libsndfile: update to 1.0.19 (LBSNDF-7)
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-0186 http://www.mega-nerd.com/libsndfile/libsndfile-1.0.19.tar.gz This will likely require a fresh boostrap to updated source checkouts. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13415 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d875d23de5
commit
77fab7603a
|
@ -1,14 +1,14 @@
|
|||
The main author of libsndfile is Erik de Castro Lopo <erikd@mega-nerd.com>.
|
||||
The main author of libsndfile is Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
apart from code in the following directories:
|
||||
|
||||
The code in the src/GSM610 directory was written by Jutta Degener
|
||||
<jutta@cs.tu-berlin.de> and Carsten Bormann <cabo@cs.tu-berlin.de>.
|
||||
They should not be contacted in relation to libsndfile or the GSM 6.10 code
|
||||
that is part of libsndfile. Their original code can be found at:
|
||||
- src/GSM610 : Written by Jutta Degener <jutta@cs.tu-berlin.de> and Carsten
|
||||
Bormann <cabo@cs.tu-berlin.de>. They should not be contacted in relation to
|
||||
libsndfile or the GSM 6.10 code that is part of libsndfile. Their original
|
||||
code can be found at:
|
||||
|
||||
http://kbs.cs.tu-berlin.de/~jutta/toast.html
|
||||
|
||||
Code in the src/G72x directory was released by Sun Microsystems, Inc. to the
|
||||
public domain. Minor modifications were required to integrate these files
|
||||
into libsndfile. The changes are listed in src/G72x/ChangeLog.
|
||||
http://kbs.cs.tu-berlin.de/~jutta/toast.html
|
||||
|
||||
- src/G72x : Released by Sun Microsystems, Inc. to the public domain. Minor
|
||||
modifications were required to integrate these files into libsndfile. The
|
||||
changes are listed in src/G72x/ChangeLog.
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,5 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
EXTRA_DIST = add_cflags.m4 clip_mode.m4 endian.m4 extra_largefile.m4 \
|
||||
flexible_array.m4 llrint.m4 lrint.m4 lrintf.m4 octave.m4 extra_pkg.m4
|
||||
|
|
@ -0,0 +1,394 @@
|
|||
# Makefile.in generated by automake 1.10.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.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = M4
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/M4/add_cflags.m4 \
|
||||
$(top_srcdir)/M4/add_cxxflags.m4 $(top_srcdir)/M4/clip_mode.m4 \
|
||||
$(top_srcdir)/M4/endian.m4 $(top_srcdir)/M4/extra_largefile.m4 \
|
||||
$(top_srcdir)/M4/extra_pkg.m4 \
|
||||
$(top_srcdir)/M4/flexible_array.m4 \
|
||||
$(top_srcdir)/M4/gcc_version.m4 $(top_srcdir)/M4/libtool.m4 \
|
||||
$(top_srcdir)/M4/lrint.m4 $(top_srcdir)/M4/lrintf.m4 \
|
||||
$(top_srcdir)/M4/ltoptions.m4 $(top_srcdir)/M4/ltsugar.m4 \
|
||||
$(top_srcdir)/M4/ltversion.m4 $(top_srcdir)/M4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/M4/mkoctfile_version.m4 \
|
||||
$(top_srcdir)/M4/octave.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILER_IS_GCC = @COMPILER_IS_GCC@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
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@
|
||||
FGREP = @FGREP@
|
||||
FLAC_CFLAGS = @FLAC_CFLAGS@
|
||||
FLAC_LIBS = @FLAC_LIBS@
|
||||
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
|
||||
GCC_MINOR_VERSION = @GCC_MINOR_VERSION@
|
||||
GCC_VERSION = @GCC_VERSION@
|
||||
GETCONF = @GETCONF@
|
||||
GREP = @GREP@
|
||||
HAVE_AUTOGEN = @HAVE_AUTOGEN@
|
||||
HAVE_JACK = @HAVE_JACK@
|
||||
HAVE_MKOCTFILE = @HAVE_MKOCTFILE@
|
||||
HAVE_OCTAVE = @HAVE_OCTAVE@
|
||||
HAVE_OCTAVE_CONFIG = @HAVE_OCTAVE_CONFIG@
|
||||
HAVE_WINE = @HAVE_WINE@
|
||||
HTML_BGCOLOUR = @HTML_BGCOLOUR@
|
||||
HTML_FGCOLOUR = @HTML_FGCOLOUR@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
JACK_CFLAGS = @JACK_CFLAGS@
|
||||
JACK_LIBS = @JACK_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MKOCTFILE = @MKOCTFILE@
|
||||
MKOCTFILE_VERSION = @MKOCTFILE_VERSION@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OCTAVE = @OCTAVE@
|
||||
OCTAVE_CONFIG = @OCTAVE_CONFIG@
|
||||
OCTAVE_CONFIG_VERSION = @OCTAVE_CONFIG_VERSION@
|
||||
OCTAVE_DEST_MDIR = @OCTAVE_DEST_MDIR@
|
||||
OCTAVE_DEST_ODIR = @OCTAVE_DEST_ODIR@
|
||||
OCTAVE_VERSION = @OCTAVE_VERSION@
|
||||
OGG_CFLAGS = @OGG_CFLAGS@
|
||||
OGG_LIBS = @OGG_LIBS@
|
||||
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
|
||||
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SF_COUNT_MAX = @SF_COUNT_MAX@
|
||||
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
|
||||
SHELL = @SHELL@
|
||||
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
|
||||
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
|
||||
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
|
||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STRIP = @STRIP@
|
||||
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
|
||||
VERSION = @VERSION@
|
||||
VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
|
||||
VORBISENC_LIBS = @VORBISENC_LIBS@
|
||||
VORBIS_CFLAGS = @VORBIS_CFLAGS@
|
||||
VORBIS_LIBS = @VORBIS_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
htmldocdir = @htmldocdir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
EXTRA_DIST = add_cflags.m4 clip_mode.m4 endian.m4 extra_largefile.m4 \
|
||||
flexible_array.m4 llrint.m4 lrint.m4 lrintf.m4 octave.m4 extra_pkg.m4
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu M4/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu M4/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
distclean distclean-generic distclean-libtool distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,17 @@
|
|||
dnl @synopsis AC_ADD_CFLAGS
|
||||
dnl
|
||||
dnl Add the given option to CFLAGS, if it doesn't break the compiler
|
||||
|
||||
AC_DEFUN([AC_ADD_CFLAGS],
|
||||
[AC_MSG_CHECKING([if $CC accepts $1])
|
||||
ac_add_cflags__old_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $1"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
],
|
||||
[puts("Hello, World!"); return 0;],
|
||||
AC_MSG_RESULT([yes]),
|
||||
AC_MSG_RESULT([no])
|
||||
CFLAGS="$ac_add_cflags__old_cflags"
|
||||
)
|
||||
])# AC_ADD_CFLAGS
|
|
@ -0,0 +1,17 @@
|
|||
dnl @synopsis AC_ADD_CXXFLAGS
|
||||
dnl
|
||||
dnl Add the given option to CXXFLAGS, if it doesn't break the compiler
|
||||
|
||||
AC_DEFUN([AC_ADD_CXXFLAGS],
|
||||
[AC_MSG_CHECKING([if $CXX accepts $1])
|
||||
ac_add_cxxflags__old_cxxflags="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $1"
|
||||
AC_TRY_LINK([
|
||||
#include <cstdio>
|
||||
],
|
||||
[puts("Hello, World!"); return 0;],
|
||||
AC_MSG_RESULT([yes]),
|
||||
AC_MSG_RESULT([no])
|
||||
CXXFLAGS="$ac_add_cxxflags__old_cxxflags"
|
||||
)
|
||||
])# AC_ADD_CXXFLAGS
|
|
@ -0,0 +1,124 @@
|
|||
dnl @synopsis AC_C_CLIP_MODE
|
||||
dnl
|
||||
dnl Determine the clipping mode when converting float to int.
|
||||
dnl @version 1.0 May 17 2003
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dnl Find the clipping mode in the following way:
|
||||
dnl 1) If we are not cross compiling test it.
|
||||
dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
|
||||
|
||||
AC_DEFUN([AC_C_CLIP_MODE],
|
||||
[AC_CACHE_CHECK(processor clipping capabilities,
|
||||
ac_cv_c_clip_type,
|
||||
|
||||
# Initialize to unknown
|
||||
ac_cv_c_clip_positive=unknown
|
||||
ac_cv_c_clip_negative=unknown
|
||||
|
||||
|
||||
if test $ac_cv_c_clip_positive = unknown ; then
|
||||
AC_TRY_RUN(
|
||||
[[
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = 1.0 * 0x7FFFFFFF ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != 127)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
]],
|
||||
ac_cv_c_clip_positive=yes,
|
||||
ac_cv_c_clip_positive=no,
|
||||
ac_cv_c_clip_positive=unknown
|
||||
)
|
||||
|
||||
AC_TRY_RUN(
|
||||
[[
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = -8.0 * 0x10000000 ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != -128)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
]],
|
||||
ac_cv_c_clip_negative=yes,
|
||||
ac_cv_c_clip_negative=no,
|
||||
ac_cv_c_clip_negative=unknown
|
||||
)
|
||||
fi
|
||||
|
||||
if test $ac_cv_c_clip_positive = yes ; then
|
||||
ac_cv_c_clip_positive=1
|
||||
else
|
||||
ac_cv_c_clip_positive=0
|
||||
fi
|
||||
|
||||
if test $ac_cv_c_clip_negative = yes ; then
|
||||
ac_cv_c_clip_negative=1
|
||||
else
|
||||
ac_cv_c_clip_negative=0
|
||||
fi
|
||||
|
||||
[[
|
||||
case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
|
||||
"00")
|
||||
ac_cv_c_clip_type="none"
|
||||
;;
|
||||
"10")
|
||||
ac_cv_c_clip_type="positive"
|
||||
;;
|
||||
"01")
|
||||
ac_cv_c_clip_type="negative"
|
||||
;;
|
||||
"11")
|
||||
ac_cv_c_clip_type="both"
|
||||
;;
|
||||
esac
|
||||
]]
|
||||
|
||||
)
|
||||
]
|
||||
|
||||
)# AC_C_CLIP_MODE
|
||||
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
dnl @synopsis AC_C_FIND_ENDIAN
|
||||
dnl
|
||||
dnl Determine endian-ness of target processor.
|
||||
dnl @version 1.1 Mar 03 2002
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Majority written from scratch to replace the standard autoconf macro
|
||||
dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation
|
||||
dnl of the AC_TRY_RUN macro.
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
|
||||
dnl Find endian-ness in the following way:
|
||||
dnl 1) Look in <endian.h>.
|
||||
dnl 2) If 1) fails, look in <sys/types.h> and <sys/param.h>.
|
||||
dnl 3) If 1) and 2) fails and not cross compiling run a test program.
|
||||
dnl 4) If 1) and 2) fails and cross compiling then guess based on target.
|
||||
|
||||
AC_DEFUN([AC_C_FIND_ENDIAN],
|
||||
[AC_CACHE_CHECK(processor byte ordering,
|
||||
ac_cv_c_byte_order,
|
||||
|
||||
# Initialize to unknown
|
||||
ac_cv_c_byte_order=unknown
|
||||
|
||||
if test x$ac_cv_header_endian_h = xyes ; then
|
||||
|
||||
# First try <endian.h> which should set BYTE_ORDER.
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <endian.h>
|
||||
#if BYTE_ORDER != LITTLE_ENDIAN
|
||||
not big endian
|
||||
#endif
|
||||
], return 0 ;,
|
||||
ac_cv_c_byte_order=little
|
||||
)]
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <endian.h>
|
||||
#if BYTE_ORDER != BIG_ENDIAN
|
||||
not big endian
|
||||
#endif
|
||||
], return 0 ;,
|
||||
ac_cv_c_byte_order=big
|
||||
)]
|
||||
|
||||
fi
|
||||
|
||||
if test $ac_cv_c_byte_order = unknown ; then
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
|
||||
bogus endian macros
|
||||
#endif
|
||||
], return 0 ;,
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#if BYTE_ORDER != LITTLE_ENDIAN
|
||||
not big endian
|
||||
#endif
|
||||
], return 0 ;,
|
||||
ac_cv_c_byte_order=little
|
||||
)]
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#if BYTE_ORDER != LITTLE_ENDIAN
|
||||
not big endian
|
||||
#endif
|
||||
], return 0 ;,
|
||||
ac_cv_c_byte_order=little
|
||||
)]
|
||||
|
||||
)]
|
||||
|
||||
fi
|
||||
|
||||
if test $ac_cv_c_byte_order = unknown ; then
|
||||
if test $cross_compiling = yes ; then
|
||||
# This is the last resort. Try to guess the target processor endian-ness
|
||||
# by looking at the target CPU type.
|
||||
[
|
||||
case "$target_cpu" in
|
||||
alpha* | i?86* | mipsel* | ia64*)
|
||||
ac_cv_c_big_endian=0
|
||||
ac_cv_c_little_endian=1
|
||||
;;
|
||||
|
||||
m68* | mips* | powerpc* | hppa* | sparc*)
|
||||
ac_cv_c_big_endian=1
|
||||
ac_cv_c_little_endian=0
|
||||
;;
|
||||
|
||||
esac
|
||||
]
|
||||
else
|
||||
AC_TRY_RUN(
|
||||
[[
|
||||
int main (void)
|
||||
{ /* Are we little or big endian? From Harbison&Steele. */
|
||||
union
|
||||
{ long l ;
|
||||
char c [sizeof (long)] ;
|
||||
} u ;
|
||||
u.l = 1 ;
|
||||
return (u.c [sizeof (long) - 1] == 1);
|
||||
}
|
||||
]], , ac_cv_c_byte_order=big,
|
||||
ac_cv_c_byte_order=unknown
|
||||
)
|
||||
|
||||
AC_TRY_RUN(
|
||||
[[int main (void)
|
||||
{ /* Are we little or big endian? From Harbison&Steele. */
|
||||
union
|
||||
{ long l ;
|
||||
char c [sizeof (long)] ;
|
||||
} u ;
|
||||
u.l = 1 ;
|
||||
return (u.c [0] == 1);
|
||||
}]], , ac_cv_c_byte_order=little,
|
||||
ac_cv_c_byte_order=unknown
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
)
|
||||
|
||||
if test $ac_cv_c_byte_order = big ; then
|
||||
ac_cv_c_big_endian=1
|
||||
ac_cv_c_little_endian=0
|
||||
elif test $ac_cv_c_byte_order = little ; then
|
||||
ac_cv_c_big_endian=0
|
||||
ac_cv_c_little_endian=1
|
||||
else
|
||||
ac_cv_c_big_endian=0
|
||||
ac_cv_c_little_endian=0
|
||||
|
||||
AC_MSG_WARN([[*****************************************************************]])
|
||||
AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]])
|
||||
AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]])
|
||||
AC_MSG_WARN([[*** src/config.h may need to be hand editied. ]])
|
||||
AC_MSG_WARN([[*****************************************************************]])
|
||||
fi
|
||||
|
||||
]
|
||||
)# AC_C_FIND_ENDIAN
|
||||
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
dnl By default, many hosts won't let programs access large files;
|
||||
dnl one must use special compiler options to get large-file access to work.
|
||||
dnl For more details about this brain damage please see:
|
||||
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
|
||||
|
||||
dnl Written by Paul Eggert <eggert@twinsun.com>.
|
||||
|
||||
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
||||
dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS],
|
||||
[AC_CACHE_CHECK([for $1 value to request large file support],
|
||||
ac_cv_sys_largefile_$1,
|
||||
[ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
|
||||
ac_cv_sys_largefile_$1=no
|
||||
ifelse($1, CFLAGS,
|
||||
[case "$host_os" in
|
||||
# IRIX 6.2 and later require cc -n32.
|
||||
changequote(, )dnl
|
||||
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
|
||||
changequote([, ])dnl
|
||||
if test "$GCC" != yes; then
|
||||
ac_cv_sys_largefile_CFLAGS=-n32
|
||||
fi
|
||||
ac_save_CC="$CC"
|
||||
CC="$CC $ac_cv_sys_largefile_CFLAGS"
|
||||
AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
|
||||
CC="$ac_save_CC"
|
||||
esac])
|
||||
}])])
|
||||
|
||||
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
||||
dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
|
||||
[case $2 in
|
||||
no) ;;
|
||||
?*)
|
||||
case "[$]$1" in
|
||||
'') $1=$2 ;;
|
||||
*) $1=[$]$1' '$2 ;;
|
||||
esac ;;
|
||||
esac])
|
||||
|
||||
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
||||
dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
|
||||
[AC_CACHE_CHECK([for $1], $2,
|
||||
[$2=no
|
||||
changequote(, )dnl
|
||||
$4
|
||||
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
||||
case "$ac_flag" in
|
||||
-D$1)
|
||||
$2=1 ;;
|
||||
-D$1=*)
|
||||
$2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
|
||||
esac
|
||||
done
|
||||
changequote([, ])dnl
|
||||
])
|
||||
if test "[$]$2" != no; then
|
||||
AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
|
||||
fi])
|
||||
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_ARG_ENABLE(largefile,
|
||||
[ --disable-largefile omit support for large files])
|
||||
if test "$enable_largefile" != no; then
|
||||
AC_CHECK_TOOL(GETCONF, getconf)
|
||||
AC_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
|
||||
AC_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
|
||||
AC_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
|
||||
|
||||
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
||||
case "$ac_flag" in
|
||||
no) ;;
|
||||
-D_FILE_OFFSET_BITS=*) ;;
|
||||
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
|
||||
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
|
||||
-D?* | -I?*)
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
|
||||
*)
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
|
||||
esac
|
||||
done
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
|
||||
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
|
||||
ac_cv_sys_file_offset_bits,
|
||||
[Number of bits in a file offset, on hosts where this is settable.])
|
||||
[case "$host_os" in
|
||||
# HP-UX 10.20 and later
|
||||
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
||||
ac_cv_sys_file_offset_bits=64 ;;
|
||||
esac]
|
||||
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
|
||||
ac_cv_sys_largefile_source,
|
||||
[Define to make fseeko etc. visible, on some hosts.],
|
||||
[case "$host_os" in
|
||||
# HP-UX 10.20 and later
|
||||
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
||||
ac_cv_sys_largefile_source=1 ;;
|
||||
esac])
|
||||
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
|
||||
ac_cv_sys_large_files,
|
||||
[Define for large files, on AIX-style hosts.],
|
||||
[case "$host_os" in
|
||||
# AIX 4.2 and later
|
||||
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
|
||||
ac_cv_sys_large_files=1 ;;
|
||||
esac])
|
||||
fi
|
||||
])
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
# extra_pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (c) 2004 Scott James Remnant <scott@netsplit.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.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# PKG_CHECK_MOD_VERSION(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
# [ACTION-IF-NOT-FOUND])
|
||||
#
|
||||
# This is a very slight modification to the macro PKG_CHECK_MODULES that
|
||||
# is in the original pkg.m4 file. It prints the versions in the checking
|
||||
# message (erikd@mega-nerd.com).
|
||||
|
||||
AC_DEFUN([PKG_CHECK_MOD_VERSION],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
||||
|
||||
pkg_failed=no
|
||||
AC_MSG_CHECKING([for $2 ])
|
||||
|
||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
||||
|
||||
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
||||
and $1[]_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details.])
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
_PKG_SHORT_ERRORS_SUPPORTED
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
|
||||
else
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
||||
|
||||
ifelse([$4], , [AC_MSG_ERROR(dnl
|
||||
[Package requirements ($2) were not met:
|
||||
|
||||
$$1_PKG_ERRORS
|
||||
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
_PKG_TEXT
|
||||
])],
|
||||
[AC_MSG_RESULT([no])
|
||||
$4])
|
||||
elif test $pkg_failed = untried; then
|
||||
ifelse([$4], , [AC_MSG_FAILURE(dnl
|
||||
[The pkg-config script could not be found or is too old. Make sure it
|
||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||
path to pkg-config.
|
||||
|
||||
_PKG_TEXT
|
||||
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
|
||||
[$4])
|
||||
else
|
||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
||||
AC_MSG_RESULT([yes])
|
||||
ifelse([$3], , :, [$3])
|
||||
fi[]dnl
|
||||
])# PKG_CHECK_MOD_VERSION
|
|
@ -0,0 +1,32 @@
|
|||
dnl @synopsis AC_C99_FLEXIBLE_ARRAY
|
||||
dnl
|
||||
dnl Dose the compiler support the 1999 ISO C Standard "stuct hack".
|
||||
dnl @version 1.1 Mar 15 2004
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
|
||||
AC_DEFUN([AC_C99_FLEXIBLE_ARRAY],
|
||||
[AC_CACHE_CHECK(C99 struct flexible array support,
|
||||
ac_cv_c99_flexible_array,
|
||||
|
||||
# Initialize to unknown
|
||||
ac_cv_c99_flexible_array=no
|
||||
|
||||
AC_TRY_LINK([[
|
||||
#include <stdlib.h>
|
||||
typedef struct {
|
||||
int k;
|
||||
char buffer [] ;
|
||||
} MY_STRUCT ;
|
||||
]],
|
||||
[ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
|
||||
ac_cv_c99_flexible_array=yes,
|
||||
ac_cv_c99_flexible_array=no
|
||||
))]
|
||||
) # AC_C99_FLEXIBLE_ARRAY
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
dnl @synopsis AC_GCC_VERSION
|
||||
dnl
|
||||
dnl Find the version of gcc.
|
||||
dnl @version 1.0 Nov 05 2007
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([AC_GCC_VERSION],
|
||||
[
|
||||
if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then
|
||||
|
||||
AC_MSG_CHECKING([for version of $CC])
|
||||
GCC_VERSION=`$CC -dumpversion`
|
||||
AC_MSG_RESULT($GCC_VERSION)
|
||||
|
||||
changequote(,)dnl
|
||||
GCC_MINOR_VERSION=`echo $GCC_VERSION | sed "s/^[0-9]\+\.//" | sed "s/\..*//"`
|
||||
GCC_MAJOR_VERSION=`echo $GCC_VERSION | sed "s/\..*//"`
|
||||
changequote([,])dnl
|
||||
fi
|
||||
|
||||
AC_SUBST(GCC_VERSION)
|
||||
AC_SUBST(GCC_MAJOR_VERSION)
|
||||
AC_SUBST(GCC_MINOR_VERSION)
|
||||
|
||||
])# AC_GCC_VERSION
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,38 @@
|
|||
dnl @synopsis AC_C99_FUNC_LLRINT
|
||||
dnl
|
||||
dnl Check whether C99's llrint function is available.
|
||||
dnl @version 1.1 Sep 30 2002
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
AC_DEFUN([AC_C99_FUNC_LLRINT],
|
||||
[AC_CACHE_CHECK(for llrint,
|
||||
ac_cv_c99_llrint,
|
||||
[
|
||||
llrint_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-lm"
|
||||
AC_TRY_LINK([
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
], int64_t x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
|
||||
|
||||
CFLAGS=$llrint_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_llrint" = yes; then
|
||||
AC_DEFINE(HAVE_LLRINT, 1,
|
||||
[Define if you have C99's llrint function.])
|
||||
fi
|
||||
])# AC_C99_FUNC_LLRINT
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
dnl @synopsis AC_C99_FUNC_LRINT
|
||||
dnl
|
||||
dnl Check whether C99's lrint function is available.
|
||||
dnl @version 1.3 Feb 12 2002
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
AC_DEFUN([AC_C99_FUNC_LRINT],
|
||||
[AC_CACHE_CHECK(for lrint,
|
||||
ac_cv_c99_lrint,
|
||||
[
|
||||
lrint_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-lm"
|
||||
AC_TRY_LINK([
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
|
||||
|
||||
CFLAGS=$lrint_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_lrint" = yes; then
|
||||
AC_DEFINE(HAVE_LRINT, 1,
|
||||
[Define if you have C99's lrint function.])
|
||||
fi
|
||||
])# AC_C99_FUNC_LRINT
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
dnl @synopsis AC_C99_FUNC_LRINTF
|
||||
dnl
|
||||
dnl Check whether C99's lrintf function is available.
|
||||
dnl @version 1.3 Feb 12 2002
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
AC_DEFUN([AC_C99_FUNC_LRINTF],
|
||||
[AC_CACHE_CHECK(for lrintf,
|
||||
ac_cv_c99_lrintf,
|
||||
[
|
||||
lrintf_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-lm"
|
||||
AC_TRY_LINK([
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
|
||||
|
||||
CFLAGS=$lrintf_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_lrintf" = yes; then
|
||||
AC_DEFINE(HAVE_LRINTF, 1,
|
||||
[Define if you have C99's lrintf function.])
|
||||
fi
|
||||
])# AC_C99_FUNC_LRINTF
|
||||
|
|
@ -0,0 +1,368 @@
|
|||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 6 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option `$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl `shared' nor `disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [0], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the `shared' and
|
||||
# `disable-shared' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the `static' and
|
||||
# `disable-static' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the `fast-install'
|
||||
# and `disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
|
||||
for pkg in $enableval; do
|
||||
IFS="$lt_save_ifs"
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$lt_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the `disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the `pic-only' and `no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[pic_mode="$withval"],
|
||||
[pic_mode=default])
|
||||
|
||||
test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the `pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
|
@ -0,0 +1,123 @@
|
|||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59 which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
|
@ -0,0 +1,23 @@
|
|||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# Generated from ltversion.in.
|
||||
|
||||
# serial 3012 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.2.6])
|
||||
m4_define([LT_PACKAGE_REVISION], [1.3012])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.2.6'
|
||||
macro_revision='1.3012'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
|
@ -0,0 +1,92 @@
|
|||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 4 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
|
@ -0,0 +1,38 @@
|
|||
dnl @synopsis AC_MKOCTFILE_VERSION
|
||||
dnl
|
||||
dnl Find the version of mkoctfile.
|
||||
dnl @version 1.0 Aug 23 2007
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([AC_MKOCTFILE_VERSION],
|
||||
[
|
||||
|
||||
|
||||
AC_ARG_WITH(mkoctfile,
|
||||
AC_HELP_STRING([--with-mkoctfile], [choose the mkoctfile version]),
|
||||
[ with_mkoctfile=$withval ])
|
||||
|
||||
test -z "$with_mkoctfile" && with_mkoctfile=mkoctfile
|
||||
|
||||
AC_CHECK_PROG(HAVE_MKOCTFILE,$with_mkoctfile,yes,no)
|
||||
|
||||
if test "x$ac_cv_prog_HAVE_MKOCTFILE" = "xyes" ; then
|
||||
MKOCTFILE=$with_mkoctfile
|
||||
|
||||
AC_MSG_CHECKING([for version of $MKOCTFILE])
|
||||
MKOCTFILE_VERSION=`$with_mkoctfile --version 2>&1 | sed 's/mkoctfile, version //g'`
|
||||
AC_MSG_RESULT($MKOCTFILE_VERSION)
|
||||
fi
|
||||
|
||||
AC_SUBST(MKOCTFILE)
|
||||
AC_SUBST(MKOCTFILE_VERSION)
|
||||
|
||||
])# AC_MKOCTFILE_VERSION
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
dnl Evaluate an expression in octave
|
||||
dnl
|
||||
dnl OCTAVE_EVAL(expr,var) -> var=expr
|
||||
dnl
|
||||
dnl Stolen from octave-forge
|
||||
|
||||
AC_DEFUN([OCTAVE_EVAL],
|
||||
[
|
||||
AC_MSG_CHECKING([for $1 in $OCTAVE])
|
||||
$2=`TERM=;$OCTAVE -qfH --eval "disp($1)"`
|
||||
AC_MSG_RESULT($$2)
|
||||
AC_SUBST($2)
|
||||
]) # OCTAVE_EVAL
|
||||
|
||||
dnl @synopsis AC_OCTAVE_VERSION
|
||||
dnl
|
||||
dnl Find the version of Octave.
|
||||
dnl @version 1.0 Aug 23 2007
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([AC_OCTAVE_VERSION],
|
||||
[
|
||||
|
||||
AC_ARG_WITH(octave,
|
||||
AC_HELP_STRING([--with-octave], [choose the octave version]),
|
||||
[ with_octave=$withval ])
|
||||
|
||||
test -z "$with_octave" && with_octave=octave
|
||||
|
||||
AC_CHECK_PROG(HAVE_OCTAVE,$with_octave,yes,no)
|
||||
|
||||
if test "x$ac_cv_prog_HAVE_OCTAVE" = "xyes" ; then
|
||||
OCTAVE=$with_octave
|
||||
OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION)
|
||||
fi
|
||||
|
||||
AC_SUBST(OCTAVE)
|
||||
AC_SUBST(OCTAVE_VERSION)
|
||||
|
||||
])# AC_OCTAVE_VERSION
|
||||
|
||||
dnl @synopsis AC_OCTAVE_CONFIG_VERSION
|
||||
dnl
|
||||
dnl Find the version of Octave.
|
||||
dnl @version 1.0 Aug 23 2007
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([AC_OCTAVE_CONFIG_VERSION],
|
||||
[
|
||||
|
||||
AC_ARG_WITH(octave-config,
|
||||
AC_HELP_STRING([--with-octave-config], [choose the octave-config version]),
|
||||
[ with_octave_config=$withval ])
|
||||
|
||||
test -z "$with_octave_config" && with_octave_config=octave-config
|
||||
|
||||
AC_CHECK_PROG(HAVE_OCTAVE_CONFIG,$with_octave_config,yes,no)
|
||||
|
||||
if test "x$ac_cv_prog_HAVE_OCTAVE_CONFIG" = "xyes" ; then
|
||||
OCTAVE_CONFIG=$with_octave_config
|
||||
AC_MSG_CHECKING([for version of $OCTAVE_CONFIG])
|
||||
OCTAVE_CONFIG_VERSION=`$OCTAVE_CONFIG --version`
|
||||
AC_MSG_RESULT($OCTAVE_CONFIG_VERSION)
|
||||
fi
|
||||
|
||||
AC_SUBST(OCTAVE_CONFIG)
|
||||
AC_SUBST(OCTAVE_CONFIG_VERSION)
|
||||
|
||||
])# AC_OCTAVE_CONFIG_VERSION
|
||||
|
||||
dnl @synopsis AC_OCTAVE_BUILD
|
||||
dnl
|
||||
dnl Check programs and headers required for building octave plugins.
|
||||
dnl @version 1.0 Aug 23 2007
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
|
||||
|
||||
AC_DEFUN([AC_OCTAVE_BUILD],
|
||||
[
|
||||
|
||||
dnl Default to no.
|
||||
OCTAVE_BUILD=no
|
||||
|
||||
AC_OCTAVE_VERSION
|
||||
AC_MKOCTFILE_VERSION
|
||||
AC_OCTAVE_CONFIG_VERSION
|
||||
|
||||
prog_concat="$ac_cv_prog_HAVE_OCTAVE$ac_cv_prog_HAVE_OCTAVE_CONFIG$ac_cv_prog_HAVE_MKOCTFILE"
|
||||
|
||||
if test "x$prog_concat" = "xyesyesyes" ; then
|
||||
if test "x$OCTAVE_VERSION" != "x$MKOCTFILE_VERSION" ; then
|
||||
AC_MSG_WARN([** Mismatch between versions of octave and mkoctfile. **])
|
||||
AC_MSG_WARN([** Octave libsndfile modules will not be built. **])
|
||||
elif test "x$OCTAVE_VERSION" != "x$OCTAVE_CONFIG_VERSION" ; then
|
||||
AC_MSG_WARN([** Mismatch between versions of octave and octave-config. **])
|
||||
AC_MSG_WARN([** Octave libsndfile modules will not be built. **])
|
||||
else
|
||||
case "$MKOCTFILE_VERSION" in
|
||||
2.*)
|
||||
AC_MSG_WARN([Octave version 2.X is not supported.])
|
||||
;;
|
||||
3.0.*)
|
||||
OCTAVE_DEST_ODIR=`$OCTAVE_CONFIG --oct-site-dir | sed 's%^/usr%${prefix}%'`
|
||||
OCTAVE_DEST_MDIR=`$OCTAVE_CONFIG --m-site-dir | sed 's%^/usr%${prefix}%'`
|
||||
|
||||
OCTAVE_BUILD=yes
|
||||
;;
|
||||
*)
|
||||
AC_MSG_WARN([Octave version $MKOCTFILE_VERSION is not supported.])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_MSG_RESULT([building octave libsndfile module... $OCTAVE_BUILD])
|
||||
fi
|
||||
|
||||
AC_SUBST(OCTAVE_DEST_ODIR)
|
||||
AC_SUBST(OCTAVE_DEST_MDIR)
|
||||
|
||||
AC_SUBST(MKOCTFILE)
|
||||
|
||||
AM_CONDITIONAL(BUILD_OCTAVE_MOD, test "x$OCTAVE_BUILD" = xyes)
|
||||
|
||||
])# AC_OCTAVE_BUILD
|
|
@ -1,28 +1,29 @@
|
|||
# Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = Win32 Octave src
|
||||
# man doc Win32 examples regtest tests
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
EXTRA_DIST = reconfigure.mk acinclude.m4 libsndfile.spec.in \
|
||||
sndfile.pc.in Mingw-make-dist.sh
|
||||
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = sndfile.pc
|
||||
|
||||
m4datadir = $(datadir)/aclocal
|
||||
|
||||
test: check-recursive
|
||||
|
||||
# Target to make autogenerated files.
|
||||
genfiles :
|
||||
(cd src ; make genfiles)
|
||||
(cd tests ; make genfiles)
|
||||
|
||||
|
||||
## Do not edit or modify anything in this comment block.
|
||||
## The arch-tag line is a file identity tag for the GNU Arch
|
||||
## revision control system.
|
||||
##
|
||||
## arch-tag: e40c569e-8020-4e95-b774-6b0703614526
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gcc-werror
|
||||
|
||||
if BUILD_OCTAVE_MOD
|
||||
octave_dir = Octave
|
||||
endif
|
||||
|
||||
SUBDIRS = M4 Win32 src $(octave_dir)
|
||||
#man doc examples regtest tests programs
|
||||
|
||||
DIST_SUBDIRS = M4 man doc Win32 src Octave examples regtest tests programs
|
||||
|
||||
EXTRA_DIST = libsndfile.spec.in sndfile.pc.in Mingw-make-dist.sh
|
||||
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = sndfile.pc
|
||||
|
||||
m4datadir = $(datadir)/aclocal
|
||||
|
||||
test: check-recursive
|
||||
|
||||
# Target to make autogenerated files.
|
||||
genfiles :
|
||||
(cd src ; make genfiles)
|
||||
(cd tests ; make genfiles)
|
||||
|
||||
|
||||
|
|
|
@ -114,9 +114,3 @@ if [ ! -f $ZIPNAME ]; then
|
|||
zip -r $ZIPNAME $INSTALL/
|
||||
fi
|
||||
|
||||
|
||||
# Do not edit or modify anything in this comment block.
|
||||
# The following line is a file identity tag for the GNU Arch
|
||||
# revision control system.
|
||||
#
|
||||
# arch-tag: 3f82cd8a-f800-48d7-9646-2cdcf03c81a0
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
Version 1.0.19 (2009-03-02)
|
||||
* Fix for CVE-2009-0186 (Alin Rad Pop, Secunia Research).
|
||||
* Huge number of minor bug fixes as a result of static analysis.
|
||||
|
||||
Version 1.0.18 (2009-02-07)
|
||||
* Add Ogg/Vorbis support (thanks to John ffitch).
|
||||
* Remove captive FLAC library.
|
||||
* Many new features and bug fixes.
|
||||
* Generate Win32 and Win64 pre-compiled binaries.
|
||||
|
||||
Version 1.0.17 (2006-08-31)
|
||||
* Add sndfile.hh C++ wrapper.
|
||||
* Update Win32 MinGW build instructions.
|
||||
|
|
|
@ -1,14 +1,72 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
EXTRA_DIST = sndfile_load.m sndfile_save.m sndfile_play.m
|
||||
# Prevent any extension.
|
||||
EXEEXT =
|
||||
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
EXTRA_DIST = sndfile_load.m sndfile_save.m sndfile_play.m \
|
||||
octave_test.m octave_test.sh $(oct_module_srcs) PKG_ADD
|
||||
|
||||
octconfigdir = $(exec_prefix)/share/octave/site/m
|
||||
octconfig_DATA = sndfile_load.m sndfile_save.m sndfile_play.m
|
||||
|
||||
|
||||
## Do not edit or modify anything in this comment block.
|
||||
## The arch-tag line is a file identity tag for the GNU Arch
|
||||
## revision control system.
|
||||
##
|
||||
## arch-tag: 56f1645a-3a13-4846-acc7-8b4abf2904ff
|
||||
OCTAVE_DEST_MDIR = @OCTAVE_DEST_MDIR@
|
||||
OCTAVE_DEST_ODIR = @OCTAVE_DEST_ODIR@/sndfile
|
||||
|
||||
OCT_CXXFLAGS = @OCT_CXXFLAGS@
|
||||
OCT_LIB_DIR = @OCT_LIB_DIR@
|
||||
OCT_LIBS = @OCT_LIBS@
|
||||
|
||||
SNDFILEDIR = $(top_builddir)/src
|
||||
INCLUDES = -I$(SNDFILEDIR)
|
||||
|
||||
oct_module_srcs = sndfile.cc
|
||||
oct_module_files = sndfile.oct PKG_ADD
|
||||
|
||||
# Make these noinst so they can be installed manually.
|
||||
noinst_DATA = $(oct_module_files)
|
||||
|
||||
|
||||
# Use Octave's mkoctfile to do all the heavy lifting. Unfortunately, its
|
||||
# a little dumb so we need to guide it carefully.
|
||||
sndfile.oct : sndfile.o
|
||||
$(MKOCTFILE) -v $(INCLUDES) $(top_builddir)/Octave/$+ -L$(SNDFILEDIR)/.libs -L$(SNDFILEDIR) -lsndfile -o $(top_builddir)/Octave/$@
|
||||
|
||||
sndfile.o : sndfile.cc
|
||||
$(MKOCTFILE) -v $(INCLUDES) -c $+ -o $(top_builddir)/Octave/$@
|
||||
|
||||
# Allow for the test being run in the build dir, but the test script
|
||||
# being located in the source dir.
|
||||
check :
|
||||
octave_src_dir=$(srcdir) $(srcdir)/octave_test.sh
|
||||
|
||||
|
||||
# Since the octave modules are installed in a special location, a custom install
|
||||
# and uninstall routine must be specified.
|
||||
install-exec-local : $(oct_module_files)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(OCTAVE_DEST_ODIR)" || $(mkdir_p) "$(DESTDIR)$(OCTAVE_DEST_ODIR)"
|
||||
@list='$(oct_module_files)'; 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) --mode=install $(INSTALL) '$$p' '$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL) "$$p" "$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f" || exit 1; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-local :
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(oct_module_files)'; for p in $$list; do \
|
||||
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " rm -f '$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(OCTAVE_DEST_ODIR)/$$f"; \
|
||||
done
|
||||
|
||||
clean-local :
|
||||
rm -f sndfile.o sndfile.oct
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
autoload ("sfread", "sndfile.oct");
|
||||
autoload ("sfversion", "sndfile.oct");
|
||||
autoload ("sfwrite", "sndfile.oct");
|
|
@ -0,0 +1,56 @@
|
|||
# Copyright (C) 2007 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# These tests are nowhere near comprehensive.
|
||||
|
||||
printf ("\n\n\n\n\n\n\n") ;
|
||||
|
||||
printf (" Running Octave tests : ") ;
|
||||
fflush (stdout) ;
|
||||
|
||||
filename = "whatever" ;
|
||||
srate_out = 32000 ;
|
||||
fmt_out = "wav-float" ;
|
||||
|
||||
t = (2 * pi / srate_out * (0:srate_out-1))' ;
|
||||
data_out = sin (440.0 * t) ;
|
||||
|
||||
# Write out a file.
|
||||
sfwrite (filename, data_out, srate_out, fmt_out) ;
|
||||
|
||||
# Read it back in again.
|
||||
[ data_in, srate_in, fmt_in ] = sfread (filename) ;
|
||||
|
||||
if (srate_in != srate_out)
|
||||
error ("\n\nSample rate mismatch : %d -> %d.\n\n", srate_out, srate_in) ;
|
||||
endif
|
||||
|
||||
# Octave strcmp return 1 for the same.
|
||||
if (strcmp (fmt_in, fmt_out) != 1)
|
||||
error ("\n\nFormat error : '%s' -> '%s'.\n\n", fmt_out, fmt_in) ;
|
||||
endif
|
||||
|
||||
err = max (abs (data_out - data_in)) ;
|
||||
|
||||
if (err > 1e-7)
|
||||
error ("err : %g\n", err) ;
|
||||
endif
|
||||
|
||||
printf ("ok") ;
|
||||
|
||||
printf ("\n\n\n\n\n\n\n") ;
|
||||
|
||||
unlink (filename) ;
|
|
@ -0,0 +1,72 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# Check where we're being run from.
|
||||
if [ -d Octave ]; then
|
||||
cd Octave
|
||||
fi
|
||||
|
||||
# Find libsndfile shared object.
|
||||
libsndfile_lib_location=""
|
||||
|
||||
if [ -f "../src/.libs/libsndfile.so" ]; then
|
||||
libsndfile_lib_location="../src/.libs/"
|
||||
elif [ -f "../src/libsndfile.so" ]; then
|
||||
libsndfile_lib_location="../src/"
|
||||
elif [ -f "../src/.libs/libsndfile.dylib" ]; then
|
||||
libsndfile_lib_location="../src/.libs/"
|
||||
elif [ -f "../src/libsndfile.dylib" ]; then
|
||||
libsndfile_lib_location="../src/"
|
||||
else
|
||||
echo
|
||||
echo
|
||||
echo "Not able to find the libsndfile shared lib we've just built."
|
||||
echo "This may cause the following test to fail."
|
||||
echo
|
||||
echo
|
||||
fi
|
||||
|
||||
libsndfile_lib_location=`(cd $libsndfile_lib_location && pwd)`
|
||||
|
||||
|
||||
# Find sndfile.oct
|
||||
sndfile_oct_location=""
|
||||
|
||||
if [ -f .libs/sndfile.oct ]; then
|
||||
sndfile_oct_location=".libs"
|
||||
elif [ -f sndfile.oct ]; then
|
||||
sndfile_oct_location="."
|
||||
else
|
||||
echo "Not able to find the sndfile.oct binaries we've just built."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case `file -b $sndfile_oct_location/sndfile.oct` in
|
||||
ELF*)
|
||||
;;
|
||||
Mach*)
|
||||
echo "Tests don't work on this platform."
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Not able to find the sndfile.oct binaries we've just built."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Make sure the TERM environment variable doesn't contain anything wrong.
|
||||
unset TERM
|
||||
|
||||
# echo "libsndfile_lib_location : $libsndfile_lib_location"
|
||||
# echo "sndfile_oct_location : $sndfile_oct_location"
|
||||
|
||||
export LD_LIBRARY_PATH="$libsndfile_lib_location:$LD_LIBRARY_PATH"
|
||||
|
||||
octave_src_dir=`(cd $octave_src_dir && pwd)`
|
||||
|
||||
octave_script="$octave_src_dir/octave_test.m"
|
||||
|
||||
(cd $sndfile_oct_location && octave -qH $octave_script)
|
||||
|
||||
|
|
@ -0,0 +1,405 @@
|
|||
/*
|
||||
** Copyright (C) 2007 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <octave/oct.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
|
||||
#define FOUR_GIG (0x100000000LL)
|
||||
#define BUFFER_FRAMES 8192
|
||||
|
||||
|
||||
static int format_of_str (const std::string & fmt) ;
|
||||
static void string_of_format (std::string & fmt, int format) ;
|
||||
|
||||
|
||||
DEFUN_DLD (sfversion, args, nargout ,
|
||||
"-*- texinfo -*-\n\
|
||||
@deftypefn {Loadable Function} {@var{version} =} sfversion ()\n\
|
||||
@cindex Reading sound files\n\
|
||||
Return a string containing the libsndfile version.\n\
|
||||
@seealso{sfread, sfwrite}\n\
|
||||
@end deftypefn")
|
||||
{ char buffer [256] ;
|
||||
octave_value_list retval ;
|
||||
|
||||
/* Bail out if the input parameters are bad. */
|
||||
if (args.length () != 0 || nargout > 1)
|
||||
{ print_usage () ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
|
||||
|
||||
std::string version (buffer) ;
|
||||
|
||||
retval.append (version) ;
|
||||
return retval ;
|
||||
} /* sfversion */
|
||||
|
||||
|
||||
DEFUN_DLD (sfread, args, nargout ,
|
||||
"-*- texinfo -*-\n\
|
||||
@deftypefn {Loadable Function} {@var{data},@var{srate},@var{format} =} sfread (@var{filename})\n\
|
||||
@cindex Reading sound files\n\
|
||||
Read a sound file from disk using libsndfile.\n\
|
||||
@seealso{sfversion, sfwrite}\n\
|
||||
@end deftypefn")
|
||||
{ SNDFILE * file ;
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
octave_value_list retval ;
|
||||
|
||||
int nargin = args.length () ;
|
||||
|
||||
/* Bail out if the input parameters are bad. */
|
||||
if ((nargin != 1) || !args (0) .is_string () || nargout < 1 || nargout > 3)
|
||||
{ print_usage () ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
std::string filename = args (0).string_value () ;
|
||||
|
||||
if ((file = sf_open (filename.c_str (), SFM_READ, &sfinfo)) == NULL)
|
||||
{ error ("sfread: couldn't open file %s : %s", filename.c_str (), sf_strerror (NULL)) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
if (sfinfo.frames > FOUR_GIG)
|
||||
printf ("This is a really huge file (%lld frames).\nYou may run out of memory trying to load it.\n", (long long) sfinfo.frames) ;
|
||||
|
||||
dim_vector dim = dim_vector () ;
|
||||
dim.resize (2) ;
|
||||
dim (0) = sfinfo.frames ;
|
||||
dim (1) = sfinfo.channels ;
|
||||
|
||||
/* Should I be using Matrix instead? */
|
||||
NDArray out (dim, 0.0) ;
|
||||
|
||||
float buffer [BUFFER_FRAMES * sfinfo.channels] ;
|
||||
int readcount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
do
|
||||
{ readcount = sf_readf_float (file, buffer, BUFFER_FRAMES) ;
|
||||
|
||||
/* Make sure we don't read more frames than we allocated. */
|
||||
if (total + readcount > sfinfo.frames)
|
||||
readcount = sfinfo.frames - total ;
|
||||
|
||||
for (int ch = 0 ; ch < sfinfo.channels ; ch++)
|
||||
{ for (int k = 0 ; k < readcount ; k++)
|
||||
out (total + k, ch) = buffer [k * sfinfo.channels + ch] ;
|
||||
} ;
|
||||
|
||||
total += readcount ;
|
||||
} while (readcount > 0 && total < sfinfo.frames) ;
|
||||
|
||||
retval.append (out.squeeze ()) ;
|
||||
|
||||
if (nargout >= 2)
|
||||
retval.append ((octave_uint32) sfinfo.samplerate) ;
|
||||
|
||||
if (nargout >= 3)
|
||||
{ std::string fmt ("") ;
|
||||
string_of_format (fmt, sfinfo.format) ;
|
||||
retval.append (fmt) ;
|
||||
} ;
|
||||
|
||||
/* Clean up. */
|
||||
sf_close (file) ;
|
||||
|
||||
return retval ;
|
||||
} /* sfread */
|
||||
|
||||
DEFUN_DLD (sfwrite, args, nargout ,
|
||||
"-*- texinfo -*-\n\
|
||||
@deftypefn {Function File} sfwrite (@var{filename},@var{data},@var{srate},@var{format})\n\
|
||||
Write a sound file to disk using libsndfile.\n\
|
||||
@seealso{sfread, sfversion}\n\
|
||||
@end deftypefn\n\
|
||||
")
|
||||
{ SNDFILE * file ;
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
octave_value_list retval ;
|
||||
|
||||
int nargin = args.length () ;
|
||||
|
||||
/* Bail out if the input parameters are bad. */
|
||||
if (nargin != 4 || !args (0).is_string () || !args (1).is_real_matrix ()
|
||||
|| !args (2).is_real_scalar () || !args (3).is_string ()
|
||||
|| nargout != 0)
|
||||
{ print_usage () ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
std::string filename = args (0).string_value () ;
|
||||
std::string format = args (3).string_value () ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
sfinfo.format = format_of_str (format) ;
|
||||
if (sfinfo.format == 0)
|
||||
{ error ("Bad format '%s'", format.c_str ()) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
sfinfo.samplerate = lrint (args (2).scalar_value ()) ;
|
||||
if (sfinfo.samplerate < 1)
|
||||
{ error ("Bad sample rate : %d.\n", sfinfo.samplerate) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
Matrix data = args (1).matrix_value () ;
|
||||
long rows = args (1).rows () ;
|
||||
long cols = args (1).columns () ;
|
||||
|
||||
if (cols > rows)
|
||||
{ error ("Audio data should have one column per channel, but supplied data "
|
||||
"has %ld rows and %ld columns.\n", rows, cols) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
sfinfo.channels = cols ;
|
||||
|
||||
if ((file = sf_open (filename.c_str (), SFM_WRITE, &sfinfo)) == NULL)
|
||||
{ error ("Couldn't open file %s : %s", filename.c_str (), sf_strerror (NULL)) ;
|
||||
return retval ;
|
||||
} ;
|
||||
|
||||
float buffer [BUFFER_FRAMES * sfinfo.channels] ;
|
||||
int writecount ;
|
||||
long total = 0 ;
|
||||
|
||||
do
|
||||
{
|
||||
writecount = BUFFER_FRAMES ;
|
||||
|
||||
/* Make sure we don't read more frames than we allocated. */
|
||||
if (total + writecount > rows)
|
||||
writecount = rows - total ;
|
||||
|
||||
for (int ch = 0 ; ch < sfinfo.channels ; ch++)
|
||||
{ for (int k = 0 ; k < writecount ; k++)
|
||||
buffer [k * sfinfo.channels + ch] = data (total + k, ch) ;
|
||||
} ;
|
||||
|
||||
if (writecount > 0)
|
||||
sf_writef_float (file, buffer, writecount) ;
|
||||
|
||||
total += writecount ;
|
||||
} while (writecount > 0 && total < rows) ;
|
||||
|
||||
/* Clean up. */
|
||||
sf_close (file) ;
|
||||
|
||||
return retval ;
|
||||
} /* sfwrite */
|
||||
|
||||
|
||||
static void
|
||||
str_split (const std::string & str, const std::string & delim, std::vector <std::string> & output)
|
||||
{
|
||||
unsigned int offset = 0 ;
|
||||
size_t delim_index = 0 ;
|
||||
|
||||
delim_index = str.find (delim, offset) ;
|
||||
|
||||
while (delim_index != std::string::npos)
|
||||
{
|
||||
output.push_back (str.substr(offset, delim_index - offset)) ;
|
||||
offset += delim_index - offset + delim.length () ;
|
||||
delim_index = str.find (delim, offset) ;
|
||||
}
|
||||
|
||||
output.push_back (str.substr (offset)) ;
|
||||
} /* str_split */
|
||||
|
||||
static int
|
||||
hash_of_str (const std::string & str)
|
||||
{
|
||||
int hash = 0 ;
|
||||
|
||||
for (unsigned k = 0 ; k < str.length () ; k++)
|
||||
hash = (hash * 3) + tolower (str [k]) ;
|
||||
|
||||
return hash ;
|
||||
} /* hash_of_str */
|
||||
|
||||
static int
|
||||
major_format_of_hash (const std::string & str)
|
||||
{ int hash ;
|
||||
|
||||
hash = hash_of_str (str) ;
|
||||
|
||||
switch (hash)
|
||||
{
|
||||
case 0x5c8 : /* 'wav' */ return SF_FORMAT_WAV ;
|
||||
case 0xf84 : /* 'aiff' */ return SF_FORMAT_AIFF ;
|
||||
case 0x198 : /* 'au' */ return SF_FORMAT_AU ;
|
||||
case 0x579 : /* 'paf' */ return SF_FORMAT_PAF ;
|
||||
case 0x5e5 : /* 'svx' */ return SF_FORMAT_SVX ;
|
||||
case 0x1118 : /* 'nist' */ return SF_FORMAT_NIST ;
|
||||
case 0x5d6 : /* 'voc' */ return SF_FORMAT_VOC ;
|
||||
case 0x324a : /* 'ircam' */ return SF_FORMAT_IRCAM ;
|
||||
case 0x505 : /* 'w64' */ return SF_FORMAT_W64 ;
|
||||
case 0x1078 : /* 'mat4' */ return SF_FORMAT_MAT4 ;
|
||||
case 0x1079 : /* 'mat5' */ return SF_FORMAT_MAT5 ;
|
||||
case 0x5b8 : /* 'pvf' */ return SF_FORMAT_PVF ;
|
||||
case 0x1d1 : /* 'xi' */ return SF_FORMAT_XI ;
|
||||
case 0x56f : /* 'htk' */ return SF_FORMAT_HTK ;
|
||||
case 0x5aa : /* 'sds' */ return SF_FORMAT_SDS ;
|
||||
case 0x53d : /* 'avr' */ return SF_FORMAT_AVR ;
|
||||
case 0x11d0 : /* 'wavx' */ return SF_FORMAT_WAVEX ;
|
||||
case 0x569 : /* 'sd2' */ return SF_FORMAT_SD2 ;
|
||||
case 0x1014 : /* 'flac' */ return SF_FORMAT_FLAC ;
|
||||
case 0x504 : /* 'caf' */ return SF_FORMAT_CAF ;
|
||||
case 0x5f6 : /* 'wve' */ return SF_FORMAT_WVE ;
|
||||
default : break ;
|
||||
} ;
|
||||
|
||||
printf ("%s : hash '%s' -> 0x%x\n", __func__, str.c_str (), hash) ;
|
||||
|
||||
return 0 ;
|
||||
} /* major_format_of_hash */
|
||||
|
||||
static int
|
||||
minor_format_of_hash (const std::string & str)
|
||||
{ int hash ;
|
||||
|
||||
hash = hash_of_str (str) ;
|
||||
|
||||
switch (hash)
|
||||
{
|
||||
case 0x1085 : /* 'int8' */ return SF_FORMAT_PCM_S8 ;
|
||||
case 0x358a : /* 'uint8' */ return SF_FORMAT_PCM_U8 ;
|
||||
case 0x31b0 : /* 'int16' */ return SF_FORMAT_PCM_16 ;
|
||||
case 0x31b1 : /* 'int24' */ return SF_FORMAT_PCM_24 ;
|
||||
case 0x31b2 : /* 'int32' */ return SF_FORMAT_PCM_32 ;
|
||||
case 0x3128 : /* 'float' */ return SF_FORMAT_FLOAT ;
|
||||
case 0x937d : /* 'double' */ return SF_FORMAT_DOUBLE ;
|
||||
case 0x11bd : /* 'ulaw' */ return SF_FORMAT_ULAW ;
|
||||
case 0xfa1 : /* 'alaw' */ return SF_FORMAT_ALAW ;
|
||||
case 0xfc361 : /* 'ima_adpcm' */ return SF_FORMAT_IMA_ADPCM ;
|
||||
case 0x5739a : /* 'ms_adpcm' */ return SF_FORMAT_MS_ADPCM ;
|
||||
case 0x9450 : /* 'gsm610' */ return SF_FORMAT_GSM610 ;
|
||||
case 0x172a3 : /* 'g721_32' */ return SF_FORMAT_G721_32 ;
|
||||
case 0x172d8 : /* 'g723_24' */ return SF_FORMAT_G723_24 ;
|
||||
case 0x172da : /* 'g723_40' */ return SF_FORMAT_G723_40 ;
|
||||
default : break ;
|
||||
} ;
|
||||
|
||||
printf ("%s : hash '%s' -> 0x%x\n", __func__, str.c_str (), hash) ;
|
||||
|
||||
return 0 ;
|
||||
} /* minor_format_of_hash */
|
||||
|
||||
|
||||
static const char *
|
||||
string_of_major_format (int format)
|
||||
{
|
||||
switch (format & SF_FORMAT_TYPEMASK)
|
||||
{
|
||||
case SF_FORMAT_WAV : return "wav" ;
|
||||
case SF_FORMAT_AIFF : return "aiff" ;
|
||||
case SF_FORMAT_AU : return "au" ;
|
||||
case SF_FORMAT_PAF : return "paf" ;
|
||||
case SF_FORMAT_SVX : return "svx" ;
|
||||
case SF_FORMAT_NIST : return "nist" ;
|
||||
case SF_FORMAT_VOC : return "voc" ;
|
||||
case SF_FORMAT_IRCAM : return "ircam" ;
|
||||
case SF_FORMAT_W64 : return "w64" ;
|
||||
case SF_FORMAT_MAT4 : return "mat4" ;
|
||||
case SF_FORMAT_MAT5 : return "mat5" ;
|
||||
case SF_FORMAT_PVF : return "pvf" ;
|
||||
case SF_FORMAT_XI : return "xi" ;
|
||||
case SF_FORMAT_HTK : return "htk" ;
|
||||
case SF_FORMAT_SDS : return "sds" ;
|
||||
case SF_FORMAT_AVR : return "avr" ;
|
||||
case SF_FORMAT_WAVEX : return "wavx" ;
|
||||
case SF_FORMAT_SD2 : return "sd2" ;
|
||||
case SF_FORMAT_FLAC : return "flac" ;
|
||||
case SF_FORMAT_CAF : return "caf" ;
|
||||
case SF_FORMAT_WVE : return "wfe" ;
|
||||
default : break ;
|
||||
} ;
|
||||
|
||||
return "unknown" ;
|
||||
} /* string_of_major_format */
|
||||
|
||||
static const char *
|
||||
string_of_minor_format (int format)
|
||||
{
|
||||
switch (format & SF_FORMAT_SUBMASK)
|
||||
{
|
||||
case SF_FORMAT_PCM_S8 : return "int8" ;
|
||||
case SF_FORMAT_PCM_U8 : return "uint8" ;
|
||||
case SF_FORMAT_PCM_16 : return "int16" ;
|
||||
case SF_FORMAT_PCM_24 : return "int24" ;
|
||||
case SF_FORMAT_PCM_32 : return "int32" ;
|
||||
case SF_FORMAT_FLOAT : return "float" ;
|
||||
case SF_FORMAT_DOUBLE : return "double" ;
|
||||
case SF_FORMAT_ULAW : return "ulaw" ;
|
||||
case SF_FORMAT_ALAW : return "alaw" ;
|
||||
case SF_FORMAT_IMA_ADPCM : return "ima_adpcm" ;
|
||||
case SF_FORMAT_MS_ADPCM : return "ms_adpcm" ;
|
||||
case SF_FORMAT_GSM610 : return "gsm610" ;
|
||||
case SF_FORMAT_G721_32 : return "g721_32" ;
|
||||
case SF_FORMAT_G723_24 : return "g723_24" ;
|
||||
case SF_FORMAT_G723_40 : return "g723_40" ;
|
||||
default : break ;
|
||||
} ;
|
||||
|
||||
return "unknown" ;
|
||||
} /* string_of_minor_format */
|
||||
|
||||
static int
|
||||
format_of_str (const std::string & fmt)
|
||||
{
|
||||
std::vector <std::string> split ;
|
||||
|
||||
str_split (fmt, "-", split) ;
|
||||
|
||||
if (split.size () != 2)
|
||||
return 0 ;
|
||||
|
||||
int major_fmt = major_format_of_hash (split.at (0)) ;
|
||||
if (major_fmt == 0)
|
||||
return 0 ;
|
||||
|
||||
int minor_fmt = minor_format_of_hash (split.at (1)) ;
|
||||
if (minor_fmt == 0)
|
||||
return 0 ;
|
||||
|
||||
return major_fmt | minor_fmt ;
|
||||
} /* format_of_str */
|
||||
|
||||
static void
|
||||
string_of_format (std::string & fmt, int format)
|
||||
{
|
||||
char buffer [64] ;
|
||||
|
||||
snprintf (buffer, sizeof (buffer), "%s-%s", string_of_major_format (format), string_of_minor_format (format)) ;
|
||||
|
||||
fmt = buffer ;
|
||||
|
||||
return ;
|
||||
} /* string_of_format */
|
|
@ -50,10 +50,3 @@ else
|
|||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
# Do not edit or modify anything in this comment block.
|
||||
# The arch-tag line is a file identity tag for the GNU Arch
|
||||
# revision control system.
|
||||
#
|
||||
# arch-tag: 9d7ed7ce-41fe-4efe-8bde-f5fc6f46bb03
|
||||
|
||||
|
|
|
@ -57,10 +57,3 @@ if (status),
|
|||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
# Do not edit or modify anything in this comment block.
|
||||
# The arch-tag line is a file identity tag for the GNU Arch
|
||||
# revision control system.
|
||||
#
|
||||
# arch-tag: 96fb14c8-2b5a-4b93-a576-ab83a6d9026b
|
||||
|
||||
|
|
|
@ -51,10 +51,3 @@ str = sprintf ("save -mat-binary %s samplerate wavedata", filename) ;
|
|||
eval (str) ;
|
||||
|
||||
endfunction
|
||||
|
||||
# Do not edit or modify anything in this comment block.
|
||||
# The arch-tag line is a file identity tag for the GNU Arch
|
||||
# revision control system.
|
||||
#
|
||||
# arch-tag: 5e44602b-940b-4927-af7c-47639769a40b
|
||||
|
||||
|
|
|
@ -1,28 +1,19 @@
|
|||
This is libsndfile, 1.0.17
|
||||
This is libsndfile, 1.0.19
|
||||
|
||||
libsndfile is a library of C routines for reading and writing
|
||||
files containing sampled audio data.
|
||||
libsndfile is a library of C routines for reading and writing
|
||||
files containing sampled audio data.
|
||||
|
||||
The src/ directory contains the source code for library itself.
|
||||
|
||||
The doc/ directory contains the libsndfile documentation.
|
||||
|
||||
The examples/ directory contains examples of how to write code using
|
||||
libsndfile. 'wav32_aiff24' converts a WAV file containing 32 bit floating
|
||||
point data into a 24 bit PCM AIFF file. 'sndfile2oct' dumps the audio
|
||||
data of a file in a human readable format. 'sfconvert' is the beginnings
|
||||
of a audio file format conversion utility. 'make_sine' generates a WAV
|
||||
file containing one cycle of a sine wave with 4096 sample points in
|
||||
32 bit floating point format. 'sfinfo' opens a sound file and prints
|
||||
out information about that file.
|
||||
libsndfile.
|
||||
|
||||
The tests/ directory contains programs which link against libsndfile
|
||||
and test its functionality.
|
||||
|
||||
The Win32/ directory contains files and documentation to allow libsndfile
|
||||
to compile under Win32 with the Microsoft Visual C++ compiler.
|
||||
|
||||
The src/GSM610 directory contains code written by Jutta Degener and Carsten
|
||||
The src/GSM610 directory contains code written by Jutta Degener and Carsten
|
||||
Bormann. Their original code can be found at :
|
||||
http://kbs.cs.tu-berlin.de/~jutta/toast.html
|
||||
|
||||
|
@ -30,41 +21,44 @@ The src/G72x directory contains code written and released by Sun Microsystems
|
|||
under a suitably free license.
|
||||
|
||||
|
||||
Win32
|
||||
LINUX
|
||||
-----
|
||||
There are detailed instructions for building libsndfile on Win32 in the file
|
||||
Whereever possible, you should use the packages supplied by your Linux
|
||||
distribution.
|
||||
|
||||
If you really do need to compile from source it should be as easy as:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
Since libsndfile optionally links against libFLAC, libogg and libvorbis, you
|
||||
will need to install appropriate versions of these libraries before running
|
||||
configure as above.
|
||||
|
||||
|
||||
UNIX
|
||||
----
|
||||
Compile as for Linux.
|
||||
|
||||
|
||||
Win32/Win64
|
||||
-----------
|
||||
The default Windows compilers are nowhere near compliant with the 1999 ISO
|
||||
C Standard and hence not able to compile libsndfile.
|
||||
|
||||
Please use the libsndfile binaries available on the libsndfile web site.
|
||||
|
||||
doc/win32.html
|
||||
|
||||
|
||||
MacOSX
|
||||
------
|
||||
Building on MacOSX should be the same as building it on any other Unix.
|
||||
|
||||
|
||||
OTHER PLATFORMS
|
||||
---------------
|
||||
To compile libsndfile on platforms which have a Bourne Shell compatible
|
||||
shell, an ANSI C compiler and a make utility should require no more that
|
||||
the following three commands :
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
For platforms without the required shell, it is usually sufficient to
|
||||
create an approriate config.h file in the src/ directory with correct
|
||||
values for the following #defines (this would work for AmigaOS) :
|
||||
|
||||
#define HAVE_ENDIAN_H 0
|
||||
#define GUESS_BIG_ENDIAN 1
|
||||
#define GUESS_LITTLE_ENDIAN 0
|
||||
#define FORCE_BROKEN_FLOAT 0
|
||||
|
||||
|
||||
CONTACTS
|
||||
--------
|
||||
|
||||
libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||
libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||
The libsndfile home page is at :
|
||||
|
||||
http://www.mega-nerd.com/libsndfile/
|
||||
|
|
|
@ -2,9 +2,3 @@
|
|||
|
||||
EXTRA_DIST = README-precompiled-dll.txt testprog.c
|
||||
|
||||
## Do not edit or modify anything in this comment block.
|
||||
## The arch-tag line is a file identity tag for the GNU Arch
|
||||
## revision control system.
|
||||
##
|
||||
## arch-tag: c28c7540-67f6-47e7-8035-0abbc6a174bc
|
||||
|
||||
|
|
|
@ -14,11 +14,3 @@ main (void)
|
|||
return 0 ;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The following line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 31165fd8-9d91-4e5d-8b31-8efd42ef7645
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
# Copyright (C) 1999-2006 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||
# Copyright (C) 1999-2008 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||
|
||||
dnl Require autoconf version
|
||||
AC_PREREQ(2.59)
|
||||
AC_PREREQ(2.57)
|
||||
|
||||
AC_INIT([libsndfile],[1.0.19],[erikd@mega-nerd.com])
|
||||
|
||||
# Put config stuff in Cfg.
|
||||
AC_CONFIG_AUX_DIR(Cfg)
|
||||
|
||||
AC_INIT([libsndfile],[1.0.17],[erikd@mega-nerd.com])
|
||||
AC_CONFIG_SRCDIR([src/sndfile.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_MACRO_DIR([M4])
|
||||
|
||||
AC_CONFIG_HEADERS([src/config.h])
|
||||
|
||||
dnl Add parameters for aclocal
|
||||
AC_SUBST(ACLOCAL_AMFLAGS, "-I M4")
|
||||
|
||||
AC_LANG([C])
|
||||
|
||||
#------------------------------------------------------------------------------------
|
||||
|
@ -28,14 +37,19 @@ AC_LANG([C])
|
|||
# 6. If any interfaces have been removed since the last public release, then set age
|
||||
# to 0.
|
||||
|
||||
SHARED_VERSION_INFO="1:17:0"
|
||||
SHARED_VERSION_INFO="1:19:0"
|
||||
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CXX
|
||||
|
||||
# Do not check for F77.
|
||||
define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
|
||||
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_CHECK_PROG(autogen, autogen, yes, no)
|
||||
AC_CHECK_PROG(HAVE_AUTOGEN, autogen, yes, no)
|
||||
AC_CHECK_PROG(HAVE_WINE, wine, yes, no)
|
||||
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
|
@ -45,7 +59,7 @@ AC_HEADER_STDC
|
|||
AC_CHECK_HEADERS(endian.h)
|
||||
AC_CHECK_HEADERS(byteswap.h)
|
||||
AC_CHECK_HEADERS(locale.h)
|
||||
AC_CHECK_HEADERS(inttypes.h)
|
||||
AC_CHECK_HEADERS(sys/time.h)
|
||||
|
||||
AC_HEADER_SYS_WAIT
|
||||
|
||||
|
@ -56,6 +70,9 @@ else
|
|||
AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],0)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST],
|
||||
[test "$build_os:$target_os:$host_os:$HAVE_WINE" = "linux-gnu:mingw32msvc:mingw32msvc:yes"])
|
||||
|
||||
#====================================================================================
|
||||
# Check for support of the struct hack.
|
||||
|
||||
|
@ -104,12 +121,19 @@ AC_ARG_ENABLE(bow-docs,
|
|||
AC_ARG_ENABLE(sqlite,
|
||||
AC_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
|
||||
|
||||
AC_ARG_ENABLE(flac,
|
||||
AC_HELP_STRING([--disable-flac], [disable use of FLAC]))
|
||||
|
||||
AC_ARG_ENABLE(alsa,
|
||||
AC_HELP_STRING([--disable-alsa], [disable use of ALSA]))
|
||||
|
||||
AC_ARG_ENABLE(external-libs,
|
||||
AC_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis]))
|
||||
|
||||
AC_ARG_ENABLE(octave,
|
||||
AC_HELP_STRING([--enable-octave], [disable building of GNU Octave module]))
|
||||
|
||||
AC_ARG_ENABLE(test-coverage,
|
||||
AC_HELP_STRING([--enable-test-coverage], [enable test coverage]))
|
||||
AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "$enable_test_coverage" = yes])
|
||||
|
||||
#====================================================================================
|
||||
# Check types and their sizes.
|
||||
|
||||
|
@ -223,6 +247,8 @@ AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
|
|||
[Target processor is big endian.])
|
||||
AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
|
||||
[Target processor is little endian.])
|
||||
AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
|
||||
[Target processor is big endian.])
|
||||
|
||||
#====================================================================================
|
||||
# Check for functions.
|
||||
|
@ -231,36 +257,78 @@ AC_CHECK_FUNCS(malloc calloc realloc free)
|
|||
AC_CHECK_FUNCS(open read write lseek pread pwrite)
|
||||
AC_CHECK_FUNCS(fstat ftruncate fsync)
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf)
|
||||
AC_CHECK_FUNCS(gmtime gmtime_r)
|
||||
AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r gettimeofday)
|
||||
AC_CHECK_FUNCS(mmap getpagesize)
|
||||
AC_CHECK_FUNCS(setlocale)
|
||||
|
||||
AC_CHECK_LIB([m],floor)
|
||||
AC_CHECK_FUNCS(floor ceil fmod)
|
||||
|
||||
case "$host_os" in
|
||||
cygwin*)
|
||||
AC_MSG_WARN([[Not using built-in lrint() and lrintf() because they are broken on Cygwin.]])
|
||||
;;
|
||||
*)
|
||||
AC_C99_FUNC_LRINT
|
||||
AC_C99_FUNC_LRINTF
|
||||
AC_C99_FUNC_LRINT
|
||||
AC_C99_FUNC_LRINTF
|
||||
|
||||
if test "x$ac_cv_c99_lrint" = "xno" ; then
|
||||
if test "x$ac_cv_c99_lrintf" = "xno" ; then
|
||||
AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
|
||||
AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
#====================================================================================
|
||||
# Check for requirements for building plugins for other languages/enviroments.
|
||||
|
||||
dnl Octave maths environment http://www.octave.org/
|
||||
if test x$cross_compiling = xno ; then
|
||||
if test x$enable_octave = xno ; then
|
||||
AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
|
||||
else
|
||||
AC_OCTAVE_BUILD
|
||||
fi
|
||||
else
|
||||
AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
|
||||
fi
|
||||
|
||||
#====================================================================================
|
||||
# Check for Ogg, Vorbis and FLAC.
|
||||
|
||||
HAVE_EXTERNAL_LIBS=0
|
||||
EXTERNAL_CFLAGS=""
|
||||
EXTERNAL_LIBS=""
|
||||
|
||||
# Check for pkg-config outside the if statement.
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
if test x$enable_external_libs = xno ; then
|
||||
AC_MSG_WARN([[*** External libs (FLAC, Ogg, Vorbis) disabled. ***]])
|
||||
else
|
||||
PKG_CHECK_MOD_VERSION(FLAC, flac >= 1.2.1, ac_cv_flac=yes, ac_cv_flac=no)
|
||||
PKG_CHECK_MOD_VERSION(OGG, ogg >= 1.1.3, ac_cv_ogg=yes, ac_cv_ogg=no)
|
||||
|
||||
# Vorbis versions earlier than 1.2.1 are not const correct at the API level.
|
||||
# Vorbis 1.2.2 adds vorbis_version_string.
|
||||
PKG_CHECK_MOD_VERSION(VORBIS, vorbis >= 1.2.0, ac_cv_vorbis=yes, ac_cv_vorbis=no)
|
||||
PKG_CHECK_MOD_VERSION(VORBISENC, vorbisenc >= 1.2.0, ac_cv_vorbisenc=yes, ac_cv_vorbisenc=no)
|
||||
fi
|
||||
|
||||
HAVE_VORBIS_VERSION_STRING=0
|
||||
if test x$ac_cv_flac$ac_cv_ogg$ac_cv_vorbis$ac_cv_vorbisenc = "xyesyesyesyes" ; then
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$VORBIS_LIBS $LIBS"
|
||||
AC_CHECK_LIB(vorbis, vorbis_version_string, HAVE_VORBIS_VERSION_STRING=1)
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
HAVE_EXTERNAL_LIBS=1
|
||||
enable_external_libs=yes
|
||||
|
||||
EXTERNAL_CFLAGS="$FLAC_CFLAGS $OGG_CFLAGS $VORBISENC_CFLAGS"
|
||||
EXTERNAL_LIBS="$FLAC_LIBS $VORBISENC_LIBS"
|
||||
else
|
||||
enable_external_libs=no
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED([HAVE_EXTERNAL_LIBS], $HAVE_EXTERNAL_LIBS, [Will be set to 1 if flac, ogg and vorbis are available.])
|
||||
AC_DEFINE_UNQUOTED([HAVE_VORBIS_VERSION_STRING], $HAVE_VORBIS_VERSION_STRING, [Set to 1 if we have vorbis_version_string.])
|
||||
|
||||
#====================================================================================
|
||||
# Check for libsqlite3 (only used in regtest).
|
||||
|
||||
ac_cv_sqlite3=no
|
||||
if test x$enable_sqlite != xno ; then
|
||||
PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no)
|
||||
PKG_CHECK_MOD_VERSION(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no)
|
||||
fi
|
||||
|
||||
if test x$ac_cv_sqlite3 = "xyes" ; then
|
||||
|
@ -271,6 +339,19 @@ else
|
|||
|
||||
AC_DEFINE_UNQUOTED([HAVE_SQLITE3],$HAVE_SQLITE3,[Set to 1 if you have libsqlite3.])
|
||||
|
||||
#====================================================================================
|
||||
# Check for JACK (only used for examples/sndfile-jackplay).
|
||||
|
||||
PKG_CHECK_MOD_VERSION(JACK, jack >= 0.100, ac_cv_jack=yes, ac_cv_jack=no)
|
||||
|
||||
if test x$ac_cv_jack = "xyes" ; then
|
||||
HAVE_JACK=1
|
||||
else
|
||||
HAVE_JACK=0
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED([HAVE_JACK],$HAVE_JACK,[Set to 1 if you have JACK.])
|
||||
|
||||
#====================================================================================
|
||||
# Determine if the processor can do clipping on float to int conversions.
|
||||
|
||||
|
@ -307,10 +388,6 @@ case "$host_os" in
|
|||
use_windows_api=1
|
||||
OS_SPECIFIC_LINKS="-lwinmm"
|
||||
;;
|
||||
cygwin*)
|
||||
os_is_win32=1
|
||||
OS_SPECIFIC_LINKS="-lwinmm"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
|
||||
|
@ -326,22 +403,7 @@ if test x$enable_alsa != xno ; then
|
|||
AC_CHECK_HEADERS(alsa/asoundlib.h)
|
||||
if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then
|
||||
ALSA_LIBS="-lasound"
|
||||
fi
|
||||
fi
|
||||
|
||||
#====================================================================================
|
||||
# Check for FLAC
|
||||
|
||||
FLAC_LIBS=""
|
||||
|
||||
if test x$enable_flac != xno ; then
|
||||
AC_CHECK_HEADERS(FLAC/all.h)
|
||||
if test x$ac_cv_header_FLAC_all_h = xyes ; then
|
||||
AC_CHECK_LIB(FLAC, FLAC__seekable_stream_encoder_set_tell_callback, HAVE_FLAC_1_1_1="yes")
|
||||
if test "x$HAVE_FLAC_1_1_1" = xyes ; then
|
||||
AC_DEFINE(HAVE_FLAC_1_1_1, [1], [Define to 1 if you have libflac 1.1.1])
|
||||
fi
|
||||
FLAC_LIBS="-lFLAC"
|
||||
enable_alsa=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -380,7 +442,7 @@ if test $ac_cv_sizeof_double != 8 ; then
|
|||
AC_MSG_WARN([[******************************************************************]])
|
||||
fi
|
||||
|
||||
if test x"$ac_cv_prog_autogen" = "xno" ; then
|
||||
if test x"$ac_cv_prog_HAVE_AUTOGEN" = "xno" ; then
|
||||
AC_MSG_WARN([[Touching files in directory tests/.]])
|
||||
touch tests/*.c tests/*.h
|
||||
fi
|
||||
|
@ -407,20 +469,47 @@ else
|
|||
#====================================================================================
|
||||
# Now use the information from the checking stage.
|
||||
|
||||
win32_target_dll=0
|
||||
COMPILER_IS_GCC=0
|
||||
|
||||
if test x$ac_cv_c_compiler_gnu = xyes ; then
|
||||
AC_ADD_CFLAGS(-std=gnu99)
|
||||
|
||||
CFLAGS="$CFLAGS -W -Wall"
|
||||
CXXFLAGS="$CXXFLAGS -W -Wall"
|
||||
AC_GCC_VERSION
|
||||
|
||||
AC_ADD_CFLAGS(-Wdeclaration-after-statement)
|
||||
AC_ADD_CFLAGS(-Wpointer-arith)
|
||||
if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
|
||||
AC_MSG_WARN([****************************************************************])
|
||||
AC_MSG_WARN([** GCC version 4.2 warns about the inline keyword for no good **])
|
||||
AC_MSG_WARN([** reason but the maintainers do not see it as a bug. **])
|
||||
AC_MSG_WARN([** See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33995 **])
|
||||
AC_MSG_WARN([** Using -fgnu-inline to avoid this stupidity. **])
|
||||
AC_MSG_WARN([****************************************************************])
|
||||
AC_ADD_CFLAGS([-fgnu89-inline])
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
CXXFLAGS="$CXXFLAGS -Wall"
|
||||
|
||||
AC_ADD_CFLAGS([-Wextra])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_ADD_CXXFLAGS([-Wextra])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
AC_ADD_CFLAGS([-Wdeclaration-after-statement])
|
||||
AC_ADD_CFLAGS([-Wpointer-arith])
|
||||
AC_ADD_CFLAGS([-funsigned-char])
|
||||
|
||||
if test x$enable_gcc_werror = "xyes" ; then
|
||||
CFLAGS="-Werror $CFLAGS"
|
||||
CXXFLAGS="-Werror $CXXFLAGS"
|
||||
fi
|
||||
|
||||
if test x$enable_test_coverage = "xyes" ; then
|
||||
# AC_ADD_CFLAGS([-ftest-coverage])
|
||||
AC_ADD_CFLAGS([-coverage])
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings "
|
||||
# -Wundef -Wmissing-declarations -Winline -Wconversion"
|
||||
CXXFLAGS="$CXXFLAGS -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo "
|
||||
|
@ -444,10 +533,16 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
|
|||
SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.linux"
|
||||
;;
|
||||
mingw*)
|
||||
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/libsndfile.def"
|
||||
# Linker flag '-Wl,--out-implib' does not work with mingw cross compiler
|
||||
# so we don't use it here.
|
||||
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/libsndfile-1.def"
|
||||
win32_target_dll=1
|
||||
if test x"$enable_shared" = xno ; then
|
||||
win32_target_dll=0
|
||||
fi
|
||||
;;
|
||||
cygwin*)
|
||||
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/cygsndfile.def"
|
||||
os2*)
|
||||
SHLIB_VERSION_ARG="-Wl,-export-symbols \$(srcdir)/Symbols.os2"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
@ -456,11 +551,11 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
|
|||
CFLAGS="$CFLAGS -pipe"
|
||||
fi
|
||||
|
||||
AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.])
|
||||
GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
|
||||
AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.])
|
||||
COMPILER_IS_GCC=1
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED([WIN32_TARGET_DLL], ${win32_target_dll}, [Set to 1 if windows DLL is being built.])
|
||||
AC_DEFINE_UNQUOTED([COMPILER_IS_GCC], ${COMPILER_IS_GCC}, [Set to 1 if the compile is GNU GCC.])
|
||||
AC_DEFUN([AX_COMPILER_VENDOR],
|
||||
[
|
||||
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
|
||||
|
@ -497,6 +592,8 @@ if test x"$CFLAGS" = x ; then
|
|||
exit
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
AC_SUBST(htmldocdir)
|
||||
AC_SUBST(HTML_BGCOLOUR)
|
||||
AC_SUBST(HTML_FGCOLOUR)
|
||||
|
@ -506,25 +603,33 @@ AC_SUBST(SHARED_VERSION_INFO)
|
|||
AC_SUBST(OS_SPECIFIC_CFLAGS)
|
||||
AC_SUBST(OS_SPECIFIC_LINKS)
|
||||
AC_SUBST(ALSA_LIBS)
|
||||
AC_SUBST(FLAC_LIBS)
|
||||
AC_SUBST(ENABLE_EXPERIMENTAL_CODE)
|
||||
|
||||
AC_SUBST(EXTERNAL_CFLAGS)
|
||||
AC_SUBST(EXTERNAL_LIBS)
|
||||
|
||||
AC_SUBST(COMPILER_IS_GCC)
|
||||
AC_SUBST(GCC_MAJOR_VERSION)
|
||||
|
||||
AC_SUBST(HAVE_JACK)
|
||||
|
||||
dnl The following line causes the libtool distributed with the source
|
||||
dnl to be replaced if the build system has a more recent version.
|
||||
AC_SUBST(LIBTOOL_DEPS)
|
||||
|
||||
AC_CONFIG_FILES([ \
|
||||
src/sndfile.h src/Makefile src/GSM610/Makefile src/G72x/Makefile \
|
||||
man/Makefile examples/Makefile tests/Makefile regtest/Makefile \
|
||||
doc/Makefile doc/libsndfile.css \
|
||||
Win32/Makefile Octave/Makefile \
|
||||
Makefile libsndfile.spec sndfile.pc \
|
||||
])
|
||||
src/sndfile.h src/Makefile src/GSM610/Makefile src/G72x/Makefile \
|
||||
man/Makefile examples/Makefile tests/Makefile regtest/Makefile \
|
||||
M4/Makefile doc/Makefile Win32/Makefile Octave/Makefile \
|
||||
programs/Makefile doc/libsndfile.css \
|
||||
Makefile libsndfile.spec sndfile.pc \
|
||||
tests/test_wrapper.sh \
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
# Make it executable.
|
||||
chmod u+x tests/test_wrapper.sh
|
||||
|
||||
#====================================================================================
|
||||
|
||||
AC_MSG_RESULT([
|
||||
|
@ -532,18 +637,21 @@ AC_MSG_RESULT([
|
|||
|
||||
Configuration summary :
|
||||
|
||||
Version : ..................... ${VERSION}
|
||||
Experimental code : ........... ${enable_experimental:-no}
|
||||
Version : ............................. ${VERSION}
|
||||
Experimental code : ................... ${enable_experimental:-no}
|
||||
Using ALSA in example programs : ...... ${enable_alsa:-no}
|
||||
External FLAC/Ogg/Vorbis : ............ ${enable_external_libs:-no}
|
||||
|
||||
])
|
||||
|
||||
if test x$ac_cv_c_compiler_gnu = xyes ; then
|
||||
echo -e " Tools :\n"
|
||||
echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}"
|
||||
echo " GCC major version : ........... ${GCC_MAJOR_VERSION}"
|
||||
echo " Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
|
||||
echo " GCC version : ......................... ${GCC_VERSION}"
|
||||
if test $GCC_MAJOR_VERSION -lt 3 ; then
|
||||
echo -e "\n ** This compiler version allows applications to write"
|
||||
echo " ** to static strings within the library."
|
||||
echo " ** Compile with GCC version 3.X to avoid this problem."
|
||||
echo " ** Compile with GCC version 3.X or above to avoid this problem."
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -558,10 +666,10 @@ if test $bindir = "\${exec_prefix}/bin" ; then
|
|||
AC_MSG_RESULT([[
|
||||
Installation directories :
|
||||
|
||||
Library directory : ........... $libdir
|
||||
Program directory : ........... $bindir
|
||||
Pkgconfig directory : ......... $libdir/pkgconfig
|
||||
HTML docs directory : ......... $htmldocdir
|
||||
Library directory : ................... $libdir
|
||||
Program directory : ................... $bindir
|
||||
Pkgconfig directory : ................. $libdir/pkgconfig
|
||||
HTML docs directory : ................. $htmldocdir
|
||||
]])
|
||||
|
||||
if test x$prefix != "x/usr" ; then
|
||||
|
@ -570,14 +678,5 @@ if test x$prefix != "x/usr" ; then
|
|||
echo -e "PKG_CONFIG_PATH environment variable.\n"
|
||||
fi
|
||||
|
||||
#====================================================================================
|
||||
|
||||
ifelse(dnl
|
||||
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: 6391b316-6cfc-43c2-a18a-8defdc4ee359
|
||||
|
||||
)dnl
|
||||
(cd src && make genfiles)
|
||||
(cd tests && make genfiles)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#! /bin/sh
|
||||
./configure "$@" --disable-sqlite --disable-shared --with-pic --disable-flac
|
||||
|
||||
#! /bin/sh
|
||||
./configure "$@" --disable-sqlite --disable-shared --with-pic --disable-external-libs --disable-octave
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
substitution" error during linking. What can I do to fix this?</A><BR>
|
||||
<A HREF="#Q005">Q5 : Why doesn't libsndfile do interleaving/de-interleaving?</A><BR>
|
||||
<A HREF="#Q006">Q6 : What's the best format for storing temporary files?</A><BR>
|
||||
<A HREF="#Q007">Q7 : On Linux/Unix/MaxOSX, what's the best way of detecting the
|
||||
<A HREF="#Q007">Q7 : On Linux/Unix/MacOSX, what's the best way of detecting the
|
||||
presence of libsndfile?</A><BR>
|
||||
<A HREF="#Q008">Q8 : But I just want a simple Makefile! What do I do?</A><BR>
|
||||
<A HREF="#Q009">Q9 : How about adding the ability to write/read sound files to/from
|
||||
|
@ -43,6 +43,19 @@
|
|||
</A><BR>
|
||||
<A HREF="#Q017">Q17 : Can libsndfile read/write files from/to UNIX pipes?
|
||||
</A><BR>
|
||||
<A HREF="#Q018">Q18 : Is it possible to build a Universal Binary on Mac OSX?
|
||||
</A><BR>
|
||||
<A HREF="#Q019">Q19 : I have project files for Visual Studio / XCode / Whatever. Why
|
||||
don't you distribute them with libsndfile?
|
||||
</A><BR>
|
||||
<A HREF="#Q020">Q20 : Why doesn't libsndfile support MP3? Lots of other Open Source
|
||||
projects support it!
|
||||
</A><BR>
|
||||
<A HREF="#Q021">Q21 : How do I use libsndfile in a closed source or commercial program
|
||||
and comply with the license?
|
||||
</A><BR>
|
||||
<A HREF="#Q022">Q22 : What versions of windows does libsndfile work on?
|
||||
</A><BR>
|
||||
<HR>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
|
@ -89,9 +102,12 @@ and always have the optimal behavior.
|
|||
<A NAME="Q003"></A>
|
||||
<H2><BR><B>Q3 : Compiling is really slow on MacOSX. Why?</B></H2>
|
||||
<P>
|
||||
When you configure and compile libsndfile, it uses the Bourne shell for a number
|
||||
When you configure and compile libsndfile, it uses the /bin/sh shell for a number
|
||||
of tasks (ie configure script and libtool).
|
||||
However, Apple has decided to ship their system with a really crappy Bourne shell.
|
||||
Older versions of OSX (10.2?) shipped a a really crappy Bourne shell as /bin/sh
|
||||
which resulted in <b>really</b> slow compiles.
|
||||
New version of OSX ship GNU BASh as /bin/sh and this answer doesn't apply in that
|
||||
case.
|
||||
</P>
|
||||
<P>
|
||||
To fix this I suggest that you install the GNU Bash shell, rename /bin/sh to
|
||||
|
@ -313,8 +329,18 @@ between 16 bit shorts and normalised floats is going to suffer other losses
|
|||
in audio quality that they should also be concerned about.
|
||||
</P>
|
||||
<P>
|
||||
The correct way to deal with this problem is to consider 16 bit short data as
|
||||
a final destination format only, not as an intermediate storage format.
|
||||
Since this problem only occurs when converting between integer data on disk and
|
||||
normalized floats in the application, it can be avoided by using something
|
||||
other than normalized floats in the application.
|
||||
Alternatives to normalized floats are the <b>short</b> and <b>int</b> data
|
||||
types (ie using sf_read_short or sf_read_int) or using un-normalized floats
|
||||
(see
|
||||
<a href="http://www.mega-nerd.com/libsndfile/command.html#SFC_SET_NORM_FLOAT">
|
||||
SFC_SET_NORM_FLOAT</a>).
|
||||
</P>
|
||||
<P>
|
||||
Another way to deal with this problem is to consider 16 bit short data as a
|
||||
final destination format only, not as an intermediate storage format.
|
||||
All intermediate data (ie which is going to be processed further) should be
|
||||
stored in floating point format which is supported by all of the most common
|
||||
file formats.
|
||||
|
@ -552,9 +578,204 @@ data in both big and little endian format.
|
|||
</P>
|
||||
|
||||
<P>
|
||||
Sell also <A HREF="#Q006">FAQ Q6</A>.
|
||||
See also <A HREF="#Q006">FAQ Q6</A>.
|
||||
</P>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="Q018"></A>
|
||||
<H2><BR><B>Q18 : Is it possible to build a Universal Binary on Mac OSX?
|
||||
</B></H2>
|
||||
|
||||
<P>
|
||||
Yes, but you must do two separate configure/build/test runs; one on PowerPC
|
||||
and one on Intel.
|
||||
It is then possible to merge the binaries into a single universal binary using
|
||||
one of the programs in the Apple tool chain.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
It is <b>not</b> possible to build a working universal binary via a single
|
||||
compile/build run on a single CPU.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
The problem is that the libsndfile build process detects features of the CPU its
|
||||
being built for during the configure process and when building a universal binary,
|
||||
configure is only run once and that data is then used for both CPUs.
|
||||
That configure data will be wrong for one of those CPUs.
|
||||
You will still be able to compile libsndfile, and the test suite will pass on
|
||||
the machine you compiled it on.
|
||||
However, if you take the universal binary test suite programs compiled on one
|
||||
CPU and run them on the other, the test suite will fail.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Part of the problem is the the CPU endian-ness is detected at configure time.
|
||||
Yes, I know the Apple compiler defines one of the macros __LITTLE_ENDIAN__
|
||||
and __BIG_ENDIAN__, but those macros are not part of the 1999 ISO C Standard
|
||||
and they are not portable.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Endian issues are not the only reason why the cross compiled binary will fail.
|
||||
The configure script also detects other CPU specific idiosyncrasies to provide
|
||||
more optimized code.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Finally, the real show stopper problem with universal binaries is the problem
|
||||
with the test suite.
|
||||
libsndfile contains a huge, comprehensive test suite.
|
||||
When you compile a universal binary and run the test suite, you only test the
|
||||
native compile.
|
||||
The cross compiled binary (the one with the much higher chance of having
|
||||
problems) cannot be tested.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Now, if you have read this far you're probably thinking there must be a way
|
||||
to fix this and there probably is.
|
||||
The problem is that its a hell of a lot of work and would require significant
|
||||
changes to the configure process, the internal code and the test suite.
|
||||
In addition, these changes must not break compilation on any of the platforms
|
||||
libsndfile is currently working on.
|
||||
</p>
|
||||
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="Q019"></A>
|
||||
<H2><BR><B>Q19 : I have project files for Visual Studio / XCode / Whatever. Why
|
||||
don't you distribute them with libsndfile?
|
||||
</B></H2>
|
||||
|
||||
<P>
|
||||
There's a very good reason for this.
|
||||
I will only distribute things that I actually have an ability to test and
|
||||
maintain.
|
||||
Project files for a bunch of different compilers and Integrated Development
|
||||
Environments are simply too difficult to maintain.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
The problem is that every time I add a new file to libsndfile or rename an
|
||||
existing file I would have to modify all the project files and then test that
|
||||
libsndfile still built with all the different compilers.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Maintaining these project files is also rather difficult if I don't have access
|
||||
to the required compiler/IDE.
|
||||
If I just edit the project files without testing them I will almost certainly
|
||||
get it wrong.
|
||||
If I release a version of libsndfile with broken project files, I'll get a bunch
|
||||
of emails from people complaining about it not building and have no way of
|
||||
fixing or even testing it.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
I currently release sources that I personally test on Win32, Linux and
|
||||
MacOSX (PowerPC) using the compiler I trust (GNU GCC).
|
||||
Supporting one compiler on three (actually much more because GCC is available
|
||||
almost everywhere) platforms is doable without too much pain.
|
||||
I also release binaries for Win32 with instructions on how to use those
|
||||
binaries with Visual Studio.
|
||||
As a guy who is mainly interested in Linux, I'm not to keen to jump through
|
||||
a bunch of hoops to support compilers and operating systems I don't use.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
So, I hear you want to volunteer to maintain the project files for Some Crappy
|
||||
Compiler 2007?
|
||||
Well sorry, that won't work either.
|
||||
I have had numerous people over the years offer to maintaining the project
|
||||
files for Microsoft's Visual Studio.
|
||||
Every single time that happened, they maintained it for a release or two and
|
||||
then disappeared off the face of the earth.
|
||||
Hence, I'm not willing to enter into an arrangement like that again.
|
||||
</P>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="Q020"></A>
|
||||
<H2><BR><B>Q20 : Why doesn't libsndfile support MP3? Lots of other Open Source
|
||||
projects support it!
|
||||
</B></H2>
|
||||
|
||||
<P>
|
||||
MP3 is not supported for one very good reason; doing so requires the payment
|
||||
of licensing fees.
|
||||
As can be seen from
|
||||
<a href="http://www.mp3licensing.com/royalty/software.html">
|
||||
mp3licensing.com</a>
|
||||
the required royalty payments are not cheap.
|
||||
</P>
|
||||
|
||||
<p>
|
||||
Yes, I know other libraries ignore the licensing requirements, but their legal
|
||||
status is extremely dubious.
|
||||
At any time, the body selling the licenses could go after the authors of those
|
||||
libraries.
|
||||
Some of those authors may be students and hence wouldn't be worth pursuing.
|
||||
</P>
|
||||
|
||||
<p>
|
||||
However, libsndfile is released under the name of a company, Mega Nerd Pty Ltd;
|
||||
a company which has income from from libsamplerate licensing, libsndfile based
|
||||
consulting income and other unrelated consulting income.
|
||||
Adding MP3 support to libsndfile could place that income would be under legal
|
||||
threat.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Fortunately, Ogg Vorbis exists as an alternative to MP3.
|
||||
Support for Ogg Vorbis was added to libsndfile (mostly due to the efforts of
|
||||
John ffitch of the Csound project) in version 1.0.18.
|
||||
</p>
|
||||
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="Q021"></A>
|
||||
<H2><BR><B>Q21 : How do I use libsndfile in a closed source or commercial program
|
||||
and comply with the license?
|
||||
</B></H2>
|
||||
|
||||
<p>
|
||||
Here is a checklist of things you need to do to make sure your use of libsndfile
|
||||
in a closed source or commercial project complies with the license libsndfile is
|
||||
released under, the GNU Lesser General Public License (LGPL):
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Make sure you are linking to libsndfile as a shared library (Linux and Unix
|
||||
systems), Dynamic Link Library (Microsoft Windows) or dynlib (Mac OSX).
|
||||
If you are using some other operating system that doesn't allow dynamically
|
||||
linked libraries, you will not be able to use libsndfile unless you release
|
||||
the source code to your program.
|
||||
<li>In the licensing documentation for your program, add a statement that your
|
||||
software depends on libsndfile and that libsndfile is released under the GNU
|
||||
Lesser General Public License, either
|
||||
<a href="http://www.gnu.org/licenses/lgpl-2.1.txt">version 2.1</a>
|
||||
or optionally
|
||||
<a href="http://www.gnu.org/licenses/lgpl.txt">version 3</a>.
|
||||
<li>Include the text for both versions of the license, possibly as separate
|
||||
files named libsndfile_lgpl_v2_1.txt and libsndfile_lgpl_v3.txt.
|
||||
</ul>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="Q022"></A>
|
||||
<H2><BR><B>Q22 : What versions of windows does libsndfile work on?
|
||||
</B></H2>
|
||||
|
||||
<p>
|
||||
Currently the precompiled windows binaries are tested in Windows XP.
|
||||
As such, they should also work on Win2k and Windows Vista.
|
||||
They may also work on earlier versions of windows.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
libsndfile does not yet work on 64 bit versions of windows.
|
||||
Support for 64 bit versions of WinXP and Vista is likely to be working some
|
||||
time late in 2008.
|
||||
</p>
|
||||
<!-- ========================================================================= -->
|
||||
<HR>
|
||||
<P>
|
||||
|
@ -562,16 +783,8 @@ Sell also <A HREF="#Q006">FAQ Q6</A>.
|
|||
<A HREF="http://www.mega-nerd.com/libsndfile/">
|
||||
http://www.mega-nerd.com/libsndfile/</A>.
|
||||
<BR>
|
||||
Version : 1.0.13
|
||||
Version : 1.0.19
|
||||
</P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: 508f827d-b9a7-4a86-8c2f-d82321df91f7
|
||||
-->
|
||||
|
|
|
@ -4,13 +4,7 @@ htmldir = $(htmldocdir)
|
|||
html_DATA = index.html libsndfile.jpg libsndfile.css api.html command.html \
|
||||
bugs.html sndfile_info.html new_file_type.HOWTO pkgconfig.html \
|
||||
win32.html FAQ.html lists.html embedded_files.html octave.html \
|
||||
dither.html
|
||||
dither.html tutorial.html
|
||||
|
||||
EXTRA_DIST = $(html_DATA)
|
||||
|
||||
## Do not edit or modify anything in this comment block.
|
||||
## The arch-tag line is a file identity tag for the GNU Arch
|
||||
## revision control system.
|
||||
##
|
||||
## arch-tag: 2f7e97fe-5ef8-49a1-ae12-14ebab69c048
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ The functions of libsndfile are defined as follows:
|
|||
|
||||
sf_count_t <A HREF="#seek">sf_seek</A> (SNDFILE *sndfile, sf_count_t frames, int whence) ;
|
||||
|
||||
int <A HREF="#command">sf_command</A> (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
|
||||
int <A HREF="command.html">sf_command</A> (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
|
||||
|
||||
int <A HREF="#error">sf_error</A> (SNDFILE *sndfile) ;
|
||||
const char* <A HREF="#error">sf_strerror</A> (SNDFILE *sndfile) ;
|
||||
|
@ -346,34 +346,6 @@ sf_seek will return the offset in (multichannel) frames from the start of the au
|
|||
or -1 if an error occured (ie an attempt is made to seek beyond the start or end of the file).
|
||||
</P>
|
||||
|
||||
<A NAME="command"></A>
|
||||
<H2><BR><B>Command Interface</B></H2>
|
||||
|
||||
<PRE>
|
||||
int sf_command (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
This function allows the caller to retrieve information from or change aspects of the
|
||||
library behaviour on a per file basis. Examples include reading or writing text descriptions
|
||||
to a file or changing the scaling applied to sample data during read and write.
|
||||
</P>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
The cmd parameter is a short null terminated string which specifies which command
|
||||
to execute. Data is passed to and returned from the library by use of a void
|
||||
pointer. The library will not read or write more than datasize bytes from the void
|
||||
pointer. For some calls no data is required in which case data should be NULL and
|
||||
datasize may be used for some other purpose.
|
||||
</P>
|
||||
<P>
|
||||
The return value of sf_command () depends on the value of the cmd parameter, but it is
|
||||
usually non-zero for success and zero on error.
|
||||
</P>
|
||||
<P>
|
||||
This function is explained more fully <A HREF="command.html">here</A>.
|
||||
</P>
|
||||
|
||||
<A NAME="error"></A>
|
||||
<H2><BR><B>Error Reporting Functions</B></H2>
|
||||
|
||||
|
@ -588,6 +560,10 @@ compressed file formats other than SF_FORMAT_ALAW and SF_FORMAT_ULAW is undefine
|
|||
</B>
|
||||
</P>
|
||||
|
||||
<p>
|
||||
See also : <a href="command.html#SFC_RAW_NEEDS_ENDSWAP">SFC_RAW_NEEDS_ENDSWAP</a>
|
||||
</p>
|
||||
|
||||
<A NAME="string"></A>
|
||||
<H2><BR><B>Functions for Reading and Writing String Data</B></H2>
|
||||
|
||||
|
@ -684,7 +660,7 @@ and a parameter of SF_TRUE to force correct scaling.
|
|||
<A HREF="http://www.mega-nerd.com/libsndfile/">here</A>.
|
||||
</P>
|
||||
<P>
|
||||
Version : 1.0.17
|
||||
Version : 1.0.19
|
||||
</P>
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
|
@ -693,11 +669,3 @@ Version : 1.0.17
|
|||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: f6d3aa8f-983a-4ad3-9681-346e122d815e
|
||||
-->
|
||||
|
|
|
@ -74,11 +74,3 @@
|
|||
</P>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: 1533a2ca-489c-4190-b602-ecae1cc992e4
|
||||
-->
|
||||
|
|
|
@ -95,6 +95,13 @@
|
|||
<TD>Set/clear the scale factor when integer (short/int) data is read from a file
|
||||
containing floating point data.</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_SET_SCALE_INT_FLOAT_WRITE">SFC_SET_SCALE_INT_FLOAT_WRITE</A></TD>
|
||||
<TD>Set/clear the scale factor when integer (short/int) data is written to a file
|
||||
as floating point data.</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_GET_SIMPLE_FORMAT_COUNT">SFC_GET_SIMPLE_FORMAT_COUNT</A></TD>
|
||||
<TD>Retrieve the number of simple formats supported by libsndfile.</TD>
|
||||
|
@ -168,6 +175,35 @@
|
|||
<TD>Retreive information about audio files embedded inside other files.</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_WAVEX_GET_AMBISONIC">SFC_GET_AMBISONIC</A></TD>
|
||||
<TD>Test a WAVEX file for Ambisonic format</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_WAVEX_SET_AMBISONIC">SFC_SET_AMBISONIC</A></TD>
|
||||
<TD>Modify a WAVEX header for Ambisonic format</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_SET_VBR_ENCODING_QUALITY">SFC_SET_VBR_ENCODING_QUALITY</A></TD>
|
||||
<TD>Set the the Variable Bit Rate encoding quality</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_RAW_NEEDS_ENDSWAP">SFC_RAW_NEEDS_ENDSWAP</a></td>
|
||||
<TD>Determine if raw data needs endswapping</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_GET_BROADCAST_INFO">SFC_GET_BROADCAST_INFO</A></TD>
|
||||
<TD>Retrieve the Broadcast Chunk info</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD><A HREF="#SFC_SET_BROADCAST_INFO">SFC_SET_BROADCAST_INFO</A></TD>
|
||||
<TD>Set the Broadcast Chunk info</TD>
|
||||
</TR>
|
||||
|
||||
<!--
|
||||
<TR>
|
||||
|
@ -594,6 +630,33 @@ Example:
|
|||
</DL>
|
||||
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_SET_SCALE_INT_FLOAT_WRITE"></A>
|
||||
<H2><BR><B>SFC_SET_SCALE_INT_FLOAT_WRITE</B></H2>
|
||||
<P>
|
||||
Set/clear the scale factor when integer (short/int) data is written to a file
|
||||
as floating point data.
|
||||
</P>
|
||||
<P>
|
||||
Parameters:
|
||||
</P>
|
||||
<PRE>
|
||||
sndfile : A valid SNDFILE* pointer
|
||||
cmd : SFC_SET_SCALE_FLOAT_INT_READ
|
||||
data : NULL
|
||||
datasize : TRUE or FALSE
|
||||
</PRE>
|
||||
<P>
|
||||
Example:
|
||||
</P>
|
||||
<PRE>
|
||||
sf_command (sndfile, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE) ;
|
||||
</PRE>
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>Returns the previous SFC_SET_SCALE_INT_FLOAT_WRITE setting for this file.
|
||||
</DL>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_GET_SIMPLE_FORMAT_COUNT"></A>
|
||||
<H2><BR><B>SFC_GET_SIMPLE_FORMAT_COUNT</B></H2>
|
||||
|
@ -1059,7 +1122,7 @@ Example:
|
|||
</PRE>
|
||||
<DL>
|
||||
<DT>Return value:</DT>
|
||||
<DD>Zero on sucess, non-zero otherwise.
|
||||
<DD>Zero on success, non-zero otherwise.
|
||||
</DL>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
|
@ -1137,7 +1200,7 @@ Parameters:
|
|||
datasize : sizeof (SF_EMBED_FILE_INFO)
|
||||
</PRE>
|
||||
<P>
|
||||
The SF_FORMAT_INFO struct is defined in <sndfile.h> as:
|
||||
The SF_EMBED_FILE_INFO struct is defined in <sndfile.h> as:
|
||||
</P>
|
||||
<PRE>
|
||||
typedef struct
|
||||
|
@ -1157,6 +1220,178 @@ The SF_FORMAT_INFO struct is defined in <sndfile.h> as:
|
|||
|
||||
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_WAVEX_GET_AMBISONIC"></A>
|
||||
<H2><BR><B>SFC_WAVEX_GET_AMBISONIC</B></H2>
|
||||
<P>
|
||||
Test if the current file has the GUID of a WAVEX file for any of the Ambisonic
|
||||
formats.
|
||||
</P>
|
||||
<P>
|
||||
Parameters:
|
||||
<PRE>
|
||||
sndfile : A valid SNDFILE* pointer
|
||||
cmd : SFC_WAVEX_GET_AMBISONIC
|
||||
data : NULL
|
||||
datasize : 0
|
||||
</PRE>
|
||||
<P>
|
||||
The Ambisonic WAVEX formats are defined here :
|
||||
<A HREF="http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html">
|
||||
http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html</A>.
|
||||
</P>
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>SF_AMBISONIC_NONE or SF_AMBISONIC_B_FORMAT or zero if the file format
|
||||
does not support ambisonic formats.
|
||||
</DL>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_WAVEX_SET_AMBISONIC"></A>
|
||||
<H2><BR><B>SFC_WAVEX_SET_AMBISONIC</B></H2>
|
||||
<P>
|
||||
Set the GUID of a new WAVEX file to indicate an Ambisonics format.
|
||||
</P>
|
||||
<P>
|
||||
Parameters:
|
||||
<PRE>
|
||||
sndfile : A valid SNDFILE* pointer
|
||||
cmd : SFC_WAVEX_SET_AMBISONIC
|
||||
data : NULL
|
||||
datasize : SF_AMBISONIC_NONE or SF_AMBISONIC_B_FORMAT
|
||||
</PRE>
|
||||
<P>
|
||||
Turn on (SF_AMBISONIC_B_FORMAT) or off (SF_AMBISONIC_NONE) encoding.
|
||||
This command is currently only supported for files with SF_FORMAT_WAVEX format.
|
||||
</P>
|
||||
<P>
|
||||
The Ambisonic WAVEX formats are defined here :
|
||||
<A HREF="http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html">
|
||||
http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html</A>.
|
||||
</P>
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>Return the ambisonic value that has just been set or zero if the file
|
||||
format does not support ambisonic encoding.
|
||||
</DL>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_SET_VBR_ENCODING_QUALITY"></A>
|
||||
<H2><BR><B>SFC_SET_VBR_ENCODING_QUALITY</B></H2>
|
||||
<P>
|
||||
Set the the Variable Bit Rate encoding quality.
|
||||
The encoding quality value should be between 0.0 (lowest quality) and 1.0
|
||||
(highest quality).
|
||||
</P>
|
||||
<P>
|
||||
Parameters:
|
||||
<PRE>
|
||||
sndfile : A valid SNDFILE* pointer
|
||||
cmd : SFC_SET_VBR_ENCODING_QUALITY
|
||||
data : A pointer to a double value
|
||||
datasize : sizeof (double)
|
||||
</PRE>
|
||||
<P>
|
||||
The command must be sent before any audio data is written to the file.
|
||||
</P>
|
||||
<P>
|
||||
</P>
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>Zero on success, non-zero otherwise.
|
||||
</DL>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_RAW_NEEDS_ENDSWAP"></A>
|
||||
<H2><BR><B>SFC_RAW_NEEDS_ENDSWAP</B></H2>
|
||||
<P>
|
||||
Determine if raw data read using
|
||||
<a href="api.html#raw">
|
||||
sf_read_raw</a>
|
||||
needs to be end swapped on the host CPU.
|
||||
</P>
|
||||
<P>
|
||||
For instance, will return SF_TRUE on when reading WAV containing
|
||||
SF_FORMAT_PCM_16 data on a big endian machine and SF_FALSE on a little endian
|
||||
machine.
|
||||
</P>
|
||||
<P>
|
||||
Parameters:
|
||||
<PRE>
|
||||
sndfile : A valid SNDFILE* pointer
|
||||
cmd : SFC_RAW_NEEDS_ENDSWAP
|
||||
data : NULL
|
||||
datasize : 0
|
||||
</PRE>
|
||||
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>SF_TRUE or SF_FALSE
|
||||
</DL>
|
||||
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_GET_BROADCAST_INFO"></A>
|
||||
<H2><BR><B>SFC_GET_BROADCAST_INFO</B></H2>
|
||||
<P>
|
||||
Retrieve the Broadcast Extention Chunk from WAV (and related) files.
|
||||
</P>
|
||||
<p>
|
||||
Parameters:
|
||||
</p>
|
||||
<PRE>
|
||||
sndfile : A valid SNDFILE* pointer
|
||||
cmd : SFC_GET_BROADCAST_INFO
|
||||
data : a pointer to an SF_BROADCAST_INFO struct
|
||||
datasize : sizeof (SF_BROADCAST_INFO)
|
||||
</PRE>
|
||||
<P>
|
||||
The SF_BROADCAST_INFO struct is defined in <sndfile.h> as:
|
||||
</P>
|
||||
<PRE>
|
||||
typedef struct
|
||||
{ char description [256] ;
|
||||
char originator [32] ;
|
||||
char originator_reference [32] ;
|
||||
char origination_date [10] ;
|
||||
char origination_time [8] ;
|
||||
unsigned int time_reference_low ;
|
||||
unsigned int time_reference_high ;
|
||||
short version ;
|
||||
char umid [64] ;
|
||||
char reserved [190] ;
|
||||
unsigned int coding_history_size ;
|
||||
char coding_history [256] ;
|
||||
} SF_BROADCAST_INFO ;
|
||||
</PRE>
|
||||
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>SF_TRUE if the file contained a Broadcast Extention chunk or SF_FALSE
|
||||
otherwise.
|
||||
</DL>
|
||||
|
||||
<!-- ========================================================================= -->
|
||||
<A NAME="SFC_SET_BROADCAST_INFO"></A>
|
||||
<H2><BR><B>SFC_SET_BROADCAST_INFO</B></H2>
|
||||
<P>
|
||||
Set the Broadcast Extention Chunk for WAV (and related) files.
|
||||
</P>
|
||||
<p>
|
||||
Parameters:
|
||||
</p>
|
||||
<PRE>
|
||||
sndfile : A valid SNDFILE* pointer
|
||||
cmd : SFC_SET_BROADCAST_INFO
|
||||
data : a pointer to an SF_BROADCAST_INFO struct
|
||||
datasize : sizeof (SF_BROADCAST_INFO)
|
||||
</PRE>
|
||||
|
||||
<DL>
|
||||
<DT>Return value: </DT>
|
||||
<DD>SF_TRUE if setting the Broadcast Extention chunk was successful and SF_FALSE
|
||||
otherwise.
|
||||
</DL>
|
||||
<!-- ========================================================================= -->
|
||||
|
||||
|
||||
|
@ -1166,16 +1401,8 @@ The SF_FORMAT_INFO struct is defined in <sndfile.h> as:
|
|||
<A HREF="http://www.mega-nerd.com/libsndfile/">
|
||||
http://www.mega-nerd.com/libsndfile/</A>.
|
||||
<BR>
|
||||
Version : 1.0.17
|
||||
Version : 1.0.19
|
||||
</P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: 6ee72f74-0fb3-42b6-a85c-d3331d7145b5
|
||||
-->
|
||||
|
|
|
@ -1009,16 +1009,8 @@ Example:
|
|||
<A HREF="http://www.mega-nerd.com/libsndfile/">
|
||||
http://www.mega-nerd.com/libsndfile/</A>.
|
||||
<BR>
|
||||
Version : 1.0.17
|
||||
Version : 1.0.19
|
||||
</P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: e610e74b-9ac0-4255-aff8-97ed229a6a3d
|
||||
-->
|
||||
|
|
|
@ -37,18 +37,10 @@ There are however a couple of caveats:
|
|||
</UL>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
The test program <B>multi_file.c</B> in the <B>tests/</B> directory of the
|
||||
The test program <B>multi_file_test.c</B> in the <B>tests/</B> directory of the
|
||||
source code tarball shows how this functionality is used to read and write
|
||||
embedded files.
|
||||
</P>
|
||||
<!-- pepper -->
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: 25bcfcfc-231d-4c31-bded-e4184bcaa815
|
||||
-->
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
libsndfile
|
||||
</TITLE>
|
||||
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
|
||||
<META NAME="Version" CONTENT="libsndfile-1.0.17">
|
||||
<META NAME="Version" CONTENT="libsndfile-1.0.19">
|
||||
<META NAME="Description" CONTENT="The libsndfile Home Page">
|
||||
<META NAME="Keywords" CONTENT="WAV AIFF AU SVX PAF NIST W64 libsndfile sound audio dsp Linux">
|
||||
<META NAME="ROBOTS" CONTENT="NOFOLLOW">
|
||||
|
@ -24,19 +24,20 @@
|
|||
<A HREF="#Features">Features</A> -+-
|
||||
<A HREF="#Similar">Similar or Related Projects</A> -+-
|
||||
<A HREF="NEWS">News</A>
|
||||
<BR>
|
||||
<br>
|
||||
<A HREF="development.html">Development</A> -+-
|
||||
<A HREF="api.html">Programming Interface</A> -+-
|
||||
<A HREF="bugs.html">Bug Reporting</A> -+-
|
||||
<A HREF="#Download">Download</A>
|
||||
<BR>
|
||||
<br>
|
||||
<A HREF="FAQ.html">FAQ</A> -+-
|
||||
<A HREF="lists.html">Mailing Lists</A> -+-
|
||||
<A HREF="ChangeLog">Change Log</A> -+-
|
||||
<A HREF="#Licensing">Licensing Information</A>
|
||||
<A HREF="#Licensing">Licensing Information</A> -+-
|
||||
<A HREF="#SeeAlso">See Also</A>
|
||||
</CENTER>
|
||||
|
||||
<BR><BR>
|
||||
<br><br>
|
||||
<P>
|
||||
Libsndfile is a C library for reading and writing files containing sampled sound
|
||||
(such as MS Windows WAV and the Apple/SGI AIFF format) through one standard
|
||||
|
@ -73,8 +74,6 @@
|
|||
<LI>mips-sgi-irix5.3 (using gcc)
|
||||
<LI>QNX 6.0
|
||||
<LI>i386-unknown-openbsd2.9
|
||||
<BR>
|
||||
<LI>Win32 (Microsoft Visual C++)
|
||||
</UL>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
|
@ -117,40 +116,41 @@
|
|||
The file formats are arranged across the top and encodings along the left
|
||||
edge.
|
||||
</P>
|
||||
<BR>
|
||||
<br>
|
||||
|
||||
<TABLE BORDER="1" cellpadding="2">
|
||||
<TR><TD> </TD>
|
||||
<TD ALIGN="center">Micro- soft<BR>WAV</TD>
|
||||
<TD ALIGN="center">SGI / Apple<BR>AIFF / AIFC</TD>
|
||||
<TD ALIGN="center">Sun / DEC /<BR>NeXT<BR>AU / SND</TD>
|
||||
<TD ALIGN="center">Header- less<BR>RAW</TD>
|
||||
<TD ALIGN="center">Paris Audio<BR>File<BR>PAF</TD>
|
||||
<TD ALIGN="center">Commo- dore<BR>Amiga<BR>IFF / SVX</TD>
|
||||
<TD ALIGN="center">Sphere<BR>Nist<BR>WAV</TD>
|
||||
<TD ALIGN="center">IRCAM<BR>SF</TD>
|
||||
<TD ALIGN="center">Creative<BR>VOC</TD>
|
||||
<TD ALIGN="center">Sound forge<BR>W64</TD>
|
||||
<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.0</A><BR>MAT4</TD>
|
||||
<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.1</A><BR>MAT5</TD>
|
||||
<TD ALIGN="center">Portable Voice Format<BR>PVF</TD>
|
||||
<TD ALIGN="center">Fasttracker 2<BR>XI</TD>
|
||||
<TD ALIGN="center">HMM Tool Kit<BR>HTK</TD>
|
||||
<TD ALIGN="center">Apple<BR>CAF</TD>
|
||||
<!-- TD ALIGN="center">Sound<BR>Designer II<BR>SD2</TD -->
|
||||
<TD ALIGN="center">Micro- soft<br>WAV</TD>
|
||||
<TD ALIGN="center">SGI / Apple<br>AIFF / AIFC</TD>
|
||||
<TD ALIGN="center">Sun / DEC /<br>NeXT<br>AU / SND</TD>
|
||||
<TD ALIGN="center">Header- less<br>RAW</TD>
|
||||
<TD ALIGN="center">Paris Audio<br>File<br>PAF</TD>
|
||||
<TD ALIGN="center">Commo- dore<br>Amiga<br>IFF / SVX</TD>
|
||||
<TD ALIGN="center">Sphere<br>Nist<br>WAV</TD>
|
||||
<TD ALIGN="center">IRCAM<br>SF</TD>
|
||||
<TD ALIGN="center">Creative<br>VOC</TD>
|
||||
<TD ALIGN="center">Sound forge<br>W64</TD>
|
||||
<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.0</A><br>MAT4</TD>
|
||||
<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.1</A><br>MAT5</TD>
|
||||
<TD ALIGN="center">Portable Voice Format<br>PVF</TD>
|
||||
<TD ALIGN="center">Fasttracker 2<br>XI</TD>
|
||||
<TD ALIGN="center">HMM Tool Kit<br>HTK</TD>
|
||||
<TD ALIGN="center">Apple<br>CAF</TD>
|
||||
<TD ALIGN="center">Sound<br>Designer II<br>SD2</TD>
|
||||
<TD ALIGN="center">Free Lossless Audio Codec<br>FLAC</TD>
|
||||
</TR>
|
||||
<TR><TD>Unsigned 8 bit PCM</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>Signed 8 bit PCM</TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD>R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>Signed 16 bit PCM</TD>
|
||||
|
@ -158,118 +158,128 @@
|
|||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>Signed 24 bit PCM</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>Signed 32 bit PCM</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD> </TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>32 bit float</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>64 bit double</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>u-law encoding</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
<TR><TD>A-law encoding</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD ALIGN="center">R/W</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>IMA ADPCM</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>MS ADPCM</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>GSM 6.10</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>G721 ADPCM 32kbps</TD>
|
||||
<TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>G723 ADPCM 24kbps</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>G723 ADPCM 40kbps</TD>
|
||||
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>12 bit DWVW</TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>16 bit DWVW</TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
|
||||
<TR><TD>24 bit DWVW</TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
<TR><TD>Ok Dialogic ADPCM</TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
<TR><TD>8 bit DPCM</TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
<TR><TD>16 bit DPCM</TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<p>
|
||||
From version 1.0.18, libsndfile also reads and writes
|
||||
<a href="http://flac.sourceforge.net/">FLAC</a>
|
||||
and
|
||||
<a href="http://www.vorbis.com/">Ogg/Vorbis</a>.
|
||||
</p>
|
||||
|
||||
<!-- pepper -->
|
||||
|
||||
<P>
|
||||
|
@ -277,13 +287,15 @@
|
|||
</P>
|
||||
<UL>
|
||||
<LI> Kurzweil K2000 sampler files.
|
||||
<LI> Ogg Vorbis.
|
||||
<LI> Ogg Speex.
|
||||
<LI> FLAC.
|
||||
</UL>
|
||||
<P>
|
||||
I have decided that I will not be adding support for MPEG Layer 3 due to the
|
||||
patent issues surrounding this file format.
|
||||
I have decided that I will not be adding support for MPEG Layer 3 (commonly
|
||||
known as MP3) due to the patent issues surrounding this file format.
|
||||
See
|
||||
<a href="http://www.mega-nerd.com/libsndfile/FAQ.html#Q020">
|
||||
the FAQ</a>
|
||||
for more.
|
||||
</P>
|
||||
<P>
|
||||
Other file formats may also be added on request.
|
||||
|
@ -346,15 +358,19 @@
|
|||
<LI>Version 1.0.16 (Apr 30 2006) Add support for RIFX. Other minor feature enhancements and
|
||||
bug fixes.
|
||||
<LI>Version 1.0.17 (Aug 31 2006) Add C++ wrapper sndfile.hh. Minor bug fixes and cleanups.
|
||||
<LI>Version 1.0.18 (Feb 07 2009) Add Ogg/Vorbis suppport, remove captive libraries, many
|
||||
new features and bug fixes. Generate Win32 and Win64 pre-compiled binaries.
|
||||
<LI>Version 1.0.19 (Mar 02 2009) Fix for CVE-2009-0186. Huge number of minor fixes as a
|
||||
result of static analysis.
|
||||
</UL>
|
||||
|
||||
<A NAME="Similar"></A>
|
||||
<H1><B>Similar or Related Projects</B></H1>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="http://home.sprynet.com/~cbagwell/sox.html">SoX</A> is a program for
|
||||
<LI><A HREF="http://sox.sourceforge.net/">SoX</A> is a program for
|
||||
converting between sound file formats.
|
||||
<LI><A HREF="http://members.home.com/ve3wwg/gnuwave.html">Wavplay</A> started out
|
||||
<LI><A HREF="http://www.hitsquad.com/smm/programs/WavPlay/">Wavplay</A> started out
|
||||
as a minimal WAV file player under Linux and has mutated into Gnuwave, a client/server
|
||||
application for more general multimedia and games sound playback.
|
||||
<LI><A HREF="http://www.68k.org/~michael/audiofile/">Audiofile</A> (libaudiofile) is
|
||||
|
@ -368,10 +384,14 @@
|
|||
<A NAME="Licensing"></A>
|
||||
<H1><B>Licensing</B></H1>
|
||||
<P>
|
||||
libsndfile is released under the terms of the GNU Lesser General Public License. You may
|
||||
read the license
|
||||
<A HREF="http://www.gnu.org/copyleft/lesser.html">here</A>
|
||||
or read a simple explanation of the ideas behind the GPL and the LGPL
|
||||
libsndfile is released under the terms of the GNU Lesser General Public License,
|
||||
of which there are two versions;
|
||||
<a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">version 2.1</a>
|
||||
and
|
||||
<a href="http://www.gnu.org/copyleft/lesser.html">version 3</a>.
|
||||
To mamximise the compatibility of libsndfile, the user may choose to use libsndfile
|
||||
under either of the above two licenses.
|
||||
You can also read a simple explanation of the ideas behind the GPL and the LGPL
|
||||
<A HREF="http://www.gnu.org/copyleft/copyleft.html">here</A>.
|
||||
</P>
|
||||
<P>
|
||||
|
@ -392,14 +412,13 @@
|
|||
<A HREF="http://www.opensource.org/">Open Source</A>.
|
||||
However, if you put in a great deal of effort building a huge application
|
||||
which simply uses libsndfile for file I/O, then I have no problem with you releasing
|
||||
that as closed source and charging as much money as you want for it as long as you
|
||||
that as closed source and charging as much money as you want for it as long as you
|
||||
abide by <A HREF="http://www.gnu.org/copyleft/lesser.html">the license</A>.
|
||||
</P>
|
||||
<A NAME="Download"></A>
|
||||
|
||||
<P>
|
||||
What I don't like to see is things like Steve Dekorte's
|
||||
<A HREF="http://www.dekorte.com/Software/OSX/SoundConverter/">SoundConverter</A>
|
||||
for Mac OSX.
|
||||
What I don't like to see is things like Steve Dekorte's <b>SoundConverter</b>
|
||||
(no I won't link to his page) for Mac OSX.
|
||||
Mr Dekorte has grabbed a number of Free Software packages and wrapped them in a
|
||||
rather amateurish, buggy GUI and released the result as shareware.
|
||||
He charges US$10 for the full version when his contribution to the whole is, by
|
||||
|
@ -409,28 +428,32 @@
|
|||
less than 10%.
|
||||
</P>
|
||||
|
||||
<A NAME="Download"></A>
|
||||
<H1><B>Download</B></H1>
|
||||
<P>
|
||||
Here is the latest version. It is available in the following formats (I am no longer
|
||||
distributing RPMs).
|
||||
Here is the latest version. It is available in the following formats:
|
||||
</P>
|
||||
<UL>
|
||||
<LI>Source code as a .tar.gz :
|
||||
<A HREF="libsndfile-1.0.17.tar.gz">libsndfile-1.0.17.tar.gz</A>
|
||||
<A HREF="libsndfile-1.0.19.tar.gz">libsndfile-1.0.19.tar.gz</A>
|
||||
and
|
||||
<A HREF="libsndfile-1.0.17.tar.gz.asc">(GPG signature)</A>.
|
||||
<LI>Windows .zip file including precompiled binaries and all source code :
|
||||
<A HREF="libsndfile-1_0_17.zip">libsndfile-1_0_17.zip</A>
|
||||
and
|
||||
<A HREF="libsndfile-1_0_17.zip.asc">(GPG signature)</A>.
|
||||
<A HREF="libsndfile-1.0.19.tar.gz.asc">(GPG signature)</A>.
|
||||
<LI>Win32 installer:
|
||||
<A HREF="libsndfile-1.0.19-w32-setup.exe">
|
||||
libsndfile-1.0.19-w32-setup.exe</A> (thoroughly tested under
|
||||
<a href="http://www.winehq.com/">Wine</a> and Windows XP).
|
||||
<LI>Win64 installer:
|
||||
<A HREF="libsndfile-1.0.19-w64-setup.exe">
|
||||
libsndfile-1.0.19-w64-setup.exe</A> (alpha quality release).
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
Compiling libsndfile is relatively easy. The INSTALL file in the top level directory
|
||||
gives instructions on compiling and installing libsndfile on Unix-like systems
|
||||
(including MacOSX). For Win32 there are instructions in the doc/ directory of the
|
||||
tarball. These instructions are mirrored
|
||||
<A HREF="win32.html">here</A>.
|
||||
</P>
|
||||
The Win32 installer was compiled for Windows XP but should also work on Windows
|
||||
2000 and Vista.
|
||||
It may even work on earlier versions of Windows.
|
||||
The Win64 is pretty much untested.
|
||||
</p>
|
||||
|
||||
<P>
|
||||
Pre-release versions of libsndfile are available
|
||||
<A HREF="http://www.mega-nerd.com/tmp/">here</A>
|
||||
|
@ -438,9 +461,18 @@
|
|||
<A HREF="lists.html">libsndfile-devel</A>
|
||||
mailing list.
|
||||
</P>
|
||||
<BR><BR>
|
||||
|
||||
<HR>
|
||||
<A NAME="SeeAlso"></A>
|
||||
<H1><B>See Also</B></H1>
|
||||
<UL>
|
||||
<LI><a href="http://www.mega-nerd.com/libsndfile/tools/">
|
||||
sndfile-tools</a>
|
||||
: a small collection of programs which use libsndfile.
|
||||
</UL>
|
||||
|
||||
<br><br>
|
||||
|
||||
<hr>
|
||||
|
||||
<P>
|
||||
The latest version of this document can be found
|
||||
|
@ -455,7 +487,7 @@ Author :
|
|||
<P>
|
||||
This page has been accessed
|
||||
<IMG SRC=
|
||||
"/cgi-bin/Count.cgi?ft=6|frgb=55;55;55|tr=0|trgb=0;0;0|wxh=15;20|md=6|dd=B|st=1|sh=1|df=libsndfile.dat"
|
||||
"/cgi-bin/Count.cgi?ft=6|frgb=55;55;55|tr=0|trgb=0;0;0|wxh=15;20|md=7|dd=B|st=1|sh=1|df=libsndfile.dat"
|
||||
HEIGHT=30 WIDTH=100 ALT="counter.gif">
|
||||
times.
|
||||
</P>
|
||||
|
@ -463,14 +495,6 @@ times.
|
|||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
|
||||
<BR><BR>
|
||||
<br><br>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: a96adffb-3017-46e2-82a0-6d77832b14d5
|
||||
-->
|
||||
|
|
|
@ -2,6 +2,7 @@ body {
|
|||
background : black ;
|
||||
color : white ;
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
line-height: 1.5 ;
|
||||
}
|
||||
td {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
|
|
|
@ -2,6 +2,7 @@ body {
|
|||
background : @HTML_BGCOLOUR@ ;
|
||||
color : @HTML_FGCOLOUR@ ;
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
line-height: 1.5 ;
|
||||
}
|
||||
td {
|
||||
font-family : arial, helvetica, sans-serif ;
|
||||
|
|
|
@ -49,11 +49,3 @@ copy of all emails to the libsndfile-announce list.
|
|||
<!-- pepper -->
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: 71a13776-1e29-47ae-8eee-e376e73dc4db
|
||||
-->
|
||||
|
|
|
@ -76,25 +76,25 @@ top of file should you need to have a look at it.
|
|||
|
||||
Step 5
|
||||
------
|
||||
Add a call to your open read function from sf_open_read ().
|
||||
Add a call to your open function from psf_open_file ().
|
||||
|
||||
Edit src/sndfile.c and find the switch statement in sf_open_read (). It starts
|
||||
Edit src/sndfile.c and find the switch statement in psf_open_file (). It starts
|
||||
like this:
|
||||
|
||||
switch (filetype)
|
||||
{ case SF_FORMAT_WAV :
|
||||
sf_errno = wav_open_read (psf) ;
|
||||
error = wav_open (psf) ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_AIFF :
|
||||
sf_errno = aiff_open_read (psf) ;
|
||||
error = aiff_open (psf) ;
|
||||
break ;
|
||||
|
||||
Towards the bottom of this switch statement your should add one for the new file
|
||||
type. Something like:
|
||||
|
||||
case SF_FORMAT_WACK :
|
||||
sf_errno = whacky_open_read (psf) ;
|
||||
sf_errno = whacky_open (psf) ;
|
||||
break ;
|
||||
|
||||
Setp 6
|
||||
|
@ -112,9 +112,9 @@ Implement your open read function. The best way to do this is by coding
|
|||
something much like one of the other file formats. The file src/au.c might be
|
||||
a good place to start.
|
||||
|
||||
In src/whacky.c you should now implement the function whacky_open_read() which
|
||||
In src/whacky.c you should now implement the function whacky_open() which
|
||||
was prototyped in src/common.h. This function should return 0 on success and
|
||||
a negative number on error.
|
||||
a non-zero number on error.
|
||||
|
||||
Error values are defined in src/common.h in a enum which starts at SFE_NO_ERROR.
|
||||
When adding a new error value, you also need to add an error string to the
|
||||
|
|
|
@ -115,11 +115,3 @@
|
|||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: 6e99f38b-e2ad-4fdd-bc0f-94bf0c66d243
|
||||
-->
|
||||
|
|
|
@ -68,11 +68,3 @@
|
|||
</P>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: 3c1ed1be-9875-47f9-90f3-015da975d622
|
||||
-->
|
||||
|
|
|
@ -50,11 +50,3 @@
|
|||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: a7ae18b0-bf27-4c50-b8b2-e209d0cd36c5
|
||||
-->
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
<TITLE>
|
||||
libsndfile Tutorial
|
||||
</TITLE>
|
||||
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
|
||||
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
|
||||
</HEAD>
|
||||
|
||||
<BODY>
|
||||
<!-- pepper -->
|
||||
<H1><BR>libsndfile Tutorial</H1>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
<b>More coming soon.</b>
|
||||
</P>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
For now, the best place to look for example code is the <tt>examples/</tt>
|
||||
directory of the source code distribution and the libsndfile test suite which
|
||||
is located in the <tt>tests/</tt> directory of the source code distribution.
|
||||
</P>
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
|
@ -14,115 +14,34 @@
|
|||
<H1><BR>Building libsndfile on Win32</H1>
|
||||
|
||||
<P><B>
|
||||
Note : For pre-compiled binaries for windows, see the main web page.
|
||||
Note : For pre-compiled binaries for windows, both for win32 and win64, see the
|
||||
main web page.
|
||||
</B></P>
|
||||
|
||||
<P>
|
||||
There are currently two ways of building libsndfile under Win32:
|
||||
</P>
|
||||
<UL>
|
||||
<LI> Using the free <A HREF="#MinGW">MinGW</A> tools.
|
||||
<LI> Using Cygwin (this is the full Cygwin without the -mno-cygwin option).
|
||||
</UL>
|
||||
|
||||
<P><B>
|
||||
Building libsndfile using the microsoft compiler does not currently work.
|
||||
Microsoft's compiler is a C++ compiler and does not compile a number of ISO
|
||||
C99 Standard constructs.
|
||||
If you insist on compiling libsndfile with the microsoft compiler you are
|
||||
on your own.
|
||||
</B></P>
|
||||
<P><B>
|
||||
However, even though the libsndfile source code cannot be compiled with
|
||||
the microsoft compiler, the pre-compiled windows DLL distributed on the
|
||||
main web page can be used with C++ projects compiled with the microsoft
|
||||
compiler.
|
||||
</B></P>
|
||||
|
||||
<P>
|
||||
The free MinGW tools are the preferred option because they are a free (as in
|
||||
beer and speech), easily obtainable and much closer to the Linux/GCC
|
||||
environment on which libsndfile is developed.
|
||||
</P>
|
||||
|
||||
<A NAME="MinGW"></A>
|
||||
<H2><BR>Building libsndfile using MinGW.</H2>
|
||||
<P>
|
||||
The MinGW tools are available from <A HREF="http://www.mingw.org/">
|
||||
http://www.mingw.org/</A>.
|
||||
The files you will need will be named something like:
|
||||
</P>
|
||||
<UL>
|
||||
<LI> msysDTK-1.0.1.exe
|
||||
<LI> MSYS-1.0.10.exe
|
||||
<LI> gcc-core-3.4.2-20040916-1.tar.gz
|
||||
<LI> gcc-g++-3.4.2-20040916-1.tar.gz
|
||||
<LI> binutils-2.15.91-20040901-1.tar.gz
|
||||
<LI> mingw-runtime-3.9.tar.gz
|
||||
<LI> w32api-3.6.tar.gz
|
||||
<LI> mingw-utils-0.3.tar.gz
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
They should be installed using the directions on the MinGW site.
|
||||
I know the instructions aren't great, but I don't have the time or expertise
|
||||
to write better ones.
|
||||
There is currently only one way of building libsndfile for Win32 and Win64;
|
||||
cross compiling from Linux using the MinGW cross compiler.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Once you have the tools installed you will get an icon named <B>MSYS</B> on
|
||||
your desktop.
|
||||
Clicking on that icon will bring up something that looks a little like an
|
||||
xterm.
|
||||
libsndfile is written to be compiled by a compiler which supports large
|
||||
chunks of the 1999 ISO C Standard.
|
||||
Unfortunately, the microsoft compiler supports close to nothing of this
|
||||
standard and hence is not suitable for libsndfile.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Assuming that you have downloaded the <B>.tar.gz</B> file into the
|
||||
<B>C:\temp\</B> directory you should now be able to execute the following
|
||||
commands:
|
||||
It <b>may</b> be possible to compile libsndfile on windows using the
|
||||
<a href="http://www.mingw.org/">MinGW</a>
|
||||
compiler suite, but I haven't tested that and have no interest in supporting
|
||||
that.
|
||||
</P>
|
||||
|
||||
<PRE>
|
||||
tar zxf /c/temp/libsndfile.X.Y.Z.tar.gz
|
||||
cd libsndfile-X.Y.Z
|
||||
./configure
|
||||
make
|
||||
make check
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
If there is a failure during compiling or the "make check" stage, you should
|
||||
check that you are using the current stable version of the MinGW tools, and
|
||||
the latest version of libsndfile before sending the author a bug report.
|
||||
</P>
|
||||
|
||||
<P>
|
||||
Once this is done, anyone interested in using libsndfile in other projects
|
||||
will be interested in the following files:
|
||||
</P>
|
||||
<UL>
|
||||
<LI> libsndfile.dll
|
||||
<LI> libsndfile.lib
|
||||
<LI> libsndfile.def
|
||||
<LI> src/sndfile.h
|
||||
<LI> doc/*.html
|
||||
</UL>
|
||||
|
||||
<!--===========================================================================-->
|
||||
|
||||
<!-- pepper -->
|
||||
<H2><BR>Compile Problems</H2>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
Compile problems using the above method of building the libsndfile DLL on Win32 should
|
||||
be emailed to
|
||||
<A HREF="mailto:erikd@mega-nerd.com">
|
||||
Erik de Castro Lopo</a>.
|
||||
</P>
|
||||
<!-- pepper -->
|
||||
<P>
|
||||
If you are using some other method to compile the libsndfile DLL you are on your own.
|
||||
</P>
|
||||
<BR>
|
||||
<!-- pepper -->
|
||||
<!-- pepper -->
|
||||
|
@ -131,11 +50,3 @@ If you are using some other method to compile the libsndfile DLL you are on your
|
|||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: b32ddb11-eb51-425f-9d39-b8b66284f129
|
||||
-->
|
||||
|
|
|
@ -1,46 +1,24 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
bin_PROGRAMS = sndfile-info sndfile-play sndfile-convert
|
||||
noinst_PROGRAMS = make_sine sfprocess list_formats generate sndfilehandle sndfile-to-text
|
||||
|
||||
noinst_PROGRAMS = make_sine sfprocess list_formats cooledit-fixer generate
|
||||
INCLUDES = -I$(top_srcdir)/src
|
||||
|
||||
# This is the BeOS version of sndfile-play. It needs to be compiled with the C++
|
||||
# compiler.
|
||||
EXTRA_DIST = sndfile-play-beos.cpp
|
||||
sndfile_to_text_SOURCES = sndfile-to-text.c
|
||||
sndfile_to_text_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
|
||||
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
|
||||
make_sine_SOURCES = make_sine.c
|
||||
make_sine_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
SNDFILEDIR =../src
|
||||
INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS)
|
||||
sfprocess_SOURCES = sfprocess.c
|
||||
sfprocess_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_info_SOURCES = sndfile-info.c
|
||||
sndfile_info_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
list_formats_SOURCES = list_formats.c
|
||||
list_formats_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_play_SOURCES = sndfile-play.c
|
||||
sndfile_play_LDADD = $(SNDFILEDIR)/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
|
||||
generate_SOURCES = generate.c
|
||||
generate_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_convert_SOURCES = sndfile-convert.c
|
||||
sndfile_convert_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
|
||||
make_sine_SOURCES = make_sine.c
|
||||
make_sine_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
|
||||
sfprocess_SOURCES = sfprocess.c
|
||||
sfprocess_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
|
||||
list_formats_SOURCES = list_formats.c
|
||||
list_formats_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
|
||||
cooledit_fixer_SOURCES = cooledit-fixer.c
|
||||
cooledit_fixer_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
|
||||
generate_SOURCES = generate.c
|
||||
generate_LDADD = $(SNDFILEDIR)/libsndfile.la
|
||||
|
||||
## Do not edit or modify anything in this comment block.
|
||||
## The arch-tag line is a file identity tag for the GNU Arch
|
||||
## revision control system.
|
||||
##
|
||||
## arch-tag: faeb8674-e417-4162-9ac9-05f2b8369b57
|
||||
sndfilehandle_SOURCES = sndfilehandle.cc
|
||||
sndfilehandle_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
|
|
|
@ -1,19 +1,33 @@
|
|||
/*
|
||||
** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2002-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
** All rights reserved.
|
||||
**
|
||||
** 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.
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** 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.
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
@ -115,11 +129,3 @@ encode_file (const char *infilename, const char *outfilename, int filetype)
|
|||
return ;
|
||||
} /* encode_file */
|
||||
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: fe28ef37-ae89-4f61-966b-0b1f68e37425
|
||||
*/
|
||||
|
|
|
@ -1,19 +1,33 @@
|
|||
/*
|
||||
** Copyright (C) 2001-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
** All rights reserved.
|
||||
**
|
||||
** 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.
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** 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.
|
||||
** * 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>
|
||||
|
@ -67,10 +81,3 @@ main (void)
|
|||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 58127a0c-93a2-46cf-b615-fcb9adacf3f1
|
||||
*/
|
||||
|
|
|
@ -1,19 +1,33 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
** All rights reserved.
|
||||
**
|
||||
** 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.
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** 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.
|
||||
** * 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>
|
||||
|
@ -80,10 +94,3 @@ main (void)
|
|||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: fd945a2c-a306-49ef-a262-6336ced15246
|
||||
*/
|
||||
|
|
|
@ -1,19 +1,33 @@
|
|||
/*
|
||||
** Copyright (C) 2001-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2001-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
** All rights reserved.
|
||||
**
|
||||
** 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.
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** 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.
|
||||
** * 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>
|
||||
|
@ -121,11 +135,3 @@ process_data (double *data, int count, int channels)
|
|||
return ;
|
||||
} /* process_data */
|
||||
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: de9fdd1e-b807-41ef-9d51-075ba383e536
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
** Copyright (C) 2008-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define BLOCK_SIZE 512
|
||||
|
||||
static void
|
||||
print_usage (char *progname)
|
||||
{ printf ("\nUsage : %s <input file> <output file>\n", progname) ;
|
||||
puts ("\n"
|
||||
" Where the output file will contain a line for each frame\n"
|
||||
" and a column for each channel.\n"
|
||||
) ;
|
||||
|
||||
} /* print_usage */
|
||||
|
||||
static void
|
||||
convert_to_text (SNDFILE * infile, FILE * outfile, int channels)
|
||||
{ float buf [channels * BLOCK_SIZE] ;
|
||||
int k, m, readcount ;
|
||||
|
||||
while ((readcount = sf_readf_float (infile, buf, BLOCK_SIZE)) > 0)
|
||||
{ for (k = 0 ; k < readcount ; k++)
|
||||
{ for (m = 0 ; m < channels ; m++)
|
||||
fprintf (outfile, " % 12.10f", buf [k * channels + m]) ;
|
||||
fprintf (outfile, "\n") ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* convert_to_text */
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{ char *progname, *infilename, *outfilename ;
|
||||
SNDFILE *infile = NULL ;
|
||||
FILE *outfile = NULL ;
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
|
||||
if (argc != 3)
|
||||
{ print_usage (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
infilename = argv [1] ;
|
||||
outfilename = argv [2] ;
|
||||
|
||||
if (strcmp (infilename, outfilename) == 0)
|
||||
{ printf ("Error : Input and output filenames are the same.\n\n") ;
|
||||
print_usage (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (infilename [0] == '-')
|
||||
{ printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
|
||||
print_usage (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (outfilename [0] == '-')
|
||||
{ printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
|
||||
print_usage (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)
|
||||
{ printf ("Not able to open input file %s.\n", infilename) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
/* Open the output file. */
|
||||
if ((outfile = fopen (outfilename, "w")) == NULL)
|
||||
{ printf ("Not able to open output file %s : %s\n", outfilename, sf_strerror (NULL)) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
fprintf (outfile, "# Converted from file %s.\n", infilename) ;
|
||||
fprintf (outfile, "# Channels %d, Sample rate %d\n", sfinfo.channels, sfinfo.samplerate) ;
|
||||
|
||||
convert_to_text (infile, outfile, sfinfo.channels) ;
|
||||
|
||||
sf_close (infile) ;
|
||||
fclose (outfile) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
** Copyright (C) 2007 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include <sndfile.hh>
|
||||
|
||||
#define BUFFER_LEN 1024
|
||||
|
||||
static void
|
||||
create_file (const char * fname, int format)
|
||||
{ static short buffer [BUFFER_LEN] ;
|
||||
|
||||
SndfileHandle file ;
|
||||
int channels = 2 ;
|
||||
int srate = 48000 ;
|
||||
|
||||
printf ("Creating file named '%s'\n", fname) ;
|
||||
|
||||
file = SndfileHandle (fname, SFM_WRITE, format, channels, srate) ;
|
||||
|
||||
memset (buffer, 0, sizeof (buffer)) ;
|
||||
|
||||
file.write (buffer, BUFFER_LEN) ;
|
||||
|
||||
puts ("") ;
|
||||
/*
|
||||
** The SndfileHandle object will automatically close the file and
|
||||
** release all allocated memory when the object goes out of scope.
|
||||
** This is the Resource Acquisition Is Initailization idom.
|
||||
** See : http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
|
||||
*/
|
||||
} /* create_file */
|
||||
|
||||
static void
|
||||
read_file (const char * fname)
|
||||
{ static short buffer [BUFFER_LEN] ;
|
||||
|
||||
SndfileHandle file ;
|
||||
|
||||
file = SndfileHandle (fname) ;
|
||||
|
||||
printf ("Opened file '%s'\n", fname) ;
|
||||
printf (" Sample rate : %d\n", file.samplerate ()) ;
|
||||
printf (" Channels : %d\n", file.channels ()) ;
|
||||
|
||||
file.read (buffer, BUFFER_LEN) ;
|
||||
|
||||
puts ("") ;
|
||||
|
||||
/* RAII takes care of destroying SndfileHandle object. */
|
||||
} /* read_file */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{ const char * fname = "test.wav" ;
|
||||
|
||||
puts ("\nSimple example showing usage of the C++ SndfileHandle object.\n") ;
|
||||
|
||||
create_file (fname, SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
|
||||
|
||||
read_file (fname) ;
|
||||
|
||||
puts ("Done.\n") ;
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
|
|
@ -4,9 +4,3 @@ man_MANS = sndfile-info.1 sndfile-play.1 sndfile-convert.1
|
|||
|
||||
EXTRA_DIST = sndfile-info.1 sndfile-play.1 sndfile-convert.1
|
||||
|
||||
## Do not edit or modify anything in this comment block.
|
||||
## The arch-tag line is a file identity tag for the GNU Arch
|
||||
## revision control system.
|
||||
##
|
||||
## arch-tag: a7e49b1a-d2f1-414d-aa5a-3a91ef566d9f
|
||||
|
||||
|
|
|
@ -20,9 +20,3 @@ the output file. Run "sndfile-convert --help" for more information.
|
|||
.SH AUTHOR
|
||||
This manual page was written by Erik de Castro Lopo <erikd@mega-nerd.com>.
|
||||
|
||||
.\" Do not edit or modify anything in this comment block.
|
||||
.\" The following line is a file identity tag for the GNU Arch
|
||||
.\" revision control system.
|
||||
|
||||
.\" arch-tag: 23aa443e-f38d-488b-b7e3-290fc5c77d20
|
||||
|
||||
|
|
|
@ -14,9 +14,3 @@ This manual page was originally written by Joshua Haberman
|
|||
others). Further additions have been made by Erik de Castro Lopo
|
||||
<erikd@mega-nerd.com>.
|
||||
|
||||
.\" Do not edit or modify anything in this comment block.
|
||||
.\" The following line is a file identity tag for the GNU Arch
|
||||
.\" revision control system.
|
||||
|
||||
.\" arch-tag: f9eca35e-5519-434d-bc55-fe845df977cd
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ sndfile-play \- play a sound file
|
|||
.SH DESCRIPTION
|
||||
sndfile-play plays the specified sound file using :
|
||||
.EX
|
||||
ALSA on Linux
|
||||
/dev/dsp on systems supporting OSS (including Linux)
|
||||
/dev/audio on Sun Solaris
|
||||
CoreAudio on Apple MacOSX
|
||||
|
@ -33,8 +34,3 @@ This manual page was originally written by Joshua Haberman
|
|||
others). Further additions have been made by Erik de Castro Lopo
|
||||
<erikd@mega-nerd.com>.
|
||||
|
||||
.\" Do not edit or modify anything in this comment block.
|
||||
.\" The arch-tag line is a file identity tag for the GNU Arch
|
||||
.\" revision control system.
|
||||
|
||||
.\" arch-tag: 5a0120d9-040c-464e-b01e-89dc2c2428c9
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
## 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
|
||||
|
||||
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
|
||||
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS)
|
||||
|
||||
# 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_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_convert_SOURCES = sndfile-convert.c common.c common.h
|
||||
sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
||||
sndfile_cmp_SOURCES = sndfile-cmp.c
|
||||
sndfile_cmp_LDADD = $(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_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
|
|
@ -0,0 +1,620 @@
|
|||
# Makefile.in generated by automake 1.10.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.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
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)
|
||||
subdir = programs
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/M4/add_cflags.m4 \
|
||||
$(top_srcdir)/M4/add_cxxflags.m4 $(top_srcdir)/M4/clip_mode.m4 \
|
||||
$(top_srcdir)/M4/endian.m4 $(top_srcdir)/M4/extra_largefile.m4 \
|
||||
$(top_srcdir)/M4/extra_pkg.m4 \
|
||||
$(top_srcdir)/M4/flexible_array.m4 \
|
||||
$(top_srcdir)/M4/gcc_version.m4 $(top_srcdir)/M4/libtool.m4 \
|
||||
$(top_srcdir)/M4/lrint.m4 $(top_srcdir)/M4/lrintf.m4 \
|
||||
$(top_srcdir)/M4/ltoptions.m4 $(top_srcdir)/M4/ltsugar.m4 \
|
||||
$(top_srcdir)/M4/ltversion.m4 $(top_srcdir)/M4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/M4/mkoctfile_version.m4 \
|
||||
$(top_srcdir)/M4/octave.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_sndfile_cmp_OBJECTS = sndfile-cmp.$(OBJEXT)
|
||||
sndfile_cmp_OBJECTS = $(am_sndfile_cmp_OBJECTS)
|
||||
sndfile_cmp_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)
|
||||
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)
|
||||
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)
|
||||
sndfile_play_OBJECTS = $(am_sndfile_play_OBJECTS)
|
||||
sndfile_play_DEPENDENCIES = $(top_builddir)/src/libsndfile.la \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
|
||||
depcomp = $(SHELL) $(top_srcdir)/Cfg/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
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)
|
||||
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) \
|
||||
$(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_get_SOURCES) \
|
||||
$(sndfile_metadata_set_SOURCES) $(sndfile_play_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILER_IS_GCC = @COMPILER_IS_GCC@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
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@
|
||||
FGREP = @FGREP@
|
||||
FLAC_CFLAGS = @FLAC_CFLAGS@
|
||||
FLAC_LIBS = @FLAC_LIBS@
|
||||
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
|
||||
GCC_MINOR_VERSION = @GCC_MINOR_VERSION@
|
||||
GCC_VERSION = @GCC_VERSION@
|
||||
GETCONF = @GETCONF@
|
||||
GREP = @GREP@
|
||||
HAVE_AUTOGEN = @HAVE_AUTOGEN@
|
||||
HAVE_JACK = @HAVE_JACK@
|
||||
HAVE_MKOCTFILE = @HAVE_MKOCTFILE@
|
||||
HAVE_OCTAVE = @HAVE_OCTAVE@
|
||||
HAVE_OCTAVE_CONFIG = @HAVE_OCTAVE_CONFIG@
|
||||
HAVE_WINE = @HAVE_WINE@
|
||||
HTML_BGCOLOUR = @HTML_BGCOLOUR@
|
||||
HTML_FGCOLOUR = @HTML_FGCOLOUR@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
JACK_CFLAGS = @JACK_CFLAGS@
|
||||
JACK_LIBS = @JACK_LIBS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MKOCTFILE = @MKOCTFILE@
|
||||
MKOCTFILE_VERSION = @MKOCTFILE_VERSION@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OCTAVE = @OCTAVE@
|
||||
OCTAVE_CONFIG = @OCTAVE_CONFIG@
|
||||
OCTAVE_CONFIG_VERSION = @OCTAVE_CONFIG_VERSION@
|
||||
OCTAVE_DEST_MDIR = @OCTAVE_DEST_MDIR@
|
||||
OCTAVE_DEST_ODIR = @OCTAVE_DEST_ODIR@
|
||||
OCTAVE_VERSION = @OCTAVE_VERSION@
|
||||
OGG_CFLAGS = @OGG_CFLAGS@
|
||||
OGG_LIBS = @OGG_LIBS@
|
||||
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
|
||||
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SF_COUNT_MAX = @SF_COUNT_MAX@
|
||||
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
|
||||
SHELL = @SHELL@
|
||||
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
|
||||
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
|
||||
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
|
||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STRIP = @STRIP@
|
||||
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
|
||||
VERSION = @VERSION@
|
||||
VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
|
||||
VORBISENC_LIBS = @VORBISENC_LIBS@
|
||||
VORBIS_CFLAGS = @VORBIS_CFLAGS@
|
||||
VORBIS_LIBS = @VORBIS_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
htmldocdir = @htmldocdir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS)
|
||||
|
||||
# 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_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_convert_SOURCES = sndfile-convert.c common.c common.h
|
||||
sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
sndfile_cmp_SOURCES = sndfile-cmp.c
|
||||
sndfile_cmp_LDADD = $(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_LDADD = $(top_builddir)/src/libsndfile.la
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu programs/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu programs/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
sndfile-cmp$(EXEEXT): $(sndfile_cmp_OBJECTS) $(sndfile_cmp_DEPENDENCIES)
|
||||
@rm -f sndfile-cmp$(EXEEXT)
|
||||
$(LINK) $(sndfile_cmp_OBJECTS) $(sndfile_cmp_LDADD) $(LIBS)
|
||||
sndfile-convert$(EXEEXT): $(sndfile_convert_OBJECTS) $(sndfile_convert_DEPENDENCIES)
|
||||
@rm -f sndfile-convert$(EXEEXT)
|
||||
$(LINK) $(sndfile_convert_OBJECTS) $(sndfile_convert_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)
|
||||
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)
|
||||
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)
|
||||
sndfile-play$(EXEEXT): $(sndfile_play_OBJECTS) $(sndfile_play_DEPENDENCIES)
|
||||
@rm -f sndfile-play$(EXEEXT)
|
||||
$(LINK) $(sndfile_play_OBJECTS) $(sndfile_play_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@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-convert.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-info.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@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@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
|
||||
@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
|
||||
@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
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(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" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic clean-libtool ctags distclean distclean-compile \
|
||||
distclean-generic distclean-libtool distclean-tags distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-binPROGRAMS install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
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:
|
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2008 George Blood Audio
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN 4096
|
||||
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
void
|
||||
sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
{ static double data [BUFFER_LEN], max ;
|
||||
int frames, readcount, k ;
|
||||
|
||||
frames = BUFFER_LEN / channels ;
|
||||
readcount = frames ;
|
||||
|
||||
sf_command (infile, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
|
||||
|
||||
if (max < 1.0)
|
||||
{ while (readcount > 0)
|
||||
{ readcount = sf_readf_double (infile, data, frames) ;
|
||||
sf_writef_double (outfile, data, readcount) ;
|
||||
} ;
|
||||
}
|
||||
else
|
||||
{ sf_command (infile, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_double (infile, data, frames) ;
|
||||
for (k = 0 ; k < readcount * channels ; k++)
|
||||
data [k] /= max ;
|
||||
sf_writef_double (outfile, data, readcount) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* sfe_copy_data_fp */
|
||||
|
||||
void
|
||||
sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels)
|
||||
{ static int data [BUFFER_LEN] ;
|
||||
int frames, readcount ;
|
||||
|
||||
frames = BUFFER_LEN / channels ;
|
||||
readcount = frames ;
|
||||
|
||||
while (readcount > 0)
|
||||
{ readcount = sf_readf_int (infile, data, frames) ;
|
||||
sf_writef_int (outfile, data, readcount) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* sfe_copy_data_int */
|
||||
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
static int
|
||||
merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const METADATA_INFO * info)
|
||||
{ SF_BROADCAST_INFO_2K binfo ;
|
||||
int infileminor ;
|
||||
|
||||
memset (&binfo, 0, sizeof (binfo)) ;
|
||||
|
||||
if ((SF_FORMAT_TYPEMASK & format) != SF_FORMAT_WAV)
|
||||
{ printf ("Error : This is not a WAV file and hence broadcast info cannot be added to it.\n\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
infileminor = SF_FORMAT_SUBMASK & format ;
|
||||
|
||||
switch (infileminor)
|
||||
{ case SF_FORMAT_PCM_16 :
|
||||
case SF_FORMAT_PCM_24 :
|
||||
case SF_FORMAT_PCM_32 :
|
||||
break ;
|
||||
|
||||
default :
|
||||
printf (
|
||||
"Warning : The EBU Technical Recommendation R68-2000 states that the only\n"
|
||||
" allowed encodings are Linear PCM and MPEG3. This file is not in\n"
|
||||
" the right format.\n\n"
|
||||
) ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
if (sf_command (infile, SFC_GET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
|
||||
{ if (infile == outfile)
|
||||
{ printf (
|
||||
"Error : Attempting in-place broadcast info update, but file does not\n"
|
||||
" have a 'bext' chunk to modify. The solution is to specify both\n"
|
||||
" input and output files on the command line.\n\n"
|
||||
) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
#define REPLACE_IF_NEW(x) \
|
||||
if (info->x != NULL) \
|
||||
{ memset (binfo.x, 0, sizeof (binfo.x)) ; \
|
||||
memcpy (binfo.x, info->x, MIN (strlen (info->x), sizeof (binfo.x))) ; \
|
||||
} ;
|
||||
|
||||
REPLACE_IF_NEW (description) ;
|
||||
REPLACE_IF_NEW (originator) ;
|
||||
REPLACE_IF_NEW (originator_reference) ;
|
||||
REPLACE_IF_NEW (origination_date) ;
|
||||
REPLACE_IF_NEW (origination_time) ;
|
||||
REPLACE_IF_NEW (umid) ;
|
||||
|
||||
/* Special case for coding_history because we may want to append. */
|
||||
if (info->coding_history != NULL)
|
||||
{ if (info->coding_hist_append)
|
||||
{ int slen = strlen (binfo.coding_history) ;
|
||||
|
||||
while (slen > 1 && isspace (binfo.coding_history [slen - 1]))
|
||||
slen -- ;
|
||||
|
||||
memcpy (binfo.coding_history + slen, info->coding_history, sizeof (binfo.coding_history) - slen) ;
|
||||
}
|
||||
else
|
||||
{ size_t slen = MIN (strlen (info->coding_history), sizeof (binfo.coding_history)) ;
|
||||
|
||||
memset (binfo.coding_history, 0, sizeof (binfo.coding_history)) ;
|
||||
memcpy (binfo.coding_history, info->coding_history, slen) ;
|
||||
binfo.coding_history_size = slen ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
if (sf_command (outfile, SFC_SET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
|
||||
{ printf ("Error : Setting of broadcast info chunks failed.\n\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
} /* merge_broadcast_info*/
|
||||
|
||||
static void
|
||||
update_strings (SNDFILE * outfile, const METADATA_INFO * info)
|
||||
{
|
||||
if (info->title != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->title) ;
|
||||
|
||||
if (info->copyright != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->copyright) ;
|
||||
|
||||
if (info->artist != NULL)
|
||||
sf_set_string (outfile, SF_STR_ARTIST, info->artist) ;
|
||||
|
||||
if (info->comment != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->comment) ;
|
||||
|
||||
if (info->date != NULL)
|
||||
sf_set_string (outfile, SF_STR_DATE, info->date) ;
|
||||
|
||||
if (info->album != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->album) ;
|
||||
|
||||
if (info->license != NULL)
|
||||
sf_set_string (outfile, SF_STR_TITLE, info->license) ;
|
||||
|
||||
} /* update_strings */
|
||||
|
||||
|
||||
|
||||
void
|
||||
sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info)
|
||||
{ SNDFILE *infile = NULL, *outfile = NULL ;
|
||||
SF_INFO sfinfo ;
|
||||
METADATA_INFO tmpinfo ;
|
||||
int error_code = 0 ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
memset (&tmpinfo, 0, sizeof (tmpinfo)) ;
|
||||
|
||||
if (filenames [1] == NULL)
|
||||
infile = outfile = sf_open (filenames [0], SFM_RDWR, &sfinfo) ;
|
||||
else
|
||||
{ infile = sf_open (filenames [0], SFM_READ, &sfinfo) ;
|
||||
|
||||
/* Output must be WAV. */
|
||||
sfinfo.format = SF_FORMAT_WAV | (SF_FORMAT_SUBMASK & sfinfo.format) ;
|
||||
outfile = sf_open (filenames [1], SFM_WRITE, &sfinfo) ;
|
||||
} ;
|
||||
|
||||
if (infile == NULL)
|
||||
{ printf ("Error : Not able to open input file '%s' : %s\n", filenames [0], sf_strerror (infile)) ;
|
||||
error_code = 1 ;
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
if (outfile == NULL)
|
||||
{ printf ("Error : Not able to open output file '%s' : %s\n", filenames [1], sf_strerror (outfile)) ;
|
||||
error_code = 1 ;
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
if (info->has_bext_fields && merge_broadcast_info (infile, outfile, sfinfo.format, info))
|
||||
{ error_code = 1 ;
|
||||
goto cleanup_exit ;
|
||||
} ;
|
||||
|
||||
update_strings (outfile, info) ;
|
||||
|
||||
if (infile != outfile)
|
||||
{ int infileminor = SF_FORMAT_SUBMASK & sfinfo.format ;
|
||||
|
||||
/* If the input file is not the same as the output file, copy the data. */
|
||||
if ((infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT))
|
||||
sfe_copy_data_fp (outfile, infile, sfinfo.channels) ;
|
||||
else
|
||||
sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
|
||||
} ;
|
||||
|
||||
cleanup_exit :
|
||||
|
||||
if (outfile != NULL && outfile != infile)
|
||||
sf_close (outfile) ;
|
||||
|
||||
if (infile != NULL)
|
||||
sf_close (infile) ;
|
||||
|
||||
if (error_code)
|
||||
exit (error_code) ;
|
||||
|
||||
return ;
|
||||
} /* sfe_apply_metadata_changes */
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2009 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 <sndfile.h>
|
||||
|
||||
typedef struct
|
||||
{ const char * title ;
|
||||
const char * copyright ;
|
||||
const char * artist ;
|
||||
const char * comment ;
|
||||
const char * date ;
|
||||
const char * album ;
|
||||
const char * license ;
|
||||
|
||||
|
||||
/* Stuff to go in the 'bext' chunk of WAV files. */
|
||||
int has_bext_fields ;
|
||||
int coding_hist_append ;
|
||||
|
||||
const char * description ;
|
||||
const char * originator ;
|
||||
const char * originator_reference ;
|
||||
const char * origination_date ;
|
||||
const char * origination_time ;
|
||||
const char * umid ;
|
||||
const char * coding_history ;
|
||||
} METADATA_INFO ;
|
||||
|
||||
typedef SF_BROADCAST_INFO_VAR (2048) SF_BROADCAST_INFO_2K ;
|
||||
|
||||
void sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info) ;
|
||||
|
||||
void sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels) ;
|
||||
|
||||
void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
|
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
** Copyright (C) 2008-2009 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.
|
||||
*/
|
||||
|
||||
/* sndfile-cmp.c
|
||||
* Conrad Parker 2008
|
||||
*/
|
||||
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
/* Length of comparison data buffers in units of items */
|
||||
#define BUFLEN 65536
|
||||
|
||||
static char * progname ;
|
||||
static char * filename1, * filename2 ;
|
||||
|
||||
static int
|
||||
comparison_error (const char * what)
|
||||
{ printf ("%s: %s of files %s and %s differ\n", progname, what, filename1, filename2) ;
|
||||
return 1 ;
|
||||
} /* comparison_error */
|
||||
|
||||
static int
|
||||
compare (void)
|
||||
{
|
||||
double buf1 [BUFLEN], buf2 [BUFLEN] ;
|
||||
SF_INFO sfinfo1, sfinfo2 ;
|
||||
SNDFILE * sf1 = NULL, * sf2 = NULL ;
|
||||
sf_count_t len, i, nread1, nread2 ;
|
||||
int retval = 0 ;
|
||||
|
||||
memset (&sfinfo1, 0, sizeof (SF_INFO)) ;
|
||||
sf1 = sf_open (filename1, SFM_READ, &sfinfo1) ;
|
||||
if (sf1 == NULL)
|
||||
{ printf ("Error opening %s.\n", filename1) ;
|
||||
retval = 1 ;
|
||||
goto out ;
|
||||
} ;
|
||||
|
||||
memset (&sfinfo2, 0, sizeof (SF_INFO)) ;
|
||||
sf2 = sf_open (filename2, SFM_READ, &sfinfo2) ;
|
||||
if (sf2 == NULL)
|
||||
{ printf ("Error opening %s.\n", filename2) ;
|
||||
retval = 1 ;
|
||||
goto out ;
|
||||
} ;
|
||||
|
||||
if (sfinfo1.samplerate != sfinfo2.samplerate)
|
||||
{ retval = comparison_error ("Samplerates") ;
|
||||
goto out ;
|
||||
} ;
|
||||
|
||||
if (sfinfo1.channels != sfinfo2.channels)
|
||||
{ retval = comparison_error ("Number of channels") ;
|
||||
goto out ;
|
||||
} ;
|
||||
|
||||
/* Calculate the framecount that will fit in our data buffers */
|
||||
len = BUFLEN / sfinfo1.channels ;
|
||||
|
||||
while ( (nread1 = sf_readf_double (sf1, buf1, len)) > 0)
|
||||
{ nread2 = sf_readf_double (sf2, buf2, nread1) ;
|
||||
if (nread2 != nread1)
|
||||
{ retval = comparison_error ("PCM data lengths") ;
|
||||
goto out ;
|
||||
} ;
|
||||
for (i = 0 ; i < nread1 ; i++)
|
||||
{ if (buf1 [i] != buf2 [i])
|
||||
{ retval = comparison_error ("PCM data") ;
|
||||
goto out ;
|
||||
} ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
if ( (nread2 = sf_readf_double (sf2, buf2, nread1)) != 0)
|
||||
{ retval = comparison_error ("PCM data lengths") ;
|
||||
goto out ;
|
||||
} ;
|
||||
|
||||
out :
|
||||
sf_close (sf1) ;
|
||||
sf_close (sf2) ;
|
||||
|
||||
return retval ;
|
||||
} /* compare */
|
||||
|
||||
static void
|
||||
print_version (void)
|
||||
{ char buffer [256] ;
|
||||
|
||||
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
|
||||
printf ("\nVersion : %s\n\n", buffer) ;
|
||||
} /* print_version */
|
||||
|
||||
static void
|
||||
print_usage (void)
|
||||
{
|
||||
print_version () ;
|
||||
|
||||
printf ("Usage : %s <filename> <filename>\n", progname) ;
|
||||
printf (" Compare the PCM data of two sound files.\n\n") ;
|
||||
} /* print_usage */
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
|
||||
if (argc != 3)
|
||||
{ print_usage () ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
filename1 = argv [argc - 2] ;
|
||||
filename2 = argv [argc - 1] ;
|
||||
|
||||
if (strcmp (filename1, filename2) == 0)
|
||||
{ printf ("Error : Input filenames are the same.\n\n") ;
|
||||
print_usage () ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
return compare () ;
|
||||
} /* main */
|
|
@ -0,0 +1,369 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2009 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"
|
||||
|
||||
|
||||
typedef struct
|
||||
{ char *infilename, *outfilename ;
|
||||
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
|
||||
print_usage (char *progname)
|
||||
{ SF_FORMAT_INFO info ;
|
||||
|
||||
int k ;
|
||||
|
||||
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"
|
||||
) ;
|
||||
|
||||
puts ("\n"
|
||||
" 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"
|
||||
" -pcm16 : force the output to 16 bit pcm\n"
|
||||
" -pcm24 : force the output to 24 bit pcm\n"
|
||||
" -pcm32 : force the output to 32 bit pcm\n"
|
||||
" -float32 : force the output to 32 bit floating point"
|
||||
) ;
|
||||
puts (
|
||||
" -ulaw : force the output ULAW\n"
|
||||
" -alaw : force the output ALAW\n"
|
||||
" -ima-adpcm : force the output to IMA ADPCM (WAV only)\n"
|
||||
" -ms-adpcm : force the output to MS ADPCM (WAV only)\n"
|
||||
" -gsm610 : force the GSM6.10 (WAV only)\n"
|
||||
" -dwvw12 : force the output to 12 bit DWVW (AIFF only)\n"
|
||||
" -dwvw16 : force the output to 16 bit DWVW (AIFF only)\n"
|
||||
" -dwvw24 : force the output to 24 bit DWVW (AIFF only)\n"
|
||||
" -vorbis : force the output to Vorbis (OGG only)\n"
|
||||
) ;
|
||||
|
||||
puts (
|
||||
" The format of the output file is determined by the file extension of the\n"
|
||||
" 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) ;
|
||||
} ;
|
||||
|
||||
puts ("") ;
|
||||
} /* print_usage */
|
||||
|
||||
int
|
||||
main (int argc, char * argv [])
|
||||
{ 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] ;
|
||||
|
||||
if (argc < 3 || argc > 5)
|
||||
{ print_usage (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
infilename = argv [argc-2] ;
|
||||
outfilename = argv [argc-1] ;
|
||||
|
||||
if (strcmp (infilename, outfilename) == 0)
|
||||
{ printf ("Error : Input and output filenames are the same.\n\n") ;
|
||||
print_usage (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (infilename [0] == '-')
|
||||
{ printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
|
||||
print_usage (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (outfilename [0] == '-')
|
||||
{ printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
|
||||
print_usage (progname) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
for (k = 1 ; k < argc - 2 ; k++)
|
||||
{ if (! strcmp (argv [k], "-pcms8"))
|
||||
{ outfileminor = SF_FORMAT_PCM_S8 ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-pcmu8"))
|
||||
{ outfileminor = SF_FORMAT_PCM_U8 ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-pcm16"))
|
||||
{ outfileminor = SF_FORMAT_PCM_16 ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-pcm24"))
|
||||
{ outfileminor = SF_FORMAT_PCM_24 ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-pcm32"))
|
||||
{ outfileminor = SF_FORMAT_PCM_32 ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-float32"))
|
||||
{ outfileminor = SF_FORMAT_FLOAT ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-ulaw"))
|
||||
{ outfileminor = SF_FORMAT_ULAW ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-alaw"))
|
||||
{ outfileminor = SF_FORMAT_ALAW ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-ima-adpcm"))
|
||||
{ outfileminor = SF_FORMAT_IMA_ADPCM ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-ms-adpcm"))
|
||||
{ outfileminor = SF_FORMAT_MS_ADPCM ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-gsm610"))
|
||||
{ outfileminor = SF_FORMAT_GSM610 ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-dwvw12"))
|
||||
{ outfileminor = SF_FORMAT_DWVW_12 ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-dwvw16"))
|
||||
{ outfileminor = SF_FORMAT_DWVW_16 ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-dwvw24"))
|
||||
{ outfileminor = SF_FORMAT_DWVW_24 ;
|
||||
continue ;
|
||||
} ;
|
||||
if (! strcmp (argv [k], "-vorbis"))
|
||||
{ outfileminor = SF_FORMAT_VORBIS ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strstr (argv [k], "-override-sample-rate=") == argv [k])
|
||||
{ const char *ptr ;
|
||||
|
||||
ptr = argv [k] + strlen ("-override-sample-rate=") ;
|
||||
override_sample_rate = atoi (ptr) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
printf ("Error : Not able to decode argunment '%s'.\n", argv [k]) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)
|
||||
{ printf ("Not able to open input file %s.\n", infilename) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
/* Update sample rate if forced to something else. */
|
||||
if (override_sample_rate)
|
||||
sfinfo.samplerate = override_sample_rate ;
|
||||
|
||||
infileminor = sfinfo.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if ((sfinfo.format = guess_output_file_type (outfilename, sfinfo.format)) == 0)
|
||||
{ printf ("Error : Not able to determine output file type for %s.\n", outfilename) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
outfilemajor = sfinfo.format & (SF_FORMAT_TYPEMASK | SF_FORMAT_ENDMASK) ;
|
||||
|
||||
if (outfileminor == 0)
|
||||
outfileminor = sfinfo.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if (outfileminor != 0)
|
||||
sfinfo.format = outfilemajor | outfileminor ;
|
||||
else
|
||||
sfinfo.format = outfilemajor | (sfinfo.format & SF_FORMAT_SUBMASK) ;
|
||||
|
||||
if ((sfinfo.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_XI)
|
||||
switch (sfinfo.format & SF_FORMAT_SUBMASK)
|
||||
{ case SF_FORMAT_PCM_16 :
|
||||
sfinfo.format = outfilemajor | SF_FORMAT_DPCM_16 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_PCM_S8 :
|
||||
case SF_FORMAT_PCM_U8 :
|
||||
sfinfo.format = outfilemajor | SF_FORMAT_DPCM_8 ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
if (sf_format_check (&sfinfo) == 0)
|
||||
{ printf ("Error : output file format is invalid (0x%08X).\n", sfinfo.format) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
/* Open the output file. */
|
||||
if ((outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)) == NULL)
|
||||
{ printf ("Not able to open output file %s : %s\n", outfilename, sf_strerror (NULL)) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
/* Copy the metadata */
|
||||
copy_metadata (outfile, infile) ;
|
||||
|
||||
if ((outfileminor == SF_FORMAT_DOUBLE) || (outfileminor == SF_FORMAT_FLOAT)
|
||||
|| (infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT)
|
||||
|| (infileminor == SF_FORMAT_VORBIS) || (outfileminor == SF_FORMAT_VORBIS))
|
||||
sfe_copy_data_fp (outfile, infile, sfinfo.channels) ;
|
||||
else
|
||||
sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
|
||||
|
||||
sf_close (infile) ;
|
||||
sf_close (outfile) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
static void
|
||||
copy_metadata (SNDFILE *outfile, SNDFILE *infile)
|
||||
{ SF_INSTRUMENT inst ;
|
||||
SF_BROADCAST_INFO_2K binfo ;
|
||||
const char *str ;
|
||||
int k, err = 0 ;
|
||||
|
||||
for (k = SF_STR_FIRST ; k <= SF_STR_LAST ; k++)
|
||||
{ str = sf_get_string (infile, k) ;
|
||||
if (str != NULL)
|
||||
err = sf_set_string (outfile, k, str) ;
|
||||
} ;
|
||||
|
||||
memset (&inst, 0, sizeof (inst)) ;
|
||||
memset (&binfo, 0, sizeof (binfo)) ;
|
||||
|
||||
if (sf_command (infile, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
|
||||
sf_command (outfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) ;
|
||||
|
||||
if (sf_command (infile, SFC_GET_BROADCAST_INFO, &binfo, sizeof (binfo)) == SF_TRUE)
|
||||
sf_command (outfile, SFC_SET_BROADCAST_INFO, &binfo, sizeof (binfo)) ;
|
||||
|
||||
} /* copy_metadata */
|
||||
|
|
@ -0,0 +1,386 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2009 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 <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN (1 << 16)
|
||||
|
||||
#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 info_dump (const char *filename) ;
|
||||
static int instrument_dump (const char *filename) ;
|
||||
static int broadcast_dump (const char *filename) ;
|
||||
static void total_dump (void) ;
|
||||
|
||||
static double total_seconds = 0.0 ;
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{ int k ;
|
||||
|
||||
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) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [1], "-i") == 0)
|
||||
{ int error = 0 ;
|
||||
|
||||
for (k = 2 ; k < argc ; k++)
|
||||
error += instrument_dump (argv [k]) ;
|
||||
return error ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [1], "-b") == 0)
|
||||
{ int error = 0 ;
|
||||
|
||||
for (k = 2 ; k < argc ; k++)
|
||||
error += broadcast_dump (argv [k]) ;
|
||||
return error ;
|
||||
} ;
|
||||
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
info_dump (argv [k]) ;
|
||||
|
||||
if (argc > 2)
|
||||
total_dump () ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*==============================================================================
|
||||
** Print version and usage.
|
||||
*/
|
||||
|
||||
static double data [BUFFER_LEN] ;
|
||||
|
||||
static void
|
||||
print_version (void)
|
||||
{ char buffer [256] ;
|
||||
|
||||
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
|
||||
printf ("\nVersion : %s\n\n", buffer) ;
|
||||
} /* print_version */
|
||||
|
||||
|
||||
static void
|
||||
print_usage (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) ;
|
||||
printf (" Prints out the instrument data for the given file.\n\n") ;
|
||||
printf (" %s -b <file>\n", progname) ;
|
||||
printf (" Prints out the broadcast WAV info for the given file.\n\n") ;
|
||||
#if (defined (_WIN32) || defined (WIN32))
|
||||
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") ;
|
||||
fflush (stdout) ;
|
||||
|
||||
/* 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
|
||||
} /* print_usage */
|
||||
|
||||
/*==============================================================================
|
||||
** Dumping of sndfile info.
|
||||
*/
|
||||
|
||||
static double data [BUFFER_LEN] ;
|
||||
|
||||
static double
|
||||
get_signal_max (SNDFILE *file)
|
||||
{ double max ;
|
||||
|
||||
sf_command (file, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
|
||||
|
||||
return max ;
|
||||
} /* get_signal_max */
|
||||
|
||||
static double
|
||||
calc_decibels (SF_INFO * sfinfo, double max)
|
||||
{ double decibels ;
|
||||
|
||||
switch (sfinfo->format & SF_FORMAT_SUBMASK)
|
||||
{ case SF_FORMAT_PCM_U8 :
|
||||
case SF_FORMAT_PCM_S8 :
|
||||
decibels = max / 0x80 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_PCM_16 :
|
||||
decibels = max / 0x8000 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_PCM_24 :
|
||||
decibels = max / 0x800000 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_PCM_32 :
|
||||
decibels = max / 0x80000000 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_FLOAT :
|
||||
case SF_FORMAT_DOUBLE :
|
||||
decibels = max / 1.0 ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
decibels = max / 0x8000 ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
return 20.0 * log10 (decibels) ;
|
||||
} /* calc_decibels */
|
||||
|
||||
static const char *
|
||||
format_duration_str (double seconds)
|
||||
{ static char str [128] ;
|
||||
int hrs, min ;
|
||||
double sec ;
|
||||
|
||||
memset (str, 0, sizeof (str)) ;
|
||||
|
||||
hrs = (int) (seconds / 3600.0) ;
|
||||
min = (int) ((seconds - (hrs * 3600.0)) / 60.0) ;
|
||||
sec = seconds - (hrs * 3600.0) - (min * 60.0) ;
|
||||
|
||||
snprintf (str, sizeof (str) - 1, "%02d:%02d:%06.3f", hrs, min, sec) ;
|
||||
|
||||
return str ;
|
||||
} /* format_duration_str */
|
||||
|
||||
static const char *
|
||||
generate_duration_str (SF_INFO *sfinfo)
|
||||
{
|
||||
double seconds ;
|
||||
|
||||
if (sfinfo->samplerate < 1)
|
||||
return NULL ;
|
||||
|
||||
if (sfinfo->frames / sfinfo->samplerate > 0x7FFFFFFF)
|
||||
return "unknown" ;
|
||||
|
||||
seconds = (1.0 * sfinfo->frames) / sfinfo->samplerate ;
|
||||
|
||||
/* Accumulate the total of all known file durations */
|
||||
total_seconds += seconds ;
|
||||
|
||||
return format_duration_str (seconds) ;
|
||||
} /* generate_duration_str */
|
||||
|
||||
static void
|
||||
info_dump (const char *filename)
|
||||
{ static char strbuffer [BUFFER_LEN] ;
|
||||
SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
double signal_max, decibels ;
|
||||
|
||||
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)) ;
|
||||
sf_command (file, SFC_GET_LOG_INFO, strbuffer, BUFFER_LEN) ;
|
||||
puts (strbuffer) ;
|
||||
puts (sf_strerror (NULL)) ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
printf ("========================================\n") ;
|
||||
sf_command (file, SFC_GET_LOG_INFO, strbuffer, BUFFER_LEN) ;
|
||||
puts (strbuffer) ;
|
||||
printf ("----------------------------------------\n") ;
|
||||
|
||||
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)) ;
|
||||
|
||||
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) ;
|
||||
|
||||
} /* info_dump */
|
||||
|
||||
/*==============================================================================
|
||||
** Dumping of SF_INSTRUMENT data.
|
||||
*/
|
||||
|
||||
static const char *
|
||||
str_of_type (int mode)
|
||||
{ switch (mode)
|
||||
{ case SF_LOOP_NONE : return "none" ;
|
||||
case SF_LOOP_FORWARD : return "fwd " ;
|
||||
case SF_LOOP_BACKWARD : return "back" ;
|
||||
case SF_LOOP_ALTERNATING : return "alt " ;
|
||||
default : break ;
|
||||
} ;
|
||||
|
||||
return "????" ;
|
||||
} /* str_of_mode */
|
||||
|
||||
static int
|
||||
instrument_dump (const char *filename)
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
SF_INSTRUMENT inst ;
|
||||
int got_inst, 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 ;
|
||||
} ;
|
||||
|
||||
got_inst = sf_command (file, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) ;
|
||||
sf_close (file) ;
|
||||
|
||||
if (got_inst == SF_FALSE)
|
||||
{ printf ("Error : File '%s' does not contain instrument data.\n\n", filename) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
printf ("Instrument : %s\n\n", filename) ;
|
||||
printf (" Gain : %d\n", inst.gain) ;
|
||||
printf (" Base note : %d\n", inst.basenote) ;
|
||||
printf (" Velocity : %d - %d\n", (int) inst.velocity_lo, (int) inst.velocity_hi) ;
|
||||
printf (" Key : %d - %d\n", (int) inst.key_lo, (int) inst.key_hi) ;
|
||||
printf (" Loop points : %d\n", inst.loop_count) ;
|
||||
|
||||
for (k = 0 ; k < inst.loop_count ; k++)
|
||||
printf (" %-2d Mode : %s Start : %6d End : %6d Count : %6d\n", k, str_of_type (inst.loops [k].mode), inst.loops [k].start, inst.loops [k].end, inst.loops [k].count) ;
|
||||
|
||||
putchar ('\n') ;
|
||||
return 0 ;
|
||||
} /* instrument_dump */
|
||||
|
||||
static int
|
||||
broadcast_dump (const char *filename)
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
SF_BROADCAST_INFO_2K bext ;
|
||||
double time_ref_sec ;
|
||||
int got_bext ;
|
||||
|
||||
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 ;
|
||||
} ;
|
||||
|
||||
memset (&bext, 0, sizeof (SF_BROADCAST_INFO_2K)) ;
|
||||
|
||||
got_bext = sf_command (file, SFC_GET_BROADCAST_INFO, &bext, sizeof (bext)) ;
|
||||
sf_close (file) ;
|
||||
|
||||
if (got_bext == SF_FALSE)
|
||||
{ printf ("Error : File '%s' does not contain broadcast information.\n\n", filename) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
** From : http://www.ebu.ch/en/technical/publications/userguides/bwf_user_guide.php
|
||||
**
|
||||
** Time Reference:
|
||||
** This field is a count from midnight in samples to the first sample
|
||||
** of the audio sequence.
|
||||
*/
|
||||
|
||||
time_ref_sec = ((pow (2.0, 32) * bext.time_reference_high) + (1.0 * bext.time_reference_low)) / sfinfo.samplerate ;
|
||||
|
||||
printf ("Description : %.*s\n", (int) sizeof (bext.description), bext.description) ;
|
||||
printf ("Originator : %.*s\n", (int) sizeof (bext.originator), bext.originator) ;
|
||||
printf ("Origination ref : %.*s\n", (int) sizeof (bext.originator_reference), bext.originator_reference) ;
|
||||
printf ("Origination date : %.*s\n", (int) sizeof (bext.origination_date), bext.origination_date) ;
|
||||
printf ("Origination time : %.*s\n", (int) sizeof (bext.origination_time), bext.origination_time) ;
|
||||
|
||||
if (bext.time_reference_high == 0 && bext.time_reference_low == 0)
|
||||
printf ("Time ref : 0\n") ;
|
||||
else
|
||||
printf ("Time ref : 0x%x%08x (%.6f seconds)\n", bext.time_reference_high, bext.time_reference_low, time_ref_sec) ;
|
||||
|
||||
printf ("BWF version : %d\n", bext.version) ;
|
||||
printf ("UMID : %.*s\n", (int) sizeof (bext.umid), bext.umid) ;
|
||||
printf ("Coding history : %.*s\n", bext.coding_history_size, bext.coding_history) ;
|
||||
|
||||
return 0 ;
|
||||
} /* broadcast_dump */
|
||||
|
||||
static void
|
||||
total_dump (void)
|
||||
{ printf ("========================================\n") ;
|
||||
printf ("Total Duration : %s\n", format_duration_str (total_seconds)) ;
|
||||
} /* total_dump */
|
|
@ -0,0 +1,277 @@
|
|||
/*
|
||||
** Copyright (c) 2007-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** 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 <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
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
** Copyright (C) 2008 George Blood Audio
|
||||
** Written by 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 <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN (1 << 16)
|
||||
|
||||
static void usage_exit (const char *progname, int exit_code) ;
|
||||
static void process_args (SNDFILE * file, const SF_BROADCAST_INFO_2K * binfo, int argc, char * argv []) ;
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{ SNDFILE *file ;
|
||||
SF_INFO sfinfo ;
|
||||
SF_BROADCAST_INFO_2K binfo ;
|
||||
const char *progname ;
|
||||
const char * filename = NULL ;
|
||||
int start ;
|
||||
|
||||
/* Store the program name. */
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
|
||||
/* Check if we've been asked for help. */
|
||||
if (argc <= 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
|
||||
usage_exit (progname, 0) ;
|
||||
|
||||
if (argv [argc - 1][0] != '-')
|
||||
{ filename = argv [argc - 1] ;
|
||||
start = 1 ;
|
||||
}
|
||||
else if (argv [1][0] != '-')
|
||||
{ filename = argv [1] ;
|
||||
start = 2 ;
|
||||
}
|
||||
else
|
||||
{ printf ("Error : Either the first or the last command line parameter should be a filename.\n\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
/* Get the time in case we need it later. */
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
|
||||
{ printf ("Error : Open of file '%s' failed : %s\n\n", filename, sf_strerror (file)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
memset (&binfo, 0, sizeof (binfo)) ;
|
||||
if (sf_command (file, SFC_GET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
|
||||
memset (&binfo, 0, sizeof (binfo)) ;
|
||||
|
||||
process_args (file, &binfo, argc - 2, argv + start) ;
|
||||
|
||||
sf_close (file) ;
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*==============================================================================
|
||||
** Print version and usage.
|
||||
*/
|
||||
|
||||
static void
|
||||
usage_exit (const char *progname, int exit_code)
|
||||
{ printf ("\nUsage :\n %s [options] <file>\n\nOptions:\n", progname) ;
|
||||
|
||||
puts (
|
||||
" --bext-description Print the 'bext' description.\n"
|
||||
" --bext-originator Print the 'bext; originator info.\n"
|
||||
" --bext-orig-ref Print the 'bext' origination reference.\n"
|
||||
" --bext-umid Print the 'bext' UMID.\n"
|
||||
" --bext-orig-date Print the 'bext' origination date.\n"
|
||||
" --bext-orig-time Print the 'bext' origination time.\n"
|
||||
" --bext-coding-hist Print the 'bext' coding history.\n"
|
||||
) ;
|
||||
|
||||
puts (
|
||||
" --str-title Print the title metadata.\n"
|
||||
" --str-copyright Print the copyright metadata.\n"
|
||||
" --str-artist Print the artist metadata.\n"
|
||||
" --str-comment Print the comment metadata.\n"
|
||||
" --str-date Print the creation date metadata.\n"
|
||||
" --str-album Print the album metadata.\n"
|
||||
" --str-license Print the license metadata.\n"
|
||||
) ;
|
||||
|
||||
exit (exit_code) ;
|
||||
} /* usage_exit */
|
||||
|
||||
static void
|
||||
process_args (SNDFILE * file, const SF_BROADCAST_INFO_2K * binfo, int argc, char * argv [])
|
||||
{ const char * str ;
|
||||
int k, do_all = 0 ;
|
||||
|
||||
#define HANDLE_BEXT_ARG(cmd,name,field) \
|
||||
if (do_all || strcmp (argv [k], cmd) == 0) \
|
||||
{ printf ("%-20s : %.*s\n", name, (int) sizeof (binfo->field), binfo->field) ; \
|
||||
if (! do_all) \
|
||||
continue ; \
|
||||
} ;
|
||||
|
||||
#define HANDLE_STR_ARG(cmd,name,id) \
|
||||
if (do_all || strcmp (argv [k], cmd) == 0) \
|
||||
{ str = sf_get_string (file, id) ; \
|
||||
printf ("%-20s : %s\n", name, str ? str : "") ; \
|
||||
if (! do_all) continue ; \
|
||||
} ;
|
||||
|
||||
for (k = 0 ; k < argc ; k++)
|
||||
{ if (do_all || strcmp (argv [k], "--all") == 0)
|
||||
do_all = 1 ;
|
||||
|
||||
HANDLE_BEXT_ARG ("--bext-description", "Description", description) ;
|
||||
HANDLE_BEXT_ARG ("--bext-originator", "Originator", originator) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-ref", "Origination ref", originator_reference) ;
|
||||
HANDLE_BEXT_ARG ("--bext-umid", "UMID", umid) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-date", "Origination date", origination_date) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-time", "Origination time", origination_time) ;
|
||||
HANDLE_BEXT_ARG ("--bext-coding-hist", "Coding history", coding_history) ;
|
||||
|
||||
HANDLE_STR_ARG ("--str-title", "Name", SF_STR_TITLE) ;
|
||||
HANDLE_STR_ARG ("--str-copyright", "Copyright", SF_STR_COPYRIGHT) ;
|
||||
HANDLE_STR_ARG ("--str-artist", "Artist", SF_STR_ARTIST) ;
|
||||
HANDLE_STR_ARG ("--str-comment", "Comment", SF_STR_COMMENT) ;
|
||||
HANDLE_STR_ARG ("--str-date", "Create date", SF_STR_DATE) ;
|
||||
HANDLE_STR_ARG ("--str-album", "Album", SF_STR_ALBUM) ;
|
||||
HANDLE_STR_ARG ("--str-license", "License", SF_STR_LICENSE) ;
|
||||
|
||||
if (! do_all)
|
||||
{ printf ("Error : Don't know what to do with command line arg '%s'.\n\n", argv [k]) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* process_args */
|
|
@ -0,0 +1,280 @@
|
|||
/*
|
||||
** Copyright (C) 2008 George Blood Audio
|
||||
** Written by 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 <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define BUFFER_LEN (1 << 16)
|
||||
|
||||
|
||||
static void usage_exit (const char *progname, int exit_code) ;
|
||||
static void missing_param (const char * option) ;
|
||||
static void read_localtime (struct tm * timedata) ;
|
||||
static int has_bext_fields_set (const METADATA_INFO * info) ;
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{ METADATA_INFO info ;
|
||||
struct tm timedata ;
|
||||
const char *progname ;
|
||||
const char * filenames [2] = { NULL, NULL } ;
|
||||
int k ;
|
||||
|
||||
/* Store the program name. */
|
||||
progname = strrchr (argv [0], '/') ;
|
||||
progname = progname ? progname + 1 : argv [0] ;
|
||||
|
||||
/* Check if we've been asked for help. */
|
||||
if (argc < 3 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
|
||||
usage_exit (progname, 0) ;
|
||||
|
||||
/* Clear set all fields of the struct to zero bytes. */
|
||||
memset (&info, 0, sizeof (info)) ;
|
||||
|
||||
/* Get the time in case we need it later. */
|
||||
read_localtime (&timedata) ;
|
||||
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
{ char tmp [20] ;
|
||||
|
||||
if (argv [k][0] != '-')
|
||||
{ if (filenames [0] == NULL)
|
||||
filenames [0] = argv [k] ;
|
||||
else if (filenames [1] == NULL)
|
||||
filenames [1] = argv [k] ;
|
||||
else
|
||||
{ printf ("Error : Already have two file names on the command line and then found '%s'.\n\n", argv [k]) ;
|
||||
usage_exit (progname, 1) ;
|
||||
} ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
#define HANDLE_BEXT_ARG(cmd,field) \
|
||||
if (strcmp (argv [k], cmd) == 0) \
|
||||
{ k ++ ; \
|
||||
if (k == argc) missing_param (argv [k - 1]) ; \
|
||||
info.field = argv [k] ; \
|
||||
continue ; \
|
||||
} ;
|
||||
|
||||
HANDLE_BEXT_ARG ("--bext-description", description) ;
|
||||
HANDLE_BEXT_ARG ("--bext-originator", originator) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-ref", originator_reference) ;
|
||||
HANDLE_BEXT_ARG ("--bext-umid", umid) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-date", origination_date) ;
|
||||
HANDLE_BEXT_ARG ("--bext-orig-time", origination_time) ;
|
||||
HANDLE_BEXT_ARG ("--bext-coding-hist", coding_history) ;
|
||||
|
||||
#define HANDLE_STR_ARG(cmd,field) \
|
||||
if (strcmp (argv [k], cmd) == 0) \
|
||||
{ k ++ ; \
|
||||
if (k == argc) missing_param (argv [k - 1]) ; \
|
||||
info.field = argv [k] ; \
|
||||
continue ; \
|
||||
} ;
|
||||
|
||||
HANDLE_STR_ARG ("--str-title", title) ;
|
||||
HANDLE_STR_ARG ("--str-copyright", copyright) ;
|
||||
HANDLE_STR_ARG ("--str-artist", artist) ;
|
||||
HANDLE_STR_ARG ("--str-date", date) ;
|
||||
HANDLE_STR_ARG ("--str-album", album) ;
|
||||
HANDLE_STR_ARG ("--str-license", license) ;
|
||||
|
||||
/* Following options do not take an argument. */
|
||||
if (strcmp (argv [k], "--bext-auto-time-date") == 0)
|
||||
{ snprintf (tmp, sizeof (tmp), "%02d:%02d:%02d", timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
|
||||
info.origination_time = strdup (tmp) ;
|
||||
|
||||
snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
|
||||
info.origination_date = strdup (tmp) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-auto-time") == 0)
|
||||
{ snprintf (tmp, sizeof (tmp), "%02d:%02d:%02d", timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
|
||||
info.origination_time = strdup (tmp) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--bext-auto-date") == 0)
|
||||
{ snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
|
||||
info.origination_date = strdup (tmp) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (strcmp (argv [k], "--str-auto-date") == 0)
|
||||
{ snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
|
||||
|
||||
info.date = strdup (tmp) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
printf ("Error : Don't know what to do with command line arg '%s'.\n\n", argv [k]) ;
|
||||
usage_exit (progname, 1) ;
|
||||
} ;
|
||||
|
||||
/* Find out if any of the 'bext' fields are set. */
|
||||
info.has_bext_fields = has_bext_fields_set (&info) ;
|
||||
|
||||
if (filenames [0] == NULL)
|
||||
{ printf ("Error : No input file specificed.\n\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (filenames [1] != NULL && strcmp (filenames [0], filenames [1]) == 0)
|
||||
{ printf ("Error : Input and output files are the same.\n\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (info.coding_history != NULL && filenames [1] == NULL)
|
||||
{ printf ("\n"
|
||||
"Error : Trying to update coding history of an existing file which unfortunately\n"
|
||||
" is not supported. Instead, create a new file using :\n"
|
||||
"\n"
|
||||
" %s --bext-coding-hist \"Coding history\" old_file.wav new_file.wav\n"
|
||||
"\n",
|
||||
progname) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
sfe_apply_metadata_changes (filenames, &info) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
/*==============================================================================
|
||||
** Print version and usage.
|
||||
*/
|
||||
|
||||
static void
|
||||
usage_exit (const char *progname, int exit_code)
|
||||
{ printf ("\nUsage :\n\n"
|
||||
" %s [options] <file>\n"
|
||||
" %s [options] <input file> <output file>\n"
|
||||
"\n",
|
||||
progname, progname) ;
|
||||
|
||||
puts (
|
||||
"Where an option is made up of a pair of a field to set (one of\n"
|
||||
"the 'bext' or metadata fields below) and a string. Fields are\n"
|
||||
"as follows :\n"
|
||||
) ;
|
||||
|
||||
puts (
|
||||
" --bext-description Set the 'bext' description.\n"
|
||||
" --bext-originator Set the 'bext' originator.\n"
|
||||
" --bext-orig-ref Set the 'bext' originator reference.\n"
|
||||
" --bext-umid Set the 'bext' UMID.\n"
|
||||
" --bext-orig-date Set the 'bext' origination date.\n"
|
||||
" --bext-orig-time Set the 'bext' origination time.\n"
|
||||
" --bext-coding-hist Set the 'bext' coding history\n"
|
||||
"\n"
|
||||
" --str-title Set the metadata title.\n"
|
||||
" --str-copyright Set the metadata copyright.\n"
|
||||
" --str-artist Set the metadata artist.\n"
|
||||
" --str-date Set the metadata date.\n"
|
||||
" --str-album Set the metadata album.\n"
|
||||
" --str-license Set the metadata license.\n"
|
||||
) ;
|
||||
|
||||
puts (
|
||||
"There are also the following arguments which do not take a\n"
|
||||
"parameter :\n\n"
|
||||
" --bext-auto-time-date Set the 'bext' time and date to current time/date.\n"
|
||||
" --bext-auto-time Set the 'bext' time to current time.\n"
|
||||
" --bext-auto-date Set the 'bext' date to current date.\n"
|
||||
" --str-auto-date Set the metadata date to current date.\n"
|
||||
) ;
|
||||
|
||||
puts (
|
||||
"Most of the above operations can be done in-place on an existing\n"
|
||||
"file. If any operation cannot be performed, the application will\n"
|
||||
"exit with an appropriate error message.\n"
|
||||
) ;
|
||||
|
||||
exit (exit_code) ;
|
||||
} /* usage_exit */
|
||||
|
||||
static void
|
||||
missing_param (const char * option)
|
||||
{
|
||||
printf ("Error : Option '%s' needs a parameter but doesn't seem to have one.\n\n", option) ;
|
||||
exit (1) ;
|
||||
} /* missing_param */
|
||||
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
static int
|
||||
has_bext_fields_set (const METADATA_INFO * info)
|
||||
{
|
||||
if (info->description || info->originator || info->originator_reference)
|
||||
return 1 ;
|
||||
|
||||
if (info->origination_date || info->origination_time || info->umid || info->coding_history)
|
||||
return 1 ;
|
||||
|
||||
return 0 ;
|
||||
} /* has_bext_fields_set */
|
||||
|
||||
static void
|
||||
read_localtime (struct tm * timedata)
|
||||
{ time_t current ;
|
||||
|
||||
time (¤t) ;
|
||||
memset (timedata, 0, sizeof (struct tm)) ;
|
||||
|
||||
#if defined (HAVE_LOCALTIME_R)
|
||||
/* If the re-entrant version is available, use it. */
|
||||
localtime_r (¤t, timedata) ;
|
||||
#elif defined (HAVE_LOCALTIME)
|
||||
{
|
||||
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 ;
|
||||
} /* read_localtime */
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
** Copyright (C) 2001 Marcus Overhagen <marcus@overhagen.de>
|
||||
**
|
||||
** 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 <stdio.h>
|
||||
|
||||
#include <Application.h>
|
||||
#include <SoundPlayer.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define BUFFER_LEN 1024
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** BeOS functions for playing a sound.
|
||||
*/
|
||||
|
||||
#if defined (__BEOS__)
|
||||
|
||||
struct shared_data
|
||||
{
|
||||
BSoundPlayer *player;
|
||||
SNDFILE *sndfile;
|
||||
SF_INFO sfinfo;
|
||||
sem_id finished;
|
||||
};
|
||||
|
||||
static void
|
||||
buffer_callback(void *theCookie, void *buf, size_t size, const media_raw_audio_format &format)
|
||||
{
|
||||
shared_data *data = (shared_data *)theCookie;
|
||||
short *buffer = (short *)buf;
|
||||
int count = size / sizeof(short);
|
||||
int m, readcount;
|
||||
|
||||
if (!data->player->HasData())
|
||||
return;
|
||||
|
||||
readcount = sf_read_short(data->sndfile, buffer, count);
|
||||
if (readcount == 0)
|
||||
{ data->player->SetHasData(false);
|
||||
release_sem(data->finished);
|
||||
}
|
||||
if (readcount < count)
|
||||
{ for (m = readcount ; m < count ; m++)
|
||||
buffer [m] = 0 ;
|
||||
}
|
||||
if (data->sfinfo.pcmbitwidth < 16)
|
||||
{ for (m = 0 ; m < count ; m++)
|
||||
buffer [m] *= 256 ;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
beos_play (int argc, char *argv [])
|
||||
{
|
||||
shared_data data;
|
||||
status_t status;
|
||||
int k;
|
||||
|
||||
/* BSoundPlayer requires a BApplication object */
|
||||
BApplication app("application/x-vnd.MarcusOverhagen-sfplay");
|
||||
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
{ printf ("Playing %s\n", argv [k]) ;
|
||||
if (! (data.sndfile = sf_open_read (argv [k], &data.sfinfo)))
|
||||
{ sf_perror (NULL) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (data.sfinfo.channels < 1 || data.sfinfo.channels > 2)
|
||||
{ printf ("Error : channels = %d.\n", data.sfinfo.channels) ;
|
||||
sf_close (data.sndfile) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
data.finished = create_sem(0,"finished");
|
||||
|
||||
media_raw_audio_format format =
|
||||
{ data.sfinfo.samplerate,
|
||||
data.sfinfo.channels,
|
||||
media_raw_audio_format::B_AUDIO_SHORT,
|
||||
B_HOST_IS_LENDIAN ? B_MEDIA_LITTLE_ENDIAN : B_MEDIA_BIG_ENDIAN,
|
||||
BUFFER_LEN * sizeof(short)
|
||||
};
|
||||
|
||||
BSoundPlayer player(&format,"player",buffer_callback,NULL,&data);
|
||||
data.player = &player;
|
||||
|
||||
if ((status = player.InitCheck()) != B_OK)
|
||||
{
|
||||
printf ("Error : BSoundPlayer init failed, %s.\n", strerror(status)) ;
|
||||
delete_sem(data.finished);
|
||||
sf_close (data.sndfile) ;
|
||||
continue ;
|
||||
}
|
||||
|
||||
player.SetVolume(1.0);
|
||||
player.Start();
|
||||
player.SetHasData(true);
|
||||
acquire_sem(data.finished);
|
||||
player.Stop();
|
||||
delete_sem(data.finished);
|
||||
|
||||
sf_close (data.sndfile) ;
|
||||
|
||||
} ;
|
||||
|
||||
} /* beos_play */
|
||||
|
||||
#endif
|
||||
|
||||
/*==============================================================================
|
||||
** Main function.
|
||||
*/
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
if (argc < 2)
|
||||
{ printf ("Usage : %s <input sound file>\n\n", argv [0]) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
beos_play (argc, argv) ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
|
@ -0,0 +1,958 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the author nor the names of any contributors may be used
|
||||
** to endorse or promote products derived from this software without
|
||||
** specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ALSA_ASOUNDLIB_H
|
||||
#define ALSA_PCM_NEW_HW_PARAMS_API
|
||||
#define ALSA_PCM_NEW_SW_PARAMS_API
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if defined (__linux__)
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/soundcard.h>
|
||||
|
||||
#elif (defined (__MACH__) && defined (__APPLE__))
|
||||
#include <Carbon.h>
|
||||
#include <CoreAudio/AudioHardware.h>
|
||||
|
||||
#elif (defined (sun) && defined (unix))
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/audioio.h>
|
||||
|
||||
#elif (OS_IS_WIN32 == 1)
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define SIGNED_SIZEOF(x) ((int) sizeof (x))
|
||||
#define BUFFER_LEN (2048)
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Linux/OSS functions for playing a sound.
|
||||
*/
|
||||
|
||||
#if HAVE_ALSA_ASOUNDLIB_H
|
||||
|
||||
static snd_pcm_t * alsa_open (int channels, unsigned srate, int realtime) ;
|
||||
static int alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels) ;
|
||||
|
||||
static void
|
||||
alsa_play (int argc, char *argv [])
|
||||
{ static float buffer [BUFFER_LEN] ;
|
||||
SNDFILE *sndfile ;
|
||||
SF_INFO sfinfo ;
|
||||
snd_pcm_t * alsa_dev ;
|
||||
int k, readcount, subformat ;
|
||||
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
{ memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
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 ((alsa_dev = alsa_open (sfinfo.channels, (unsigned) sfinfo.samplerate, SF_FALSE)) == NULL)
|
||||
continue ;
|
||||
|
||||
subformat = sfinfo.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
|
||||
{ double scale ;
|
||||
int m ;
|
||||
|
||||
sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &scale, sizeof (scale)) ;
|
||||
if (scale < 1e-10)
|
||||
scale = 1.0 ;
|
||||
else
|
||||
scale = 32700.0 / scale ;
|
||||
|
||||
while ((readcount = sf_read_float (sndfile, buffer, BUFFER_LEN)))
|
||||
{ for (m = 0 ; m < readcount ; m++)
|
||||
buffer [m] *= scale ;
|
||||
alsa_write_float (alsa_dev, buffer, BUFFER_LEN / sfinfo.channels, sfinfo.channels) ;
|
||||
} ;
|
||||
}
|
||||
else
|
||||
{ while ((readcount = sf_read_float (sndfile, buffer, BUFFER_LEN)))
|
||||
alsa_write_float (alsa_dev, buffer, BUFFER_LEN / sfinfo.channels, sfinfo.channels) ;
|
||||
} ;
|
||||
|
||||
snd_pcm_drain (alsa_dev) ;
|
||||
snd_pcm_close (alsa_dev) ;
|
||||
|
||||
sf_close (sndfile) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* alsa_play */
|
||||
|
||||
static snd_pcm_t *
|
||||
alsa_open (int channels, unsigned samplerate, int realtime)
|
||||
{ const char * device = "default" ;
|
||||
snd_pcm_t *alsa_dev = NULL ;
|
||||
snd_pcm_hw_params_t *hw_params ;
|
||||
snd_pcm_uframes_t buffer_size ;
|
||||
snd_pcm_uframes_t alsa_period_size, alsa_buffer_frames ;
|
||||
snd_pcm_sw_params_t *sw_params ;
|
||||
|
||||
int err ;
|
||||
|
||||
if (realtime)
|
||||
{ alsa_period_size = 256 ;
|
||||
alsa_buffer_frames = 3 * alsa_period_size ;
|
||||
}
|
||||
else
|
||||
{ alsa_period_size = 1024 ;
|
||||
alsa_buffer_frames = 4 * alsa_period_size ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_open (&alsa_dev, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
|
||||
{ fprintf (stderr, "cannot open audio device \"%s\" (%s)\n", device, snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
snd_pcm_nonblock (alsa_dev, 0) ;
|
||||
|
||||
if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0)
|
||||
{ fprintf (stderr, "cannot allocate hardware parameter structure (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_hw_params_any (alsa_dev, hw_params)) < 0)
|
||||
{ fprintf (stderr, "cannot initialize hardware parameter structure (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_hw_params_set_access (alsa_dev, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
|
||||
{ fprintf (stderr, "cannot set access type (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_hw_params_set_format (alsa_dev, hw_params, SND_PCM_FORMAT_FLOAT)) < 0)
|
||||
{ fprintf (stderr, "cannot set sample format (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_hw_params_set_rate_near (alsa_dev, hw_params, &samplerate, 0)) < 0)
|
||||
{ fprintf (stderr, "cannot set sample rate (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_hw_params_set_channels (alsa_dev, hw_params, channels)) < 0)
|
||||
{ fprintf (stderr, "cannot set channel count (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_hw_params_set_buffer_size_near (alsa_dev, hw_params, &alsa_buffer_frames)) < 0)
|
||||
{ fprintf (stderr, "cannot set buffer size (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_hw_params_set_period_size_near (alsa_dev, hw_params, &alsa_period_size, 0)) < 0)
|
||||
{ fprintf (stderr, "cannot set period size (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_hw_params (alsa_dev, hw_params)) < 0)
|
||||
{ fprintf (stderr, "cannot set parameters (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
/* extra check: if we have only one period, this code won't work */
|
||||
snd_pcm_hw_params_get_period_size (hw_params, &alsa_period_size, 0) ;
|
||||
snd_pcm_hw_params_get_buffer_size (hw_params, &buffer_size) ;
|
||||
if (alsa_period_size == buffer_size)
|
||||
{ fprintf (stderr, "Can't use period equal to buffer size (%lu == %lu)", alsa_period_size, buffer_size) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
snd_pcm_hw_params_free (hw_params) ;
|
||||
|
||||
if ((err = snd_pcm_sw_params_malloc (&sw_params)) != 0)
|
||||
{ fprintf (stderr, "%s: snd_pcm_sw_params_malloc: %s", __func__, snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_sw_params_current (alsa_dev, sw_params)) != 0)
|
||||
{ fprintf (stderr, "%s: snd_pcm_sw_params_current: %s", __func__, snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
/* note: set start threshold to delay start until the ring buffer is full */
|
||||
snd_pcm_sw_params_current (alsa_dev, sw_params) ;
|
||||
|
||||
if ((err = snd_pcm_sw_params_set_start_threshold (alsa_dev, sw_params, buffer_size)) < 0)
|
||||
{ fprintf (stderr, "cannot set start threshold (%s)\n", snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
if ((err = snd_pcm_sw_params (alsa_dev, sw_params)) != 0)
|
||||
{ fprintf (stderr, "%s: snd_pcm_sw_params: %s", __func__, snd_strerror (err)) ;
|
||||
goto catch_error ;
|
||||
} ;
|
||||
|
||||
snd_pcm_sw_params_free (sw_params) ;
|
||||
|
||||
snd_pcm_reset (alsa_dev) ;
|
||||
|
||||
catch_error :
|
||||
|
||||
if (err < 0 && alsa_dev != NULL)
|
||||
{ snd_pcm_close (alsa_dev) ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
return alsa_dev ;
|
||||
} /* alsa_open */
|
||||
|
||||
static int
|
||||
alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels)
|
||||
{ static int epipe_count = 0 ;
|
||||
|
||||
int total = 0 ;
|
||||
int retval ;
|
||||
|
||||
if (epipe_count > 0)
|
||||
epipe_count -- ;
|
||||
|
||||
while (total < frames)
|
||||
{ retval = snd_pcm_writei (alsa_dev, data + total * channels, frames - total) ;
|
||||
|
||||
if (retval >= 0)
|
||||
{ total += retval ;
|
||||
if (total == frames)
|
||||
return total ;
|
||||
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
switch (retval)
|
||||
{ case -EAGAIN :
|
||||
puts ("alsa_write_float: EAGAIN") ;
|
||||
continue ;
|
||||
break ;
|
||||
|
||||
case -EPIPE :
|
||||
if (epipe_count > 0)
|
||||
{ printf ("alsa_write_float: EPIPE %d\n", epipe_count) ;
|
||||
if (epipe_count > 140)
|
||||
return retval ;
|
||||
} ;
|
||||
epipe_count += 100 ;
|
||||
|
||||
#if 0
|
||||
if (0)
|
||||
{ snd_pcm_status_t *status ;
|
||||
|
||||
snd_pcm_status_alloca (&status) ;
|
||||
if ((retval = snd_pcm_status (alsa_dev, status)) < 0)
|
||||
fprintf (stderr, "alsa_out: xrun. can't determine length\n") ;
|
||||
else if (snd_pcm_status_get_state (status) == SND_PCM_STATE_XRUN)
|
||||
{ struct timeval now, diff, tstamp ;
|
||||
|
||||
gettimeofday (&now, 0) ;
|
||||
snd_pcm_status_get_trigger_tstamp (status, &tstamp) ;
|
||||
timersub (&now, &tstamp, &diff) ;
|
||||
|
||||
fprintf (stderr, "alsa_write_float xrun: of at least %.3f msecs. resetting stream\n",
|
||||
diff.tv_sec * 1000 + diff.tv_usec / 1000.0) ;
|
||||
}
|
||||
else
|
||||
fprintf (stderr, "alsa_write_float: xrun. can't determine length\n") ;
|
||||
} ;
|
||||
#endif
|
||||
|
||||
snd_pcm_prepare (alsa_dev) ;
|
||||
break ;
|
||||
|
||||
case -EBADFD :
|
||||
fprintf (stderr, "alsa_write_float: Bad PCM state.n") ;
|
||||
return 0 ;
|
||||
break ;
|
||||
|
||||
case -ESTRPIPE :
|
||||
fprintf (stderr, "alsa_write_float: Suspend event.n") ;
|
||||
return 0 ;
|
||||
break ;
|
||||
|
||||
case -EIO :
|
||||
puts ("alsa_write_float: EIO") ;
|
||||
return 0 ;
|
||||
|
||||
default :
|
||||
fprintf (stderr, "alsa_write_float: retval = %d\n", retval) ;
|
||||
return 0 ;
|
||||
break ;
|
||||
} ; /* switch */
|
||||
} ; /* while */
|
||||
|
||||
return total ;
|
||||
} /* alsa_write_float */
|
||||
|
||||
#endif /* HAVE_ALSA_ASOUNDLIB_H */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Linux/OSS functions for playing a sound.
|
||||
*/
|
||||
|
||||
#if defined (__linux__)
|
||||
|
||||
static int linux_open_dsp_device (int channels, int srate) ;
|
||||
|
||||
static void
|
||||
linux_play (int argc, char *argv [])
|
||||
{ static short buffer [BUFFER_LEN] ;
|
||||
SNDFILE *sndfile ;
|
||||
SF_INFO sfinfo ;
|
||||
int k, audio_device, readcount, writecount, subformat ;
|
||||
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
{ memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
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 ;
|
||||
} ;
|
||||
|
||||
audio_device = linux_open_dsp_device (sfinfo.channels, sfinfo.samplerate) ;
|
||||
|
||||
subformat = sfinfo.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
|
||||
{ static float float_buffer [BUFFER_LEN] ;
|
||||
double scale ;
|
||||
int m ;
|
||||
|
||||
sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &scale, sizeof (scale)) ;
|
||||
if (scale < 1e-10)
|
||||
scale = 1.0 ;
|
||||
else
|
||||
scale = 32700.0 / scale ;
|
||||
|
||||
while ((readcount = sf_read_float (sndfile, float_buffer, BUFFER_LEN)))
|
||||
{ for (m = 0 ; m < readcount ; m++)
|
||||
buffer [m] = scale * float_buffer [m] ;
|
||||
writecount = write (audio_device, buffer, readcount * sizeof (short)) ;
|
||||
} ;
|
||||
}
|
||||
else
|
||||
{ while ((readcount = sf_read_short (sndfile, buffer, BUFFER_LEN)))
|
||||
writecount = write (audio_device, buffer, readcount * sizeof (short)) ;
|
||||
} ;
|
||||
|
||||
if (ioctl (audio_device, SNDCTL_DSP_POST, 0) == -1)
|
||||
perror ("ioctl (SNDCTL_DSP_POST) ") ;
|
||||
|
||||
if (ioctl (audio_device, SNDCTL_DSP_SYNC, 0) == -1)
|
||||
perror ("ioctl (SNDCTL_DSP_SYNC) ") ;
|
||||
|
||||
close (audio_device) ;
|
||||
|
||||
sf_close (sndfile) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* linux_play */
|
||||
|
||||
static int
|
||||
linux_open_dsp_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 ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
stereo = 0 ;
|
||||
if (ioctl (fd, SNDCTL_DSP_STEREO, &stereo) == -1)
|
||||
{ /* Fatal error */
|
||||
perror ("linux_open_dsp_device : stereo ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (ioctl (fd, SNDCTL_DSP_RESET, 0))
|
||||
{ perror ("linux_open_dsp_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 ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (ioctl (fd, SNDCTL_DSP_CHANNELS, &channels) != 0)
|
||||
{ perror ("linux_open_dsp_device : channels ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (ioctl (fd, SNDCTL_DSP_SPEED, &srate) != 0)
|
||||
{ perror ("linux_open_dsp_device : sample rate ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (ioctl (fd, SNDCTL_DSP_SYNC, 0) != 0)
|
||||
{ perror ("linux_open_dsp_device : sync ") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
return fd ;
|
||||
} /* linux_open_dsp_device */
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Mac OS X functions for playing a sound.
|
||||
*/
|
||||
|
||||
#if (defined (__MACH__) && defined (__APPLE__)) /* MacOSX */
|
||||
|
||||
typedef struct
|
||||
{ AudioStreamBasicDescription format ;
|
||||
|
||||
UInt32 buf_size ;
|
||||
AudioDeviceID device ;
|
||||
|
||||
SNDFILE *sndfile ;
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
int fake_stereo ;
|
||||
int done_playing ;
|
||||
} MacOSXAudioData ;
|
||||
|
||||
#include <math.h>
|
||||
|
||||
static OSStatus
|
||||
macosx_audio_out_callback (AudioDeviceID device, const AudioTimeStamp* current_time,
|
||||
const AudioBufferList* data_in, const AudioTimeStamp* time_in,
|
||||
AudioBufferList* data_out, const AudioTimeStamp* time_out,
|
||||
void* client_data)
|
||||
{ MacOSXAudioData *audio_data ;
|
||||
int size, sample_count, read_count, k ;
|
||||
float *buffer ;
|
||||
|
||||
/* Prevent compiler warnings. */
|
||||
device = device ;
|
||||
current_time = current_time ;
|
||||
data_in = data_in ;
|
||||
time_in = time_in ;
|
||||
time_out = time_out ;
|
||||
|
||||
audio_data = (MacOSXAudioData*) client_data ;
|
||||
|
||||
size = data_out->mBuffers [0].mDataByteSize ;
|
||||
sample_count = size / sizeof (float) ;
|
||||
|
||||
buffer = (float*) data_out->mBuffers [0].mData ;
|
||||
|
||||
if (audio_data->fake_stereo != 0)
|
||||
{ read_count = sf_read_float (audio_data->sndfile, buffer, sample_count / 2) ;
|
||||
|
||||
for (k = read_count - 1 ; k >= 0 ; k--)
|
||||
{ buffer [2 * k ] = buffer [k] ;
|
||||
buffer [2 * k + 1] = buffer [k] ;
|
||||
} ;
|
||||
read_count *= 2 ;
|
||||
}
|
||||
else
|
||||
read_count = sf_read_float (audio_data->sndfile, buffer, sample_count) ;
|
||||
|
||||
/* Fill the remainder with zeroes. */
|
||||
if (read_count < sample_count)
|
||||
{ if (audio_data->fake_stereo == 0)
|
||||
memset (&(buffer [read_count]), 0, (sample_count - read_count) * sizeof (float)) ;
|
||||
/* Tell the main application to terminate. */
|
||||
audio_data->done_playing = SF_TRUE ;
|
||||
} ;
|
||||
|
||||
return noErr ;
|
||||
} /* macosx_audio_out_callback */
|
||||
|
||||
static void
|
||||
macosx_play (int argc, char *argv [])
|
||||
{ MacOSXAudioData audio_data ;
|
||||
OSStatus err ;
|
||||
UInt32 count, buffer_size ;
|
||||
int k ;
|
||||
|
||||
audio_data.fake_stereo = 0 ;
|
||||
audio_data.device = kAudioDeviceUnknown ;
|
||||
|
||||
/* get the default output device for the HAL */
|
||||
count = sizeof (AudioDeviceID) ;
|
||||
if ((err = AudioHardwareGetProperty (kAudioHardwarePropertyDefaultOutputDevice,
|
||||
&count, (void *) &(audio_data.device))) != noErr)
|
||||
{ printf ("AudioHardwareGetProperty (kAudioDevicePropertyDefaultOutputDevice) failed.\n") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
/* get the buffersize that the default device uses for IO */
|
||||
count = sizeof (UInt32) ;
|
||||
if ((err = AudioDeviceGetProperty (audio_data.device, 0, false, kAudioDevicePropertyBufferSize,
|
||||
&count, &buffer_size)) != noErr)
|
||||
{ printf ("AudioDeviceGetProperty (kAudioDevicePropertyBufferSize) failed.\n") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
/* get a description of the data format used by the default device */
|
||||
count = sizeof (AudioStreamBasicDescription) ;
|
||||
if ((err = AudioDeviceGetProperty (audio_data.device, 0, false, kAudioDevicePropertyStreamFormat,
|
||||
&count, &(audio_data.format))) != noErr)
|
||||
{ printf ("AudioDeviceGetProperty (kAudioDevicePropertyStreamFormat) failed.\n") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
/* Base setup completed. Now play files. */
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
{ printf ("Playing %s\n", argv [k]) ;
|
||||
if (! (audio_data.sndfile = sf_open (argv [k], SFM_READ, &(audio_data.sfinfo))))
|
||||
{ puts (sf_strerror (NULL)) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (audio_data.sfinfo.channels < 1 || audio_data.sfinfo.channels > 2)
|
||||
{ printf ("Error : channels = %d.\n", audio_data.sfinfo.channels) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
audio_data.format.mSampleRate = audio_data.sfinfo.samplerate ;
|
||||
|
||||
if (audio_data.sfinfo.channels == 1)
|
||||
{ audio_data.format.mChannelsPerFrame = 2 ;
|
||||
audio_data.fake_stereo = 1 ;
|
||||
}
|
||||
else
|
||||
audio_data.format.mChannelsPerFrame = audio_data.sfinfo.channels ;
|
||||
|
||||
if ((err = AudioDeviceSetProperty (audio_data.device, NULL, 0, false, kAudioDevicePropertyStreamFormat,
|
||||
sizeof (AudioStreamBasicDescription), &(audio_data.format))) != noErr)
|
||||
{ printf ("AudioDeviceSetProperty (kAudioDevicePropertyStreamFormat) failed.\n") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
/* we want linear pcm */
|
||||
if (audio_data.format.mFormatID != kAudioFormatLinearPCM)
|
||||
return ;
|
||||
|
||||
/* Fire off the device. */
|
||||
if ((err = AudioDeviceAddIOProc (audio_data.device, macosx_audio_out_callback,
|
||||
(void *) &audio_data)) != noErr)
|
||||
{ printf ("AudioDeviceAddIOProc failed.\n") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
err = AudioDeviceStart (audio_data.device, macosx_audio_out_callback) ;
|
||||
if (err != noErr)
|
||||
return ;
|
||||
|
||||
audio_data.done_playing = SF_FALSE ;
|
||||
|
||||
while (audio_data.done_playing == SF_FALSE)
|
||||
usleep (10 * 1000) ; /* 10 000 milliseconds. */
|
||||
|
||||
if ((err = AudioDeviceStop (audio_data.device, macosx_audio_out_callback)) != noErr)
|
||||
{ printf ("AudioDeviceStop failed.\n") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
err = AudioDeviceRemoveIOProc (audio_data.device, macosx_audio_out_callback) ;
|
||||
if (err != noErr)
|
||||
{ printf ("AudioDeviceRemoveIOProc failed.\n") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
sf_close (audio_data.sndfile) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* macosx_play */
|
||||
|
||||
#endif /* MacOSX */
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Win32 functions for playing a sound.
|
||||
**
|
||||
** This API sucks. Its needlessly complicated and is *WAY* too loose with
|
||||
** passing pointers arounf in integers and and using char* pointers to
|
||||
** point to data instead of short*. It plain sucks!
|
||||
*/
|
||||
|
||||
#if (OS_IS_WIN32 == 1)
|
||||
|
||||
#define WIN32_BUFFER_LEN (1<<15)
|
||||
|
||||
typedef struct
|
||||
{ HWAVEOUT hwave ;
|
||||
WAVEHDR whdr [2] ;
|
||||
|
||||
CRITICAL_SECTION mutex ; /* to control access to BuffersInUSe */
|
||||
HANDLE Event ; /* signal that a buffer is free */
|
||||
|
||||
short buffer [WIN32_BUFFER_LEN / sizeof (short)] ;
|
||||
int current, bufferlen ;
|
||||
int BuffersInUse ;
|
||||
|
||||
SNDFILE *sndfile ;
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
sf_count_t remaining ;
|
||||
} Win32_Audio_Data ;
|
||||
|
||||
|
||||
static void
|
||||
win32_play_data (Win32_Audio_Data *audio_data)
|
||||
{ int thisread, readcount ;
|
||||
|
||||
/* fill a buffer if there is more data and we can read it sucessfully */
|
||||
readcount = (audio_data->remaining > audio_data->bufferlen) ? audio_data->bufferlen : (int) audio_data->remaining ;
|
||||
|
||||
thisread = (int) sf_read_short (audio_data->sndfile, (short *) (audio_data->whdr [audio_data->current].lpData), readcount) ;
|
||||
|
||||
audio_data->remaining -= thisread ;
|
||||
|
||||
if (thisread > 0)
|
||||
{ /* Fix buffer length if this is only a partial block. */
|
||||
if (thisread < audio_data->bufferlen)
|
||||
audio_data->whdr [audio_data->current].dwBufferLength = thisread * sizeof (short) ;
|
||||
|
||||
/* Queue the WAVEHDR */
|
||||
waveOutWrite (audio_data->hwave, (LPWAVEHDR) &(audio_data->whdr [audio_data->current]), sizeof (WAVEHDR)) ;
|
||||
|
||||
/* count another buffer in use */
|
||||
EnterCriticalSection (&audio_data->mutex) ;
|
||||
audio_data->BuffersInUse ++ ;
|
||||
LeaveCriticalSection (&audio_data->mutex) ;
|
||||
|
||||
/* use the other buffer next time */
|
||||
audio_data->current = (audio_data->current + 1) % 2 ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* win32_play_data */
|
||||
|
||||
static void CALLBACK
|
||||
win32_audio_out_callback (HWAVEOUT hwave, UINT msg, DWORD_PTR data, DWORD param1, DWORD param2)
|
||||
{ Win32_Audio_Data *audio_data ;
|
||||
|
||||
/* Prevent compiler warnings. */
|
||||
hwave = hwave ;
|
||||
param1 = param2 ;
|
||||
|
||||
if (data == 0)
|
||||
return ;
|
||||
|
||||
/*
|
||||
** I consider this technique of passing a pointer via an integer as
|
||||
** fundamentally broken but thats the way microsoft has defined the
|
||||
** interface.
|
||||
*/
|
||||
audio_data = (Win32_Audio_Data*) data ;
|
||||
|
||||
/* let main loop know a buffer is free */
|
||||
if (msg == MM_WOM_DONE)
|
||||
{ EnterCriticalSection (&audio_data->mutex) ;
|
||||
audio_data->BuffersInUse -- ;
|
||||
LeaveCriticalSection (&audio_data->mutex) ;
|
||||
SetEvent (audio_data->Event) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* win32_audio_out_callback */
|
||||
|
||||
static void
|
||||
win32_play (int argc, char *argv [])
|
||||
{ Win32_Audio_Data audio_data ;
|
||||
|
||||
WAVEFORMATEX wf ;
|
||||
int k, error ;
|
||||
|
||||
audio_data.sndfile = NULL ;
|
||||
audio_data.hwave = 0 ;
|
||||
|
||||
for (k = 1 ; k < argc ; k++)
|
||||
{ printf ("Playing %s\n", argv [k]) ;
|
||||
|
||||
if (! (audio_data.sndfile = sf_open (argv [k], SFM_READ, &(audio_data.sfinfo))))
|
||||
{ puts (sf_strerror (NULL)) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
audio_data.remaining = audio_data.sfinfo.frames * audio_data.sfinfo.channels ;
|
||||
audio_data.current = 0 ;
|
||||
|
||||
InitializeCriticalSection (&audio_data.mutex) ;
|
||||
audio_data.Event = CreateEvent (0, FALSE, FALSE, 0) ;
|
||||
|
||||
wf.nChannels = audio_data.sfinfo.channels ;
|
||||
wf.wFormatTag = WAVE_FORMAT_PCM ;
|
||||
wf.cbSize = 0 ;
|
||||
wf.wBitsPerSample = 16 ;
|
||||
|
||||
wf.nSamplesPerSec = audio_data.sfinfo.samplerate ;
|
||||
|
||||
wf.nBlockAlign = audio_data.sfinfo.channels * sizeof (short) ;
|
||||
|
||||
wf.nAvgBytesPerSec = wf.nBlockAlign * wf.nSamplesPerSec ;
|
||||
|
||||
error = waveOutOpen (&(audio_data.hwave), WAVE_MAPPER, &wf, (DWORD_PTR) win32_audio_out_callback,
|
||||
(DWORD_PTR) &audio_data, CALLBACK_FUNCTION) ;
|
||||
if (error)
|
||||
{ puts ("waveOutOpen failed.") ;
|
||||
audio_data.hwave = 0 ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
audio_data.whdr [0].lpData = (char*) audio_data.buffer ;
|
||||
audio_data.whdr [1].lpData = ((char*) audio_data.buffer) + sizeof (audio_data.buffer) / 2 ;
|
||||
|
||||
audio_data.whdr [0].dwBufferLength = sizeof (audio_data.buffer) / 2 ;
|
||||
audio_data.whdr [1].dwBufferLength = sizeof (audio_data.buffer) / 2 ;
|
||||
|
||||
audio_data.whdr [0].dwFlags = 0 ;
|
||||
audio_data.whdr [1].dwFlags = 0 ;
|
||||
|
||||
/* length of each audio buffer in samples */
|
||||
audio_data.bufferlen = sizeof (audio_data.buffer) / 2 / sizeof (short) ;
|
||||
|
||||
/* Prepare the WAVEHDRs */
|
||||
if ((error = waveOutPrepareHeader (audio_data.hwave, &(audio_data.whdr [0]), sizeof (WAVEHDR))))
|
||||
{ printf ("waveOutPrepareHeader [0] failed : %08X\n", error) ;
|
||||
waveOutClose (audio_data.hwave) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if ((error = waveOutPrepareHeader (audio_data.hwave, &(audio_data.whdr [1]), sizeof (WAVEHDR))))
|
||||
{ printf ("waveOutPrepareHeader [1] failed : %08X\n", error) ;
|
||||
waveOutUnprepareHeader (audio_data.hwave, &(audio_data.whdr [0]), sizeof (WAVEHDR)) ;
|
||||
waveOutClose (audio_data.hwave) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
/* Fill up both buffers with audio data */
|
||||
audio_data.BuffersInUse = 0 ;
|
||||
win32_play_data (&audio_data) ;
|
||||
win32_play_data (&audio_data) ;
|
||||
|
||||
/* loop until both buffers are released */
|
||||
while (audio_data.BuffersInUse > 0)
|
||||
{
|
||||
/* wait for buffer to be released */
|
||||
WaitForSingleObject (audio_data.Event, INFINITE) ;
|
||||
|
||||
/* refill the buffer if there is more data to play */
|
||||
win32_play_data (&audio_data) ;
|
||||
} ;
|
||||
|
||||
waveOutUnprepareHeader (audio_data.hwave, &(audio_data.whdr [0]), sizeof (WAVEHDR)) ;
|
||||
waveOutUnprepareHeader (audio_data.hwave, &(audio_data.whdr [1]), sizeof (WAVEHDR)) ;
|
||||
|
||||
waveOutClose (audio_data.hwave) ;
|
||||
audio_data.hwave = 0 ;
|
||||
|
||||
DeleteCriticalSection (&audio_data.mutex) ;
|
||||
|
||||
sf_close (audio_data.sndfile) ;
|
||||
} ;
|
||||
|
||||
} /* win32_play */
|
||||
|
||||
#endif /* Win32 */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Solaris.
|
||||
*/
|
||||
|
||||
#if (defined (sun) && defined (unix)) /* ie Solaris */
|
||||
|
||||
static void
|
||||
solaris_play (int argc, char *argv [])
|
||||
{ static short buffer [BUFFER_LEN] ;
|
||||
audio_info_t audio_info ;
|
||||
SNDFILE *sndfile ;
|
||||
SF_INFO sfinfo ;
|
||||
unsigned long delay_time ;
|
||||
long k, start_count, output_count, write_count, read_count ;
|
||||
int audio_fd, error, done ;
|
||||
|
||||
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 ;
|
||||
} ;
|
||||
|
||||
/* open the audio device - write only, non-blocking */
|
||||
if ((audio_fd = open ("/dev/audio", O_WRONLY | O_NONBLOCK)) < 0)
|
||||
{ perror ("open (/dev/audio) failed") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
/* Retrive standard values. */
|
||||
AUDIO_INITINFO (&audio_info) ;
|
||||
|
||||
audio_info.play.sample_rate = sfinfo.samplerate ;
|
||||
audio_info.play.channels = sfinfo.channels ;
|
||||
audio_info.play.precision = 16 ;
|
||||
audio_info.play.encoding = AUDIO_ENCODING_LINEAR ;
|
||||
audio_info.play.gain = AUDIO_MAX_GAIN ;
|
||||
audio_info.play.balance = AUDIO_MID_BALANCE ;
|
||||
|
||||
if ((error = ioctl (audio_fd, AUDIO_SETINFO, &audio_info)))
|
||||
{ perror ("ioctl (AUDIO_SETINFO) failed") ;
|
||||
return ;
|
||||
} ;
|
||||
|
||||
/* Delay time equal to 1/4 of a buffer in microseconds. */
|
||||
delay_time = (BUFFER_LEN * 1000000) / (audio_info.play.sample_rate * 4) ;
|
||||
|
||||
done = 0 ;
|
||||
while (! done)
|
||||
{ read_count = sf_read_short (sndfile, buffer, BUFFER_LEN) ;
|
||||
if (read_count < BUFFER_LEN)
|
||||
{ memset (&(buffer [read_count]), 0, (BUFFER_LEN - read_count) * sizeof (short)) ;
|
||||
/* Tell the main application to terminate. */
|
||||
done = SF_TRUE ;
|
||||
} ;
|
||||
|
||||
start_count = 0 ;
|
||||
output_count = BUFFER_LEN * sizeof (short) ;
|
||||
|
||||
while (output_count > 0)
|
||||
{ /* write as much data as possible */
|
||||
write_count = write (audio_fd, &(buffer [start_count]), output_count) ;
|
||||
if (write_count > 0)
|
||||
{ output_count -= write_count ;
|
||||
start_count += write_count ;
|
||||
}
|
||||
else
|
||||
{ /* Give the audio output time to catch up. */
|
||||
usleep (delay_time) ;
|
||||
} ;
|
||||
} ; /* while (outpur_count > 0) */
|
||||
} ; /* while (! done) */
|
||||
|
||||
close (audio_fd) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* solaris_play */
|
||||
|
||||
#endif /* Solaris */
|
||||
|
||||
/*==============================================================================
|
||||
** Main function.
|
||||
*/
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
printf ("\nUsage : %s <input sound file>\n\n", argv [0]) ;
|
||||
#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 ;
|
||||
} ;
|
||||
|
||||
#if defined (__linux__)
|
||||
#if HAVE_ALSA_ASOUNDLIB_H
|
||||
if (access ("/proc/asound/cards", R_OK) == 0)
|
||||
alsa_play (argc, argv) ;
|
||||
else
|
||||
#endif
|
||||
linux_play (argc, argv) ;
|
||||
#elif (defined (__MACH__) && defined (__APPLE__))
|
||||
macosx_play (argc, argv) ;
|
||||
#elif (defined (sun) && defined (unix))
|
||||
solaris_play (argc, argv) ;
|
||||
#elif (OS_IS_WIN32 == 1)
|
||||
win32_play (argc, argv) ;
|
||||
#elif defined (__BEOS__)
|
||||
printf ("This program cannot be compiled on BeOS.\n") ;
|
||||
printf ("Instead, compile the file sfplay_beos.cpp.\n") ;
|
||||
return 1 ;
|
||||
#else
|
||||
puts ("*** Playing sound not yet supported on this platform.") ;
|
||||
puts ("*** Please feel free to submit a patch.") ;
|
||||
return 1 ;
|
||||
#endif
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2008 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the author nor the names of any contributors may be used
|
||||
# to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# Simple test script for the sndfile-metadata-set program.
|
||||
|
||||
import commands, os, sys
|
||||
import time, datetime
|
||||
|
||||
def print_test_name (name):
|
||||
print " %-30s :" % name,
|
||||
|
||||
def assert_info (filename, arg, value):
|
||||
cmd = "./sndfile-metadata-get %s %s" % (arg, filename)
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
sys.exit (1)
|
||||
if output.find (value) < 0:
|
||||
print "\n\nError : not able to find '%s'." % value
|
||||
print output
|
||||
sys.exit (1)
|
||||
return
|
||||
|
||||
|
||||
def check_executable (name):
|
||||
if not (os.path.isfile (name)):
|
||||
print "\n\nError : Can't find executable '%s'. Have you run make?" % name
|
||||
sys.exit (1)
|
||||
|
||||
def test_empty_fail ():
|
||||
print_test_name ("Empty fail test")
|
||||
cmd = "./sndfile-metadata-set --bext-description Alpha sine.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if not status:
|
||||
print "\n\nError : command '%s' should have failed." % cmd
|
||||
sys.exit (1)
|
||||
print "ok"
|
||||
|
||||
def test_copy ():
|
||||
print_test_name ("Copy test")
|
||||
cmd = "./sndfile-metadata-set --bext-description \"First Try\" sine.wav output.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
sys.exit (1)
|
||||
assert_info ("output.wav", "--bext-description", "First Try")
|
||||
print "ok"
|
||||
|
||||
def test_update (tests):
|
||||
print_test_name ("Update test")
|
||||
for arg, value in tests:
|
||||
cmd = "./sndfile-metadata-set %s \"%s\" output.wav" % (arg, value)
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
sys.exit (1)
|
||||
assert_info ("output.wav", arg, value)
|
||||
print "ok"
|
||||
|
||||
def test_post_mod (tests):
|
||||
print_test_name ("Post mod test")
|
||||
for arg, value in tests:
|
||||
assert_info ("output.wav", arg, value)
|
||||
print "ok"
|
||||
|
||||
def test_auto_date ():
|
||||
print_test_name ("Auto date test")
|
||||
cmd = "./sndfile-metadata-set --bext-auto-time-date sine.wav date-time.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
sys.exit (1)
|
||||
target = datetime.date.today ().__str__ ()
|
||||
assert_info ("date-time.wav", "--bext-orig-date", target)
|
||||
print "ok"
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
def test_coding_history ():
|
||||
print_test_name ("Coding history test")
|
||||
cmd = "./sndfile-metadata-set --bext-coding-hist \"alpha beta\" output.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
sys.exit (1)
|
||||
cmd = "./sndfile-metadata-get --bext-coding-hist output.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
sys.exit (1)
|
||||
print "ok"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
def test_rewrite ():
|
||||
print_test_name ("Rewrite test")
|
||||
cmd = "./sndfile-metadata-set --bext-originator \"Really, really long string\" output.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
sys.exit (1)
|
||||
cmd = "./sndfile-metadata-set --bext-originator \"Short\" output.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
sys.exit (1)
|
||||
cmd = "./sndfile-metadata-get --bext-originator output.wav"
|
||||
status, output = commands.getstatusoutput (cmd)
|
||||
if status:
|
||||
print "\n\nError : command '%s' should not have failed." % cmd
|
||||
sys.exit (1)
|
||||
if output.find ("really long") > 0:
|
||||
print "\n\nError : output '%s' should not contain 'really long'." % output
|
||||
sys.exit (1)
|
||||
print "ok"
|
||||
|
||||
#===============================================================================
|
||||
|
||||
test_dir = "programs"
|
||||
|
||||
if os.path.isdir (test_dir):
|
||||
os.chdir (test_dir)
|
||||
|
||||
for f in [ "sndfile-metadata-set", "sndfile-metadata-get", "../examples/make_sine" ]:
|
||||
check_executable (f)
|
||||
|
||||
os.system ("../examples/make_sine")
|
||||
if not os.path.isfile ("sine.wav"):
|
||||
print "\n\nError : Can't file file 'sine.wav'."
|
||||
sys.exit (1)
|
||||
|
||||
print ""
|
||||
|
||||
test_empty_fail ()
|
||||
test_copy ()
|
||||
|
||||
tests = [
|
||||
("--bext-description", "Alpha"), ("--bext-originator", "Beta"), ("--bext-orig-ref", "Charlie"),
|
||||
("--bext-umid", "Delta"), ("--bext-orig-date", "2001-10-01"), ("--bext-orig-time", "01:02:03"),
|
||||
("--str-title", "Echo"), ("--str-artist", "Fox trot")
|
||||
]
|
||||
|
||||
test_auto_date ()
|
||||
test_update (tests)
|
||||
test_post_mod (tests)
|
||||
|
||||
test_update ([ ("--str-artist", "Fox") ])
|
||||
|
||||
test_coding_history ()
|
||||
|
||||
test_rewrite ()
|
||||
|
||||
|
||||
print ""
|
||||
|
||||
sys.exit (0)
|
||||
|
|
@ -4,15 +4,8 @@ bin_PROGRAMS = sndfile-regtest
|
|||
|
||||
noinst_HEADERS = regtest.h
|
||||
|
||||
SNDFILEDIR =../src
|
||||
INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS)
|
||||
INCLUDES = -I$(top_srcdir)/src $(SQLITE3_CFLAGS) $(OS_SPECIFIC_CFLAGS)
|
||||
|
||||
sndfile_regtest_SOURCES = sndfile-regtest.c database.c checksum.c
|
||||
sndfile_regtest_LDADD = $(SNDFILEDIR)/libsndfile.la $(SQLITE3_LIBS)
|
||||
sndfile_regtest_LDADD = $(top_builddir)/src/libsndfile.la $(SQLITE3_LIBS)
|
||||
|
||||
|
||||
## Do not edit or modify anything in this comment block.
|
||||
## The arch-tag line is a file identity tag for the GNU Arch
|
||||
## revision control system.
|
||||
##
|
||||
## arch-tag: ac4a9626-49ce-4bb4-9fb6-e43de0a23432
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2005 Erik de Castro Lopo
|
||||
** Copyright (C) 2005-2009 Erik de Castro Lopo
|
||||
**
|
||||
** 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
|
||||
|
@ -20,16 +20,15 @@
|
|||
** A simple checksum for short, int and float data.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "float_cast.h"
|
||||
|
||||
#include "regtest.h"
|
||||
|
||||
#define BIG_PRIME 999983
|
||||
|
@ -116,10 +115,3 @@ float_checksum (SNDFILE * file, int start)
|
|||
return start ;
|
||||
} /* float_checksum */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The following line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 6ae999d1-dd5a-4306-9e11-d4cfc9e8ae27
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2005 Erik de Castro Lopo
|
||||
** Copyright (C) 2005-2009 Erik de Castro Lopo
|
||||
**
|
||||
** 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
|
||||
|
@ -185,8 +185,8 @@ db_add_file (REG_DB * db_handle, const char * filepath)
|
|||
|
||||
snprintf (db->cmdbuf, sizeof (db->cmdbuf), "insert into sndfile "
|
||||
"(fname, fpath, srate, frames, channels, format, checksum, logbuf) values"
|
||||
"('%s','%s',%d,'%lld', %d, '0x%08x', '0x%08x', '%s');",
|
||||
db->filename, db->pathname, info.samplerate, info.frames, info.channels, info.format, checksum, db->logbuf) ;
|
||||
"('%s','%s',%d,'%ld', %d, '0x%08x', '0x%08x', '%s');",
|
||||
db->filename, db->pathname, info.samplerate, (long) info.frames, info.channels, info.format, checksum, db->logbuf) ;
|
||||
|
||||
if (strlen (db->cmdbuf) >= sizeof (db->cmdbuf) - 1)
|
||||
{ printf ("strlen (db->cmdbuf) too long.\n") ;
|
||||
|
@ -311,8 +311,8 @@ get_filename_pathname_by_ekey (REGTEST_DB * db, int ekey)
|
|||
exit (1) ;
|
||||
} ;
|
||||
|
||||
strncpy (db->filename, result [2], sizeof (db->filename)) ;
|
||||
strncpy (db->pathname, result [3], sizeof (db->pathname)) ;
|
||||
snprintf (db->filename, sizeof (db->filename), "%s", result [2]) ;
|
||||
snprintf (db->pathname, sizeof (db->pathname), "%s", result [3]) ;
|
||||
|
||||
sqlite3_free_table (result) ;
|
||||
|
||||
|
@ -368,7 +368,7 @@ check_file_by_ekey (REGTEST_DB * db, int ekey)
|
|||
if (strcmp (result [k], "frames") == 0)
|
||||
{ if (strtoll (result [k + cols], NULL, 10) == info.frames)
|
||||
continue ;
|
||||
printf ("\n\nError : frames doesn't match : %s == %lld\n", result [k + cols], info.frames) ;
|
||||
printf ("\n\nError : frames doesn't match : %s == %ld\n", result [k + cols], (long) info.frames) ;
|
||||
} ;
|
||||
|
||||
if (strcmp (result [k], "channels") == 0)
|
||||
|
@ -411,6 +411,7 @@ check_file_by_ekey (REGTEST_DB * db, int ekey)
|
|||
static void
|
||||
get_filename_pathname (REGTEST_DB * db, const char *filepath)
|
||||
{ const char * cptr ;
|
||||
int slen ;
|
||||
|
||||
if (filepath [0] != '/')
|
||||
{ memset (db->pathname, 0, sizeof (db->pathname)) ;
|
||||
|
@ -419,18 +420,19 @@ get_filename_pathname (REGTEST_DB * db, const char *filepath)
|
|||
exit (1) ;
|
||||
} ;
|
||||
|
||||
db->pathname [strlen (db->pathname)] = '/' ;
|
||||
strncat (db->pathname, filepath, sizeof (db->pathname)) ;
|
||||
slen = strlen (db->pathname) ;
|
||||
db->pathname [slen ++] = '/' ;
|
||||
snprintf (db->pathname + slen, sizeof (db->pathname) - slen, "%s", filepath) ;
|
||||
}
|
||||
else
|
||||
strncpy (db->pathname, filepath, sizeof (db->pathname)) ;
|
||||
snprintf (db->pathname, sizeof (db->pathname), "%s", filepath) ;
|
||||
|
||||
if ((cptr = strrchr (db->pathname, '/')) == NULL)
|
||||
{ printf ("\nError : bad pathname %s\n", filepath) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
strncpy (db->filename, cptr + 1, sizeof (db->filename)) ;
|
||||
snprintf (db->filename, sizeof (db->filename), "%s", cptr + 1) ;
|
||||
} /* get filename_pathname */
|
||||
|
||||
static void
|
||||
|
@ -443,9 +445,9 @@ static int
|
|||
count_callback (REGTEST_DB * db, int argc, char **argv, char **colname)
|
||||
{ db->count ++ ;
|
||||
|
||||
argc = 0 ;
|
||||
argv = NULL ;
|
||||
colname = NULL ;
|
||||
(void) argc ;
|
||||
(void) argv ;
|
||||
(void) colname ;
|
||||
return 0 ;
|
||||
} /* count_callback */
|
||||
|
||||
|
@ -453,8 +455,8 @@ static int
|
|||
ekey_max_callback (REGTEST_DB * db, int argc, char **argv, char **unused)
|
||||
{ int ekey ;
|
||||
|
||||
argc = 0 ;
|
||||
unused = NULL ;
|
||||
(void) argc ;
|
||||
(void) unused ;
|
||||
|
||||
ekey = strtol (argv [0], NULL, 10) ;
|
||||
if (ekey > db->ekey_max)
|
||||
|
@ -467,7 +469,7 @@ static int
|
|||
callback (void *unused, int argc, char **argv, char **colname)
|
||||
{ int k ;
|
||||
|
||||
unused = NULL ;
|
||||
(void) unused ;
|
||||
|
||||
for (k = 0 ; k < argc ; k++)
|
||||
printf ("%s = %s\n", colname [k], argv [k] ? argv [k] : "NULL") ;
|
||||
|
@ -491,12 +493,3 @@ dummy (void)
|
|||
} /* dummy */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The following line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: c6bcb7cb-0d9e-47b6-a89a-66304df4d462
|
||||
*/
|
||||
|
|
|
@ -36,10 +36,3 @@ int db_del_entry (REG_DB * db_handle, const char * entry) ;
|
|||
/* In checksum.c */
|
||||
int calc_checksum (SNDFILE * file, const SF_INFO * info) ;
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The following line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 80138e38-f373-48d3-8152-7f7882a62cd7
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2005 Erik de Castro Lopo
|
||||
** Copyright (C) 2005-2009 Erik de Castro Lopo
|
||||
**
|
||||
** 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
|
||||
|
@ -119,10 +119,3 @@ main (void)
|
|||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The following line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 7f318f08-9bfa-4249-856d-fe994819bdce
|
||||
*/
|
||||
|
|
|
@ -14,15 +14,9 @@ libg72x_la_SOURCES = $(CFILES) $(noinst_HEADERS)
|
|||
g72x_test_SOURCES = g72x_test.c
|
||||
g72x_test_LDADD = ./libg72x.la -lm
|
||||
|
||||
check: g72x_test
|
||||
./g72x_test all
|
||||
check: g72x_test$(EXEEXT)
|
||||
./g72x_test$(EXEEXT) all
|
||||
|
||||
# Disable autoheader.
|
||||
AUTOHEADER=echo
|
||||
|
||||
## Do not edit or modify anything in this comment block.
|
||||
## The arch-tag line is a file identity tag for the GNU Arch
|
||||
## revision control system.
|
||||
##
|
||||
## arch-tag: d417a8e8-da7f-423d-884d-f03c93379348
|
||||
|
||||
|
|
|
@ -152,11 +152,4 @@ g721_decoder(
|
|||
/* sr was 14-bit dynamic range */
|
||||
return (sr << 2);
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 101b6e25-457d-490a-99ae-e2e74a26ea24
|
||||
*/
|
||||
|
||||
|
|
|
@ -159,11 +159,4 @@ g723_16_decoder(
|
|||
/* sr was of 14-bit dynamic range */
|
||||
return (sr << 2);
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: ae265466-c3fc-4f83-bb32-edae488a5ca5
|
||||
*/
|
||||
|
||||
|
|
|
@ -136,11 +136,4 @@ g723_24_decoder(
|
|||
|
||||
return (sr << 2); /* sr was of 14-bit dynamic range */
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 75389236-650b-4427-98f3-0df6e8fb24bc
|
||||
*/
|
||||
|
||||
|
|
|
@ -150,11 +150,4 @@ int g723_40_decoder (int i, G72x_STATE *state_ptr)
|
|||
|
||||
return (sr << 2); /* sr was of 14-bit dynamic range */
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: eb8d9a00-32bf-4dd2-b287-01b0336d72bf
|
||||
*/
|
||||
|
||||
|
|
|
@ -87,12 +87,12 @@ int fmult (int an, int srn)
|
|||
|
||||
/*
|
||||
** The original was :
|
||||
** wanmant = (anmant * (srn & 0x37) + 0x30) >> 4 ;
|
||||
** wanmant = (anmant * (srn & 0x3F) + 0x30) >> 4 ;
|
||||
** but could see no valid reason for the + 0x30.
|
||||
** Removed it and it improved the SNR of the codec.
|
||||
*/
|
||||
|
||||
wanmant = (anmant * (srn & 0x37)) >> 4 ;
|
||||
wanmant = (anmant * (srn & 0x3F)) >> 4 ;
|
||||
|
||||
retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) :
|
||||
(wanmant >> -wanexp);
|
||||
|
@ -642,11 +642,3 @@ pack_bytes (int bits, const short * samples, unsigned char * block)
|
|||
return bindex ;
|
||||
} /* pack_bytes */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 6298dc75-fd0f-4062-9b90-f73ed69f22d4
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -89,11 +89,3 @@ int g72x_encode_block (struct g72x_state *pstate, short *samples, unsigned char
|
|||
|
||||
#endif /* !G72X_HEADER_FILE */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621
|
||||
*/
|
||||
|
||||
|
|
|
@ -107,12 +107,3 @@ int g723_40_decoder (int code, G72x_STATE *state_ptr);
|
|||
void private_init_state (G72x_STATE *state_ptr) ;
|
||||
|
||||
#endif /* G72X_PRIVATE_H */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
|
@ -212,11 +212,3 @@ oct_save_short (short *a, short *b, int len)
|
|||
return 0 ;
|
||||
} /* oct_save_short */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 0597b442-a5b0-4abf-92a4-92f6c24e85a6
|
||||
*/
|
||||
|
||||
|
|
|
@ -13,9 +13,4 @@ libgsm_la_SOURCES = $(CFILES) $(noinst_HEADERS)
|
|||
# Disable autoheader.
|
||||
AUTOHEADER=echo
|
||||
|
||||
## Do not edit or modify anything in this comment block.
|
||||
## The arch-tag line is a file identity tag for the GNU Arch
|
||||
## revision control system.
|
||||
##
|
||||
## arch-tag: ba91ffbe-9d1d-4044-a1de-e8ee2f890560
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "gsm610_priv.h"
|
||||
#include "gsm.h"
|
||||
|
||||
#define saturate(x) \
|
||||
((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
|
||||
|
@ -238,11 +237,4 @@ word gsm_div (word num, word denum)
|
|||
|
||||
return div;
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: a7398579-e2e1-4733-aa2d-4c6efc0c58ff
|
||||
*/
|
||||
|
||||
|
|
|
@ -8,10 +8,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gsm610_priv.h"
|
||||
#include "gsm.h"
|
||||
|
||||
/*
|
||||
* 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER
|
||||
|
@ -73,7 +70,7 @@ void Gsm_Coder (
|
|||
xmaxc++, Mc++, xMc );
|
||||
/*
|
||||
* Gsm_Update_of_reconstructed_short_time_residual_signal
|
||||
* ( dpp, e + 5, dp );
|
||||
* ( dpp, State->e + 5, dp );
|
||||
*/
|
||||
|
||||
{ register int i;
|
||||
|
@ -87,11 +84,4 @@ void Gsm_Coder (
|
|||
(void)memcpy( (char *)State->dp0, (char *)(State->dp0 + 160),
|
||||
120 * sizeof(*State->dp0) );
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: ae8ef1b2-5a1e-4263-94cd-42b15dca81a3
|
||||
*/
|
||||
|
||||
|
|
|
@ -23,11 +23,4 @@
|
|||
#define HAS_UTIME_H 1 /* UTIME header file */
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 5338dfef-8e59-4f51-af47-627c9ea85353
|
||||
*/
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "gsm610_priv.h"
|
||||
#include "gsm.h"
|
||||
|
||||
/*
|
||||
* 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
|
||||
|
@ -57,11 +56,4 @@ void Gsm_Decoder (
|
|||
Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
|
||||
Postprocessing(S, s);
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 11ae5b90-2e8b-400b-ac64-a69a1fc6cc41
|
||||
*/
|
||||
|
||||
|
|
|
@ -48,11 +48,5 @@ int gsm_explode (gsm, gsm_byte *, gsm_signal *);
|
|||
void gsm_implode (gsm, gsm_signal *, gsm_byte *);
|
||||
|
||||
#endif /* GSM_H */
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 8cfc7698-5433-4b6f-aeca-967c6fda4dec
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -298,11 +298,4 @@ extern word gsm_FAC [8] ;
|
|||
#endif /* !NDEBUG */
|
||||
|
||||
#endif /* PRIVATE_H */
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 8bc5fdf2-e8c8-4686-9bd7-a30b512bef0c
|
||||
*/
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue