From a6d068af7f132d32352e10a72dfb77223bf3bc2c Mon Sep 17 00:00:00 2001 From: vspader Date: Tue, 25 Apr 2006 17:48:50 +0000 Subject: [PATCH] sndfile fix --- Libraries/SndFile/Files/src/Makefile | 852 +++++++++++++++ Libraries/SndFile/Files/src/Makefile.am | 102 ++ Libraries/SndFile/Files/src/Makefile.in | 852 +++++++++++++++ Libraries/SndFile/Files/src/caf.c | 538 +++++++++ Libraries/SndFile/Files/src/config.h.in | 256 +++++ Libraries/SndFile/Files/src/cygsndfile.def | 39 + Libraries/SndFile/Files/src/flac.c | 1156 ++++++++++++++++++++ Libraries/SndFile/Files/src/g72x.c | 615 +++++++++++ Libraries/SndFile/Files/src/sndfile.h.in | 530 +++++++++ Libraries/SndFile/Files/src/stamp-h1 | 1 + 10 files changed, 4941 insertions(+) create mode 100644 Libraries/SndFile/Files/src/Makefile create mode 100644 Libraries/SndFile/Files/src/Makefile.am create mode 100644 Libraries/SndFile/Files/src/Makefile.in create mode 100644 Libraries/SndFile/Files/src/caf.c create mode 100644 Libraries/SndFile/Files/src/config.h.in create mode 100644 Libraries/SndFile/Files/src/cygsndfile.def create mode 100644 Libraries/SndFile/Files/src/flac.c create mode 100644 Libraries/SndFile/Files/src/g72x.c create mode 100644 Libraries/SndFile/Files/src/sndfile.h.in create mode 100644 Libraries/SndFile/Files/src/stamp-h1 diff --git a/Libraries/SndFile/Files/src/Makefile b/Libraries/SndFile/Files/src/Makefile new file mode 100644 index 000000000..2c699b43f --- /dev/null +++ b/Libraries/SndFile/Files/src/Makefile @@ -0,0 +1,852 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# src/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + + +srcdir = . +top_srcdir = .. + +pkgdatadir = $(datadir)/libsndfile +pkglibdir = $(libdir)/libsndfile +pkgincludedir = $(includedir)/libsndfile +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = powerpc-apple-darwin8.6.0 +host_triplet = powerpc-apple-darwin8.6.0 +target_triplet = powerpc-apple-darwin8.6.0 +noinst_PROGRAMS = test_endswap$(EXEEXT) test_file_io$(EXEEXT) \ + test_log_printf$(EXEEXT) +subdir = src +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/sndfile.h.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = sndfile.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libsndfile_la_DEPENDENCIES = GSM610/libgsm.la G72x/libg72x.la \ + $(am__DEPENDENCIES_1) +am__objects_1 = sndfile.lo common.lo file_io.lo command.lo pcm.lo \ + ulaw.lo alaw.lo float32.lo double64.lo ima_adpcm.lo \ + ms_adpcm.lo gsm610.lo dwvw.lo vox_adpcm.lo interleave.lo \ + strings.lo dither.lo +am__objects_2 = aiff.lo au.lo g72x.lo avr.lo caf.lo ircam.lo \ + macbinary3.lo macos.lo mat4.lo mat5.lo nist.lo paf.lo pvf.lo \ + raw.lo svx.lo voc.lo htk.lo dwd.lo ogg.lo rx2.lo sd2.lo sds.lo \ + txw.lo wve.lo w64.lo wav_w64.lo wav.lo xi.lo flac.lo +am__objects_3 = +am_libsndfile_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) +nodist_libsndfile_la_OBJECTS = $(am__objects_3) +libsndfile_la_OBJECTS = $(am_libsndfile_la_OBJECTS) \ + $(nodist_libsndfile_la_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am_test_endswap_OBJECTS = test_endswap.$(OBJEXT) +test_endswap_OBJECTS = $(am_test_endswap_OBJECTS) +test_endswap_LDADD = $(LDADD) +am_test_file_io_OBJECTS = test_file_io-file_io.$(OBJEXT) \ + test_file_io-test_file_io.$(OBJEXT) +test_file_io_OBJECTS = $(am_test_file_io_OBJECTS) +test_file_io_LDADD = $(LDADD) +am_test_log_printf_OBJECTS = \ + test_log_printf-test_log_printf.$(OBJEXT) +test_log_printf_OBJECTS = $(am_test_log_printf_OBJECTS) +test_log_printf_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libsndfile_la_SOURCES) $(nodist_libsndfile_la_SOURCES) \ + $(test_endswap_SOURCES) $(test_file_io_SOURCES) \ + $(test_log_printf_SOURCES) +DIST_SOURCES = $(libsndfile_la_SOURCES) $(test_endswap_SOURCES) \ + $(test_file_io_SOURCES) $(test_log_printf_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(nodist_include_HEADERS) $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /Users/xugg/Desktop/libsndfile-1.0.15/missing --run aclocal-1.9 +ALSA_LIBS = +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /Users/xugg/Desktop/libsndfile-1.0.15/missing --run tar +AR = ar +AUTOCONF = ${SHELL} /Users/xugg/Desktop/libsndfile-1.0.15/missing --run autoconf + +#====================================================================== +# Disable autoheader. +AUTOHEADER = echo +AUTOMAKE = ${SHELL} /Users/xugg/Desktop/libsndfile-1.0.15/missing --run automake-1.9 +AWK = awk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 -std=gnu99 -W -Wall -Wdeclaration-after-statement -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wcast-qual -Wnested-externs -Wbad-function-cast -Wwrite-strings -pipe -fpascal-strings -I/Developer/Headers/FlatCarbon +COMPILER_IS_GCC = +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = grep -E +ENABLE_EXPERIMENTAL_CODE = +EXEEXT = +F77 = +FFLAGS = +FLAC_LIBS = +GCC_MAJOR_VERSION = 4 +GETCONF = +HTML_BGCOLOUR = black +HTML_FGCOLOUR = white +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = -lm +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIBTOOL_DEPS = ./ltmain.sh +LN_S = ln -s +LTLIBOBJS = +MAKEINFO = ${SHELL} /Users/xugg/Desktop/libsndfile-1.0.15/missing --run makeinfo +OBJEXT = o +OS_SPECIFIC_CFLAGS = -fpascal-strings -I/Developer/Headers/FlatCarbon +OS_SPECIFIC_LINKS = -framework CoreAudio +PACKAGE = libsndfile +PACKAGE_BUGREPORT = erikd@mega-nerd.com +PACKAGE_NAME = libsndfile +PACKAGE_STRING = libsndfile 1.0.15 +PACKAGE_TARNAME = libsndfile +PACKAGE_VERSION = 1.0.15 +PATH_SEPARATOR = : +PKG_CONFIG = /sw/bin/pkg-config +RANLIB = ranlib +SET_MAKE = +SF_COUNT_MAX = 0x7FFFFFFFFFFFFFFFLL +SHARED_VERSION_INFO = 1:15:0 +SHELL = /bin/sh +SHLIB_VERSION_ARG = -Wl,-exported_symbols_list -Wl,$(srcdir)/Symbols.darwin +SIZEOF_SF_COUNT_T = 8 +SQLITE3_CFLAGS = +SQLITE3_LIBS = +STRIP = strip +TYPEOF_SF_COUNT_T = off_t +VERSION = 1.0.15 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_F77 = +ac_ct_GETCONF = +ac_ct_RANLIB = ranlib +ac_ct_STRIP = strip +ac_pt_PKG_CONFIG = /sw/bin/pkg-config +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__fastdepCXX_FALSE = # +am__fastdepCXX_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +autogen = no +bindir = ${exec_prefix}/bin +build = powerpc-apple-darwin8.6.0 +build_alias = +build_cpu = powerpc +build_os = darwin8.6.0 +build_vendor = apple +datadir = ${prefix}/share +exec_prefix = ${prefix} +host = powerpc-apple-darwin8.6.0 +host_alias = +host_cpu = powerpc +host_os = darwin8.6.0 +host_vendor = apple +htmldocdir = /usr/local/share/doc/libsndfile1-dev/html +includedir = ${prefix}/include +infodir = ${prefix}/info +install_sh = /Users/xugg/Desktop/libsndfile-1.0.15/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localstatedir = ${prefix}/var +mandir = ${prefix}/man +mkdir_p = $(mkinstalldirs) +oldincludedir = /usr/include +prefix = /usr/local +program_transform_name = s,x,x, +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target = powerpc-apple-darwin8.6.0 +target_alias = +target_cpu = powerpc +target_os = darwin8.6.0 +target_vendor = apple +SUBDIRS = GSM610 G72x +lib_LTLIBRARIES = libsndfile.la +nodist_include_HEADERS = sndfile.h +EXTRA_DIST = sndfile.h.in config.h.in test_endswap.tpl test_endswap.def \ + Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def \ + create_symbols_file.py + +noinst_HEADERS = common.h sfconfig.h sfendian.h float_cast.h wav_w64.h sf_unistd.h +COMMON = sndfile.c common.c file_io.c command.c pcm.c ulaw.c alaw.c float32.c \ + double64.c ima_adpcm.c ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c \ + interleave.c strings.c dither.c + +FILESPECIFIC = aiff.c au.c g72x.c avr.c caf.c ircam.c macbinary3.c macos.c \ + mat4.c mat5.c nist.c paf.c pvf.c raw.c svx.c voc.c htk.c dwd.c \ + ogg.c rx2.c sd2.c sds.c txw.c wve.c w64.c wav_w64.c wav.c xi.c \ + flac.c + + +# MinGW requires -no-undefined if a DLL is to be built. +libsndfile_la_LDFLAGS = -no-undefined -version-info 1:15:0 -Wl,-exported_symbols_list -Wl,$(srcdir)/Symbols.darwin +libsndfile_la_SOURCES = $(COMMON) $(FILESPECIFIC) $(noinst_HEADERS) +nodist_libsndfile_la_SOURCES = $(nodist_include_HEADERS) +libsndfile_la_LIBADD = GSM610/libgsm.la G72x/libg72x.la -lm $(FLAC_LIBS) +test_endswap_SOURCES = test_endswap.c +test_file_io_CFLAGS = $(AM_CFLAGS) +test_file_io_SOURCES = file_io.c test_file_io.c +test_log_printf_CFLAGS = $(AM_CFLAGS) +test_log_printf_SOURCES = test_log_printf.c +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +sndfile.h: $(top_builddir)/config.status $(srcdir)/sndfile.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libsndfile.la: $(libsndfile_la_OBJECTS) $(libsndfile_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libsndfile_la_LDFLAGS) $(libsndfile_la_OBJECTS) $(libsndfile_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +test_endswap$(EXEEXT): $(test_endswap_OBJECTS) $(test_endswap_DEPENDENCIES) + @rm -f test_endswap$(EXEEXT) + $(LINK) $(test_endswap_LDFLAGS) $(test_endswap_OBJECTS) $(test_endswap_LDADD) $(LIBS) +test_file_io$(EXEEXT): $(test_file_io_OBJECTS) $(test_file_io_DEPENDENCIES) + @rm -f test_file_io$(EXEEXT) + $(LINK) $(test_file_io_LDFLAGS) $(test_file_io_OBJECTS) $(test_file_io_LDADD) $(LIBS) +test_log_printf$(EXEEXT): $(test_log_printf_OBJECTS) $(test_log_printf_DEPENDENCIES) + @rm -f test_log_printf$(EXEEXT) + $(LINK) $(test_log_printf_LDFLAGS) $(test_log_printf_OBJECTS) $(test_log_printf_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/aiff.Plo +include ./$(DEPDIR)/alaw.Plo +include ./$(DEPDIR)/au.Plo +include ./$(DEPDIR)/avr.Plo +include ./$(DEPDIR)/caf.Plo +include ./$(DEPDIR)/command.Plo +include ./$(DEPDIR)/common.Plo +include ./$(DEPDIR)/dither.Plo +include ./$(DEPDIR)/double64.Plo +include ./$(DEPDIR)/dwd.Plo +include ./$(DEPDIR)/dwvw.Plo +include ./$(DEPDIR)/file_io.Plo +include ./$(DEPDIR)/flac.Plo +include ./$(DEPDIR)/float32.Plo +include ./$(DEPDIR)/g72x.Plo +include ./$(DEPDIR)/gsm610.Plo +include ./$(DEPDIR)/htk.Plo +include ./$(DEPDIR)/ima_adpcm.Plo +include ./$(DEPDIR)/interleave.Plo +include ./$(DEPDIR)/ircam.Plo +include ./$(DEPDIR)/macbinary3.Plo +include ./$(DEPDIR)/macos.Plo +include ./$(DEPDIR)/mat4.Plo +include ./$(DEPDIR)/mat5.Plo +include ./$(DEPDIR)/ms_adpcm.Plo +include ./$(DEPDIR)/nist.Plo +include ./$(DEPDIR)/ogg.Plo +include ./$(DEPDIR)/paf.Plo +include ./$(DEPDIR)/pcm.Plo +include ./$(DEPDIR)/pvf.Plo +include ./$(DEPDIR)/raw.Plo +include ./$(DEPDIR)/rx2.Plo +include ./$(DEPDIR)/sd2.Plo +include ./$(DEPDIR)/sds.Plo +include ./$(DEPDIR)/sndfile.Plo +include ./$(DEPDIR)/strings.Plo +include ./$(DEPDIR)/svx.Plo +include ./$(DEPDIR)/test_endswap.Po +include ./$(DEPDIR)/test_file_io-file_io.Po +include ./$(DEPDIR)/test_file_io-test_file_io.Po +include ./$(DEPDIR)/test_log_printf-test_log_printf.Po +include ./$(DEPDIR)/txw.Plo +include ./$(DEPDIR)/ulaw.Plo +include ./$(DEPDIR)/voc.Plo +include ./$(DEPDIR)/vox_adpcm.Plo +include ./$(DEPDIR)/w64.Plo +include ./$(DEPDIR)/wav.Plo +include ./$(DEPDIR)/wav_w64.Plo +include ./$(DEPDIR)/wve.Plo +include ./$(DEPDIR)/xi.Plo + +.c.o: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c $< + +.c.obj: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LTCOMPILE) -c -o $@ $< + +test_file_io-file_io.o: file_io.c + if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -MT test_file_io-file_io.o -MD -MP -MF "$(DEPDIR)/test_file_io-file_io.Tpo" -c -o test_file_io-file_io.o `test -f 'file_io.c' || echo '$(srcdir)/'`file_io.c; \ + then mv -f "$(DEPDIR)/test_file_io-file_io.Tpo" "$(DEPDIR)/test_file_io-file_io.Po"; else rm -f "$(DEPDIR)/test_file_io-file_io.Tpo"; exit 1; fi +# source='file_io.c' object='test_file_io-file_io.o' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -c -o test_file_io-file_io.o `test -f 'file_io.c' || echo '$(srcdir)/'`file_io.c + +test_file_io-file_io.obj: file_io.c + if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -MT test_file_io-file_io.obj -MD -MP -MF "$(DEPDIR)/test_file_io-file_io.Tpo" -c -o test_file_io-file_io.obj `if test -f 'file_io.c'; then $(CYGPATH_W) 'file_io.c'; else $(CYGPATH_W) '$(srcdir)/file_io.c'; fi`; \ + then mv -f "$(DEPDIR)/test_file_io-file_io.Tpo" "$(DEPDIR)/test_file_io-file_io.Po"; else rm -f "$(DEPDIR)/test_file_io-file_io.Tpo"; exit 1; fi +# source='file_io.c' object='test_file_io-file_io.obj' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -c -o test_file_io-file_io.obj `if test -f 'file_io.c'; then $(CYGPATH_W) 'file_io.c'; else $(CYGPATH_W) '$(srcdir)/file_io.c'; fi` + +test_file_io-test_file_io.o: test_file_io.c + if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -MT test_file_io-test_file_io.o -MD -MP -MF "$(DEPDIR)/test_file_io-test_file_io.Tpo" -c -o test_file_io-test_file_io.o `test -f 'test_file_io.c' || echo '$(srcdir)/'`test_file_io.c; \ + then mv -f "$(DEPDIR)/test_file_io-test_file_io.Tpo" "$(DEPDIR)/test_file_io-test_file_io.Po"; else rm -f "$(DEPDIR)/test_file_io-test_file_io.Tpo"; exit 1; fi +# source='test_file_io.c' object='test_file_io-test_file_io.o' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -c -o test_file_io-test_file_io.o `test -f 'test_file_io.c' || echo '$(srcdir)/'`test_file_io.c + +test_file_io-test_file_io.obj: test_file_io.c + if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -MT test_file_io-test_file_io.obj -MD -MP -MF "$(DEPDIR)/test_file_io-test_file_io.Tpo" -c -o test_file_io-test_file_io.obj `if test -f 'test_file_io.c'; then $(CYGPATH_W) 'test_file_io.c'; else $(CYGPATH_W) '$(srcdir)/test_file_io.c'; fi`; \ + then mv -f "$(DEPDIR)/test_file_io-test_file_io.Tpo" "$(DEPDIR)/test_file_io-test_file_io.Po"; else rm -f "$(DEPDIR)/test_file_io-test_file_io.Tpo"; exit 1; fi +# source='test_file_io.c' object='test_file_io-test_file_io.obj' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -c -o test_file_io-test_file_io.obj `if test -f 'test_file_io.c'; then $(CYGPATH_W) 'test_file_io.c'; else $(CYGPATH_W) '$(srcdir)/test_file_io.c'; fi` + +test_log_printf-test_log_printf.o: test_log_printf.c + if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_log_printf_CFLAGS) $(CFLAGS) -MT test_log_printf-test_log_printf.o -MD -MP -MF "$(DEPDIR)/test_log_printf-test_log_printf.Tpo" -c -o test_log_printf-test_log_printf.o `test -f 'test_log_printf.c' || echo '$(srcdir)/'`test_log_printf.c; \ + then mv -f "$(DEPDIR)/test_log_printf-test_log_printf.Tpo" "$(DEPDIR)/test_log_printf-test_log_printf.Po"; else rm -f "$(DEPDIR)/test_log_printf-test_log_printf.Tpo"; exit 1; fi +# source='test_log_printf.c' object='test_log_printf-test_log_printf.o' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_log_printf_CFLAGS) $(CFLAGS) -c -o test_log_printf-test_log_printf.o `test -f 'test_log_printf.c' || echo '$(srcdir)/'`test_log_printf.c + +test_log_printf-test_log_printf.obj: test_log_printf.c + if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_log_printf_CFLAGS) $(CFLAGS) -MT test_log_printf-test_log_printf.obj -MD -MP -MF "$(DEPDIR)/test_log_printf-test_log_printf.Tpo" -c -o test_log_printf-test_log_printf.obj `if test -f 'test_log_printf.c'; then $(CYGPATH_W) 'test_log_printf.c'; else $(CYGPATH_W) '$(srcdir)/test_log_printf.c'; fi`; \ + then mv -f "$(DEPDIR)/test_log_printf-test_log_printf.Tpo" "$(DEPDIR)/test_log_printf-test_log_printf.Po"; else rm -f "$(DEPDIR)/test_log_printf-test_log_printf.Tpo"; exit 1; fi +# source='test_log_printf.c' object='test_log_printf-test_log_printf.obj' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_log_printf_CFLAGS) $(CFLAGS) -c -o test_log_printf-test_log_printf.obj `if test -f 'test_log_printf.c'; then $(CYGPATH_W) 'test_log_printf.c'; else $(CYGPATH_W) '$(srcdir)/test_log_printf.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-nodist_includeHEADERS: $(nodist_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + @list='$(nodist_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-nodist_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-nodist_includeHEADERS + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-nodist_includeHEADERS + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstPROGRAMS clean-recursive ctags ctags-recursive \ + distclean distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-recursive distclean-tags distdir \ + dvi dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-nodist_includeHEADERS install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-nodist_includeHEADERS + + +test_endswap.c: test_endswap.def test_endswap.tpl + autogen --writable --source-time test_endswap.def + +genfiles : test_endswap.c Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def + +# Two test programs. +# It is not possible to place these in the tests/ directory because they +# need access to the internals of the SF_PRIVATE struct. + +check: test_endswap test_file_io test_log_printf + @echo + @echo + @echo + @echo "============================================================" + ./test_endswap + ./test_file_io + ./test_log_printf + @echo "============================================================" + @echo + @echo + @echo + +#====================================================================== +# Generate an OS specific Symbols files. This is done when the author +# builds the distribution tarball. There should be not need for the +# end user to create these files. + +Symbols.linux: create_symbols_file.py + ./create_symbols_file.py linux $(VERSION) > Symbols.linux + +Symbols.darwin: create_symbols_file.py + ./create_symbols_file.py darwin $(VERSION) > Symbols.darwin + +libsndfile.def: create_symbols_file.py + ./create_symbols_file.py win32 $(VERSION) > libsndfile.def + +cygsndfile.def: create_symbols_file.py + ./create_symbols_file.py cygwin $(VERSION) > cygsndfile.def + +# Fake dependancy to force the creation of these files. +sndfile.c : Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def + +# Dependancies. + +aiff.c au.c g72x.c ircam.c mat4.c mat5.c nist.c paf.c pvf.c : sndfile.h common.h +raw.c svx.c voc.c w64.c wav.c wav_w64.c htk.c sd2.c rx2.c txw.c : sndfile.h common.h +sds.c wve.c dwd.c ogg.c xi.c sndfile.c common.c file_io.c : sndfile.h common.h +command.c pcm.c ulaw.c alaw.c float32.c double64.c ima_adpcm.c : sndfile.h common.h +ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c interleave.c strings.c : sndfile.h common.h +dither.c : sndfile.h common.h +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/SndFile/Files/src/Makefile.am b/Libraries/SndFile/Files/src/Makefile.am new file mode 100644 index 000000000..5a40e112a --- /dev/null +++ b/Libraries/SndFile/Files/src/Makefile.am @@ -0,0 +1,102 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = GSM610 G72x + +lib_LTLIBRARIES = libsndfile.la +nodist_include_HEADERS = sndfile.h + +OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@ +OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@ + +EXTRA_DIST = sndfile.h.in config.h.in test_endswap.tpl test_endswap.def \ + Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def \ + create_symbols_file.py + +noinst_HEADERS = common.h sfconfig.h sfendian.h float_cast.h wav_w64.h sf_unistd.h + +noinst_PROGRAMS = test_endswap test_file_io test_log_printf + +COMMON = sndfile.c common.c file_io.c command.c pcm.c ulaw.c alaw.c float32.c \ + double64.c ima_adpcm.c ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c \ + interleave.c strings.c dither.c + +FILESPECIFIC = aiff.c au.c g72x.c avr.c caf.c ircam.c macbinary3.c macos.c \ + mat4.c mat5.c nist.c paf.c pvf.c raw.c svx.c voc.c htk.c dwd.c \ + ogg.c rx2.c sd2.c sds.c txw.c wve.c w64.c wav_w64.c wav.c xi.c \ + flac.c + +# MinGW requires -no-undefined if a DLL is to be built. +libsndfile_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@ @SHLIB_VERSION_ARG@ +libsndfile_la_SOURCES = $(COMMON) $(FILESPECIFIC) $(noinst_HEADERS) +nodist_libsndfile_la_SOURCES = $(nodist_include_HEADERS) +libsndfile_la_LIBADD = GSM610/libgsm.la G72x/libg72x.la -lm $(FLAC_LIBS) + +test_endswap_SOURCES = test_endswap.c + +test_file_io_CFLAGS = $(AM_CFLAGS) +test_file_io_SOURCES = file_io.c test_file_io.c + +test_log_printf_CFLAGS = $(AM_CFLAGS) +test_log_printf_SOURCES = test_log_printf.c + +test_endswap.c: test_endswap.def test_endswap.tpl + autogen --writable --source-time test_endswap.def + +genfiles : test_endswap.c Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def + +# Two test programs. +# It is not possible to place these in the tests/ directory because they +# need access to the internals of the SF_PRIVATE struct. + +check: test_endswap test_file_io test_log_printf + @echo + @echo + @echo + @echo "============================================================" + ./test_endswap + ./test_file_io + ./test_log_printf + @echo "============================================================" + @echo + @echo + @echo + +#====================================================================== +# Generate an OS specific Symbols files. This is done when the author +# builds the distribution tarball. There should be not need for the +# end user to create these files. + +Symbols.linux: create_symbols_file.py + ./create_symbols_file.py linux $(VERSION) > Symbols.linux + +Symbols.darwin: create_symbols_file.py + ./create_symbols_file.py darwin $(VERSION) > Symbols.darwin + +libsndfile.def: create_symbols_file.py + ./create_symbols_file.py win32 $(VERSION) > libsndfile.def + +cygsndfile.def: create_symbols_file.py + ./create_symbols_file.py cygwin $(VERSION) > cygsndfile.def + +# Fake dependancy to force the creation of these files. +sndfile.c : Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def + +#====================================================================== +# Disable autoheader. +AUTOHEADER=echo + +# Dependancies. + +aiff.c au.c g72x.c ircam.c mat4.c mat5.c nist.c paf.c pvf.c : sndfile.h common.h +raw.c svx.c voc.c w64.c wav.c wav_w64.c htk.c sd2.c rx2.c txw.c : sndfile.h common.h +sds.c wve.c dwd.c ogg.c xi.c sndfile.c common.c file_io.c : sndfile.h common.h +command.c pcm.c ulaw.c alaw.c float32.c double64.c ima_adpcm.c : sndfile.h common.h +ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c interleave.c strings.c : sndfile.h common.h +dither.c : sndfile.h common.h + +## Do not edit or modify anything in this comment block. +## The arch-tag line is a file identity tag for the GNU Arch +## revision control system. +## +## arch-tag: fc3511e6-4230-4bcb-9c86-f728d7a06fe7 + diff --git a/Libraries/SndFile/Files/src/Makefile.in b/Libraries/SndFile/Files/src/Makefile.in new file mode 100644 index 000000000..1ff715fc9 --- /dev/null +++ b/Libraries/SndFile/Files/src/Makefile.in @@ -0,0 +1,852 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +noinst_PROGRAMS = test_endswap$(EXEEXT) test_file_io$(EXEEXT) \ + test_log_printf$(EXEEXT) +subdir = src +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/sndfile.h.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = sndfile.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libsndfile_la_DEPENDENCIES = GSM610/libgsm.la G72x/libg72x.la \ + $(am__DEPENDENCIES_1) +am__objects_1 = sndfile.lo common.lo file_io.lo command.lo pcm.lo \ + ulaw.lo alaw.lo float32.lo double64.lo ima_adpcm.lo \ + ms_adpcm.lo gsm610.lo dwvw.lo vox_adpcm.lo interleave.lo \ + strings.lo dither.lo +am__objects_2 = aiff.lo au.lo g72x.lo avr.lo caf.lo ircam.lo \ + macbinary3.lo macos.lo mat4.lo mat5.lo nist.lo paf.lo pvf.lo \ + raw.lo svx.lo voc.lo htk.lo dwd.lo ogg.lo rx2.lo sd2.lo sds.lo \ + txw.lo wve.lo w64.lo wav_w64.lo wav.lo xi.lo flac.lo +am__objects_3 = +am_libsndfile_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) +nodist_libsndfile_la_OBJECTS = $(am__objects_3) +libsndfile_la_OBJECTS = $(am_libsndfile_la_OBJECTS) \ + $(nodist_libsndfile_la_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am_test_endswap_OBJECTS = test_endswap.$(OBJEXT) +test_endswap_OBJECTS = $(am_test_endswap_OBJECTS) +test_endswap_LDADD = $(LDADD) +am_test_file_io_OBJECTS = test_file_io-file_io.$(OBJEXT) \ + test_file_io-test_file_io.$(OBJEXT) +test_file_io_OBJECTS = $(am_test_file_io_OBJECTS) +test_file_io_LDADD = $(LDADD) +am_test_log_printf_OBJECTS = \ + test_log_printf-test_log_printf.$(OBJEXT) +test_log_printf_OBJECTS = $(am_test_log_printf_OBJECTS) +test_log_printf_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libsndfile_la_SOURCES) $(nodist_libsndfile_la_SOURCES) \ + $(test_endswap_SOURCES) $(test_file_io_SOURCES) \ + $(test_log_printf_SOURCES) +DIST_SOURCES = $(libsndfile_la_SOURCES) $(test_endswap_SOURCES) \ + $(test_file_io_SOURCES) $(test_log_printf_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(nodist_include_HEADERS) $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSA_LIBS = @ALSA_LIBS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ + +#====================================================================== +# Disable autoheader. +AUTOHEADER = echo +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILER_IS_GCC = @COMPILER_IS_GCC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FLAC_LIBS = @FLAC_LIBS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GETCONF = @GETCONF@ +HTML_BGCOLOUR = @HTML_BGCOLOUR@ +HTML_FGCOLOUR = @HTML_FGCOLOUR@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@ +OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SF_COUNT_MAX = @SF_COUNT_MAX@ +SHARED_VERSION_INFO = @SHARED_VERSION_INFO@ +SHELL = @SHELL@ +SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@ +SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@ +SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ +SQLITE3_LIBS = @SQLITE3_LIBS@ +STRIP = @STRIP@ +TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_GETCONF = @ac_ct_GETCONF@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +autogen = @autogen@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldocdir = @htmldocdir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUBDIRS = GSM610 G72x +lib_LTLIBRARIES = libsndfile.la +nodist_include_HEADERS = sndfile.h +EXTRA_DIST = sndfile.h.in config.h.in test_endswap.tpl test_endswap.def \ + Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def \ + create_symbols_file.py + +noinst_HEADERS = common.h sfconfig.h sfendian.h float_cast.h wav_w64.h sf_unistd.h +COMMON = sndfile.c common.c file_io.c command.c pcm.c ulaw.c alaw.c float32.c \ + double64.c ima_adpcm.c ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c \ + interleave.c strings.c dither.c + +FILESPECIFIC = aiff.c au.c g72x.c avr.c caf.c ircam.c macbinary3.c macos.c \ + mat4.c mat5.c nist.c paf.c pvf.c raw.c svx.c voc.c htk.c dwd.c \ + ogg.c rx2.c sd2.c sds.c txw.c wve.c w64.c wav_w64.c wav.c xi.c \ + flac.c + + +# MinGW requires -no-undefined if a DLL is to be built. +libsndfile_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@ @SHLIB_VERSION_ARG@ +libsndfile_la_SOURCES = $(COMMON) $(FILESPECIFIC) $(noinst_HEADERS) +nodist_libsndfile_la_SOURCES = $(nodist_include_HEADERS) +libsndfile_la_LIBADD = GSM610/libgsm.la G72x/libg72x.la -lm $(FLAC_LIBS) +test_endswap_SOURCES = test_endswap.c +test_file_io_CFLAGS = $(AM_CFLAGS) +test_file_io_SOURCES = file_io.c test_file_io.c +test_log_printf_CFLAGS = $(AM_CFLAGS) +test_log_printf_SOURCES = test_log_printf.c +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +sndfile.h: $(top_builddir)/config.status $(srcdir)/sndfile.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libsndfile.la: $(libsndfile_la_OBJECTS) $(libsndfile_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libsndfile_la_LDFLAGS) $(libsndfile_la_OBJECTS) $(libsndfile_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +test_endswap$(EXEEXT): $(test_endswap_OBJECTS) $(test_endswap_DEPENDENCIES) + @rm -f test_endswap$(EXEEXT) + $(LINK) $(test_endswap_LDFLAGS) $(test_endswap_OBJECTS) $(test_endswap_LDADD) $(LIBS) +test_file_io$(EXEEXT): $(test_file_io_OBJECTS) $(test_file_io_DEPENDENCIES) + @rm -f test_file_io$(EXEEXT) + $(LINK) $(test_file_io_LDFLAGS) $(test_file_io_OBJECTS) $(test_file_io_LDADD) $(LIBS) +test_log_printf$(EXEEXT): $(test_log_printf_OBJECTS) $(test_log_printf_DEPENDENCIES) + @rm -f test_log_printf$(EXEEXT) + $(LINK) $(test_log_printf_LDFLAGS) $(test_log_printf_OBJECTS) $(test_log_printf_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aiff.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alaw.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/au.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/caf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/double64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwvw.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_io.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flac.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g72x.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm610.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htk.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ima_adpcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interleave.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ircam.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/macbinary3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/macos.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mat4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mat5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ms_adpcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raw.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rx2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sd2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sds.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strings.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/svx.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_endswap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_file_io-file_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_file_io-test_file_io.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_log_printf-test_log_printf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/txw.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ulaw.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/voc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vox_adpcm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wav.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wav_w64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wve.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xi.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +test_file_io-file_io.o: file_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -MT test_file_io-file_io.o -MD -MP -MF "$(DEPDIR)/test_file_io-file_io.Tpo" -c -o test_file_io-file_io.o `test -f 'file_io.c' || echo '$(srcdir)/'`file_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_file_io-file_io.Tpo" "$(DEPDIR)/test_file_io-file_io.Po"; else rm -f "$(DEPDIR)/test_file_io-file_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_io.c' object='test_file_io-file_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -c -o test_file_io-file_io.o `test -f 'file_io.c' || echo '$(srcdir)/'`file_io.c + +test_file_io-file_io.obj: file_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -MT test_file_io-file_io.obj -MD -MP -MF "$(DEPDIR)/test_file_io-file_io.Tpo" -c -o test_file_io-file_io.obj `if test -f 'file_io.c'; then $(CYGPATH_W) 'file_io.c'; else $(CYGPATH_W) '$(srcdir)/file_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_file_io-file_io.Tpo" "$(DEPDIR)/test_file_io-file_io.Po"; else rm -f "$(DEPDIR)/test_file_io-file_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_io.c' object='test_file_io-file_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -c -o test_file_io-file_io.obj `if test -f 'file_io.c'; then $(CYGPATH_W) 'file_io.c'; else $(CYGPATH_W) '$(srcdir)/file_io.c'; fi` + +test_file_io-test_file_io.o: test_file_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -MT test_file_io-test_file_io.o -MD -MP -MF "$(DEPDIR)/test_file_io-test_file_io.Tpo" -c -o test_file_io-test_file_io.o `test -f 'test_file_io.c' || echo '$(srcdir)/'`test_file_io.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_file_io-test_file_io.Tpo" "$(DEPDIR)/test_file_io-test_file_io.Po"; else rm -f "$(DEPDIR)/test_file_io-test_file_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_file_io.c' object='test_file_io-test_file_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -c -o test_file_io-test_file_io.o `test -f 'test_file_io.c' || echo '$(srcdir)/'`test_file_io.c + +test_file_io-test_file_io.obj: test_file_io.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -MT test_file_io-test_file_io.obj -MD -MP -MF "$(DEPDIR)/test_file_io-test_file_io.Tpo" -c -o test_file_io-test_file_io.obj `if test -f 'test_file_io.c'; then $(CYGPATH_W) 'test_file_io.c'; else $(CYGPATH_W) '$(srcdir)/test_file_io.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_file_io-test_file_io.Tpo" "$(DEPDIR)/test_file_io-test_file_io.Po"; else rm -f "$(DEPDIR)/test_file_io-test_file_io.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_file_io.c' object='test_file_io-test_file_io.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_file_io_CFLAGS) $(CFLAGS) -c -o test_file_io-test_file_io.obj `if test -f 'test_file_io.c'; then $(CYGPATH_W) 'test_file_io.c'; else $(CYGPATH_W) '$(srcdir)/test_file_io.c'; fi` + +test_log_printf-test_log_printf.o: test_log_printf.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_log_printf_CFLAGS) $(CFLAGS) -MT test_log_printf-test_log_printf.o -MD -MP -MF "$(DEPDIR)/test_log_printf-test_log_printf.Tpo" -c -o test_log_printf-test_log_printf.o `test -f 'test_log_printf.c' || echo '$(srcdir)/'`test_log_printf.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_log_printf-test_log_printf.Tpo" "$(DEPDIR)/test_log_printf-test_log_printf.Po"; else rm -f "$(DEPDIR)/test_log_printf-test_log_printf.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_log_printf.c' object='test_log_printf-test_log_printf.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_log_printf_CFLAGS) $(CFLAGS) -c -o test_log_printf-test_log_printf.o `test -f 'test_log_printf.c' || echo '$(srcdir)/'`test_log_printf.c + +test_log_printf-test_log_printf.obj: test_log_printf.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_log_printf_CFLAGS) $(CFLAGS) -MT test_log_printf-test_log_printf.obj -MD -MP -MF "$(DEPDIR)/test_log_printf-test_log_printf.Tpo" -c -o test_log_printf-test_log_printf.obj `if test -f 'test_log_printf.c'; then $(CYGPATH_W) 'test_log_printf.c'; else $(CYGPATH_W) '$(srcdir)/test_log_printf.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/test_log_printf-test_log_printf.Tpo" "$(DEPDIR)/test_log_printf-test_log_printf.Po"; else rm -f "$(DEPDIR)/test_log_printf-test_log_printf.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_log_printf.c' object='test_log_printf-test_log_printf.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_log_printf_CFLAGS) $(CFLAGS) -c -o test_log_printf-test_log_printf.obj `if test -f 'test_log_printf.c'; then $(CYGPATH_W) 'test_log_printf.c'; else $(CYGPATH_W) '$(srcdir)/test_log_printf.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-nodist_includeHEADERS: $(nodist_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)" + @list='$(nodist_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-nodist_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-nodist_includeHEADERS + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-nodist_includeHEADERS + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstPROGRAMS clean-recursive ctags ctags-recursive \ + distclean distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-recursive distclean-tags distdir \ + dvi dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-nodist_includeHEADERS install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-nodist_includeHEADERS + + +test_endswap.c: test_endswap.def test_endswap.tpl + autogen --writable --source-time test_endswap.def + +genfiles : test_endswap.c Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def + +# Two test programs. +# It is not possible to place these in the tests/ directory because they +# need access to the internals of the SF_PRIVATE struct. + +check: test_endswap test_file_io test_log_printf + @echo + @echo + @echo + @echo "============================================================" + ./test_endswap + ./test_file_io + ./test_log_printf + @echo "============================================================" + @echo + @echo + @echo + +#====================================================================== +# Generate an OS specific Symbols files. This is done when the author +# builds the distribution tarball. There should be not need for the +# end user to create these files. + +Symbols.linux: create_symbols_file.py + ./create_symbols_file.py linux $(VERSION) > Symbols.linux + +Symbols.darwin: create_symbols_file.py + ./create_symbols_file.py darwin $(VERSION) > Symbols.darwin + +libsndfile.def: create_symbols_file.py + ./create_symbols_file.py win32 $(VERSION) > libsndfile.def + +cygsndfile.def: create_symbols_file.py + ./create_symbols_file.py cygwin $(VERSION) > cygsndfile.def + +# Fake dependancy to force the creation of these files. +sndfile.c : Symbols.linux Symbols.darwin libsndfile.def cygsndfile.def + +# Dependancies. + +aiff.c au.c g72x.c ircam.c mat4.c mat5.c nist.c paf.c pvf.c : sndfile.h common.h +raw.c svx.c voc.c w64.c wav.c wav_w64.c htk.c sd2.c rx2.c txw.c : sndfile.h common.h +sds.c wve.c dwd.c ogg.c xi.c sndfile.c common.c file_io.c : sndfile.h common.h +command.c pcm.c ulaw.c alaw.c float32.c double64.c ima_adpcm.c : sndfile.h common.h +ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c interleave.c strings.c : sndfile.h common.h +dither.c : sndfile.h common.h +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/SndFile/Files/src/caf.c b/Libraries/SndFile/Files/src/caf.c new file mode 100644 index 000000000..01f371989 --- /dev/null +++ b/Libraries/SndFile/Files/src/caf.c @@ -0,0 +1,538 @@ +/* +** Copyright (C) 2005 Erik de Castro Lopo +** +** 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. +*/ + +#include "sfconfig.h" + +#include +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define aac_MARKER MAKE_MARKER ('a', 'a', 'c', ' ') +#define alac_MARKER MAKE_MARKER ('a', 'l', 'a', 'c') +#define alaw_MARKER MAKE_MARKER ('a', 'l', 'a', 'w') +#define caff_MARKER MAKE_MARKER ('c', 'a', 'f', 'f') +#define chan_MARKER MAKE_MARKER ('c', 'h', 'a', 'n') +#define data_MARKER MAKE_MARKER ('d', 'a', 't', 'a') +#define desc_MARKER MAKE_MARKER ('d', 'e', 's', 'c') +#define edct_MARKER MAKE_MARKER ('e', 'd', 'c', 't') +#define free_MARKER MAKE_MARKER ('f', 'r', 'e', 'e') +#define ima4_MARKER MAKE_MARKER ('i', 'm', 'a', '4') +#define info_MARKER MAKE_MARKER ('i', 'n', 'f', 'o') +#define inst_MARKER MAKE_MARKER ('i', 'n', 's', 't') +#define kuki_MARKER MAKE_MARKER ('k', 'u', 'k', 'i') +#define lpcm_MARKER MAKE_MARKER ('l', 'p', 'c', 'm') +#define mark_MARKER MAKE_MARKER ('m', 'a', 'r', 'k') +#define midi_MARKER MAKE_MARKER ('m', 'i', 'd', 'i') +#define mp1_MARKER MAKE_MARKER ('.', 'm', 'p', '1') +#define mp2_MARKER MAKE_MARKER ('.', 'm', 'p', '2') +#define mp3_MARKER MAKE_MARKER ('.', 'm', 'p', '3') +#define ovvw_MARKER MAKE_MARKER ('o', 'v', 'v', 'w') +#define pakt_MARKER MAKE_MARKER ('p', 'a', 'k', 't') +#define peak_MARKER MAKE_MARKER ('p', 'e', 'a', 'k') +#define regn_MARKER MAKE_MARKER ('r', 'e', 'g', 'n') +#define strg_MARKER MAKE_MARKER ('s', 't', 'r', 'g') +#define umid_MARKER MAKE_MARKER ('u', 'm', 'i', 'd') +#define uuid_MARKER MAKE_MARKER ('u', 'u', 'i', 'd') +#define ulaw_MARKER MAKE_MARKER ('u', 'l', 'a', 'w') +#define MAC3_MARKER MAKE_MARKER ('M', 'A', 'C', '3') +#define MAC6_MARKER MAKE_MARKER ('M', 'A', 'C', '6') + +#define CAF_PEAK_CHUNK_SIZE(ch) (sizeof (int) + ch * (sizeof (float) + 8)) + +#define SFE_CAF_NOT_CAF 666 +#define SFE_CAF_NO_DESC 667 +#define SFE_CAF_BAD_PEAK 668 + +/*------------------------------------------------------------------------------ +** Typedefs. +*/ + +typedef struct +{ unsigned char srate [8] ; + unsigned int fmt_id ; + unsigned int fmt_flags ; + unsigned int pkt_bytes ; + unsigned int pkt_frames ; + unsigned int channels_per_frame ; + unsigned int bits_per_chan ; +} DESC_CHUNK ; + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int caf_close (SF_PRIVATE *psf) ; +static int caf_read_header (SF_PRIVATE *psf) ; +static int caf_write_header (SF_PRIVATE *psf, int calc_length) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +caf_open (SF_PRIVATE *psf) +{ int subformat, format, error = 0 ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = caf_read_header (psf))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (psf->is_pipe) + return SFE_NO_PIPE_WRITE ; + + format = psf->sf.format & SF_FORMAT_TYPEMASK ; + if (format != SF_FORMAT_CAF) + return SFE_BAD_OPEN_FORMAT ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + if (psf->mode != SFM_RDWR || psf->filelength < 44) + { psf->filelength = 0 ; + psf->datalength = 0 ; + psf->dataoffset = 0 ; + psf->sf.frames = 0 ; + } ; + + psf->str_flags = SF_STR_ALLOW_START ; + + /* + ** By default, add the peak chunk to floating point files. Default behaviour + ** can be switched off using sf_command (SFC_SET_PEAK_CHUNK, SF_FALSE). + */ + if (psf->mode == SFM_WRITE && (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)) + { if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL) + return SFE_MALLOC_FAILED ; + psf->peak_info->peak_loc = SF_PEAK_START ; + } ; + + if ((error = caf_write_header (psf, SF_FALSE)) != 0) + return error ; + + psf->write_header = caf_write_header ; + } ; + + psf->container_close = caf_close ; + /*psf->command = caf_command ;*/ + + switch (subformat) + { case SF_FORMAT_PCM_S8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_ULAW : + error = ulaw_init (psf) ; + break ; + + case SF_FORMAT_ALAW : + error = alaw_init (psf) ; + break ; + + /* Lite remove start */ + case SF_FORMAT_FLOAT : + error = float32_init (psf) ; + break ; + + case SF_FORMAT_DOUBLE : + error = double64_init (psf) ; + break ; + /* Lite remove end */ + + default : + return SFE_UNSUPPORTED_ENCODING ; + } ; + + return error ; +} /* caf_open */ + +static int +caf_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + caf_write_header (psf, SF_TRUE) ; + + return 0 ; +} /* caf_close */ + +/*------------------------------------------------------------------------------ +*/ + +static int +decode_desc_chunk (SF_PRIVATE *psf, const DESC_CHUNK *desc) +{ int format ; + + psf->sf.channels = desc->channels_per_frame ; + + format = SF_FORMAT_CAF | (psf->endian == SF_ENDIAN_LITTLE ? SF_ENDIAN_LITTLE : 0) ; + + if (desc->fmt_id == lpcm_MARKER && desc->fmt_flags & 1) + { /* Floating point data. */ + if (desc->bits_per_chan == 32 && desc->pkt_bytes == 4 * desc->channels_per_frame) + { psf->bytewidth = 4 ; + return format | SF_FORMAT_FLOAT ; + } ; + if (desc->bits_per_chan == 64 && desc->pkt_bytes == 8 * desc->channels_per_frame) + { psf->bytewidth = 8 ; + return format | SF_FORMAT_DOUBLE ; + } ; + } ; + + if ((desc->fmt_flags & 1) != 0) + { psf_log_printf (psf, "**** Ooops, 'desc' chunk suggests float data, but other info invalid.\n") ; + return 0 ; + } ; + + if (desc->fmt_id == lpcm_MARKER) + { /* Integer data. */ + if (desc->bits_per_chan == 32 && desc->pkt_bytes == 4 * desc->channels_per_frame) + { psf->bytewidth = 4 ; + return format | SF_FORMAT_PCM_32 ; + } ; + if (desc->bits_per_chan == 24 && desc->pkt_bytes == 3 * desc->channels_per_frame) + { psf->bytewidth = 3 ; + return format | SF_FORMAT_PCM_24 ; + } ; + if (desc->bits_per_chan == 16 && desc->pkt_bytes == 2 * desc->channels_per_frame) + { psf->bytewidth = 2 ; + return format | SF_FORMAT_PCM_16 ; + } ; + if (desc->bits_per_chan == 8 && desc->pkt_bytes == 1 * desc->channels_per_frame) + { psf->bytewidth = 1 ; + return format | SF_FORMAT_PCM_S8 ; + } ; + } ; + + if (desc->fmt_id == alaw_MARKER && desc->bits_per_chan == 8) + { psf->bytewidth = 1 ; + return format | SF_FORMAT_ALAW ; + } ; + + if (desc->fmt_id == ulaw_MARKER && desc->bits_per_chan == 8) + { psf->bytewidth = 1 ; + return format | SF_FORMAT_ULAW ; + } ; + + return 0 ; +} /* decode_desc_chunk */ + +static int +caf_read_header (SF_PRIVATE *psf) +{ DESC_CHUNK desc ; + sf_count_t chunk_size ; + double srate ; + short version, flags ; + int marker, k, have_data = 0 ; + + memset (&desc, 0, sizeof (desc)) ; + + /* Set position to start of file to begin reading header. */ + psf_binheader_readf (psf, "pmE2E2", 0, &marker, &version, &flags) ; + psf_log_printf (psf, "%M\n Version : %d\n Flags : %x\n", marker, version, flags) ; + if (marker != caff_MARKER) + return SFE_CAF_NOT_CAF ; + + psf_binheader_readf (psf, "mE8b", &marker, &chunk_size, psf->u.ucbuf, 8) ; + srate = double64_be_read (psf->u.ucbuf) ; + LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%5.3f", srate) ; + psf_log_printf (psf, "%M : %D\n Sample rate : %s\n", marker, chunk_size, psf->u.cbuf) ; + if (marker != desc_MARKER) + return SFE_CAF_NO_DESC ; + + if (chunk_size < sizeof (DESC_CHUNK)) + { psf_log_printf (psf, "**** Chunk size too small. Should be > 32 bytes.\n") ; + return SFE_MALFORMED_FILE ; + } ; + + psf->sf.samplerate = lrint (srate) ; + + psf_binheader_readf (psf, "mE44444", &desc.fmt_id, &desc.fmt_flags, &desc.pkt_bytes, &desc.pkt_frames, + &desc.channels_per_frame, &desc.bits_per_chan) ; + psf_log_printf (psf, " Format id : %M\n Format flags : %x\n Bytes / packet : %u\n" + " Frames / packet : %u\n Channels / frame : %u\n Bits / channel : %u\n", + desc.fmt_id, desc.fmt_flags, desc.pkt_bytes, desc.pkt_frames, desc.channels_per_frame, desc.bits_per_chan) ; + + if (chunk_size > sizeof (DESC_CHUNK)) + psf_binheader_readf (psf, "j", (int) (chunk_size - sizeof (DESC_CHUNK))) ; + + psf->sf.channels = desc.channels_per_frame ; + + while (have_data == 0 && psf_ftell (psf) < psf->filelength - SIGNED_SIZEOF (marker)) + { psf_binheader_readf (psf, "mE8", &marker, &chunk_size) ; + + switch (marker) + { case peak_MARKER : + psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ; + if (chunk_size != CAF_PEAK_CHUNK_SIZE (psf->sf.channels)) + { psf_binheader_readf (psf, "j", (int) chunk_size) ; + psf_log_printf (psf, "*** File PEAK chunk %D should be %d.\n", chunk_size, CAF_PEAK_CHUNK_SIZE (psf->sf.channels)) ; + return SFE_CAF_BAD_PEAK ; + } ; + + if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL) + return SFE_MALLOC_FAILED ; + + /* read in rest of PEAK chunk. */ + psf_binheader_readf (psf, "E4", & (psf->peak_info->edit_number)) ; + psf_log_printf (psf, " edit count : %d\n", psf->peak_info->edit_number) ; + + psf_log_printf (psf, " Ch Position Value\n") ; + for (k = 0 ; k < psf->sf.channels ; k++) + { sf_count_t position ; + float value ; + + psf_binheader_readf (psf, "Ef8", &value, &position) ; + psf->peak_info->peaks [k].value = value ; + psf->peak_info->peaks [k].position = position ; + + LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), " %2d %-12ld %g\n", k, (long) position, value) ; + psf_log_printf (psf, psf->u.cbuf) ; + } ; + + psf->peak_info->peak_loc = SF_PEAK_START ; + break ; + + case free_MARKER : + psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ; + psf_binheader_readf (psf, "j", (int) chunk_size) ; + break ; + + case data_MARKER : + psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ; + psf_binheader_readf (psf, "E4", &k) ; + psf_log_printf (psf, " edit : %u\n", k) ; + have_data = 1 ; + break ; + + default : + psf_log_printf (psf, " %M : %D (skipped)\n", marker, chunk_size) ; + psf_binheader_readf (psf, "j", (int) chunk_size) ; + break ; + } ; + } ; + + if (have_data == 0) + { psf_log_printf (psf, "**** Error, could not find 'data' chunk.\n") ; + return SFE_MALFORMED_FILE ; + } ; + + psf_log_printf (psf, "End\n") ; + + psf->dataoffset = psf_ftell (psf) ; + psf->datalength = psf->filelength - psf->dataoffset ; + psf->endian = (desc.fmt_flags & 2) ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ; + + if ((psf->sf.format = decode_desc_chunk (psf, &desc)) == 0) + return SFE_UNSUPPORTED_ENCODING ; + + if (psf->bytewidth > 0) + psf->sf.frames = psf->datalength / psf->bytewidth ; + + return 0 ; +} /* caf_read_header */ + +/*------------------------------------------------------------------------------ +*/ + +static int +caf_write_header (SF_PRIVATE *psf, int calc_length) +{ DESC_CHUNK desc ; + sf_count_t current, free_len ; + int subformat ; + + memset (&desc, 0, sizeof (desc)) ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + if (psf->bytewidth > 0) + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + /* 'caff' marker, version and flags. */ + psf_binheader_writef (psf, "Em22", caff_MARKER, 1, 0) ; + + /* 'desc' marker and chunk size. */ + psf_binheader_writef (psf, "Em8", desc_MARKER, (sf_count_t) (sizeof (DESC_CHUNK))) ; + + double64_be_write (1.0 * psf->sf.samplerate, psf->u.ucbuf) ; + psf_binheader_writef (psf, "b", psf->u.ucbuf, 8) ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + + if (CPU_IS_BIG_ENDIAN && (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU)) + psf->endian = SF_ENDIAN_BIG ; + else if (CPU_IS_LITTLE_ENDIAN && (psf->endian == SF_ENDIAN_LITTLE || psf->endian == SF_ENDIAN_CPU)) + psf->endian = SF_ENDIAN_LITTLE ; + + if (psf->endian == SF_ENDIAN_LITTLE) + desc.fmt_flags = 2 ; + else + psf->endian = SF_ENDIAN_BIG ; + + /* initial section (same for all, it appears) */ + switch (subformat) + { case SF_FORMAT_PCM_S8 : + desc.fmt_id = lpcm_MARKER ; + psf->bytewidth = 1 ; + desc.pkt_bytes = psf->bytewidth * psf->sf.channels ; + desc.pkt_frames = 1 ; + desc.channels_per_frame = psf->sf.channels ; + desc.bits_per_chan = 8 ; + break ; + + case SF_FORMAT_PCM_16 : + desc.fmt_id = lpcm_MARKER ; + psf->bytewidth = 2 ; + desc.pkt_bytes = psf->bytewidth * psf->sf.channels ; + desc.pkt_frames = 1 ; + desc.channels_per_frame = psf->sf.channels ; + desc.bits_per_chan = 16 ; + break ; + + case SF_FORMAT_PCM_24 : + psf->bytewidth = 3 ; + desc.pkt_bytes = psf->bytewidth * psf->sf.channels ; + desc.pkt_frames = 1 ; + desc.channels_per_frame = psf->sf.channels ; + desc.bits_per_chan = 24 ; + desc.fmt_id = lpcm_MARKER ; + break ; + + case SF_FORMAT_PCM_32 : + desc.fmt_id = lpcm_MARKER ; + psf->bytewidth = 4 ; + desc.pkt_bytes = psf->bytewidth * psf->sf.channels ; + desc.pkt_frames = 1 ; + desc.channels_per_frame = psf->sf.channels ; + desc.bits_per_chan = 32 ; + break ; + + case SF_FORMAT_FLOAT : + desc.fmt_id = lpcm_MARKER ; + desc.fmt_flags |= 1 ; + psf->bytewidth = 4 ; + desc.pkt_bytes = psf->bytewidth * psf->sf.channels ; + desc.pkt_frames = 1 ; + desc.channels_per_frame = psf->sf.channels ; + desc.bits_per_chan = 32 ; + break ; + + case SF_FORMAT_DOUBLE : + desc.fmt_id = lpcm_MARKER ; + desc.fmt_flags |= 1 ; + psf->bytewidth = 8 ; + desc.pkt_bytes = psf->bytewidth * psf->sf.channels ; + desc.pkt_frames = 1 ; + desc.channels_per_frame = psf->sf.channels ; + desc.bits_per_chan = 64 ; + break ; + + case SF_FORMAT_ALAW : + desc.fmt_id = alaw_MARKER ; + psf->bytewidth = 1 ; + desc.pkt_bytes = psf->bytewidth * psf->sf.channels ; + desc.pkt_frames = 1 ; + desc.channels_per_frame = psf->sf.channels ; + desc.bits_per_chan = 8 ; + break ; + + case SF_FORMAT_ULAW : + desc.fmt_id = ulaw_MARKER ; + psf->bytewidth = 1 ; + desc.pkt_bytes = psf->bytewidth * psf->sf.channels ; + desc.pkt_frames = 1 ; + desc.channels_per_frame = psf->sf.channels ; + desc.bits_per_chan = 8 ; + break ; + + default : + return SFE_UNIMPLEMENTED ; + } ; + + psf_binheader_writef (psf, "mE44444", desc.fmt_id, desc.fmt_flags, desc.pkt_bytes, desc.pkt_frames, desc.channels_per_frame, desc.bits_per_chan) ; + +#if 0 + if (psf->str_flags & SF_STR_LOCATE_START) + caf_write_strings (psf, SF_STR_LOCATE_START) ; +#endif + + if (psf->peak_info != NULL) + { int k ; + psf_binheader_writef (psf, "Em84", peak_MARKER, (sf_count_t) CAF_PEAK_CHUNK_SIZE (psf->sf.channels), psf->peak_info->edit_number) ; + for (k = 0 ; k < psf->sf.channels ; k++) + psf_binheader_writef (psf, "Ef8", (float) psf->peak_info->peaks [k].value, psf->peak_info->peaks [k].position) ; + } ; + + /* Add free chunk so that the actual audio data starts at a multiple 0x1000. */ + free_len = 0x1000 - psf->headindex - 16 - 12 ; + while (free_len < 0) + free_len += 0x1000 ; + psf_binheader_writef (psf, "Em8z", free_MARKER, free_len, (int) free_len) ; + + psf_binheader_writef (psf, "Em84", data_MARKER, psf->datalength, 0) ; + + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + if (current < psf->dataoffset) + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + else if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* caf_write_header */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 65883e65-bd3c-4618-9241-d3c02fd630bd +*/ diff --git a/Libraries/SndFile/Files/src/config.h.in b/Libraries/SndFile/Files/src/config.h.in new file mode 100644 index 000000000..ff659fef3 --- /dev/null +++ b/Libraries/SndFile/Files/src/config.h.in @@ -0,0 +1,256 @@ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Set to 1 if the compile is GNU GCC. */ +#undef COMPILER_IS_GCC + +/* Target processor clips on negative float to int conversion. */ +#undef CPU_CLIPS_NEGATIVE + +/* Target processor clips on positive float to int conversion. */ +#undef CPU_CLIPS_POSITIVE + +/* Target processor is big endian. */ +#undef CPU_IS_BIG_ENDIAN + +/* Target processor is little endian. */ +#undef CPU_IS_LITTLE_ENDIAN + +/* Set to 1 to enable experimental code. */ +#undef ENABLE_EXPERIMENTAL_CODE + +/* Major version of GCC or 3 otherwise. */ +#undef GCC_MAJOR_VERSION + +/* Define to 1 if you have the header file. */ +#undef HAVE_ALSA_ASOUNDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + +/* Define to 1 if you have the `calloc' function. */ +#undef HAVE_CALLOC + +/* Define to 1 if you have the `ceil' function. */ +#undef HAVE_CEIL + +/* Set to 1 if S_IRGRP is defined. */ +#undef HAVE_DECL_S_IRGRP + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the 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 + +/* Define to 1 if you have the header file. */ +#undef HAVE_FLAC_ALL_H + +/* Set to 1 if the compile supports the struct hack. */ +#undef HAVE_FLEXIBLE_ARRAY + +/* Define to 1 if you have the `floor' function. */ +#undef HAVE_FLOOR + +/* Define to 1 if you have the `fmod' function. */ +#undef HAVE_FMOD + +/* Define to 1 if you have the `free' function. */ +#undef HAVE_FREE + +/* Define to 1 if you have the `fstat' function. */ +#undef HAVE_FSTAT + +/* 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. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the `gmtime' function. */ +#undef HAVE_GMTIME + +/* Define to 1 if you have the `gmtime_r' function. */ +#undef HAVE_GMTIME_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the 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. */ +#undef HAVE_LSEEK + +/* Define to 1 if you have the `malloc' function. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mmap' function. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `open' function. */ +#undef HAVE_OPEN + +/* 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. */ +#undef HAVE_READ + +/* Define to 1 if you have the `realloc' function. */ +#undef HAVE_REALLOC + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* 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 header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the `write' function. */ +#undef HAVE_WRITE + +/* Set to 1 if compiling for MacOSX */ +#undef OS_IS_MACOSX + +/* Set to 1 if compiling for Win32 */ +#undef OS_IS_WIN32 + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Set to maximum allowed value of sf_count_t type. */ +#undef SF_COUNT_MAX + +/* The size of a `double', as computed by sizeof. */ +#undef SIZEOF_DOUBLE + +/* The size of a `float', as computed by sizeof. */ +#undef SIZEOF_FLOAT + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of a `int64_t', as computed by sizeof. */ +#undef SIZEOF_INT64_T + +/* The size of a `loff_t', as computed by sizeof. */ +#undef SIZEOF_LOFF_T + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of a `off64_t', as computed by sizeof. */ +#undef SIZEOF_OFF64_T + +/* The size of a `off_t', as computed by sizeof. */ +#undef SIZEOF_OFF_T + +/* Set to sizeof (long) if unknown. */ +#undef SIZEOF_SF_COUNT_T + +/* The size of a `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of a `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of a `ssize_t', as computed by sizeof. */ +#undef SIZEOF_SSIZE_T + +/* The size of a `void*', as computed by sizeof. */ +#undef SIZEOF_VOIDP + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Set to long if unknown. */ +#undef TYPEOF_SF_COUNT_T + +/* Set to 1 to use the native windows API */ +#undef USE_WINDOWS_API + +/* Version number of package */ +#undef VERSION + +/* 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 diff --git a/Libraries/SndFile/Files/src/cygsndfile.def b/Libraries/SndFile/Files/src/cygsndfile.def new file mode 100644 index 000000000..510aa8e22 --- /dev/null +++ b/Libraries/SndFile/Files/src/cygsndfile.def @@ -0,0 +1,39 @@ +; Auto-generated by create_symbols_file.py + +LIBRARY cygsndfile-1.dll +EXPORTS + +sf_command @1 +sf_open @2 +sf_close @3 +sf_seek @4 +sf_error @7 +sf_perror @8 +sf_error_str @9 +sf_error_number @10 +sf_format_check @11 +sf_read_raw @16 +sf_readf_short @17 +sf_readf_int @18 +sf_readf_float @19 +sf_readf_double @20 +sf_read_short @21 +sf_read_int @22 +sf_read_float @23 +sf_read_double @24 +sf_write_raw @32 +sf_writef_short @33 +sf_writef_int @34 +sf_writef_float @35 +sf_writef_double @36 +sf_write_short @37 +sf_write_int @38 +sf_write_float @39 +sf_write_double @40 +sf_strerror @50 +sf_get_string @60 +sf_set_string @61 +sf_open_fd @70 +sf_open_virtual @80 +sf_write_sync @90 + diff --git a/Libraries/SndFile/Files/src/flac.c b/Libraries/SndFile/Files/src/flac.c new file mode 100644 index 000000000..1f0872f0b --- /dev/null +++ b/Libraries/SndFile/Files/src/flac.c @@ -0,0 +1,1156 @@ +/* +** Copyright (C) 2004, 2005 Erik de Castro Lopo +** Copyright (C) 2004 Tobias Gehrig +** +** 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. +*/ + +#include "sfconfig.h" + +#include +#include +#include +#include +#include + +#include "sndfile.h" +#include "common.h" + + +#ifndef HAVE_FLAC_ALL_H + +int +flac_open (SF_PRIVATE *psf) +{ if (psf) + return SFE_UNIMPLEMENTED ; + return (psf && 0) ; +} /* flac_open */ + + +#else + +#include + +#include "sfendian.h" +#include "float_cast.h" + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +#define ENC_BUFFER_SIZE 4096 + +typedef enum +{ PFLAC_PCM_SHORT = 0, + PFLAC_PCM_INT = 1, + PFLAC_PCM_FLOAT = 2, + PFLAC_PCM_DOUBLE = 3 +} PFLAC_PCM ; + +typedef struct +{ FLAC__SeekableStreamDecoder *fsd ; + FLAC__SeekableStreamEncoder *fse ; + PFLAC_PCM pcmtype ; + void* ptr ; + unsigned pos, len, remain ; + + const FLAC__int32 * const * wbuffer ; + FLAC__int32 * rbuffer [FLAC__MAX_CHANNELS] ; + + FLAC__int32* encbuffer ; + unsigned bufferpos ; + + const FLAC__Frame *frame ; + FLAC__bool bufferbackup ; +} FLAC_PRIVATE ; + +static sf_count_t flac_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; +static int flac_close (SF_PRIVATE *psf) ; + +static int flac_enc_init (SF_PRIVATE *psf) ; +static int flac_read_header (SF_PRIVATE *psf) ; + +static sf_count_t flac_read_flac2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t flac_read_flac2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t flac_read_flac2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t flac_read_flac2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t flac_write_s2flac (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ; +static sf_count_t flac_write_i2flac (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ; +static sf_count_t flac_write_f2flac (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ; +static sf_count_t flac_write_d2flac (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ; + +static void f2flac8_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; +static void f2flac16_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; +static void f2flac24_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; +static void f2flac8_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; +static void f2flac16_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; +static void f2flac24_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) ; +static void d2flac8_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; +static void d2flac16_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; +static void d2flac24_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; +static void d2flac8_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; +static void d2flac16_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; +static void d2flac24_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) ; + +static int flac_command (SF_PRIVATE *psf, int command, void *data, int datasize) ; + +/* Decoder Callbacks */ +static FLAC__SeekableStreamDecoderReadStatus sf_flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer [], unsigned *bytes, void *client_data) ; +static FLAC__SeekableStreamDecoderSeekStatus sf_flac_seek_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) ; +static FLAC__SeekableStreamDecoderTellStatus sf_flac_tell_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ; +static FLAC__SeekableStreamDecoderLengthStatus sf_flac_length_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) ; +static FLAC__bool sf_flac_eof_callback (const FLAC__SeekableStreamDecoder *decoder, void *client_data) ; +static FLAC__StreamDecoderWriteStatus sf_flac_write_callback (const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) ; +static void sf_flac_meta_callback (const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) ; +static void sf_flac_error_callback (const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) ; + +/* Encoder Callbacks */ +static FLAC__SeekableStreamEncoderSeekStatus sf_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) ; +#ifdef HAVE_FLAC_1_1_1 +static FLAC__SeekableStreamEncoderTellStatus sf_flac_enc_tell_callback (const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) ; +#endif +static FLAC__StreamEncoderWriteStatus sf_flac_enc_write_callback (const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer [], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) ; + +static const int legal_sample_rates [] = +{ 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000 +} ; + +static inline void +s2flac8_array (const short *src, FLAC__int32 *dest, int count) +{ while (--count >= 0) + dest [count] = src [count] >> 8 ; +} /* s2flac8_array */ + +static inline void +s2flac16_array (const short *src, FLAC__int32 *dest, int count) +{ while (--count >= 0) + dest [count] = src [count] ; +} /* s2flac16_array */ + +static inline void +s2flac24_array (const short *src, FLAC__int32 *dest, int count) +{ while (--count >= 0) + dest [count] = src [count] << 8 ; +} /* s2flac24_array */ + +static inline void +i2flac8_array (const int *src, FLAC__int32 *dest, int count) +{ while (--count >= 0) + dest [count] = src [count] >> 24 ; +} /* i2flac8_array */ + +static inline void +i2flac16_array (const int *src, FLAC__int32 *dest, int count) +{ + while (--count >= 0) + dest [count] = src [count] >> 16 ; +} /* i2flac16_array */ + +static inline void +i2flac24_array (const int *src, FLAC__int32 *dest, int count) +{ while (--count >= 0) + dest [count] = src [count] >> 8 ; +} /* i2flac24_array */ + +static sf_count_t +flac_buffer_copy (SF_PRIVATE *psf) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + const FLAC__Frame *frame = pflac->frame ; + const FLAC__int32* const *buffer = pflac->wbuffer ; + unsigned i = 0, j, offset ; + + if (pflac->ptr == NULL) + { /* + ** Not sure why this code is here and not elsewhere. + ** Removing it causes valgrind errors. + */ + pflac->bufferbackup = SF_TRUE ; + for (i = 0 ; i < frame->header.channels ; i++) + { if (pflac->rbuffer [i] == NULL) + pflac->rbuffer [i] = calloc (frame->header.blocksize, sizeof (FLAC__int32)) ; + memcpy (pflac->rbuffer [i], buffer [i], frame->header.blocksize * sizeof (FLAC__int32)) ; + } ; + pflac->wbuffer = (const FLAC__int32* const*) pflac->rbuffer ; + + return 0 ; + } ; + + switch (pflac->pcmtype) + { case PFLAC_PCM_SHORT : + { short *retpcm = ((short*) pflac->ptr) ; + int shift = 16 - frame->header.bits_per_sample ; + if (shift < 0) + { shift = abs (shift) ; + for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * frame->header.channels ; + for (j = 0 ; j < frame->header.channels ; j++) + retpcm [offset + j] = buffer [j][pflac->bufferpos] >> shift ; + pflac->remain -= frame->header.channels ; + pflac->bufferpos++ ; + } + } + else + { for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * frame->header.channels ; + + if (pflac->bufferpos >= frame->header.blocksize) + break ; + + for (j = 0 ; j < frame->header.channels ; j++) + retpcm [offset + j] = (buffer [j][pflac->bufferpos]) << shift ; + + pflac->remain -= frame->header.channels ; + pflac->bufferpos++ ; + } ; + } ; + } ; + break ; + + case PFLAC_PCM_INT : + { int *retpcm = ((int*) pflac->ptr) ; + int shift = 32 - frame->header.bits_per_sample ; + for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * frame->header.channels ; + + if (pflac->bufferpos >= frame->header.blocksize) + break ; + + for (j = 0 ; j < frame->header.channels ; j++) + retpcm [offset + j] = buffer [j][pflac->bufferpos] << shift ; + pflac->remain -= frame->header.channels ; + pflac->bufferpos++ ; + } ; + } ; + break ; + + case PFLAC_PCM_FLOAT : + { float *retpcm = ((float*) pflac->ptr) ; + float norm = (psf->norm_float == SF_TRUE) ? 1.0 / (1 << (frame->header.bits_per_sample - 1)) : 1.0 ; + + for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * frame->header.channels ; + + if (pflac->bufferpos >= frame->header.blocksize) + break ; + + for (j = 0 ; j < frame->header.channels ; j++) + retpcm [offset + j] = buffer [j][pflac->bufferpos] * norm ; + pflac->remain -= frame->header.channels ; + pflac->bufferpos++ ; + } ; + } ; + break ; + + case PFLAC_PCM_DOUBLE : + { double *retpcm = ((double*) pflac->ptr) ; + double norm = (psf->norm_double == SF_TRUE) ? 1.0 / (1 << (frame->header.bits_per_sample - 1)) : 1.0 ; + + for (i = 0 ; i < frame->header.blocksize && pflac->remain > 0 ; i++) + { offset = pflac->pos + i * frame->header.channels ; + + if (pflac->bufferpos >= frame->header.blocksize) + break ; + + for (j = 0 ; j < frame->header.channels ; j++) + retpcm [offset + j] = buffer [j][pflac->bufferpos] * norm ; + pflac->remain -= frame->header.channels ; + pflac->bufferpos++ ; + } ; + } ; + break ; + + default : + return 0 ; + } ; + + offset = i * frame->header.channels ; + pflac->pos += i * frame->header.channels ; + + return offset ; +} /* flac_buffer_copy */ + + +static FLAC__SeekableStreamDecoderReadStatus +sf_flac_read_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__byte buffer [], unsigned *bytes, void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + *bytes = psf_fread (buffer, 1, *bytes, psf) ; + if (*bytes > 0 && psf->error == 0) + return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK ; + + return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR ; +} /* sf_flac_read_callback */ + +static FLAC__SeekableStreamDecoderSeekStatus +sf_flac_seek_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__uint64 absolute_byte_offset, void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + psf_fseek (psf, absolute_byte_offset, SEEK_SET) ; + if (psf->error) + return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR ; + + return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK ; +} /* sf_flac_seek_callback */ + +static FLAC__SeekableStreamDecoderTellStatus +sf_flac_tell_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__uint64 *absolute_byte_offset, void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + *absolute_byte_offset = psf_ftell (psf) ; + if (psf->error) + return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR ; + + return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK ; +} /* sf_flac_tell_callback */ + +static FLAC__SeekableStreamDecoderLengthStatus +sf_flac_length_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__uint64 *stream_length, void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + if ((*stream_length = psf->filelength) == 0) + return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR ; + + return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK ; +} /* sf_flac_length_callback */ + +static FLAC__bool +sf_flac_eof_callback (const FLAC__SeekableStreamDecoder *UNUSED (decoder), void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + if (psf_ftell (psf) == psf->filelength) + return SF_TRUE ; + + return SF_FALSE ; +} /* sf_flac_eof_callback */ + +static FLAC__StreamDecoderWriteStatus +sf_flac_write_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), const FLAC__Frame *frame, const FLAC__int32 * const buffer [], void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + + pflac->frame = frame ; + pflac->bufferpos = 0 ; + + pflac->bufferbackup = SF_FALSE ; + pflac->wbuffer = buffer ; + + flac_buffer_copy (psf) ; + + return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE ; +} /* sf_flac_write_callback */ + +static void +sf_flac_meta_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), const FLAC__StreamMetadata *metadata, void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + switch (metadata->type) + { case FLAC__METADATA_TYPE_STREAMINFO : + psf->sf.channels = metadata->data.stream_info.channels ; + psf->sf.samplerate = metadata->data.stream_info.sample_rate ; + psf->sf.frames = metadata->data.stream_info.total_samples ; + + switch (metadata->data.stream_info.bits_per_sample) + { case 8 : + psf->sf.format |= SF_FORMAT_PCM_S8 ; + break ; + case 16 : + psf->sf.format |= SF_FORMAT_PCM_16 ; + break ; + case 24 : + psf->sf.format |= SF_FORMAT_PCM_24 ; + break ; + default : + psf_log_printf (psf, "sf_flac_meta_callback : bits_per_sample %d not yet implemented.\n", metadata->data.stream_info.bits_per_sample) ; + break ; + } ; + break ; + + default : + psf_log_printf (psf, "sf_flac_meta_callback : metadata-type %d not yet implemented.\n", metadata->type) ; + break ; + } ; + + return ; +} /* sf_flac_meta_callback */ + +static void +sf_flac_error_callback (const FLAC__SeekableStreamDecoder * UNUSED (decoder), FLAC__StreamDecoderErrorStatus status, void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + psf_log_printf (psf, "ERROR : %s\n", FLAC__StreamDecoderErrorStatusString [status]) ; + + switch (status) + { case FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC : + psf->error = SFE_FLAC_LOST_SYNC ; + break ; + case FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER : + psf->error = SFE_FLAC_BAD_HEADER ; + break ; + default : + psf->error = SFE_FLAC_UNKOWN_ERROR ; + break ; + } ; + + return ; +} /* sf_flac_error_callback */ + +static FLAC__SeekableStreamEncoderSeekStatus +sf_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder * UNUSED (encoder), FLAC__uint64 absolute_byte_offset, void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + psf_fseek (psf, absolute_byte_offset, SEEK_SET) ; + if (psf->error) + return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR ; + + return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK ; +} /* sf_flac_enc_seek_callback */ + +#ifdef HAVE_FLAC_1_1_1 +static FLAC__SeekableStreamEncoderTellStatus +sf_flac_enc_tell_callback (const FLAC__SeekableStreamEncoder *UNUSED (encoder), FLAC__uint64 *absolute_byte_offset, void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + *absolute_byte_offset = psf_ftell (psf) ; + if (psf->error) + return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_ERROR ; + + return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK ; +} /* sf_flac_enc_tell_callback */ +#endif + +static FLAC__StreamEncoderWriteStatus +sf_flac_enc_write_callback (const FLAC__SeekableStreamEncoder * UNUSED (encoder), const FLAC__byte buffer [], unsigned bytes, unsigned UNUSED (samples), unsigned UNUSED (current_frame), void *client_data) +{ SF_PRIVATE *psf = (SF_PRIVATE*) client_data ; + + if (psf_fwrite (buffer, 1, bytes, psf) == bytes && psf->error == 0) + return FLAC__STREAM_ENCODER_WRITE_STATUS_OK ; + + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR ; +} /* sf_flac_enc_write_callback */ + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +flac_open (SF_PRIVATE *psf) +{ int subformat ; + int error = 0 ; + + FLAC_PRIVATE* pflac = calloc (1, sizeof (FLAC_PRIVATE)) ; + psf->fdata = pflac ; + + if (psf->mode == SFM_RDWR) + return SFE_UNIMPLEMENTED ; + + if (psf->mode == SFM_READ) + { if ((error = flac_read_header (psf))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE) + { if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_FLAC) + return SFE_BAD_OPEN_FORMAT ; + + psf->endian = SF_ENDIAN_BIG ; + + if ((error = flac_enc_init (psf))) + return error ; + } ; + + psf->datalength = psf->filelength ; + psf->dataoffset = 0 ; + psf->blockwidth = 0 ; + psf->bytewidth = 1 ; + + psf->container_close = flac_close ; + psf->seek = flac_seek ; + psf->command = flac_command ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + switch (subformat) + { case SF_FORMAT_PCM_S8 : /* 8-bit FLAC. */ + case SF_FORMAT_PCM_16 : /* 16-bit FLAC. */ + case SF_FORMAT_PCM_24 : /* 24-bit FLAC. */ + error = flac_init (psf) ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + return error ; +} /* flac_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +flac_close (SF_PRIVATE *psf) +{ FLAC_PRIVATE* pflac ; + int k ; + + if ((pflac = (FLAC_PRIVATE*) psf->fdata) == NULL) + return 0 ; + + if (psf->mode == SFM_WRITE) + { FLAC__seekable_stream_encoder_finish (pflac->fse) ; + FLAC__seekable_stream_encoder_delete (pflac->fse) ; + if (pflac->encbuffer) + free (pflac->encbuffer) ; + } ; + + if (psf->mode == SFM_READ) + { FLAC__seekable_stream_decoder_finish (pflac->fsd) ; + FLAC__seekable_stream_decoder_delete (pflac->fsd) ; + } ; + + for (k = 0 ; k < ARRAY_LEN (pflac->rbuffer) ; k++) + free (pflac->rbuffer [k]) ; + + free (pflac) ; + psf->fdata = NULL ; + + return 0 ; +} /* flac_close */ + +static int +flac_enc_init (SF_PRIVATE *psf) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + unsigned bps ; + int k, found ; + + found = 0 ; + for (k = 0 ; k < ARRAY_LEN (legal_sample_rates) ; k++) + if (psf->sf.samplerate == legal_sample_rates [k]) + { found = 1 ; + break ; + } ; + + if (found == 0) + return SFE_FLAC_BAD_SAMPLE_RATE ; + + psf_fseek (psf, 0, SEEK_SET) ; + if ((pflac->fse = FLAC__seekable_stream_encoder_new ()) == NULL) + return SFE_FLAC_NEW_DECODER ; + FLAC__seekable_stream_encoder_set_write_callback (pflac->fse, sf_flac_enc_write_callback) ; + FLAC__seekable_stream_encoder_set_seek_callback (pflac->fse, sf_flac_enc_seek_callback) ; + +#ifdef HAVE_FLAC_1_1_1 + FLAC__seekable_stream_encoder_set_tell_callback (pflac->fse, sf_flac_enc_tell_callback) ; +#endif + FLAC__seekable_stream_encoder_set_client_data (pflac->fse, psf) ; + FLAC__seekable_stream_encoder_set_channels (pflac->fse, psf->sf.channels) ; + FLAC__seekable_stream_encoder_set_sample_rate (pflac->fse, psf->sf.samplerate) ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + bps = 8 ; + break ; + case SF_FORMAT_PCM_16 : + bps = 16 ; + break ; + case SF_FORMAT_PCM_24 : + bps = 24 ; + break ; + + default : + bps = 0 ; + break ; + } ; + + FLAC__seekable_stream_encoder_set_bits_per_sample (pflac->fse, bps) ; + + if ((bps = FLAC__seekable_stream_encoder_init (pflac->fse)) != FLAC__SEEKABLE_STREAM_DECODER_OK) + { psf_log_printf (psf, "Error : FLAC encoder init returned error : %s\n", FLAC__seekable_stream_encoder_get_resolved_state_string (pflac->fse)) ; + return SFE_FLAC_INIT_DECODER ; + } ; + + if (psf->error == 0) + psf->dataoffset = psf_ftell (psf) ; + pflac->encbuffer = calloc (ENC_BUFFER_SIZE, sizeof (FLAC__int32)) ; + + return psf->error ; +} /* flac_enc_init */ + +static int +flac_read_header (SF_PRIVATE *psf) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + + psf_fseek (psf, 0, SEEK_SET) ; + if ((pflac->fsd = FLAC__seekable_stream_decoder_new ()) == NULL) + return SFE_FLAC_NEW_DECODER ; + + FLAC__seekable_stream_decoder_set_read_callback (pflac->fsd, sf_flac_read_callback) ; + FLAC__seekable_stream_decoder_set_seek_callback (pflac->fsd, sf_flac_seek_callback) ; + FLAC__seekable_stream_decoder_set_tell_callback (pflac->fsd, sf_flac_tell_callback) ; + FLAC__seekable_stream_decoder_set_length_callback (pflac->fsd, sf_flac_length_callback) ; + FLAC__seekable_stream_decoder_set_eof_callback (pflac->fsd, sf_flac_eof_callback) ; + FLAC__seekable_stream_decoder_set_write_callback (pflac->fsd, sf_flac_write_callback) ; + FLAC__seekable_stream_decoder_set_metadata_callback (pflac->fsd, sf_flac_meta_callback) ; + FLAC__seekable_stream_decoder_set_error_callback (pflac->fsd, sf_flac_error_callback) ; + FLAC__seekable_stream_decoder_set_client_data (pflac->fsd, psf) ; + + if (FLAC__seekable_stream_decoder_init (pflac->fsd) != FLAC__SEEKABLE_STREAM_DECODER_OK) + return SFE_FLAC_INIT_DECODER ; + + FLAC__seekable_stream_decoder_process_until_end_of_metadata (pflac->fsd) ; + if (psf->error == 0) + { FLAC__uint64 position ; + FLAC__seekable_stream_decoder_get_decode_position (pflac->fsd, &position) ; + psf->dataoffset = position ; + } ; + + return psf->error ; +} /* flac_read_header */ + +static int +flac_command (SF_PRIVATE *psf, int command, void *data, int datasize) +{ + /* Avoid compiler warnings. */ + psf = psf ; + data = data ; + datasize = datasize ; + + switch (command) + { default : break ; + } ; + + return 0 ; +} /* flac_command */ + +int +flac_init (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_RDWR) + return SFE_BAD_MODE_RW ; + + if (psf->mode == SFM_READ) + { psf->read_short = flac_read_flac2s ; + psf->read_int = flac_read_flac2i ; + psf->read_float = flac_read_flac2f ; + psf->read_double = flac_read_flac2d ; + } ; + + if (psf->mode == SFM_WRITE) + { psf->write_short = flac_write_s2flac ; + psf->write_int = flac_write_i2flac ; + psf->write_float = flac_write_f2flac ; + psf->write_double = flac_write_d2flac ; + } ; + + psf->bytewidth = 1 ; + psf->blockwidth = psf->sf.channels ; + + if (psf->filelength > psf->dataoffset) + psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : psf->filelength - psf->dataoffset ; + else + psf->datalength = 0 ; + + return 0 ; +} /* flac_init */ + +static unsigned +flac_read_loop (SF_PRIVATE *psf, unsigned len) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + + pflac->pos = 0 ; + pflac->len = len ; + pflac->remain = len ; + if (pflac->frame != NULL && pflac->bufferpos < pflac->frame->header.blocksize) + flac_buffer_copy (psf) ; + + while (pflac->pos < pflac->len) + { if (FLAC__seekable_stream_decoder_process_single (pflac->fsd) == 0) + break ; + if (FLAC__seekable_stream_decoder_get_state (pflac->fsd) != FLAC__SEEKABLE_STREAM_DECODER_OK) + break ; + } ; + + pflac->ptr = NULL ; + + return pflac->pos ; +} /* flac_read_loop */ + +static sf_count_t +flac_read_flac2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + sf_count_t total = 0, current ; + unsigned readlen ; + + pflac->pcmtype = PFLAC_PCM_SHORT ; + + while (total < len) + { pflac->ptr = ptr + total ; + readlen = (len - total > 0x1000000) ? 0x1000000 : (unsigned) (len - total) ; + current = flac_read_loop (psf, readlen) ; + if (current == 0) + break ; + total += current ; + } ; + + return total ; +} /* flac_read_flac2s */ + +static sf_count_t +flac_read_flac2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + sf_count_t total = 0, current ; + unsigned readlen ; + + pflac->pcmtype = PFLAC_PCM_INT ; + + while (total < len) + { pflac->ptr = ptr + total ; + readlen = (len - total > 0x1000000) ? 0x1000000 : (unsigned) (len - total) ; + current = flac_read_loop (psf, readlen) ; + if (current == 0) + break ; + total += current ; + } ; + + return total ; +} /* flac_read_flac2i */ + +static sf_count_t +flac_read_flac2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + sf_count_t total = 0, current ; + unsigned readlen ; + + pflac->pcmtype = PFLAC_PCM_FLOAT ; + + while (total < len) + { pflac->ptr = ptr + total ; + readlen = (len - total > 0x1000000) ? 0x1000000 : (unsigned) (len - total) ; + current = flac_read_loop (psf, readlen) ; + if (current == 0) + break ; + total += current ; + } ; + + return total ; +} /* flac_read_flac2f */ + +static sf_count_t +flac_read_flac2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + sf_count_t total = 0, current ; + unsigned readlen ; + + pflac->pcmtype = PFLAC_PCM_DOUBLE ; + + while (total < len) + { pflac->ptr = ptr + total ; + readlen = (len - total > 0x1000000) ? 0x1000000 : (unsigned) (len - total) ; + current = flac_read_loop (psf, readlen) ; + if (current == 0) + break ; + total += current ; + } ; + + return total ; +} /* flac_read_flac2d */ + +static sf_count_t +flac_write_s2flac (SF_PRIVATE *psf, const short *ptr, sf_count_t len) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + void (*convert) (const short *, FLAC__int32 *, int) ; + int bufferlen, writecount, thiswrite ; + sf_count_t total = 0 ; + FLAC__int32* buffer = pflac->encbuffer ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + convert = s2flac8_array ; + break ; + case SF_FORMAT_PCM_16 : + convert = s2flac16_array ; + break ; + case SF_FORMAT_PCM_24 : + convert = s2flac24_array ; + break ; + default : + return -1 ; + } ; + + bufferlen = ENC_BUFFER_SIZE / (sizeof (FLAC__int32) * psf->sf.channels) ; + bufferlen *= psf->sf.channels ; + + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + convert (ptr + total, buffer, writecount) ; + if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) + thiswrite = writecount ; + else + break ; + total += thiswrite ; + if (thiswrite < writecount) + break ; + + len -= thiswrite ; + } ; + + return total ; +} /* flac_write_s2flac */ + +static sf_count_t +flac_write_i2flac (SF_PRIVATE *psf, const int *ptr, sf_count_t len) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + void (*convert) (const int *, FLAC__int32 *, int) ; + int bufferlen, writecount, thiswrite ; + sf_count_t total = 0 ; + FLAC__int32* buffer = pflac->encbuffer ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + convert = i2flac8_array ; + break ; + case SF_FORMAT_PCM_16 : + convert = i2flac16_array ; + break ; + case SF_FORMAT_PCM_24 : + convert = i2flac24_array ; + break ; + default : + return -1 ; + } ; + + bufferlen = ENC_BUFFER_SIZE / (sizeof (FLAC__int32) * psf->sf.channels) ; + bufferlen *= psf->sf.channels ; + + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + convert (ptr + total, buffer, writecount) ; + if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) + thiswrite = writecount ; + else + break ; + total += thiswrite ; + if (thiswrite < writecount) + break ; + + len -= thiswrite ; + } ; + + return total ; +} /* flac_write_i2flac */ + +static sf_count_t +flac_write_f2flac (SF_PRIVATE *psf, const float *ptr, sf_count_t len) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + void (*convert) (const float *, FLAC__int32 *, int, int) ; + int bufferlen, writecount, thiswrite ; + sf_count_t total = 0 ; + FLAC__int32* buffer = pflac->encbuffer ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + convert = (psf->add_clipping) ? f2flac8_clip_array : f2flac8_array ; + break ; + case SF_FORMAT_PCM_16 : + convert = (psf->add_clipping) ? f2flac16_clip_array : f2flac16_array ; + break ; + case SF_FORMAT_PCM_24 : + convert = (psf->add_clipping) ? f2flac24_clip_array : f2flac24_array ; + break ; + default : + return -1 ; + } ; + + bufferlen = ENC_BUFFER_SIZE / (sizeof (FLAC__int32) * psf->sf.channels) ; + bufferlen *= psf->sf.channels ; + + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + convert (ptr + total, buffer, writecount, psf->norm_float) ; + if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) + thiswrite = writecount ; + else + break ; + total += thiswrite ; + if (thiswrite < writecount) + break ; + + len -= thiswrite ; + } ; + + return total ; +} /* flac_write_f2flac */ + +static void +f2flac8_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) +{ float normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10) : 1.0 ; + + while (--count >= 0) + { scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7F)) + { dest [count] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10)) + { dest [count] = 0x80 ; + continue ; + } ; + dest [count] = lrintf (scaled_value) ; + } ; + + return ; +} /* f2flac8_clip_array */ + +static void +f2flac16_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) +{ + float normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x1000) : 1.0 ; + + while (--count >= 0) { + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFF)) { + dest [count] = 0x7FFF ; + continue ; + } + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x1000)) { + dest [count] = 0x8000 ; + continue ; + } + dest [count] = lrintf (scaled_value) ; + } +} /* f2flac16_clip_array */ + +static void +f2flac24_clip_array (const float *src, FLAC__int32 *dest, int count, int normalize) +{ float normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x100000) : 1.0 ; + + while (--count >= 0) + { scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFF)) + { dest [count] = 0x7FFFFF ; + continue ; + } ; + + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x100000)) + { dest [count] = 0x800000 ; + continue ; + } + dest [count] = lrintf (scaled_value) ; + } ; + + return ; +} /* f2flac24_clip_array */ + +static void +f2flac8_array (const float *src, FLAC__int32 *dest, int count, int normalize) +{ float normfact = normalize ? (1.0 * 0x7F) : 1.0 ; + + while (--count >= 0) + dest [count] = lrintf (src [count] * normfact) ; +} /* f2flac8_array */ + +static void +f2flac16_array (const float *src, FLAC__int32 *dest, int count, int normalize) +{ float normfact = normalize ? (1.0 * 0x7FFF) : 1.0 ; + + while (--count >= 0) + dest [count] = lrintf (src [count] * normfact) ; +} /* f2flac16_array */ + +static void +f2flac24_array (const float *src, FLAC__int32 *dest, int count, int normalize) +{ float normfact = normalize ? (1.0 * 0x7FFFFF) : 1.0 ; + + while (--count >= 0) + dest [count] = lrintf (src [count] * normfact) ; +} /* f2flac24_array */ + +static sf_count_t +flac_write_d2flac (SF_PRIVATE *psf, const double *ptr, sf_count_t len) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + void (*convert) (const double *, FLAC__int32 *, int, int) ; + int bufferlen, writecount, thiswrite ; + sf_count_t total = 0 ; + FLAC__int32* buffer = pflac->encbuffer ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + convert = (psf->add_clipping) ? d2flac8_clip_array : d2flac8_array ; + break ; + case SF_FORMAT_PCM_16 : + convert = (psf->add_clipping) ? d2flac16_clip_array : d2flac16_array ; + break ; + case SF_FORMAT_PCM_24 : + convert = (psf->add_clipping) ? d2flac24_clip_array : d2flac24_array ; + break ; + default : + return -1 ; + } ; + + bufferlen = ENC_BUFFER_SIZE / (sizeof (FLAC__int32) * psf->sf.channels) ; + bufferlen *= psf->sf.channels ; + + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + convert (ptr + total, buffer, writecount, psf->norm_double) ; + if (FLAC__seekable_stream_encoder_process_interleaved (pflac->fse, buffer, writecount/psf->sf.channels)) + thiswrite = writecount ; + else + break ; + total += thiswrite ; + if (thiswrite < writecount) + break ; + + len -= thiswrite ; + } ; + + return total ; +} /* flac_write_d2flac */ + +static void +d2flac8_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) +{ double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10) : 1.0 ; + + while (--count >= 0) + { scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7F)) + { dest [count] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10)) + { dest [count] = 0x80 ; + continue ; + } ; + dest [count] = lrint (scaled_value) ; + } ; + + return ; +} /* d2flac8_clip_array */ + +static void +d2flac16_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) +{ double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x1000) : 1.0 ; + + while (--count >= 0) + { scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFF)) + { dest [count] = 0x7FFF ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x1000)) + { dest [count] = 0x8000 ; + continue ; + } ; + dest [count] = lrint (scaled_value) ; + } ; + + return ; +} /* d2flac16_clip_array */ + +static void +d2flac24_clip_array (const double *src, FLAC__int32 *dest, int count, int normalize) +{ double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x100000) : 1.0 ; + + while (--count >= 0) + { scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFF)) + { dest [count] = 0x7FFFFF ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x100000)) + { dest [count] = 0x800000 ; + continue ; + } ; + dest [count] = lrint (scaled_value) ; + } ; + + return ; +} /* d2flac24_clip_array */ + +static void +d2flac8_array (const double *src, FLAC__int32 *dest, int count, int normalize) +{ double normfact = normalize ? (1.0 * 0x7F) : 1.0 ; + + while (--count >= 0) + dest [count] = lrint (src [count] * normfact) ; +} /* d2flac8_array */ + +static void +d2flac16_array (const double *src, FLAC__int32 *dest, int count, int normalize) +{ double normfact = normalize ? (1.0 * 0x7FFF) : 1.0 ; + + while (--count >= 0) + dest [count] = lrint (src [count] * normfact) ; +} /* d2flac16_array */ + +static void +d2flac24_array (const double *src, FLAC__int32 *dest, int count, int normalize) +{ double normfact = normalize ? (1.0 * 0x7FFFFF) : 1.0 ; + + while (--count >= 0) + dest [count] = lrint (src [count] * normfact) ; +} /* d2flac24_array */ + +static sf_count_t +flac_seek (SF_PRIVATE *psf, int UNUSED (mode), sf_count_t offset) +{ FLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->fdata ; + + if (pflac == NULL) + return 0 ; + + if (psf->dataoffset < 0) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + pflac->frame = NULL ; + + if (psf->mode == SFM_READ) + { FLAC__uint64 position ; + if (FLAC__seekable_stream_decoder_seek_absolute (pflac->fsd, offset)) + { FLAC__seekable_stream_decoder_get_decode_position (pflac->fsd, &position) ; + return offset ; + } ; + + return ((sf_count_t) -1) ; + } ; + + /* Seeking in write mode not yet supported. */ + psf->error = SFE_BAD_SEEK ; + + return ((sf_count_t) -1) ; +} /* flac_seek */ + +#endif + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 46d49617-ebff-42b4-8f66-a0e428147360 +*/ diff --git a/Libraries/SndFile/Files/src/g72x.c b/Libraries/SndFile/Files/src/g72x.c new file mode 100644 index 000000000..dbbf9dae5 --- /dev/null +++ b/Libraries/SndFile/Files/src/g72x.c @@ -0,0 +1,615 @@ +/* +** Copyright (C) 1999-2005 Erik de Castro Lopo +** +** 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. +*/ + +#include "sfconfig.h" + +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" +#include "G72x/g72x.h" + +/* This struct is private to the G72x code. */ +struct g72x_state ; +typedef struct g72x_state G72x_STATE ; + +typedef struct +{ /* Private data. Don't mess with it. */ + struct g72x_state * private ; + + /* Public data. Read only. */ + int blocksize, samplesperblock, bytesperblock ; + + /* Public data. Read and write. */ + int blocks_total, block_curr, sample_curr ; + unsigned char block [G72x_BLOCK_SIZE] ; + short samples [G72x_BLOCK_SIZE] ; +} G72x_PRIVATE ; + +static int psf_g72x_decode_block (SF_PRIVATE *psf, G72x_PRIVATE *pg72x) ; +static int psf_g72x_encode_block (SF_PRIVATE *psf, G72x_PRIVATE *pg72x) ; + +static sf_count_t g72x_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t g72x_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t g72x_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t g72x_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t g72x_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ; +static sf_count_t g72x_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ; +static sf_count_t g72x_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ; +static sf_count_t g72x_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ; + +static sf_count_t g72x_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; + +static int g72x_close (SF_PRIVATE *psf) ; + + +/*============================================================================================ +** WAV G721 Reader initialisation function. +*/ + +int +g72x_init (SF_PRIVATE * psf) +{ G72x_PRIVATE *pg72x ; + int bitspersample, bytesperblock, codec ; + + if (psf->fdata != NULL) + { psf_log_printf (psf, "*** psf->fdata is not NULL.\n") ; + return SFE_INTERNAL ; + } ; + + psf->sf.seekable = SF_FALSE ; + + if (psf->sf.channels != 1) + return SFE_G72X_NOT_MONO ; + + if ((pg72x = calloc (1, sizeof (G72x_PRIVATE))) == NULL) + return SFE_MALLOC_FAILED ; + + psf->fdata = (void*) pg72x ; + + pg72x->block_curr = 0 ; + pg72x->sample_curr = 0 ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_G721_32 : + codec = G721_32_BITS_PER_SAMPLE ; + bytesperblock = G721_32_BYTES_PER_BLOCK ; + bitspersample = G721_32_BITS_PER_SAMPLE ; + break ; + + case SF_FORMAT_G723_24: + codec = G723_24_BITS_PER_SAMPLE ; + bytesperblock = G723_24_BYTES_PER_BLOCK ; + bitspersample = G723_24_BITS_PER_SAMPLE ; + break ; + + case SF_FORMAT_G723_40: + codec = G723_40_BITS_PER_SAMPLE ; + bytesperblock = G723_40_BYTES_PER_BLOCK ; + bitspersample = G723_40_BITS_PER_SAMPLE ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + psf->blockwidth = psf->bytewidth = 1 ; + + psf->filelength = psf_get_filelen (psf) ; + if (psf->filelength < psf->dataoffset) + psf->filelength = psf->dataoffset ; + + psf->datalength = psf->filelength - psf->dataoffset ; + if (psf->dataend > 0) + psf->datalength -= psf->filelength - psf->dataend ; + + if (psf->mode == SFM_READ) + { pg72x->private = g72x_reader_init (codec, &(pg72x->blocksize), &(pg72x->samplesperblock)) ; + if (pg72x->private == NULL) + return SFE_MALLOC_FAILED ; + + pg72x->bytesperblock = bytesperblock ; + + psf->read_short = g72x_read_s ; + psf->read_int = g72x_read_i ; + psf->read_float = g72x_read_f ; + psf->read_double = g72x_read_d ; + + psf->seek = g72x_seek ; + + if (psf->datalength % pg72x->blocksize) + { psf_log_printf (psf, "*** Odd psf->datalength (%D) should be a multiple of %d\n", psf->datalength, pg72x->blocksize) ; + pg72x->blocks_total = (psf->datalength / pg72x->blocksize) + 1 ; + } + else + pg72x->blocks_total = psf->datalength / pg72x->blocksize ; + + psf->sf.frames = pg72x->blocks_total * pg72x->samplesperblock ; + + psf_g72x_decode_block (psf, pg72x) ; + } + else if (psf->mode == SFM_WRITE) + { pg72x->private = g72x_writer_init (codec, &(pg72x->blocksize), &(pg72x->samplesperblock)) ; + if (pg72x->private == NULL) + return SFE_MALLOC_FAILED ; + + pg72x->bytesperblock = bytesperblock ; + + psf->write_short = g72x_write_s ; + psf->write_int = g72x_write_i ; + psf->write_float = g72x_write_f ; + psf->write_double = g72x_write_d ; + + if (psf->datalength % pg72x->blocksize) + pg72x->blocks_total = (psf->datalength / pg72x->blocksize) + 1 ; + else + pg72x->blocks_total = psf->datalength / pg72x->blocksize ; + + if (psf->datalength > 0) + psf->sf.frames = (8 * psf->datalength) / bitspersample ; + + if ((psf->sf.frames * bitspersample) / 8 != psf->datalength) + psf_log_printf (psf, "*** Warning : weird psf->datalength.\n") ; + } ; + + psf->codec_close = g72x_close ; + + return 0 ; +} /* g72x_init */ + +/*============================================================================================ +** G721 Read Functions. +*/ + +static int +psf_g72x_decode_block (SF_PRIVATE *psf, G72x_PRIVATE *pg72x) +{ int k ; + + pg72x->block_curr ++ ; + pg72x->sample_curr = 0 ; + + if (pg72x->block_curr > pg72x->blocks_total) + { memset (pg72x->samples, 0, G72x_BLOCK_SIZE * sizeof (short)) ; + return 1 ; + } ; + + if ((k = psf_fread (pg72x->block, 1, pg72x->bytesperblock, psf)) != pg72x->bytesperblock) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pg72x->bytesperblock) ; + + pg72x->blocksize = k ; + g72x_decode_block (pg72x->private, pg72x->block, pg72x->samples) ; + + return 1 ; +} /* psf_g72x_decode_block */ + +static int +g72x_read_block (SF_PRIVATE *psf, G72x_PRIVATE *pg72x, short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { if (pg72x->block_curr > pg72x->blocks_total) + { memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ; + return total ; + } ; + + if (pg72x->sample_curr >= pg72x->samplesperblock) + psf_g72x_decode_block (psf, pg72x) ; + + count = pg72x->samplesperblock - pg72x->sample_curr ; + count = (len - indx > count) ? count : len - indx ; + + memcpy (&(ptr [indx]), &(pg72x->samples [pg72x->sample_curr]), count * sizeof (short)) ; + indx += count ; + pg72x->sample_curr += count ; + total = indx ; + } ; + + return total ; +} /* g72x_read_block */ + +static sf_count_t +g72x_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ G72x_PRIVATE *pg72x ; + int readcount, count ; + sf_count_t total = 0 ; + + if (psf->fdata == NULL) + return 0 ; + pg72x = (G72x_PRIVATE*) psf->fdata ; + + while (len > 0) + { readcount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = g72x_read_block (psf, pg72x, ptr, readcount) ; + + total += count ; + len -= count ; + + if (count != readcount) + break ; + } ; + + return total ; +} /* g72x_read_s */ + +static sf_count_t +g72x_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ G72x_PRIVATE *pg72x ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + + if (psf->fdata == NULL) + return 0 ; + pg72x = (G72x_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = SF_BUFFER_LEN / sizeof (short) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = g72x_read_block (psf, pg72x, sptr, readcount) ; + + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = sptr [k] << 16 ; + + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* g72x_read_i */ + +static sf_count_t +g72x_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ G72x_PRIVATE *pg72x ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (psf->fdata == NULL) + return 0 ; + pg72x = (G72x_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = SF_BUFFER_LEN / sizeof (short) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = g72x_read_block (psf, pg72x, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * sptr [k] ; + + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* g72x_read_f */ + +static sf_count_t +g72x_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ G72x_PRIVATE *pg72x ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + if (psf->fdata == NULL) + return 0 ; + pg72x = (G72x_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = SF_BUFFER_LEN / sizeof (short) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = g72x_read_block (psf, pg72x, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (double) (sptr [k]) ; + + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* g72x_read_d */ + +static sf_count_t +g72x_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) +{ + /* Prevent compiler warnings. */ + mode ++ ; + offset ++ ; + + psf_log_printf (psf, "seek unsupported\n") ; + + /* No simple solution. To do properly, would need to seek + ** to start of file and decode everything up to seek position. + ** Maybe implement SEEK_SET to 0 only? + */ + return 0 ; + +/* +** G72x_PRIVATE *pg72x ; +** int newblock, newsample, sample_curr ; +** +** if (psf->fdata == NULL) +** return 0 ; +** pg72x = (G72x_PRIVATE*) psf->fdata ; +** +** if (! (psf->datalength && psf->dataoffset)) +** { psf->error = SFE_BAD_SEEK ; +** return PSF_SEEK_ERROR ; +** } ; +** +** sample_curr = (8 * psf->datalength) / G721_32_BITS_PER_SAMPLE ; +** +** switch (whence) +** { case SEEK_SET : +** if (offset < 0 || offset > sample_curr) +** { psf->error = SFE_BAD_SEEK ; +** return PSF_SEEK_ERROR ; +** } ; +** newblock = offset / pg72x->samplesperblock ; +** newsample = offset % pg72x->samplesperblock ; +** break ; +** +** case SEEK_CUR : +** if (psf->current + offset < 0 || psf->current + offset > sample_curr) +** { psf->error = SFE_BAD_SEEK ; +** return PSF_SEEK_ERROR ; +** } ; +** newblock = (8 * (psf->current + offset)) / pg72x->samplesperblock ; +** newsample = (8 * (psf->current + offset)) % pg72x->samplesperblock ; +** break ; +** +** case SEEK_END : +** if (offset > 0 || sample_curr + offset < 0) +** { psf->error = SFE_BAD_SEEK ; +** return PSF_SEEK_ERROR ; +** } ; +** newblock = (sample_curr + offset) / pg72x->samplesperblock ; +** newsample = (sample_curr + offset) % pg72x->samplesperblock ; +** break ; +** +** default : +** psf->error = SFE_BAD_SEEK ; +** return PSF_SEEK_ERROR ; +** } ; +** +** if (psf->mode == SFM_READ) +** { psf_fseek (psf, psf->dataoffset + newblock * pg72x->blocksize, SEEK_SET) ; +** pg72x->block_curr = newblock ; +** psf_g72x_decode_block (psf, pg72x) ; +** pg72x->sample_curr = newsample ; +** } +** else +** { /+* What to do about write??? *+/ +** psf->error = SFE_BAD_SEEK ; +** return PSF_SEEK_ERROR ; +** } ; +** +** psf->current = newblock * pg72x->samplesperblock + newsample ; +** return psf->current ; +** +*/ +} /* g72x_seek */ + +/*========================================================================================== +** G72x Write Functions. +*/ + +static int +psf_g72x_encode_block (SF_PRIVATE *psf, G72x_PRIVATE *pg72x) +{ int k ; + + /* Encode the samples. */ + g72x_encode_block (pg72x->private, pg72x->samples, pg72x->block) ; + + /* Write the block to disk. */ + if ((k = psf_fwrite (pg72x->block, 1, pg72x->blocksize, psf)) != pg72x->blocksize) + psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pg72x->blocksize) ; + + pg72x->sample_curr = 0 ; + pg72x->block_curr ++ ; + + /* Set samples to zero for next block. */ + memset (pg72x->samples, 0, G72x_BLOCK_SIZE * sizeof (short)) ; + + return 1 ; +} /* psf_g72x_encode_block */ + +static int +g72x_write_block (SF_PRIVATE *psf, G72x_PRIVATE *pg72x, const short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { count = pg72x->samplesperblock - pg72x->sample_curr ; + + if (count > len - indx) + count = len - indx ; + + memcpy (&(pg72x->samples [pg72x->sample_curr]), &(ptr [indx]), count * sizeof (short)) ; + indx += count ; + pg72x->sample_curr += count ; + total = indx ; + + if (pg72x->sample_curr >= pg72x->samplesperblock) + psf_g72x_encode_block (psf, pg72x) ; + } ; + + return total ; +} /* g72x_write_block */ + +static sf_count_t +g72x_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) +{ G72x_PRIVATE *pg72x ; + int writecount, count ; + sf_count_t total = 0 ; + + if (psf->fdata == NULL) + return 0 ; + pg72x = (G72x_PRIVATE*) psf->fdata ; + + while (len > 0) + { writecount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = g72x_write_block (psf, pg72x, ptr, writecount) ; + + total += count ; + len -= count ; + if (count != writecount) + break ; + } ; + + return total ; +} /* g72x_write_s */ + +static sf_count_t +g72x_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) +{ G72x_PRIVATE *pg72x ; + short *sptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + + if (psf->fdata == NULL) + return 0 ; + pg72x = (G72x_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = ptr [total + k] >> 16 ; + count = g72x_write_block (psf, pg72x, sptr, writecount) ; + + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + return total ; +} /* g72x_write_i */ + +static sf_count_t +g72x_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) +{ G72x_PRIVATE *pg72x ; + short *sptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (psf->fdata == NULL) + return 0 ; + pg72x = (G72x_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrintf (normfact * ptr [total + k]) ; + count = g72x_write_block (psf, pg72x, sptr, writecount) ; + + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* g72x_write_f */ + +static sf_count_t +g72x_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) +{ G72x_PRIVATE *pg72x ; + short *sptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + if (psf->fdata == NULL) + return 0 ; + pg72x = (G72x_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrint (normfact * ptr [total + k]) ; + count = g72x_write_block (psf, pg72x, sptr, writecount) ; + + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* g72x_write_d */ + +static int +g72x_close (SF_PRIVATE *psf) +{ G72x_PRIVATE *pg72x ; + + pg72x = (G72x_PRIVATE*) psf->fdata ; + + if (psf->mode == SFM_WRITE) + { /* If a block has been partially assembled, write it out + ** as the final block. + */ + + if (pg72x->sample_curr && pg72x->sample_curr < G72x_BLOCK_SIZE) + psf_g72x_encode_block (psf, pg72x) ; + + if (psf->write_header) + psf->write_header (psf, SF_FALSE) ; + } ; + + /* Only free the pointer allocated by g72x_(reader|writer)_init. */ + free (pg72x->private) ; + + return 0 ; +} /* g72x_close */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 3cc5439e-7247-486b-b2e6-11a4affa5744 +*/ diff --git a/Libraries/SndFile/Files/src/sndfile.h.in b/Libraries/SndFile/Files/src/sndfile.h.in new file mode 100644 index 000000000..9e098df41 --- /dev/null +++ b/Libraries/SndFile/Files/src/sndfile.h.in @@ -0,0 +1,530 @@ +/* +** Copyright (C) 1999-2006 Erik de Castro Lopo +** +** 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 + +/* For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS) */ + +#if (defined (__MWERKS__)) +#include +#else +#include +#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 default). */ + 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 @TYPEOF_SF_COUNT_T@ sf_count_t ; + +#define SF_COUNT_MAX @SF_COUNT_MAX@ + +/* 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 */ diff --git a/Libraries/SndFile/Files/src/stamp-h1 b/Libraries/SndFile/Files/src/stamp-h1 new file mode 100644 index 000000000..57ea58e40 --- /dev/null +++ b/Libraries/SndFile/Files/src/stamp-h1 @@ -0,0 +1 @@ +timestamp for src/config.h