# libsndfile
![C/C++ CI](https://github.com/libsndfile/libsndfile/workflows/C/C++%20CI/badge.svg)
libsndfile is a C library for reading and writing files containing sampled audio
data.
## Authors
The libsndfile project was originally developed and maintained by
Erik de Castro Lopo <erikd@mega-nerd.com> aka @erikd. The project was developed
on Github at <https://github.com/erikd/libsndfile>.
After the release of version 1.0.30, @erikd transferred the project to
[the libsndfile team](https://github.com/libsndfile), see [AUTHORS](AUTHORS)
for details.
## Hacking
The canonical source code repository for libsndfile is at
<https://github.com/libsndfile/libsndfile>.
You can grab the source code using:
git clone https://github.com/libsndfile/libsndfile.git
For building for Android see [BuildingForAndroid][BuildingForAndroid].
There are currently two build systems: the traditional GNU autotool based one and
modern CMake based build system. Use of the CMake build system is documented
below.
Setting up a build environment for libsndfile on Debian or Ubuntu is as simple as:
sudo apt install autoconf autogen automake build-essential libasound2-dev \
libflac-dev libogg-dev libtool libvorbis-dev libopus-dev libmp3lame-dev \
libmpg123-dev pkg-config python
For other Linux distributions or any of the *BSDs, the setup should be similar
although the package install tools and package names may be slightly different.
Similarly on Mac OS X, assuming [brew] is already installed:
brew install autoconf autogen automake flac libogg libtool libvorbis opus mpg123 pkg-config
Once the build environment has been set up, building and testing libsndfile is
as simple as:
autoreconf -vif
./configure --enable-werror
make
make check
## The CMake build system
Although Autotools is the primary and recommended build toolchain, CMake meta
build generator is also available. The build process with CMake takes
place in two stages. First, standard build files are created from configuration
scripts. Then the platform's native build tools are used for the actual
building. CMake can produce Microsoft Visual Studio project and solution files,
Unix Makefiles, Xcode projects and [many more](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
Some IDE support CMake natively or with plugins, check you IDE documentation
for details.
### Requirements
1. C99-compliant compiler toolchain (tested with GCC, Clang and Visual
Studio 2015)
2. CMake 3.1.3 or newer
There are some recommended packages to enable all features of libsndfile:
1. Ogg, Vorbis and FLAC libraries and headers to enable these formats support
2. ALSA development package under Linux to build sndfile-play utility
3. Sndio development package under BSD to build sndfile-play utility
### Building from command line
CMake can handle out-of-place builds, enabling several builds from
the same source tree, and cross-compilation. The ability to build a directory
tree outside the source tree is a key feature, ensuring that if a build
directory is removed, the source files remain unaffected.
mkdir CMakeBuild
cd CMakeBuild
Then run `cmake` command with directory where CMakeLists.txt script is located
as argument (relative paths are supported):
cmake ..
This command will configure and write build script or solution to CMakeBuild
directory. CMake is smart enough to create Unix makefiles under Linux or Visual
Studio solution if you have Visual Studio installed, but you can configure
[generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
with `-G` command line parameter:
cmake .. -G"Unix Makefiles"
The build procedure depends on the selected generator. With "Unix Makefiles" you
can type:
make & make install
With "Visual Studio" and some other generators you can open solution or project
from `CMakeBuild` directory and build using IDE.
Finally, you can use unified command:
cmake --build .
CMake also provides Qt-based cross platform GUI, cmake-gui. Using it is trivial
and does not require detailed explanations.
### Configuring CMake
You can pass additional options with `/D<parameter>=<value>` when you run
`cmake` command. Some useful system options:
* `CMAKE_C_FLAGS` - additional C compiler flags
* `CMAKE_BUILD_TYPE` - configuration type, `DEBUG`, `RELEASE`, `RELWITHDEBINFO`
or `MINSIZEREL`. `DEBUG` is default
* `CMAKE_INSTALL_PREFIX` - build install location, the same as `--prefix` option
of `configure` script
Useful libsndfile options:
* `BUILD_SHARED_LIBS` - build shared library (DLL under Windows) when `ON`,
build static library othervise. This option is `OFF` by default.
* `BUILD_PROGRAMS` - build libsndfile's utilities from `programs/` directory,
`ON` by default.
* `BUILD_EXAMPLES` - build examples, `ON` by default.
* `BUILD_TESTING` - build tests. Then you can run tests with `ctest` command,
`ON` by default. Setting `BUILD_SHARED_LIBS` to `ON` disables this option.
* `ENABLE_EXTERNAL_LIBS` - enable Ogg, Vorbis, FLAC and Opus support. This
option is available and set to `ON` if all dependency libraries were found.
* `ENABLE_MPEG` - MP3 support. This option is available and set to `ON` if all
dependency libraries were found.
* `ENABLE_CPU_CLIP` - enable tricky cpu specific clipper. Enabled and set to
`ON` when CPU clips negative\positive. Don't touch it if you are not sure
* `ENABLE_BOW_DOCS` - enable black-on-white documentation theme, `OFF` by
default.
* `ENABLE_EXPERIMENTAL` - enable experimental code. Don't use it if you are
not sure. This option is `OFF` by default.
* `ENABLE_CPACK` - enable [CPack](https://cmake.org/cmake/help/latest/module/CPack.html) support.
This option is `ON` by default.
* `ENABLE_PACKAGE_CONFIG` - generate and install [package config file](https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#config-file-packages).
* `INSTALL_PKGCONFIG_MODULE` - generate and install [pkg-config module](https://people.freedesktop.org/~dbn/pkg-config-guide.html).
* `INSTALL_MANPAGES` - install [man pages](https://en.wikipedia.org/wiki/Man_page) for programs. This option is `ON` by default
* `ENABLE_STATIC_RUNTIME` - enable static runtime on Windows platform (MSVC and
MinGW), `OFF` by default.
**Note**: For MSVC compiler this option is deprecated for CMake >= 3.15, see
policy [CMP0091](https://cmake.org/cmake/help/latest/policy/CMP0091.html).
Use `CMAKE_MSVC_RUNTIME_LIBRARY` option instead.
**Note**: For MinGW toolchain this option is experimental. If you enabled it
and then disabled again, you need to clear CMake cache (delete CMakeCache.txt).
* `ENABLE_COMPATIBLE_LIBSNDFILE_NAME` - set DLL name to `libsndfile-1.dll`
(canonical name) on Windows platform, `sndfile.dll` otherwise, `OFF` by
default. Library name can be different depending on platform. The well known
DLL name on Windows platform is `libsndfile-1.dll`, because the only way to
build Windows library before was MinGW toolchain with Autotools. This name
is native for MinGW ecosystem, Autotools constructs it using MinGW platform
rules from `sndfile` target. But when you build with CMake using native
Windows compiler, the name is `sndfile.dll`. This is name for native Windows
platform, because Windows has no library naming rules. It is preffered
because you can search library using package manager or CMake's
`find_library` command on any platform using the same `sndfile` name.
* `ENABLE_SSE2` - add compiler flag to enable SSE2 if required, `ON` by default.
This option is for X86 and GCC compatible compilers configurations only.
If you compile for other SIMD set, e.g. AVX2, you may want to set
`ENABLE_SSE2` to `OFF`.
**Note**: This option is not active for X64 configuration, because SSE2
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
QListView 自定义数据模型(增、删、改以及选中项文字滚动) (573个子文件)
benchmark-1.0.0 1KB
benchmark-1.0.0rc2 1KB
sndfile-convert.1 3KB
sndfile-metadata-get.1 3KB
sndfile-interleave.1 2KB
sndfile-info.1 830B
sndfile-salvage.1 769B
sndfile-cmp.1 759B
sndfile-concat.1 756B
sndfile-play.1 688B
benchmark-1.0.18pre16-hendrix 2KB
benchmark-1.0.18pre16-mingus 2KB
benchmark-0.0.28 2KB
benchmark-1.0.6pre10-coltrane 2KB
benchmark-1.0.6pre10-miles 2KB
configure.ac 26KB
Makefile.am 21KB
Makefile.am 3KB
Makefile.am 106B
Makefile.am 94B
Makefile.am 86B
AUTHORS 12KB
benchmark-latest-coltrane 3KB
window.c 126KB
lossy_comp_test.c 100KB
sndfile.c 99KB
sndfile.c 99KB
pcm.c 80KB
pcm.c 80KB
vorbisfile.c 74KB
framing.c 66KB
command_test.c 64KB
ogg_opus.c 61KB
ogg_opus.c 61KB
ulaw.c 61KB
ulaw.c 61KB
aiff.c 59KB
aiff.c 59KB
wav.c 55KB
wav.c 55KB
wavlike.c 51KB
wavlike.c 51KB
common.c 49KB
common.c 49KB
alac_encoder.c 46KB
flac.c 44KB
flac.c 44KB
vorbisenc.c 38KB
ogg_vorbis.c 35KB
ogg_vorbis.c 35KB
psy.c 35KB
xi.c 34KB
xi.c 34KB
nms_adpcm.c 32KB
nms_adpcm.c 32KB
caf.c 32KB
caf.c 32KB
string_test.c 31KB
floor1.c 30KB
block.c 30KB
bitwise.c 30KB
double64.c 29KB
double64.c 29KB
rf64.c 29KB
rf64.c 29KB
sds.c 29KB
sds.c 29KB
ima_adpcm.c 29KB
ima_adpcm.c 29KB
file_io.c 28KB
file_io.c 28KB
mapping0.c 28KB
alac.c 28KB
alac.c 28KB
ogg.c 28KB
ogg.c 28KB
float32.c 28KB
float32.c 28KB
voc.c 27KB
voc.c 27KB
ms_adpcm.c 25KB
ms_adpcm.c 25KB
long_term.c 25KB
sndfile-play.c 24KB
res0.c 24KB
alaw.c 24KB
alaw.c 24KB
paf.c 24KB
paf.c 24KB
mpeg_l3_encode.c 24KB
mpeg_l3_encode.c 24KB
smallft.c 22KB
w64.c 21KB
w64.c 21KB
alac_decoder.c 21KB
mpeg_decode.c 19KB
mpeg_decode.c 19KB
info.c 19KB
sd2.c 19KB
sd2.c 19KB
共 573 条
- 1
- 2
- 3
- 4
- 5
- 6
码农客栈
- 粉丝: 948
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页