mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-26 19:40:24 +00:00
Merge from -mdev branch.
This commit is contained in:
commit
019dbf5056
137
ChangeLog
137
ChangeLog
@ -1,3 +1,140 @@
|
||||
2008-10-13 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* tests/command_test.c
|
||||
Add test function instrument_rw_test, but don't hook it into the testing
|
||||
yet.
|
||||
|
||||
* src/common.h src/command.c src/sndfile.c src/flac.c
|
||||
Error code rationalization.
|
||||
|
||||
* src/common.h src/sndfile.c
|
||||
Set psf->error to SFE_CMD_HAS_DATA when adding metadata via sf_command()
|
||||
fails due to psf->have_written being true.
|
||||
|
||||
* doc/command.html
|
||||
Document the SFC_GET/SET_BROADCAST_INFO comamnds.
|
||||
|
||||
2008-10-10 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* tests/command_test.c
|
||||
Improve error reporting when '\0' is found in coding history.
|
||||
Fix false failure.
|
||||
|
||||
2008-10-09 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/broadcast.c
|
||||
Convert all coding history line endings to \r\n.
|
||||
|
||||
* tests/command_test.c
|
||||
Add test to make sure all line endings are converted to \r\n.
|
||||
|
||||
2008-10-08 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/broadcast.c
|
||||
Changed the order of coding history fields.
|
||||
|
||||
* tests/command_test.c
|
||||
Update bextch test to cope with previous change.
|
||||
|
||||
* examples/common.c
|
||||
Add extra length check when copying broadcast info data.
|
||||
|
||||
2008-10-05 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* tests/utils.tpl tests/pcm_test.tpl
|
||||
Update check_file_hash_or_die to use 64 bit hash.
|
||||
|
||||
* tests/checksum_test.c tests/Makefile.am
|
||||
Add new checksum_test specifically for lossy compression of headerless
|
||||
files.
|
||||
|
||||
2008-10-04 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/gsm610.c
|
||||
Seek to psf->dataoffset before decoding first block.
|
||||
|
||||
* src/sndfile.c
|
||||
Fix detection of mpc2k files on big endian systems.
|
||||
|
||||
2008-10-03 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/broadcast.c
|
||||
Use '\r\n' newlines in Coding History as required by spec.
|
||||
|
||||
2008-10-02 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/test_conversions.c
|
||||
Use int64_t instead of 'long long'.
|
||||
|
||||
2008-10-01 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* examples/sndfile-metadata-set.c
|
||||
Remove --bext-coding-history-append command line option because it didn't
|
||||
really make sense.
|
||||
|
||||
* examples/sndfile-metadata-(get|set).c
|
||||
Add usage messages.
|
||||
|
||||
* examples/test-sndfile-metadata-set.py
|
||||
Start work on test coding history.
|
||||
|
||||
2008-09-30 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* README doc/win32.html
|
||||
Bring these up to date.
|
||||
|
||||
* src/aiff.c
|
||||
Fix parsing of REX files.
|
||||
|
||||
2008-09-29 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/file_io.c
|
||||
Use intptr_t instead of long for return value of _get_osfhandle.
|
||||
|
||||
* src/test_conversions.c src/test_endswap.tpl
|
||||
Fix printing of int64_t values.
|
||||
|
||||
* examples/sndfile-play.c
|
||||
Fix win64 issues.
|
||||
|
||||
* tests/win32_ordinal_test.c
|
||||
Fix calling of GetProcAddress with ordinal under win64.
|
||||
|
||||
* tests/utils.tpl
|
||||
Fix win64 issues.
|
||||
|
||||
2008-09-25 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* examples/*
|
||||
Rename copy_data.[ch] to common.[ch]. Fix build.
|
||||
Move code from sndfile-metadata-set.c to common.c.
|
||||
|
||||
* examples/Makefile.am tests/Makefile.am regtest/Makefile.am
|
||||
Clean paths.
|
||||
|
||||
2008-09-19 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* doc/tutorial.html doc/Makefile.am
|
||||
Add file doc/tutorial.html and hook into build/dist system.
|
||||
|
||||
2008-09-14 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* examples/sndfile-metadata-set.c
|
||||
Clean up handling of bext command line params.
|
||||
|
||||
2008-09-13 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/w64.c
|
||||
Add handling/skipping of a couple of new chunk types.
|
||||
|
||||
2008-09-09 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* configure.ac
|
||||
Add -funsigned-char to CFLAGS if the compiler supports it.
|
||||
|
||||
* examples/sndfile-metadata-(get|set).c
|
||||
Add handling for more metadata types.
|
||||
|
||||
2008-09-04 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/common.h
|
||||
|
68
README
68
README
@ -1,28 +1,19 @@
|
||||
This is libsndfile, 1.0.17
|
||||
|
||||
libsndfile is a library of C routines for reading and writing
|
||||
files containing sampled audio data.
|
||||
libsndfile is a library of C routines for reading and writing
|
||||
files containing sampled audio data.
|
||||
|
||||
The src/ directory contains the source code for library itself.
|
||||
|
||||
The doc/ directory contains the libsndfile documentation.
|
||||
|
||||
The examples/ directory contains examples of how to write code using
|
||||
libsndfile. 'wav32_aiff24' converts a WAV file containing 32 bit floating
|
||||
point data into a 24 bit PCM AIFF file. 'sndfile2oct' dumps the audio
|
||||
data of a file in a human readable format. 'sfconvert' is the beginnings
|
||||
of a audio file format conversion utility. 'make_sine' generates a WAV
|
||||
file containing one cycle of a sine wave with 4096 sample points in
|
||||
32 bit floating point format. 'sfinfo' opens a sound file and prints
|
||||
out information about that file.
|
||||
libsndfile.
|
||||
|
||||
The tests/ directory contains programs which link against libsndfile
|
||||
and test its functionality.
|
||||
|
||||
The Win32/ directory contains files and documentation to allow libsndfile
|
||||
to compile under Win32 with the Microsoft Visual C++ compiler.
|
||||
|
||||
The src/GSM610 directory contains code written by Jutta Degener and Carsten
|
||||
The src/GSM610 directory contains code written by Jutta Degener and Carsten
|
||||
Bormann. Their original code can be found at :
|
||||
http://kbs.cs.tu-berlin.de/~jutta/toast.html
|
||||
|
||||
@ -30,41 +21,44 @@ The src/G72x directory contains code written and released by Sun Microsystems
|
||||
under a suitably free license.
|
||||
|
||||
|
||||
Win32
|
||||
LINUX
|
||||
-----
|
||||
There are detailed instructions for building libsndfile on Win32 in the file
|
||||
Whereever possible, you should use the packages supplied by your Linux
|
||||
distribution.
|
||||
|
||||
If you really do need to compile from source it should be as easy as:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
Since libsndfile optionally links against libFLAC, libogg and libvorbis, you
|
||||
will need to install appropriate versions of these libraries before running
|
||||
configure as above.
|
||||
|
||||
|
||||
UNIX
|
||||
----
|
||||
Compile as for Linux.
|
||||
|
||||
|
||||
Win32/Win64
|
||||
-----------
|
||||
The default Windows compilers are nowhere near compliant with the 1999 ISO
|
||||
C Standard and hence not able to compile libsndfile.
|
||||
|
||||
Please use the libsndfile binaries available on the libsndfile web site.
|
||||
|
||||
doc/win32.html
|
||||
|
||||
|
||||
MacOSX
|
||||
------
|
||||
Building on MacOSX should be the same as building it on any other Unix.
|
||||
|
||||
|
||||
OTHER PLATFORMS
|
||||
---------------
|
||||
To compile libsndfile on platforms which have a Bourne Shell compatible
|
||||
shell, an ANSI C compiler and a make utility should require no more that
|
||||
the following three commands :
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
For platforms without the required shell, it is usually sufficient to
|
||||
create an approriate config.h file in the src/ directory with correct
|
||||
values for the following #defines (this would work for AmigaOS) :
|
||||
|
||||
#define HAVE_ENDIAN_H 0
|
||||
#define GUESS_BIG_ENDIAN 1
|
||||
#define GUESS_LITTLE_ENDIAN 0
|
||||
#define FORCE_BROKEN_FLOAT 0
|
||||
|
||||
|
||||
CONTACTS
|
||||
--------
|
||||
|
||||
libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||
libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||
The libsndfile home page is at :
|
||||
|
||||
http://www.mega-nerd.com/libsndfile/
|
||||
|
@ -1,396 +0,0 @@
|
||||
# MinGW specific Makefile for libsndfile.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
PROGRAMS = sndfile-info.exe sndfile-play.exe sndfile-convert.exe
|
||||
TARGETS = libsndfile.dll $(PROGRAMS) sndfile.pc src/sndfile.h
|
||||
|
||||
AR = @AR@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@ -Isrc
|
||||
COMPILER_IS_GCC = @COMPILER_IS_GCC@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DLLWRAP = @DLLWRAP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
install_sh = @install_sh@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LN_S = @LN_S@
|
||||
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
|
||||
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
|
||||
PEXPORTS = @PEXPORTS@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
RANLIB = @RANLIB@
|
||||
STRIP = @STRIP@
|
||||
|
||||
#====================================================================
|
||||
# Target directories.
|
||||
|
||||
bindir = @bindir@
|
||||
exec_prefix = @exec_prefix@
|
||||
htmldocdir = @htmldocdir@
|
||||
includedir = @includedir@
|
||||
libdir = @libdir@
|
||||
pkgconfigdir = @libdir@/pkgconfig
|
||||
prefix = @prefix@
|
||||
|
||||
#====================================================================
|
||||
# Targets
|
||||
|
||||
all : $(TARGETS)
|
||||
|
||||
clean :
|
||||
rm -f $(TARGETS) *.del *.lib src/*.o src/G72x/*.o \
|
||||
src/GSM610/*.o tests/*.o tests/*.exe
|
||||
|
||||
install : $(TARGETS)
|
||||
$(install_sh) -c libsndfile.dll $(libdir)
|
||||
$(install_sh) -c sndfile.pc $(pkgconfigdir)
|
||||
@for prog in $(PROGRAMS); do \
|
||||
echo "installing ... $$prog" ; \
|
||||
$(install_sh) -c "$$prog" $(bindir) ; \
|
||||
done;
|
||||
$(install_sh) -c src/sndfile.h $(includedir)
|
||||
|
||||
uninstall :
|
||||
rm -f $(libdir)/libsndfile.dll
|
||||
rm -f $(pkgconfigdir)/sndfile.pc
|
||||
@for prog in $(PROGRAMS); do \
|
||||
rm -f $(bindir)/"$$prog" ; \
|
||||
done;
|
||||
rm -f $(includedir)/sndfile.h
|
||||
|
||||
#====================================================================
|
||||
|
||||
LINK_OBJS = \
|
||||
src/GSM610/add.o \
|
||||
src/GSM610/code.o \
|
||||
src/GSM610/decode.o \
|
||||
src/GSM610/gsm_create.o \
|
||||
src/GSM610/gsm_decode.o \
|
||||
src/GSM610/gsm_destroy.o \
|
||||
src/GSM610/gsm_encode.o \
|
||||
src/GSM610/gsm_option.o \
|
||||
src/GSM610/long_term.o \
|
||||
src/GSM610/lpc.o \
|
||||
src/GSM610/preprocess.o \
|
||||
src/GSM610/rpe.o \
|
||||
src/GSM610/short_term.o \
|
||||
src/GSM610/table.o \
|
||||
src/G72x/g721.o \
|
||||
src/G72x/g723_16.o \
|
||||
src/G72x/g723_24.o \
|
||||
src/G72x/g723_40.o \
|
||||
src/G72x/g72x.o \
|
||||
src/aiff.o \
|
||||
src/alaw.o \
|
||||
src/au.o \
|
||||
src/au_g72x.o \
|
||||
src/avr.o \
|
||||
src/common.o \
|
||||
src/double64.o \
|
||||
src/dwvw.o \
|
||||
src/file_io.o \
|
||||
src/dither.o \
|
||||
src/float32.o \
|
||||
src/command.o \
|
||||
src/strings.o \
|
||||
src/ima_adpcm.o \
|
||||
src/ms_adpcm.o \
|
||||
src/nist.o \
|
||||
src/ircam.o \
|
||||
src/paf.o \
|
||||
src/pcm.o \
|
||||
src/raw.o \
|
||||
src/rx2.o \
|
||||
src/sd2.o \
|
||||
src/sndfile.o \
|
||||
src/svx.o \
|
||||
src/txw.o \
|
||||
src/sds.o \
|
||||
src/ulaw.o \
|
||||
src/voc.o \
|
||||
src/w64.o \
|
||||
src/wav.o \
|
||||
src/gsm610.o \
|
||||
src/wav_w64.o \
|
||||
src/dwd.o \
|
||||
src/wve.o \
|
||||
src/mat4.o \
|
||||
src/mat5.o \
|
||||
src/vox_adpcm.o \
|
||||
src/ogg.o \
|
||||
src/pvf.o \
|
||||
src/xi.o \
|
||||
src/htk.o
|
||||
|
||||
libsndfile.dll libsndfile.lib : $(LINK_OBJS)
|
||||
$(DLLWRAP) --def src/libsndfile.def $(LINK_OBJS) --output-lib libsndfile.lib -o libsndfile.dll
|
||||
$(STRIP) libsndfile.dll
|
||||
|
||||
sndfile-info.exe : examples/sndfile-info.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
sndfile-convert.exe : examples/sndfile-convert.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
sndfile-play.exe : examples/sndfile-play.o libsndfile.lib
|
||||
$(CC) $+ -lwinmm -o $@
|
||||
|
||||
generate.exe : examples/generate.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
sndfile.pc : sndfile.pc.in config.status
|
||||
@./config.status $@
|
||||
|
||||
config.status :
|
||||
./configure
|
||||
|
||||
#====================================================================
|
||||
# Testing programs.
|
||||
|
||||
TEST_PROGS = \
|
||||
src/test_file_io.exe \
|
||||
src/test_log_printf.exe \
|
||||
tests/sfversion.exe \
|
||||
tests/error_test.exe \
|
||||
tests/pcm_test.exe \
|
||||
tests/ulaw_test.exe \
|
||||
tests/alaw_test.exe \
|
||||
tests/dwvw_test.exe \
|
||||
tests/command_test.exe \
|
||||
tests/floating_point_test.exe \
|
||||
tests/headerless_test.exe \
|
||||
tests/write_read_test.exe \
|
||||
tests/lossy_comp_test.exe \
|
||||
tests/peak_chunk_test.exe \
|
||||
tests/misc_test.exe \
|
||||
tests/string_test.exe \
|
||||
tests/win32_test.exe \
|
||||
tests/stdio_test.exe \
|
||||
tests/stdin_test.exe \
|
||||
tests/stdout_test.exe \
|
||||
tests/pipe_test.exe \
|
||||
tests/benchmark.exe
|
||||
|
||||
check : $(TEST_PROGS)
|
||||
@echo
|
||||
@echo
|
||||
@echo
|
||||
@echo "============================================================"
|
||||
src/test_file_io.exe
|
||||
src/test_log_printf.exe
|
||||
@echo "============================================================"
|
||||
@echo
|
||||
@echo
|
||||
@echo
|
||||
tests/error_test.exe
|
||||
tests/pcm_test.exe
|
||||
tests/ulaw_test.exe
|
||||
tests/alaw_test.exe
|
||||
tests/dwvw_test.exe
|
||||
tests/command_test.exe ver
|
||||
tests/command_test.exe norm
|
||||
tests/command_test.exe format
|
||||
tests/floating_point_test.exe
|
||||
tests/headerless_test.exe
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo "passed common tests"
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test wav
|
||||
tests/lossy_comp_test wav_ima
|
||||
tests/lossy_comp_test wav_msadpcm
|
||||
tests/lossy_comp_test wav_ulaw
|
||||
tests/lossy_comp_test wav_alaw
|
||||
tests/lossy_comp_test wav_gsm610
|
||||
tests/peak_chunk_test wav
|
||||
tests/misc_test wav
|
||||
tests/string_test wav
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo "passed tests on WAV files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test aiff
|
||||
tests/lossy_comp_test aiff_ulaw
|
||||
tests/lossy_comp_test aiff_alaw
|
||||
tests/peak_chunk_test aiff
|
||||
tests/misc_test aiff
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on AIFF files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test au
|
||||
tests/lossy_comp_test au_ulaw
|
||||
tests/lossy_comp_test au_alaw
|
||||
tests/lossy_comp_test au_g721
|
||||
tests/lossy_comp_test au_g723
|
||||
tests/misc_test au
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on AU files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test raw
|
||||
tests/lossy_comp_test raw_ulaw
|
||||
tests/lossy_comp_test raw_alaw
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on RAW (header-less) files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test paf
|
||||
tests/misc_test paf
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on PAF files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test svx
|
||||
tests/misc_test svx
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on SVX files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test nist
|
||||
tests/misc_test nist
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on NIST files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test ircam
|
||||
tests/lossy_comp_test ircam_ulaw
|
||||
tests/lossy_comp_test ircam_alaw
|
||||
tests/misc_test ircam
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on IRCAM files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test voc
|
||||
tests/lossy_comp_test voc_ulaw
|
||||
tests/lossy_comp_test voc_alaw
|
||||
tests/misc_test voc
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on VOC files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test w64
|
||||
tests/lossy_comp_test w64_ima
|
||||
tests/lossy_comp_test w64_msadpcm
|
||||
tests/lossy_comp_test w64_ulaw
|
||||
tests/lossy_comp_test w64_alaw
|
||||
tests/lossy_comp_test w64_gsm610
|
||||
tests/misc_test w64
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on W64 files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test mat4
|
||||
tests/misc_test mat4
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on MAT4 files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test mat5
|
||||
tests/misc_test mat5
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on MAT5 files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test htk
|
||||
tests/misc_test htk
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on HTK files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
tests/write_read_test avr
|
||||
tests/misc_test avr
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed tests on AVR files."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/stdio_test.exe
|
||||
@tests/pipe_test.exe
|
||||
@echo "----------------------------------------------------------------------"
|
||||
@tests/sfversion.exe
|
||||
@echo " passed all tests."
|
||||
@echo "----------------------------------------------------------------------"
|
||||
|
||||
#====================================================================
|
||||
# Test programs.
|
||||
|
||||
src/test_file_io.exe : src/file_io.o src/test_file_io.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
# Special case : test_log_printf.c #includes common.c
|
||||
src/test_log_printf.exe : src/test_log_printf.c src/common.c libsndfile.lib
|
||||
$(CC) $(CFLAGS) -c src/test_log_printf.c -o src/test_log_printf.o
|
||||
$(CC) src/test_log_printf.o libsndfile.lib -o $@
|
||||
|
||||
tests/sfversion.exe : tests/sfversion.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/error_test.exe : tests/error_test.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/pcm_test.exe : tests/pcm_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/ulaw_test.exe : tests/ulaw_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/alaw_test.exe : tests/alaw_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/dwvw_test.exe : tests/dwvw_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/command_test.exe : tests/command_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/floating_point_test.exe : tests/floating_point_test.o tests/utils.o tests/dft_cmp.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/headerless_test.exe : tests/headerless_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/write_read_test.exe : tests/write_read_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/lossy_comp_test.exe : tests/lossy_comp_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/peak_chunk_test.exe : tests/peak_chunk_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/misc_test.exe : tests/misc_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/string_test.exe : tests/string_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/win32_test.exe : tests/win32_test.o
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/stdio_test.exe : tests/stdio_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/pipe_test.exe : tests/pipe_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/stdin_test.exe : tests/stdin_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/stdout_test.exe : tests/stdout_test.o tests/utils.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
tests/benchmark.exe : tests/benchmark.o libsndfile.lib
|
||||
$(CC) $+ -o $@
|
||||
|
||||
# End of Makefile
|
||||
#====================================================================
|
@ -1,571 +0,0 @@
|
||||
|
||||
# Set the value of $(MSVCDir) for your installation.
|
||||
# Please note that none of the directory names are allowed to have spaces
|
||||
# in them. You must use the short name.
|
||||
#
|
||||
# "C:\Program Files\Microsoft Visual Studio\VC98" will not work.
|
||||
# "C:\Progra~1\Micros~1\VC98" will work.
|
||||
|
||||
MSVCDir="C:\Progra~1\Micros~1\VC98"
|
||||
|
||||
CPP=cl.exe
|
||||
LINK32=link.exe
|
||||
DLL_LINK_FLAGS=/nologo /dll /incremental:no /libpath:"$(MSVCDir)\Lib" /pdb:"libsndfile.pdb" /implib:".\libsndfile.lib" /machine:I386 /out:"libsndfile.dll"
|
||||
PROG_LINK_FLAGS=/nologo /incremental:no /libpath:"$(MSVCDir)\Lib" /pdb:"libsndfile.pdb" /machine:I386 /exetype:dynamic
|
||||
|
||||
CFLAGS=/nologo /MD /W1 /GX /O2 /I "$(MSVCDir)\Include" /I "src" /D "WIN32" /D "_USRDLL" /D "inline=__inline" /YX /FD
|
||||
|
||||
#====================================================================
|
||||
# Targets
|
||||
|
||||
ALL : libsndfile.dll \
|
||||
"sndfile-info.exe" \
|
||||
"sndfile-convert.exe" \
|
||||
"sndfile-play.exe" \
|
||||
"generate.exe"
|
||||
|
||||
CLEAN :
|
||||
-@erase "src\*.obj"
|
||||
-@erase "src\G72x\*.obj"
|
||||
-@erase "src\GSM610\*.obj"
|
||||
-@erase "tests\*.obj"
|
||||
-@erase "tests\*.exe"
|
||||
|
||||
#====================================================================
|
||||
|
||||
LINK32_OBJS= \
|
||||
".\src\GSM610\add.obj" \
|
||||
".\src\GSM610\code.obj" \
|
||||
".\src\GSM610\decode.obj" \
|
||||
".\src\GSM610\gsm_create.obj" \
|
||||
".\src\GSM610\gsm_decode.obj" \
|
||||
".\src\GSM610\gsm_destroy.obj" \
|
||||
".\src\GSM610\gsm_encode.obj" \
|
||||
".\src\GSM610\gsm_option.obj" \
|
||||
".\src\GSM610\long_term.obj" \
|
||||
".\src\GSM610\lpc.obj" \
|
||||
".\src\GSM610\preprocess.obj" \
|
||||
".\src\GSM610\rpe.obj" \
|
||||
".\src\GSM610\short_term.obj" \
|
||||
".\src\GSM610\table.obj" \
|
||||
".\src\G72x\g721.obj" \
|
||||
".\src\G72x\g723_16.obj" \
|
||||
".\src\G72x\g723_24.obj" \
|
||||
".\src\G72x\g723_40.obj" \
|
||||
".\src\G72x\g72x.obj" \
|
||||
".\src\aiff.obj" \
|
||||
".\src\alaw.obj" \
|
||||
".\src\au.obj" \
|
||||
".\src\g72x.obj" \
|
||||
".\src\avr.obj" \
|
||||
".\src\common.obj" \
|
||||
".\src\double64.obj" \
|
||||
".\src\dwvw.obj" \
|
||||
".\src\file_io.obj" \
|
||||
".\src\dither.obj" \
|
||||
".\src\float32.obj" \
|
||||
".\src\command.obj" \
|
||||
".\src\strings.obj" \
|
||||
".\src\ima_adpcm.obj" \
|
||||
".\src\ms_adpcm.obj" \
|
||||
".\src\nist.obj" \
|
||||
".\src\ircam.obj" \
|
||||
".\src\paf.obj" \
|
||||
".\src\pcm.obj" \
|
||||
".\src\raw.obj" \
|
||||
".\src\rx2.obj" \
|
||||
".\src\sd2.obj" \
|
||||
".\src\sndfile.obj" \
|
||||
".\src\svx.obj" \
|
||||
".\src\txw.obj" \
|
||||
".\src\sds.obj" \
|
||||
".\src\ulaw.obj" \
|
||||
".\src\voc.obj" \
|
||||
".\src\w64.obj" \
|
||||
".\src\wav.obj" \
|
||||
".\src\gsm610.obj" \
|
||||
".\src\wav_w64.obj" \
|
||||
".\src\dwd.obj" \
|
||||
".\src\wve.obj" \
|
||||
".\src\mat4.obj" \
|
||||
".\src\mat5.obj" \
|
||||
".\src\vox_adpcm.obj" \
|
||||
".\src\ogg.obj" \
|
||||
".\src\pvf.obj" \
|
||||
".\src\xi.obj" \
|
||||
".\src\htk.obj" \
|
||||
".\src\flac.obj" \
|
||||
".\src\caf.obj"
|
||||
|
||||
libsndfile.dll : $(LINK32_OBJS) ".\src\libsndfile.def"
|
||||
$(LINK32) $(DLL_LINK_FLAGS) /def:".\src\libsndfile.def" $(LINK32_OBJS)
|
||||
|
||||
"sndfile-info.exe" : ".\examples\sndfile-info.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\examples\sndfile-info.obj" /c ".\examples\sndfile-info.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:"sndfile-info.exe" ".\examples\sndfile-info.obj" libsndfile.lib
|
||||
|
||||
"sndfile-convert.exe" : ".\examples\sndfile-convert.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\examples\sndfile-convert.obj" /c ".\examples\sndfile-convert.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:"sndfile-convert.exe" ".\examples\sndfile-convert.obj" libsndfile.lib
|
||||
|
||||
"sndfile-play.exe" : ".\examples\sndfile-play.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\examples\sndfile-play.obj" /c ".\examples\sndfile-play.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:"sndfile-play.exe" ".\examples\sndfile-play.obj" libsndfile.lib winmm.lib
|
||||
|
||||
"generate.exe" : ".\examples\generate.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\examples\generate.obj" /c ".\examples\generate.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:"generate.exe" ".\examples\generate.obj" libsndfile.lib
|
||||
|
||||
TEST_PROGS= \
|
||||
".\src\test_file_io.exe" \
|
||||
".\tests\sfversion.exe" \
|
||||
".\tests\error_test.exe" \
|
||||
".\tests\pcm_test.exe" \
|
||||
".\tests\ulaw_test.exe" \
|
||||
".\tests\alaw_test.exe" \
|
||||
".\tests\dwvw_test.exe" \
|
||||
".\tests\command_test.exe" \
|
||||
".\tests\floating_point_test.exe" \
|
||||
".\tests\headerless_test.exe" \
|
||||
".\tests\write_read_test.exe" \
|
||||
".\tests\lossy_comp_test.exe" \
|
||||
".\tests\peak_chunk_test.exe" \
|
||||
".\tests\misc_test.exe" \
|
||||
".\tests\string_test.exe" \
|
||||
".\tests\win32_test.exe" \
|
||||
".\tests\stdio_test.exe" \
|
||||
".\tests\pipe_test.exe" \
|
||||
".\tests\benchmark.exe"
|
||||
|
||||
CHECK: $(TEST_PROGS)
|
||||
".\src\test_file_io.exe"
|
||||
".\tests\error_test.exe"
|
||||
".\tests\pcm_test.exe"
|
||||
".\tests\ulaw_test.exe"
|
||||
".\tests\alaw_test.exe"
|
||||
".\tests\dwvw_test.exe"
|
||||
".\tests\command_test.exe" ver
|
||||
".\tests\command_test.exe" norm
|
||||
".\tests\command_test.exe" format
|
||||
".\tests\floating_point_test.exe"
|
||||
".\tests\headerless_test.exe"
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo passed common tests
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" wav
|
||||
".\tests\lossy_comp_test" wav_ima
|
||||
".\tests\lossy_comp_test" wav_msadpcm
|
||||
".\tests\lossy_comp_test" wav_ulaw
|
||||
".\tests\lossy_comp_test" wav_alaw
|
||||
".\tests\lossy_comp_test" wav_gsm610
|
||||
".\tests\peak_chunk_test" wav
|
||||
".\tests\misc_test" wav
|
||||
".\tests\string_test" wav
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo "passed tests on WAV files.
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" aiff
|
||||
".\tests\lossy_comp_test" aiff_ulaw
|
||||
".\tests\lossy_comp_test" aiff_alaw
|
||||
".\tests\peak_chunk_test" aiff
|
||||
".\tests\misc_test" aiff
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on AIFF files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" au
|
||||
".\tests\lossy_comp_test" au_ulaw
|
||||
".\tests\lossy_comp_test" au_alaw
|
||||
".\tests\lossy_comp_test" au_g721
|
||||
".\tests\lossy_comp_test" au_g723
|
||||
".\tests\misc_test" au
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on AU files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" caf
|
||||
".\tests\lossy_comp_test" caf_ulaw
|
||||
".\tests\lossy_comp_test" caf_alaw
|
||||
".\tests\misc_test" caf
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@echo `./sfversion` passed tests on CAF files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" raw
|
||||
".\tests\lossy_comp_test" raw_ulaw
|
||||
".\tests\lossy_comp_test" raw_alaw
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on RAW (header-less) files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" paf
|
||||
".\tests\misc_test" paf
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on PAF files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" svx
|
||||
".\tests\misc_test" svx
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on SVX files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" nist
|
||||
".\tests\misc_test" nist
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on NIST files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" ircam
|
||||
".\tests\lossy_comp_test" ircam_ulaw
|
||||
".\tests\lossy_comp_test" ircam_alaw
|
||||
".\tests\misc_test" ircam
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on IRCAM files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" voc
|
||||
".\tests\lossy_comp_test" voc_ulaw
|
||||
".\tests\lossy_comp_test" voc_alaw
|
||||
".\tests\misc_test" voc
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on VOC files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" w64
|
||||
".\tests\lossy_comp_test" w64_ima
|
||||
".\tests\lossy_comp_test" w64_msadpcm
|
||||
".\tests\lossy_comp_test" w64_ulaw
|
||||
".\tests\lossy_comp_test" w64_alaw
|
||||
".\tests\lossy_comp_test" w64_gsm610
|
||||
".\tests\misc_test" w64
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on W64 files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" mat4
|
||||
".\tests\misc_test" mat4
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on MAT4 files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" mat5
|
||||
".\tests\misc_test" mat5
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on MAT5 files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" htk
|
||||
".\tests\misc_test" htk
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on HTK files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
".\tests\write_read_test" avr
|
||||
".\tests\misc_test" avr
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed tests on AVR files."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\stdio_test.exe"
|
||||
-@".\tests\pipe_test.exe"
|
||||
-@echo ----------------------------------------------------------------------
|
||||
-@".\tests\sfversion.exe"
|
||||
-@echo " passed all tests."
|
||||
-@echo ----------------------------------------------------------------------
|
||||
|
||||
#====================================================================
|
||||
# C files in src\GSM610.
|
||||
|
||||
".\src\GSM610\add.obj" : ".\src\Gsm610\add.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\add.obj" /c ".\src\Gsm610\add.c"
|
||||
|
||||
".\src\GSM610\code.obj" : ".\src\Gsm610\code.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\code.obj" /c ".\src\Gsm610\code.c"
|
||||
|
||||
".\src\GSM610\decode.obj" : ".\src\Gsm610\decode.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\decode.obj" /c ".\src\Gsm610\decode.c"
|
||||
|
||||
".\src\GSM610\gsm_create.obj" : ".\src\Gsm610\gsm_create.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_create.obj" /c ".\src\Gsm610\gsm_create.c"
|
||||
|
||||
".\src\GSM610\gsm_decode.obj" : ".\src\Gsm610\gsm_decode.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_decode.obj" /c ".\src\Gsm610\gsm_decode.c"
|
||||
|
||||
".\src\GSM610\gsm_destroy.obj" : ".\src\Gsm610\gsm_destroy.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_destroy.obj" /c ".\src\Gsm610\gsm_destroy.c"
|
||||
|
||||
".\src\GSM610\gsm_encode.obj" : ".\src\Gsm610\gsm_encode.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_encode.obj" /c ".\src\Gsm610\gsm_encode.c"
|
||||
|
||||
".\src\GSM610\gsm_option.obj" : ".\src\Gsm610\gsm_option.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_option.obj" /c ".\src\Gsm610\gsm_option.c"
|
||||
|
||||
".\src\GSM610\long_term.obj" : ".\src\Gsm610\long_term.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\long_term.obj" /c ".\src\Gsm610\long_term.c"
|
||||
|
||||
".\src\GSM610\lpc.obj" : ".\src\Gsm610\lpc.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\lpc.obj" /c ".\src\Gsm610\lpc.c"
|
||||
|
||||
".\src\GSM610\preprocess.obj" : ".\src\Gsm610\preprocess.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\preprocess.obj" /c ".\src\Gsm610\preprocess.c"
|
||||
|
||||
".\src\GSM610\rpe.obj" : ".\src\Gsm610\rpe.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\rpe.obj" /c ".\src\Gsm610\rpe.c"
|
||||
|
||||
".\src\GSM610\short_term.obj" : ".\src\Gsm610\short_term.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\short_term.obj" /c ".\src\Gsm610\short_term.c"
|
||||
|
||||
".\src\GSM610\table.obj" : ".\src\Gsm610\table.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\table.obj" /c ".\src\Gsm610\table.c"
|
||||
|
||||
#====================================================================
|
||||
# C files in src\G72x.
|
||||
|
||||
".\src\G72x\g721.obj" : ".\src\G72x\g721.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\G72x\g721.obj" /c ".\src\G72x\g721.c"
|
||||
|
||||
".\src\G72x\g723_16.obj" : ".\src\G72x\g723_16.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\G72x\g723_16.obj" /c ".\src\G72x\g723_16.c"
|
||||
|
||||
".\src\G72x\g723_24.obj" : ".\src\G72x\g723_24.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\G72x\g723_24.obj" /c ".\src\G72x\g723_24.c"
|
||||
|
||||
".\src\G72x\g723_40.obj" : ".\src\G72x\g723_40.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\G72x\g723_40.obj" /c ".\src\G72x\g723_40.c"
|
||||
|
||||
".\src\G72x\g72x.obj" : ".\src\G72x\g72x.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\G72x\g72x.obj" /c ".\src\G72x\g72x.c"
|
||||
|
||||
#====================================================================
|
||||
# C files in src.
|
||||
|
||||
".\src\aiff.obj" : ".\src\aiff.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\aiff.obj" /c ".\src\aiff.c"
|
||||
|
||||
".\src\alaw.obj" : ".\src\alaw.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\alaw.obj" /c ".\src\alaw.c"
|
||||
|
||||
".\src\au.obj" : ".\src\au.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\au.obj" /c ".\src\au.c"
|
||||
|
||||
".\src\g72x.obj" : ".\src\g72x.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\g72x.obj" /c ".\src\g72x.c"
|
||||
|
||||
".\src\avr.obj" : ".\src\avr.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\avr.obj" /c ".\src\avr.c"
|
||||
|
||||
".\src\common.obj" : ".\src\common.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\common.obj" /c ".\src\common.c"
|
||||
|
||||
".\src\double64.obj" : ".\src\double64.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\double64.obj" /c ".\src\double64.c"
|
||||
|
||||
".\src\dwvw.obj" : ".\src\dwvw.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\dwvw.obj" /c ".\src\dwvw.c"
|
||||
|
||||
".\src\file_io.obj" : ".\src\file_io.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\file_io.obj" /c ".\src\file_io.c"
|
||||
|
||||
".\src\dither.obj" : ".\src\dither.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\dither.obj" /c ".\src\dither.c"
|
||||
|
||||
".\src\float32.obj" : ".\src\float32.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\float32.obj" /c ".\src\float32.c"
|
||||
|
||||
".\src\command.obj" : ".\src\command.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\command.obj" /c ".\src\command.c"
|
||||
|
||||
".\src\strings.obj" : ".\src\strings.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\strings.obj" /c ".\src\strings.c"
|
||||
|
||||
".\src\ima_adpcm.obj" : ".\src\ima_adpcm.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\ima_adpcm.obj" /c ".\src\ima_adpcm.c"
|
||||
|
||||
".\src\ircam.obj" : ".\src\ircam.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\ircam.obj" /c ".\src\ircam.c"
|
||||
|
||||
".\src\ms_adpcm.obj" : ".\src\ms_adpcm.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\ms_adpcm.obj" /c ".\src\ms_adpcm.c"
|
||||
|
||||
".\src\nist.obj" : ".\src\nist.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\nist.obj" /c ".\src\nist.c"
|
||||
|
||||
".\src\paf.obj" : ".\src\paf.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\paf.obj" /c ".\src\paf.c"
|
||||
|
||||
".\src\pcm.obj" : ".\src\pcm.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\pcm.obj" /c ".\src\pcm.c"
|
||||
|
||||
".\src\raw.obj" : ".\src\raw.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\raw.obj" /c ".\src\raw.c"
|
||||
|
||||
".\src\rx2.obj" : ".\src\rx2.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\rx2.obj" /c ".\src\rx2.c"
|
||||
|
||||
".\src\sd2.obj" : ".\src\sd2.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\sd2.obj" /c ".\src\sd2.c"
|
||||
|
||||
".\src\sndfile.obj" : ".\src\sndfile.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\sndfile.obj" /c ".\src\sndfile.c"
|
||||
|
||||
".\src\svx.obj" : ".\src\svx.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\svx.obj" /c ".\src\svx.c"
|
||||
|
||||
".\src\txw.obj" : ".\src\txw.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\txw.obj" /c ".\src\txw.c"
|
||||
|
||||
".\src\sds.obj" : ".\src\sds.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\sds.obj" /c ".\src\sds.c"
|
||||
|
||||
".\src\ulaw.obj" : ".\src\ulaw.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\ulaw.obj" /c ".\src\ulaw.c"
|
||||
|
||||
".\src\voc.obj" : ".\src\voc.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\voc.obj" /c ".\src\voc.c"
|
||||
|
||||
".\src\w64.obj" : ".\src\w64.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\w64.obj" /c ".\src\w64.c"
|
||||
|
||||
".\src\wav.obj" : ".\src\wav.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\wav.obj" /c ".\src\wav.c"
|
||||
|
||||
".\src\gsm610.obj" : ".\src\gsm610.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\gsm610.obj" /c ".\src\gsm610.c"
|
||||
|
||||
".\src\wav_w64.obj" : ".\src\wav_w64.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\wav_w64.obj" /c ".\src\wav_w64.c"
|
||||
|
||||
".\src\dwd.obj" : ".\src\dwd.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\dwd.obj" /c ".\src\dwd.c"
|
||||
|
||||
".\src\wve.obj" : ".\src\wve.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\wve.obj" /c ".\src\wve.c"
|
||||
|
||||
".\src\mat4.obj" : ".\src\mat4.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\mat4.obj" /c ".\src\mat4.c"
|
||||
|
||||
".\src\mat5.obj" : ".\src\mat5.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\mat5.obj" /c ".\src\mat5.c"
|
||||
|
||||
".\src\vox_adpcm.obj" : ".\src\vox_adpcm.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\vox_adpcm.obj" /c ".\src\vox_adpcm.c"
|
||||
|
||||
".\src\ogg.obj" : ".\src\ogg.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\ogg.obj" /c ".\src\ogg.c"
|
||||
|
||||
".\src\pvf.obj" : ".\src\pvf.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\pvf.obj" /c ".\src\pvf.c"
|
||||
|
||||
".\src\xi.obj" : ".\src\xi.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\xi.obj" /c ".\src\xi.c"
|
||||
|
||||
".\src\htk.obj" : ".\src\htk.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\htk.obj" /c ".\src\htk.c"
|
||||
|
||||
".\src\flac.obj" : ".\src\flac.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\flac.obj" /c ".\src\flac.c"
|
||||
|
||||
".\src\caf.obj" : ".\src\caf.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\caf.obj" /c ".\src\caf.c"
|
||||
|
||||
#====================================================================
|
||||
# Object files for test programs.
|
||||
|
||||
".\tests\utils.obj" : ".\tests\utils.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\utils.obj" /c ".\tests\utils.c"
|
||||
|
||||
".\tests\dft_cmp.obj" : ".\tests\dft_cmp.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\dft_cmp.obj" /c ".\tests\dft_cmp.c"
|
||||
|
||||
#====================================================================
|
||||
# Test programs.
|
||||
|
||||
".\src\test_file_io.exe" : ".\src\file_io.obj" ".\src\test_file_io.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\src\test_file_io.obj" /c ".\src\test_file_io.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\src\test_file_io.exe" ".\src\test_file_io.obj" ".\src\file_io.obj"
|
||||
|
||||
".\tests\sfversion.exe" : ".\tests\sfversion.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\sfversion.obj" /c ".\tests\sfversion.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\sfversion.exe" ".\tests\sfversion.obj" libsndfile.lib
|
||||
|
||||
".\tests\error_test.exe" : ".\tests\error_test.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\error_test.obj" /c ".\tests\error_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\error_test.exe" ".\tests\error_test.obj" libsndfile.lib
|
||||
|
||||
".\tests\pcm_test.exe" : ".\tests\pcm_test.c" ".\tests\utils.obj" "libsndfile.dll"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\pcm_test.obj" /c ".\tests\pcm_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\pcm_test.exe" ".\tests\pcm_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\ulaw_test.exe" : ".\tests\ulaw_test.c" ".\tests\utils.obj" "libsndfile.dll"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\ulaw_test.obj" /c ".\tests\ulaw_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\ulaw_test.exe" ".\tests\ulaw_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\alaw_test.exe" : ".\tests\alaw_test.c" ".\tests\utils.obj" "libsndfile.dll"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\alaw_test.obj" /c ".\tests\alaw_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\alaw_test.exe" ".\tests\alaw_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\dwvw_test.exe" : ".\tests\dwvw_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\dwvw_test.obj" /c ".\tests\dwvw_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\dwvw_test.exe" ".\tests\dwvw_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\command_test.exe" : ".\tests\command_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\command_test.obj" /c ".\tests\command_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\command_test.exe" ".\tests\command_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\floating_point_test.exe" : ".\tests\floating_point_test.c" ".\tests\utils.obj" ".\tests\dft_cmp.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\floating_point_test.obj" /c ".\tests\floating_point_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\floating_point_test.exe" ".\tests\floating_point_test.obj" ".\tests\utils.obj" ".\tests\dft_cmp.obj" libsndfile.lib
|
||||
|
||||
".\tests\headerless_test.exe" : ".\tests\headerless_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\headerless_test.obj" /c ".\tests\headerless_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\headerless_test.exe" ".\tests\headerless_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\write_read_test.exe" : ".\tests\write_read_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\write_read_test.obj" /c ".\tests\write_read_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\write_read_test.exe" ".\tests\write_read_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\lossy_comp_test.exe" : ".\tests\lossy_comp_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\lossy_comp_test.obj" /c ".\tests\lossy_comp_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\lossy_comp_test.exe" ".\tests\lossy_comp_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\peak_chunk_test.exe" : ".\tests\peak_chunk_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\peak_chunk_test.obj" /c ".\tests\peak_chunk_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\peak_chunk_test.exe" ".\tests\peak_chunk_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\misc_test.exe" : ".\tests\misc_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\misc_test.obj" /c ".\tests\misc_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\misc_test.exe" ".\tests\misc_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\string_test.exe" : ".\tests\string_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\string_test.obj" /c ".\tests\string_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\string_test.exe" ".\tests\string_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\win32_test.exe" : ".\tests\win32_test.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\win32_test.obj" /c ".\tests\win32_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\win32_test.exe" ".\tests\win32_test.obj"
|
||||
|
||||
".\tests\stdio_test.exe" : ".\tests\stdio_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\stdio_test.obj" /c ".\tests\stdio_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\stdio_test.exe" ".\tests\stdio_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\pipe_test.exe" : ".\tests\pipe_test.c" ".\tests\utils.obj"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\pipe_test.obj" /c ".\tests\pipe_test.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\pipe_test.exe" ".\tests\pipe_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
# ".\tests\stdin_test.exe" : ".\tests\stdin_test.c" ".\tests\utils.obj"
|
||||
# $(CPP) $(CFLAGS) /Fo".\tests\stdin_test.obj" /c ".\tests\stdin_test.c"
|
||||
# $(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\stdin_test.exe" ".\tests\stdin_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
#
|
||||
# ".\tests\stdout_test.exe" : ".\tests\stdout_test.c" ".\tests\utils.obj"
|
||||
# $(CPP) $(CFLAGS) /Fo".\tests\stdout_test.obj" /c ".\tests\stdout_test.c"
|
||||
# $(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\stdout_test.exe" ".\tests\stdout_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
".\tests\benchmark.exe" : ".\tests\benchmark.c"
|
||||
$(CPP) $(CFLAGS) /Fo".\tests\benchmark.obj" /c ".\tests\benchmark.c"
|
||||
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\benchmark.exe" ".\tests\benchmark.obj" ".\tests\utils.obj" libsndfile.lib
|
||||
|
||||
# End of Makefile
|
||||
#====================================================================
|
||||
|
@ -1,96 +0,0 @@
|
||||
NOTE: This is not the way the author builds libsndfile on Win32
|
||||
so this desciption may be out of date. For the authors method
|
||||
of building libsndfile on Win32 have a look at the file named
|
||||
win32.html in the doc\ directory of the source code distribution.
|
||||
|
||||
*****************************************************************
|
||||
|
||||
This is the readme-Win32.txt file associated with the LibSndFile
|
||||
library. It describes how the included workspace and project
|
||||
was created for Microsoft Visual C++ developer's studio (MSVC),
|
||||
version 5.0. Skip to point 7 if you wish to create a new
|
||||
project for building an executable.
|
||||
|
||||
1. Extracted libsndfile.zip to d:\files\msvc\
|
||||
|
||||
2. It created (replace X.Y.Z with the libsndfile version number)
|
||||
d:\files\msvc\libsndfile-X.Y.Z\Win32 *
|
||||
d:\files\msvc\libsndfile-X.Y.Z\src *
|
||||
d:\files\msvc\libsndfile-X.Y.Z\tests *
|
||||
d:\files\msvc\libsndfile-X.Y.Z\examples
|
||||
d:\files\msvc\libsndfile-X.Y.Z\doc
|
||||
d:\files\msvc\libsndfile-X.Y.Z\m4
|
||||
d:\files\msvc\libsndfile-X.Y.Z\MacOS
|
||||
|
||||
* are needed for this example
|
||||
|
||||
3. From MSVC:New->Workspace, I created LibSndFileWorkspace at:
|
||||
d:\files\msvc\libsndfile-X.Y.Z\Win32\
|
||||
(workspace files have the extension .dsw)
|
||||
|
||||
3. In MSVC, rt-click on "Workspace LibSndFileWorkspace" and add project:
|
||||
Project type: Win32 Static Library
|
||||
Project Name: LibSndFile
|
||||
Project Location: D:\files\msvc\libsndfile-X.Y.Z\Win32
|
||||
Select button: 'Add to current workspace'
|
||||
Platforms: Win32
|
||||
|
||||
4. Rt-click newly formed "LibSndFile files" and add files:
|
||||
d:\files\msvc\libsndfile-X.Y.Z\src\*.*
|
||||
d:\files\msvc\libsndfile-X.Y.Z\src\Gsm610\*.*
|
||||
d:\files\msvc\libsndfile-X.Y.Z\src\G72x\*.*
|
||||
|
||||
5. Rt-click 'LibSndFile files' and go to Settings
|
||||
a. Select all configurations on the left hand side
|
||||
b. Then select C/C++/Preprocessor and add
|
||||
"..\" (no quotes) to 'Additional include directories'
|
||||
(This allows ..Win32\config.h and unistd.h to be found.)
|
||||
|
||||
6. At this point you should be able to build the library. The output
|
||||
will be found in ..\Win32\LibSndFile\Debug\LibSndFile.lib. You can
|
||||
change the LibSndFile project to Release and a similar release
|
||||
path will be created.
|
||||
|
||||
The following describes how to add an application project to the
|
||||
workspace. You may add as many as you wish. In general, you will
|
||||
need one project for each executable you want to create.
|
||||
|
||||
7. Rt-click LibSndFileWorkspace and select 'Add project'
|
||||
Project type: Win32 Console Application
|
||||
Project Name: sfversion
|
||||
Location: d:\files\msvc\libsndfile-X.Y.Z\Win32\sfversion
|
||||
Select button: 'Add to current workspace'
|
||||
Platforms: Win32
|
||||
|
||||
Notes:
|
||||
- MSVC will create a directory ..\Win32\sfversion\
|
||||
- MSVC will create the file sfversion.dsp in this directory
|
||||
|
||||
8. Rt-click 'sfversion files' and add file:
|
||||
d:\files\msvc\libsndfile-X.Y.Z\tests\sfversion.c
|
||||
|
||||
9. Rt-click 'sfversion files' and go to Settings:
|
||||
a. Select 'All configurations' on the left hand side
|
||||
b. Then select C/C++/Preprocessor and add
|
||||
"..\..\src,..\" (no quotes) to 'Additional include directories'
|
||||
|
||||
9. Rt-click 'sfversion files' and go to Settings:
|
||||
a. Select 'Debug Configuration' on left hand side
|
||||
b. Then select Link tab and add
|
||||
"..\LibSndFile\Debug\LibSndFile.lib " (no quotes) to
|
||||
the list of 'Object/library modules'. Leave a space between new
|
||||
addition existing lib files.
|
||||
|
||||
10. Repeat above for Release build adding Release path info.
|
||||
|
||||
11. Build your application, it should link and create an .exe
|
||||
|
||||
Final notes:
|
||||
|
||||
Files created during build by msvc but are not needed for archive:
|
||||
*ncb *.plg *.opt *.obj *.idb *.pch *.lib *.exe
|
||||
|
||||
Files associated with LibSndFile but not used by msvc:
|
||||
Makefile.in
|
||||
Makefile.am
|
||||
- End -
|
281
Win32/config.h
281
Win32/config.h
@ -1,281 +0,0 @@
|
||||
/*
|
||||
** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This is the Win32 version of the file config.h which is autogenerated
|
||||
** on Unix systems.
|
||||
*/
|
||||
|
||||
#pragma warning (disable : 4244)
|
||||
#pragma warning (disable : 4761)
|
||||
|
||||
/* Set to 1 if the compile is GNU GCC. */
|
||||
/* #undef COMPILER_IS_GCC */
|
||||
|
||||
/* Target processor clips on negative float to int conversion. */
|
||||
#define CPU_CLIPS_NEGATIVE 1
|
||||
|
||||
/* Target processor clips on positive float to int conversion. */
|
||||
#define CPU_CLIPS_POSITIVE 0
|
||||
|
||||
/* Target processor is big endian. */
|
||||
#define CPU_IS_BIG_ENDIAN 0
|
||||
|
||||
/* Target processor is little endian. */
|
||||
#define CPU_IS_LITTLE_ENDIAN 1
|
||||
|
||||
/* Set to 1 to enable experimental code. */
|
||||
#define ENABLE_EXPERIMENTAL_CODE 0
|
||||
|
||||
/* Major version of GCC or 3 otherwise. */
|
||||
/* #undef GCC_MAJOR_VERSION */
|
||||
|
||||
/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
|
||||
/* #undef HAVE_ALSA_ASOUNDLIB_H */
|
||||
|
||||
/* Define to 1 if you have the <byteswap.h> header file. */
|
||||
/* #undef HAVE_BYTESWAP_H */
|
||||
|
||||
/* Define to 1 if you have the `calloc' function. */
|
||||
#define HAVE_CALLOC 1
|
||||
|
||||
/* Define to 1 if you have the `ceil' function. */
|
||||
#define HAVE_CEIL 1
|
||||
|
||||
/* Set to 1 if S_IRGRP is defined. */
|
||||
#define HAVE_DECL_S_IRGRP 0
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
|
||||
/* Define to 1 if you have the <endian.h> header file. */
|
||||
/* #undef HAVE_ENDIAN_H */
|
||||
|
||||
/* Define to 1 if you have the `fdatasync' function. */
|
||||
|
||||
/* #undef HAVE_FDATASYNC */
|
||||
|
||||
/* Define to 1 if you have libflac 1.1.1 */
|
||||
/* #undef HAVE_FLAC_1_1_1 1 */
|
||||
|
||||
/* Define to 1 if you have the <FLAC/all.h> header file. */
|
||||
/* #undef HAVE_FLAC_ALL_H 1 */
|
||||
|
||||
/* Set to 1 if the compile supports the struct hack. */
|
||||
#define HAVE_FLEXIBLE_ARRAY 1
|
||||
|
||||
/* Define to 1 if you have the `floor' function. */
|
||||
#define HAVE_FLOOR 1
|
||||
|
||||
/* Define to 1 if you have the `fmod' function. */
|
||||
#define HAVE_FMOD 1
|
||||
|
||||
/* Define to 1 if you have the `free' function. */
|
||||
#define HAVE_FREE 1
|
||||
|
||||
/* Define to 1 if you have the `fstat' function. */
|
||||
#define HAVE_FSTAT 1
|
||||
|
||||
/* Define to 1 if you have the `fsync' function. */
|
||||
/* #undef HAVE_FSYNC */
|
||||
|
||||
/* Define to 1 if you have the `ftruncate' function. */
|
||||
/* #undef HAVE_FTRUNCATE */
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define to 1 if you have the `gmtime' function. */
|
||||
#define HAVE_GMTIME 1
|
||||
|
||||
/* Define to 1 if you have the `gmtime_r' function. */
|
||||
/* #undef HAVE_GMTIME_R */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
/* #undef HAVE_INTTYPES_H */
|
||||
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#define HAVE_LIBM 1
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
/* #undef HAVE_LOCALE_H */
|
||||
|
||||
/* Define if you have C99's lrint function. */
|
||||
/* #undef HAVE_LRINT */
|
||||
|
||||
/* Define if you have C99's lrintf function. */
|
||||
/* #undef HAVE_LRINTF */
|
||||
|
||||
/* Define to 1 if you have the `lseek' function. */
|
||||
#define HAVE_LSEEK 1
|
||||
|
||||
/* Define to 1 if you have the `malloc' function. */
|
||||
#define HAVE_MALLOC 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
/* #undef HAVE_MMAP */
|
||||
|
||||
/* Define to 1 if you have the `open' function. */
|
||||
#define HAVE_OPEN 1
|
||||
|
||||
/* Define to 1 if you have the `pread' function. */
|
||||
/* #undef HAVE_PREAD */
|
||||
|
||||
/* Define to 1 if you have the `pwrite' function. */
|
||||
/* #undef HAVE_PWRITE */
|
||||
|
||||
/* Define to 1 if you have the `read' function. */
|
||||
#define HAVE_READ 1
|
||||
|
||||
/* Define to 1 if you have the `realloc' function. */
|
||||
#define HAVE_REALLOC 1
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
/* #undef HAVE_SETLOCALE */
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Set to 1 if you have libsqlite3. */
|
||||
/* #undef HAVE_SQLITE3 */
|
||||
|
||||
/* Define to 1 if the system has the type `ssize_t'. */
|
||||
/* #undef HAVE_SSIZE_T */
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
/* #undef HAVE_STDINT_H */
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
/* #undef HAVE_SYS_WAIT_H */
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
/* #undef HAVE_UNISTD_H */
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `write' function. */
|
||||
#define HAVE_WRITE 1
|
||||
|
||||
/* Set to 1 if compiling for MacOSX */
|
||||
#define OS_IS_MACOSX 0
|
||||
|
||||
/* Set to 1 if compiling for Win32 */
|
||||
#define OS_IS_WIN32 1
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libsndfile"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "erikd@mega-nerd.com"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "libsndfile"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libsndfile 1.0.13"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libsndfile"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "1.0.13"
|
||||
|
||||
/* Set to maximum allowed value of sf_count_t type. */
|
||||
#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFi64
|
||||
|
||||
/* The size of a `double', as computed by sizeof. */
|
||||
#define SIZEOF_DOUBLE 8
|
||||
|
||||
/* The size of a `float', as computed by sizeof. */
|
||||
#define SIZEOF_FLOAT 4
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The size of a `int64_t', as computed by sizeof. */
|
||||
#define SIZEOF_INT64_T 0
|
||||
|
||||
/* The size of a `loff_t', as computed by sizeof. */
|
||||
#define SIZEOF_LOFF_T 0
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
/* The size of a `long long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG_LONG 0
|
||||
|
||||
/* The size of a `off64_t', as computed by sizeof. */
|
||||
/* #undef SIZEOF_OFF64_T */
|
||||
|
||||
/* The size of a `off_t', as computed by sizeof. */
|
||||
#define SIZEOF_OFF_T 4
|
||||
|
||||
/* Set to sizeof (long) if unknown. */
|
||||
#define SIZEOF_SF_COUNT_T 8
|
||||
|
||||
/* The size of a `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* The size of a `size_t', as computed by sizeof. */
|
||||
#define SIZEOF_SIZE_T 4
|
||||
|
||||
/* The size of a `ssize_t', as computed by sizeof. */
|
||||
#define SIZEOF_SSIZE_T 4
|
||||
|
||||
/* The size of a `void*', as computed by sizeof. */
|
||||
#define SIZEOF_VOIDP 4
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Set to long if unknown. */
|
||||
#define TYPEOF_SF_COUNT_T loff_t
|
||||
|
||||
/* Set to 1 to use the native windows API */
|
||||
#define USE_WINDOWS_API 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.0.13"
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
/* #undef _FILE_OFFSET_BITS */
|
||||
|
||||
/* Define to make fseeko etc. visible, on some hosts. */
|
||||
/* #undef _LARGEFILE_SOURCE */
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
7268
Win32/libtool.mingw
7268
Win32/libtool.mingw
File diff suppressed because it is too large
Load Diff
530
Win32/sndfile.h
530
Win32/sndfile.h
@ -1,530 +0,0 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
** sndfile.h -- system-wide definitions
|
||||
**
|
||||
** API documentation is in the doc/ directory of the source code tarball
|
||||
** and at http://www.mega-nerd.com/libsndfile/api.html.
|
||||
*/
|
||||
|
||||
#ifndef SNDFILE_H
|
||||
#define SNDFILE_H
|
||||
|
||||
/* This is the version 1.0.X header file. */
|
||||
#define SNDFILE_1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS) */
|
||||
|
||||
#if (defined (__MWERKS__))
|
||||
#include <unix.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* The following file types can be read and written.
|
||||
** A file type would consist of a major type (ie SF_FORMAT_WAV) bitwise
|
||||
** ORed with a minor type (ie SF_FORMAT_PCM). SF_FORMAT_TYPEMASK and
|
||||
** SF_FORMAT_SUBMASK can be used to separate the major and minor file
|
||||
** types.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ /* Major formats. */
|
||||
SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian). */
|
||||
SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */
|
||||
SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */
|
||||
SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */
|
||||
SF_FORMAT_PAF = 0x050000, /* Ensoniq PARIS file format. */
|
||||
SF_FORMAT_SVX = 0x060000, /* Amiga IFF / SVX8 / SV16 format. */
|
||||
SF_FORMAT_NIST = 0x070000, /* Sphere NIST format. */
|
||||
SF_FORMAT_VOC = 0x080000, /* VOC files. */
|
||||
SF_FORMAT_IRCAM = 0x0A0000, /* Berkeley/IRCAM/CARL */
|
||||
SF_FORMAT_W64 = 0x0B0000, /* Sonic Foundry's 64 bit RIFF/WAV */
|
||||
SF_FORMAT_MAT4 = 0x0C0000, /* Matlab (tm) V4.2 / GNU Octave 2.0 */
|
||||
SF_FORMAT_MAT5 = 0x0D0000, /* Matlab (tm) V5.0 / GNU Octave 2.1 */
|
||||
SF_FORMAT_PVF = 0x0E0000, /* Portable Voice Format */
|
||||
SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */
|
||||
SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */
|
||||
SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */
|
||||
SF_FORMAT_AVR = 0x120000, /* Audio Visual Research */
|
||||
SF_FORMAT_WAVEX = 0x130000, /* MS WAVE with WAVEFORMATEX */
|
||||
SF_FORMAT_SD2 = 0x160000, /* Sound Designer 2 */
|
||||
SF_FORMAT_FLAC = 0x170000, /* FLAC lossless file format */
|
||||
SF_FORMAT_CAF = 0x180000, /* Core Audio File format */
|
||||
|
||||
/* Subtypes from here on. */
|
||||
|
||||
SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */
|
||||
SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */
|
||||
SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */
|
||||
SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */
|
||||
|
||||
SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */
|
||||
|
||||
SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */
|
||||
SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */
|
||||
|
||||
SF_FORMAT_ULAW = 0x0010, /* U-Law encoded. */
|
||||
SF_FORMAT_ALAW = 0x0011, /* A-Law encoded. */
|
||||
SF_FORMAT_IMA_ADPCM = 0x0012, /* IMA ADPCM. */
|
||||
SF_FORMAT_MS_ADPCM = 0x0013, /* Microsoft ADPCM. */
|
||||
|
||||
SF_FORMAT_GSM610 = 0x0020, /* GSM 6.10 encoding. */
|
||||
SF_FORMAT_VOX_ADPCM = 0x0021, /* OKI / Dialogix ADPCM */
|
||||
|
||||
SF_FORMAT_G721_32 = 0x0030, /* 32kbs G721 ADPCM encoding. */
|
||||
SF_FORMAT_G723_24 = 0x0031, /* 24kbs G723 ADPCM encoding. */
|
||||
SF_FORMAT_G723_40 = 0x0032, /* 40kbs G723 ADPCM encoding. */
|
||||
|
||||
SF_FORMAT_DWVW_12 = 0x0040, /* 12 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_16 = 0x0041, /* 16 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_24 = 0x0042, /* 24 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_N = 0x0043, /* N bit Delta Width Variable Word encoding. */
|
||||
|
||||
SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */
|
||||
SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */
|
||||
|
||||
/* Endian-ness options. */
|
||||
|
||||
SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */
|
||||
SF_ENDIAN_LITTLE = 0x10000000, /* Force little endian-ness. */
|
||||
SF_ENDIAN_BIG = 0x20000000, /* Force big endian-ness. */
|
||||
SF_ENDIAN_CPU = 0x30000000, /* Force CPU endian-ness. */
|
||||
|
||||
SF_FORMAT_SUBMASK = 0x0000FFFF,
|
||||
SF_FORMAT_TYPEMASK = 0x0FFF0000,
|
||||
SF_FORMAT_ENDMASK = 0x30000000
|
||||
} ;
|
||||
|
||||
/*
|
||||
** The following are the valid command numbers for the sf_command()
|
||||
** interface. The use of these commands is documented in the file
|
||||
** command.html in the doc directory of the source code distribution.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SFC_GET_LIB_VERSION = 0x1000,
|
||||
SFC_GET_LOG_INFO = 0x1001,
|
||||
|
||||
SFC_GET_NORM_DOUBLE = 0x1010,
|
||||
SFC_GET_NORM_FLOAT = 0x1011,
|
||||
SFC_SET_NORM_DOUBLE = 0x1012,
|
||||
SFC_SET_NORM_FLOAT = 0x1013,
|
||||
SFC_SET_SCALE_FLOAT_INT_READ = 0x1014,
|
||||
|
||||
SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020,
|
||||
SFC_GET_SIMPLE_FORMAT = 0x1021,
|
||||
|
||||
SFC_GET_FORMAT_INFO = 0x1028,
|
||||
|
||||
SFC_GET_FORMAT_MAJOR_COUNT = 0x1030,
|
||||
SFC_GET_FORMAT_MAJOR = 0x1031,
|
||||
SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032,
|
||||
SFC_GET_FORMAT_SUBTYPE = 0x1033,
|
||||
|
||||
SFC_CALC_SIGNAL_MAX = 0x1040,
|
||||
SFC_CALC_NORM_SIGNAL_MAX = 0x1041,
|
||||
SFC_CALC_MAX_ALL_CHANNELS = 0x1042,
|
||||
SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043,
|
||||
|
||||
SFC_SET_ADD_PEAK_CHUNK = 0x1050,
|
||||
|
||||
SFC_UPDATE_HEADER_NOW = 0x1060,
|
||||
SFC_SET_UPDATE_HEADER_AUTO = 0x1061,
|
||||
|
||||
SFC_FILE_TRUNCATE = 0x1080,
|
||||
|
||||
SFC_SET_RAW_START_OFFSET = 0x1090,
|
||||
|
||||
SFC_SET_DITHER_ON_WRITE = 0x10A0,
|
||||
SFC_SET_DITHER_ON_READ = 0x10A1,
|
||||
|
||||
SFC_GET_DITHER_INFO_COUNT = 0x10A2,
|
||||
SFC_GET_DITHER_INFO = 0x10A3,
|
||||
|
||||
SFC_GET_EMBED_FILE_INFO = 0x10B0,
|
||||
|
||||
SFC_SET_CLIPPING = 0x10C0,
|
||||
SFC_GET_CLIPPING = 0x10C1,
|
||||
|
||||
SFC_GET_INSTRUMENT = 0x10D0,
|
||||
SFC_SET_INSTRUMENT = 0x10D1,
|
||||
|
||||
SFC_GET_LOOP_INFO = 0x10E0,
|
||||
|
||||
/* Following commands for testing only. */
|
||||
SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001,
|
||||
|
||||
/*
|
||||
** SFC_SET_ADD_* values are deprecated and will disappear at some
|
||||
** time in the future. They are guaranteed to be here up to and
|
||||
** including version 1.0.8 to avoid breakage of existng software.
|
||||
** They currently do nothing and will continue to do nothing.
|
||||
*/
|
||||
SFC_SET_ADD_DITHER_ON_WRITE = 0x1070,
|
||||
SFC_SET_ADD_DITHER_ON_READ = 0x1071
|
||||
} ;
|
||||
|
||||
|
||||
/*
|
||||
** String types that can be set and read from files. Not all file types
|
||||
** support this and even the file types which support one, may not support
|
||||
** all string types.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_STR_TITLE = 0x01,
|
||||
SF_STR_COPYRIGHT = 0x02,
|
||||
SF_STR_SOFTWARE = 0x03,
|
||||
SF_STR_ARTIST = 0x04,
|
||||
SF_STR_COMMENT = 0x05,
|
||||
SF_STR_DATE = 0x06
|
||||
} ;
|
||||
|
||||
/*
|
||||
** Use the following as the start and end index when doing metadata
|
||||
** transcoding.
|
||||
*/
|
||||
|
||||
#define SF_STR_FIRST SF_STR_TITLE
|
||||
#define SF_STR_LAST SF_STR_DATE
|
||||
|
||||
enum
|
||||
{ /* True and false */
|
||||
SF_FALSE = 0,
|
||||
SF_TRUE = 1,
|
||||
|
||||
/* Modes for opening files. */
|
||||
SFM_READ = 0x10,
|
||||
SFM_WRITE = 0x20,
|
||||
SFM_RDWR = 0x30
|
||||
} ;
|
||||
|
||||
/* Public error values. These are guaranteed to remain unchanged for the duration
|
||||
** of the library major version number.
|
||||
** There are also a large number of private error numbers which are internal to
|
||||
** the library which can change at any time.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_ERR_NO_ERROR = 0,
|
||||
SF_ERR_UNRECOGNISED_FORMAT = 1,
|
||||
SF_ERR_SYSTEM = 2,
|
||||
SF_ERR_MALFORMED_FILE = 3,
|
||||
SF_ERR_UNSUPPORTED_ENCODING = 4
|
||||
} ;
|
||||
|
||||
/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
|
||||
|
||||
typedef struct SNDFILE_tag SNDFILE ;
|
||||
|
||||
/* The following typedef is system specific and is defined when libsndfile is.
|
||||
** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD),
|
||||
** off64_t (Solaris), __int64_t (Win32) etc.
|
||||
*/
|
||||
|
||||
typedef __int64 sf_count_t ;
|
||||
|
||||
#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFi64
|
||||
|
||||
/* A pointer to a SF_INFO structure is passed to sf_open_read () and filled in.
|
||||
** On write, the SF_INFO structure is filled in by the user and passed into
|
||||
** sf_open_write ().
|
||||
*/
|
||||
|
||||
struct SF_INFO
|
||||
{ sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */
|
||||
int samplerate ;
|
||||
int channels ;
|
||||
int format ;
|
||||
int sections ;
|
||||
int seekable ;
|
||||
} ;
|
||||
|
||||
typedef struct SF_INFO SF_INFO ;
|
||||
|
||||
/* The SF_FORMAT_INFO struct is used to retrieve information about the sound
|
||||
** file formats libsndfile supports using the sf_command () interface.
|
||||
**
|
||||
** Using this interface will allow applications to support new file formats
|
||||
** and encoding types when libsndfile is upgraded, without requiring
|
||||
** re-compilation of the application.
|
||||
**
|
||||
** Please consult the libsndfile documentation (particularly the information
|
||||
** on the sf_command () interface) for examples of its use.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ int format ;
|
||||
const char *name ;
|
||||
const char *extension ;
|
||||
} SF_FORMAT_INFO ;
|
||||
|
||||
/*
|
||||
** Enums and typedefs for adding dither on read and write.
|
||||
** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE
|
||||
** and SFC_SET_DITHER_ON_READ.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SFD_DEFAULT_LEVEL = 0,
|
||||
SFD_CUSTOM_LEVEL = 0x40000000,
|
||||
|
||||
SFD_NO_DITHER = 500,
|
||||
SFD_WHITE = 501,
|
||||
SFD_TRIANGULAR_PDF = 502
|
||||
} ;
|
||||
|
||||
typedef struct
|
||||
{ int type ;
|
||||
double level ;
|
||||
const char *name ;
|
||||
} SF_DITHER_INFO ;
|
||||
|
||||
/* Struct used to retrieve information about a file embedded within a
|
||||
** larger file. See SFC_GET_EMBED_FILE_INFO.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ sf_count_t offset ;
|
||||
sf_count_t length ;
|
||||
} SF_EMBED_FILE_INFO ;
|
||||
|
||||
/*
|
||||
** Structs used to retrieve music sample information from a file.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ /*
|
||||
** The loop mode field in SF_INSTRUMENT will be one of the following.
|
||||
*/
|
||||
SF_LOOP_NONE = 800,
|
||||
SF_LOOP_FORWARD,
|
||||
SF_LOOP_BACKWARD,
|
||||
SF_LOOP_ALTERNATING
|
||||
} ;
|
||||
|
||||
typedef struct
|
||||
{ int gain ;
|
||||
char basenote, detune ;
|
||||
char velocity_lo, velocity_hi ;
|
||||
char key_lo, key_hi ;
|
||||
int loop_count ;
|
||||
|
||||
struct
|
||||
{ int mode ;
|
||||
unsigned int start ;
|
||||
unsigned int end ;
|
||||
unsigned int count ;
|
||||
} loops [16] ; /* make variable in a sensible way */
|
||||
} SF_INSTRUMENT ;
|
||||
|
||||
|
||||
|
||||
/* Struct used to retrieve loop information from a file.*/
|
||||
typedef struct
|
||||
{
|
||||
short time_sig_num ; /* any positive integer > 0 */
|
||||
short time_sig_den ; /* any positive power of 2 > 0 */
|
||||
int loop_mode ; /* see SF_LOOP enum */
|
||||
|
||||
int num_beats ; /* this is NOT the amount of quarter notes !!!*/
|
||||
/* a full bar of 4/4 is 4 beats */
|
||||
/* a full bar of 7/8 is 7 beats */
|
||||
|
||||
float bpm ; /* suggestion, as it can be calculated using other fields:*/
|
||||
/* file's lenght, file's sampleRate and our time_sig_den*/
|
||||
/* -> bpms are always the amount of _quarter notes_ per minute */
|
||||
|
||||
int root_key ; /* MIDI note, or -1 for None */
|
||||
int future [6] ;
|
||||
} SF_LOOP_INFO ;
|
||||
|
||||
typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_tell) (void *user_data) ;
|
||||
|
||||
struct SF_VIRTUAL_IO
|
||||
{ sf_vio_get_filelen get_filelen ;
|
||||
sf_vio_seek seek ;
|
||||
sf_vio_read read ;
|
||||
sf_vio_write write ;
|
||||
sf_vio_tell tell ;
|
||||
} ;
|
||||
|
||||
typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ;
|
||||
|
||||
/* Open the specified file for read, write or both. On error, this will
|
||||
** return a NULL pointer. To find the error number, pass a NULL SNDFILE
|
||||
** to sf_perror () or sf_error_str ().
|
||||
** All calls to sf_open() should be matched with a call to sf_close().
|
||||
*/
|
||||
|
||||
SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ;
|
||||
|
||||
/* Use the existing file descriptor to create a SNDFILE object. If close_desc
|
||||
** is TRUE, the file descriptor will be closed when sf_close() is called. If
|
||||
** it is FALSE, the descritor will not be closed.
|
||||
** When passed a descriptor like this, the library will assume that the start
|
||||
** of file header is at the current file offset. This allows sound files within
|
||||
** larger container files to be read and/or written.
|
||||
** On error, this will return a NULL pointer. To find the error number, pass a
|
||||
** NULL SNDFILE to sf_perror () or sf_error_str ().
|
||||
** All calls to sf_open_fd() should be matched with a call to sf_close().
|
||||
|
||||
*/
|
||||
|
||||
SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
|
||||
|
||||
SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ;
|
||||
|
||||
/* sf_error () returns a error number which can be translated to a text
|
||||
** string using sf_error_number().
|
||||
*/
|
||||
|
||||
int sf_error (SNDFILE *sndfile) ;
|
||||
|
||||
/* sf_strerror () returns to the caller a pointer to the current error message for
|
||||
** the given SNDFILE.
|
||||
*/
|
||||
|
||||
const char* sf_strerror (SNDFILE *sndfile) ;
|
||||
|
||||
/* sf_error_number () allows the retrieval of the error string for each internal
|
||||
** error number.
|
||||
**
|
||||
*/
|
||||
|
||||
const char* sf_error_number (int errnum) ;
|
||||
|
||||
/* The following three error functions are deprecated but they will remain in the
|
||||
** library for the forseeable future. The function sf_strerror() should be used
|
||||
** in their place.
|
||||
*/
|
||||
|
||||
int sf_perror (SNDFILE *sndfile) ;
|
||||
int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ;
|
||||
|
||||
|
||||
/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
|
||||
|
||||
int sf_command (SNDFILE *sndfile, int command, void *data, int datasize) ;
|
||||
|
||||
/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
|
||||
|
||||
int sf_format_check (const SF_INFO *info) ;
|
||||
|
||||
/* Seek within the waveform data chunk of the SNDFILE. sf_seek () uses
|
||||
** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as
|
||||
** stdio.h function fseek ().
|
||||
** An offset of zero with whence set to SEEK_SET will position the
|
||||
** read / write pointer to the first data sample.
|
||||
** On success sf_seek returns the current position in (multi-channel)
|
||||
** samples from the start of the file.
|
||||
** Please see the libsndfile documentation for moving the read pointer
|
||||
** separately from the write pointer on files open in mode SFM_RDWR.
|
||||
** On error all of these functions return -1.
|
||||
*/
|
||||
|
||||
sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ;
|
||||
|
||||
/* Functions for retrieving and setting string data within sound files.
|
||||
** Not all file types support this features; AIFF and WAV do. For both
|
||||
** functions, the str_type parameter must be one of the SF_STR_* values
|
||||
** defined above.
|
||||
** On error, sf_set_string() returns non-zero while sf_get_string()
|
||||
** returns NULL.
|
||||
*/
|
||||
|
||||
int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ;
|
||||
|
||||
const char* sf_get_string (SNDFILE *sndfile, int str_type) ;
|
||||
|
||||
/* Functions for reading/writing the waveform data of a sound file.
|
||||
*/
|
||||
|
||||
sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
|
||||
sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ;
|
||||
|
||||
/* Functions for reading and writing the data chunk in terms of frames.
|
||||
** The number of items actually read/written = frames * number of channels.
|
||||
** sf_xxxx_raw read/writes the raw data bytes from/to the file
|
||||
** sf_xxxx_short passes data in the native short format
|
||||
** sf_xxxx_int passes data in the native int format
|
||||
** sf_xxxx_float passes data in the native float format
|
||||
** sf_xxxx_double passes data in the native double format
|
||||
** All of these read/write function return number of frames read/written.
|
||||
*/
|
||||
|
||||
sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ;
|
||||
|
||||
/* Functions for reading and writing the data chunk in terms of items.
|
||||
** Otherwise similar to above.
|
||||
** All of these read/write function return number of items read/written.
|
||||
*/
|
||||
|
||||
sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ;
|
||||
|
||||
/* Close the SNDFILE and clean up all memory allocations associated with this
|
||||
** file.
|
||||
** Returns 0 on success, or an error number.
|
||||
*/
|
||||
|
||||
int sf_close (SNDFILE *sndfile) ;
|
||||
|
||||
/* If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file
|
||||
** to force the writing of data to disk. If the file is opened SFM_READ
|
||||
** no action is taken.
|
||||
*/
|
||||
|
||||
void sf_write_sync (SNDFILE *sndfile) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* SNDFILE_H */
|
@ -3,7 +3,7 @@
|
||||
dnl Require autoconf version
|
||||
AC_PREREQ(2.57)
|
||||
|
||||
AC_INIT([libsndfile],[1.0.18pre23],[erikd@mega-nerd.com])
|
||||
AC_INIT([libsndfile],[1.0.18pre24],[erikd@mega-nerd.com])
|
||||
|
||||
# Put config stuff in Cfg.
|
||||
AC_CONFIG_AUX_DIR(Cfg)
|
||||
@ -479,6 +479,7 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
|
||||
|
||||
AC_ADD_CFLAGS([-Wdeclaration-after-statement])
|
||||
AC_ADD_CFLAGS([-Wpointer-arith])
|
||||
AC_ADD_CFLAGS([-funsigned-char])
|
||||
|
||||
if test x$enable_gcc_werror = "xyes" ; then
|
||||
CFLAGS="-Werror $CFLAGS"
|
||||
|
@ -4,7 +4,7 @@ htmldir = $(htmldocdir)
|
||||
html_DATA = index.html libsndfile.jpg libsndfile.css api.html command.html \
|
||||
bugs.html sndfile_info.html new_file_type.HOWTO pkgconfig.html \
|
||||
win32.html FAQ.html lists.html embedded_files.html octave.html \
|
||||
dither.html
|
||||
dither.html tutorial.html
|
||||
|
||||
EXTRA_DIST = $(html_DATA)
|
||||
|
||||
|
@ -195,6 +195,16 @@
|
||||
<TD>Determine if raw data needs endswapping</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_GET_BROADCAST_INFO">SFC_GET_BROADCAST_INFO</A></TD>
|
||||
<TD>Retrieve the Broadcast Chunk info</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_SET_BROADCAST_INFO">SFC_SET_BROADCAST_INFO</A></TD>
|
||||
<TD>Set the Broadcast Chunk info</TD>
|
||||
</TR>
|
||||
|
||||
<!--
|
||||
<TR>
|
||||
<TD><A HREF="#add-dither">add dither</A></TD>
|
||||
@ -1190,7 +1200,7 @@ Parameters:
|
||||
datasize : sizeof (SF_EMBED_FILE_INFO)
|
||||
</PRE>
|
||||
<P>
|
||||
The SF_FORMAT_INFO struct is defined in <sndfile.h> as:
|
||||
The SF_EMBED_FILE_INFO struct is defined in <sndfile.h> as:
|
||||
</P>
|
||||
<PRE>
|
||||
typedef struct
|
||||
@ -1314,13 +1324,74 @@ Parameters:
|
||||
datasize : 0
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
</P>
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>SF_TRUE or SF_FALSE
|
||||
</DL>
|
||||
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_GET_BROADCAST_INFO"></A>
|
||||
<H2><BR><B>SFC_GET_BROADCAST_INFO</B></H2>
|
||||
<P>
|
||||
Retrieve the Broadcast Extention Chunk from WAV (and related) files.
|
||||
</P>
|
||||
<p>
|
||||
Parameters:
|
||||
</p>
|
||||
<PRE>
|
||||
sndfile : A valid SNDFILE* pointer
|
||||
cmd : SFC_GET_BROADCAST_INFO
|
||||
data : a pointer to an SF_BROADCAST_INFO struct
|
||||
datasize : sizeof (SF_BROADCAST_INFO)
|
||||
</PRE>
|
||||
<P>
|
||||
The SF_BROADCAST_INFO struct is defined in <sndfile.h> as:
|
||||
</P>
|
||||
<PRE>
|
||||
typedef struct
|
||||
{ char description [256] ;
|
||||
char originator [32] ;
|
||||
char originator_reference [32] ;
|
||||
char origination_date [10] ;
|
||||
char origination_time [8] ;
|
||||
unsigned int time_reference_low ;
|
||||
unsigned int time_reference_high ;
|
||||
short version ;
|
||||
char umid [64] ;
|
||||
char reserved [190] ;
|
||||
unsigned int coding_history_size ;
|
||||
char coding_history [256] ;
|
||||
} SF_BROADCAST_INFO ;
|
||||
</PRE>
|
||||
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>SF_TRUE if the file contained a Broadcast Extention chunk or SF_FALSE
|
||||
otherwise.
|
||||
</DL>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_SET_BROADCAST_INFO"></A>
|
||||
<H2><BR><B>SFC_SET_BROADCAST_INFO</B></H2>
|
||||
<P>
|
||||
Set the Broadcast Extention Chunk for WAV (and related) files.
|
||||
</P>
|
||||
<p>
|
||||
Parameters:
|
||||
</p>
|
||||
<PRE>
|
||||
sndfile : A valid SNDFILE* pointer
|
||||
cmd : SFC_SET_BROADCAST_INFO
|
||||
data : a pointer to an SF_BROADCAST_INFO struct
|
||||
datasize : sizeof (SF_BROADCAST_INFO)
|
||||
</PRE>
|
||||
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>SF_TRUE if setting the Broadcast Extention chunk was successful and SF_FALSE
|
||||
otherwise.
|
||||
</DL>
|
||||
<!-- ========================================================================= -->
|
||||
|
||||
|
||||
|
33
doc/tutorial.html
Normal file
33
doc/tutorial.html
Normal file
@ -0,0 +1,33 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
libsndfile Tutorial
|
||||
</TITLE>
|
||||
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
|
||||
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
|
||||
</HEAD>
|
||||
|
||||
<BODY>
|
||||
<!-- pepper -->
|
||||
<H1><BR>libsndfile Tutorial</H1>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
<b>More coming soon.</b>
|
||||
</P>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
For now, the best place to look for example code is the <tt>examples/</tt>
|
||||
directory of the source code distribution and the libsndfile test suite which
|
||||
is located in the <tt>tests/</tt> directory of the source code distribution.
|
||||
</P>
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
105
doc/win32.html
105
doc/win32.html
@ -14,115 +14,34 @@
|
||||
<H1><BR>Building libsndfile on Win32</H1>
|
||||
|
||||
<P><B>
|
||||
Note : For pre-compiled binaries for windows, see the main web page.
|
||||
Note : For pre-compiled binaries for windows, both for win32 and win64, see the
|
||||
main web page.
|
||||
</B></P>
|
||||
|
||||
<P>
|
||||
There are currently two ways of building libsndfile under Win32:
|
||||
</P>
|
||||
<UL>
|
||||
<LI> Using the free <A HREF="#MinGW">MinGW</A> tools.
|
||||
<LI> Using Cygwin (this is the full Cygwin without the -mno-cygwin option).
|
||||
</UL>
|
||||
|
||||
<P><B>
|
||||
Building libsndfile using the microsoft compiler does not currently work.
|
||||
Microsoft's compiler is a C++ compiler and does not compile a number of ISO
|
||||
C99 Standard constructs.
|
||||
If you insist on compiling libsndfile with the microsoft compiler you are
|
||||
on your own.
|
||||
</B></P>
|
||||
<P><B>
|
||||
However, even though the libsndfile source code cannot be compiled with
|
||||
the microsoft compiler, the pre-compiled windows DLL distributed on the
|
||||
main web page can be used with C++ projects compiled with the microsoft
|
||||
compiler.
|
||||
</B></P>
|
||||
|
||||
<P>
|
||||
The free MinGW tools are the preferred option because they are a free (as in
|
||||
beer and speech), easily obtainable and much closer to the Linux/GCC
|
||||
environment on which libsndfile is developed.
|
||||
</P>
|
||||
|
||||
<A NAME="MinGW"></A>
|
||||
<H2><BR>Building libsndfile using MinGW.</H2>
|
||||
<P>
|
||||
The MinGW tools are available from <A HREF="http://www.mingw.org/">
|
||||
http://www.mingw.org/</A>.
|
||||
The files you will need will be named something like:
|
||||
</P>
|
||||
<UL>
|
||||
<LI> msysDTK-1.0.1.exe
|
||||
<LI> MSYS-1.0.10.exe
|
||||
<LI> gcc-core-3.4.2-20040916-1.tar.gz
|
||||
<LI> gcc-g++-3.4.2-20040916-1.tar.gz
|
||||
<LI> binutils-2.15.91-20040901-1.tar.gz
|
||||
<LI> mingw-runtime-3.9.tar.gz
|
||||
<LI> w32api-3.6.tar.gz
|
||||
<LI> mingw-utils-0.3.tar.gz
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
They should be installed using the directions on the MinGW site.
|
||||
I know the instructions aren't great, but I don't have the time or expertise
|
||||
to write better ones.
|
||||
There is currently only one way of building libsndfile for Win32 and Win64;
|
||||
cross compiling from Linux using the MinGW cross compiler.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Once you have the tools installed you will get an icon named <B>MSYS</B> on
|
||||
your desktop.
|
||||
Clicking on that icon will bring up something that looks a little like an
|
||||
xterm.
|
||||
libsndfile is written to be compiled by a compiler which supports large
|
||||
chunks of the 1999 ISO C Standard.
|
||||
Unfortunately, the microsoft compiler supports close to nothing of this
|
||||
standard and hence is not suitable for libsndfile.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Assuming that you have downloaded the <B>.tar.gz</B> file into the
|
||||
<B>C:\temp\</B> directory you should now be able to execute the following
|
||||
commands:
|
||||
It <b>may</b> be possible to compile libsndfile on windows using the
|
||||
<a href="http://www.mingw.org/">MinGW</a>
|
||||
compiler suite, but I haven't tested that and have no interest in supporting
|
||||
that.
|
||||
</P>
|
||||
|
||||
<PRE>
|
||||
tar zxf /c/temp/libsndfile.X.Y.Z.tar.gz
|
||||
cd libsndfile-X.Y.Z
|
||||
./configure
|
||||
make
|
||||
make check
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
If there is a failure during compiling or the "make check" stage, you should
|
||||
check that you are using the current stable version of the MinGW tools, and
|
||||
the latest version of libsndfile before sending the author a bug report.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Once this is done, anyone interested in using libsndfile in other projects
|
||||
will be interested in the following files:
|
||||
</P>
|
||||
<UL>
|
||||
<LI> libsndfile.dll
|
||||
<LI> libsndfile.lib
|
||||
<LI> libsndfile.def
|
||||
<LI> src/sndfile.h
|
||||
<LI> doc/*.html
|
||||
</UL>
|
||||
|
||||
<!--===========================================================================-->
|
||||
|
||||
<!-- pepper -->
|
||||
<H2><BR>Compile Problems</H2>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
Compile problems using the above method of building the libsndfile DLL on Win32 should
|
||||
be emailed to
|
||||
<A HREF="mailto:erikd@mega-nerd.com">
|
||||
Erik de Castro Lopo</a>.
|
||||
</P>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
If you are using some other method to compile the libsndfile DLL you are on your own.
|
||||
</P>
|
||||
<BR>
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
|
@ -12,43 +12,42 @@ EXTRA_DIST = sndfile-play-beos.cpp test-sndfile-metadata-set.py
|
||||
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
|
||||
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
|
||||
|
||||
SNDFILEDIR = ../src
|
||||
INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS)
|
||||
INCLUDES = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS)
|
||||
|
||||
sndfile_info_SOURCES = sndfile-info.c
|
||||
sndfile_info_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
sndfile_info_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_play_SOURCES = sndfile-play.c
|
||||
sndfile_play_LDADD = $(SNDFILEDIR)/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
|
||||
sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
|
||||
|
||||
sndfile_jackplay_SOURCES = sndfile-jackplay.c
|
||||
sndfile_jackplay_CFLAGS = $(JACK_CFLAGS)
|
||||
sndfile_jackplay_LDADD = $(SNDFILEDIR)/libsndfile.la $(JACK_LIBS)
|
||||
sndfile_jackplay_LDADD = $(top_builddir)/src/libsndfile.la $(JACK_LIBS)
|
||||
|
||||
sndfile_convert_SOURCES = sndfile-convert.c copy_data.c copy_data.h
|
||||
sndfile_convert_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
sndfile_convert_SOURCES = sndfile-convert.c common.c common.h
|
||||
sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_cmp_SOURCES = sndfile-cmp.c
|
||||
sndfile_cmp_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
sndfile_cmp_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_metadata_set_SOURCES = sndfile-metadata-set.c copy_data.c copy_data.h
|
||||
sndfile_metadata_set_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
sndfile_metadata_set_SOURCES = sndfile-metadata-set.c common.c common.h
|
||||
sndfile_metadata_set_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_metadata_get_SOURCES = sndfile-metadata-get.c
|
||||
sndfile_metadata_get_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
sndfile_metadata_get_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
make_sine_SOURCES = make_sine.c
|
||||
make_sine_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
make_sine_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sfprocess_SOURCES = sfprocess.c
|
||||
sfprocess_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
sfprocess_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
list_formats_SOURCES = list_formats.c
|
||||
list_formats_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
list_formats_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
generate_SOURCES = generate.c
|
||||
generate_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
generate_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfilehandle_SOURCES = sndfilehandle.cc
|
||||
sndfilehandle_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
sndfilehandle_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
|
260
examples/common.c
Normal file
260
examples/common.c
Normal file
@ -0,0 +1,260 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2008 George Blood Audio
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN 4096
|
||||
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
void
|
||||
sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
{ static double data [BUFFER_LEN], max ;
|
||||
int frames, readcount, k ;
|
||||
|
||||
frames = BUFFER_LEN / channels ;
|
||||
readcount = frames ;
|
||||
|
||||
sf_command (infile, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
|
||||
|
||||
if (max < 1.0)
|
||||
{ while (readcount > 0)
|
||||
{ readcount = sf_readf_double (infile, data, frames) ;
|
||||
sf_writef_double (outfile, data, readcount) ;
|
||||
} ;
|
||||
}
|
||||
else
|
||||
{ sf_command (infile, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_double (infile, data, frames) ;
|
||||
for (k = 0 ; k < readcount * channels ; k++)
|
||||
data [k] /= max ;
|
||||
sf_writef_double (outfile, data, readcount) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* sfe_copy_data_fp */
|
||||
|
||||
void
|
||||
sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
{ static int data [BUFFER_LEN] ;
|
||||
int frames, readcount ;
|
||||
|
||||
frames = BUFFER_LEN / channels ;
|
||||
readcount = frames ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_int (infile, data, frames) ;
|
||||
sf_writef_int (outfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* sfe_copy_data_int */
|
||||
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
static int
|
||||
merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const METADATA_INFO * info)
|
||||
{ SF_BROADCAST_INFO binfo ;
|
||||
int infileminor ;
|
||||
|
||||
memset (&binfo, 0, sizeof (binfo)) ;
|
||||
|
||||
if ((SF_FORMAT_TYPEMASK & format) != SF_FORMAT_WAV)
|
||||
{ printf ("Error : This is not a WAV file and hence broadcast info cannot be added to it.\n\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
infileminor = SF_FORMAT_SUBMASK & format ;
|
||||
|
||||
switch (infileminor)
|
||||
{ case SF_FORMAT_PCM_16 :
|
||||
case SF_FORMAT_PCM_24 :
|
||||
case SF_FORMAT_PCM_32 :
|
||||
break ;
|
||||
|
||||
default :
|
||||
printf (
|
||||
"Warning : The EBU Technical Recommendation R68-2000 states that the only\n"
|
||||
" allowed encodings are Linear PCM and MPEG3. This file is not in\n"
|
||||
" the right format.\n\n"
|
||||
) ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
if (sf_command (infile, SFC_GET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
|
||||
{ if (infile == outfile)
|
||||
{ printf (
|
||||
"Error : Attempting in-place broadcast info update, but file does not\n"
|
||||
" have a 'bext' chunk to modify. The solution is to specify both\n"
|
||||
" input and output files on the command line.\n\n"
|
||||
) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
#define REPLACE_IF_NEW(x) \
|
||||
if (info->x != NULL) \
|
||||
memcpy (binfo.x, info->x, MIN (strlen (info->x), sizeof (binfo.x))) ;
|
||||
|
||||
REPLACE_IF_NEW (description) ;
|
||||
REPLACE_IF_NEW (originator) ;
|
||||
REPLACE_IF_NEW (originator_reference) ;
|
||||
REPLACE_IF_NEW (origination_date) ;
|
||||
REPLACE_IF_NEW (origination_time) ;
|
||||
REPLACE_IF_NEW (umid) ;
|
||||
|
||||
/* Special case for coding_history because we may want to append. */
|
||||
if (info->coding_history != NULL)
|
||||
{ if (info->coding_hist_append)
|
||||
{ int slen = strlen (binfo.coding_history) ;
|
||||
|
||||
while (slen > 1 && isspace (binfo.coding_history [slen - 1]))
|
||||
slen -- ;
|
||||
|
||||
binfo.coding_history [slen++] = '\n' ;
|
||||
memcpy (binfo.coding_history + slen, info->coding_history, sizeof (binfo.coding_history) - slen) ;
|
||||
}
|
||||
else
|
||||
{ memcpy (binfo.coding_history, info->coding_history, sizeof (binfo.coding_history)) ;
|
||||
binfo.coding_history_size = sizeof (binfo.coding_history) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
if (sf_command (outfile, SFC_SET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
|
||||
printf ("Error : Setting of broadcast info chunks failed.\n\n") ;
|
||||
|
||||
return 0 ;
|
||||
} /* merge_broadcast_info*/
|
||||
|
||||
static void
|
||||
update_strings (SNDFILE * outfile, const METADATA_INFO * info)
|
||||
{
|
||||
if (info->title != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->title) ;
|
||||
|
||||
if (info->copyright != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->copyright) ;
|
||||
|
||||
if (info->artist != NULL)
|
||||
sf_set_string (outfile, SF_STR_ARTIST, info->artist) ;
|
||||
|
||||
if (info->comment != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->comment) ;
|
||||
|
||||
if (info->date != NULL)
|
||||
sf_set_string (outfile, SF_STR_DATE, info->date) ;
|
||||
|
||||
if (info->album != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->album) ;
|
||||
|
||||
if (info->license != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->license) ;
|
||||
|
||||
} /* update_strings */
|
||||
|
||||
|
||||
|
||||
void
|
||||
sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info)
|
||||
{ SNDFILE *infile = NULL, *outfile = NULL ;
|
||||
SF_INFO sfinfo ;
|
||||
METADATA_INFO tmpinfo ;
|
||||
int error_code = 0 ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
memset (&tmpinfo, 0, sizeof (tmpinfo)) ;
|
||||
|
||||
if (filenames [1] == NULL)
|
||||
infile = outfile = sf_open (filenames [0], SFM_RDWR, &sfinfo) ;
|
||||
else
|
||||
{ infile = sf_open (filenames [0], SFM_READ, &sfinfo) ;
|
||||
|
||||
/* Output must be WAV. */
|
||||
sfinfo.format = SF_FORMAT_WAV | (SF_FORMAT_SUBMASK & sfinfo.format) ;
|
||||
outfile = sf_open (filenames [1], SFM_WRITE, &sfinfo) ;
|
||||
} ;
|
||||
|
||||
if (infile == NULL)
|
||||
{ printf ("Error : Not able to open input file '%s' : %s\n", filenames [0], sf_strerror (infile)) ;
|
||||
error_code = 1 ;
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
if (outfile == NULL)
|
||||
{ printf ("Error : Not able to open output file '%s' : %s\n", filenames [1], sf_strerror (outfile)) ;
|
||||
error_code = 1 ;
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
if (info->has_bext_fields && merge_broadcast_info (infile, outfile, sfinfo.format, info))
|
||||
{ error_code = 1 ;
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
update_strings (outfile, info) ;
|
||||
|
||||
if (infile != outfile)
|
||||
{ int infileminor = SF_FORMAT_SUBMASK & sfinfo.format ;
|
||||
|
||||
/* If the input file is not the same as the output file, copy the data. */
|
||||
if ((infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT))
|
||||
sfe_copy_data_fp (outfile, infile, sfinfo.channels) ;
|
||||
else
|
||||
sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
|
||||
} ;
|
||||
|
||||
cleanup_exit :
|
||||
|
||||
if (outfile != NULL && outfile != infile)
|
||||
sf_close (outfile) ;
|
||||
|
||||
if (infile != NULL)
|
||||
sf_close (infile) ;
|
||||
|
||||
if (error_code)
|
||||
exit (error_code) ;
|
||||
|
||||
return ;
|
||||
} /* sfe_apply_metadata_changes */
|
||||
|
@ -32,6 +32,31 @@
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
typedef struct
|
||||
{ const char * title ;
|
||||
const char * copyright ;
|
||||
const char * artist ;
|
||||
const char * comment ;
|
||||
const char * date ;
|
||||
const char * album ;
|
||||
const char * license ;
|
||||
|
||||
|
||||
/* Stuff to go in the 'bext' chunk of WAV files. */
|
||||
int has_bext_fields ;
|
||||
int coding_hist_append ;
|
||||
|
||||
const char * description ;
|
||||
const char * originator ;
|
||||
const char * originator_reference ;
|
||||
const char * origination_date ;
|
||||
const char * origination_time ;
|
||||
const char * umid ;
|
||||
const char * coding_history ;
|
||||
} METADATA_INFO ;
|
||||
|
||||
void sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info) ;
|
||||
|
||||
void sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels) ;
|
||||
|
||||
void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "copy_data.h"
|
||||
|
||||
#define BUFFER_LEN 4096
|
||||
|
||||
void
|
||||
sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
{ static double data [BUFFER_LEN], max ;
|
||||
int frames, readcount, k ;
|
||||
|
||||
frames = BUFFER_LEN / channels ;
|
||||
readcount = frames ;
|
||||
|
||||
sf_command (infile, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
|
||||
|
||||
if (max < 1.0)
|
||||
{ while (readcount > 0)
|
||||
{ readcount = sf_readf_double (infile, data, frames) ;
|
||||
sf_writef_double (outfile, data, readcount) ;
|
||||
} ;
|
||||
}
|
||||
else
|
||||
{ sf_command (infile, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_double (infile, data, frames) ;
|
||||
for (k = 0 ; k < readcount * channels ; k++)
|
||||
data [k] /= max ;
|
||||
sf_writef_double (outfile, data, readcount) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* sfe_copy_data_fp */
|
||||
|
||||
void
|
||||
sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
{ static int data [BUFFER_LEN] ;
|
||||
int frames, readcount ;
|
||||
|
||||
frames = BUFFER_LEN / channels ;
|
||||
readcount = frames ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_int (infile, data, frames) ;
|
||||
sf_writef_int (outfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* sfe_copy_data_int */
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "copy_data.h"
|
||||
#include "common.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
|
@ -42,8 +42,6 @@
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "copy_data.h"
|
||||
|
||||
#define BUFFER_LEN (1 << 16)
|
||||
|
||||
|
||||
@ -65,7 +63,7 @@ main (int argc, char *argv [])
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
|
||||
/* Check if we've been asked for help. */
|
||||
if (argc < 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
|
||||
if (argc <= 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
|
||||
usage_exit (progname, 0) ;
|
||||
|
||||
if (argv [argc - 1][0] != '-')
|
||||
@ -102,8 +100,28 @@ main (int argc, char *argv [])
|
||||
|
||||
static void
|
||||
usage_exit (const char *progname, int exit_code)
|
||||
{ printf ("Usage :\n %s <file> ...\n", progname) ;
|
||||
printf (" Fill in more later.\n\n") ;
|
||||
{ printf ("\nUsage :\n %s [options] <file>\n\nOptions:\n", progname) ;
|
||||
|
||||
puts (
|
||||
" --bext-description Print the 'bext' description.\n"
|
||||
" --bext-originator Print the 'bext; originator info.\n"
|
||||
" --bext-orig-ref Print the 'bext' origination reference.\n"
|
||||
" --bext-umid Print the 'bext' UMID.\n"
|
||||
" --bext-orig-date Print the 'bext' origination date.\n"
|
||||
" --bext-orig-time Print the 'bext' origination time.\n"
|
||||
" --bext-coding-hist Print the 'bext' coding history.\n"
|
||||
) ;
|
||||
|
||||
puts (
|
||||
" --str-title Print the title metadata.\n"
|
||||
" --str-copyright Print the copyright metadata.\n"
|
||||
" --str-artist Print the artist metadata.\n"
|
||||
" --str-comment Print the comment metadata.\n"
|
||||
" --str-date Print the creation date metadata.\n"
|
||||
" --str-album Print the album metadata.\n"
|
||||
" --str-license Print the license metadata.\n"
|
||||
) ;
|
||||
|
||||
exit (exit_code) ;
|
||||
} /* usage_exit */
|
||||
|
||||
@ -138,9 +156,13 @@ process_args (SNDFILE * file, const SF_BROADCAST_INFO * binfo, int argc, char *
|
||||
HANDLE_BEXT_ARG ("--bext-orig-time", "Origination time", origination_time) ;
|
||||
HANDLE_BEXT_ARG ("--bext-coding-hist", "Coding history", coding_history) ;
|
||||
|
||||
HANDLE_STR_ARG ("--str-name", "Name", SF_STR_TITLE) ;
|
||||
HANDLE_STR_ARG ("--str-title", "Name", SF_STR_TITLE) ;
|
||||
HANDLE_STR_ARG ("--str-copyright", "Copyright", SF_STR_COPYRIGHT) ;
|
||||
HANDLE_STR_ARG ("--str-artist", "Artist", SF_STR_ARTIST) ;
|
||||
HANDLE_STR_ARG ("--str-create-date", "Create date", SF_STR_DATE) ;
|
||||
HANDLE_STR_ARG ("--str-comment", "Comment", SF_STR_COMMENT) ;
|
||||
HANDLE_STR_ARG ("--str-date", "Create date", SF_STR_DATE) ;
|
||||
HANDLE_STR_ARG ("--str-album", "Album", SF_STR_ALBUM) ;
|
||||
HANDLE_STR_ARG ("--str-license", "License", SF_STR_LICENSE) ;
|
||||
|
||||
if (! do_all)
|
||||
printf ("Error : Don't know what to do with command line arg '%s'.\n\n", argv [k]) ;
|
||||
|
@ -42,45 +42,19 @@
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "copy_data.h"
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN (1 << 16)
|
||||
|
||||
|
||||
typedef struct
|
||||
{ const char * name ;
|
||||
const char * artist ;
|
||||
const char * create_date ;
|
||||
|
||||
/* Stuff to go in the 'bext' chunk of WAV files. */
|
||||
int has_bext_fields ;
|
||||
int coding_hist_append ;
|
||||
|
||||
const char * description ;
|
||||
const char * originator ;
|
||||
const char * originator_reference ;
|
||||
const char * origination_date ;
|
||||
const char * origination_time ;
|
||||
const char * umid ;
|
||||
const char * coding_history ;
|
||||
} INFO ;
|
||||
|
||||
|
||||
|
||||
static void usage_exit (const char *progname, int exit_code) ;
|
||||
static void missing_param (const char * option) ;
|
||||
static void read_localtime (struct tm * timedata) ;
|
||||
|
||||
static void apply_changes (const char * filenames [2], const INFO * info) ;
|
||||
|
||||
static int merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const INFO * info) ;
|
||||
static void update_strings (SNDFILE * outfile, const INFO * info) ;
|
||||
|
||||
static int has_bext_fields_set (const INFO * info) ;
|
||||
static int has_bext_fields_set (const METADATA_INFO * info) ;
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{ INFO info ;
|
||||
{ METADATA_INFO info ;
|
||||
struct tm timedata ;
|
||||
const char *progname ;
|
||||
const char * filenames [2] = { NULL, NULL } ;
|
||||
@ -113,94 +87,36 @@ main (int argc, char *argv [])
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-description") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.description = argv [k] ;
|
||||
continue ;
|
||||
#define HANDLE_BEXT_ARG(cmd,field) \
|
||||
if (strcmp (argv [k], cmd) == 0) \
|
||||
{ k ++ ; \
|
||||
if (k == argc) missing_param (argv [k - 1]) ; \
|
||||
info.field = argv [k] ; \
|
||||
continue ; \
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-originator") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
HANDLE_BEXT_ARG ("--bext-description", description) ;
|
||||
HANDLE_BEXT_ARG ("--bext-originator", originator) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-ref", originator_reference) ;
|
||||
HANDLE_BEXT_ARG ("--bext-umid", umid) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-date", origination_date) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-time", origination_time) ;
|
||||
HANDLE_BEXT_ARG ("--bext-coding-hist", coding_history) ;
|
||||
|
||||
info.originator = argv [k] ;
|
||||
continue ;
|
||||
} ;
|
||||
#define HANDLE_STR_ARG(cmd,field) \
|
||||
if (strcmp (argv [k], cmd) == 0) \
|
||||
{ k ++ ; \
|
||||
if (k == argc) missing_param (argv [k - 1]) ; \
|
||||
info.field = argv [k] ; \
|
||||
continue ; \
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-orig-ref") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.originator_reference = argv [k] ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-umid") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.umid = argv [k] ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-orig-date") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.origination_date = argv [k] ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-orig-time") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.origination_time = argv [k] ;
|
||||
puts (info.origination_time) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-coding-hist") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.coding_history = argv [k] ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-coding-hist-append") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.coding_history = argv [k] ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--str-name") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.name = argv [k] ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--str-artist") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.artist = argv [k] ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--str-create-date") == 0)
|
||||
{ k ++ ;
|
||||
if (k == argc) missing_param (argv [k - 1]) ;
|
||||
|
||||
info.create_date = argv [k] ;
|
||||
continue ;
|
||||
} ;
|
||||
HANDLE_STR_ARG ("--str-title", title) ;
|
||||
HANDLE_STR_ARG ("--str-copyright", copyright) ;
|
||||
HANDLE_STR_ARG ("--str-artist", artist) ;
|
||||
HANDLE_STR_ARG ("--str-date", date) ;
|
||||
HANDLE_STR_ARG ("--str-album", album) ;
|
||||
HANDLE_STR_ARG ("--str-license", license) ;
|
||||
|
||||
/* Following options do not take an argument. */
|
||||
if (strcmp (argv [k], "--bext-auto-time-date") == 0)
|
||||
@ -227,12 +143,12 @@ main (int argc, char *argv [])
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--str-auto-create-date") == 0)
|
||||
if (strcmp (argv [k], "--str-auto-date") == 0)
|
||||
{ char tmp [20] ;
|
||||
|
||||
snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
|
||||
|
||||
info.create_date = strdup (tmp) ;
|
||||
info.date = strdup (tmp) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
@ -253,7 +169,7 @@ main (int argc, char *argv [])
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
apply_changes (filenames, &info) ;
|
||||
sfe_apply_metadata_changes (filenames, &info) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
@ -264,8 +180,50 @@ main (int argc, char *argv [])
|
||||
|
||||
static void
|
||||
usage_exit (const char *progname, int exit_code)
|
||||
{ printf ("Usage :\n %s <file> ...\n", progname) ;
|
||||
printf (" Fill in more later.\n\n") ;
|
||||
{ printf ("\nUsage :\n\n"
|
||||
" %s [options] <file>\n"
|
||||
" %s [options] <input file> <output file>\n"
|
||||
"\n",
|
||||
progname, progname) ;
|
||||
|
||||
puts (
|
||||
"Where an option is made up of a pair of a field to set (one of\n"
|
||||
"the 'bext' or metadata fields below) and a string. Fields are\n"
|
||||
"as follows :\n"
|
||||
) ;
|
||||
|
||||
puts (
|
||||
" --bext-description Set the 'bext' description.\n"
|
||||
" --bext-originator Set the 'bext' originator.\n"
|
||||
" --bext-orig-ref Set the 'bext' originator reference.\n"
|
||||
" --bext-umid Set the 'bext' UMID.\n"
|
||||
" --bext-orig-date Set the 'bext' origination date.\n"
|
||||
" --bext-orig-time Set the 'bext' origination time.\n"
|
||||
" --bext-coding-hist Set the 'bext' coding history\n"
|
||||
"\n"
|
||||
" --str-title Set the metadata title.\n"
|
||||
" --str-copyright Set the metadata copyright.\n"
|
||||
" --str-artist Set the metadata artist.\n"
|
||||
" --str-date Set the metadata date.\n"
|
||||
" --str-album Set the metadata album.\n"
|
||||
" --str-license Set the metadata license.\n"
|
||||
) ;
|
||||
|
||||
puts (
|
||||
"There are also the following arguments which do not take a\n"
|
||||
"parameter :\n\n"
|
||||
" --bext-auto-time-date Set the 'bext' time and date to current time/date.\n"
|
||||
" --bext-auto-time Set the 'bext' time to current time.\n"
|
||||
" --bext-auto-date Set the 'bext' date to current date.\n"
|
||||
" --str-auto-date Set the metadata date to current date.\n"
|
||||
) ;
|
||||
|
||||
puts (
|
||||
"Most of the above operations can be done in-place on an existing\n"
|
||||
"file. If any operation cannot be performed, the application will\n"
|
||||
"exit with an appropriate error message.\n"
|
||||
) ;
|
||||
|
||||
exit (exit_code) ;
|
||||
} /* usage_exit */
|
||||
|
||||
@ -280,14 +238,14 @@ missing_param (const char * option)
|
||||
*/
|
||||
|
||||
static int
|
||||
has_bext_fields_set (const INFO * info)
|
||||
has_bext_fields_set (const METADATA_INFO * info)
|
||||
{
|
||||
if (info->description || info->originator || info->originator_reference)
|
||||
return 1 ;
|
||||
|
||||
|
||||
if (info->origination_date || info->origination_time || info->umid || info->coding_history)
|
||||
return 1 ;
|
||||
|
||||
|
||||
return 0 ;
|
||||
} /* has_bext_fields_set */
|
||||
|
||||
@ -311,154 +269,3 @@ read_localtime (struct tm * timedata)
|
||||
return ;
|
||||
} /* read_localtime */
|
||||
|
||||
static void
|
||||
apply_changes (const char * filenames [2], const INFO * info)
|
||||
{ SNDFILE *infile = NULL, *outfile = NULL ;
|
||||
SF_INFO sfinfo ;
|
||||
INFO tmpinfo ;
|
||||
int error_code = 0 ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
memset (&tmpinfo, 0, sizeof (tmpinfo)) ;
|
||||
|
||||
if (filenames [1] == NULL)
|
||||
infile = outfile = sf_open (filenames [0], SFM_RDWR, &sfinfo) ;
|
||||
else
|
||||
{ infile = sf_open (filenames [0], SFM_READ, &sfinfo) ;
|
||||
|
||||
/* Output must be WAV. */
|
||||
sfinfo.format = SF_FORMAT_WAV | (SF_FORMAT_SUBMASK & sfinfo.format) ;
|
||||
outfile = sf_open (filenames [1], SFM_WRITE, &sfinfo) ;
|
||||
} ;
|
||||
|
||||
if (infile == NULL)
|
||||
{ printf ("Error : Not able to open input file '%s' : %s\n", filenames [0], sf_strerror (infile)) ;
|
||||
error_code = 1 ;
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
if (outfile == NULL)
|
||||
{ printf ("Error : Not able to open output file '%s' : %s\n", filenames [1], sf_strerror (outfile)) ;
|
||||
error_code = 1 ;
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
if (info->has_bext_fields && merge_broadcast_info (infile, outfile, sfinfo.format, info))
|
||||
{ error_code = 1 ;
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
update_strings (outfile, info) ;
|
||||
|
||||
if (infile != outfile)
|
||||
{ int infileminor = SF_FORMAT_SUBMASK & sfinfo.format ;
|
||||
|
||||
/* If the input file is not the same as the output file, copy the data. */
|
||||
if ((infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT))
|
||||
sfe_copy_data_fp (outfile, infile, sfinfo.channels) ;
|
||||
else
|
||||
sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
|
||||
} ;
|
||||
|
||||
cleanup_exit :
|
||||
|
||||
if (outfile != NULL && outfile != infile)
|
||||
sf_close (outfile) ;
|
||||
|
||||
if (infile != NULL)
|
||||
sf_close (infile) ;
|
||||
|
||||
if (error_code)
|
||||
exit (error_code) ;
|
||||
|
||||
return ;
|
||||
} /* apply_changes */
|
||||
|
||||
static int
|
||||
merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const INFO * info)
|
||||
{ SF_BROADCAST_INFO binfo ;
|
||||
int infileminor ;
|
||||
|
||||
memset (&binfo, 0, sizeof (binfo)) ;
|
||||
|
||||
if ((SF_FORMAT_TYPEMASK & format) != SF_FORMAT_WAV)
|
||||
{ printf ("Error : This is not a WAV file and hence broadcast info cannot be added to it.\n\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
infileminor = SF_FORMAT_SUBMASK & format ;
|
||||
|
||||
switch (infileminor)
|
||||
{ case SF_FORMAT_PCM_16 :
|
||||
case SF_FORMAT_PCM_24 :
|
||||
case SF_FORMAT_PCM_32 :
|
||||
break ;
|
||||
|
||||
default :
|
||||
printf (
|
||||
"Warning : The EBU Technical Recommendation R68-2000 states that the only\n"
|
||||
" allowed encodings are Linear PCM and MPEG3. This file is not in\n"
|
||||
" the right format.\n\n"
|
||||
) ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
if (sf_command (infile, SFC_GET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
|
||||
{ if (infile == outfile)
|
||||
{ printf (
|
||||
"Error : Attempting in-place broadcast info update, but file does not\n"
|
||||
" have a 'bext' chunk to modify. The solution is to specify both\n"
|
||||
" input and output files on the command line.\n\n"
|
||||
) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
#define REPLACE_IF_NEW(x) \
|
||||
if (info->x != NULL) \
|
||||
memcpy (binfo.x, info->x, sizeof (binfo.x)) ;
|
||||
|
||||
REPLACE_IF_NEW (description) ;
|
||||
REPLACE_IF_NEW (originator) ;
|
||||
REPLACE_IF_NEW (originator_reference) ;
|
||||
REPLACE_IF_NEW (origination_date) ;
|
||||
REPLACE_IF_NEW (origination_time) ;
|
||||
REPLACE_IF_NEW (umid) ;
|
||||
|
||||
/* Special case for coding_history because we may want to append. */
|
||||
if (info->coding_history != NULL)
|
||||
{ if (info->coding_hist_append)
|
||||
{ int slen = strlen (binfo.coding_history) ;
|
||||
|
||||
while (slen > 1 && isspace (binfo.coding_history [slen - 1]))
|
||||
slen -- ;
|
||||
|
||||
binfo.coding_history [slen++] = '\n' ;
|
||||
memcpy (binfo.coding_history + slen, info->coding_history, sizeof (binfo.coding_history) - slen) ;
|
||||
}
|
||||
else
|
||||
{ memcpy (binfo.coding_history, info->coding_history, sizeof (binfo.coding_history)) ;
|
||||
binfo.coding_history_size = sizeof (binfo.coding_history) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
if (sf_command (outfile, SFC_SET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
|
||||
printf ("Error : Setting of broadcast info chunks failed.\n\n") ;
|
||||
|
||||
return 0 ;
|
||||
} /* merge_broadcast_info*/
|
||||
|
||||
static void
|
||||
update_strings (SNDFILE * outfile, const INFO * info)
|
||||
{
|
||||
if (info->name != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->name) ;
|
||||
|
||||
if (info->artist != NULL)
|
||||
sf_set_string (outfile, SF_STR_ARTIST, info->artist) ;
|
||||
|
||||
if (info->create_date != NULL)
|
||||
sf_set_string (outfile, SF_STR_DATE, info->create_date) ;
|
||||
|
||||
} /* update_strings */
|
||||
|
||||
|
@ -700,7 +700,7 @@ win32_play_data (Win32_Audio_Data *audio_data)
|
||||
} /* win32_play_data */
|
||||
|
||||
static void CALLBACK
|
||||
win32_audio_out_callback (HWAVEOUT hwave, UINT msg, DWORD data, DWORD param1, DWORD param2)
|
||||
win32_audio_out_callback (HWAVEOUT hwave, UINT msg, DWORD_PTR data, DWORD param1, DWORD param2)
|
||||
{ Win32_Audio_Data *audio_data ;
|
||||
|
||||
/* Prevent compiler warnings. */
|
||||
@ -728,11 +728,6 @@ win32_audio_out_callback (HWAVEOUT hwave, UINT msg, DWORD data, DWORD param1, DW
|
||||
return ;
|
||||
} /* win32_audio_out_callback */
|
||||
|
||||
/* This is needed for earlier versions of the M$ development tools. */
|
||||
#ifndef DWORD_PTR
|
||||
#define DWORD_PTR DWORD
|
||||
#endif
|
||||
|
||||
static void
|
||||
win32_play (int argc, char *argv [])
|
||||
{ Win32_Audio_Data audio_data ;
|
||||
|
@ -100,6 +100,20 @@ def test_auto_date ():
|
||||
print "ok"
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
def test_coding_history ():
|
||||
print_test_name ("Coding history test")
|
||||
cmd = "./sndfile-metadata-set --bext-coding-hist \"alpha beta\" output.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
cmd = "./sndfile-metadata-get --bext-coding-hist output.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
print "ok"
|
||||
|
||||
#===============================================================================
|
||||
|
||||
if os.path.isdir ("examples"):
|
||||
@ -121,7 +135,7 @@ test_copy ()
|
||||
tests = [
|
||||
("--bext-description", "Alpha"), ("--bext-originator", "Beta"), ("--bext-orig-ref", "Charlie"),
|
||||
("--bext-umid", "Delta"), ("--bext-orig-date", "2001-10-01"), ("--bext-orig-time", "01:02:03"),
|
||||
("--str-name", "Echo"), ("--str-artist", "Fox trot")
|
||||
("--str-title", "Echo"), ("--str-artist", "Fox trot")
|
||||
]
|
||||
|
||||
test_auto_date ()
|
||||
@ -130,6 +144,8 @@ test_post_mod (tests)
|
||||
|
||||
test_update ([ ("--str-artist", "Fox") ])
|
||||
|
||||
test_coding_history ()
|
||||
|
||||
print ""
|
||||
|
||||
sys.exit (0)
|
||||
|
@ -4,9 +4,8 @@ bin_PROGRAMS = sndfile-regtest
|
||||
|
||||
noinst_HEADERS = regtest.h
|
||||
|
||||
SNDFILEDIR =../src
|
||||
INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(SQLITE3_CFLAGS) $(OS_SPECIFIC_CFLAGS)
|
||||
INCLUDES = -I$(top_srcdir)/src $(SQLITE3_CFLAGS) $(OS_SPECIFIC_CFLAGS)
|
||||
|
||||
sndfile_regtest_SOURCES = sndfile-regtest.c database.c checksum.c
|
||||
sndfile_regtest_LDADD = $(SNDFILEDIR)/libsndfile.la $(SQLITE3_LIBS)
|
||||
sndfile_regtest_LDADD = $(top_builddir)/src/libsndfile.la $(SQLITE3_LIBS)
|
||||
|
||||
|
@ -516,6 +516,7 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
psf_log_printf (psf, " Block Size : %u\n", ssnd_fmt.blocksize) ;
|
||||
|
||||
psf->dataoffset += ssnd_fmt.offset ;
|
||||
psf->datalength -= ssnd_fmt.offset ;
|
||||
}
|
||||
else
|
||||
{ psf_log_printf (psf, " Offset : %u (Should be zero)\n", ssnd_fmt.offset) ;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Copyright (C) 2006 Paul Davis <paul@linuxaudiosystems.com>
|
||||
** Copyright (C) 2006, 2007 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2006-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
@ -22,6 +22,8 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
static void strncpy_crlf (char *dest, const char *src, size_t n) ;
|
||||
|
||||
/*
|
||||
** Allocate and initialize a broadcast info structure.
|
||||
*/
|
||||
@ -119,14 +121,23 @@ broadcast_add_coding_history (SF_BROADCAST_INFO* bext, unsigned int channels, un
|
||||
/* Make sure its a terminated C string. */
|
||||
bext->coding_history [sizeof (bext->coding_history) - 1] = 0 ;
|
||||
|
||||
current_history_len = strlen (bext->coding_history) ;
|
||||
/* Note newlines in Coding History should be '\r\n' as per the URL above. */
|
||||
|
||||
if (bext->coding_history_size > 0)
|
||||
strncpy_crlf (history, bext->coding_history, sizeof (history)) ;
|
||||
else
|
||||
history [0] = 0 ;
|
||||
|
||||
current_history_len = strlen (history) ;
|
||||
newline = "" ;
|
||||
|
||||
if (current_history_len != 0 && bext->coding_history [current_history_len - 1] != '\n')
|
||||
newline = "\n" ;
|
||||
if (current_history_len != 0 && history [current_history_len - 1] != '\n')
|
||||
newline = "\r\n" ;
|
||||
|
||||
memset (history, 0, sizeof (history)) ;
|
||||
count = LSF_SNPRINTF (history, sizeof (history), "%s%sF=%u,A=PCM,M=%s,W=%hu,T=%s-%s\n", bext->coding_history, newline, samplerate, chnstr, width, PACKAGE, VERSION) ;
|
||||
count = LSF_SNPRINTF (history + current_history_len, sizeof (history) - current_history_len,
|
||||
"%sA=PCM,F=%u,W=%hu,M=%s,T=%s-%s\r\n",
|
||||
newline, samplerate, width, chnstr, PACKAGE, VERSION) ;
|
||||
count += current_history_len ;
|
||||
|
||||
while (count >= SIGNED_SIZEOF (bext->coding_history))
|
||||
{ /* Coding history is too long, delete oldest part. */
|
||||
@ -155,3 +166,39 @@ broadcast_add_coding_history (SF_BROADCAST_INFO* bext, unsigned int channels, un
|
||||
return SF_TRUE ;
|
||||
} /* broadcast_add_coding_history */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Strncpy which converts all line endings to CR/LF.
|
||||
*/
|
||||
|
||||
static void
|
||||
strncpy_crlf (char *dest, const char *src, size_t max)
|
||||
{ char * end = dest + max - 1 ;
|
||||
|
||||
while (dest < end && src [0])
|
||||
{ if ((src [0] == '\r' && src [1] == '\n') || (src [0] == '\n' && src [1] == '\r'))
|
||||
{ *dest++ = '\r' ;
|
||||
*dest++ = '\n' ;
|
||||
src += 2 ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (src [0] == '\r')
|
||||
{ *dest++ = '\r' ;
|
||||
*dest++ = '\n' ;
|
||||
src += 1 ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (src [0] == '\n')
|
||||
{ *dest++ = '\r' ;
|
||||
*dest++ = '\n' ;
|
||||
src += 1 ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
*dest++ = *src++ ;
|
||||
} ;
|
||||
|
||||
/* Make sure dest is terminated. */
|
||||
*end = 0 ;
|
||||
} /* strncpy_crlf */
|
||||
|
@ -99,7 +99,7 @@ psf_get_format_simple (SF_FORMAT_INFO *data)
|
||||
{ int indx ;
|
||||
|
||||
if (data->format < 0 || data->format >= (SIGNED_SIZEOF (simple_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)))
|
||||
return SFE_BAD_CONTROL_CMD ;
|
||||
return SFE_BAD_COMMAND_PARAM ;
|
||||
|
||||
indx = data->format ;
|
||||
memcpy (data, &(simple_formats [indx]), SIGNED_SIZEOF (SF_FORMAT_INFO)) ;
|
||||
@ -153,7 +153,7 @@ psf_get_format_major (SF_FORMAT_INFO *data)
|
||||
{ int indx ;
|
||||
|
||||
if (data->format < 0 || data->format >= (SIGNED_SIZEOF (major_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)))
|
||||
return SFE_BAD_CONTROL_CMD ;
|
||||
return SFE_BAD_COMMAND_PARAM ;
|
||||
|
||||
indx = data->format ;
|
||||
memcpy (data, &(major_formats [indx]), SIGNED_SIZEOF (SF_FORMAT_INFO)) ;
|
||||
@ -210,7 +210,7 @@ psf_get_format_subtype (SF_FORMAT_INFO *data)
|
||||
{ int indx ;
|
||||
|
||||
if (data->format < 0 || data->format >= (SIGNED_SIZEOF (subtype_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)))
|
||||
return SFE_BAD_CONTROL_CMD ;
|
||||
return SFE_BAD_COMMAND_PARAM ;
|
||||
|
||||
indx = data->format ;
|
||||
memcpy (data, &(subtype_formats [indx]), sizeof (SF_FORMAT_INFO)) ;
|
||||
@ -248,7 +248,7 @@ psf_get_format_info (SF_FORMAT_INFO *data)
|
||||
|
||||
memset (data, 0, sizeof (SF_FORMAT_INFO)) ;
|
||||
|
||||
return SFE_BAD_CONTROL_CMD ;
|
||||
return SFE_BAD_COMMAND_PARAM ;
|
||||
} /* psf_get_format_info */
|
||||
|
||||
/*==============================================================================
|
||||
|
@ -424,11 +424,10 @@ enum
|
||||
SFE_NO_PIPE_WRITE,
|
||||
|
||||
SFE_INTERNAL,
|
||||
SFE_BAD_CONTROL_CMD,
|
||||
SFE_BAD_COMMAND_PARAM,
|
||||
SFE_BAD_ENDIAN,
|
||||
SFE_CHANNEL_COUNT_ZERO,
|
||||
SFE_CHANNEL_COUNT,
|
||||
SFE_BAD_RDWR_FORMAT,
|
||||
|
||||
SFE_BAD_VIRTUAL_IO,
|
||||
|
||||
@ -446,6 +445,7 @@ enum
|
||||
SFE_OPEN_PIPE_RDWR,
|
||||
SFE_RDWR_POSITION,
|
||||
SFE_RDWR_BAD_HEADER,
|
||||
SFE_CMD_HAS_DATA,
|
||||
|
||||
SFE_STR_NO_SUPPORT,
|
||||
SFE_STR_NOT_WRITE,
|
||||
|
@ -592,10 +592,6 @@ psf_fsync (SF_PRIVATE *psf)
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
|
||||
#ifndef HAVE_SSIZE_T
|
||||
typedef long ssize_t ;
|
||||
#endif
|
||||
|
||||
static int psf_close_handle (HANDLE handle) ;
|
||||
static HANDLE psf_open_handle (const char * path, int mode) ;
|
||||
static sf_count_t psf_get_filelen_handle (HANDLE handle) ;
|
||||
@ -862,7 +858,7 @@ psf_set_stdio (SF_PRIVATE *psf, int mode)
|
||||
/* USE_WINDOWS_API */ void
|
||||
psf_set_file (SF_PRIVATE *psf, int fd)
|
||||
{ HANDLE handle ;
|
||||
long osfhandle ;
|
||||
intptr_t osfhandle ;
|
||||
|
||||
osfhandle = _get_osfhandle (fd) ;
|
||||
handle = (HANDLE) osfhandle ;
|
||||
@ -1165,10 +1161,6 @@ psf_ftruncate (SF_PRIVATE *psf, sf_count_t len)
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
|
||||
#ifndef HAVE_SSIZE_T
|
||||
typedef long ssize_t ;
|
||||
#endif
|
||||
|
||||
/* Win32 */ int
|
||||
psf_fopen (SF_PRIVATE *psf, const char *pathname, int open_mode)
|
||||
{ int oflag, mode ;
|
||||
|
@ -621,7 +621,7 @@ flac_open (SF_PRIVATE *psf)
|
||||
psf->codec_data = pflac ;
|
||||
|
||||
if (psf->mode == SFM_RDWR)
|
||||
return SFE_BAD_RDWR_FORMAT ;
|
||||
return SFE_BAD_MODE_RW ;
|
||||
|
||||
if (psf->mode == SFM_READ)
|
||||
{ if ((error = flac_read_header (psf)))
|
||||
|
@ -152,6 +152,8 @@ Need separate gsm_data structs for encode and decode.
|
||||
|
||||
psf->sf.frames = pgsm610->samplesperblock * pgsm610->blocks ;
|
||||
|
||||
psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
|
||||
|
||||
pgsm610->decode_block (psf, pgsm610) ; /* Read first block. */
|
||||
|
||||
psf->read_short = gsm610_read_s ;
|
||||
|
@ -449,7 +449,7 @@ ogg_close (SF_PRIVATE *psf)
|
||||
{
|
||||
if (psf->write_current <= 0)
|
||||
ogg_write_header (psf, 0) ;
|
||||
|
||||
|
||||
vorbis_analysis_wrote (&vdata->vd, 0) ;
|
||||
while (vorbis_analysis_blockout (&vdata->vd, &vdata->vb) == 1)
|
||||
{
|
||||
|
@ -82,13 +82,12 @@ ErrorStruct SndfileErrors [] =
|
||||
{ SFE_UNKNOWN_FORMAT , "File contains data in an unknown format." },
|
||||
{ SFE_NOT_READMODE , "Read attempted on file currently open for write." },
|
||||
{ SFE_NOT_WRITEMODE , "Write attempted on file currently open for read." },
|
||||
{ SFE_BAD_MODE_RW , "This file format does not support read/write mode." },
|
||||
{ SFE_BAD_MODE_RW , "Error : This file format does not support read/write mode." },
|
||||
{ SFE_BAD_SF_INFO , "Internal error : SF_INFO struct incomplete." },
|
||||
{ SFE_BAD_OFFSET , "Error : supplied offset beyond end of file." },
|
||||
{ SFE_NO_EMBED_SUPPORT , "Error : embedding not supported for this file format." },
|
||||
{ SFE_NO_EMBEDDED_RDWR , "Error : cannot open embedded file read/write." },
|
||||
{ SFE_NO_PIPE_WRITE , "Error : this file format does not support pipe write." },
|
||||
{ SFE_BAD_RDWR_FORMAT , "Error : File format cannot be opened for RDWR." },
|
||||
{ SFE_BAD_VIRTUAL_IO , "Error : bad pointer on SF_VIRTUAL_IO struct." },
|
||||
|
||||
{ SFE_INTERLEAVE_MODE , "Attempt to write to file with non-interleaved data." },
|
||||
@ -96,7 +95,7 @@ ErrorStruct SndfileErrors [] =
|
||||
{ SFE_INTERLEAVE_READ , "Bad karma in read during interleave read operation." },
|
||||
|
||||
{ SFE_INTERNAL , "Unspecified internal error." },
|
||||
{ SFE_BAD_CONTROL_CMD , "Bad command passed to function sf_command()." },
|
||||
{ SFE_BAD_COMMAND_PARAM , "Bad parameter passed to function sf_command." },
|
||||
{ SFE_BAD_ENDIAN , "Bad endian-ness. Try default endian-ness" },
|
||||
{ SFE_CHANNEL_COUNT_ZERO , "Channel count is zero." },
|
||||
{ SFE_CHANNEL_COUNT , "Too many channels specified." },
|
||||
@ -111,7 +110,8 @@ ErrorStruct SndfileErrors [] =
|
||||
{ SFE_OPEN_PIPE_RDWR , "Error : attempt toopen a pipe in read/write mode." },
|
||||
{ SFE_RDWR_POSITION , "Error on RDWR position (cryptic)." },
|
||||
{ SFE_RDWR_BAD_HEADER , "Error : Cannot open file in read/write mode due to string data in header." },
|
||||
|
||||
{ SFE_CMD_HAS_DATA , "Error : Command fails because file already has audio data." },
|
||||
|
||||
{ SFE_STR_NO_SUPPORT , "Error : File type does not support string data." },
|
||||
{ SFE_STR_NOT_WRITE , "Error : Trying to set a string when file is not in write mode." },
|
||||
{ SFE_STR_MAX_DATA , "Error : Maximum string data storage reached." },
|
||||
@ -827,7 +827,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
switch (command)
|
||||
{ case SFC_GET_LIB_VERSION :
|
||||
if (data == NULL)
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
if (ENABLE_EXPERIMENTAL_CODE)
|
||||
LSF_SNPRINTF (data, datasize, "%s-%s-exp", PACKAGE_NAME, PACKAGE_VERSION) ;
|
||||
else
|
||||
@ -836,46 +836,46 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
|
||||
case SFC_GET_SIMPLE_FORMAT_COUNT :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (int))
|
||||
return (sf_errno = SFE_BAD_CONTROL_CMD) ;
|
||||
return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
|
||||
*((int*) data) = psf_get_format_simple_count () ;
|
||||
return 0 ;
|
||||
|
||||
case SFC_GET_SIMPLE_FORMAT :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO))
|
||||
return (sf_errno = SFE_BAD_CONTROL_CMD) ;
|
||||
return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
|
||||
return psf_get_format_simple (data) ;
|
||||
|
||||
case SFC_GET_FORMAT_MAJOR_COUNT :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (int))
|
||||
return (sf_errno = SFE_BAD_CONTROL_CMD) ;
|
||||
return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
|
||||
*((int*) data) = psf_get_format_major_count () ;
|
||||
return 0 ;
|
||||
|
||||
case SFC_GET_FORMAT_MAJOR :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO))
|
||||
return (sf_errno = SFE_BAD_CONTROL_CMD) ;
|
||||
return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
|
||||
return psf_get_format_major (data) ;
|
||||
|
||||
case SFC_GET_FORMAT_SUBTYPE_COUNT :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (int))
|
||||
return (sf_errno = SFE_BAD_CONTROL_CMD) ;
|
||||
return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
|
||||
*((int*) data) = psf_get_format_subtype_count () ;
|
||||
return 0 ;
|
||||
|
||||
case SFC_GET_FORMAT_SUBTYPE :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO))
|
||||
return (sf_errno = SFE_BAD_CONTROL_CMD) ;
|
||||
return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
|
||||
return psf_get_format_subtype (data) ;
|
||||
|
||||
case SFC_GET_FORMAT_INFO :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO))
|
||||
return (sf_errno = SFE_BAD_CONTROL_CMD) ;
|
||||
return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
|
||||
return psf_get_format_info (data) ;
|
||||
} ;
|
||||
|
||||
if (sndfile == NULL && command == SFC_GET_LOG_INFO)
|
||||
{ if (data == NULL)
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
LSF_SNPRINTF (data, datasize, "%s", sf_logbuffer) ;
|
||||
return strlen (data) ;
|
||||
} ;
|
||||
@ -890,7 +890,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
|
||||
case SFC_GET_CURRENT_SF_INFO :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (SF_INFO))
|
||||
return (sf_errno = SFE_BAD_CONTROL_CMD) ;
|
||||
return (sf_errno = SFE_BAD_COMMAND_PARAM) ;
|
||||
memcpy (data, &psf->sf, sizeof (SF_INFO)) ;
|
||||
break ;
|
||||
|
||||
@ -937,7 +937,9 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
return SF_FALSE ;
|
||||
/* If data has already been written this must fail. */
|
||||
if (psf->have_written)
|
||||
{ psf->error = SFE_CMD_HAS_DATA ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
/* Everything seems OK, so set psf->has_peak and re-write header. */
|
||||
if (datasize == SF_FALSE && psf->peak_info != NULL)
|
||||
{ free (psf->peak_info) ;
|
||||
@ -958,42 +960,42 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
|
||||
case SFC_GET_LOG_INFO :
|
||||
if (data == NULL)
|
||||
return SFE_BAD_CONTROL_CMD ;
|
||||
return SFE_BAD_COMMAND_PARAM ;
|
||||
LSF_SNPRINTF (data, datasize, "%s", psf->logbuffer) ;
|
||||
break ;
|
||||
|
||||
case SFC_CALC_SIGNAL_MAX :
|
||||
if (data == NULL || datasize != sizeof (double))
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
*((double*) data) = psf_calc_signal_max (psf, SF_FALSE) ;
|
||||
break ;
|
||||
|
||||
case SFC_CALC_NORM_SIGNAL_MAX :
|
||||
if (data == NULL || datasize != sizeof (double))
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
*((double*) data) = psf_calc_signal_max (psf, SF_TRUE) ;
|
||||
break ;
|
||||
|
||||
case SFC_CALC_MAX_ALL_CHANNELS :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (double) * psf->sf.channels)
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
return psf_calc_max_all_channels (psf, (double*) data, SF_FALSE) ;
|
||||
|
||||
case SFC_CALC_NORM_MAX_ALL_CHANNELS :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (double) * psf->sf.channels)
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
return psf_calc_max_all_channels (psf, (double*) data, SF_TRUE) ;
|
||||
|
||||
case SFC_GET_SIGNAL_MAX :
|
||||
if (data == NULL || datasize != sizeof (double))
|
||||
{ psf->error = SFE_BAD_CONTROL_CMD ;
|
||||
{ psf->error = SFE_BAD_COMMAND_PARAM ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
return psf_get_signal_max (psf, (double *) data) ;
|
||||
|
||||
case SFC_GET_MAX_ALL_CHANNELS :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (double) * psf->sf.channels)
|
||||
{ psf->error = SFE_BAD_CONTROL_CMD ;
|
||||
{ psf->error = SFE_BAD_COMMAND_PARAM ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
return psf_get_max_all_channels (psf, (double*) data) ;
|
||||
@ -1019,7 +1021,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
|
||||
case SFC_SET_DITHER_ON_WRITE :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (SF_DITHER_INFO))
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
memcpy (&psf->write_dither, data, sizeof (psf->write_dither)) ;
|
||||
if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
|
||||
dither_init (psf, SFM_WRITE) ;
|
||||
@ -1027,7 +1029,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
|
||||
case SFC_SET_DITHER_ON_READ :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (SF_DITHER_INFO))
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
memcpy (&psf->read_dither, data, sizeof (psf->read_dither)) ;
|
||||
if (psf->mode == SFM_READ || psf->mode == SFM_RDWR)
|
||||
dither_init (psf, SFM_READ) ;
|
||||
@ -1055,9 +1057,10 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
|
||||
case SFC_SET_RAW_START_OFFSET :
|
||||
if (data == NULL || datasize != sizeof (sf_count_t))
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
|
||||
if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_RAW)
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
|
||||
psf->dataoffset = *((sf_count_t*) data) ;
|
||||
sf_seek (sndfile, 0, SEEK_CUR) ;
|
||||
@ -1065,7 +1068,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
|
||||
case SFC_GET_EMBED_FILE_INFO :
|
||||
if (data == NULL || datasize != sizeof (SF_EMBED_FILE_INFO))
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
|
||||
((SF_EMBED_FILE_INFO*) data)->offset = psf->fileoffset ;
|
||||
((SF_EMBED_FILE_INFO*) data)->length = psf->filelength ;
|
||||
@ -1079,7 +1082,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
else if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_DOUBLE)
|
||||
double64_init (psf) ;
|
||||
else
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
break ;
|
||||
/* Lite remove end */
|
||||
|
||||
@ -1092,7 +1095,9 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
|
||||
case SFC_GET_LOOP_INFO :
|
||||
if (datasize != sizeof (SF_LOOP_INFO) || data == NULL)
|
||||
{ psf->error = SFE_BAD_COMMAND_PARAM ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
if (psf->loop_info == NULL)
|
||||
return SF_FALSE ;
|
||||
memcpy (data, psf->loop_info, sizeof (SF_LOOP_INFO)) ;
|
||||
@ -1111,7 +1116,9 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
return SF_FALSE ;
|
||||
/* If data has already been written this must fail. */
|
||||
if (psf->broadcast_info == NULL && psf->have_written)
|
||||
{ psf->error = SFE_CMD_HAS_DATA ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
|
||||
if (psf->broadcast_info == NULL)
|
||||
psf->broadcast_info = broadcast_info_alloc () ;
|
||||
@ -1125,14 +1132,18 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
|
||||
case SFC_GET_BROADCAST_INFO :
|
||||
if (datasize != sizeof (SF_BROADCAST_INFO) || data == NULL)
|
||||
{ psf->error = SFE_BAD_COMMAND_PARAM ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
if (psf->broadcast_info == NULL)
|
||||
return SF_FALSE ;
|
||||
return broadcast_info_copy (data, psf->broadcast_info) ;
|
||||
|
||||
case SFC_GET_INSTRUMENT :
|
||||
if (datasize != sizeof (SF_INSTRUMENT) || data == NULL)
|
||||
{ psf->error = SFE_BAD_COMMAND_PARAM ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
if (psf->instrument == NULL)
|
||||
return SF_FALSE ;
|
||||
memcpy (data, psf->instrument, sizeof (SF_INSTRUMENT)) ;
|
||||
@ -1141,9 +1152,14 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
case SFC_SET_INSTRUMENT :
|
||||
/* If data has already been written this must fail. */
|
||||
if (psf->have_written)
|
||||
{ psf->error = SFE_CMD_HAS_DATA ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
if (datasize != sizeof (SF_INSTRUMENT) || data == NULL)
|
||||
{ psf->error = SFE_BAD_COMMAND_PARAM ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
|
||||
if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
|
||||
{ psf->error = SFE_MALLOC_FAILED ;
|
||||
return SF_FALSE ;
|
||||
@ -1160,7 +1176,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
return psf->command (psf, command, data, datasize) ;
|
||||
|
||||
psf_log_printf (psf, "*** sf_command : cmd = 0x%X\n", command) ;
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
return (psf->error = SFE_BAD_COMMAND_PARAM) ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
@ -2269,7 +2285,7 @@ guess_file_type (SF_PRIVATE *psf)
|
||||
if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
|
||||
return SF_FORMAT_SDS ;
|
||||
|
||||
if ((buffer [0] & 0xFFFF) == MAKE_MARKER (1, 4, 0, 0))
|
||||
if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
|
||||
return SF_FORMAT_MPC2K ;
|
||||
|
||||
if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
|
||||
@ -2720,7 +2736,7 @@ psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo)
|
||||
psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ;
|
||||
|
||||
if (mode == SFM_RDWR && sf_format_check (&(psf->sf)) == 0)
|
||||
{ error = SFE_BAD_RDWR_FORMAT ;
|
||||
{ error = SFE_BAD_MODE_RW ;
|
||||
goto error_exit ;
|
||||
} ;
|
||||
|
||||
|
@ -20,9 +20,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "test_main.h"
|
||||
@ -43,7 +45,7 @@ conversion_test (char endian)
|
||||
{
|
||||
SF_PRIVATE sf_private, *psf ;
|
||||
const char * filename = "conversion.bin" ;
|
||||
long long i64 = SF_PLATFORM_S64 (0x0123456789abcdef), t64 = 0 ;
|
||||
int64_t i64 = SF_PLATFORM_S64 (0x0123456789abcdef), t64 = 0 ;
|
||||
char format_str [16] ;
|
||||
char test_name [64] ;
|
||||
char i8 = 12, t8 = 0 ;
|
||||
@ -87,7 +89,7 @@ conversion_test (char endian)
|
||||
cmp_test (__LINE__, i16, t16, "\n\nLine %d : 16 bit int failed 0x%x -> 0x%x.\n\n") ;
|
||||
cmp_test (__LINE__, i24, t24, "\n\nLine %d : 24 bit int failed 0x%x -> 0x%x.\n\n") ;
|
||||
cmp_test (__LINE__, i32, t32, "\n\nLine %d : 32 bit int failed 0x%x -> 0x%x.\n\n") ;
|
||||
cmp_test (__LINE__, i64, t64, "\n\nLine %d : 64 bit int failed 0x%llx -> 0x%llx.\n\n") ;
|
||||
cmp_test (__LINE__, i64, t64, "\n\nLine %d : 64 bit int failed 0x%" PRIx64 "x -> 0x%" PRIx64 "x.\n\n") ;
|
||||
|
||||
remove (filename) ;
|
||||
puts ("ok") ;
|
||||
|
@ -21,14 +21,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "sfendian.h"
|
||||
|
||||
@ -36,12 +36,7 @@
|
||||
|
||||
#define FMT_SHORT "0x%04x\n"
|
||||
#define FMT_INT "0x%08x\n"
|
||||
|
||||
#if SIZEOF_INT64_T == SIZEOF_LONG
|
||||
#define FMT_INT64 "0x%016lx\n"
|
||||
#else
|
||||
#define FMT_INT64 "0x%016llx\n"
|
||||
#endif
|
||||
#define FMT_INT64 "0x%016" PRIx64 "\n"
|
||||
|
||||
/*==============================================================================
|
||||
** Test functions.
|
||||
|
@ -60,7 +60,7 @@ test_float_convert (void)
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
} ;
|
||||
} ;
|
||||
|
||||
puts ("ok") ;
|
||||
} /* test_float_convert */
|
||||
@ -97,7 +97,7 @@ test_double_convert (void)
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
} ;
|
||||
} ;
|
||||
|
||||
puts ("ok") ;
|
||||
} /* test_double_convert */
|
||||
|
78
src/w64.c
78
src/w64.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2007 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
@ -47,8 +47,8 @@
|
||||
static unsigned char name [16] = { (x0), (x1), (x2), (x3), (x4), (x5), \
|
||||
(x6), (x7), (x8), (x9), (xa), (xb), (xc), (xd), (xe), (xf) }
|
||||
|
||||
#define riff_HASH16 MAKE_HASH16 ('r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11, 0xA5, \
|
||||
0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
|
||||
#define riff_HASH16 MAKE_HASH16 ('r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11, \
|
||||
0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
|
||||
|
||||
#define wave_HASH16 MAKE_HASH16 ('w', 'a', 'v', 'e', 0xF3, 0xAC, 0xD3, 0x11, \
|
||||
0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
|
||||
@ -65,6 +65,25 @@
|
||||
#define ACID_HASH16 MAKE_HASH16 (0x6D, 0x07, 0x1C, 0xEA, 0xA3, 0xEF, 0x78, 0x4C, \
|
||||
0x90, 0x57, 0x7F, 0x79, 0xEE, 0x25, 0x2A, 0xAE)
|
||||
|
||||
#define levl_HASH16 MAKE_HASH16 (0x6c, 0x65, 0x76, 0x6c, 0xf3, 0xac, 0xd3, 0x11, \
|
||||
0xd1, 0x8c, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
|
||||
|
||||
#define list_HASH16 MAKE_HASH16 (0x6C, 0x69, 0x73, 0x74, 0x2F, 0x91, 0xCF, 0x11, \
|
||||
0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
|
||||
|
||||
#define junk_HASH16 MAKE_HASH16 (0x6A, 0x75, 0x6E, 0x6b, 0xF3, 0xAC, 0xD3, 0x11, \
|
||||
0x8C, 0xD1, 0x00, 0xC0, 0x4f, 0x8E, 0xDB, 0x8A)
|
||||
|
||||
#define bext_MARKER MAKE_HASH16 (0x62, 0x65, 0x78, 0x74, 0xf3, 0xac, 0xd3, 0xaa, \
|
||||
0xd1, 0x8c, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
|
||||
|
||||
#define MARKER_HASH16 MAKE_HASH16 (0x56, 0x62, 0xf7, 0xab, 0x2d, 0x39, 0xd2, 0x11, \
|
||||
0x86, 0xc7, 0x00, 0xc0, 0x4f, 0x8e, 0xdb, 0x8a)
|
||||
|
||||
#define SUMLIST_HASH16 MAKE_HASH16 (0xBC, 0x94, 0x5F, 0x92, 0x5A, 0x52, 0xD2, 0x11, \
|
||||
0x86, 0xDC, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
|
||||
|
||||
|
||||
MAKE_MARKER16 (riff_MARKER16, 'r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11,
|
||||
0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00) ;
|
||||
|
||||
@ -215,7 +234,11 @@ w64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
|
||||
psf_binheader_readf (psf, "p", 0) ;
|
||||
|
||||
while (! done)
|
||||
{ /* Read the 4 byte marker and jump 12 bytes. */
|
||||
{ /* Each new chunk must start on an 8 byte boundary, so jump if needed. */
|
||||
if (psf->headindex & 0x7)
|
||||
psf_binheader_readf (psf, "j", 8 - (psf->headindex & 0x7)) ;
|
||||
|
||||
/* Generate hash of 16 byte marker. */
|
||||
bytesread += psf_binheader_readf (psf, "h", &marker) ;
|
||||
chunk_size = 0 ;
|
||||
|
||||
@ -299,12 +322,49 @@ w64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
|
||||
psf_fseek (psf, chunk_size, SEEK_CUR) ;
|
||||
break ;
|
||||
|
||||
case levl_HASH16 :
|
||||
psf_binheader_readf (psf, "e8", &chunk_size) ;
|
||||
psf_log_printf (psf, "levl : %D\n", chunk_size) ;
|
||||
dword = chunk_size ;
|
||||
psf_binheader_readf (psf, "j", dword - 24) ;
|
||||
break ;
|
||||
|
||||
case list_HASH16 :
|
||||
psf_binheader_readf (psf, "e8", &chunk_size) ;
|
||||
psf_log_printf (psf, "list : %D\n", chunk_size) ;
|
||||
dword = chunk_size ;
|
||||
psf_binheader_readf (psf, "j", dword - 24) ;
|
||||
break ;
|
||||
|
||||
case junk_HASH16 :
|
||||
psf_binheader_readf (psf, "e8", &chunk_size) ;
|
||||
psf_log_printf (psf, "junk : %D\n", chunk_size) ;
|
||||
dword = chunk_size ;
|
||||
psf_binheader_readf (psf, "j", dword - 24) ;
|
||||
break ;
|
||||
|
||||
case bext_MARKER :
|
||||
psf_binheader_readf (psf, "e8", &chunk_size) ;
|
||||
psf_log_printf (psf, "bext : %D\n", chunk_size) ;
|
||||
dword = chunk_size ;
|
||||
psf_binheader_readf (psf, "j", dword - 24) ;
|
||||
break ;
|
||||
|
||||
case MARKER_HASH16 :
|
||||
psf_binheader_readf (psf, "e8", &chunk_size) ;
|
||||
psf_log_printf (psf, "marker : %D\n", chunk_size) ;
|
||||
dword = chunk_size ;
|
||||
psf_binheader_readf (psf, "j", dword - 24) ;
|
||||
break ;
|
||||
|
||||
case SUMLIST_HASH16 :
|
||||
psf_binheader_readf (psf, "e8", &chunk_size) ;
|
||||
psf_log_printf (psf, "summary list : %D\n", chunk_size) ;
|
||||
dword = chunk_size ;
|
||||
psf_binheader_readf (psf, "j", dword - 24) ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
if (psf_ftell (psf) & 0x0F)
|
||||
{ psf_log_printf (psf, " Unknown chunk marker at position %d. Resynching.\n", dword - 4) ;
|
||||
psf_binheader_readf (psf, "j", -3) ;
|
||||
break ;
|
||||
} ;
|
||||
psf_log_printf (psf, "*** Unknown chunk marker : %X. Exiting parser.\n", marker) ;
|
||||
done = SF_TRUE ;
|
||||
break ;
|
||||
|
@ -13,10 +13,9 @@ noinst_PROGRAMS = sfversion floating_point_test write_read_test \
|
||||
raw_test string_test multi_file_test dither_test \
|
||||
scale_clip_test win32_test fix_this aiff_rw_test virtual_io_test \
|
||||
locale_test largefile_test win32_ordinal_test ogg_test vorbis_test \
|
||||
external_libs_test $(CPP_TEST)
|
||||
checksum_test external_libs_test $(CPP_TEST)
|
||||
|
||||
SNDFILEDIR = ../src
|
||||
INCLUDES = -I$(srcdir)/$(SNDFILEDIR)
|
||||
INCLUDES = -I$(top_srcdir)/src
|
||||
noinst_HEADERS = dft_cmp.h utils.h generate.h
|
||||
|
||||
autogen_sources = write_read_test.tpl write_read_test.def \
|
||||
@ -33,110 +32,113 @@ EXTRA_DIST = $(autogen_sources)
|
||||
#===============================================================================
|
||||
|
||||
sfversion_SOURCES = sfversion.c
|
||||
sfversion_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
sfversion_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
write_read_test_SOURCES = utils.c generate.c write_read_test.c
|
||||
write_read_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
write_read_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
lossy_comp_test_SOURCES = utils.c lossy_comp_test.c
|
||||
lossy_comp_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
lossy_comp_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
fix_this_SOURCES = utils.c fix_this.c
|
||||
fix_this_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
fix_this_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
error_test_SOURCES = error_test.c utils.c
|
||||
error_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
error_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
ulaw_test_SOURCES = utils.c ulaw_test.c
|
||||
ulaw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
ulaw_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
alaw_test_SOURCES = utils.c alaw_test.c
|
||||
alaw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
alaw_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
aiff_rw_test_SOURCES = utils.c aiff_rw_test.c
|
||||
aiff_rw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
aiff_rw_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
command_test_SOURCES = command_test.c utils.c
|
||||
command_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
command_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
locale_test_SOURCES = locale_test.c utils.c
|
||||
locale_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
locale_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
largefile_test_SOURCES = largefile_test.c utils.c
|
||||
largefile_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
largefile_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
pcm_test_SOURCES = pcm_test.c utils.c
|
||||
pcm_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
pcm_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
headerless_test_SOURCES = utils.c headerless_test.c
|
||||
headerless_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
headerless_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
stdin_test_SOURCES = stdin_test.c utils.c
|
||||
stdin_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
stdin_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
stdout_test_SOURCES = stdout_test.c
|
||||
stdout_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
stdout_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
stdio_test_SOURCES = stdio_test.c utils.c
|
||||
stdio_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
stdio_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
pipe_test_SOURCES = pipe_test.c utils.c
|
||||
pipe_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
pipe_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
benchmark_SOURCES = benchmark.c
|
||||
benchmark_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
benchmark_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
header_test_SOURCES = header_test.c utils.c
|
||||
header_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
header_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
misc_test_SOURCES = misc_test.c utils.c
|
||||
misc_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
misc_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
raw_test_SOURCES = raw_test.c utils.c
|
||||
raw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
raw_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
string_test_SOURCES = string_test.c utils.c
|
||||
string_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
string_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
dither_test_SOURCES = dither_test.c utils.c
|
||||
dither_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
dither_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
multi_file_test_SOURCES = multi_file_test.c utils.c
|
||||
multi_file_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
multi_file_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
virtual_io_test_SOURCES = virtual_io_test.c utils.c
|
||||
virtual_io_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
virtual_io_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
ogg_test_SOURCES = ogg_test.c utils.c
|
||||
ogg_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
ogg_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
vorbis_test_SOURCES = vorbis_test.c utils.c
|
||||
vorbis_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
vorbis_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
win32_test_SOURCES = win32_test.c
|
||||
win32_test_LDADD =
|
||||
|
||||
win32_ordinal_test_SOURCES = win32_ordinal_test.c utils.c
|
||||
win32_ordinal_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
win32_ordinal_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
external_libs_test_SOURCES = external_libs_test.c utils.c
|
||||
external_libs_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
external_libs_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
cpp_test_SOURCES = cpp_test.cc utils.c
|
||||
cpp_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
cpp_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
checksum_test_SOURCES = checksum_test.c utils.c
|
||||
checksum_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
# Lite remove start
|
||||
dwvw_test_SOURCES = utils.c dwvw_test.c
|
||||
dwvw_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
dwvw_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
floating_point_test_SOURCES = utils.c dft_cmp.c floating_point_test.c
|
||||
floating_point_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
floating_point_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
peak_chunk_test_SOURCES = peak_chunk_test.c utils.c
|
||||
peak_chunk_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
peak_chunk_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
scale_clip_test_SOURCES = scale_clip_test.c utils.c
|
||||
scale_clip_test_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
scale_clip_test_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
# Lite remove end
|
||||
|
||||
#===============================================================================
|
||||
@ -209,6 +211,7 @@ generic-tests : error_test ulaw_test alaw_test command_test floating_point_test
|
||||
./command_test bext
|
||||
./command_test bextch
|
||||
./floating_point_test
|
||||
./checksum_test
|
||||
./scale_clip_test
|
||||
./headerless_test
|
||||
./locale_test
|
||||
|
128
tests/checksum_test.c
Normal file
128
tests/checksum_test.c
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
** Copyright (C) 2008 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#define SAMPLE_RATE 8000
|
||||
|
||||
typedef struct
|
||||
{ int enc_fmt ;
|
||||
|
||||
const char * enc_name ;
|
||||
const char * dec_name ;
|
||||
|
||||
uint64_t enc_cksum ;
|
||||
uint64_t dec_cksum ;
|
||||
} CHECKSUM ;
|
||||
|
||||
static CHECKSUM
|
||||
checksum_orig [] =
|
||||
{
|
||||
{ SF_FORMAT_RAW | SF_FORMAT_ULAW,
|
||||
"checksum.ulaw", "cksum_ulaw.pcm16",
|
||||
0x33aefae029e0c888LL, 0x595cd6e47edd0cffLL
|
||||
},
|
||||
{ SF_FORMAT_RAW | SF_FORMAT_ALAW,
|
||||
"checksum.alaw", "cksum_alaw.pcm16",
|
||||
0x48c798da3572d468LL, 0x6837d74869af5bb6LL
|
||||
},
|
||||
{ SF_FORMAT_RAW | SF_FORMAT_GSM610,
|
||||
"checksum.gsm", "cksum_gsm.pcm16",
|
||||
0x1b1f64ff2acf858fLL, 0x504179dbadd4bce6LL
|
||||
},
|
||||
{ SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM,
|
||||
"checksum.vox", "cksum_vox.pcm16",
|
||||
0xf1147fb3a298f4dfLL, 0xfc9c0cb8b12cb0abLL
|
||||
},
|
||||
} ;
|
||||
|
||||
static void checksum_test (const CHECKSUM * cksum) ;
|
||||
|
||||
static float orig [1 << 14] ;
|
||||
static short data [1 << 14] ;
|
||||
|
||||
int
|
||||
main (void)
|
||||
{ unsigned k ;
|
||||
|
||||
gen_windowed_sine_float (orig, ARRAY_LEN (orig), 0.9) ;
|
||||
|
||||
for (k = 0 ; k < ARRAY_LEN (checksum_orig) ; k++)
|
||||
checksum_test (&checksum_orig [k]) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
static void
|
||||
checksum_test (const CHECKSUM * cksum)
|
||||
{ SNDFILE * file ;
|
||||
SF_INFO info ;
|
||||
|
||||
print_test_name (__func__, cksum->enc_name) ;
|
||||
|
||||
info.format = cksum->enc_fmt ;
|
||||
info.channels = 1 ;
|
||||
info.samplerate = SAMPLE_RATE ;
|
||||
|
||||
file = test_open_file_or_die (cksum->enc_name, SFM_WRITE, &info, 0, __LINE__) ;
|
||||
test_write_float_or_die (file, 0, orig, ARRAY_LEN (orig), __LINE__) ;
|
||||
sf_close (file) ;
|
||||
|
||||
check_file_hash_or_die (cksum->enc_name, cksum->enc_cksum, __LINE__) ;
|
||||
puts ("ok") ;
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
print_test_name (__func__, cksum->dec_name) ;
|
||||
|
||||
info.format = cksum->enc_fmt ;
|
||||
info.channels = 1 ;
|
||||
info.samplerate = SAMPLE_RATE ;
|
||||
|
||||
file = test_open_file_or_die (cksum->enc_name, SFM_READ, &info, 0, __LINE__) ;
|
||||
test_read_short_or_die (file, 0, data, ARRAY_LEN (data), __LINE__) ;
|
||||
sf_close (file) ;
|
||||
|
||||
info.format = SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_PCM_16 ;
|
||||
info.channels = 1 ;
|
||||
info.samplerate = SAMPLE_RATE ;
|
||||
|
||||
file = test_open_file_or_die (cksum->dec_name, SFM_WRITE, &info, 0, __LINE__) ;
|
||||
test_write_short_or_die (file, 0, data, ARRAY_LEN (data), __LINE__) ;
|
||||
sf_close (file) ;
|
||||
|
||||
check_file_hash_or_die (cksum->dec_name, cksum->dec_cksum, __LINE__) ;
|
||||
|
||||
remove (cksum->enc_name) ;
|
||||
remove (cksum->dec_name) ;
|
||||
|
||||
puts ("ok") ;
|
||||
} /* checksum_test */
|
||||
|
@ -644,6 +644,39 @@ truncate_test (const char *filename, int filetype)
|
||||
puts ("ok") ;
|
||||
} /* truncate_test */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void
|
||||
instrumet_rw_test (const char *filename)
|
||||
{ SNDFILE *sndfile ;
|
||||
SF_INFO sfinfo ;
|
||||
SF_INSTRUMENT inst ;
|
||||
memset (&sfinfo, 0, sizeof (SF_INFO)) ;
|
||||
|
||||
sndfile = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
|
||||
|
||||
if (sf_command (sndfile, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
|
||||
{ inst.basenote = 22 ;
|
||||
|
||||
if (sf_command (sndfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
|
||||
printf ("Sucess: [%s] updated\n", filename) ;
|
||||
else
|
||||
printf ("Error: SFC_SET_INSTRUMENT on [%s] [%s]\n", filename, sf_strerror (sndfile)) ;
|
||||
}
|
||||
else
|
||||
printf ("Error: SFC_GET_INSTRUMENT on [%s] [%s]\n", filename, sf_strerror (sndfile)) ;
|
||||
|
||||
|
||||
if (sf_command (sndfile, SFC_UPDATE_HEADER_NOW, NULL, 0) != 0)
|
||||
printf ("Error: SFC_UPDATE_HEADER_NOW on [%s] [%s]\n", filename, sf_strerror (sndfile)) ;
|
||||
|
||||
sf_write_sync (sndfile) ;
|
||||
sf_close (sndfile) ;
|
||||
|
||||
return ;
|
||||
} /* instrumet_rw_test */
|
||||
|
||||
static void
|
||||
instrument_test (const char *filename, int filetype)
|
||||
{ static SF_INSTRUMENT write_inst =
|
||||
@ -754,6 +787,8 @@ instrument_test (const char *filename, int filetype)
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (0) instrumet_rw_test (filename) ;
|
||||
|
||||
unlink (filename) ;
|
||||
puts ("ok") ;
|
||||
} /* instrument_test */
|
||||
@ -931,16 +966,80 @@ broadcast_rdwr_test (const char *filename, int filetype)
|
||||
puts ("ok") ;
|
||||
} /* broadcast_rdwr_test */
|
||||
|
||||
static void
|
||||
check_coding_history_newlines (const char *filename)
|
||||
{ static SF_BROADCAST_INFO bc_write, bc_read ;
|
||||
SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
unsigned k ;
|
||||
|
||||
sfinfo.samplerate = 22050 ;
|
||||
sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;
|
||||
sfinfo.channels = 1 ;
|
||||
|
||||
memset (&bc_write, 0, sizeof (bc_write)) ;
|
||||
|
||||
snprintf (bc_write.description, sizeof (bc_write.description), "Test description") ;
|
||||
snprintf (bc_write.originator, sizeof (bc_write.originator), "Test originator") ;
|
||||
snprintf (bc_write.originator_reference, sizeof (bc_write.originator_reference), "%08x-%08x", (unsigned int) time (NULL), (unsigned int) (~ time (NULL))) ;
|
||||
snprintf (bc_write.origination_date, sizeof (bc_write.origination_date), "%d/%02d/%02d", 2006, 3, 30) ;
|
||||
snprintf (bc_write.origination_time, sizeof (bc_write.origination_time), "%02d:%02d:%02d", 20, 27, 0) ;
|
||||
snprintf (bc_write.umid, sizeof (bc_write.umid), "Some umid") ;
|
||||
bc_write.coding_history_size = snprintf (bc_write.coding_history, sizeof (bc_write.coding_history), "This has\nUnix\nand\rMac OS9\rline endings.\n") ; ;
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
|
||||
{ printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
|
||||
sf_close (file) ;
|
||||
|
||||
memset (&bc_read, 0, sizeof (bc_read)) ;
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
|
||||
{ printf ("\n\nLine %d : sf_command (SFC_SET_BROADCAST_INFO) failed.\n\n", __LINE__) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
check_log_buffer_or_die (file, __LINE__) ;
|
||||
sf_close (file) ;
|
||||
|
||||
if (bc_read.coding_history_size == 0)
|
||||
{ printf ("\n\nLine %d : missing coding history.\n\n", __LINE__) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
for (k = 1 ; k < bc_read.coding_history_size ; k++)
|
||||
{ if (bc_read.coding_history [k] == '\n' && bc_read.coding_history [k - 1] != '\r')
|
||||
{ printf ("\n\nLine %d : '\\n' without '\\r' before.\n\n", __LINE__) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (bc_read.coding_history [k] == '\r' && bc_read.coding_history [k + 1] != '\n')
|
||||
{ printf ("\n\nLine %d : '\\r' without '\\n' after.\n\n", __LINE__) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (bc_read.coding_history [k] == 0 && k < bc_read.coding_history_size - 1)
|
||||
{ printf ("\n\nLine %d : '\\0' within coding history at index %d of %d.\n\n", __LINE__, k, bc_read.coding_history_size) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* check_coding_history_newlines */
|
||||
|
||||
static void
|
||||
broadcast_coding_history_test (const char *filename)
|
||||
{ static SF_BROADCAST_INFO bc_write, bc_read ;
|
||||
SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
const char *default_history = "F=22050,A=PCM,M=mono,W=16" ;
|
||||
const char *default_history = "A=PCM,F=22050,W=16,M=mono" ;
|
||||
const char *supplied_history =
|
||||
"A=PCM,M=mono,F=44100,W=24,T=other\r\n"
|
||||
"A=PCM,M=mono,F=22050,W=16,T=yet_another\r\n" ;
|
||||
"A=PCM,F=44100,W=24,M=mono,T=other\r\n"
|
||||
"A=PCM,F=22050,W=16,M=mono,T=yet_another\r\n" ;
|
||||
|
||||
print_test_name ("broadcast_coding_history_test", filename) ;
|
||||
|
||||
@ -988,7 +1087,7 @@ broadcast_coding_history_test (const char *filename)
|
||||
} ;
|
||||
|
||||
bc_write.coding_history_size = strlen (supplied_history) ;
|
||||
snprintf (bc_write.coding_history, sizeof (bc_write.coding_history), "%s", supplied_history) ;
|
||||
bc_write.coding_history_size = snprintf (bc_write.coding_history, sizeof (bc_write.coding_history), "%s", supplied_history) ;
|
||||
|
||||
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
|
||||
if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
|
||||
@ -1022,6 +1121,8 @@ broadcast_coding_history_test (const char *filename)
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
check_coding_history_newlines (filename) ;
|
||||
|
||||
unlink (filename) ;
|
||||
puts ("ok") ;
|
||||
} /* broadcast_coding_history_test */
|
||||
|
@ -1,137 +0,0 @@
|
||||
/*
|
||||
** Copyright (C) 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#include <sndfile.hh>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
static short sbuffer [100] ;
|
||||
static int ibuffer [100] ;
|
||||
static float fbuffer [100] ;
|
||||
static double dbuffer [100] ;
|
||||
|
||||
static void
|
||||
create_file (const std::string& filename, int format)
|
||||
{ Sndfile::Handle file (filename, SFM_WRITE, format, 2, 48000) ;
|
||||
|
||||
setString (file, SF_STR_TITLE, filename) ;
|
||||
|
||||
/* Item write. */
|
||||
write (file, sbuffer, ARRAY_LEN (sbuffer)) ;
|
||||
write (file, ibuffer, ARRAY_LEN (ibuffer)) ;
|
||||
write (file, fbuffer, ARRAY_LEN (fbuffer)) ;
|
||||
write (file, dbuffer, ARRAY_LEN (dbuffer)) ;
|
||||
|
||||
/* Frame write. */
|
||||
writef (file, sbuffer, ARRAY_LEN (sbuffer) / channels (file)) ;
|
||||
writef (file, ibuffer, ARRAY_LEN (ibuffer) / channels (file)) ;
|
||||
writef (file, fbuffer, ARRAY_LEN (fbuffer) / channels (file)) ;
|
||||
writef (file, dbuffer, ARRAY_LEN (dbuffer) / channels (file)) ;
|
||||
|
||||
/*
|
||||
** An explicit close() call is not necessary as the
|
||||
** Sndfile::Handle destructor closes the file anyway.
|
||||
*/
|
||||
} /* create_file */
|
||||
|
||||
static void
|
||||
read_file (const std::string& filename, int frmt)
|
||||
{ Sndfile::Handle file ;
|
||||
std::string title ;
|
||||
sf_count_t count ;
|
||||
|
||||
file = Sndfile::open (filename) ;
|
||||
|
||||
if (format (file) != frmt)
|
||||
{ printf ("\n\n%s %d : Error : format 0x%08x should be 0x%08x.\n\n", __func__, __LINE__, format (file), frmt) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (channels (file) != 2)
|
||||
{ printf ("\n\n%s %d : Error : channels %d should be 2.\n\n", __func__, __LINE__, channels (file)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (frames (file) != ARRAY_LEN (sbuffer) * 4)
|
||||
{ printf ("\n\n%s %d : Error : frames %ld should be %d.\n\n", __func__, __LINE__,
|
||||
SF_COUNT_TO_LONG (frames (file)), ARRAY_LEN (sbuffer) * 4 / 2) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
title = getString (file, SF_STR_TITLE) ;
|
||||
|
||||
if (title == "")
|
||||
{ printf ("\n\n%s %d : Error : No title.\n\n", __func__, __LINE__) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (filename != title)
|
||||
{ printf ("\n\n%s %d : Error : title '%s' should be '%s'\n\n", __func__, __LINE__, title.c_str(), filename.c_str()) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Item read. */
|
||||
read (file, sbuffer, ARRAY_LEN (sbuffer)) ;
|
||||
read (file, ibuffer, ARRAY_LEN (ibuffer)) ;
|
||||
read (file, fbuffer, ARRAY_LEN (fbuffer)) ;
|
||||
read (file, dbuffer, ARRAY_LEN (dbuffer)) ;
|
||||
|
||||
/* Frame read. */
|
||||
readf (file, sbuffer, ARRAY_LEN (sbuffer) / channels (file)) ;
|
||||
readf (file, ibuffer, ARRAY_LEN (ibuffer) / channels (file)) ;
|
||||
readf (file, fbuffer, ARRAY_LEN (fbuffer) / channels (file)) ;
|
||||
readf (file, dbuffer, ARRAY_LEN (dbuffer) / channels (file)) ;
|
||||
|
||||
count = seek (file, frames (file) - 10, SEEK_SET) ;
|
||||
if (count != frames (file) - 10)
|
||||
{ printf ("\n\n%s %d : Error : offset (%ld) should be %ld\n\n", __func__, __LINE__,
|
||||
SF_COUNT_TO_LONG (count), SF_COUNT_TO_LONG (frames (file) - 10)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
count = read (file, sbuffer, ARRAY_LEN (sbuffer)) ;
|
||||
if (count != 10 * channels (file))
|
||||
{ printf ("\n\n%s %d : Error : count (%ld) should be %ld\n\n", __func__, __LINE__,
|
||||
SF_COUNT_TO_LONG (count), SF_COUNT_TO_LONG (10 * channels (file))) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
** An explicit close() call is not necessary as the
|
||||
** Sndfile::Handle destructor closes the file anyway.
|
||||
*/
|
||||
} /* create_file */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{ const char * filename = "cpp_test.wav" ;
|
||||
|
||||
print_test_name ("CeePlusPlus test", filename) ;
|
||||
|
||||
create_file (filename, SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
|
||||
read_file (filename, SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
|
||||
|
||||
remove (filename) ;
|
||||
puts ("ok") ;
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
@ -37,17 +37,17 @@
|
||||
static void lrintf_test (void) ;
|
||||
|
||||
[+ FOR data_type
|
||||
+]static void pcm_test_[+ (get "name") +] (const char *filename, int filetype, int hash) ;
|
||||
+]static void pcm_test_[+ (get "name") +] (const char *filename, int filetype, uint64_t hash) ;
|
||||
[+ ENDFOR data_type
|
||||
+]
|
||||
static void pcm_test_float (const char *filename, int filetype, int hash, int replace_float) ;
|
||||
static void pcm_test_double (const char *filename, int filetype, int hash, int replace_float) ;
|
||||
static void pcm_test_float (const char *filename, int filetype, uint64_t hash, int replace_float) ;
|
||||
static void pcm_test_double (const char *filename, int filetype, uint64_t hash, int replace_float) ;
|
||||
|
||||
typedef union
|
||||
{ double d [BUFFER_SIZE + 1];
|
||||
float f [BUFFER_SIZE + 1];
|
||||
int i [BUFFER_SIZE + 1];
|
||||
short s [BUFFER_SIZE + 1];
|
||||
{ double d [BUFFER_SIZE + 1] ;
|
||||
float f [BUFFER_SIZE + 1] ;
|
||||
int i [BUFFER_SIZE + 1] ;
|
||||
short s [BUFFER_SIZE + 1] ;
|
||||
} BUFFER ;
|
||||
|
||||
/* Data written to the file. */
|
||||
@ -61,32 +61,32 @@ main (void)
|
||||
{
|
||||
lrintf_test () ;
|
||||
|
||||
pcm_test_bits_8 ("pcm-s8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_S8, 0x9ae33814) ;
|
||||
pcm_test_bits_8 ("pcm-u8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_U8, 0x651d4694) ;
|
||||
pcm_test_bits_8 ("pcm-s8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_S8, 0x1cda335091249dbfLL) ;
|
||||
pcm_test_bits_8 ("pcm-u8.raw", SF_FORMAT_RAW | SF_FORMAT_PCM_U8, 0x7f748c433d695f3fLL) ;
|
||||
|
||||
pcm_test_bits_16 ("le-pcm16.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0x16866fa0) ;
|
||||
pcm_test_bits_16 ("be-pcm16.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0xc571826c) ;
|
||||
pcm_test_bits_16 ("le-pcm16.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0x3a2b956c881ebf08LL) ;
|
||||
pcm_test_bits_16 ("be-pcm16.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_PCM_16, 0xd9e2f840c55750f8LL) ;
|
||||
|
||||
pcm_test_bits_24 ("le-pcm24.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0x658e4bb6) ;
|
||||
pcm_test_bits_24 ("be-pcm24.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0xbf8cde4a) ;
|
||||
pcm_test_bits_24 ("le-pcm24.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0x933b6a759ab496f8LL) ;
|
||||
pcm_test_bits_24 ("be-pcm24.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_PCM_24, 0xbb1f3eaf9c30b6f8LL) ;
|
||||
|
||||
pcm_test_bits_32 ("le-pcm32.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0x04c84a70) ;
|
||||
pcm_test_bits_32 ("be-pcm32.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0x069c84f6) ;
|
||||
pcm_test_bits_32 ("le-pcm32.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0xa77aece1c1c17f08LL) ;
|
||||
pcm_test_bits_32 ("be-pcm32.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_PCM_32, 0x3099ddf142d0b0f8LL) ;
|
||||
|
||||
/* Lite remove start */
|
||||
pcm_test_float ("le-float.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0xbb836603, SF_FALSE) ;
|
||||
pcm_test_float ("be-float.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x903cd8fc, SF_FALSE) ;
|
||||
pcm_test_float ("le-float.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x3c2ad04f7554267aLL, SF_FALSE) ;
|
||||
pcm_test_float ("be-float.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x074de3e248fa9186LL, SF_FALSE) ;
|
||||
|
||||
pcm_test_double ("le-double.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xbf84448e, SF_FALSE) ;
|
||||
pcm_test_double ("be-double.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xaf3d9fb5, SF_FALSE) ;
|
||||
pcm_test_double ("le-double.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xc682726f958f669cLL, SF_FALSE) ;
|
||||
pcm_test_double ("be-double.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xd9a3583f8ee51164LL, SF_FALSE) ;
|
||||
|
||||
puts ("Test IEEE replacement code.") ;
|
||||
|
||||
pcm_test_float ("le-float.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0xbb836603, SF_TRUE) ;
|
||||
pcm_test_float ("be-float.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x903cd8fc, SF_TRUE) ;
|
||||
pcm_test_float ("le-float.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x3c2ad04f7554267aLL, SF_TRUE) ;
|
||||
pcm_test_float ("be-float.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_FLOAT, 0x074de3e248fa9186LL, SF_TRUE) ;
|
||||
|
||||
pcm_test_double ("le-double.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xbf84448e, SF_TRUE) ;
|
||||
pcm_test_double ("be-double.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xaf3d9fb5, SF_TRUE) ;
|
||||
pcm_test_double ("le-double.raw", SF_ENDIAN_LITTLE | SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xc682726f958f669cLL, SF_TRUE) ;
|
||||
pcm_test_double ("be-double.raw", SF_ENDIAN_BIG | SF_FORMAT_RAW | SF_FORMAT_DOUBLE, 0xd9a3583f8ee51164LL, SF_TRUE) ;
|
||||
/* Lite remove end */
|
||||
|
||||
return 0 ;
|
||||
@ -126,7 +126,7 @@ lrintf_test (void)
|
||||
|
||||
[+ FOR data_type
|
||||
+]static void
|
||||
pcm_test_[+ (get "name") +] (const char *filename, int filetype, int hash)
|
||||
pcm_test_[+ (get "name") +] (const char *filename, int filetype, uint64_t hash)
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, items, zero_count ;
|
||||
@ -399,7 +399,7 @@ pcm_test_[+ (get "name") +] (const char *filename, int filetype, int hash)
|
||||
*/
|
||||
|
||||
static void
|
||||
pcm_test_float (const char *filename, int filetype, int hash, int replace_float)
|
||||
pcm_test_float (const char *filename, int filetype, uint64_t hash, int replace_float)
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, items, frames ;
|
||||
@ -653,7 +653,7 @@ pcm_test_float (const char *filename, int filetype, int hash, int replace_float)
|
||||
} /* pcm_test_float */
|
||||
|
||||
static void
|
||||
pcm_test_double (const char *filename, int filetype, int hash, int replace_float)
|
||||
pcm_test_double (const char *filename, int filetype, uint64_t hash, int replace_float)
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, items, frames ;
|
||||
|
@ -1,6 +1,6 @@
|
||||
[+ AutoGen5 template h c +]
|
||||
/*
|
||||
** Copyright (C) 2002-2007 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
@ -52,7 +52,7 @@ extern "C" {
|
||||
|
||||
void create_short_sndfile (const char *filename, int format, int channels) ;
|
||||
|
||||
void check_file_hash_or_die (const char *filename, unsigned int target_hash, int line_num) ;
|
||||
void check_file_hash_or_die (const char *filename, uint64_t target_hash, int line_num) ;
|
||||
|
||||
void print_test_name (const char *test, const char *filename) ;
|
||||
|
||||
@ -138,6 +138,7 @@ sf_count_t file_length_fd (int fd) ;
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
@ -203,7 +204,6 @@ create_short_sndfile (const char *filename, int format, int channels)
|
||||
{ short data [2 * 3 * 4 * 5 * 6 * 7] = { 0, } ;
|
||||
SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
|
||||
sfinfo.samplerate = 44100 ;
|
||||
sfinfo.channels = channels ;
|
||||
@ -220,42 +220,37 @@ create_short_sndfile (const char *filename, int format, int channels)
|
||||
} /* create_short_sndfile */
|
||||
|
||||
void
|
||||
check_file_hash_or_die (const char *filename, unsigned int target_hash, int line_num)
|
||||
{ static unsigned char buffer [2048] ;
|
||||
unsigned int hash1, hash2 ;
|
||||
FILE *file ;
|
||||
int k, read_count ;
|
||||
check_file_hash_or_die (const char *filename, uint64_t target_hash, int line_num)
|
||||
{ static unsigned char buf [4096] ;
|
||||
uint64_t cksum ;
|
||||
FILE *file ;
|
||||
int k, read_count ;
|
||||
|
||||
memset (buffer, 0xEE, sizeof (buffer)) ;
|
||||
memset (buf, 0, sizeof (buf)) ;
|
||||
|
||||
/* The 'b' in the mode string means binary for Win32. */
|
||||
if (! (file = fopen (filename, "rb")))
|
||||
if ((file = fopen (filename, "rb")) == NULL)
|
||||
{ printf ("\n\nLine %d: could not open file '%s'\n\n", line_num, filename) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
hash1 = hash2 = 0 ;
|
||||
cksum = 0 ;
|
||||
|
||||
while ((read_count = fread (buffer, 1, sizeof (buffer), file)))
|
||||
{ for (k = 0 ; k < read_count ; k++)
|
||||
{ hash1 = hash1 + buffer [k] ;
|
||||
hash2 = hash2 ^ (buffer [k] << (k % 25)) ;
|
||||
} ;
|
||||
} ;
|
||||
while ((read_count = fread (buf, 1, sizeof (buf), file)))
|
||||
for (k = 0 ; k < read_count ; k++)
|
||||
cksum = cksum * 511 + buf [k] ;
|
||||
|
||||
fclose (file) ;
|
||||
|
||||
hash1 += hash2 ;
|
||||
|
||||
if (target_hash == 0)
|
||||
{ printf (" 0x%08x ", hash1) ;
|
||||
{ printf (" 0x%016" PRIx64 "\n", cksum) ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
if (hash1 != target_hash)
|
||||
{ printf ("\n\nLine %d: incorrect hash value 0x%08x should be 0x%08x\n\n", line_num, hash1, target_hash) ;
|
||||
if (cksum != target_hash)
|
||||
{ printf ("\n\nLine %d: incorrect hash value 0x%016" PRIx64 " should be 0x%016" PRIx64 ".\n\n", line_num, cksum, target_hash) ;
|
||||
exit (1) ;
|
||||
}
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* check_file_hash_or_die */
|
||||
@ -818,6 +813,7 @@ sf_count_t
|
||||
file_length_fd (int fd)
|
||||
{ struct stat data ;
|
||||
|
||||
memset (&data, 0, sizeof (data)) ;
|
||||
if (fstat (fd, &data) != 0)
|
||||
return 0 ;
|
||||
|
||||
|
@ -64,7 +64,13 @@ test_ordinal (HMODULE hmod, const char * func_name, int ordinal)
|
||||
|
||||
print_test_name ("win32_ordinal_test", func_name) ;
|
||||
|
||||
ord = GetProcAddress (hmod, (LPSTR) ordinal) ;
|
||||
#if SIZEOF_VOIDP == 8
|
||||
#define LPCSTR_OF_ORDINAL(x) ((LPCSTR) ((int64_t) (x)))
|
||||
#else
|
||||
#define LPCSTR_OF_ORDINAL(x) ((LPCSTR) (x))
|
||||
#endif
|
||||
|
||||
ord = GetProcAddress (hmod, LPCSTR_OF_ORDINAL (ordinal)) ;
|
||||
if ((name = GetProcAddress (hmod, func_name)) == NULL)
|
||||
{ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError (),
|
||||
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpmsg, 0, NULL) ;
|
||||
|
@ -370,7 +370,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
else
|
||||
puts (" No FLAC tests because FLAC support was not compiled in.") ;
|
||||
test_count++ ;
|
||||
test_count++ ;
|
||||
} ;
|
||||
|
||||
if (do_all || ! strcmp (argv [1], "rf64"))
|
||||
|
Loading…
Reference in New Issue
Block a user