mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Upgrades libsndfile to 1.0.24.
This commit is contained in:
@@ -1,36 +1,47 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
bin_PROGRAMS = sndfile-info sndfile-play sndfile-convert sndfile-jackplay sndfile-cmp \
|
||||
sndfile-metadata-set sndfile-metadata-get
|
||||
bin_PROGRAMS = sndfile-info sndfile-play sndfile-convert sndfile-cmp \
|
||||
sndfile-metadata-set sndfile-metadata-get sndfile-interleave \
|
||||
sndfile-deinterleave sndfile-concat sndfile-salvage
|
||||
|
||||
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
|
||||
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS)
|
||||
|
||||
CLEANFILES = *~
|
||||
|
||||
# This is the BeOS version of sndfile-play. It needs to be compiled with the C++
|
||||
# compiler.
|
||||
EXTRA_DIST = sndfile-play-beos.cpp test-sndfile-metadata-set.py
|
||||
|
||||
sndfile_info_SOURCES = sndfile-info.c
|
||||
sndfile_info_SOURCES = sndfile-info.c common.c common.h
|
||||
sndfile_info_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_play_SOURCES = sndfile-play.c
|
||||
sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
|
||||
|
||||
sndfile_jackplay_SOURCES = sndfile-jackplay.c
|
||||
sndfile_jackplay_CFLAGS = $(JACK_CFLAGS)
|
||||
sndfile_jackplay_LDADD = $(top_builddir)/src/libsndfile.la $(JACK_LIBS)
|
||||
sndfile_play_SOURCES = sndfile-play.c common.c common.h
|
||||
sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS) $(SNDIO_LIBS)
|
||||
|
||||
sndfile_convert_SOURCES = sndfile-convert.c common.c common.h
|
||||
sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_cmp_SOURCES = sndfile-cmp.c
|
||||
sndfile_cmp_SOURCES = sndfile-cmp.c common.c common.h
|
||||
sndfile_cmp_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_metadata_set_SOURCES = sndfile-metadata-set.c common.c common.h
|
||||
sndfile_metadata_set_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_metadata_get_SOURCES = sndfile-metadata-get.c
|
||||
sndfile_metadata_get_SOURCES = sndfile-metadata-get.c common.c common.h
|
||||
sndfile_metadata_get_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_interleave_SOURCES = sndfile-interleave.c common.c common.h
|
||||
sndfile_interleave_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_deinterleave_SOURCES = sndfile-deinterleave.c common.c common.h
|
||||
sndfile_deinterleave_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_concat_SOURCES = sndfile-concat.c common.c common.h
|
||||
sndfile_concat_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_salvage_SOURCES = sndfile-salvage.c common.c common.h
|
||||
sndfile_salvage_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
|
@@ -1,8 +1,9 @@
|
||||
# Makefile.in generated by automake 1.10.2 from Makefile.am.
|
||||
# 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 Free Software Foundation, Inc.
|
||||
# 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.
|
||||
@@ -16,8 +17,9 @@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@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
|
||||
@@ -34,9 +36,10 @@ build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
bin_PROGRAMS = sndfile-info$(EXEEXT) sndfile-play$(EXEEXT) \
|
||||
sndfile-convert$(EXEEXT) sndfile-jackplay$(EXEEXT) \
|
||||
sndfile-cmp$(EXEEXT) sndfile-metadata-set$(EXEEXT) \
|
||||
sndfile-metadata-get$(EXEEXT)
|
||||
sndfile-convert$(EXEEXT) sndfile-cmp$(EXEEXT) \
|
||||
sndfile-metadata-set$(EXEEXT) sndfile-metadata-get$(EXEEXT) \
|
||||
sndfile-interleave$(EXEEXT) sndfile-deinterleave$(EXEEXT) \
|
||||
sndfile-concat$(EXEEXT) sndfile-salvage$(EXEEXT)
|
||||
subdir = programs
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
@@ -45,71 +48,98 @@ am__aclocal_m4_deps = $(top_srcdir)/M4/add_cflags.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/gcc_version.m4 $(top_srcdir)/M4/lrint.m4 \
|
||||
$(top_srcdir)/M4/lrintf.m4 \
|
||||
$(top_srcdir)/M4/mkoctfile_version.m4 \
|
||||
$(top_srcdir)/M4/octave.m4 $(top_srcdir)/M4/pkg.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
$(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 =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_sndfile_cmp_OBJECTS = sndfile-cmp.$(OBJEXT)
|
||||
am_sndfile_cmp_OBJECTS = sndfile-cmp.$(OBJEXT) common.$(OBJEXT)
|
||||
sndfile_cmp_OBJECTS = $(am_sndfile_cmp_OBJECTS)
|
||||
sndfile_cmp_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_sndfile_concat_OBJECTS = sndfile-concat.$(OBJEXT) common.$(OBJEXT)
|
||||
sndfile_concat_OBJECTS = $(am_sndfile_concat_OBJECTS)
|
||||
sndfile_concat_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
|
||||
am_sndfile_convert_OBJECTS = sndfile-convert.$(OBJEXT) \
|
||||
common.$(OBJEXT)
|
||||
sndfile_convert_OBJECTS = $(am_sndfile_convert_OBJECTS)
|
||||
sndfile_convert_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
|
||||
am_sndfile_info_OBJECTS = sndfile-info.$(OBJEXT)
|
||||
am_sndfile_deinterleave_OBJECTS = sndfile-deinterleave.$(OBJEXT) \
|
||||
common.$(OBJEXT)
|
||||
sndfile_deinterleave_OBJECTS = $(am_sndfile_deinterleave_OBJECTS)
|
||||
sndfile_deinterleave_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
|
||||
am_sndfile_info_OBJECTS = sndfile-info.$(OBJEXT) common.$(OBJEXT)
|
||||
sndfile_info_OBJECTS = $(am_sndfile_info_OBJECTS)
|
||||
sndfile_info_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
|
||||
am_sndfile_jackplay_OBJECTS = \
|
||||
sndfile_jackplay-sndfile-jackplay.$(OBJEXT)
|
||||
sndfile_jackplay_OBJECTS = $(am_sndfile_jackplay_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
sndfile_jackplay_DEPENDENCIES = $(top_builddir)/src/libsndfile.la \
|
||||
$(am__DEPENDENCIES_1)
|
||||
sndfile_jackplay_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(sndfile_jackplay_CFLAGS) \
|
||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_sndfile_metadata_get_OBJECTS = sndfile-metadata-get.$(OBJEXT)
|
||||
am_sndfile_interleave_OBJECTS = sndfile-interleave.$(OBJEXT) \
|
||||
common.$(OBJEXT)
|
||||
sndfile_interleave_OBJECTS = $(am_sndfile_interleave_OBJECTS)
|
||||
sndfile_interleave_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
|
||||
am_sndfile_metadata_get_OBJECTS = sndfile-metadata-get.$(OBJEXT) \
|
||||
common.$(OBJEXT)
|
||||
sndfile_metadata_get_OBJECTS = $(am_sndfile_metadata_get_OBJECTS)
|
||||
sndfile_metadata_get_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
|
||||
am_sndfile_metadata_set_OBJECTS = sndfile-metadata-set.$(OBJEXT) \
|
||||
common.$(OBJEXT)
|
||||
sndfile_metadata_set_OBJECTS = $(am_sndfile_metadata_set_OBJECTS)
|
||||
sndfile_metadata_set_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
|
||||
am_sndfile_play_OBJECTS = sndfile-play.$(OBJEXT)
|
||||
am_sndfile_play_OBJECTS = sndfile-play.$(OBJEXT) common.$(OBJEXT)
|
||||
sndfile_play_OBJECTS = $(am_sndfile_play_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
sndfile_play_DEPENDENCIES = $(top_builddir)/src/libsndfile.la \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1)
|
||||
am_sndfile_salvage_OBJECTS = sndfile-salvage.$(OBJEXT) \
|
||||
common.$(OBJEXT)
|
||||
sndfile_salvage_OBJECTS = $(am_sndfile_salvage_OBJECTS)
|
||||
sndfile_salvage_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) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=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) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(sndfile_cmp_SOURCES) $(sndfile_convert_SOURCES) \
|
||||
$(sndfile_info_SOURCES) $(sndfile_jackplay_SOURCES) \
|
||||
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 " $@;
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
SOURCES = $(sndfile_cmp_SOURCES) $(sndfile_concat_SOURCES) \
|
||||
$(sndfile_convert_SOURCES) $(sndfile_deinterleave_SOURCES) \
|
||||
$(sndfile_info_SOURCES) $(sndfile_interleave_SOURCES) \
|
||||
$(sndfile_metadata_get_SOURCES) \
|
||||
$(sndfile_metadata_set_SOURCES) $(sndfile_play_SOURCES)
|
||||
DIST_SOURCES = $(sndfile_cmp_SOURCES) $(sndfile_convert_SOURCES) \
|
||||
$(sndfile_info_SOURCES) $(sndfile_jackplay_SOURCES) \
|
||||
$(sndfile_metadata_set_SOURCES) $(sndfile_play_SOURCES) \
|
||||
$(sndfile_salvage_SOURCES)
|
||||
DIST_SOURCES = $(sndfile_cmp_SOURCES) $(sndfile_concat_SOURCES) \
|
||||
$(sndfile_convert_SOURCES) $(sndfile_deinterleave_SOURCES) \
|
||||
$(sndfile_info_SOURCES) $(sndfile_interleave_SOURCES) \
|
||||
$(sndfile_metadata_get_SOURCES) \
|
||||
$(sndfile_metadata_set_SOURCES) $(sndfile_play_SOURCES)
|
||||
$(sndfile_metadata_set_SOURCES) $(sndfile_play_SOURCES) \
|
||||
$(sndfile_salvage_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@@ -117,6 +147,7 @@ ACLOCAL = @ACLOCAL@
|
||||
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
@@ -125,7 +156,7 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILER_IS_GCC = @COMPILER_IS_GCC@
|
||||
CLEAN_VERSION = @CLEAN_VERSION@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
@@ -135,13 +166,13 @@ 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@
|
||||
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXTERNAL_CFLAGS = @EXTERNAL_CFLAGS@
|
||||
EXTERNAL_LIBS = @EXTERNAL_LIBS@
|
||||
@@ -154,11 +185,11 @@ GCC_VERSION = @GCC_VERSION@
|
||||
GETCONF = @GETCONF@
|
||||
GREP = @GREP@
|
||||
HAVE_AUTOGEN = @HAVE_AUTOGEN@
|
||||
HAVE_JACK = @HAVE_JACK@
|
||||
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@
|
||||
@@ -166,8 +197,6 @@ INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
JACK_CFLAGS = @JACK_CFLAGS@
|
||||
JACK_LIBS = @JACK_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
@@ -179,6 +208,7 @@ LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MKOCTFILE = @MKOCTFILE@
|
||||
MKOCTFILE_VERSION = @MKOCTFILE_VERSION@
|
||||
@@ -203,10 +233,14 @@ 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@
|
||||
@@ -214,6 +248,7 @@ 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@
|
||||
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
|
||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STRIP = @STRIP@
|
||||
@@ -223,10 +258,12 @@ 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@
|
||||
@@ -261,7 +298,6 @@ libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
@@ -282,25 +318,31 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS)
|
||||
CLEANFILES = *~
|
||||
|
||||
# This is the BeOS version of sndfile-play. It needs to be compiled with the C++
|
||||
# compiler.
|
||||
EXTRA_DIST = sndfile-play-beos.cpp test-sndfile-metadata-set.py
|
||||
sndfile_info_SOURCES = sndfile-info.c
|
||||
sndfile_info_SOURCES = sndfile-info.c common.c common.h
|
||||
sndfile_info_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
sndfile_play_SOURCES = sndfile-play.c
|
||||
sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
|
||||
sndfile_jackplay_SOURCES = sndfile-jackplay.c
|
||||
sndfile_jackplay_CFLAGS = $(JACK_CFLAGS)
|
||||
sndfile_jackplay_LDADD = $(top_builddir)/src/libsndfile.la $(JACK_LIBS)
|
||||
sndfile_play_SOURCES = sndfile-play.c common.c common.h
|
||||
sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS) $(SNDIO_LIBS)
|
||||
sndfile_convert_SOURCES = sndfile-convert.c common.c common.h
|
||||
sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
sndfile_cmp_SOURCES = sndfile-cmp.c
|
||||
sndfile_cmp_SOURCES = sndfile-cmp.c common.c common.h
|
||||
sndfile_cmp_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
sndfile_metadata_set_SOURCES = sndfile-metadata-set.c common.c common.h
|
||||
sndfile_metadata_set_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
sndfile_metadata_get_SOURCES = sndfile-metadata-get.c
|
||||
sndfile_metadata_get_SOURCES = sndfile-metadata-get.c common.c common.h
|
||||
sndfile_metadata_get_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
sndfile_interleave_SOURCES = sndfile-interleave.c common.c common.h
|
||||
sndfile_interleave_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
sndfile_deinterleave_SOURCES = sndfile-deinterleave.c common.c common.h
|
||||
sndfile_deinterleave_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
sndfile_concat_SOURCES = sndfile-concat.c common.c common.h
|
||||
sndfile_concat_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
sndfile_salvage_SOURCES = sndfile-salvage.c common.c common.h
|
||||
sndfile_salvage_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@@ -314,9 +356,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu programs/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu programs/Makefile
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu programs/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu programs/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
@@ -334,55 +376,80 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
if test -f $$p \
|
||||
|| test -f $$p1 \
|
||||
; then \
|
||||
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
|
||||
else :; fi; \
|
||||
done
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p || test -f $$p1; \
|
||||
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(bindir)/$$f"; \
|
||||
done
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' `; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f $$p $$f"; \
|
||||
rm -f $$p $$f ; \
|
||||
done
|
||||
@list='$(bin_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
|
||||
sndfile-cmp$(EXEEXT): $(sndfile_cmp_OBJECTS) $(sndfile_cmp_DEPENDENCIES)
|
||||
@rm -f sndfile-cmp$(EXEEXT)
|
||||
$(LINK) $(sndfile_cmp_OBJECTS) $(sndfile_cmp_LDADD) $(LIBS)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_cmp_OBJECTS) $(sndfile_cmp_LDADD) $(LIBS)
|
||||
sndfile-concat$(EXEEXT): $(sndfile_concat_OBJECTS) $(sndfile_concat_DEPENDENCIES)
|
||||
@rm -f sndfile-concat$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_concat_OBJECTS) $(sndfile_concat_LDADD) $(LIBS)
|
||||
sndfile-convert$(EXEEXT): $(sndfile_convert_OBJECTS) $(sndfile_convert_DEPENDENCIES)
|
||||
@rm -f sndfile-convert$(EXEEXT)
|
||||
$(LINK) $(sndfile_convert_OBJECTS) $(sndfile_convert_LDADD) $(LIBS)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_convert_OBJECTS) $(sndfile_convert_LDADD) $(LIBS)
|
||||
sndfile-deinterleave$(EXEEXT): $(sndfile_deinterleave_OBJECTS) $(sndfile_deinterleave_DEPENDENCIES)
|
||||
@rm -f sndfile-deinterleave$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_deinterleave_OBJECTS) $(sndfile_deinterleave_LDADD) $(LIBS)
|
||||
sndfile-info$(EXEEXT): $(sndfile_info_OBJECTS) $(sndfile_info_DEPENDENCIES)
|
||||
@rm -f sndfile-info$(EXEEXT)
|
||||
$(LINK) $(sndfile_info_OBJECTS) $(sndfile_info_LDADD) $(LIBS)
|
||||
sndfile-jackplay$(EXEEXT): $(sndfile_jackplay_OBJECTS) $(sndfile_jackplay_DEPENDENCIES)
|
||||
@rm -f sndfile-jackplay$(EXEEXT)
|
||||
$(sndfile_jackplay_LINK) $(sndfile_jackplay_OBJECTS) $(sndfile_jackplay_LDADD) $(LIBS)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_info_OBJECTS) $(sndfile_info_LDADD) $(LIBS)
|
||||
sndfile-interleave$(EXEEXT): $(sndfile_interleave_OBJECTS) $(sndfile_interleave_DEPENDENCIES)
|
||||
@rm -f sndfile-interleave$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_interleave_OBJECTS) $(sndfile_interleave_LDADD) $(LIBS)
|
||||
sndfile-metadata-get$(EXEEXT): $(sndfile_metadata_get_OBJECTS) $(sndfile_metadata_get_DEPENDENCIES)
|
||||
@rm -f sndfile-metadata-get$(EXEEXT)
|
||||
$(LINK) $(sndfile_metadata_get_OBJECTS) $(sndfile_metadata_get_LDADD) $(LIBS)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_metadata_get_OBJECTS) $(sndfile_metadata_get_LDADD) $(LIBS)
|
||||
sndfile-metadata-set$(EXEEXT): $(sndfile_metadata_set_OBJECTS) $(sndfile_metadata_set_DEPENDENCIES)
|
||||
@rm -f sndfile-metadata-set$(EXEEXT)
|
||||
$(LINK) $(sndfile_metadata_set_OBJECTS) $(sndfile_metadata_set_LDADD) $(LIBS)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_metadata_set_OBJECTS) $(sndfile_metadata_set_LDADD) $(LIBS)
|
||||
sndfile-play$(EXEEXT): $(sndfile_play_OBJECTS) $(sndfile_play_DEPENDENCIES)
|
||||
@rm -f sndfile-play$(EXEEXT)
|
||||
$(LINK) $(sndfile_play_OBJECTS) $(sndfile_play_LDADD) $(LIBS)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_play_OBJECTS) $(sndfile_play_LDADD) $(LIBS)
|
||||
sndfile-salvage$(EXEEXT): $(sndfile_salvage_OBJECTS) $(sndfile_salvage_DEPENDENCIES)
|
||||
@rm -f sndfile-salvage$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(sndfile_salvage_OBJECTS) $(sndfile_salvage_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
@@ -392,48 +459,40 @@ distclean-compile:
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-cmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-concat.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-convert.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-deinterleave.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-info.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-interleave.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-metadata-get.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-metadata-set.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-play.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile_jackplay-sndfile-jackplay.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-salvage.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@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 $@ $<
|
||||
|
||||
sndfile_jackplay-sndfile-jackplay.o: sndfile-jackplay.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sndfile_jackplay_CFLAGS) $(CFLAGS) -MT sndfile_jackplay-sndfile-jackplay.o -MD -MP -MF $(DEPDIR)/sndfile_jackplay-sndfile-jackplay.Tpo -c -o sndfile_jackplay-sndfile-jackplay.o `test -f 'sndfile-jackplay.c' || echo '$(srcdir)/'`sndfile-jackplay.c
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sndfile_jackplay-sndfile-jackplay.Tpo $(DEPDIR)/sndfile_jackplay-sndfile-jackplay.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sndfile-jackplay.c' object='sndfile_jackplay-sndfile-jackplay.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) $(sndfile_jackplay_CFLAGS) $(CFLAGS) -c -o sndfile_jackplay-sndfile-jackplay.o `test -f 'sndfile-jackplay.c' || echo '$(srcdir)/'`sndfile-jackplay.c
|
||||
|
||||
sndfile_jackplay-sndfile-jackplay.obj: sndfile-jackplay.c
|
||||
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sndfile_jackplay_CFLAGS) $(CFLAGS) -MT sndfile_jackplay-sndfile-jackplay.obj -MD -MP -MF $(DEPDIR)/sndfile_jackplay-sndfile-jackplay.Tpo -c -o sndfile_jackplay-sndfile-jackplay.obj `if test -f 'sndfile-jackplay.c'; then $(CYGPATH_W) 'sndfile-jackplay.c'; else $(CYGPATH_W) '$(srcdir)/sndfile-jackplay.c'; fi`
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/sndfile_jackplay-sndfile-jackplay.Tpo $(DEPDIR)/sndfile_jackplay-sndfile-jackplay.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sndfile-jackplay.c' object='sndfile_jackplay-sndfile-jackplay.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) $(sndfile_jackplay_CFLAGS) $(CFLAGS) -c -o sndfile_jackplay-sndfile-jackplay.obj `if test -f 'sndfile-jackplay.c'; then $(CYGPATH_W) 'sndfile-jackplay.c'; else $(CYGPATH_W) '$(srcdir)/sndfile-jackplay.c'; fi`
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
@@ -452,7 +511,7 @@ tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
@@ -460,29 +519,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
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)
|
||||
tags=; \
|
||||
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)$$tags$$unique" \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
@@ -503,13 +567,17 @@ distdir: $(DISTFILES)
|
||||
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 $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
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 \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@@ -537,9 +605,11 @@ install-strip:
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
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"
|
||||
@@ -560,6 +630,8 @@ dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
@@ -568,18 +640,28 @@ install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
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
|
||||
@@ -618,6 +700,7 @@ uninstall-am: uninstall-binPROGRAMS
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
uninstall-binPROGRAMS
|
||||
|
||||
|
||||
# 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:
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2008 George Blood Audio
|
||||
**
|
||||
** All rights reserved.
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
@@ -146,6 +147,14 @@ merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const MET
|
||||
REPLACE_IF_NEW (origination_time) ;
|
||||
REPLACE_IF_NEW (umid) ;
|
||||
|
||||
/* Special case for Time Ref. */
|
||||
if (info->time_ref != NULL)
|
||||
{ uint64_t ts = atoll (info->time_ref) ;
|
||||
|
||||
binfo.time_reference_high = (ts >> 32) ;
|
||||
binfo.time_reference_low = (ts & 0xffffffff) ;
|
||||
} ;
|
||||
|
||||
/* Special case for coding_history because we may want to append. */
|
||||
if (info->coding_history != NULL)
|
||||
{ if (info->coding_hist_append)
|
||||
@@ -180,22 +189,22 @@ update_strings (SNDFILE * outfile, const METADATA_INFO * info)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->title) ;
|
||||
|
||||
if (info->copyright != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->copyright) ;
|
||||
sf_set_string (outfile, SF_STR_COPYRIGHT, info->copyright) ;
|
||||
|
||||
if (info->artist != NULL)
|
||||
sf_set_string (outfile, SF_STR_ARTIST, info->artist) ;
|
||||
|
||||
if (info->comment != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->comment) ;
|
||||
sf_set_string (outfile, SF_STR_COMMENT, info->comment) ;
|
||||
|
||||
if (info->date != NULL)
|
||||
sf_set_string (outfile, SF_STR_DATE, info->date) ;
|
||||
|
||||
if (info->album != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->album) ;
|
||||
sf_set_string (outfile, SF_STR_ALBUM, info->album) ;
|
||||
|
||||
if (info->license != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->license) ;
|
||||
sf_set_string (outfile, SF_STR_LICENSE, info->license) ;
|
||||
|
||||
} /* update_strings */
|
||||
|
||||
@@ -238,8 +247,6 @@ sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * in
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
update_strings (outfile, info) ;
|
||||
|
||||
if (infile != outfile)
|
||||
{ int infileminor = SF_FORMAT_SUBMASK & sfinfo.format ;
|
||||
|
||||
@@ -250,6 +257,8 @@ sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * in
|
||||
sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
|
||||
} ;
|
||||
|
||||
update_strings (outfile, info) ;
|
||||
|
||||
cleanup_exit :
|
||||
|
||||
if (outfile != NULL && outfile != infile)
|
||||
@@ -264,3 +273,107 @@ cleanup_exit :
|
||||
return ;
|
||||
} /* sfe_apply_metadata_changes */
|
||||
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ const char *ext ;
|
||||
int len ;
|
||||
int format ;
|
||||
} OUTPUT_FORMAT_MAP ;
|
||||
|
||||
static OUTPUT_FORMAT_MAP format_map [] =
|
||||
{
|
||||
{ "aif", 3, SF_FORMAT_AIFF },
|
||||
{ "wav", 0, SF_FORMAT_WAV },
|
||||
{ "au", 0, SF_FORMAT_AU },
|
||||
{ "caf", 0, SF_FORMAT_CAF },
|
||||
{ "flac", 0, SF_FORMAT_FLAC },
|
||||
{ "snd", 0, SF_FORMAT_AU },
|
||||
{ "svx", 0, SF_FORMAT_SVX },
|
||||
{ "paf", 0, SF_ENDIAN_BIG | SF_FORMAT_PAF },
|
||||
{ "fap", 0, SF_ENDIAN_LITTLE | SF_FORMAT_PAF },
|
||||
{ "gsm", 0, SF_FORMAT_RAW },
|
||||
{ "nist", 0, SF_FORMAT_NIST },
|
||||
{ "htk", 0, SF_FORMAT_HTK },
|
||||
{ "ircam", 0, SF_FORMAT_IRCAM },
|
||||
{ "sf", 0, SF_FORMAT_IRCAM },
|
||||
{ "voc", 0, SF_FORMAT_VOC },
|
||||
{ "w64", 0, SF_FORMAT_W64 },
|
||||
{ "raw", 0, SF_FORMAT_RAW },
|
||||
{ "mat4", 0, SF_FORMAT_MAT4 },
|
||||
{ "mat5", 0, SF_FORMAT_MAT5 },
|
||||
{ "mat", 0, SF_FORMAT_MAT4 },
|
||||
{ "pvf", 0, SF_FORMAT_PVF },
|
||||
{ "sds", 0, SF_FORMAT_SDS },
|
||||
{ "sd2", 0, SF_FORMAT_SD2 },
|
||||
{ "vox", 0, SF_FORMAT_RAW },
|
||||
{ "xi", 0, SF_FORMAT_XI },
|
||||
{ "wve", 0, SF_FORMAT_WVE },
|
||||
{ "oga", 0, SF_FORMAT_OGG },
|
||||
{ "mpc", 0, SF_FORMAT_MPC2K },
|
||||
{ "rf64", 0, SF_FORMAT_RF64 },
|
||||
} ; /* format_map */
|
||||
|
||||
int
|
||||
sfe_file_type_of_ext (const char *str, int format)
|
||||
{ char buffer [16], *cptr ;
|
||||
int k ;
|
||||
|
||||
format &= SF_FORMAT_SUBMASK ;
|
||||
|
||||
if ((cptr = strrchr (str, '.')) == NULL)
|
||||
return 0 ;
|
||||
|
||||
strncpy (buffer, cptr + 1, 15) ;
|
||||
buffer [15] = 0 ;
|
||||
|
||||
for (k = 0 ; buffer [k] ; k++)
|
||||
buffer [k] = tolower ((buffer [k])) ;
|
||||
|
||||
if (strcmp (buffer, "gsm") == 0)
|
||||
return SF_FORMAT_RAW | SF_FORMAT_GSM610 ;
|
||||
|
||||
if (strcmp (buffer, "vox") == 0)
|
||||
return SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
|
||||
|
||||
for (k = 0 ; k < (int) (sizeof (format_map) / sizeof (format_map [0])) ; k++)
|
||||
{ if (format_map [k].len > 0 && strncmp (buffer, format_map [k].ext, format_map [k].len) == 0)
|
||||
return format_map [k].format | format ;
|
||||
else if (strcmp (buffer, format_map [k].ext) == 0)
|
||||
return format_map [k].format | format ;
|
||||
} ;
|
||||
|
||||
/* Default if all the above fails. */
|
||||
return (SF_FORMAT_WAV | SF_FORMAT_PCM_24) ;
|
||||
} /* sfe_file_type_of_ext */
|
||||
|
||||
void
|
||||
sfe_dump_format_map (void)
|
||||
{ SF_FORMAT_INFO info ;
|
||||
int k ;
|
||||
|
||||
for (k = 0 ; k < ARRAY_LEN (format_map) ; k++)
|
||||
{ info.format = format_map [k].format ;
|
||||
sf_command (NULL, SFC_GET_FORMAT_INFO, &info, sizeof (info)) ;
|
||||
printf (" %-10s : %s\n", format_map [k].ext, info.name == NULL ? "????" : info.name) ;
|
||||
} ;
|
||||
|
||||
} /* sfe_dump_format_map */
|
||||
|
||||
const char *
|
||||
program_name (const char * argv0)
|
||||
{ const char * tmp ;
|
||||
|
||||
tmp = strrchr (argv0, '/') ;
|
||||
argv0 = tmp ? tmp + 1 : argv0 ;
|
||||
|
||||
tmp = strrchr (argv0, '/') ;
|
||||
argv0 = tmp ? tmp + 1 : argv0 ;
|
||||
|
||||
/* Remove leading libtool name mangling. */
|
||||
if (strstr (argv0, "lt-") == argv0)
|
||||
return argv0 + 3 ;
|
||||
|
||||
return argv0 ;
|
||||
} /* program_name */
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
@@ -30,7 +30,9 @@
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof (x [0])))
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
typedef struct
|
||||
{ const char * title ;
|
||||
@@ -53,6 +55,7 @@ typedef struct
|
||||
const char * origination_time ;
|
||||
const char * umid ;
|
||||
const char * coding_history ;
|
||||
const char * time_ref ;
|
||||
} METADATA_INFO ;
|
||||
|
||||
typedef SF_BROADCAST_INFO_VAR (2048) SF_BROADCAST_INFO_2K ;
|
||||
@@ -62,3 +65,9 @@ void sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO
|
||||
void sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels) ;
|
||||
|
||||
void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
|
||||
|
||||
int sfe_file_type_of_ext (const char *filename, int format) ;
|
||||
|
||||
void sfe_dump_format_map (void) ;
|
||||
|
||||
const char * program_name (const char * argv0) ;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2008 Conrad Parker <conrad@metadecks.org>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
@@ -30,27 +31,31 @@
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* sndfile-cmp.c
|
||||
* Conrad Parker 2008
|
||||
*/
|
||||
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* Length of comparison data buffers in units of items */
|
||||
#define BUFLEN 65536
|
||||
|
||||
static char * progname ;
|
||||
static char * filename1, * filename2 ;
|
||||
static const char * progname = NULL ;
|
||||
static char * filename1 = NULL, * filename2 = NULL ;
|
||||
|
||||
static int
|
||||
comparison_error (const char * what)
|
||||
{ printf ("%s: %s of files %s and %s differ\n", progname, what, filename1, filename2) ;
|
||||
comparison_error (const char * what, sf_count_t frame_offset)
|
||||
{ char buffer [128] = "" ;
|
||||
|
||||
if (frame_offset >= 0)
|
||||
snprintf (buffer, sizeof (buffer), " (at frame offset %" PRId64 ")", frame_offset) ;
|
||||
|
||||
printf ("%s: %s of files %s and %s differ%s.\n", progname, what, filename1, filename2, buffer) ;
|
||||
return 1 ;
|
||||
} /* comparison_error */
|
||||
|
||||
@@ -60,7 +65,7 @@ compare (void)
|
||||
double buf1 [BUFLEN], buf2 [BUFLEN] ;
|
||||
SF_INFO sfinfo1, sfinfo2 ;
|
||||
SNDFILE * sf1 = NULL, * sf2 = NULL ;
|
||||
sf_count_t len, i, nread1, nread2 ;
|
||||
sf_count_t items, i, nread1, nread2, offset = 0 ;
|
||||
int retval = 0 ;
|
||||
|
||||
memset (&sfinfo1, 0, sizeof (SF_INFO)) ;
|
||||
@@ -80,34 +85,35 @@ compare (void)
|
||||
} ;
|
||||
|
||||
if (sfinfo1.samplerate != sfinfo2.samplerate)
|
||||
{ retval = comparison_error ("Samplerates") ;
|
||||
{ retval = comparison_error ("Samplerates", -1) ;
|
||||
goto out ;
|
||||
} ;
|
||||
|
||||
if (sfinfo1.channels != sfinfo2.channels)
|
||||
{ retval = comparison_error ("Number of channels") ;
|
||||
{ retval = comparison_error ("Number of channels", -1) ;
|
||||
goto out ;
|
||||
} ;
|
||||
|
||||
/* Calculate the framecount that will fit in our data buffers */
|
||||
len = BUFLEN / sfinfo1.channels ;
|
||||
items = BUFLEN / sfinfo1.channels ;
|
||||
|
||||
while ( (nread1 = sf_readf_double (sf1, buf1, len)) > 0)
|
||||
while ( (nread1 = sf_readf_double (sf1, buf1, items)) > 0)
|
||||
{ nread2 = sf_readf_double (sf2, buf2, nread1) ;
|
||||
if (nread2 != nread1)
|
||||
{ retval = comparison_error ("PCM data lengths") ;
|
||||
{ retval = comparison_error ("PCM data lengths", -1) ;
|
||||
goto out ;
|
||||
} ;
|
||||
for (i = 0 ; i < nread1 ; i++)
|
||||
for (i = 0 ; i < nread1 * sfinfo1.channels ; i++)
|
||||
{ if (buf1 [i] != buf2 [i])
|
||||
{ retval = comparison_error ("PCM data") ;
|
||||
{ retval = comparison_error ("PCM data", offset + i / sfinfo1.channels) ;
|
||||
goto out ;
|
||||
} ;
|
||||
} ;
|
||||
offset += nread1 ;
|
||||
} ;
|
||||
|
||||
if ( (nread2 = sf_readf_double (sf2, buf2, nread1)) != 0)
|
||||
{ retval = comparison_error ("PCM data lengths") ;
|
||||
{ retval = comparison_error ("PCM data lengths", -1) ;
|
||||
goto out ;
|
||||
} ;
|
||||
|
||||
@@ -127,22 +133,22 @@ print_version (void)
|
||||
} /* print_version */
|
||||
|
||||
static void
|
||||
print_usage (void)
|
||||
usage_exit (void)
|
||||
{
|
||||
print_version () ;
|
||||
|
||||
printf ("Usage : %s <filename> <filename>\n", progname) ;
|
||||
printf (" Compare the PCM data of two sound files.\n\n") ;
|
||||
} /* print_usage */
|
||||
exit (0) ;
|
||||
} /* usage_exit */
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
progname = program_name (argv [0]) ;
|
||||
|
||||
if (argc != 3)
|
||||
{ print_usage () ;
|
||||
{ usage_exit () ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
@@ -151,7 +157,7 @@ main (int argc, char *argv [])
|
||||
|
||||
if (strcmp (filename1, filename2) == 0)
|
||||
{ printf ("Error : Input filenames are the same.\n\n") ;
|
||||
print_usage () ;
|
||||
usage_exit () ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
|
169
lib-src/libsndfile/programs/sndfile-concat.c
Normal file
169
lib-src/libsndfile/programs/sndfile-concat.c
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
** 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 <ctype.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN (1<<16)
|
||||
|
||||
|
||||
static void concat_data_fp (SNDFILE *wfile, SNDFILE *rofile, int channels) ;
|
||||
static void concat_data_int (SNDFILE *wfile, SNDFILE *rofile, int channels) ;
|
||||
|
||||
static void
|
||||
usage_exit (const char *progname)
|
||||
{
|
||||
printf ("\nUsage : %s <infile1> <infile2> ... <outfile>\n\n", progname) ;
|
||||
puts (
|
||||
" Create a new output file <outfile> containing the concatenated\n"
|
||||
" audio data from froms <infile1> <infile2> ....\n"
|
||||
"\n"
|
||||
" The joined file will be encoded in the same format as the data\n"
|
||||
" in infile1, with all the data in subsequent files automatically\n"
|
||||
" converted to the correct encoding.\n"
|
||||
"\n"
|
||||
" The only restriction is that the two files must have the same\n"
|
||||
" number of channels.\n"
|
||||
) ;
|
||||
|
||||
exit (0) ;
|
||||
} /* usage_exit */
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{ const char *progname, *outfilename ;
|
||||
SNDFILE *outfile, **infiles ;
|
||||
SF_INFO sfinfo_out, sfinfo_in ;
|
||||
void (*func) (SNDFILE*, SNDFILE*, int) ;
|
||||
int k ;
|
||||
|
||||
progname = program_name (argv [0]) ;
|
||||
|
||||
if (argc < 4)
|
||||
usage_exit (progname) ;
|
||||
|
||||
argv ++ ;
|
||||
argc -- ;
|
||||
|
||||
argc -- ;
|
||||
outfilename = argv [argc] ;
|
||||
|
||||
if ((infiles = calloc (argc, sizeof (SNDFILE*))) == NULL)
|
||||
{ printf ("\nError : Malloc failed.\n\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
memset (&sfinfo_in, 0, sizeof (sfinfo_in)) ;
|
||||
|
||||
if ((infiles [0] = sf_open (argv [0], SFM_READ, &sfinfo_in)) == NULL)
|
||||
{ printf ("\nError : failed to open file '%s'.\n\n", argv [0]) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
sfinfo_out = sfinfo_in ;
|
||||
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
{ if ((infiles [k] = sf_open (argv [k], SFM_READ, &sfinfo_in)) == NULL)
|
||||
{ printf ("\nError : failed to open file '%s'.\n\n", argv [k]) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo_in.channels != sfinfo_out.channels)
|
||||
{ printf ("\nError : File '%s' has %d channels (should have %d).\n\n", argv [k], sfinfo_in.channels, sfinfo_out.channels) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
if ((outfile = sf_open (outfilename, SFM_WRITE, &sfinfo_out)) == NULL)
|
||||
{ printf ("\nError : Not able to open input file %s.\n", outfilename) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((sfinfo_out.format & SF_FORMAT_SUBMASK) == SF_FORMAT_DOUBLE ||
|
||||
(sfinfo_out.format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT)
|
||||
func = concat_data_fp ;
|
||||
else
|
||||
func = concat_data_int ;
|
||||
|
||||
for (k = 0 ; k < argc ; k++)
|
||||
{ func (outfile, infiles [k], sfinfo_out.channels) ;
|
||||
sf_close (infiles [k]) ;
|
||||
} ;
|
||||
|
||||
sf_close (outfile) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
static void
|
||||
concat_data_fp (SNDFILE *wfile, SNDFILE *rofile, int channels)
|
||||
{ static double data [BUFFER_LEN] ;
|
||||
int frames, readcount ;
|
||||
|
||||
frames = BUFFER_LEN / channels ;
|
||||
readcount = frames ;
|
||||
|
||||
sf_seek (wfile, 0, SEEK_END) ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_double (rofile, data, frames) ;
|
||||
sf_writef_double (wfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* concat_data_fp */
|
||||
|
||||
static void
|
||||
concat_data_int (SNDFILE *wfile, SNDFILE *rofile, int channels)
|
||||
{ static int data [BUFFER_LEN] ;
|
||||
int frames, readcount ;
|
||||
|
||||
frames = BUFFER_LEN / channels ;
|
||||
readcount = frames ;
|
||||
|
||||
sf_seek (wfile, 0, SEEK_END) ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_int (rofile, data, frames) ;
|
||||
sf_writef_int (wfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* concat_data_int */
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
@@ -45,93 +45,18 @@ typedef struct
|
||||
SF_INFO infileinfo, outfileinfo ;
|
||||
} OptionData ;
|
||||
|
||||
typedef struct
|
||||
{ const char *ext ;
|
||||
int len ;
|
||||
int format ;
|
||||
} OUTPUT_FORMAT_MAP ;
|
||||
|
||||
static void copy_metadata (SNDFILE *outfile, SNDFILE *infile) ;
|
||||
|
||||
static OUTPUT_FORMAT_MAP format_map [] =
|
||||
{
|
||||
{ "aif", 3, SF_FORMAT_AIFF },
|
||||
{ "wav", 0, SF_FORMAT_WAV },
|
||||
{ "au", 0, SF_FORMAT_AU },
|
||||
{ "caf", 0, SF_FORMAT_CAF },
|
||||
{ "flac", 0, SF_FORMAT_FLAC },
|
||||
{ "snd", 0, SF_FORMAT_AU },
|
||||
{ "svx", 0, SF_FORMAT_SVX },
|
||||
{ "paf", 0, SF_ENDIAN_BIG | SF_FORMAT_PAF },
|
||||
{ "fap", 0, SF_ENDIAN_LITTLE | SF_FORMAT_PAF },
|
||||
{ "gsm", 0, SF_FORMAT_RAW },
|
||||
{ "nist", 0, SF_FORMAT_NIST },
|
||||
{ "htk", 0, SF_FORMAT_HTK },
|
||||
{ "ircam", 0, SF_FORMAT_IRCAM },
|
||||
{ "sf", 0, SF_FORMAT_IRCAM },
|
||||
{ "voc", 0, SF_FORMAT_VOC },
|
||||
{ "w64", 0, SF_FORMAT_W64 },
|
||||
{ "raw", 0, SF_FORMAT_RAW },
|
||||
{ "mat4", 0, SF_FORMAT_MAT4 },
|
||||
{ "mat5", 0, SF_FORMAT_MAT5 },
|
||||
{ "mat", 0, SF_FORMAT_MAT4 },
|
||||
{ "pvf", 0, SF_FORMAT_PVF },
|
||||
{ "sds", 0, SF_FORMAT_SDS },
|
||||
{ "sd2", 0, SF_FORMAT_SD2 },
|
||||
{ "vox", 0, SF_FORMAT_RAW },
|
||||
{ "xi", 0, SF_FORMAT_XI },
|
||||
{ "wve", 0, SF_FORMAT_WVE },
|
||||
{ "oga", 0, SF_FORMAT_OGG },
|
||||
{ "mpc", 0, SF_FORMAT_MPC2K },
|
||||
{ "rf64", 0, SF_FORMAT_RF64 },
|
||||
} ; /* format_map */
|
||||
|
||||
static int
|
||||
guess_output_file_type (char *str, int format)
|
||||
{ char buffer [16], *cptr ;
|
||||
int k ;
|
||||
|
||||
format &= SF_FORMAT_SUBMASK ;
|
||||
|
||||
if ((cptr = strrchr (str, '.')) == NULL)
|
||||
return 0 ;
|
||||
|
||||
strncpy (buffer, cptr + 1, 15) ;
|
||||
buffer [15] = 0 ;
|
||||
|
||||
for (k = 0 ; buffer [k] ; k++)
|
||||
buffer [k] = tolower ((buffer [k])) ;
|
||||
|
||||
if (strcmp (buffer, "gsm") == 0)
|
||||
return SF_FORMAT_RAW | SF_FORMAT_GSM610 ;
|
||||
|
||||
if (strcmp (buffer, "vox") == 0)
|
||||
return SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
|
||||
|
||||
for (k = 0 ; k < (int) (sizeof (format_map) / sizeof (format_map [0])) ; k++)
|
||||
{ if (format_map [k].len > 0 && strncmp (buffer, format_map [k].ext, format_map [k].len) == 0)
|
||||
return format_map [k].format | format ;
|
||||
else if (strcmp (buffer, format_map [k].ext) == 0)
|
||||
return format_map [k].format | format ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
} /* guess_output_file_type */
|
||||
|
||||
static void copy_metadata (SNDFILE *outfile, SNDFILE *infile, int channels) ;
|
||||
|
||||
static void
|
||||
print_usage (char *progname)
|
||||
{ SF_FORMAT_INFO info ;
|
||||
|
||||
int k ;
|
||||
|
||||
usage_exit (const char *progname)
|
||||
{
|
||||
printf ("\nUsage : %s [options] [encoding] <input file> <output file>\n", progname) ;
|
||||
puts ("\n"
|
||||
" where [option] may be:\n\n"
|
||||
" -override-sample-rate=X : force sample rate of input to X\n\n"
|
||||
" -override-sample-rate=X : force sample rate of input to X\n"
|
||||
) ;
|
||||
|
||||
puts ("\n"
|
||||
puts (
|
||||
" where [encoding] may be one of the following:\n\n"
|
||||
" -pcms8 : force the output to signed 8 bit pcm\n"
|
||||
" -pcmu8 : force the output to unsigned 8 bit pcm\n"
|
||||
@@ -157,28 +82,24 @@ print_usage (char *progname)
|
||||
" output file name. The following extensions are currently understood:\n"
|
||||
) ;
|
||||
|
||||
for (k = 0 ; k < (int) (sizeof (format_map) / sizeof (format_map [0])) ; k++)
|
||||
{ info.format = format_map [k].format ;
|
||||
sf_command (NULL, SFC_GET_FORMAT_INFO, &info, sizeof (info)) ;
|
||||
printf (" %-10s : %s\n", format_map [k].ext, info.name) ;
|
||||
} ;
|
||||
sfe_dump_format_map () ;
|
||||
|
||||
puts ("") ;
|
||||
} /* print_usage */
|
||||
exit (0) ;
|
||||
} /* usage_exit */
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{ char *progname, *infilename, *outfilename ;
|
||||
{ const char *progname, *infilename, *outfilename ;
|
||||
SNDFILE *infile = NULL, *outfile = NULL ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, outfilemajor, outfileminor = 0, infileminor ;
|
||||
int override_sample_rate = 0 ; /* assume no sample rate override. */
|
||||
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
progname = program_name (argv [0]) ;
|
||||
|
||||
if (argc < 3 || argc > 5)
|
||||
{ print_usage (progname) ;
|
||||
{ usage_exit (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
@@ -187,19 +108,19 @@ main (int argc, char * argv [])
|
||||
|
||||
if (strcmp (infilename, outfilename) == 0)
|
||||
{ printf ("Error : Input and output filenames are the same.\n\n") ;
|
||||
print_usage (progname) ;
|
||||
usage_exit (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (infilename [0] == '-')
|
||||
if (strlen (infilename) > 1 && infilename [0] == '-')
|
||||
{ printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
|
||||
print_usage (progname) ;
|
||||
usage_exit (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (outfilename [0] == '-')
|
||||
{ printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
|
||||
print_usage (progname) ;
|
||||
usage_exit (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
@@ -277,6 +198,8 @@ main (int argc, char * argv [])
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
if ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)
|
||||
{ printf ("Not able to open input file %s.\n", infilename) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
@@ -289,7 +212,7 @@ main (int argc, char * argv [])
|
||||
|
||||
infileminor = sfinfo.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if ((sfinfo.format = guess_output_file_type (outfilename, sfinfo.format)) == 0)
|
||||
if ((sfinfo.format = sfe_file_type_of_ext (outfilename, sfinfo.format)) == 0)
|
||||
{ printf ("Error : Not able to determine output file type for %s.\n", outfilename) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
@@ -328,7 +251,7 @@ main (int argc, char * argv [])
|
||||
} ;
|
||||
|
||||
/* Copy the metadata */
|
||||
copy_metadata (outfile, infile) ;
|
||||
copy_metadata (outfile, infile, sfinfo.channels) ;
|
||||
|
||||
if ((outfileminor == SF_FORMAT_DOUBLE) || (outfileminor == SF_FORMAT_FLOAT)
|
||||
|| (infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT)
|
||||
@@ -344,11 +267,11 @@ main (int argc, char * argv [])
|
||||
} /* main */
|
||||
|
||||
static void
|
||||
copy_metadata (SNDFILE *outfile, SNDFILE *infile)
|
||||
copy_metadata (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
{ SF_INSTRUMENT inst ;
|
||||
SF_BROADCAST_INFO_2K binfo ;
|
||||
const char *str ;
|
||||
int k, err = 0 ;
|
||||
int k, err = 0, chanmap [256] ;
|
||||
|
||||
for (k = SF_STR_FIRST ; k <= SF_STR_LAST ; k++)
|
||||
{ str = sf_get_string (infile, k) ;
|
||||
@@ -359,6 +282,13 @@ copy_metadata (SNDFILE *outfile, SNDFILE *infile)
|
||||
memset (&inst, 0, sizeof (inst)) ;
|
||||
memset (&binfo, 0, sizeof (binfo)) ;
|
||||
|
||||
if (channels < ARRAY_LEN (chanmap))
|
||||
{ size_t size = channels * sizeof (chanmap [0]) ;
|
||||
|
||||
if (sf_command (infile, SFC_GET_CHANNEL_MAP_INFO, chanmap, size) == SF_TRUE)
|
||||
sf_command (outfile, SFC_SET_CHANNEL_MAP_INFO, chanmap, size) ;
|
||||
} ;
|
||||
|
||||
if (sf_command (infile, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
|
||||
sf_command (outfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) ;
|
||||
|
||||
|
194
lib-src/libsndfile/programs/sndfile-deinterleave.c
Normal file
194
lib-src/libsndfile/programs/sndfile-deinterleave.c
Normal file
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
** Copyright (C) 2009-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 <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN 4096
|
||||
#define MAX_CHANNELS 16
|
||||
|
||||
|
||||
typedef struct
|
||||
{ SNDFILE * infile ;
|
||||
SNDFILE * outfile [MAX_CHANNELS] ;
|
||||
|
||||
union
|
||||
{ double d [MAX_CHANNELS * BUFFER_LEN] ;
|
||||
int i [MAX_CHANNELS * BUFFER_LEN] ;
|
||||
} din ;
|
||||
|
||||
union
|
||||
{ double d [BUFFER_LEN] ;
|
||||
int i [BUFFER_LEN] ;
|
||||
} dout ;
|
||||
|
||||
int channels ;
|
||||
} STATE ;
|
||||
|
||||
static void usage_exit (void) ;
|
||||
|
||||
static void deinterleave_int (STATE * state) ;
|
||||
static void deinterleave_double (STATE * state) ;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{ STATE state ;
|
||||
SF_INFO sfinfo ;
|
||||
char pathname [512], ext [32], *cptr ;
|
||||
int ch, double_split ;
|
||||
|
||||
if (argc != 2)
|
||||
{ if (argc != 1)
|
||||
puts ("\nError : need a single input file.\n") ;
|
||||
usage_exit () ;
|
||||
} ;
|
||||
|
||||
memset (&state, 0, sizeof (state)) ;
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
if ((state.infile = sf_open (argv [1], SFM_READ, &sfinfo)) == NULL)
|
||||
{ printf ("\nError : Not able to open input file '%s'\n%s\n", argv [1], sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.channels < 2)
|
||||
{ printf ("\nError : Input file '%s' only has one channel.\n", argv [1]) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
state.channels = sfinfo.channels ;
|
||||
sfinfo.channels = 1 ;
|
||||
|
||||
snprintf (pathname, sizeof (pathname), "%s", argv [1]) ;
|
||||
if ((cptr = strrchr (pathname, '.')) == NULL)
|
||||
ext [0] = 0 ;
|
||||
else
|
||||
{ snprintf (ext, sizeof (ext), "%s", cptr) ;
|
||||
cptr [0] = 0 ;
|
||||
} ;
|
||||
|
||||
printf ("Input file : %s\n", pathname) ;
|
||||
puts ("Output files :") ;
|
||||
|
||||
for (ch = 0 ; ch < state.channels ; ch++)
|
||||
{ char filename [520] ;
|
||||
|
||||
snprintf (filename, sizeof (filename), "%s_%02d%s", pathname, ch, ext) ;
|
||||
|
||||
if ((state.outfile [ch] = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
|
||||
{ printf ("Not able to open output file '%s'\n%s\n", filename, sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
printf (" %s\n", filename) ;
|
||||
} ;
|
||||
|
||||
switch (sfinfo.format & SF_FORMAT_SUBMASK)
|
||||
{ case SF_FORMAT_FLOAT :
|
||||
case SF_FORMAT_DOUBLE :
|
||||
case SF_FORMAT_VORBIS :
|
||||
double_split = 1 ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
double_split = 0 ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
if (double_split)
|
||||
deinterleave_double (&state) ;
|
||||
else
|
||||
deinterleave_int (&state) ;
|
||||
|
||||
sf_close (state.infile) ;
|
||||
for (ch = 0 ; ch < MAX_CHANNELS ; ch++)
|
||||
if (state.outfile [ch] != NULL)
|
||||
sf_close (state.outfile [ch]) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void
|
||||
usage_exit (void)
|
||||
{ puts ("\nUsage : sndfile-deinterleave <filename>\n") ;
|
||||
puts (
|
||||
"Split a mutli-channel file into a set of mono files.\n"
|
||||
"\n"
|
||||
"If the input file is named 'a.wav', the output files will be named\n"
|
||||
"a_00.wav, a_01.wav and so on.\n"
|
||||
) ;
|
||||
printf ("Using %s.\n\n", sf_version_string ()) ;
|
||||
exit (0) ;
|
||||
} /* usage_exit */
|
||||
|
||||
static void
|
||||
deinterleave_int (STATE * state)
|
||||
{ int read_len ;
|
||||
int ch, k ;
|
||||
|
||||
do
|
||||
{ read_len = sf_readf_int (state->infile, state->din.i, BUFFER_LEN) ;
|
||||
|
||||
for (ch = 0 ; ch < state->channels ; ch ++)
|
||||
{ for (k = 0 ; k < read_len ; k++)
|
||||
state->dout.i [k] = state->din.i [k * state->channels + ch] ;
|
||||
sf_write_int (state->outfile [ch], state->dout.i, read_len) ;
|
||||
} ;
|
||||
}
|
||||
while (read_len > 0) ;
|
||||
|
||||
} /* deinterleave_int */
|
||||
|
||||
static void
|
||||
deinterleave_double (STATE * state)
|
||||
{ int read_len ;
|
||||
int ch, k ;
|
||||
|
||||
do
|
||||
{ read_len = sf_readf_double (state->infile, state->din.d, BUFFER_LEN) ;
|
||||
|
||||
for (ch = 0 ; ch < state->channels ; ch ++)
|
||||
{ for (k = 0 ; k < read_len ; k++)
|
||||
state->dout.d [k] = state->din.d [k * state->channels + ch] ;
|
||||
sf_write_double (state->outfile [ch], state->dout.d, read_len) ;
|
||||
} ;
|
||||
}
|
||||
while (read_len > 0) ;
|
||||
|
||||
} /* deinterleave_double */
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
@@ -45,15 +45,15 @@
|
||||
|
||||
#if (defined (WIN32) || defined (_WIN32))
|
||||
#include <windows.h>
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
static void print_version (void) ;
|
||||
static void print_usage (const char *progname) ;
|
||||
static void usage_exit (const char *progname) ;
|
||||
|
||||
static void info_dump (const char *filename) ;
|
||||
static int instrument_dump (const char *filename) ;
|
||||
static int broadcast_dump (const char *filename) ;
|
||||
static int chanmap_dump (const char *filename) ;
|
||||
static void total_dump (void) ;
|
||||
|
||||
static double total_seconds = 0.0 ;
|
||||
@@ -65,12 +65,7 @@ main (int argc, char *argv [])
|
||||
print_version () ;
|
||||
|
||||
if (argc < 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
|
||||
{ char *progname ;
|
||||
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
|
||||
print_usage (progname) ;
|
||||
{ usage_exit (program_name (argv [0])) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
@@ -90,6 +85,14 @@ main (int argc, char *argv [])
|
||||
return error ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [1], "-c") == 0)
|
||||
{ int error = 0 ;
|
||||
|
||||
for (k = 2 ; k < argc ; k++)
|
||||
error += chanmap_dump (argv [k]) ;
|
||||
return error ;
|
||||
} ;
|
||||
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
info_dump (argv [k]) ;
|
||||
|
||||
@@ -115,7 +118,7 @@ print_version (void)
|
||||
|
||||
|
||||
static void
|
||||
print_usage (const char *progname)
|
||||
usage_exit (const char *progname)
|
||||
{ printf ("Usage :\n %s <file> ...\n", progname) ;
|
||||
printf (" Prints out information about one or more sound files.\n\n") ;
|
||||
printf (" %s -i <file>\n", progname) ;
|
||||
@@ -135,7 +138,9 @@ print_usage (const char *progname)
|
||||
*/
|
||||
Sleep (5 * 1000) ;
|
||||
#endif
|
||||
} /* print_usage */
|
||||
printf ("Using %s.\n\n", sf_version_string ()) ;
|
||||
exit (0) ;
|
||||
} /* usage_exit */
|
||||
|
||||
/*==============================================================================
|
||||
** Dumping of sndfile info.
|
||||
@@ -247,29 +252,26 @@ info_dump (const char *filename)
|
||||
puts (strbuffer) ;
|
||||
printf ("----------------------------------------\n") ;
|
||||
|
||||
if (file == NULL)
|
||||
{ printf ("Error : Not able to open input file %s.\n", filename) ;
|
||||
fflush (stdout) ;
|
||||
memset (data, 0, sizeof (data)) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
}
|
||||
else
|
||||
{ printf ("Sample Rate : %d\n", sfinfo.samplerate) ;
|
||||
printf ("Frames : %" PRId64 "\n", sfinfo.frames) ;
|
||||
printf ("Channels : %d\n", sfinfo.channels) ;
|
||||
printf ("Format : 0x%08X\n", sfinfo.format) ;
|
||||
printf ("Sections : %d\n", sfinfo.sections) ;
|
||||
printf ("Seekable : %s\n", (sfinfo.seekable ? "TRUE" : "FALSE")) ;
|
||||
printf ("Duration : %s\n", generate_duration_str (&sfinfo)) ;
|
||||
printf ("Sample Rate : %d\n", sfinfo.samplerate) ;
|
||||
|
||||
if (sfinfo.frames < 100 * 1024 * 1024)
|
||||
{ /* Do not use sf_signal_max because it doesn't work for non-seekable files . */
|
||||
signal_max = get_signal_max (file) ;
|
||||
decibels = calc_decibels (&sfinfo, signal_max) ;
|
||||
printf ("Signal Max : %g (%4.2f dB)\n", signal_max, decibels) ;
|
||||
} ;
|
||||
putchar ('\n') ;
|
||||
if (sfinfo.frames == SF_COUNT_MAX)
|
||||
printf ("Frames : unknown\n") ;
|
||||
else
|
||||
printf ("Frames : %" PRId64 "\n", sfinfo.frames) ;
|
||||
|
||||
printf ("Channels : %d\n", sfinfo.channels) ;
|
||||
printf ("Format : 0x%08X\n", sfinfo.format) ;
|
||||
printf ("Sections : %d\n", sfinfo.sections) ;
|
||||
printf ("Seekable : %s\n", (sfinfo.seekable ? "TRUE" : "FALSE")) ;
|
||||
printf ("Duration : %s\n", generate_duration_str (&sfinfo)) ;
|
||||
|
||||
if (sfinfo.frames < 100 * 1024 * 1024)
|
||||
{ /* Do not use sf_signal_max because it doesn't work for non-seekable files . */
|
||||
signal_max = get_signal_max (file) ;
|
||||
decibels = calc_decibels (&sfinfo, signal_max) ;
|
||||
printf ("Signal Max : %g (%4.2f dB)\n", signal_max, decibels) ;
|
||||
} ;
|
||||
putchar ('\n') ;
|
||||
|
||||
sf_close (file) ;
|
||||
|
||||
@@ -387,6 +389,82 @@ broadcast_dump (const char *filename)
|
||||
return 0 ;
|
||||
} /* broadcast_dump */
|
||||
|
||||
static int
|
||||
chanmap_dump (const char *filename)
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
int * channel_map ;
|
||||
int got_chanmap, k ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
|
||||
{ printf ("Error : Not able to open input file %s.\n", filename) ;
|
||||
fflush (stdout) ;
|
||||
memset (data, 0, sizeof (data)) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((channel_map = calloc (sfinfo.channels, sizeof (int))) == NULL)
|
||||
{ printf ("Error : malloc failed.\n\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
got_chanmap = sf_command (file, SFC_GET_CHANNEL_MAP_INFO, channel_map, sfinfo.channels * sizeof (int)) ;
|
||||
sf_close (file) ;
|
||||
|
||||
if (got_chanmap == SF_FALSE)
|
||||
{ printf ("Error : File '%s' does not contain channel map information.\n\n", filename) ;
|
||||
free (channel_map) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
printf ("File : %s\n\n", filename) ;
|
||||
|
||||
puts (" Chan Position") ;
|
||||
for (k = 0 ; k < sfinfo.channels ; k ++)
|
||||
{ const char * name ;
|
||||
|
||||
#define CASE_NAME(x) case x : name = #x ; break ;
|
||||
switch (channel_map [k])
|
||||
{ CASE_NAME (SF_CHANNEL_MAP_INVALID) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_MONO) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_LEFT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_RIGHT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_CENTER) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_FRONT_LEFT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_FRONT_RIGHT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_FRONT_CENTER) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_REAR_CENTER) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_REAR_LEFT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_REAR_RIGHT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_LFE) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_SIDE_LEFT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_SIDE_RIGHT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_TOP_CENTER) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_TOP_FRONT_LEFT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_TOP_FRONT_RIGHT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_TOP_FRONT_CENTER) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_TOP_REAR_LEFT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_TOP_REAR_RIGHT) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_TOP_REAR_CENTER) ;
|
||||
CASE_NAME (SF_CHANNEL_MAP_MAX) ;
|
||||
default : name = "default" ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
printf (" %3d %s\n", k, name) ;
|
||||
} ;
|
||||
|
||||
putchar ('\n') ;
|
||||
free (channel_map) ;
|
||||
|
||||
return 0 ;
|
||||
} /* chanmap_dump */
|
||||
|
||||
static void
|
||||
total_dump (void)
|
||||
{ printf ("========================================\n") ;
|
||||
|
202
lib-src/libsndfile/programs/sndfile-interleave.c
Normal file
202
lib-src/libsndfile/programs/sndfile-interleave.c
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
** Copyright (C) 2009-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 <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN 4096
|
||||
#define MAX_INPUTS 16
|
||||
|
||||
|
||||
typedef struct
|
||||
{ SNDFILE * infile [MAX_INPUTS] ;
|
||||
SNDFILE * outfile ;
|
||||
|
||||
union
|
||||
{ double d [BUFFER_LEN] ;
|
||||
int i [BUFFER_LEN] ;
|
||||
} din ;
|
||||
|
||||
union
|
||||
|
||||
{ double d [MAX_INPUTS * BUFFER_LEN] ;
|
||||
int i [MAX_INPUTS * BUFFER_LEN] ;
|
||||
} dout ;
|
||||
|
||||
int channels ;
|
||||
} STATE ;
|
||||
|
||||
|
||||
static void usage_exit (void) ;
|
||||
static void interleave_int (STATE * state) ;
|
||||
static void interleave_double (STATE * state) ;
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{ STATE state ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, double_merge = 0 ;
|
||||
|
||||
if (argc < 5)
|
||||
{ if (argc > 1)
|
||||
puts ("\nError : need at least 2 input files.") ;
|
||||
usage_exit () ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [argc - 2], "-o") != 0)
|
||||
{ puts ("\nError : second last command line parameter should be '-o'.\n") ;
|
||||
usage_exit () ;
|
||||
} ;
|
||||
|
||||
if (argc - 2 > MAX_INPUTS)
|
||||
{ printf ("\nError : Cannot handle more than %d input channels.\n\n", MAX_INPUTS) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
memset (&state, 0, sizeof (state)) ;
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
for (k = 1 ; k < argc - 2 ; k++)
|
||||
{
|
||||
if ((state.infile [k - 1] = sf_open (argv [k], SFM_READ, &sfinfo)) == NULL)
|
||||
{ printf ("\nError : Not able to open input file '%s'\n%s\n", argv [k], sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.channels != 1)
|
||||
{ printf ("\bError : Input file '%s' should be mono (has %d channels).\n", argv [k], sfinfo.channels) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
switch (sfinfo.format & SF_FORMAT_SUBMASK)
|
||||
{ case SF_FORMAT_FLOAT :
|
||||
case SF_FORMAT_DOUBLE :
|
||||
case SF_FORMAT_VORBIS :
|
||||
double_merge = 1 ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
break ;
|
||||
} ;
|
||||
|
||||
state.channels ++ ;
|
||||
} ;
|
||||
|
||||
sfinfo.channels = state.channels ;
|
||||
sfinfo.format = sfe_file_type_of_ext (argv [argc - 1], sfinfo.format) ;
|
||||
|
||||
if ((state.outfile = sf_open (argv [argc - 1], SFM_WRITE, &sfinfo)) == NULL)
|
||||
{ printf ("Not able to open output file '%s'\n%s\n", argv [argc - 1], sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (double_merge)
|
||||
interleave_double (&state) ;
|
||||
else
|
||||
interleave_int (&state) ;
|
||||
|
||||
for (k = 0 ; k < MAX_INPUTS ; k++)
|
||||
if (state.infile [k] != NULL)
|
||||
sf_close (state.infile [k]) ;
|
||||
sf_close (state.outfile) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
static void
|
||||
usage_exit (void)
|
||||
{ puts ("\nUsage : sndfile-interleave <input 1> <input 2> ... -o <output file>\n") ;
|
||||
puts ("Merge two or more mono files into a single multi-channel file.\n") ;
|
||||
printf ("Using %s.\n\n", sf_version_string ()) ;
|
||||
exit (0) ;
|
||||
} /* usage_exit */
|
||||
|
||||
|
||||
static void
|
||||
interleave_int (STATE * state)
|
||||
{ int max_read_len, read_len ;
|
||||
int ch, k ;
|
||||
|
||||
do
|
||||
{ max_read_len = 0 ;
|
||||
|
||||
for (ch = 0 ; ch < state->channels ; ch ++)
|
||||
{ read_len = sf_read_int (state->infile [ch], state->din.i, BUFFER_LEN) ;
|
||||
if (read_len < BUFFER_LEN)
|
||||
memset (state->din.i + read_len, 0, sizeof (state->din.i [0]) * (BUFFER_LEN - read_len)) ;
|
||||
|
||||
for (k = 0 ; k < read_len ; k++)
|
||||
state->dout.i [k * state->channels + ch] = state->din.i [k] ;
|
||||
|
||||
max_read_len = MAX (max_read_len, read_len) ;
|
||||
} ;
|
||||
|
||||
sf_writef_int (state->outfile, state->dout.i, max_read_len) ;
|
||||
}
|
||||
while (max_read_len > 0) ;
|
||||
|
||||
} /* interleave_int */
|
||||
|
||||
|
||||
static void
|
||||
interleave_double (STATE * state)
|
||||
{ int max_read_len, read_len ;
|
||||
int ch, k ;
|
||||
|
||||
do
|
||||
{ max_read_len = 0 ;
|
||||
|
||||
for (ch = 0 ; ch < state->channels ; ch ++)
|
||||
{ read_len = sf_read_double (state->infile [ch], state->din.d, BUFFER_LEN) ;
|
||||
if (read_len < BUFFER_LEN)
|
||||
memset (state->din.d + read_len, 0, sizeof (state->din.d [0]) * (BUFFER_LEN - read_len)) ;
|
||||
|
||||
for (k = 0 ; k < read_len ; k++)
|
||||
state->dout.d [k * state->channels + ch] = state->din.d [k] ;
|
||||
|
||||
max_read_len = MAX (max_read_len, read_len) ;
|
||||
} ;
|
||||
|
||||
sf_writef_double (state->outfile, state->dout.d, max_read_len) ;
|
||||
}
|
||||
while (max_read_len > 0) ;
|
||||
|
||||
} /* interleave_double */
|
@@ -1,277 +0,0 @@
|
||||
/*
|
||||
** Copyright (C) 2007 Jonatan Liljedahl <lijon@kymatica.com>
|
||||
**
|
||||
** This program is free software ; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation ; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY ; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program ; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_JACK
|
||||
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <jack/jack.h>
|
||||
#include <jack/ringbuffer.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define RB_SIZE (1 << 16)
|
||||
|
||||
typedef struct _thread_info
|
||||
{ pthread_t thread_id ;
|
||||
SNDFILE *sndfile ;
|
||||
jack_nframes_t pos ;
|
||||
jack_client_t *client ;
|
||||
unsigned int channels ;
|
||||
volatile int can_process ;
|
||||
volatile int read_done ;
|
||||
volatile int play_done ;
|
||||
} thread_info_t ;
|
||||
|
||||
pthread_mutex_t disk_thread_lock = PTHREAD_MUTEX_INITIALIZER ;
|
||||
pthread_cond_t data_ready = PTHREAD_COND_INITIALIZER ;
|
||||
|
||||
static jack_ringbuffer_t *ringbuf ;
|
||||
static jack_port_t **output_port ;
|
||||
static jack_default_audio_sample_t ** outs ;
|
||||
const size_t sample_size = sizeof (jack_default_audio_sample_t) ;
|
||||
|
||||
static int
|
||||
process (jack_nframes_t nframes, void * arg)
|
||||
{
|
||||
thread_info_t *info = (thread_info_t *) arg ;
|
||||
jack_default_audio_sample_t buf [info->channels] ;
|
||||
unsigned i, n ;
|
||||
|
||||
if (! info->can_process)
|
||||
return 0 ;
|
||||
|
||||
for (n = 0 ; n < info->channels ; n++)
|
||||
outs [n] = jack_port_get_buffer (output_port [n], nframes) ;
|
||||
|
||||
for (i = 0 ; i < nframes ; i++)
|
||||
{ size_t read_cnt ;
|
||||
|
||||
/* Read one frame of audio. */
|
||||
read_cnt = jack_ringbuffer_read (ringbuf, (void*) buf, sample_size*info->channels) ;
|
||||
if (read_cnt == 0 && info->read_done)
|
||||
{ /* File is done, so stop the main loop. */
|
||||
info->play_done = 1 ;
|
||||
return 0 ;
|
||||
} ;
|
||||
|
||||
/* Update play-position counter. */
|
||||
info->pos += read_cnt / (sample_size*info->channels) ;
|
||||
|
||||
/* Output each channel of the frame. */
|
||||
for (n = 0 ; n < info->channels ; n++)
|
||||
outs [n][i] = buf [n] ;
|
||||
} ;
|
||||
|
||||
/* Wake up the disk thread to read more data. */
|
||||
if (pthread_mutex_trylock (&disk_thread_lock) == 0)
|
||||
{ pthread_cond_signal (&data_ready) ;
|
||||
pthread_mutex_unlock (&disk_thread_lock) ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
} /* process */
|
||||
|
||||
static void *
|
||||
disk_thread (void *arg)
|
||||
{ thread_info_t *info = (thread_info_t *) arg ;
|
||||
sf_count_t buf_avail, read_frames ;
|
||||
jack_ringbuffer_data_t vec [2] ;
|
||||
size_t bytes_per_frame = sample_size*info->channels ;
|
||||
|
||||
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL) ;
|
||||
pthread_mutex_lock (&disk_thread_lock) ;
|
||||
|
||||
while (1)
|
||||
{ jack_ringbuffer_get_write_vector (ringbuf, vec) ;
|
||||
|
||||
read_frames = 0 ;
|
||||
|
||||
if (vec [0].len)
|
||||
{ /* Fill the first part of the ringbuffer. */
|
||||
buf_avail = vec [0].len / bytes_per_frame ;
|
||||
read_frames = sf_readf_float (info->sndfile, (float *) vec [0].buf, buf_avail) ;
|
||||
if (vec [1].len)
|
||||
{ /* Fill the second part of the ringbuffer? */
|
||||
buf_avail = vec [1].len / bytes_per_frame ;
|
||||
read_frames += sf_readf_float (info->sndfile, (float *) vec [1].buf, buf_avail) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
if (read_frames == 0)
|
||||
break ; /* end of file? */
|
||||
|
||||
jack_ringbuffer_write_advance (ringbuf, read_frames * bytes_per_frame) ;
|
||||
|
||||
/* Tell process that we've filled the ringbuffer. */
|
||||
info->can_process = 1 ;
|
||||
|
||||
/* Wait for the process thread to wake us up. */
|
||||
pthread_cond_wait (&data_ready, &disk_thread_lock) ;
|
||||
} ;
|
||||
|
||||
/* Tell that we're done reading the file. */
|
||||
info->read_done = 1 ;
|
||||
pthread_mutex_unlock (&disk_thread_lock) ;
|
||||
|
||||
return 0 ;
|
||||
} /* disk_thread */
|
||||
|
||||
static void
|
||||
jack_shutdown (void *arg)
|
||||
{ (void) arg ;
|
||||
exit (1) ;
|
||||
} /* jack_shutdown */
|
||||
|
||||
static void
|
||||
print_time (jack_nframes_t pos, int jack_sr)
|
||||
{ float sec = pos / (1.0 * jack_sr) ;
|
||||
int min = sec / 60.0 ;
|
||||
fprintf (stderr, "%02d:%05.2f", min, fmod (sec, 60.0)) ;
|
||||
} /* print_time */
|
||||
|
||||
int
|
||||
main (int narg, char * args [])
|
||||
{
|
||||
SNDFILE *sndfile ;
|
||||
SF_INFO sndfileinfo ;
|
||||
jack_client_t *client ;
|
||||
thread_info_t info ;
|
||||
int i, jack_sr ;
|
||||
|
||||
if (narg < 2)
|
||||
{ fprintf (stderr, "no soundfile given\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
// create jack client
|
||||
if ((client = jack_client_new ("jackplay")) == 0)
|
||||
{
|
||||
fprintf (stderr, "Jack server not running?\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
jack_sr = jack_get_sample_rate (client) ;
|
||||
|
||||
/* Open the soundfile. */
|
||||
sndfileinfo.format = 0 ;
|
||||
sndfile = sf_open (args [1], SFM_READ, &sndfileinfo) ;
|
||||
if (sndfile == NULL)
|
||||
{ fprintf (stderr, "Could not open soundfile '%s'\n", args [1]) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
fprintf (stderr, "Channels : %d\nSample rate : %d Hz\nDuration : ", sndfileinfo.channels, sndfileinfo.samplerate) ;
|
||||
|
||||
print_time (sndfileinfo.frames, sndfileinfo.samplerate) ;
|
||||
fprintf (stderr, "\n") ;
|
||||
|
||||
if (sndfileinfo.samplerate != jack_sr)
|
||||
fprintf (stderr, "Warning: samplerate of soundfile (%d Hz) does not match jack server (%d Hz).\n", sndfileinfo.samplerate, jack_sr) ;
|
||||
|
||||
/* Init the thread info struct. */
|
||||
memset (&info, 0, sizeof (info)) ;
|
||||
info.can_process = 0 ;
|
||||
info.read_done = 0 ;
|
||||
info.play_done = 0 ;
|
||||
info.sndfile = sndfile ;
|
||||
info.channels = sndfileinfo.channels ;
|
||||
info.client = client ;
|
||||
info.pos = 0 ;
|
||||
|
||||
/* Set up callbacks. */
|
||||
jack_set_process_callback (client, process, &info) ;
|
||||
jack_on_shutdown (client, jack_shutdown, 0) ;
|
||||
|
||||
/* Allocate output ports. */
|
||||
output_port = calloc (sndfileinfo.channels, sizeof (jack_port_t *)) ;
|
||||
outs = calloc (sndfileinfo.channels, sizeof (jack_default_audio_sample_t *)) ;
|
||||
for (i = 0 ; i < sndfileinfo.channels ; i++)
|
||||
{ char name [16] ;
|
||||
|
||||
snprintf (name, sizeof (name), "out_%d", i + 1) ;
|
||||
output_port [i] = jack_port_register (client, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0) ;
|
||||
} ;
|
||||
|
||||
/* Allocate and clear ringbuffer. */
|
||||
ringbuf = jack_ringbuffer_create (sizeof (jack_default_audio_sample_t) * RB_SIZE) ;
|
||||
memset (ringbuf->buf, 0, ringbuf->size) ;
|
||||
|
||||
/* Activate client. */
|
||||
if (jack_activate (client))
|
||||
{ fprintf (stderr, "Cannot activate client.\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
/* Auto connect all channels. */
|
||||
for (i = 0 ; i < sndfileinfo.channels ; i++)
|
||||
{ char name [64] ;
|
||||
|
||||
snprintf (name, sizeof (name), "alsa_pcm:playback_%d", i + 1) ;
|
||||
|
||||
if (jack_connect (client, jack_port_name (output_port [i]), name))
|
||||
fprintf (stderr, "Cannot connect output port %d (%s).\n", i, name) ;
|
||||
} ;
|
||||
|
||||
/* Start the disk thread. */
|
||||
pthread_create (&info.thread_id, NULL, disk_thread, &info) ;
|
||||
|
||||
/* Sit in a loop, displaying the current play position. */
|
||||
while (! info.play_done)
|
||||
{ fprintf (stderr, "\r-> ") ;
|
||||
print_time (info.pos, jack_sr) ;
|
||||
fflush (stdout) ;
|
||||
usleep (50000) ;
|
||||
} ;
|
||||
|
||||
/* Clean up. */
|
||||
jack_client_close (client) ;
|
||||
jack_ringbuffer_free (ringbuf) ;
|
||||
sf_close (sndfile) ;
|
||||
free (outs) ;
|
||||
free (output_port) ;
|
||||
|
||||
puts ("") ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
#else
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
puts (
|
||||
"Sorry this program was compiled without libjack (which probably\n"
|
||||
"only exists on Linux and Mac OSX) and hence doesn't work."
|
||||
) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
#endif
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Copyright (C) 2008 George Blood Audio
|
||||
** Written by Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2008-2010 George Blood Audio
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
@@ -59,8 +58,7 @@ main (int argc, char *argv [])
|
||||
int start ;
|
||||
|
||||
/* Store the program name. */
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
progname = program_name (argv [0]) ;
|
||||
|
||||
/* Check if we've been asked for help. */
|
||||
if (argc <= 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
|
||||
@@ -124,6 +122,7 @@ usage_exit (const char *progname, int exit_code)
|
||||
" --str-license Print the license metadata.\n"
|
||||
) ;
|
||||
|
||||
printf ("Using %s.\n\n", sf_version_string ()) ;
|
||||
exit (exit_code) ;
|
||||
} /* usage_exit */
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Copyright (C) 2008 George Blood Audio
|
||||
** Written by Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2008-2010 George Blood Audio
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
@@ -61,8 +60,7 @@ main (int argc, char *argv [])
|
||||
int k ;
|
||||
|
||||
/* Store the program name. */
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
progname = program_name (argv [0]) ;
|
||||
|
||||
/* Check if we've been asked for help. */
|
||||
if (argc < 3 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
|
||||
@@ -104,6 +102,7 @@ main (int argc, char *argv [])
|
||||
HANDLE_BEXT_ARG ("--bext-orig-date", origination_date) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-time", origination_time) ;
|
||||
HANDLE_BEXT_ARG ("--bext-coding-hist", coding_history) ;
|
||||
HANDLE_BEXT_ARG ("--bext-time-ref", time_ref) ;
|
||||
|
||||
#define HANDLE_STR_ARG(cmd,field) \
|
||||
if (strcmp (argv [k], cmd) == 0) \
|
||||
@@ -113,6 +112,7 @@ main (int argc, char *argv [])
|
||||
continue ; \
|
||||
} ;
|
||||
|
||||
HANDLE_STR_ARG ("--str-comment", comment) ;
|
||||
HANDLE_STR_ARG ("--str-title", title) ;
|
||||
HANDLE_STR_ARG ("--str-copyright", copyright) ;
|
||||
HANDLE_STR_ARG ("--str-artist", artist) ;
|
||||
@@ -207,8 +207,10 @@ usage_exit (const char *progname, int exit_code)
|
||||
" --bext-umid Set the 'bext' UMID.\n"
|
||||
" --bext-orig-date Set the 'bext' origination date.\n"
|
||||
" --bext-orig-time Set the 'bext' origination time.\n"
|
||||
" --bext-coding-hist Set the 'bext' coding history\n"
|
||||
" --bext-coding-hist Set the 'bext' coding history.\n"
|
||||
" --bext-time-raf Set the 'bext' Time ref.\n"
|
||||
"\n"
|
||||
" --str-comment Set the metadata comment.\n"
|
||||
" --str-title Set the metadata title.\n"
|
||||
" --str-copyright Set the metadata copyright.\n"
|
||||
" --str-artist Set the metadata artist.\n"
|
||||
@@ -232,6 +234,7 @@ usage_exit (const char *progname, int exit_code)
|
||||
"exit with an appropriate error message.\n"
|
||||
) ;
|
||||
|
||||
printf ("Using %s.\n\n", sf_version_string ()) ;
|
||||
exit (exit_code) ;
|
||||
} /* usage_exit */
|
||||
|
||||
@@ -251,7 +254,7 @@ has_bext_fields_set (const METADATA_INFO * info)
|
||||
if (info->description || info->originator || info->originator_reference)
|
||||
return 1 ;
|
||||
|
||||
if (info->origination_date || info->origination_time || info->umid || info->coding_history)
|
||||
if (info->origination_date || info->origination_time || info->umid || info->coding_history || info->time_ref)
|
||||
return 1 ;
|
||||
|
||||
return 0 ;
|
||||
@@ -260,18 +263,20 @@ has_bext_fields_set (const METADATA_INFO * info)
|
||||
static void
|
||||
read_localtime (struct tm * timedata)
|
||||
{ time_t current ;
|
||||
struct tm *tmptr ;
|
||||
|
||||
time (¤t) ;
|
||||
memset (timedata, 0, sizeof (struct tm)) ;
|
||||
|
||||
#if defined (HAVE_LOCALTIME_R)
|
||||
/* If the re-entrant version is available, use it. */
|
||||
tmptr = localtime_r (¤t, timedata) ;
|
||||
localtime_r (¤t, timedata) ;
|
||||
#elif defined (HAVE_LOCALTIME)
|
||||
/* Otherwise use the standard one and copy the data to local storage. */
|
||||
tmptr = localtime (¤t) ;
|
||||
memcpy (timedata, tmptr, sizeof (struct tm)) ;
|
||||
{
|
||||
struct tm *tmptr ;
|
||||
/* Otherwise use the standard one and copy the data to local storage. */
|
||||
if ((tmptr = localtime (¤t)) != NULL)
|
||||
memcpy (timedata, tmptr, sizeof (struct tm)) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
@@ -41,6 +41,10 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#if HAVE_ALSA_ASOUNDLIB_H
|
||||
#define ALSA_PCM_NEW_HW_PARAMS_API
|
||||
#define ALSA_PCM_NEW_SW_PARAMS_API
|
||||
@@ -48,7 +52,7 @@
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if defined (__linux__)
|
||||
#if defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/soundcard.h>
|
||||
@@ -57,6 +61,9 @@
|
||||
#include <Carbon.h>
|
||||
#include <CoreAudio/AudioHardware.h>
|
||||
|
||||
#elif defined (HAVE_SNDIO_H)
|
||||
#include <sndio.h>
|
||||
|
||||
#elif (defined (sun) && defined (unix))
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
@@ -68,8 +75,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define SIGNED_SIZEOF(x) ((int) sizeof (x))
|
||||
#define BUFFER_LEN (2048)
|
||||
|
||||
@@ -348,12 +353,12 @@ alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels)
|
||||
** Linux/OSS functions for playing a sound.
|
||||
*/
|
||||
|
||||
#if defined (__linux__)
|
||||
#if defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
|
||||
|
||||
static int linux_open_dsp_device (int channels, int srate) ;
|
||||
static int opensoundsys_open_device (int channels, int srate) ;
|
||||
|
||||
static void
|
||||
linux_play (int argc, char *argv [])
|
||||
opensoundsys_play (int argc, char *argv [])
|
||||
{ static short buffer [BUFFER_LEN] ;
|
||||
SNDFILE *sndfile ;
|
||||
SF_INFO sfinfo ;
|
||||
@@ -373,7 +378,7 @@ linux_play (int argc, char *argv [])
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
audio_device = linux_open_dsp_device (sfinfo.channels, sfinfo.samplerate) ;
|
||||
audio_device = opensoundsys_open_device (sfinfo.channels, sfinfo.samplerate) ;
|
||||
|
||||
subformat = sfinfo.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
@@ -411,53 +416,53 @@ linux_play (int argc, char *argv [])
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* linux_play */
|
||||
} /* opensoundsys_play */
|
||||
|
||||
static int
|
||||
linux_open_dsp_device (int channels, int srate)
|
||||
opensoundsys_open_device (int channels, int srate)
|
||||
{ int fd, stereo, fmt ;
|
||||
|
||||
if ((fd = open ("/dev/dsp", O_WRONLY, 0)) == -1 &&
|
||||
(fd = open ("/dev/sound/dsp", O_WRONLY, 0)) == -1)
|
||||
{ perror ("linux_open_dsp_device : open ") ;
|
||||
{ perror ("opensoundsys_open_device : open ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
stereo = 0 ;
|
||||
if (ioctl (fd, SNDCTL_DSP_STEREO, &stereo) == -1)
|
||||
{ /* Fatal error */
|
||||
perror ("linux_open_dsp_device : stereo ") ;
|
||||
perror ("opensoundsys_open_device : stereo ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (ioctl (fd, SNDCTL_DSP_RESET, 0))
|
||||
{ perror ("linux_open_dsp_device : reset ") ;
|
||||
{ perror ("opensoundsys_open_device : reset ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
fmt = CPU_IS_BIG_ENDIAN ? AFMT_S16_BE : AFMT_S16_LE ;
|
||||
if (ioctl (fd, SNDCTL_DSP_SETFMT, &fmt) != 0)
|
||||
{ perror ("linux_open_dsp_device : set format ") ;
|
||||
{ perror ("opensoundsys_open_device : set format ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (ioctl (fd, SNDCTL_DSP_CHANNELS, &channels) != 0)
|
||||
{ perror ("linux_open_dsp_device : channels ") ;
|
||||
{ perror ("opensoundsys_open_device : channels ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (ioctl (fd, SNDCTL_DSP_SPEED, &srate) != 0)
|
||||
{ perror ("linux_open_dsp_device : sample rate ") ;
|
||||
{ perror ("opensoundsys_open_device : sample rate ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (ioctl (fd, SNDCTL_DSP_SYNC, 0) != 0)
|
||||
{ perror ("linux_open_dsp_device : sync ") ;
|
||||
{ perror ("opensoundsys_open_device : sync ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
return fd ;
|
||||
} /* linux_open_dsp_device */
|
||||
} /* opensoundsys_open_device */
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
@@ -819,6 +824,66 @@ win32_play (int argc, char *argv [])
|
||||
|
||||
#endif /* Win32 */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** OpenBDS's sndio.
|
||||
*/
|
||||
|
||||
#if defined (HAVE_SNDIO_H)
|
||||
|
||||
static void
|
||||
sndio_play (int argc, char *argv [])
|
||||
{ struct sio_hdl *hdl ;
|
||||
struct sio_par par ;
|
||||
short buffer [BUFFER_LEN] ;
|
||||
SNDFILE *sndfile ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, readcount ;
|
||||
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
{ printf ("Playing %s\n", argv [k]) ;
|
||||
if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
|
||||
{ puts (sf_strerror (NULL)) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.channels < 1 || sfinfo.channels > 2)
|
||||
{ printf ("Error : channels = %d.\n", sfinfo.channels) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if ((hdl = sio_open (NULL, SIO_PLAY, 0)) == NULL)
|
||||
{ fprintf (stderr, "open sndio device failed") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
sio_initpar (&par) ;
|
||||
par.rate = sfinfo.samplerate ;
|
||||
par.pchan = sfinfo.channels ;
|
||||
par.bits = 16 ;
|
||||
par.sig = 1 ;
|
||||
par.le = SIO_LE_NATIVE ;
|
||||
|
||||
if (! sio_setpar (hdl, &par) || ! sio_getpar (hdl, &par))
|
||||
{ fprintf (stderr, "set sndio params failed") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
if (! sio_start (hdl))
|
||||
{ fprintf (stderr, "sndio start failed") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
while ((readcount = sf_read_short (sndfile, buffer, BUFFER_LEN)))
|
||||
sio_write (hdl, buffer, readcount * sizeof (short)) ;
|
||||
|
||||
sio_close (hdl) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* sndio_play */
|
||||
|
||||
#endif /* sndio */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Solaris.
|
||||
*/
|
||||
@@ -914,17 +979,13 @@ main (int argc, char *argv [])
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
printf ("\nUsage : %s <input sound file>\n\n", argv [0]) ;
|
||||
printf ("\nUsage : %s <input sound file>\n\n", program_name (argv [0])) ;
|
||||
printf (" Using %s.\n\n", sf_version_string ()) ;
|
||||
#if (OS_IS_WIN32 == 1)
|
||||
printf ("This is a Unix style command line application which\n"
|
||||
"should be run in a MSDOS box or Command Shell window.\n\n") ;
|
||||
printf ("Sleeping for 5 seconds before exiting.\n\n") ;
|
||||
|
||||
/* This is the officially blessed by microsoft way but I can't get
|
||||
** it to link.
|
||||
** Sleep (15) ;
|
||||
** Instead, use this:
|
||||
*/
|
||||
Sleep (5 * 1000) ;
|
||||
#endif
|
||||
return 1 ;
|
||||
@@ -936,9 +997,13 @@ main (int argc, char *argv [])
|
||||
alsa_play (argc, argv) ;
|
||||
else
|
||||
#endif
|
||||
linux_play (argc, argv) ;
|
||||
opensoundsys_play (argc, argv) ;
|
||||
#elif defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
|
||||
opensoundsys_play (argc, argv) ;
|
||||
#elif (defined (__MACH__) && defined (__APPLE__))
|
||||
macosx_play (argc, argv) ;
|
||||
#elif defined HAVE_SNDIO_H
|
||||
sndio_play (argc, argv) ;
|
||||
#elif (defined (sun) && defined (unix))
|
||||
solaris_play (argc, argv) ;
|
||||
#elif (OS_IS_WIN32 == 1)
|
||||
|
277
lib-src/libsndfile/programs/sndfile-salvage.c
Normal file
277
lib-src/libsndfile/programs/sndfile-salvage.c
Normal file
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
** Copyright (C) 2010-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 <inttypes.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN (1 << 16)
|
||||
|
||||
#define NOT(x) (! (x))
|
||||
|
||||
|
||||
static void usage_exit (const char *progname) ;
|
||||
static void salvage_file (const char * broken_wav, const char * fixed_w64) ;
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
if (argc != 3)
|
||||
usage_exit (program_name (argv [0])) ;
|
||||
|
||||
salvage_file (argv [1], argv [2]) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
static void lseek_or_die (int fd, off_t offset, int whence) ;
|
||||
static sf_count_t get_file_length (int fd, const char * name) ;
|
||||
static sf_count_t find_data_offset (int fd, int format) ;
|
||||
static void copy_data (int fd, SNDFILE * sndfile, int readsize) ;
|
||||
|
||||
|
||||
static void
|
||||
usage_exit (const char *progname)
|
||||
{ printf ("Usage :\n\n %s <broken wav file> <fixed w64 file>\n\n", progname) ;
|
||||
puts ("Salvages the audio data from WAV files which are more than 4G in length.\n") ;
|
||||
printf ("Using %s.\n\n", sf_version_string ()) ;
|
||||
exit (0) ;
|
||||
} /* usage_exit */
|
||||
|
||||
static void
|
||||
salvage_file (const char * broken_wav, const char * fixed_w64)
|
||||
{ SNDFILE * sndfile ;
|
||||
SF_INFO sfinfo ;
|
||||
sf_count_t broken_len, data_offset ;
|
||||
int fd, read_size ;
|
||||
|
||||
if (strcmp (broken_wav, fixed_w64) == 0)
|
||||
{ printf ("Error : Input and output files must be different.\n\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((fd = open (broken_wav, O_RDONLY)) < 0)
|
||||
{ printf ("Error : Not able to open file '%s' : %s\n", broken_wav, strerror (errno)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
broken_len = get_file_length (fd, broken_wav) ;
|
||||
if (broken_len <= 0xffffffff)
|
||||
printf ("File is not greater than 4Gig but salvaging anyway.\n") ;
|
||||
|
||||
/* Grab the format info from the broken file. */
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
if ((sndfile = sf_open (broken_wav, SFM_READ, &sfinfo)) == NULL)
|
||||
{ printf ("sf_open ('%s') failed : %s\n", broken_wav, sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
sf_close (sndfile) ;
|
||||
|
||||
data_offset = find_data_offset (fd, sfinfo.format & SF_FORMAT_TYPEMASK) ;
|
||||
|
||||
printf ("Offset to audio data : %" PRId64 "\n", data_offset) ;
|
||||
|
||||
switch (sfinfo.format & SF_FORMAT_TYPEMASK)
|
||||
{ case SF_FORMAT_WAV :
|
||||
case SF_FORMAT_WAVEX :
|
||||
sfinfo.format = SF_FORMAT_W64 | (sfinfo.format & SF_FORMAT_SUBMASK) ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
printf ("Don't currently support this file type.\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
switch (sfinfo.format & SF_FORMAT_SUBMASK)
|
||||
{ case SF_FORMAT_PCM_U8 :
|
||||
case SF_FORMAT_PCM_S8 :
|
||||
read_size = 1 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_PCM_16 :
|
||||
read_size = 2 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_PCM_24 :
|
||||
read_size = 3 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_PCM_32 :
|
||||
case SF_FORMAT_FLOAT :
|
||||
read_size = 4 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_DOUBLE :
|
||||
read_size = 8 ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
printf ("Sorry, don't currently support this file encoding type.\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
read_size *= sfinfo.channels ;
|
||||
|
||||
if ((sndfile = sf_open (fixed_w64, SFM_WRITE, &sfinfo)) == NULL)
|
||||
{ printf ("sf_open ('%s') failed : %s\n", broken_wav, sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
lseek_or_die (fd, data_offset, SEEK_SET) ;
|
||||
|
||||
copy_data (fd, sndfile, read_size) ;
|
||||
|
||||
sf_close (sndfile) ;
|
||||
|
||||
puts ("Done!") ;
|
||||
} /* salvage_file */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static void
|
||||
lseek_or_die (int fd, off_t offset, int whence)
|
||||
{
|
||||
if (lseek (fd, offset, whence) < 0)
|
||||
{ printf ("lseek failed : %s\n", strerror (errno)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* lseek_or_die */
|
||||
|
||||
|
||||
static sf_count_t
|
||||
get_file_length (int fd, const char * name)
|
||||
{ struct stat sbuf ;
|
||||
|
||||
if (sizeof (sbuf.st_size) != 8)
|
||||
{ puts ("Error : sizeof (sbuf.st_size) != 8. Was program compiled with\n"
|
||||
" 64 bit file offsets?\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (fstat (fd, &sbuf) != 0)
|
||||
{ printf ("Error : fstat ('%s') failed : %s\n", name, strerror (errno)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
return sbuf.st_size ;
|
||||
} /* get_file_length */
|
||||
|
||||
static sf_count_t
|
||||
find_data_offset (int fd, int format)
|
||||
{ char buffer [8192], *cptr ;
|
||||
const char * target = "XXXX" ;
|
||||
sf_count_t offset = -1, extra ;
|
||||
int rlen, slen ;
|
||||
|
||||
switch (format)
|
||||
{ case SF_FORMAT_WAV :
|
||||
case SF_FORMAT_WAVEX :
|
||||
target = "data" ;
|
||||
extra = 8 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_AIFF :
|
||||
target = "SSND" ;
|
||||
extra = 16 ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
puts ("Error : Sorry, don't handle this input file format.\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
slen = strlen (target) ;
|
||||
|
||||
lseek_or_die (fd, 0, SEEK_SET) ;
|
||||
|
||||
printf ("Searching for '%s' maker.\n", target) ;
|
||||
|
||||
if ((rlen = read (fd, buffer, sizeof (buffer))) < 0)
|
||||
{ printf ("Error : failed read : %s\n", strerror (errno)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
cptr = memchr (buffer, target [0], rlen - slen) ;
|
||||
if (cptr && memcmp (cptr, target, slen) == 0)
|
||||
offset = cptr - buffer ;
|
||||
else
|
||||
{ printf ("Error : Could not find data offset.\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
return offset + extra ;
|
||||
} /* find_data_offset */
|
||||
|
||||
static void
|
||||
copy_data (int fd, SNDFILE * sndfile, int readsize)
|
||||
{ static char * buffer ;
|
||||
sf_count_t readlen, count ;
|
||||
int bufferlen, done = 0 ;
|
||||
|
||||
bufferlen = readsize * 1024 ;
|
||||
buffer = malloc (bufferlen) ;
|
||||
|
||||
while (NOT (done) && (readlen = read (fd, buffer, bufferlen)) >= 0)
|
||||
{ if (readlen < bufferlen)
|
||||
{ readlen -= readlen % readsize ;
|
||||
done = 1 ;
|
||||
} ;
|
||||
|
||||
if ((count = sf_write_raw (sndfile, buffer, readlen)) != readlen)
|
||||
{ printf ("Error : sf_write_raw returned %" PRId64 " : %s\n", count, sf_strerror (sndfile)) ;
|
||||
return ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
free (buffer) ;
|
||||
|
||||
return ;
|
||||
} /* copy_data */
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2008 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
# Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -176,7 +176,8 @@ test_post_mod (tests)
|
||||
|
||||
test_update ([ ("--str-artist", "Fox") ])
|
||||
|
||||
test_coding_history ()
|
||||
# This never worked.
|
||||
# test_coding_history ()
|
||||
|
||||
test_rewrite ()
|
||||
|
||||
|
Reference in New Issue
Block a user