summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorLorry <lorry@roadtrain.codethink.co.uk>2012-07-18 20:35:05 +0100
committerLorry <lorry@roadtrain.codethink.co.uk>2012-07-18 20:35:05 +0100
commitaceb1f30497619786f1827e4c65992b890a07410 (patch)
treece33ac9d0d076a8ec4f993e614cf71a4d5daa7e7 /examples
downloadlibsndfile-aceb1f30497619786f1827e4c65992b890a07410.tar.gz
Tarball conversion
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am24
-rw-r--r--examples/Makefile.in651
-rw-r--r--examples/generate.c131
-rw-r--r--examples/list_formats.c83
-rw-r--r--examples/make_sine.c96
-rw-r--r--examples/sfprocess.c137
-rw-r--r--examples/sndfile-to-text.c126
-rw-r--r--examples/sndfilehandle.cc84
8 files changed, 1332 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..9797a72
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,24 @@
+## Process this file with automake to produce Makefile.in
+
+noinst_PROGRAMS = make_sine sfprocess list_formats generate sndfilehandle sndfile-to-text
+
+INCLUDES = -I$(top_srcdir)/src
+
+sndfile_to_text_SOURCES = sndfile-to-text.c
+sndfile_to_text_LDADD = $(top_builddir)/src/libsndfile.la
+
+make_sine_SOURCES = make_sine.c
+make_sine_LDADD = $(top_builddir)/src/libsndfile.la
+
+sfprocess_SOURCES = sfprocess.c
+sfprocess_LDADD = $(top_builddir)/src/libsndfile.la
+
+list_formats_SOURCES = list_formats.c
+list_formats_LDADD = $(top_builddir)/src/libsndfile.la
+
+generate_SOURCES = generate.c
+generate_LDADD = $(top_builddir)/src/libsndfile.la
+
+sndfilehandle_SOURCES = sndfilehandle.cc
+sndfilehandle_LDADD = $(top_builddir)/src/libsndfile.la
+
diff --git a/examples/Makefile.in b/examples/Makefile.in
new file mode 100644
index 0000000..2f867c6
--- /dev/null
+++ b/examples/Makefile.in
@@ -0,0 +1,651 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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 = make_sine$(EXEEXT) sfprocess$(EXEEXT) \
+ list_formats$(EXEEXT) generate$(EXEEXT) sndfilehandle$(EXEEXT) \
+ sndfile-to-text$(EXEEXT)
+subdir = examples
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/M4/add_cflags.m4 \
+ $(top_srcdir)/M4/add_cxxflags.m4 $(top_srcdir)/M4/clip_mode.m4 \
+ $(top_srcdir)/M4/endian.m4 $(top_srcdir)/M4/extra_largefile.m4 \
+ $(top_srcdir)/M4/extra_pkg.m4 \
+ $(top_srcdir)/M4/flexible_array.m4 \
+ $(top_srcdir)/M4/gcc_version.m4 $(top_srcdir)/M4/libtool.m4 \
+ $(top_srcdir)/M4/lrint.m4 $(top_srcdir)/M4/lrintf.m4 \
+ $(top_srcdir)/M4/ltoptions.m4 $(top_srcdir)/M4/ltsugar.m4 \
+ $(top_srcdir)/M4/ltversion.m4 $(top_srcdir)/M4/lt~obsolete.m4 \
+ $(top_srcdir)/M4/mkoctfile_version.m4 \
+ $(top_srcdir)/M4/octave.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_generate_OBJECTS = generate.$(OBJEXT)
+generate_OBJECTS = $(am_generate_OBJECTS)
+generate_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+am_list_formats_OBJECTS = list_formats.$(OBJEXT)
+list_formats_OBJECTS = $(am_list_formats_OBJECTS)
+list_formats_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
+am_make_sine_OBJECTS = make_sine.$(OBJEXT)
+make_sine_OBJECTS = $(am_make_sine_OBJECTS)
+make_sine_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
+am_sfprocess_OBJECTS = sfprocess.$(OBJEXT)
+sfprocess_OBJECTS = $(am_sfprocess_OBJECTS)
+sfprocess_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
+am_sndfile_to_text_OBJECTS = sndfile-to-text.$(OBJEXT)
+sndfile_to_text_OBJECTS = $(am_sndfile_to_text_OBJECTS)
+sndfile_to_text_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
+am_sndfilehandle_OBJECTS = sndfilehandle.$(OBJEXT)
+sndfilehandle_OBJECTS = $(am_sndfilehandle_OBJECTS)
+sndfilehandle_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/Cfg/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_$(V))
+am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+am__v_CXX_0 = @echo " CXX " $@;
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_$(V))
+am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(generate_SOURCES) $(list_formats_SOURCES) \
+ $(make_sine_SOURCES) $(sfprocess_SOURCES) \
+ $(sndfile_to_text_SOURCES) $(sndfilehandle_SOURCES)
+DIST_SOURCES = $(generate_SOURCES) $(list_formats_SOURCES) \
+ $(make_sine_SOURCES) $(sfprocess_SOURCES) \
+ $(sndfile_to_text_SOURCES) $(sndfilehandle_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
+ALSA_LIBS = @ALSA_LIBS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLEAN_VERSION = @CLEAN_VERSION@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXTERNAL_CFLAGS = @EXTERNAL_CFLAGS@
+EXTERNAL_LIBS = @EXTERNAL_LIBS@
+FGREP = @FGREP@
+FLAC_CFLAGS = @FLAC_CFLAGS@
+FLAC_LIBS = @FLAC_LIBS@
+GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
+GCC_MINOR_VERSION = @GCC_MINOR_VERSION@
+GCC_VERSION = @GCC_VERSION@
+GETCONF = @GETCONF@
+GREP = @GREP@
+HAVE_AUTOGEN = @HAVE_AUTOGEN@
+HAVE_MKOCTFILE = @HAVE_MKOCTFILE@
+HAVE_OCTAVE = @HAVE_OCTAVE@
+HAVE_OCTAVE_CONFIG = @HAVE_OCTAVE_CONFIG@
+HAVE_WINE = @HAVE_WINE@
+HOST_TRIPLET = @HOST_TRIPLET@
+HTML_BGCOLOUR = @HTML_BGCOLOUR@
+HTML_FGCOLOUR = @HTML_FGCOLOUR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MKOCTFILE = @MKOCTFILE@
+MKOCTFILE_VERSION = @MKOCTFILE_VERSION@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OCTAVE = @OCTAVE@
+OCTAVE_CONFIG = @OCTAVE_CONFIG@
+OCTAVE_CONFIG_VERSION = @OCTAVE_CONFIG_VERSION@
+OCTAVE_DEST_MDIR = @OCTAVE_DEST_MDIR@
+OCTAVE_DEST_ODIR = @OCTAVE_DEST_ODIR@
+OCTAVE_VERSION = @OCTAVE_VERSION@
+OGG_CFLAGS = @OGG_CFLAGS@
+OGG_LIBS = @OGG_LIBS@
+OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
+OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RANLIB = @RANLIB@
+RC = @RC@
+SED = @SED@
+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@
+SNDIO_LIBS = @SNDIO_LIBS@
+SPEEX_CFLAGS = @SPEEX_CFLAGS@
+SPEEX_LIBS = @SPEEX_LIBS@
+SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
+SQLITE3_LIBS = @SQLITE3_LIBS@
+STRIP = @STRIP@
+TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
+VERSION = @VERSION@
+VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
+VORBISENC_LIBS = @VORBISENC_LIBS@
+VORBIS_CFLAGS = @VORBIS_CFLAGS@
+VORBIS_LIBS = @VORBIS_LIBS@
+WIN_RC_VERSION = @WIN_RC_VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+htmldocdir = @htmldocdir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = -I$(top_srcdir)/src
+sndfile_to_text_SOURCES = sndfile-to-text.c
+sndfile_to_text_LDADD = $(top_builddir)/src/libsndfile.la
+make_sine_SOURCES = make_sine.c
+make_sine_LDADD = $(top_builddir)/src/libsndfile.la
+sfprocess_SOURCES = sfprocess.c
+sfprocess_LDADD = $(top_builddir)/src/libsndfile.la
+list_formats_SOURCES = list_formats.c
+list_formats_LDADD = $(top_builddir)/src/libsndfile.la
+generate_SOURCES = generate.c
+generate_LDADD = $(top_builddir)/src/libsndfile.la
+sndfilehandle_SOURCES = sndfilehandle.cc
+sndfilehandle_LDADD = $(top_builddir)/src/libsndfile.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cc .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 ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu examples/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
+$(am__aclocal_m4_deps):
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+generate$(EXEEXT): $(generate_OBJECTS) $(generate_DEPENDENCIES)
+ @rm -f generate$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(generate_OBJECTS) $(generate_LDADD) $(LIBS)
+list_formats$(EXEEXT): $(list_formats_OBJECTS) $(list_formats_DEPENDENCIES)
+ @rm -f list_formats$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(list_formats_OBJECTS) $(list_formats_LDADD) $(LIBS)
+make_sine$(EXEEXT): $(make_sine_OBJECTS) $(make_sine_DEPENDENCIES)
+ @rm -f make_sine$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(make_sine_OBJECTS) $(make_sine_LDADD) $(LIBS)
+sfprocess$(EXEEXT): $(sfprocess_OBJECTS) $(sfprocess_DEPENDENCIES)
+ @rm -f sfprocess$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(sfprocess_OBJECTS) $(sfprocess_LDADD) $(LIBS)
+sndfile-to-text$(EXEEXT): $(sndfile_to_text_OBJECTS) $(sndfile_to_text_DEPENDENCIES)
+ @rm -f sndfile-to-text$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(sndfile_to_text_OBJECTS) $(sndfile_to_text_LDADD) $(LIBS)
+sndfilehandle$(EXEEXT): $(sndfilehandle_OBJECTS) $(sndfilehandle_DEPENDENCIES)
+ @rm -f sndfilehandle$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(sndfilehandle_OBJECTS) $(sndfilehandle_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list_formats.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/make_sine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfprocess.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-to-text.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfilehandle.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@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@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@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@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@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 $@ $<
+
+.cc.o:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__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)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+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)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+
+# 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/examples/generate.c b/examples/generate.c
new file mode 100644
index 0000000..8a92332
--- /dev/null
+++ b/examples/generate.c
@@ -0,0 +1,131 @@
+/*
+** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the author nor the names of any contributors may be used
+** to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "sfconfig.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <sndfile.h>
+
+#define BUFFER_LEN 4096
+
+static void encode_file (const char *infilename, const char *outfilename, int filetype) ;
+
+int
+main (int argc, char **argv)
+{
+ if (argc != 2)
+ { puts ("\nEncode a single input file into a number of different output ") ;
+ puts ("encodings. These output encodings can then be moved to another ") ;
+ puts ("OS for testing.\n") ;
+ puts (" Usage : generate <filename>\n") ;
+ exit (1) ;
+ } ;
+
+ /* A couple of standard WAV files. Make sure Win32 plays these. */
+ encode_file (argv [1], "pcmu8.wav" , SF_FORMAT_WAV | SF_FORMAT_PCM_U8) ;
+ encode_file (argv [1], "pcm16.wav" , SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
+ encode_file (argv [1], "imaadpcm.wav", SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM) ;
+ encode_file (argv [1], "msadpcm.wav", SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM) ;
+ encode_file (argv [1], "gsm610.wav" , SF_FORMAT_WAV | SF_FORMAT_GSM610) ;
+
+ /* Soundforge W64. */
+ encode_file (argv [1], "pcmu8.w64" , SF_FORMAT_W64 | SF_FORMAT_PCM_U8) ;
+ encode_file (argv [1], "pcm16.w64" , SF_FORMAT_W64 | SF_FORMAT_PCM_16) ;
+ encode_file (argv [1], "imaadpcm.w64", SF_FORMAT_W64 | SF_FORMAT_MS_ADPCM) ;
+ encode_file (argv [1], "msadpcm.w64", SF_FORMAT_W64 | SF_FORMAT_IMA_ADPCM) ;
+ encode_file (argv [1], "gsm610.w64" , SF_FORMAT_W64 | SF_FORMAT_GSM610) ;
+
+ return 0 ;
+} /* main */
+
+/*============================================================================================
+** Helper functions and macros.
+*/
+
+#define PUT_DOTS(k) \
+ { while (k--) \
+ putchar ('.') ; \
+ putchar (' ') ; \
+ }
+
+/*========================================================================================
+*/
+
+static void
+encode_file (const char *infilename, const char *outfilename, int filetype)
+{ static float buffer [BUFFER_LEN] ;
+
+ SNDFILE *infile, *outfile ;
+ SF_INFO sfinfo ;
+ int k, readcount ;
+
+ printf (" %s -> %s ", infilename, outfilename) ;
+ fflush (stdout) ;
+
+ k = 16 - strlen (outfilename) ;
+ PUT_DOTS (k) ;
+
+ if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
+ { printf ("Error : could not open file : %s\n", infilename) ;
+ puts (sf_strerror (NULL)) ;
+ exit (1) ;
+ }
+
+ sfinfo.format = filetype ;
+
+ if (! sf_format_check (&sfinfo))
+ { sf_close (infile) ;
+ printf ("Invalid encoding\n") ;
+ return ;
+ } ;
+
+ if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
+ { printf ("Error : could not open file : %s\n", outfilename) ;
+ puts (sf_strerror (NULL)) ;
+ exit (1) ;
+ } ;
+
+ while ((readcount = sf_read_float (infile, buffer, BUFFER_LEN)) > 0)
+ sf_write_float (outfile, buffer, readcount) ;
+
+ sf_close (infile) ;
+ sf_close (outfile) ;
+
+ printf ("ok\n") ;
+
+ return ;
+} /* encode_file */
+
diff --git a/examples/list_formats.c b/examples/list_formats.c
new file mode 100644
index 0000000..6d462f0
--- /dev/null
+++ b/examples/list_formats.c
@@ -0,0 +1,83 @@
+/*
+** Copyright (C) 2001-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the author nor the names of any contributors may be used
+** to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <sndfile.h>
+
+int
+main (void)
+{ SF_FORMAT_INFO info ;
+ SF_INFO sfinfo ;
+ char buffer [128] ;
+ int format, major_count, subtype_count, m, s ;
+
+ memset (&sfinfo, 0, sizeof (sfinfo)) ;
+ buffer [0] = 0 ;
+ sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
+ if (strlen (buffer) < 1)
+ { printf ("Line %d: could not retrieve lib version.\n", __LINE__) ;
+ exit (1) ;
+ } ;
+ printf ("Version : %s\n\n", buffer) ;
+
+ sf_command (NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof (int)) ;
+ sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof (int)) ;
+
+ sfinfo.channels = 1 ;
+ for (m = 0 ; m < major_count ; m++)
+ { info.format = m ;
+ sf_command (NULL, SFC_GET_FORMAT_MAJOR, &info, sizeof (info)) ;
+ printf ("%s (extension \"%s\")\n", info.name, info.extension) ;
+
+ format = info.format ;
+
+ for (s = 0 ; s < subtype_count ; s++)
+ { info.format = s ;
+ sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &info, sizeof (info)) ;
+
+ format = (format & SF_FORMAT_TYPEMASK) | info.format ;
+
+ sfinfo.format = format ;
+ if (sf_format_check (&sfinfo))
+ printf (" %s\n", info.name) ;
+ } ;
+ puts ("") ;
+ } ;
+ puts ("") ;
+
+ return 0 ;
+} /* main */
+
diff --git a/examples/make_sine.c b/examples/make_sine.c
new file mode 100644
index 0000000..ec8a830
--- /dev/null
+++ b/examples/make_sine.c
@@ -0,0 +1,96 @@
+/*
+** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the author nor the names of any contributors may be used
+** to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include <sndfile.h>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846264338
+#endif
+
+#define SAMPLE_RATE 44100
+#define SAMPLE_COUNT (SAMPLE_RATE * 4) /* 4 seconds */
+#define AMPLITUDE (1.0 * 0x7F000000)
+#define LEFT_FREQ (344.0 / SAMPLE_RATE)
+#define RIGHT_FREQ (466.0 / SAMPLE_RATE)
+
+int
+main (void)
+{ SNDFILE *file ;
+ SF_INFO sfinfo ;
+ int k ;
+ int *buffer ;
+
+ if (! (buffer = malloc (2 * SAMPLE_COUNT * sizeof (int))))
+ { printf ("Malloc failed.\n") ;
+ exit (0) ;
+ } ;
+
+ memset (&sfinfo, 0, sizeof (sfinfo)) ;
+
+ sfinfo.samplerate = SAMPLE_RATE ;
+ sfinfo.frames = SAMPLE_COUNT ;
+ sfinfo.channels = 2 ;
+ sfinfo.format = (SF_FORMAT_WAV | SF_FORMAT_PCM_24) ;
+
+ if (! (file = sf_open ("sine.wav", SFM_WRITE, &sfinfo)))
+ { printf ("Error : Not able to open output file.\n") ;
+ return 1 ;
+ } ;
+
+ if (sfinfo.channels == 1)
+ { for (k = 0 ; k < SAMPLE_COUNT ; k++)
+ buffer [k] = AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI) ;
+ }
+ else if (sfinfo.channels == 2)
+ { for (k = 0 ; k < SAMPLE_COUNT ; k++)
+ { buffer [2 * k] = AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI) ;
+ buffer [2 * k + 1] = AMPLITUDE * sin (RIGHT_FREQ * 2 * k * M_PI) ;
+ } ;
+ }
+ else
+ { printf ("makesine can only generate mono or stereo files.\n") ;
+ exit (1) ;
+ } ;
+
+ if (sf_write_int (file, buffer, sfinfo.channels * SAMPLE_COUNT) !=
+ sfinfo.channels * SAMPLE_COUNT)
+ puts (sf_strerror (file)) ;
+
+ sf_close (file) ;
+ return 0 ;
+} /* main */
+
diff --git a/examples/sfprocess.c b/examples/sfprocess.c
new file mode 100644
index 0000000..5c7db28
--- /dev/null
+++ b/examples/sfprocess.c
@@ -0,0 +1,137 @@
+/*
+** Copyright (C) 2001-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the author nor the names of any contributors may be used
+** to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdio.h>
+
+/* Include this header file to use functions from libsndfile. */
+#include <sndfile.h>
+
+/* This will be the length of the buffer used to hold.frames while
+** we process them.
+*/
+#define BUFFER_LEN 1024
+
+/* libsndfile can handle more than 6 channels but we'll restrict it to 6. */
+#define MAX_CHANNELS 6
+
+/* Function prototype. */
+static void process_data (double *data, int count, int channels) ;
+
+
+int
+main (void)
+{ /* This is a buffer of double precision floating point values
+ ** which will hold our data while we process it.
+ */
+ static double data [BUFFER_LEN] ;
+
+ /* A SNDFILE is very much like a FILE in the Standard C library. The
+ ** sf_open function return an SNDFILE* pointer when they sucessfully
+ ** open the specified file.
+ */
+ SNDFILE *infile, *outfile ;
+
+ /* A pointer to an SF_INFO stutct is passed to sf_open.
+ ** On read, the library fills this struct with information about the file.
+ ** On write, the struct must be filled in before calling sf_open.
+ */
+ SF_INFO sfinfo ;
+ int readcount ;
+ const char *infilename = "input.wav" ;
+ const char *outfilename = "output.wav" ;
+
+ /* Here's where we open the input file. We pass sf_open the file name and
+ ** a pointer to an SF_INFO struct.
+ ** On successful open, sf_open returns a SNDFILE* pointer which is used
+ ** for all subsequent operations on that file.
+ ** If an error occurs during sf_open, the function returns a NULL pointer.
+ **
+ ** If you are trying to open a raw headerless file you will need to set the
+ ** format and channels fields of sfinfo before calling sf_open(). For
+ ** instance to open a raw 16 bit stereo PCM file you would need the following
+ ** two lines:
+ **
+ ** sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16 ;
+ ** sfinfo.channels = 2 ;
+ */
+ if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
+ { /* Open failed so print an error message. */
+ printf ("Not able to open input file %s.\n", infilename) ;
+ /* Print the error message from libsndfile. */
+ puts (sf_strerror (NULL)) ;
+ return 1 ;
+ } ;
+
+ if (sfinfo.channels > MAX_CHANNELS)
+ { printf ("Not able to process more than %d channels\n", MAX_CHANNELS) ;
+ return 1 ;
+ } ;
+ /* Open the output file. */
+ if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
+ { printf ("Not able to open output file %s.\n", outfilename) ;
+ puts (sf_strerror (NULL)) ;
+ return 1 ;
+ } ;
+
+ /* While there are.frames in the input file, read them, process
+ ** them and write them to the output file.
+ */
+ while ((readcount = sf_read_double (infile, data, BUFFER_LEN)))
+ { process_data (data, readcount, sfinfo.channels) ;
+ sf_write_double (outfile, data, readcount) ;
+ } ;
+
+ /* Close input and output files. */
+ sf_close (infile) ;
+ sf_close (outfile) ;
+
+ return 0 ;
+} /* main */
+
+static void
+process_data (double *data, int count, int channels)
+{ double channel_gain [MAX_CHANNELS] = { 0.5, 0.8, 0.1, 0.4, 0.4, 0.9 } ;
+ int k, chan ;
+
+ /* Process the data here.
+ ** If the soundfile contains more then 1 channel you need to take care of
+ ** the data interleaving youself.
+ ** Current we just apply a channel dependant gain.
+ */
+
+ for (chan = 0 ; chan < channels ; chan ++)
+ for (k = chan ; k < count ; k+= channels)
+ data [k] *= channel_gain [chan] ;
+
+ return ;
+} /* process_data */
+
diff --git a/examples/sndfile-to-text.c b/examples/sndfile-to-text.c
new file mode 100644
index 0000000..7a7a219
--- /dev/null
+++ b/examples/sndfile-to-text.c
@@ -0,0 +1,126 @@
+/*
+** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the author nor the names of any contributors may be used
+** to endorse or promote products derived from this software without
+** specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <sndfile.h>
+
+#define BLOCK_SIZE 512
+
+static void
+print_usage (char *progname)
+{ printf ("\nUsage : %s <input file> <output file>\n", progname) ;
+ puts ("\n"
+ " Where the output file will contain a line for each frame\n"
+ " and a column for each channel.\n"
+ ) ;
+
+} /* print_usage */
+
+static void
+convert_to_text (SNDFILE * infile, FILE * outfile, int channels)
+{ float buf [channels * BLOCK_SIZE] ;
+ int k, m, readcount ;
+
+ while ((readcount = sf_readf_float (infile, buf, BLOCK_SIZE)) > 0)
+ { for (k = 0 ; k < readcount ; k++)
+ { for (m = 0 ; m < channels ; m++)
+ fprintf (outfile, " % 12.10f", buf [k * channels + m]) ;
+ fprintf (outfile, "\n") ;
+ } ;
+ } ;
+
+ return ;
+} /* convert_to_text */
+
+int
+main (int argc, char * argv [])
+{ char *progname, *infilename, *outfilename ;
+ SNDFILE *infile = NULL ;
+ FILE *outfile = NULL ;
+ SF_INFO sfinfo ;
+
+ progname = strrchr (argv [0], '/') ;
+ progname = progname ? progname + 1 : argv [0] ;
+
+ if (argc != 3)
+ { print_usage (progname) ;
+ return 1 ;
+ } ;
+
+ infilename = argv [1] ;
+ outfilename = argv [2] ;
+
+ if (strcmp (infilename, outfilename) == 0)
+ { printf ("Error : Input and output filenames are the same.\n\n") ;
+ print_usage (progname) ;
+ return 1 ;
+ } ;
+
+ if (infilename [0] == '-')
+ { printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
+ print_usage (progname) ;
+ return 1 ;
+ } ;
+
+ if (outfilename [0] == '-')
+ { printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
+ print_usage (progname) ;
+ return 1 ;
+ } ;
+
+ if ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)
+ { printf ("Not able to open input file %s.\n", infilename) ;
+ puts (sf_strerror (NULL)) ;
+ return 1 ;
+ } ;
+
+ /* Open the output file. */
+ if ((outfile = fopen (outfilename, "w")) == NULL)
+ { printf ("Not able to open output file %s : %s\n", outfilename, sf_strerror (NULL)) ;
+ return 1 ;
+ } ;
+
+ fprintf (outfile, "# Converted from file %s.\n", infilename) ;
+ fprintf (outfile, "# Channels %d, Sample rate %d\n", sfinfo.channels, sfinfo.samplerate) ;
+
+ convert_to_text (infile, outfile, sfinfo.channels) ;
+
+ sf_close (infile) ;
+ fclose (outfile) ;
+
+ return 0 ;
+} /* main */
+
diff --git a/examples/sndfilehandle.cc b/examples/sndfilehandle.cc
new file mode 100644
index 0000000..c9a1931
--- /dev/null
+++ b/examples/sndfilehandle.cc
@@ -0,0 +1,84 @@
+/*
+** Copyright (C) 2007-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include <cstdio>
+#include <cstring>
+
+#include <sndfile.hh>
+
+#define BUFFER_LEN 1024
+
+static void
+create_file (const char * fname, int format)
+{ static short buffer [BUFFER_LEN] ;
+
+ SndfileHandle file ;
+ int channels = 2 ;
+ int srate = 48000 ;
+
+ printf ("Creating file named '%s'\n", fname) ;
+
+ file = SndfileHandle (fname, SFM_WRITE, format, channels, srate) ;
+
+ memset (buffer, 0, sizeof (buffer)) ;
+
+ file.write (buffer, BUFFER_LEN) ;
+
+ puts ("") ;
+ /*
+ ** The SndfileHandle object will automatically close the file and
+ ** release all allocated memory when the object goes out of scope.
+ ** This is the Resource Acquisition Is Initailization idom.
+ ** See : http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
+ */
+} /* create_file */
+
+static void
+read_file (const char * fname)
+{ static short buffer [BUFFER_LEN] ;
+
+ SndfileHandle file ;
+
+ file = SndfileHandle (fname) ;
+
+ printf ("Opened file '%s'\n", fname) ;
+ printf (" Sample rate : %d\n", file.samplerate ()) ;
+ printf (" Channels : %d\n", file.channels ()) ;
+
+ file.read (buffer, BUFFER_LEN) ;
+
+ puts ("") ;
+
+ /* RAII takes care of destroying SndfileHandle object. */
+} /* read_file */
+
+int
+main (void)
+{ const char * fname = "test.wav" ;
+
+ puts ("\nSimple example showing usage of the C++ SndfileHandle object.\n") ;
+
+ create_file (fname, SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
+
+ read_file (fname) ;
+
+ puts ("Done.\n") ;
+ return 0 ;
+} /* main */
+
+