Update libsndfile to 1.0.15
parent
4586d7f241
commit
e91218f14f
|
@ -1,8 +1,8 @@
|
|||
# Makefile.in generated by automake 1.7.9 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
@ -14,6 +14,8 @@
|
|||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
@ -21,7 +23,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
|
|||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
|
@ -35,7 +36,48 @@ POST_INSTALL = :
|
|||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
noinst_PROGRAMS = g72x_test$(EXEEXT)
|
||||
subdir = src/G72x
|
||||
DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in ChangeLog
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libg72x_la_LIBADD =
|
||||
am__objects_1 = g72x.lo g721.lo g723_16.lo g723_24.lo g723_40.lo
|
||||
am__objects_2 =
|
||||
am_libg72x_la_OBJECTS = $(am__objects_1) $(am__objects_2)
|
||||
libg72x_la_OBJECTS = $(am_libg72x_la_OBJECTS)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
am_g72x_test_OBJECTS = g72x_test.$(OBJEXT)
|
||||
g72x_test_OBJECTS = $(am_g72x_test_OBJECTS)
|
||||
g72x_test_DEPENDENCIES = ./libg72x.la
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libg72x_la_SOURCES) $(g72x_test_SOURCES)
|
||||
DIST_SOURCES = $(libg72x_la_SOURCES) $(g72x_test_SOURCES)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
|
@ -70,6 +112,7 @@ ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
|
|||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
FLAC_LIBS = @FLAC_LIBS@
|
||||
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
|
||||
GETCONF = @GETCONF@
|
||||
HTML_BGCOLOUR = @HTML_BGCOLOUR@
|
||||
|
@ -96,6 +139,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
|||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SF_COUNT_MAX = @SF_COUNT_MAX@
|
||||
|
@ -103,6 +147,8 @@ 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@
|
||||
|
@ -113,6 +159,7 @@ ac_ct_F77 = @ac_ct_F77@
|
|||
ac_ct_GETCONF = @ac_ct_GETCONF@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
|
@ -120,6 +167,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
|||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
autogen = @autogen@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
|
@ -142,6 +191,7 @@ libdir = @libdir@
|
|||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
|
@ -153,76 +203,52 @@ target_alias = @target_alias@
|
|||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
|
||||
EXTRA_DIST = README README.original ChangeLog
|
||||
|
||||
noinst_HEADERS = g72x.h g72x_priv.h
|
||||
noinst_LTLIBRARIES = libg72x.la
|
||||
|
||||
noinst_PROGRAMS = g72x_test
|
||||
|
||||
CFILES = g72x.c g721.c g723_16.c g723_24.c g723_40.c
|
||||
|
||||
libg72x_la_SOURCES = $(CFILES) $(noinst_HEADERS)
|
||||
|
||||
g72x_test_SOURCES = g72x_test.c
|
||||
g72x_test_LDADD = ./libg72x.la -lm
|
||||
subdir = src/G72x
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
|
||||
libg72x_la_LDFLAGS =
|
||||
libg72x_la_LIBADD =
|
||||
am__objects_1 = g72x.lo g721.lo g723_16.lo g723_24.lo g723_40.lo
|
||||
am__objects_2 =
|
||||
am_libg72x_la_OBJECTS = $(am__objects_1) $(am__objects_2)
|
||||
libg72x_la_OBJECTS = $(am_libg72x_la_OBJECTS)
|
||||
noinst_PROGRAMS = g72x_test$(EXEEXT)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
|
||||
am_g72x_test_OBJECTS = g72x_test.$(OBJEXT)
|
||||
g72x_test_OBJECTS = $(am_g72x_test_OBJECTS)
|
||||
g72x_test_DEPENDENCIES = ./libg72x.la
|
||||
g72x_test_LDFLAGS =
|
||||
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/g721.Plo ./$(DEPDIR)/g723_16.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/g723_24.Plo ./$(DEPDIR)/g723_40.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/g72x.Plo ./$(DEPDIR)/g72x_test.Po
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
|
||||
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_SOURCES = $(libg72x_la_SOURCES) $(g72x_test_SOURCES)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in ChangeLog \
|
||||
Makefile.am
|
||||
SOURCES = $(libg72x_la_SOURCES) $(g72x_test_SOURCES)
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/G72x/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/G72x/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
|
||||
.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
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" = "$$p" && dir=.; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
|
@ -240,7 +266,7 @@ g72x_test$(EXEEXT): $(g72x_test_OBJECTS) $(g72x_test_DEPENDENCIES)
|
|||
$(LINK) $(g72x_test_LDFLAGS) $(g72x_test_OBJECTS) $(g72x_test_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT) core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
@ -253,37 +279,25 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g72x_test.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCC_TRUE@ fi
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCC_TRUE@ fi
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
|
||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCC_TRUE@ fi
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
@ -295,14 +309,6 @@ distclean-libtool:
|
|||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
|
@ -311,6 +317,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
|
@ -322,10 +329,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
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)
|
||||
|
@ -348,10 +356,6 @@ GTAGS:
|
|||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ../..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
|
@ -365,7 +369,7 @@ distdir: $(DISTFILES)
|
|||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
|
@ -383,7 +387,6 @@ distdir: $(DISTFILES)
|
|||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
|
||||
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
|
@ -404,7 +407,7 @@ mostlyclean-generic:
|
|||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
|
@ -424,6 +427,8 @@ dvi: dvi-am
|
|||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
@ -461,14 +466,14 @@ uninstall-am: uninstall-info-am
|
|||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \
|
||||
ctags distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am info \
|
||||
info-am install install-am install-data install-data-am \
|
||||
install-exec install-exec-am install-info install-info-am \
|
||||
install-man 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-info-am
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man 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-info-am
|
||||
|
||||
|
||||
check: g72x_test
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* Common routines for G.721 and G.723 conversions.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -37,8 +37,12 @@
|
|||
#include "g72x.h"
|
||||
#include "g72x_priv.h"
|
||||
|
||||
static
|
||||
short power2 [15] =
|
||||
static G72x_STATE * g72x_state_new (void) ;
|
||||
static int unpack_bytes (int bits, int blocksize, const unsigned char * block, short * samples) ;
|
||||
static int pack_bytes (int bits, const short * samples, unsigned char * block) ;
|
||||
|
||||
static
|
||||
short power2 [15] =
|
||||
{ 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80,
|
||||
0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000
|
||||
} ;
|
||||
|
@ -51,7 +55,7 @@ short power2 [15] =
|
|||
*
|
||||
* Using linear search for simple coding.
|
||||
*/
|
||||
static
|
||||
static
|
||||
int quan (int val, short *table, int size)
|
||||
{
|
||||
int i;
|
||||
|
@ -68,7 +72,7 @@ int quan (int val, short *table, int size)
|
|||
* returns the integer product of the 14-bit integer "an" and
|
||||
* "floating point" representation (4-bit exponent, 6-bit mantessa) "srn".
|
||||
*/
|
||||
static
|
||||
static
|
||||
int fmult (int an, int srn)
|
||||
{
|
||||
short anmag, anexp, anmant;
|
||||
|
@ -89,13 +93,17 @@ int fmult (int an, int srn)
|
|||
*/
|
||||
|
||||
wanmant = (anmant * (srn & 0x37)) >> 4 ;
|
||||
|
||||
|
||||
retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) :
|
||||
(wanmant >> -wanexp);
|
||||
|
||||
return (((an ^ srn) < 0) ? -retval : retval);
|
||||
}
|
||||
|
||||
static G72x_STATE * g72x_state_new (void)
|
||||
{ return calloc (1, sizeof (G72x_STATE)) ;
|
||||
}
|
||||
|
||||
/*
|
||||
* private_init_state()
|
||||
*
|
||||
|
@ -124,171 +132,134 @@ void private_init_state (G72x_STATE *state_ptr)
|
|||
state_ptr->td = 0;
|
||||
} /* private_init_state */
|
||||
|
||||
int g72x_reader_init (G72x_DATA *data, int codec)
|
||||
struct g72x_state * g72x_reader_init (int codec, int *blocksize, int *samplesperblock)
|
||||
{ G72x_STATE *pstate ;
|
||||
|
||||
if (sizeof (data->private) < sizeof (G72x_STATE))
|
||||
{ /* This is for safety only. */
|
||||
return 1 ;
|
||||
} ;
|
||||
if ((pstate = g72x_state_new ()) == NULL)
|
||||
return NULL ;
|
||||
|
||||
memset (data, 0, sizeof (G72x_DATA)) ;
|
||||
|
||||
pstate = (G72x_STATE*) data->private ;
|
||||
private_init_state (pstate) ;
|
||||
|
||||
|
||||
pstate->encoder = NULL ;
|
||||
|
||||
|
||||
switch (codec)
|
||||
{ case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */
|
||||
pstate->decoder = g723_16_decoder ;
|
||||
data->blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
data->samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
*blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 2 ;
|
||||
pstate->blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
|
||||
|
||||
case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
|
||||
pstate->decoder = g723_24_decoder ;
|
||||
data->blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
data->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
*blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 3 ;
|
||||
pstate->blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
|
||||
case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */
|
||||
pstate->decoder = g721_decoder ;
|
||||
data->blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
data->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
*blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 4 ;
|
||||
pstate->blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
|
||||
case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */
|
||||
pstate->decoder = g723_40_decoder ;
|
||||
data->blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
data->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
*blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 5 ;
|
||||
pstate->blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
default : return 1 ;
|
||||
|
||||
default :
|
||||
free (pstate) ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
return pstate ;
|
||||
} /* g72x_reader_init */
|
||||
|
||||
int g72x_writer_init (G72x_DATA *data, int codec)
|
||||
struct g72x_state * g72x_writer_init (int codec, int *blocksize, int *samplesperblock)
|
||||
{ G72x_STATE *pstate ;
|
||||
|
||||
if (sizeof (data->private) < sizeof (G72x_STATE))
|
||||
{ /* This is for safety only. Gets optimised out. */
|
||||
return 1 ;
|
||||
} ;
|
||||
if ((pstate = g72x_state_new ()) == NULL)
|
||||
return NULL ;
|
||||
|
||||
memset (data, 0, sizeof (G72x_DATA)) ;
|
||||
|
||||
pstate = (G72x_STATE*) data->private ;
|
||||
private_init_state (pstate) ;
|
||||
|
||||
pstate->decoder = NULL ;
|
||||
|
||||
|
||||
switch (codec)
|
||||
{ case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */
|
||||
pstate->encoder = g723_16_encoder ;
|
||||
data->blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
data->samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
*blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 2 ;
|
||||
pstate->blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
|
||||
|
||||
case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
|
||||
pstate->encoder = g723_24_encoder ;
|
||||
data->blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
data->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
*blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 3 ;
|
||||
pstate->blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
|
||||
case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */
|
||||
pstate->encoder = g721_encoder ;
|
||||
data->blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
data->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
*blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 4 ;
|
||||
pstate->blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
|
||||
case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */
|
||||
pstate->encoder = g723_40_encoder ;
|
||||
data->blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
data->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
*blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 5 ;
|
||||
pstate->blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
default : return 1 ;
|
||||
|
||||
default :
|
||||
free (pstate) ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
return pstate ;
|
||||
} /* g72x_writer_init */
|
||||
|
||||
int unpack_bytes (G72x_DATA *data, int bits)
|
||||
{ unsigned int in_buffer = 0 ;
|
||||
unsigned char in_byte ;
|
||||
int k, in_bits = 0, bindex = 0 ;
|
||||
|
||||
for (k = 0 ; bindex <= data->blocksize && k < G72x_BLOCK_SIZE ; k++)
|
||||
{ if (in_bits < bits)
|
||||
{ in_byte = data->block [bindex++] ;
|
||||
int g72x_decode_block (G72x_STATE *pstate, const unsigned char *block, short *samples)
|
||||
{ int k, count ;
|
||||
|
||||
in_buffer |= (in_byte << in_bits);
|
||||
in_bits += 8;
|
||||
}
|
||||
data->samples [k] = in_buffer & ((1 << bits) - 1);
|
||||
in_buffer >>= bits;
|
||||
in_bits -= bits;
|
||||
} ;
|
||||
|
||||
return k ;
|
||||
} /* unpack_bytes */
|
||||
count = unpack_bytes (pstate->codec_bits, pstate->blocksize, block, samples) ;
|
||||
|
||||
int g72x_decode_block (G72x_DATA *data)
|
||||
{ G72x_STATE *pstate ;
|
||||
int k, count ;
|
||||
|
||||
pstate = (G72x_STATE*) data->private ;
|
||||
|
||||
count = unpack_bytes (data, pstate->codec_bits) ;
|
||||
|
||||
for (k = 0 ; k < count ; k++)
|
||||
data->samples [k] = pstate->decoder (data->samples [k], pstate) ;
|
||||
|
||||
samples [k] = pstate->decoder (samples [k], pstate) ;
|
||||
|
||||
return 0 ;
|
||||
} /* g72x_decode_block */
|
||||
|
||||
int pack_bytes (G72x_DATA *data, int bits)
|
||||
{
|
||||
unsigned int out_buffer = 0 ;
|
||||
int k, bindex = 0, out_bits = 0 ;
|
||||
unsigned char out_byte ;
|
||||
int g72x_encode_block (G72x_STATE *pstate, short *samples, unsigned char *block)
|
||||
{ int k, count ;
|
||||
|
||||
for (k = 0 ; k < G72x_BLOCK_SIZE ; k++)
|
||||
{ out_buffer |= (data->samples [k] << out_bits) ;
|
||||
out_bits += bits ;
|
||||
if (out_bits >= 8)
|
||||
{ out_byte = out_buffer & 0xFF ;
|
||||
out_bits -= 8 ;
|
||||
out_buffer >>= 8 ;
|
||||
data->block [bindex++] = out_byte ;
|
||||
}
|
||||
} ;
|
||||
for (k = 0 ; k < pstate->samplesperblock ; k++)
|
||||
samples [k] = pstate->encoder (samples [k], pstate) ;
|
||||
|
||||
return bindex ;
|
||||
} /* pack_bytes */
|
||||
count = pack_bytes (pstate->codec_bits, samples, block) ;
|
||||
|
||||
int g72x_encode_block (G72x_DATA *data)
|
||||
{ G72x_STATE *pstate ;
|
||||
int k, count ;
|
||||
|
||||
pstate = (G72x_STATE*) data->private ;
|
||||
|
||||
for (k = 0 ; k < data->samplesperblock ; k++)
|
||||
data->samples [k] = pstate->encoder (data->samples [k], pstate) ;
|
||||
|
||||
count = pack_bytes (data, pstate->codec_bits) ;
|
||||
|
||||
return count ;
|
||||
} /* g72x_encode_block */
|
||||
|
||||
|
@ -622,13 +593,58 @@ update(
|
|||
state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
|
||||
else
|
||||
state_ptr->ap += (-state_ptr->ap) >> 4;
|
||||
|
||||
|
||||
return ;
|
||||
} /* update */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
unpack_bytes (int bits, int blocksize, const unsigned char * block, short * samples)
|
||||
{ unsigned int in_buffer = 0 ;
|
||||
unsigned char in_byte ;
|
||||
int k, in_bits = 0, bindex = 0 ;
|
||||
|
||||
for (k = 0 ; bindex <= blocksize && k < G72x_BLOCK_SIZE ; k++)
|
||||
{ if (in_bits < bits)
|
||||
{ in_byte = block [bindex++] ;
|
||||
|
||||
in_buffer |= (in_byte << in_bits);
|
||||
in_bits += 8;
|
||||
}
|
||||
samples [k] = in_buffer & ((1 << bits) - 1);
|
||||
in_buffer >>= bits;
|
||||
in_bits -= bits;
|
||||
} ;
|
||||
|
||||
return k ;
|
||||
} /* unpack_bytes */
|
||||
|
||||
static int
|
||||
pack_bytes (int bits, const short * samples, unsigned char * block)
|
||||
{
|
||||
unsigned int out_buffer = 0 ;
|
||||
int k, bindex = 0, out_bits = 0 ;
|
||||
unsigned char out_byte ;
|
||||
|
||||
for (k = 0 ; k < G72x_BLOCK_SIZE ; k++)
|
||||
{ out_buffer |= (samples [k] << out_bits) ;
|
||||
out_bits += bits ;
|
||||
if (out_bits >= 8)
|
||||
{ out_byte = out_buffer & 0xFF ;
|
||||
out_bits -= 8 ;
|
||||
out_buffer >>= 8 ;
|
||||
block [bindex++] = out_byte ;
|
||||
}
|
||||
} ;
|
||||
|
||||
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
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 6298dc75-fd0f-4062-9b90-f73ed69f22d4
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2001 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** Copyright (C) 1999-2005 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
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This file is not the same as the original file from Sun Microsystems. Nearly
|
||||
** all the original definitions and function prototypes that were in the file
|
||||
** of this name have been moved to private.h.
|
||||
*/
|
||||
** all the original definitions and function prototypes that were in the file
|
||||
** of this name have been moved to g72x_priv.h.
|
||||
*/
|
||||
|
||||
#ifndef G72X_HEADER_FILE
|
||||
#define G72X_HEADER_FILE
|
||||
|
||||
/*
|
||||
** Number of samples per block to process.
|
||||
/*
|
||||
** Number of samples per block to process.
|
||||
** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.
|
||||
*/
|
||||
#define G72x_BLOCK_SIZE (3*5*8)
|
||||
#define G72x_BLOCK_SIZE (3 * 5 * 8)
|
||||
|
||||
/*
|
||||
/*
|
||||
** Identifiers for the differing kinds of G72x ADPCM codecs.
|
||||
** The identifiers also define the number of encoded bits per sample.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ G723_16_BITS_PER_SAMPLE = 2,
|
||||
G723_24_BITS_PER_SAMPLE = 3,
|
||||
G723_40_BITS_PER_SAMPLE = 5,
|
||||
G723_24_BITS_PER_SAMPLE = 3,
|
||||
G723_40_BITS_PER_SAMPLE = 5,
|
||||
|
||||
G721_32_BITS_PER_SAMPLE = 4,
|
||||
G721_40_BITS_PER_SAMPLE = 5,
|
||||
|
||||
G723_16_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
|
||||
G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE),
|
||||
G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE),
|
||||
G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE),
|
||||
G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE),
|
||||
|
||||
G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
|
||||
G721_40_SAMPLES_PER_BLOCK = G721_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G721_40_BITS_PER_SAMPLE),
|
||||
|
@ -57,59 +57,41 @@ enum
|
|||
|
||||
G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
|
||||
G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8
|
||||
} ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
** This is the public structure for passing data between the caller and
|
||||
** the G72x encoder and decoder.
|
||||
** The private array is used by the encoder and decoder for internal
|
||||
** state information and should not be changed in any way by the caller.
|
||||
** When decoding or encoding a stream, the same instance of this struct
|
||||
** should be used for every call so that the decoder/encoder keeps the
|
||||
** correct state data between calls.
|
||||
*/
|
||||
/* Forward declaration of of g72x_state. */
|
||||
|
||||
typedef struct
|
||||
{ /* Private data. Don't mess with it. */
|
||||
unsigned long private [256 / sizeof (long)] ;
|
||||
|
||||
/* Public data. Read only. */
|
||||
int blocksize, max_bytes, samplesperblock, bytesperblock ;
|
||||
|
||||
/* Public data. Read and write. */
|
||||
int blocks, blockcount, samplecount ;
|
||||
unsigned char block [G72x_BLOCK_SIZE] ;
|
||||
short samples [G72x_BLOCK_SIZE] ;
|
||||
} G72x_DATA ;
|
||||
struct g72x_state ;
|
||||
|
||||
/* External function definitions. */
|
||||
|
||||
int g72x_reader_init (G72x_DATA *data, int codec) ;
|
||||
int g72x_writer_init (G72x_DATA *data, int codec) ;
|
||||
struct g72x_state * g72x_reader_init (int codec, int *blocksize, int *samplesperblock) ;
|
||||
struct g72x_state * g72x_writer_init (int codec, int *blocksize, int *samplesperblock) ;
|
||||
/*
|
||||
** Initialize the ADPCM state table for the given codec.
|
||||
** Return 0 on success, 1 on fail.
|
||||
*/
|
||||
|
||||
int g72x_decode_block (G72x_DATA *data) ;
|
||||
int g72x_decode_block (struct g72x_state *pstate, const unsigned char *block, short *samples) ;
|
||||
/*
|
||||
** The caller fills data->block with data->bytes bytes before calling the
|
||||
** function. The value data->bytes must be an integer multiple of
|
||||
** The caller fills data->block with data->bytes bytes before calling the
|
||||
** function. The value data->bytes must be an integer multiple of
|
||||
** data->blocksize and be <= data->max_bytes.
|
||||
** When it returns, the caller can read out data->samples samples.
|
||||
*/
|
||||
** When it returns, the caller can read out data->samples samples.
|
||||
*/
|
||||
|
||||
int g72x_encode_block (G72x_DATA *data) ;
|
||||
/*
|
||||
int g72x_encode_block (struct g72x_state *pstate, short *samples, unsigned char *block) ;
|
||||
/*
|
||||
** The caller fills state->samples some integer multiple data->samples_per_block
|
||||
** (up to G72x_BLOCK_SIZE) samples before calling the function.
|
||||
** When it returns, the caller can read out bytes encoded bytes.
|
||||
** When it returns, the caller can read out bytes encoded bytes.
|
||||
*/
|
||||
|
||||
#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
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621
|
||||
|
|
|
@ -27,18 +27,21 @@
|
|||
#ifndef G72X_PRIVATE_H
|
||||
#define G72X_PRIVATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#error "This code is not designed to be compiled with a C++ compiler."
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The following is the definition of the state structure used by the
|
||||
** G.721/G.723 encoder and decoder to preserve their internal state
|
||||
** between successive calls. The meanings of the majority of the state
|
||||
** structure fields are explained in detail in the CCITT Recommendation
|
||||
** G.721. The field names are essentially identical to variable names
|
||||
** in the bit level description of the coding algorithm included in this
|
||||
** between successive calls. The meanings of the majority of the state
|
||||
** structure fields are explained in detail in the CCITT Recommendation
|
||||
** G.721. The field names are essentially identical to variable names
|
||||
** in the bit level description of the coding algorithm included in this
|
||||
** Recommendation.
|
||||
*/
|
||||
|
||||
typedef struct private_g72x
|
||||
struct g72x_state
|
||||
{ long yl; /* Locked or steady state step size multiplier. */
|
||||
short yu; /* Unlocked or non-steady state step size multiplier. */
|
||||
short dms; /* Short term energy estimate. */
|
||||
|
@ -62,22 +65,20 @@ typedef struct private_g72x
|
|||
** format.
|
||||
*/
|
||||
char td; /* delayed tone detect, new in 1988 version */
|
||||
|
||||
/* The following struct members were added for libsndfile. The original
|
||||
** code worked by calling a set of functions on a sample by sample basis
|
||||
** which is slow on architectures like Intel x86. For libsndfile, this
|
||||
|
||||
/* The following struct members were added for libsndfile. The original
|
||||
** code worked by calling a set of functions on a sample by sample basis
|
||||
** which is slow on architectures like Intel x86. For libsndfile, this
|
||||
** was changed so that the encoding and decoding routines could work on
|
||||
** a block of samples at a time to reduce the function call overhead.
|
||||
*/
|
||||
int (*encoder) (int, struct private_g72x* state) ;
|
||||
int (*decoder) (int, struct private_g72x* state) ;
|
||||
|
||||
int codec_bits ;
|
||||
int byte_index, sample_index ;
|
||||
|
||||
} G72x_STATE ;
|
||||
int (*encoder) (int, struct g72x_state* state) ;
|
||||
int (*decoder) (int, struct g72x_state* state) ;
|
||||
|
||||
int codec_bits, blocksize, samplesperblock ;
|
||||
} ;
|
||||
|
||||
typedef struct g72x_state G72x_STATE ;
|
||||
|
||||
int predictor_zero (G72x_STATE *state_ptr);
|
||||
|
||||
|
@ -103,15 +104,13 @@ int g723_24_decoder (int code, G72x_STATE *state_ptr);
|
|||
int g723_40_encoder (int sample, G72x_STATE *state_ptr);
|
||||
int g723_40_decoder (int code, G72x_STATE *state_ptr);
|
||||
|
||||
int unpack_bytes (G72x_DATA *data, int bits) ;
|
||||
int pack_bytes (G72x_DATA *data, int bits) ;
|
||||
|
||||
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
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Makefile.in generated by automake 1.7.9 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
@ -14,6 +14,7 @@
|
|||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
@ -21,7 +22,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
|
|||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
|
@ -35,7 +35,45 @@ POST_INSTALL = :
|
|||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = src/GSM610
|
||||
DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in ChangeLog
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libgsm_la_LIBADD =
|
||||
am__objects_1 = add.lo decode.lo gsm_decode.lo gsm_encode.lo \
|
||||
long_term.lo preprocess.lo short_term.lo code.lo gsm_create.lo \
|
||||
gsm_destroy.lo gsm_option.lo lpc.lo rpe.lo table.lo
|
||||
am__objects_2 =
|
||||
am_libgsm_la_OBJECTS = $(am__objects_1) $(am__objects_2)
|
||||
libgsm_la_OBJECTS = $(am_libgsm_la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libgsm_la_SOURCES)
|
||||
DIST_SOURCES = $(libgsm_la_SOURCES)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
|
@ -70,6 +108,7 @@ ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
|
|||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
FLAC_LIBS = @FLAC_LIBS@
|
||||
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
|
||||
GETCONF = @GETCONF@
|
||||
HTML_BGCOLOUR = @HTML_BGCOLOUR@
|
||||
|
@ -96,6 +135,7 @@ PACKAGE_STRING = @PACKAGE_STRING@
|
|||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SF_COUNT_MAX = @SF_COUNT_MAX@
|
||||
|
@ -103,6 +143,8 @@ 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@
|
||||
|
@ -113,6 +155,7 @@ ac_ct_F77 = @ac_ct_F77@
|
|||
ac_ct_GETCONF = @ac_ct_GETCONF@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
|
@ -120,6 +163,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
|||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
autogen = @autogen@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
|
@ -142,6 +187,7 @@ libdir = @libdir@
|
|||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
|
@ -153,74 +199,52 @@ target_alias = @target_alias@
|
|||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
|
||||
EXTRA_DIST = README COPYRIGHT ChangeLog
|
||||
|
||||
noinst_HEADERS = gsm.h config.h gsm610_priv.h
|
||||
noinst_LTLIBRARIES = libgsm.la
|
||||
|
||||
CFILES = add.c decode.c gsm_decode.c gsm_encode.c long_term.c preprocess.c \
|
||||
short_term.c code.c gsm_create.c gsm_destroy.c gsm_option.c lpc.c rpe.c table.c
|
||||
|
||||
|
||||
libgsm_la_SOURCES = $(CFILES) $(noinst_HEADERS)
|
||||
subdir = src/GSM610
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
|
||||
libgsm_la_LDFLAGS =
|
||||
libgsm_la_LIBADD =
|
||||
am__objects_1 = add.lo decode.lo gsm_decode.lo gsm_encode.lo \
|
||||
long_term.lo preprocess.lo short_term.lo code.lo gsm_create.lo \
|
||||
gsm_destroy.lo gsm_option.lo lpc.lo rpe.lo table.lo
|
||||
am__objects_2 =
|
||||
am_libgsm_la_OBJECTS = $(am__objects_1) $(am__objects_2)
|
||||
libgsm_la_OBJECTS = $(am_libgsm_la_OBJECTS)
|
||||
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/add.Plo ./$(DEPDIR)/code.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/decode.Plo ./$(DEPDIR)/gsm_create.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/gsm_decode.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/gsm_destroy.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/gsm_encode.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/gsm_option.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/long_term.Plo ./$(DEPDIR)/lpc.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/preprocess.Plo ./$(DEPDIR)/rpe.Plo \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/short_term.Plo ./$(DEPDIR)/table.Plo
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
|
||||
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_SOURCES = $(libgsm_la_SOURCES)
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in ChangeLog \
|
||||
Makefile.am
|
||||
SOURCES = $(libgsm_la_SOURCES)
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/GSM610/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/GSM610/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
|
||||
.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
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" = "$$p" && dir=.; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
|
@ -228,7 +252,7 @@ libgsm.la: $(libgsm_la_OBJECTS) $(libgsm_la_DEPENDENCIES)
|
|||
$(LINK) $(libgsm_la_LDFLAGS) $(libgsm_la_OBJECTS) $(libgsm_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT) core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
@ -249,37 +273,25 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCC_TRUE@ fi
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCC_TRUE@ fi
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
|
||||
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCC_TRUE@ fi
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
@ -291,14 +303,6 @@ distclean-libtool:
|
|||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
|
@ -307,6 +311,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
|||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
|
@ -318,10 +323,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
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)
|
||||
|
@ -344,10 +350,6 @@ GTAGS:
|
|||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ../..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
|
@ -361,7 +363,7 @@ distdir: $(DISTFILES)
|
|||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
|
@ -379,7 +381,6 @@ distdir: $(DISTFILES)
|
|||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
|
@ -400,7 +401,7 @@ mostlyclean-generic:
|
|||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
|
@ -420,6 +421,8 @@ dvi: dvi-am
|
|||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
@ -457,13 +460,14 @@ uninstall-am: uninstall-info-am
|
|||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am info info-am install \
|
||||
install-am install-data install-data-am install-exec \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
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-info-am
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
uninstall-info-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.
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
/* Added by Erik de Castro Lopo */
|
||||
#define USE_FLOAT_MUL
|
||||
#define FAST
|
||||
#define WAV49
|
||||
#define WAV49
|
||||
|
||||
#ifdef __cplusplus
|
||||
#error "This code is not designed to be compiled with a C++ compiler."
|
||||
#endif
|
||||
/* Added by Erik de Castro Lopo */
|
||||
|
||||
|
||||
|
@ -21,7 +25,7 @@ typedef int longword; /* 32 bit signed int */
|
|||
typedef unsigned short uword; /* unsigned word */
|
||||
typedef unsigned int ulongword; /* unsigned longword */
|
||||
|
||||
struct gsm_state
|
||||
struct gsm_state
|
||||
{ word dp0[ 280 ] ;
|
||||
|
||||
word z1; /* preprocessing.c, Offset_com. */
|
||||
|
@ -93,7 +97,7 @@ longword gsm_L_asr (longword a, int n) ;
|
|||
word gsm_asr (word a, int n) ;
|
||||
|
||||
/*
|
||||
* Inlined functions from add.h
|
||||
* Inlined functions from add.h
|
||||
*/
|
||||
|
||||
static inline longword
|
||||
|
@ -114,17 +118,17 @@ GSM_L_MULT (word a, word b)
|
|||
static inline longword
|
||||
GSM_L_ADD (longword a, longword b)
|
||||
{ ulongword utmp ;
|
||||
|
||||
|
||||
if (a < 0 && b < 0)
|
||||
{ utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1) ;
|
||||
return (utmp >= (ulongword) MAX_LONGWORD) ? MIN_LONGWORD : -(longword)utmp-2 ;
|
||||
} ;
|
||||
|
||||
|
||||
if (a > 0 && b > 0)
|
||||
{ utmp = (ulongword) a + (ulongword) b ;
|
||||
return (utmp >= (ulongword) MAX_LONGWORD) ? MAX_LONGWORD : utmp ;
|
||||
} ;
|
||||
|
||||
|
||||
return a + b ;
|
||||
} /* GSM_L_ADD */
|
||||
|
||||
|
@ -147,12 +151,12 @@ GSM_SUB (word a, word b)
|
|||
{ longword ltmp ;
|
||||
|
||||
ltmp = ((longword) a) - ((longword) b) ;
|
||||
|
||||
|
||||
if (ltmp >= MAX_WORD)
|
||||
ltmp = MAX_WORD ;
|
||||
else if (ltmp <= MIN_WORD)
|
||||
ltmp = MIN_WORD ;
|
||||
|
||||
|
||||
return ltmp ;
|
||||
} /* GSM_SUB */
|
||||
|
||||
|
@ -200,10 +204,10 @@ void Gsm_Preprocess (
|
|||
|
||||
void Gsm_Encoding (
|
||||
struct gsm_state * S,
|
||||
word * e,
|
||||
word * ep,
|
||||
word * e,
|
||||
word * ep,
|
||||
word * xmaxc,
|
||||
word * Mc,
|
||||
word * Mc,
|
||||
word * xMc) ;
|
||||
|
||||
void Gsm_Short_Term_Analysis_Filter (
|
||||
|
@ -296,7 +300,7 @@ extern word gsm_FAC [8] ;
|
|||
#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
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 8bc5fdf2-e8c8-4686-9bd7-a30b512bef0c
|
||||
|
|
|
@ -31,4 +31,6 @@ _sf_strerror
|
|||
_sf_get_string
|
||||
_sf_set_string
|
||||
_sf_open_fd
|
||||
_sf_open_virtual
|
||||
_sf_write_sync
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ libsndfile.so.1.0
|
|||
sf_get_string ;
|
||||
sf_set_string ;
|
||||
sf_open_fd ;
|
||||
sf_open_virtual ;
|
||||
sf_write_sync ;
|
||||
local:
|
||||
* ;
|
||||
} ;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2005 David Viens <davidv@plogue.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
|
||||
|
@ -16,7 +17,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -32,53 +33,53 @@
|
|||
* Macros to handle big/little endian issues.
|
||||
*/
|
||||
|
||||
#define FORM_MARKER (MAKE_MARKER ('F', 'O', 'R', 'M'))
|
||||
#define AIFF_MARKER (MAKE_MARKER ('A', 'I', 'F', 'F'))
|
||||
#define AIFC_MARKER (MAKE_MARKER ('A', 'I', 'F', 'C'))
|
||||
#define COMM_MARKER (MAKE_MARKER ('C', 'O', 'M', 'M'))
|
||||
#define SSND_MARKER (MAKE_MARKER ('S', 'S', 'N', 'D'))
|
||||
#define MARK_MARKER (MAKE_MARKER ('M', 'A', 'R', 'K'))
|
||||
#define INST_MARKER (MAKE_MARKER ('I', 'N', 'S', 'T'))
|
||||
#define APPL_MARKER (MAKE_MARKER ('A', 'P', 'P', 'L'))
|
||||
#define FORM_MARKER (MAKE_MARKER ('F', 'O', 'R', 'M'))
|
||||
#define AIFF_MARKER (MAKE_MARKER ('A', 'I', 'F', 'F'))
|
||||
#define AIFC_MARKER (MAKE_MARKER ('A', 'I', 'F', 'C'))
|
||||
#define COMM_MARKER (MAKE_MARKER ('C', 'O', 'M', 'M'))
|
||||
#define SSND_MARKER (MAKE_MARKER ('S', 'S', 'N', 'D'))
|
||||
#define MARK_MARKER (MAKE_MARKER ('M', 'A', 'R', 'K'))
|
||||
#define INST_MARKER (MAKE_MARKER ('I', 'N', 'S', 'T'))
|
||||
#define APPL_MARKER (MAKE_MARKER ('A', 'P', 'P', 'L'))
|
||||
|
||||
#define c_MARKER (MAKE_MARKER ('(', 'c', ')', ' '))
|
||||
#define NAME_MARKER (MAKE_MARKER ('N', 'A', 'M', 'E'))
|
||||
#define AUTH_MARKER (MAKE_MARKER ('A', 'U', 'T', 'H'))
|
||||
#define ANNO_MARKER (MAKE_MARKER ('A', 'N', 'N', 'O'))
|
||||
#define COMT_MARKER (MAKE_MARKER ('C', 'O', 'M', 'T'))
|
||||
#define FVER_MARKER (MAKE_MARKER ('F', 'V', 'E', 'R'))
|
||||
#define SFX_MARKER (MAKE_MARKER ('S', 'F', 'X', '!'))
|
||||
#define c_MARKER (MAKE_MARKER ('(', 'c', ')', ' '))
|
||||
#define NAME_MARKER (MAKE_MARKER ('N', 'A', 'M', 'E'))
|
||||
#define AUTH_MARKER (MAKE_MARKER ('A', 'U', 'T', 'H'))
|
||||
#define ANNO_MARKER (MAKE_MARKER ('A', 'N', 'N', 'O'))
|
||||
#define COMT_MARKER (MAKE_MARKER ('C', 'O', 'M', 'T'))
|
||||
#define FVER_MARKER (MAKE_MARKER ('F', 'V', 'E', 'R'))
|
||||
#define SFX_MARKER (MAKE_MARKER ('S', 'F', 'X', '!'))
|
||||
|
||||
#define PEAK_MARKER (MAKE_MARKER ('P', 'E', 'A', 'K'))
|
||||
#define basc_MARKER (MAKE_MARKER ('b', 'a', 's', 'c'))
|
||||
#define PEAK_MARKER (MAKE_MARKER ('P', 'E', 'A', 'K'))
|
||||
#define basc_MARKER (MAKE_MARKER ('b', 'a', 's', 'c'))
|
||||
|
||||
/* Supported AIFC encodings.*/
|
||||
#define NONE_MARKER (MAKE_MARKER ('N', 'O', 'N', 'E'))
|
||||
#define sowt_MARKER (MAKE_MARKER ('s', 'o', 'w', 't'))
|
||||
#define twos_MARKER (MAKE_MARKER ('t', 'w', 'o', 's'))
|
||||
#define raw_MARKER (MAKE_MARKER ('r', 'a', 'w', ' '))
|
||||
#define in32_MARKER (MAKE_MARKER ('i', 'n', '3', '2'))
|
||||
#define ni32_MARKER (MAKE_MARKER ('2', '3', 'n', 'i'))
|
||||
#define NONE_MARKER (MAKE_MARKER ('N', 'O', 'N', 'E'))
|
||||
#define sowt_MARKER (MAKE_MARKER ('s', 'o', 'w', 't'))
|
||||
#define twos_MARKER (MAKE_MARKER ('t', 'w', 'o', 's'))
|
||||
#define raw_MARKER (MAKE_MARKER ('r', 'a', 'w', ' '))
|
||||
#define in32_MARKER (MAKE_MARKER ('i', 'n', '3', '2'))
|
||||
#define ni32_MARKER (MAKE_MARKER ('2', '3', 'n', 'i'))
|
||||
|
||||
#define fl32_MARKER (MAKE_MARKER ('f', 'l', '3', '2'))
|
||||
#define FL32_MARKER (MAKE_MARKER ('F', 'L', '3', '2'))
|
||||
#define fl64_MARKER (MAKE_MARKER ('f', 'l', '6', '4'))
|
||||
#define FL64_MARKER (MAKE_MARKER ('F', 'L', '6', '4'))
|
||||
#define fl32_MARKER (MAKE_MARKER ('f', 'l', '3', '2'))
|
||||
#define FL32_MARKER (MAKE_MARKER ('F', 'L', '3', '2'))
|
||||
#define fl64_MARKER (MAKE_MARKER ('f', 'l', '6', '4'))
|
||||
#define FL64_MARKER (MAKE_MARKER ('F', 'L', '6', '4'))
|
||||
|
||||
#define ulaw_MARKER (MAKE_MARKER ('u', 'l', 'a', 'w'))
|
||||
#define ULAW_MARKER (MAKE_MARKER ('U', 'L', 'A', 'W'))
|
||||
#define alaw_MARKER (MAKE_MARKER ('a', 'l', 'a', 'w'))
|
||||
#define ALAW_MARKER (MAKE_MARKER ('A', 'L', 'A', 'W'))
|
||||
#define ulaw_MARKER (MAKE_MARKER ('u', 'l', 'a', 'w'))
|
||||
#define ULAW_MARKER (MAKE_MARKER ('U', 'L', 'A', 'W'))
|
||||
#define alaw_MARKER (MAKE_MARKER ('a', 'l', 'a', 'w'))
|
||||
#define ALAW_MARKER (MAKE_MARKER ('A', 'L', 'A', 'W'))
|
||||
|
||||
#define DWVW_MARKER (MAKE_MARKER ('D', 'W', 'V', 'W'))
|
||||
#define GSM_MARKER (MAKE_MARKER ('G', 'S', 'M', ' '))
|
||||
#define ima4_MARKER (MAKE_MARKER ('i', 'm', 'a', '4'))
|
||||
#define DWVW_MARKER (MAKE_MARKER ('D', 'W', 'V', 'W'))
|
||||
#define GSM_MARKER (MAKE_MARKER ('G', 'S', 'M', ' '))
|
||||
#define ima4_MARKER (MAKE_MARKER ('i', 'm', 'a', '4'))
|
||||
|
||||
/* Unsupported AIFC encodings.*/
|
||||
|
||||
#define MAC3_MARKER (MAKE_MARKER ('M', 'A', 'C', '3'))
|
||||
#define MAC6_MARKER (MAKE_MARKER ('M', 'A', 'C', '6'))
|
||||
#define ADP4_MARKER (MAKE_MARKER ('A', 'D', 'P', '4'))
|
||||
#define MAC3_MARKER (MAKE_MARKER ('M', 'A', 'C', '3'))
|
||||
#define MAC6_MARKER (MAKE_MARKER ('M', 'A', 'C', '6'))
|
||||
#define ADP4_MARKER (MAKE_MARKER ('A', 'D', 'P', '4'))
|
||||
|
||||
/* Predfined chunk sizes. */
|
||||
#define SIZEOF_AIFF_COMM 18
|
||||
|
@ -88,22 +89,22 @@
|
|||
#define SIZEOF_INST_CHUNK 20
|
||||
|
||||
/* Is it constant? */
|
||||
#define SIZEOF_basc_CHUNK 0x54
|
||||
#define SIZEOF_basc_CHUNK_PADDING 66
|
||||
|
||||
/* AIFC/IMA4 defines. */
|
||||
#define AIFC_IMA4_BLOCK_LEN 34
|
||||
#define AIFC_IMA4_SAMPLES_PER_BLOCK 64
|
||||
#define AIFC_IMA4_SAMPLES_PER_BLOCK 64
|
||||
|
||||
#define AIFF_PEAK_CHUNK_SIZE(ch) (2 * sizeof (int) + ch * (sizeof (float) + sizeof (int)))
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Typedefs for file chunks.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ HAVE_FORM = 0x01,
|
||||
HAVE_AIFF = 0x02,
|
||||
HAVE_COMM = 0x04,
|
||||
HAVE_SSND = 0x08
|
||||
{ HAVE_FORM = 0x01,
|
||||
HAVE_AIFF = 0x02,
|
||||
HAVE_COMM = 0x04,
|
||||
HAVE_SSND = 0x08
|
||||
} ;
|
||||
|
||||
typedef struct
|
||||
|
@ -123,7 +124,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{ short playMode ;
|
||||
unsigned short beginLoop ;
|
||||
unsigned short beginLoop ;
|
||||
unsigned short endLoop ;
|
||||
} INST_LOOP ;
|
||||
|
||||
|
@ -144,12 +145,12 @@ enum
|
|||
{ basc_SCALE_MINOR = 1,
|
||||
basc_SCALE_MAJOR,
|
||||
basc_SCALE_NEITHER,
|
||||
basc_SCALE_BOTH,
|
||||
basc_SCALE_BOTH
|
||||
} ;
|
||||
|
||||
enum
|
||||
{ basc_TYPE_LOOP = 0,
|
||||
basc_TYPE_ONE_SHOT,
|
||||
basc_TYPE_ONE_SHOT
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -161,17 +162,21 @@ typedef struct
|
|||
unsigned short sigNumerator ;
|
||||
unsigned short sigDenominator ;
|
||||
unsigned short loopType ;
|
||||
char zero_bytes [SIZEOF_basc_CHUNK_PADDING] ;
|
||||
} basc_CHUNK ;
|
||||
|
||||
typedef struct
|
||||
{ unsigned short markerID ;
|
||||
unsigned int position ;
|
||||
} MARK_ID_POS ;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Private static functions.
|
||||
*/
|
||||
|
||||
static int aiff_close (SF_PRIVATE *psf) ;
|
||||
static int aiff_close (SF_PRIVATE *psf) ;
|
||||
|
||||
static int tenbytefloat2int (unsigned char *bytes) ;
|
||||
static void uint2tenbytefloat (unsigned int num, unsigned char *bytes) ;
|
||||
static void uint2tenbytefloat (unsigned int num, unsigned char *bytes) ;
|
||||
|
||||
static int aiff_read_comm_chunk (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt) ;
|
||||
|
||||
|
@ -179,23 +184,29 @@ static int aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt) ;
|
|||
|
||||
static int aiff_write_header (SF_PRIVATE *psf, int calc_length) ;
|
||||
static int aiff_write_tailer (SF_PRIVATE *psf) ;
|
||||
static void aiff_write_strings (SF_PRIVATE *psf, int location) ;
|
||||
static void aiff_write_strings (SF_PRIVATE *psf, int location) ;
|
||||
|
||||
static int aiff_command (SF_PRIVATE *psf, int command, void *data, int datasize) ;
|
||||
|
||||
static const char *get_loop_mode_str (short mode) ;
|
||||
|
||||
static int aiff_read_basc_chunk (SF_PRIVATE * psf) ;
|
||||
static short get_loop_mode (short mode) ;
|
||||
|
||||
static int aiff_read_basc_chunk (SF_PRIVATE * psf, int) ;
|
||||
|
||||
static unsigned int marker_to_position (const MARK_ID_POS *m, unsigned short n, int marksize) ;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Public function.
|
||||
*/
|
||||
|
||||
int
|
||||
aiff_open (SF_PRIVATE *psf)
|
||||
aiff_open (SF_PRIVATE *psf)
|
||||
{ COMM_CHUNK comm_fmt ;
|
||||
int error, subformat ;
|
||||
|
||||
memset (&comm_fmt, 0, sizeof (comm_fmt)) ;
|
||||
|
||||
subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
|
||||
|
@ -210,14 +221,12 @@ aiff_open (SF_PRIVATE *psf)
|
|||
return SFE_NO_PIPE_WRITE ;
|
||||
|
||||
if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_AIFF)
|
||||
return SFE_BAD_OPEN_FORMAT ;
|
||||
return SFE_BAD_OPEN_FORMAT ;
|
||||
|
||||
if (psf->mode == SFM_WRITE && (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE))
|
||||
{ psf->pchunk = calloc (1, sizeof (PEAK_CHUNK) * psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
if (psf->pchunk == NULL)
|
||||
{ if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
psf->has_peak = SF_TRUE ;
|
||||
psf->peak_loc = SF_PEAK_START ;
|
||||
psf->peak_info->peak_loc = SF_PEAK_START ;
|
||||
} ;
|
||||
|
||||
if (psf->mode != SFM_RDWR || psf->filelength < 40)
|
||||
|
@ -235,11 +244,9 @@ aiff_open (SF_PRIVATE *psf)
|
|||
psf->write_header = aiff_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = aiff_close ;
|
||||
psf->container_close = aiff_close ;
|
||||
psf->command = aiff_command ;
|
||||
|
||||
psf->blockwidth = psf->sf.channels * psf->bytewidth ;
|
||||
|
||||
switch (psf->sf.format & SF_FORMAT_SUBMASK)
|
||||
{ case SF_FORMAT_PCM_U8 :
|
||||
error = pcm_init (psf) ;
|
||||
|
@ -314,8 +321,6 @@ aiff_open (SF_PRIVATE *psf)
|
|||
default : return SFE_UNIMPLEMENTED ;
|
||||
} ;
|
||||
|
||||
if (psf->mode == SFM_READ)
|
||||
psf->blockwidth = psf->sf.channels * psf->bytewidth ;
|
||||
|
||||
return error ;
|
||||
} /* aiff_open */
|
||||
|
@ -324,13 +329,25 @@ aiff_open (SF_PRIVATE *psf)
|
|||
** Private functions.
|
||||
*/
|
||||
|
||||
/* This function ought to check size */
|
||||
static unsigned int
|
||||
marker_to_position (const MARK_ID_POS *m, unsigned short n, int marksize)
|
||||
{ int i ;
|
||||
|
||||
for (i = 0 ; i < marksize ; i++)
|
||||
if (m [i].markerID == n)
|
||||
return m [i].position ;
|
||||
return 0 ;
|
||||
} /* marker_to_position */
|
||||
|
||||
static int
|
||||
aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
||||
{ SSND_CHUNK ssnd_fmt ;
|
||||
int marker, dword, bytesread, k ;
|
||||
int FORMsize, SSNDsize ;
|
||||
int filetype, found_chunk = 0, done = 0, error = 0 ;
|
||||
MARK_ID_POS *markstr = NULL ;
|
||||
unsigned marker, dword, FORMsize, SSNDsize, bytesread ;
|
||||
int k, found_chunk = 0, done = 0, error = 0 ;
|
||||
char *cptr, byte ;
|
||||
int instr_found = 0, mark_found = 0, mark_count = 0 ;
|
||||
|
||||
/* Set position to start of file to begin reading header. */
|
||||
psf_binheader_readf (psf, "p", 0) ;
|
||||
|
@ -340,9 +357,9 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
/* Until recently AIF* file were all BIG endian. */
|
||||
psf->endian = SF_ENDIAN_BIG ;
|
||||
|
||||
/* AIFF files can apparently have their chunks in any order. However, they
|
||||
/* AIFF files can apparently have their chunks in any order. However, they
|
||||
** must have a FORM chunk. Approach here is to read all the chunks one by
|
||||
** one and then check for the mandatory chunks at the end.
|
||||
** one and then check for the mandatory chunks at the end.
|
||||
*/
|
||||
while (! done)
|
||||
{ psf_binheader_readf (psf, "m", &marker) ;
|
||||
|
@ -374,9 +391,8 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
|
||||
case AIFC_MARKER :
|
||||
case AIFF_MARKER :
|
||||
if (! (found_chunk & HAVE_FORM))
|
||||
if ((found_chunk & HAVE_FORM) == 0)
|
||||
return SFE_AIFF_AIFF_NO_FORM ;
|
||||
filetype = marker ;
|
||||
psf_log_printf (psf, " %M\n", marker) ;
|
||||
found_chunk |= HAVE_AIFF ;
|
||||
break ;
|
||||
|
@ -384,10 +400,10 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
case COMM_MARKER :
|
||||
error = aiff_read_comm_chunk (psf, comm_fmt) ;
|
||||
|
||||
psf->sf.samplerate = tenbytefloat2int (comm_fmt->sampleRate) ;
|
||||
psf->sf.frames = comm_fmt->numSampleFrames ;
|
||||
psf->sf.channels = comm_fmt->numChannels ;
|
||||
psf->bytewidth = BITWIDTH2BYTES (comm_fmt->sampleSize) ;
|
||||
psf->sf.samplerate = tenbytefloat2int (comm_fmt->sampleRate) ;
|
||||
psf->sf.frames = comm_fmt->numSampleFrames ;
|
||||
psf->sf.channels = comm_fmt->numChannels ;
|
||||
psf->bytewidth = BITWIDTH2BYTES (comm_fmt->sampleSize) ;
|
||||
|
||||
if (error)
|
||||
return error ;
|
||||
|
@ -403,39 +419,41 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
psf_binheader_readf (psf, "E4", &dword) ;
|
||||
|
||||
psf_log_printf (psf, "%M : %d\n", marker, dword) ;
|
||||
if (dword != SIGNED_SIZEOF (PEAK_CHUNK) + psf->sf.channels * SIGNED_SIZEOF (PEAK_POS))
|
||||
if (dword != AIFF_PEAK_CHUNK_SIZE (psf->sf.channels))
|
||||
{ psf_binheader_readf (psf, "j", dword) ;
|
||||
psf_log_printf (psf, "*** File PEAK chunk bigger than sizeof (PEAK_CHUNK).\n") ;
|
||||
psf_log_printf (psf, "*** File PEAK chunk too big.\n") ;
|
||||
return SFE_WAV_BAD_PEAK ;
|
||||
} ;
|
||||
|
||||
psf->pchunk = calloc (1, sizeof (PEAK_CHUNK) * psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
if (psf->pchunk == NULL)
|
||||
if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
|
||||
/* read in rest of PEAK chunk. */
|
||||
psf_binheader_readf (psf, "E44", &(psf->pchunk->version), &(psf->pchunk->timestamp)) ;
|
||||
psf_binheader_readf (psf, "E44", &(psf->peak_info->version), &(psf->peak_info->timestamp)) ;
|
||||
|
||||
if (psf->pchunk->version != 1)
|
||||
psf_log_printf (psf, " version : %d *** (should be version 1)\n", psf->pchunk->version) ;
|
||||
if (psf->peak_info->version != 1)
|
||||
psf_log_printf (psf, " version : %d *** (should be version 1)\n", psf->peak_info->version) ;
|
||||
else
|
||||
psf_log_printf (psf, " version : %d\n", psf->pchunk->version) ;
|
||||
psf_log_printf (psf, " version : %d\n", psf->peak_info->version) ;
|
||||
|
||||
psf_log_printf (psf, " time stamp : %d\n", psf->pchunk->timestamp) ;
|
||||
psf_log_printf (psf, " time stamp : %d\n", psf->peak_info->timestamp) ;
|
||||
psf_log_printf (psf, " Ch Position Value\n") ;
|
||||
|
||||
cptr = psf->u.scbuf ;
|
||||
for (dword = 0 ; dword < psf->sf.channels ; dword++)
|
||||
{ psf_binheader_readf (psf, "Ef4", &(psf->pchunk->peaks [dword].value),
|
||||
&(psf->pchunk->peaks [dword].position)) ;
|
||||
cptr = psf->u.cbuf ;
|
||||
for (dword = 0 ; dword < (unsigned) psf->sf.channels ; dword++)
|
||||
{ float value ;
|
||||
unsigned int position ;
|
||||
|
||||
LSF_SNPRINTF (cptr, sizeof (psf->u.scbuf), " %2d %-12d %g\n",
|
||||
dword, psf->pchunk->peaks [dword].position, psf->pchunk->peaks [dword].value) ;
|
||||
psf_binheader_readf (psf, "Ef4", &value, &position) ;
|
||||
psf->peak_info->peaks [dword].value = value ;
|
||||
psf->peak_info->peaks [dword].position = position ;
|
||||
|
||||
LSF_SNPRINTF (cptr, sizeof (psf->u.scbuf), " %2d %-12ld %g\n",
|
||||
dword, (long) psf->peak_info->peaks [dword].position, psf->peak_info->peaks [dword].value) ;
|
||||
cptr [sizeof (psf->u.scbuf) - 1] = 0 ;
|
||||
psf_log_printf (psf, cptr) ;
|
||||
} ;
|
||||
|
||||
psf->has_peak = SF_TRUE ; /* Found PEAK chunk. */
|
||||
break ;
|
||||
|
||||
case SSND_MARKER :
|
||||
|
@ -463,7 +481,7 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
if (! psf->sf.seekable)
|
||||
break ;
|
||||
|
||||
/* Seek to end of SSND chunk. */
|
||||
/* Seek to end of SSND chunk. */
|
||||
psf_fseek (psf, psf->dataoffset + psf->datalength + (SSNDsize & 1), SEEK_SET) ;
|
||||
break ;
|
||||
|
||||
|
@ -476,8 +494,8 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr = psf->u.cbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword + (dword & 1)) ;
|
||||
cptr [dword] = 0 ;
|
||||
psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
|
||||
psf_store_string (psf, SF_STR_COPYRIGHT, cptr) ;
|
||||
|
@ -485,17 +503,16 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
|
||||
case AUTH_MARKER :
|
||||
psf_binheader_readf (psf, "E4", &dword) ;
|
||||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf))
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 1)
|
||||
{ psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
cptr = psf->u.cbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword + (dword & 1)) ;
|
||||
cptr [dword] = 0 ;
|
||||
psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
|
||||
psf_store_string (psf, SF_STR_ARTIST, cptr) ;
|
||||
break ;
|
||||
|
@ -509,10 +526,10 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
dword -= 2 ;
|
||||
|
||||
for (k = 0 ; k < count ; k++)
|
||||
{ psf_binheader_readf (psf, "E422", ×tamp, &id, &len) ;
|
||||
|
||||
{ dword -= psf_binheader_readf (psf, "E422", ×tamp, &id, &len) ;
|
||||
psf_log_printf (psf, " time : 0x%x\n marker : %x\n length : %d\n", timestamp, id, len) ;
|
||||
|
||||
if (len + 1 > SIGNED_SIZEOF (psf->u.scbuf))
|
||||
|
@ -520,30 +537,32 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, len) ;
|
||||
cptr = psf->u.cbuf ;
|
||||
dword -= psf_binheader_readf (psf, "b", cptr, len) ;
|
||||
cptr [len] = 0 ;
|
||||
psf_log_printf (psf, " string : %s\n", cptr) ;
|
||||
} ;
|
||||
|
||||
if (dword > 0)
|
||||
psf_binheader_readf (psf, "j", dword) ;
|
||||
} ;
|
||||
break ;
|
||||
|
||||
case APPL_MARKER :
|
||||
psf_binheader_readf (psf, "E4", &dword) ;
|
||||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword >= SIGNED_SIZEOF (psf->u.scbuf))
|
||||
if (dword >= SIGNED_SIZEOF (psf->u.scbuf) - 1)
|
||||
{ psf_log_printf (psf, " %M : %d (too big, skipping)\n", marker, dword) ;
|
||||
psf_binheader_readf (psf, "j", dword) ;
|
||||
psf_binheader_readf (psf, "j", dword + (dword & 1)) ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
cptr = psf->u.cbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword + (dword & 1)) ;
|
||||
cptr [dword] = 0 ;
|
||||
|
||||
for (k = 0 ; k < dword ; k++)
|
||||
for (k = 0 ; k < (int) dword ; k++)
|
||||
if (! isprint (cptr [k]))
|
||||
{ cptr [k] = 0 ;
|
||||
break ;
|
||||
|
@ -555,17 +574,16 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
|
||||
case NAME_MARKER :
|
||||
psf_binheader_readf (psf, "E4", &dword) ;
|
||||
dword += (dword & 1) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf))
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 2)
|
||||
{ psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr [dword - 1] = 0 ;
|
||||
cptr = psf->u.cbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword + (dword & 1)) ;
|
||||
cptr [dword] = 0 ;
|
||||
psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
|
||||
psf_store_string (psf, SF_STR_TITLE, cptr) ;
|
||||
break ;
|
||||
|
@ -574,13 +592,13 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
psf_binheader_readf (psf, "E4", &dword) ;
|
||||
if (dword == 0)
|
||||
break ;
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 1)
|
||||
if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 2)
|
||||
{ psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
cptr = psf->u.scbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword) ;
|
||||
cptr = psf->u.cbuf ;
|
||||
psf_binheader_readf (psf, "b", cptr, dword + (dword & 1)) ;
|
||||
cptr [dword] = 0 ;
|
||||
psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
|
||||
psf_store_string (psf, SF_STR_COMMENT, cptr) ;
|
||||
|
@ -597,15 +615,23 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
{ unsigned char bytes [6] ;
|
||||
short gain ;
|
||||
|
||||
if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
|
||||
psf_binheader_readf (psf, "b", bytes, 6) ;
|
||||
psf_log_printf (psf, " Base Note : %u\n Detune : %u\n"
|
||||
" Low Note : %u\n High Note : %u\n"
|
||||
" Low Vel. : %u\n High Vel. : %u\n",
|
||||
bytes [0], bytes [1], bytes [2], bytes [3], bytes [4], bytes [5]) ;
|
||||
|
||||
psf_log_printf (psf, " Base Note : %u\n Detune : %u\n"
|
||||
" Low Note : %u\n High Note : %u\n"
|
||||
" Low Vel. : %u\n High Vel. : %u\n",
|
||||
bytes [0], bytes [1], bytes [2], bytes [3], bytes [4], bytes [5]) ;
|
||||
psf->instrument->basenote = bytes [0] ;
|
||||
psf->instrument->detune = bytes [1] ;
|
||||
psf->instrument->key_lo = bytes [2] ;
|
||||
psf->instrument->key_hi = bytes [3] ;
|
||||
psf->instrument->velocity_lo = bytes [4] ;
|
||||
psf->instrument->velocity_hi = bytes [5] ;
|
||||
psf_binheader_readf (psf, "E2", &gain) ;
|
||||
psf_log_printf (psf, " Gain (dB) : %d\n", gain) ;
|
||||
|
||||
psf->instrument->gain = gain ;
|
||||
psf_log_printf (psf, " Gain (dB) : %d\n", gain) ;
|
||||
} ;
|
||||
{ short mode ; /* 0 - no loop, 1 - forward looping, 2 - backward looping */
|
||||
const char *loop_mode ;
|
||||
|
@ -613,41 +639,59 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
|
||||
psf_binheader_readf (psf, "E222", &mode, &begin, &end) ;
|
||||
loop_mode = get_loop_mode_str (mode) ;
|
||||
psf_log_printf (psf, " Sustain\n mode : %d => %s\n begin : %u\n end : %u\n",
|
||||
mode, loop_mode, begin, end) ;
|
||||
mode = get_loop_mode (mode) ;
|
||||
if (mode == SF_LOOP_NONE)
|
||||
{ psf->instrument->loop_count = 0 ;
|
||||
psf->instrument->loops [0].mode = SF_LOOP_NONE ;
|
||||
}
|
||||
else
|
||||
{ psf->instrument->loop_count = 1 ;
|
||||
psf->instrument->loops [0].mode = SF_LOOP_FORWARD ;
|
||||
psf->instrument->loops [0].start = begin ;
|
||||
psf->instrument->loops [0].end = end ;
|
||||
psf->instrument->loops [0].count = 0 ;
|
||||
} ;
|
||||
psf_log_printf (psf, " Sustain\n mode : %d => %s\n begin : %u\n end : %u\n",
|
||||
mode, loop_mode, begin, end) ;
|
||||
psf_binheader_readf (psf, "E222", &mode, &begin, &end) ;
|
||||
loop_mode = get_loop_mode_str (mode) ;
|
||||
psf_log_printf (psf, " Release\n mode : %d => %s\n begin : %u\n end : %u\n",
|
||||
mode, loop_mode, begin, end) ;
|
||||
mode = get_loop_mode (mode) ;
|
||||
if (mode == SF_LOOP_NONE)
|
||||
psf->instrument->loops [0].mode = SF_LOOP_NONE ;
|
||||
else
|
||||
{ psf->instrument->loop_count += 1 ;
|
||||
psf->instrument->loops [1].mode = SF_LOOP_FORWARD ;
|
||||
psf->instrument->loops [1].start = begin ;
|
||||
psf->instrument->loops [1].end = end ;
|
||||
psf->instrument->loops [1].count = 0 ;
|
||||
} ;
|
||||
psf_log_printf (psf, " Release\n mode : %d => %s\n begin : %u\n end : %u\n",
|
||||
mode, loop_mode, begin, end) ;
|
||||
} ;
|
||||
instr_found++ ;
|
||||
break ;
|
||||
|
||||
case basc_MARKER :
|
||||
psf_binheader_readf (psf, "E4", &dword) ;
|
||||
|
||||
if (dword != SIZEOF_basc_CHUNK)
|
||||
{ psf_log_printf (psf, " %M : %d (should be %d)\n", marker, dword, SIZEOF_basc_CHUNK) ;
|
||||
psf_binheader_readf (psf, "j", dword) ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
psf_log_printf (psf, " basc : %u\n", dword) ;
|
||||
|
||||
if ((error = aiff_read_basc_chunk (psf)))
|
||||
if ((error = aiff_read_basc_chunk (psf, dword)))
|
||||
return error ;
|
||||
break ;
|
||||
|
||||
case MARK_MARKER :
|
||||
psf_binheader_readf (psf, "E4", &dword) ;
|
||||
psf_log_printf (psf, " %M : %d\n", marker, dword) ;
|
||||
{ unsigned short mark_count, mark_id ;
|
||||
unsigned char pstr_len ;
|
||||
unsigned int position ;
|
||||
{ unsigned short mark_id, n = 0 ;
|
||||
unsigned char pstr_len ;
|
||||
unsigned int position ;
|
||||
|
||||
bytesread = psf_binheader_readf (psf, "E2", &mark_count) ;
|
||||
bytesread = psf_binheader_readf (psf, "E2", &n) ;
|
||||
mark_count = n ;
|
||||
markstr = calloc (mark_count, sizeof (MARK_ID_POS)) ;
|
||||
psf_log_printf (psf, " Count : %d\n", mark_count) ;
|
||||
|
||||
while (mark_count && bytesread < dword)
|
||||
for (n = 0 ; n < mark_count && bytesread < dword ; n++)
|
||||
{ bytesread += psf_binheader_readf (psf, "E241", &mark_id, &position, &pstr_len) ;
|
||||
psf_log_printf (psf, " Mark ID : %u\n Position : %u\n", mark_id, position) ;
|
||||
|
||||
|
@ -656,9 +700,17 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
bytesread += psf_binheader_readf (psf, "b", psf->u.scbuf, pstr_len) ;
|
||||
psf_log_printf (psf, " Name : %s\n", psf->u.scbuf) ;
|
||||
|
||||
mark_count -- ;
|
||||
markstr [n].markerID = mark_id ;
|
||||
markstr [n].position = position ;
|
||||
/*
|
||||
** TODO if psf->u.scbuf is equal to
|
||||
** either Beg_loop, Beg loop or beg loop and spam
|
||||
** if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
|
||||
** return SFE_MALLOC_FAILED ;
|
||||
*/
|
||||
} ;
|
||||
} ;
|
||||
mark_found++ ;
|
||||
psf_binheader_readf (psf, "j", dword - bytesread) ;
|
||||
break ;
|
||||
|
||||
|
@ -702,11 +754,23 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
|
||||
if (psf_ftell (psf) >= psf->filelength - (2 * SIGNED_SIZEOF (dword)))
|
||||
break ;
|
||||
|
||||
if (psf->logindex >= SIGNED_SIZEOF (psf->logbuffer) - 2)
|
||||
return SFE_LOG_OVERRUN ;
|
||||
} ; /* while (1) */
|
||||
|
||||
if (instr_found && mark_found)
|
||||
{ int j ;
|
||||
|
||||
for (j = 0 ; j<psf->instrument->loop_count ; j ++)
|
||||
{ if (j < ARRAY_LEN (psf->instrument->loops))
|
||||
{ psf->instrument->loops [j].start = marker_to_position (markstr, psf->instrument->loops [j].start, mark_count) ;
|
||||
psf->instrument->loops [j].end = marker_to_position (markstr, psf->instrument->loops [j].end, mark_count) ;
|
||||
psf->instrument->loops [j].mode = SF_LOOP_FORWARD ;
|
||||
} ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
if (markstr)
|
||||
free (markstr) ;
|
||||
|
||||
if (! (found_chunk & HAVE_FORM))
|
||||
return SFE_AIFF_NO_FORM ;
|
||||
|
||||
|
@ -723,7 +787,7 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
} /* aiff_read_header */
|
||||
|
||||
static int
|
||||
aiff_close (SF_PRIVATE *psf)
|
||||
aiff_close (SF_PRIVATE *psf)
|
||||
{
|
||||
if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
|
||||
{ aiff_write_tailer (psf) ;
|
||||
|
@ -773,7 +837,7 @@ aiff_read_comm_chunk (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
psf_log_printf (psf, " Frames : %u%s\n", comm_fmt->numSampleFrames, (comm_fmt->numSampleFrames == 0 && psf->filelength > 100) ? " (Should not be 0)" : "") ;
|
||||
psf_log_printf (psf, " Channels : %d\n", comm_fmt->numChannels) ;
|
||||
|
||||
/* Found some broken 'fl32' files with comm.samplesize == 16. Fix it here. */
|
||||
/* Found some broken 'fl32' files with comm.samplesize == 16. Fix it here. */
|
||||
|
||||
if ((comm_fmt->encoding == fl32_MARKER || comm_fmt->encoding == FL32_MARKER) && comm_fmt->sampleSize != 32)
|
||||
{ psf_log_printf (psf, " Sample Size : %d (should be 32)\n", comm_fmt->sampleSize) ;
|
||||
|
@ -873,11 +937,12 @@ aiff_read_comm_chunk (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
|
|||
return error ;
|
||||
} /* aiff_read_comm_chunk */
|
||||
|
||||
|
||||
static int
|
||||
aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
{ sf_count_t current ;
|
||||
unsigned char comm_sample_rate [10], comm_zero_bytes [2] = { 0, 0 } ;
|
||||
unsigned int comm_type, comm_size, comm_encoding, comm_frames ;
|
||||
unsigned char comm_sample_rate [10], comm_zero_bytes [2] = { 0, 0 } ;
|
||||
unsigned int comm_type, comm_size, comm_encoding, comm_frames ;
|
||||
int k, endian ;
|
||||
short bit_width ;
|
||||
|
||||
|
@ -897,7 +962,7 @@ aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
|||
if (psf->mode == SFM_RDWR && psf->dataoffset > 0)
|
||||
{ /* Assuming here that the header has already been written and just
|
||||
** needs to be corrected for new data length. That means that we
|
||||
** only change the length fields of the FORM and SSND chunks;
|
||||
** only change the length fields of the FORM and SSND chunks ;
|
||||
** everything else can be skipped over.
|
||||
*/
|
||||
|
||||
|
@ -1066,6 +1131,7 @@ aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
|||
/* Write COMM chunk. */
|
||||
psf_binheader_writef (psf, "Emm4", comm_type, COMM_MARKER, comm_size) ;
|
||||
|
||||
memset (comm_sample_rate, 0, sizeof (comm_sample_rate)) ;
|
||||
uint2tenbytefloat (psf->sf.samplerate, comm_sample_rate) ;
|
||||
|
||||
psf_binheader_writef (psf, "Et242", psf->sf.channels, comm_frames, bit_width) ;
|
||||
|
@ -1075,15 +1141,70 @@ aiff_write_header (SF_PRIVATE *psf, int calc_length)
|
|||
if (comm_type == AIFC_MARKER)
|
||||
psf_binheader_writef (psf, "mb", comm_encoding, comm_zero_bytes, sizeof (comm_zero_bytes)) ;
|
||||
|
||||
if (psf->instrument != NULL)
|
||||
{ MARK_ID_POS m [4] ;
|
||||
INST_CHUNK ch ;
|
||||
unsigned short ct = 0 ;
|
||||
|
||||
memset (m, 0, sizeof (m)) ;
|
||||
|
||||
ch.baseNote = psf->instrument->basenote ;
|
||||
ch.detune = psf->instrument->detune ;
|
||||
ch.lowNote = psf->instrument->key_lo ;
|
||||
ch.highNote = psf->instrument->key_hi ;
|
||||
ch.lowVelocity = psf->instrument->velocity_lo ;
|
||||
ch.highVelocity = psf->instrument->velocity_hi ;
|
||||
ch.gain = psf->instrument->gain ;
|
||||
if (psf->instrument->loops [0].mode != SF_LOOP_NONE)
|
||||
{ ch.sustain_loop.playMode = 1 ;
|
||||
ch.sustain_loop.beginLoop = ct ;
|
||||
m [0].markerID = ct++ ;
|
||||
m [0].position = psf->instrument->loops [0].start ;
|
||||
ch.sustain_loop.endLoop = ct ;
|
||||
m [1].markerID = ct++ ;
|
||||
m [1].position = psf->instrument->loops [0].end ;
|
||||
} ;
|
||||
if (psf->instrument->loops [1].mode != SF_LOOP_NONE)
|
||||
{ ch.release_loop.playMode = 1 ;
|
||||
ch.release_loop.beginLoop = ct ;
|
||||
m [2].markerID = ct++ ;
|
||||
m [2].position = psf->instrument->loops [1].start ;
|
||||
ch.release_loop.endLoop = ct ;
|
||||
m [3].markerID = ct++ ;
|
||||
m [3].position = psf->instrument->loops [1].end ;
|
||||
}
|
||||
else
|
||||
{ ch.release_loop.playMode = 0 ;
|
||||
ch.release_loop.beginLoop = 0 ;
|
||||
ch.release_loop.endLoop = 0 ;
|
||||
} ;
|
||||
psf_binheader_writef (psf, "Em4b", INST_MARKER, sizeof (INST_CHUNK), &ch.baseNote, make_size_t (6)) ;
|
||||
psf_binheader_writef (psf, "2222222", ch.gain, ch.sustain_loop.playMode,
|
||||
ch.sustain_loop.beginLoop, ch.sustain_loop.endLoop, ch.release_loop.playMode,
|
||||
ch.release_loop.beginLoop, ch.release_loop.endLoop) ;
|
||||
|
||||
if (ct == 2)
|
||||
psf_binheader_writef (psf, "Em42241b241b",
|
||||
MARK_MARKER, 2 * sizeof (MARK_ID_POS) + 16, 2,
|
||||
m [0].markerID, m [0].position, 8, "beg loop", make_size_t (9),
|
||||
m [1].markerID, m [1].position, 8, "end loop", make_size_t (9)) ;
|
||||
else if (ct == 4)
|
||||
psf_binheader_writef (psf, "Em42241b241b241b241b",
|
||||
MARK_MARKER, 4 * sizeof (MARK_ID_POS) + 34, 4,
|
||||
m [0].markerID, m [0].position, 8, "beg loop", make_size_t (9),
|
||||
m [1].markerID, m [1].position, 8, "end loop", make_size_t (9),
|
||||
m [2].markerID, m [2].position, 8, "beg loop", make_size_t (9),
|
||||
m [3].markerID, m [3].position, 8, "end loop", make_size_t (9)) ;
|
||||
} ;
|
||||
|
||||
if (psf->str_flags & SF_STR_LOCATE_START)
|
||||
aiff_write_strings (psf, SF_STR_LOCATE_START) ;
|
||||
|
||||
if (psf->has_peak && psf->peak_loc == SF_PEAK_START)
|
||||
{ psf_binheader_writef (psf, "Em4", PEAK_MARKER,
|
||||
sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
if (psf->peak_info != NULL && psf->peak_info->peak_loc == SF_PEAK_START)
|
||||
{ psf_binheader_writef (psf, "Em4", PEAK_MARKER, AIFF_PEAK_CHUNK_SIZE (psf->sf.channels)) ;
|
||||
psf_binheader_writef (psf, "E44", 1, time (NULL)) ;
|
||||
for (k = 0 ; k < psf->sf.channels ; k++)
|
||||
psf_binheader_writef (psf, "Ef4", psf->pchunk->peaks [k].value, psf->pchunk->peaks [k].position) ; /* XXXXX */
|
||||
psf_binheader_writef (psf, "Eft8", (float) psf->peak_info->peaks [k].value, psf->peak_info->peaks [k].position) ;
|
||||
} ;
|
||||
|
||||
/* Write SSND chunk. */
|
||||
|
@ -1115,19 +1236,24 @@ aiff_write_tailer (SF_PRIVATE *psf)
|
|||
|
||||
psf->dataend = psf_fseek (psf, 0, SEEK_END) ;
|
||||
|
||||
if (psf->has_peak && psf->peak_loc == SF_PEAK_END)
|
||||
{ psf_binheader_writef (psf, "Em4", PEAK_MARKER,
|
||||
sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ;
|
||||
/* Make sure tailer data starts at even byte offset. Pad if necessary. */
|
||||
if (psf->dataend % 2 == 1)
|
||||
{ psf_fwrite (psf->header, 1, 1, psf) ;
|
||||
psf->dataend ++ ;
|
||||
} ;
|
||||
|
||||
if (psf->peak_info != NULL && psf->peak_info->peak_loc == SF_PEAK_END)
|
||||
{ psf_binheader_writef (psf, "Em4", PEAK_MARKER, AIFF_PEAK_CHUNK_SIZE (psf->sf.channels)) ;
|
||||
psf_binheader_writef (psf, "E44", 1, time (NULL)) ;
|
||||
for (k = 0 ; k < psf->sf.channels ; k++)
|
||||
psf_binheader_writef (psf, "Ef4", psf->pchunk->peaks [k].value, psf->pchunk->peaks [k].position) ; /* XXXXX */
|
||||
psf_binheader_writef (psf, "Eft8", (float) psf->peak_info->peaks [k].value, psf->peak_info->peaks [k].position) ;
|
||||
} ;
|
||||
|
||||
if (psf->str_flags & SF_STR_LOCATE_END)
|
||||
aiff_write_strings (psf, SF_STR_LOCATE_END) ;
|
||||
|
||||
/* Write the tailer. */
|
||||
if (psf->headindex)
|
||||
if (psf->headindex > 0)
|
||||
psf_fwrite (psf->header, psf->headindex, 1, psf) ;
|
||||
|
||||
return 0 ;
|
||||
|
@ -1146,23 +1272,23 @@ aiff_write_strings (SF_PRIVATE *psf, int location)
|
|||
|
||||
switch (psf->strings [k].type)
|
||||
{ case SF_STR_SOFTWARE :
|
||||
psf_binheader_writef (psf, "Ems", APPL_MARKER, psf->strings [k].str) ;
|
||||
psf_binheader_writef (psf, "EmS", APPL_MARKER, psf->strings [k].str) ;
|
||||
break ;
|
||||
|
||||
case SF_STR_TITLE :
|
||||
psf_binheader_writef (psf, "Ems", NAME_MARKER, psf->strings [k].str) ;
|
||||
psf_binheader_writef (psf, "EmS", NAME_MARKER, psf->strings [k].str) ;
|
||||
break ;
|
||||
|
||||
case SF_STR_COPYRIGHT :
|
||||
psf_binheader_writef (psf, "Ems", c_MARKER, psf->strings [k].str) ;
|
||||
psf_binheader_writef (psf, "EmS", c_MARKER, psf->strings [k].str) ;
|
||||
break ;
|
||||
|
||||
case SF_STR_ARTIST :
|
||||
psf_binheader_writef (psf, "Ems", AUTH_MARKER, psf->strings [k].str) ;
|
||||
psf_binheader_writef (psf, "EmS", AUTH_MARKER, psf->strings [k].str) ;
|
||||
break ;
|
||||
|
||||
case SF_STR_COMMENT :
|
||||
psf_binheader_writef (psf, "Ems", ANNO_MARKER, psf->strings [k].str) ;
|
||||
psf_binheader_writef (psf, "EmS", ANNO_MARKER, psf->strings [k].str) ;
|
||||
break ;
|
||||
|
||||
/*
|
||||
|
@ -1202,6 +1328,17 @@ get_loop_mode_str (short mode)
|
|||
return "*** unknown" ;
|
||||
} /* get_loop_mode_str */
|
||||
|
||||
static short
|
||||
get_loop_mode (short mode)
|
||||
{ switch (mode)
|
||||
{ case 0 : return SF_LOOP_NONE ;
|
||||
case 1 : return SF_LOOP_FORWARD ;
|
||||
case 2 : return SF_LOOP_BACKWARD ;
|
||||
} ;
|
||||
|
||||
return SF_LOOP_NONE ;
|
||||
} /* get_loop_mode */
|
||||
|
||||
/*==========================================================================================
|
||||
** Rough hack at converting from 80 bit IEEE float in AIFF header to an int and
|
||||
** back again. It assumes that all sample rates are between 1 and 800MHz, which
|
||||
|
@ -1239,10 +1376,7 @@ tenbytefloat2int (unsigned char *bytes)
|
|||
static void
|
||||
uint2tenbytefloat (unsigned int num, unsigned char *bytes)
|
||||
{ unsigned int mask = 0x40000000 ;
|
||||
int count ;
|
||||
|
||||
|
||||
memset (bytes, 0, 10) ;
|
||||
int count ;
|
||||
|
||||
if (num <= 1)
|
||||
{ bytes [0] = 0x3F ;
|
||||
|
@ -1274,13 +1408,13 @@ uint2tenbytefloat (unsigned int num, unsigned char *bytes)
|
|||
} /* uint2tenbytefloat */
|
||||
|
||||
static int
|
||||
aiff_read_basc_chunk (SF_PRIVATE * psf)
|
||||
aiff_read_basc_chunk (SF_PRIVATE * psf, int datasize)
|
||||
{ const char * type_str ;
|
||||
basc_CHUNK bc ;
|
||||
|
||||
psf_binheader_readf (psf, "E442", &bc.version, &bc.numBeats, &bc.rootNote) ;
|
||||
psf_binheader_readf (psf, "E222", &bc.scaleType, &bc.sigNumerator, &bc.sigDenominator) ;
|
||||
psf_binheader_readf (psf, "E2b", &bc.loopType, &bc.zero_bytes, SIZEOF_basc_CHUNK_PADDING) ;
|
||||
psf_binheader_readf (psf, "E2j", &bc.loopType, datasize - sizeof (bc)) ;
|
||||
|
||||
psf_log_printf (psf, " Version ? : %u\n Num Beats : %u\n Root Note : 0x%x\n",
|
||||
bc.version, bc.numBeats, bc.rootNote) ;
|
||||
|
@ -1303,8 +1437,8 @@ aiff_read_basc_chunk (SF_PRIVATE * psf)
|
|||
break ;
|
||||
} ;
|
||||
|
||||
psf_log_printf (psf, " ScaleType : 0x%x (%s)\n", bc.scaleType, type_str) ;
|
||||
psf_log_printf (psf, " Time Sig : %d/%d\n", bc.sigNumerator, bc.sigDenominator) ;
|
||||
psf_log_printf (psf, " ScaleType : 0x%x (%s)\n", bc.scaleType, type_str) ;
|
||||
psf_log_printf (psf, " Time Sig : %d/%d\n", bc.sigNumerator, bc.sigDenominator) ;
|
||||
|
||||
switch (bc.loopType)
|
||||
{ case basc_TYPE_ONE_SHOT :
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -25,20 +25,20 @@ static sf_count_t alaw_read_alaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t alaw_read_alaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t alaw_read_alaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t alaw_write_s2alaw (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t alaw_write_i2alaw (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t alaw_write_f2alaw (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t alaw_write_d2alaw (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t alaw_write_s2alaw (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t alaw_write_i2alaw (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t alaw_write_f2alaw (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t alaw_write_d2alaw (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static void alaw2s_array (unsigned char *buffer, int count, short *ptr) ;
|
||||
static void alaw2i_array (unsigned char *buffer, int count, int *ptr) ;
|
||||
static void alaw2f_array (unsigned char *buffer, int count, float *ptr, float normfact) ;
|
||||
static void alaw2d_array (unsigned char *buffer, int count, double *ptr, double normfact) ;
|
||||
|
||||
static void s2alaw_array (short *buffer, int count, unsigned char *ptr) ;
|
||||
static void i2alaw_array (int *buffer, int count, unsigned char *ptr) ;
|
||||
static void f2alaw_array (float *buffer, int count, unsigned char *ptr, float normfact) ;
|
||||
static void d2alaw_array (double *buffer, int count, unsigned char *ptr, double normfact) ;
|
||||
static void s2alaw_array (const short *buffer, int count, unsigned char *ptr) ;
|
||||
static void i2alaw_array (const int *buffer, int count, unsigned char *ptr) ;
|
||||
static void f2alaw_array (const float *buffer, int count, unsigned char *ptr, float normfact) ;
|
||||
static void d2alaw_array (const double *buffer, int count, unsigned char *ptr, double normfact) ;
|
||||
|
||||
|
||||
int
|
||||
|
@ -311,7 +311,7 @@ alaw2d_array (unsigned char *buffer, int count, double *ptr, double normfact)
|
|||
} /* alaw2d_array */
|
||||
|
||||
static inline void
|
||||
s2alaw_array (short *ptr, int count, unsigned char *buffer)
|
||||
s2alaw_array (const short *ptr, int count, unsigned char *buffer)
|
||||
{ while (--count >= 0)
|
||||
{ if (ptr [count] >= 0)
|
||||
buffer [count] = alaw_encode [ptr [count] / 16] ;
|
||||
|
@ -321,7 +321,7 @@ s2alaw_array (short *ptr, int count, unsigned char *buffer)
|
|||
} /* s2alaw_array */
|
||||
|
||||
static inline void
|
||||
i2alaw_array (int *ptr, int count, unsigned char *buffer)
|
||||
i2alaw_array (const int *ptr, int count, unsigned char *buffer)
|
||||
{ while (--count >= 0)
|
||||
{ if (ptr [count] >= 0)
|
||||
buffer [count] = alaw_encode [ptr [count] >> (16 + 4)] ;
|
||||
|
@ -331,7 +331,7 @@ i2alaw_array (int *ptr, int count, unsigned char *buffer)
|
|||
} /* i2alaw_array */
|
||||
|
||||
static inline void
|
||||
f2alaw_array (float *ptr, int count, unsigned char *buffer, float normfact)
|
||||
f2alaw_array (const float *ptr, int count, unsigned char *buffer, float normfact)
|
||||
{ while (--count >= 0)
|
||||
{ if (ptr [count] >= 0)
|
||||
buffer [count] = alaw_encode [lrintf (normfact * ptr [count])] ;
|
||||
|
@ -341,7 +341,7 @@ f2alaw_array (float *ptr, int count, unsigned char *buffer, float normfact)
|
|||
} /* f2alaw_array */
|
||||
|
||||
static inline void
|
||||
d2alaw_array (double *ptr, int count, unsigned char *buffer, double normfact)
|
||||
d2alaw_array (const double *ptr, int count, unsigned char *buffer, double normfact)
|
||||
{ while (--count >= 0)
|
||||
{ if (ptr [count] >= 0)
|
||||
buffer [count] = alaw_encode [lrint (normfact * ptr [count])] ;
|
||||
|
@ -446,7 +446,7 @@ alaw_read_alaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static sf_count_t
|
||||
alaw_write_s2alaw (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
alaw_write_s2alaw (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -467,7 +467,7 @@ alaw_write_s2alaw (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* alaw_write_s2alaw */
|
||||
|
||||
static sf_count_t
|
||||
alaw_write_i2alaw (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
alaw_write_i2alaw (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -488,7 +488,7 @@ alaw_write_i2alaw (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* alaw_write_i2alaw */
|
||||
|
||||
static sf_count_t
|
||||
alaw_write_f2alaw (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
alaw_write_f2alaw (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
float normfact ;
|
||||
|
@ -512,7 +512,7 @@ alaw_write_f2alaw (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* alaw_write_f2alaw */
|
||||
|
||||
static sf_count_t
|
||||
alaw_write_d2alaw (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
alaw_write_d2alaw (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
double normfact ;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -26,7 +26,6 @@
|
|||
#include "sndfile.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
#include "au.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Macros to handle big/little endian issues.
|
||||
|
@ -130,7 +129,7 @@ au_open (SF_PRIVATE *psf)
|
|||
psf->write_header = au_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = au_close ;
|
||||
psf->container_close = au_close ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
|
||||
|
||||
|
@ -163,26 +162,17 @@ au_open (SF_PRIVATE *psf)
|
|||
break ;
|
||||
|
||||
case SF_FORMAT_G721_32 :
|
||||
if (psf->mode == SFM_READ)
|
||||
error = au_g72x_reader_init (psf, AU_H_G721_32) ;
|
||||
else if (psf->mode == SFM_WRITE)
|
||||
error = au_g72x_writer_init (psf, AU_H_G721_32) ;
|
||||
error = g72x_init (psf) ;
|
||||
psf->sf.seekable = SF_FALSE ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_G723_24 :
|
||||
if (psf->mode == SFM_READ)
|
||||
error = au_g72x_reader_init (psf, AU_H_G723_24) ;
|
||||
else if (psf->mode == SFM_WRITE)
|
||||
error = au_g72x_writer_init (psf, AU_H_G723_24) ;
|
||||
error = g72x_init (psf) ;
|
||||
psf->sf.seekable = SF_FALSE ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_G723_40 :
|
||||
if (psf->mode == SFM_READ)
|
||||
error = au_g72x_reader_init (psf, AU_H_G723_40) ;
|
||||
else if (psf->mode == SFM_WRITE)
|
||||
error = au_g72x_writer_init (psf, AU_H_G723_40) ;
|
||||
error = g72x_init (psf) ;
|
||||
psf->sf.seekable = SF_FALSE ;
|
||||
break ;
|
||||
/* Lite remove end */
|
||||
|
@ -193,37 +183,6 @@ au_open (SF_PRIVATE *psf)
|
|||
return error ;
|
||||
} /* au_open */
|
||||
|
||||
int
|
||||
au_nh_open (SF_PRIVATE *psf)
|
||||
{
|
||||
if (psf->mode == SFM_RDWR)
|
||||
return SFE_BAD_OPEN_FORMAT ;
|
||||
|
||||
if (psf_fseek (psf, psf->dataoffset, SEEK_SET))
|
||||
return SFE_BAD_SEEK ;
|
||||
|
||||
psf_log_printf (psf, "Header-less u-law encoded file.\n") ;
|
||||
psf_log_printf (psf, "Setting up for 8kHz, mono, u-law.\n") ;
|
||||
|
||||
psf->sf.format = SF_FORMAT_AU | SF_FORMAT_ULAW ;
|
||||
|
||||
psf->dataoffset = 0 ;
|
||||
psf->endian = 0 ; /* Irrelevant but it must be something. */
|
||||
psf->sf.samplerate = 8000 ;
|
||||
psf->sf.channels = 1 ;
|
||||
psf->bytewidth = 1 ; /* Before decoding */
|
||||
|
||||
ulaw_init (psf) ;
|
||||
|
||||
psf->close = au_close ;
|
||||
|
||||
psf->blockwidth = 1 ;
|
||||
psf->sf.frames = psf->filelength ;
|
||||
psf->datalength = psf->filelength - AU_DATA_OFFSET ;
|
||||
|
||||
return 0 ;
|
||||
} /* au_nh_open */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
@ -335,6 +294,7 @@ au_read_header (SF_PRIVATE *psf)
|
|||
{ AU_FMT au_fmt ;
|
||||
int marker, dword ;
|
||||
|
||||
memset (&au_fmt, 0, sizeof (au_fmt)) ;
|
||||
psf_binheader_readf (psf, "pm", 0, &marker) ;
|
||||
psf_log_printf (psf, "%M\n", marker) ;
|
||||
|
||||
|
@ -381,8 +341,6 @@ au_read_header (SF_PRIVATE *psf)
|
|||
if (psf_ftell (psf) < psf->dataoffset)
|
||||
psf_binheader_readf (psf, "j", psf->dataoffset - psf_ftell (psf)) ;
|
||||
|
||||
psf->close = au_close ;
|
||||
|
||||
psf->sf.samplerate = au_fmt.samplerate ;
|
||||
psf->sf.channels = au_fmt.channels ;
|
||||
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef AU_HEADER_FILE
|
||||
#define AU_HEADER_FILE
|
||||
|
||||
|
||||
enum
|
||||
{ AU_H_G721_32 = 200,
|
||||
AU_H_G723_24 = 201,
|
||||
AU_H_G723_40 = 202
|
||||
} ;
|
||||
|
||||
int au_g72x_reader_init (SF_PRIVATE *psf, int codec) ;
|
||||
int au_g72x_writer_init (SF_PRIVATE *psf, int codec) ;
|
||||
|
||||
#endif /* AU_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: 63affc81-e204-4468-9705-60abe4d10689
|
||||
*/
|
|
@ -1,634 +0,0 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "sfendian.h"
|
||||
#include "float_cast.h"
|
||||
#include "common.h"
|
||||
#include "au.h"
|
||||
#include "G72x/g72x.h"
|
||||
|
||||
static int au_g72x_read_block (SF_PRIVATE *psf, G72x_DATA *pg72x, short *ptr, int len) ;
|
||||
static int au_g72x_write_block (SF_PRIVATE *psf, G72x_DATA *pg72x, short *ptr, int len) ;
|
||||
|
||||
static int au_g72x_decode_block (SF_PRIVATE *psf, G72x_DATA *pg72x) ;
|
||||
static int au_g72x_encode_block (SF_PRIVATE *psf, G72x_DATA *pg72x) ;
|
||||
|
||||
static sf_count_t au_g72x_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t au_g72x_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t au_g72x_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t au_g72x_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t au_g72x_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t au_g72x_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t au_g72x_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t au_g72x_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t au_g72x_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
|
||||
|
||||
static int au_g72x_close (SF_PRIVATE *psf) ;
|
||||
|
||||
|
||||
/*============================================================================================
|
||||
** WAV G721 Reader initialisation function.
|
||||
*/
|
||||
|
||||
int
|
||||
au_g72x_reader_init (SF_PRIVATE *psf, int codec)
|
||||
{ G72x_DATA *pg72x ;
|
||||
int bitspersample ;
|
||||
|
||||
psf->sf.seekable = SF_FALSE ;
|
||||
|
||||
if (psf->sf.channels != 1)
|
||||
return SFE_G72X_NOT_MONO ;
|
||||
|
||||
if (! (pg72x = malloc (sizeof (G72x_DATA))))
|
||||
return SFE_MALLOC_FAILED ;
|
||||
|
||||
psf->fdata = (void*) pg72x ;
|
||||
|
||||
pg72x->blockcount = 0 ;
|
||||
pg72x->samplecount = 0 ;
|
||||
|
||||
switch (codec)
|
||||
{ case AU_H_G721_32 :
|
||||
g72x_reader_init (pg72x, G721_32_BITS_PER_SAMPLE) ;
|
||||
pg72x->bytesperblock = G721_32_BYTES_PER_BLOCK ;
|
||||
bitspersample = G721_32_BITS_PER_SAMPLE ;
|
||||
break ;
|
||||
|
||||
case AU_H_G723_24:
|
||||
g72x_reader_init (pg72x, G723_24_BITS_PER_SAMPLE) ;
|
||||
pg72x->bytesperblock = G723_24_BYTES_PER_BLOCK ;
|
||||
bitspersample = G723_24_BITS_PER_SAMPLE ;
|
||||
break ;
|
||||
|
||||
case AU_H_G723_40:
|
||||
g72x_reader_init (pg72x, G723_40_BITS_PER_SAMPLE) ;
|
||||
pg72x->bytesperblock = G723_40_BYTES_PER_BLOCK ;
|
||||
bitspersample = G723_40_BITS_PER_SAMPLE ;
|
||||
break ;
|
||||
|
||||
default : return SFE_UNIMPLEMENTED ;
|
||||
} ;
|
||||
|
||||
psf->read_short = au_g72x_read_s ;
|
||||
psf->read_int = au_g72x_read_i ;
|
||||
psf->read_float = au_g72x_read_f ;
|
||||
psf->read_double = au_g72x_read_d ;
|
||||
|
||||
psf->seek = au_g72x_seek ;
|
||||
psf->close = au_g72x_close ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth = 1 ;
|
||||
|
||||
psf->filelength = psf_get_filelen (psf) ;
|
||||
psf->datalength = psf->filelength - psf->dataoffset ;
|
||||
|
||||
if (psf->datalength % pg72x->blocksize)
|
||||
pg72x->blocks = (psf->datalength / pg72x->blocksize) + 1 ;
|
||||
else
|
||||
pg72x->blocks = psf->datalength / pg72x->blocksize ;
|
||||
|
||||
psf->sf.frames = (8 * psf->datalength) / bitspersample ;
|
||||
|
||||
if ((psf->sf.frames * bitspersample) / 8 != psf->datalength)
|
||||
psf_log_printf (psf, "*** Warning : weird psf->datalength.\n") ;
|
||||
|
||||
au_g72x_decode_block (psf, pg72x) ;
|
||||
|
||||
return 0 ;
|
||||
} /* au_g72x_reader_init */
|
||||
|
||||
/*============================================================================================
|
||||
** WAV G721 writer initialisation function.
|
||||
*/
|
||||
|
||||
int
|
||||
au_g72x_writer_init (SF_PRIVATE *psf, int codec)
|
||||
{ G72x_DATA *pg72x ;
|
||||
int bitspersample ;
|
||||
|
||||
psf->sf.seekable = SF_FALSE ;
|
||||
|
||||
if (psf->sf.channels != 1)
|
||||
return SFE_G72X_NOT_MONO ;
|
||||
|
||||
if (! (pg72x = malloc (sizeof (G72x_DATA))))
|
||||
return SFE_MALLOC_FAILED ;
|
||||
|
||||
psf->fdata = (void*) pg72x ;
|
||||
|
||||
pg72x->blockcount = 0 ;
|
||||
pg72x->samplecount = 0 ;
|
||||
|
||||
switch (codec)
|
||||
{ case AU_H_G721_32 :
|
||||
g72x_writer_init (pg72x, G721_32_BITS_PER_SAMPLE) ;
|
||||
pg72x->bytesperblock = G721_32_BYTES_PER_BLOCK ;
|
||||
bitspersample = G721_32_BITS_PER_SAMPLE ;
|
||||
break ;
|
||||
|
||||
case AU_H_G723_24:
|
||||
g72x_writer_init (pg72x, G723_24_BITS_PER_SAMPLE) ;
|
||||
pg72x->bytesperblock = G723_24_BYTES_PER_BLOCK ;
|
||||
bitspersample = G723_24_BITS_PER_SAMPLE ;
|
||||
break ;
|
||||
|
||||
case AU_H_G723_40:
|
||||
g72x_writer_init (pg72x, G723_40_BITS_PER_SAMPLE) ;
|
||||
pg72x->bytesperblock = G723_40_BYTES_PER_BLOCK ;
|
||||
bitspersample = G723_40_BITS_PER_SAMPLE ;
|
||||
break ;
|
||||
|
||||
default : return SFE_UNIMPLEMENTED ;
|
||||
} ;
|
||||
|
||||
psf->write_short = au_g72x_write_s ;
|
||||
psf->write_int = au_g72x_write_i ;
|
||||
psf->write_float = au_g72x_write_f ;
|
||||
psf->write_double = au_g72x_write_d ;
|
||||
|
||||
psf->close = au_g72x_close ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth = 1 ;
|
||||
|
||||
psf->filelength = psf_get_filelen (psf) ;
|
||||
if (psf->filelength < psf->dataoffset)
|
||||
psf->filelength = psf->dataoffset ;
|
||||
|
||||
psf->datalength = psf->filelength - psf->dataoffset ;
|
||||
|
||||
if (psf->datalength % pg72x->blocksize)
|
||||
pg72x->blocks = (psf->datalength / pg72x->blocksize) + 1 ;
|
||||
else
|
||||
pg72x->blocks = psf->datalength / pg72x->blocksize ;
|
||||
|
||||
if (psf->datalength > 0)
|
||||
psf->sf.frames = (8 * psf->datalength) / bitspersample ;
|
||||
|
||||
if ((psf->sf.frames * bitspersample) / 8 != psf->datalength)
|
||||
psf_log_printf (psf, "*** Warning : weird psf->datalength.\n") ;
|
||||
|
||||
return 0 ;
|
||||
} /* au_g72x_writer_init */
|
||||
|
||||
/*============================================================================================
|
||||
** G721 Read Functions.
|
||||
*/
|
||||
|
||||
static int
|
||||
au_g72x_decode_block (SF_PRIVATE *psf, G72x_DATA *pg72x)
|
||||
{ int k ;
|
||||
|
||||
pg72x->blockcount ++ ;
|
||||
pg72x->samplecount = 0 ;
|
||||
|
||||
if (pg72x->samplecount > pg72x->blocksize)
|
||||
{ memset (pg72x->samples, 0, G72x_BLOCK_SIZE * sizeof (short)) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
if ((k = psf_fread (pg72x->block, 1, pg72x->bytesperblock, psf)) != pg72x->bytesperblock)
|
||||
psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pg72x->bytesperblock) ;
|
||||
|
||||
pg72x->blocksize = k ;
|
||||
g72x_decode_block (pg72x) ;
|
||||
|
||||
return 1 ;
|
||||
} /* au_g72x_decode_block */
|
||||
|
||||
static int
|
||||
au_g72x_read_block (SF_PRIVATE *psf, G72x_DATA *pg72x, short *ptr, int len)
|
||||
{ int count, total = 0, indx = 0 ;
|
||||
|
||||
while (indx < len)
|
||||
{ if (pg72x->blockcount >= pg72x->blocks && pg72x->samplecount >= pg72x->samplesperblock)
|
||||
{ memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ;
|
||||
return total ;
|
||||
} ;
|
||||
|
||||
if (pg72x->samplecount >= pg72x->samplesperblock)
|
||||
au_g72x_decode_block (psf, pg72x) ;
|
||||
|
||||
count = pg72x->samplesperblock - pg72x->samplecount ;
|
||||
count = (len - indx > count) ? count : len - indx ;
|
||||
|
||||
memcpy (&(ptr [indx]), &(pg72x->samples [pg72x->samplecount]), count * sizeof (short)) ;
|
||||
indx += count ;
|
||||
pg72x->samplecount += count ;
|
||||
total = indx ;
|
||||
} ;
|
||||
|
||||
return total ;
|
||||
} /* au_g72x_read_block */
|
||||
|
||||
static sf_count_t
|
||||
au_g72x_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ G72x_DATA *pg72x ;
|
||||
int readcount, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
while (len > 0)
|
||||
{ readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
|
||||
|
||||
count = au_g72x_read_block (psf, pg72x, ptr, readcount) ;
|
||||
|
||||
total += count ;
|
||||
len -= count ;
|
||||
|
||||
if (count != readcount)
|
||||
break ;
|
||||
} ;
|
||||
|
||||
return total ;
|
||||
} /* au_g72x_read_s */
|
||||
|
||||
static sf_count_t
|
||||
au_g72x_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ G72x_DATA *pg72x ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, readcount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = au_g72x_read_block (psf, pg72x, sptr, readcount) ;
|
||||
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = sptr [k] << 16 ;
|
||||
|
||||
total += count ;
|
||||
len -= readcount ;
|
||||
if (count != readcount)
|
||||
break ;
|
||||
} ;
|
||||
|
||||
return total ;
|
||||
} /* au_g72x_read_i */
|
||||
|
||||
static sf_count_t
|
||||
au_g72x_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ G72x_DATA *pg72x ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, readcount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
float normfact ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = au_g72x_read_block (psf, pg72x, sptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * sptr [k] ;
|
||||
|
||||
total += count ;
|
||||
len -= readcount ;
|
||||
if (count != readcount)
|
||||
break ;
|
||||
} ;
|
||||
|
||||
return total ;
|
||||
} /* au_g72x_read_f */
|
||||
|
||||
static sf_count_t
|
||||
au_g72x_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ G72x_DATA *pg72x ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, readcount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
double normfact ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = SF_BUFFER_LEN / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ readcount = (len >= bufferlen) ? bufferlen : len ;
|
||||
count = au_g72x_read_block (psf, pg72x, sptr, readcount) ;
|
||||
for (k = 0 ; k < readcount ; k++)
|
||||
ptr [total + k] = normfact * (double) (sptr [k]) ;
|
||||
|
||||
total += count ;
|
||||
len -= readcount ;
|
||||
if (count != readcount)
|
||||
break ;
|
||||
} ;
|
||||
|
||||
return total ;
|
||||
} /* au_g72x_read_d */
|
||||
|
||||
static sf_count_t
|
||||
au_g72x_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
||||
{
|
||||
/* Prevent compiler warnings. */
|
||||
mode ++ ;
|
||||
offset ++ ;
|
||||
|
||||
psf_log_printf (psf, "seek unsupported\n") ;
|
||||
|
||||
/* No simple solution. To do properly, would need to seek
|
||||
** to start of file and decode everything up to seek position.
|
||||
** Maybe implement SEEK_SET to 0 only?
|
||||
*/
|
||||
return 0 ;
|
||||
|
||||
/*
|
||||
** G72x_DATA *pg72x ;
|
||||
** int newblock, newsample, samplecount ;
|
||||
**
|
||||
** if (! psf->fdata)
|
||||
** return 0 ;
|
||||
** pg72x = (G72x_DATA*) psf->fdata ;
|
||||
**
|
||||
** if (! (psf->datalength && psf->dataoffset))
|
||||
** { psf->error = SFE_BAD_SEEK ;
|
||||
** return ((sf_count_t) -1) ;
|
||||
** } ;
|
||||
**
|
||||
** samplecount = (8 * psf->datalength) / G721_32_BITS_PER_SAMPLE ;
|
||||
**
|
||||
** switch (whence)
|
||||
** { case SEEK_SET :
|
||||
** if (offset < 0 || offset > samplecount)
|
||||
** { psf->error = SFE_BAD_SEEK ;
|
||||
** return ((sf_count_t) -1) ;
|
||||
** } ;
|
||||
** newblock = offset / pg72x->samplesperblock ;
|
||||
** newsample = offset % pg72x->samplesperblock ;
|
||||
** break ;
|
||||
**
|
||||
** case SEEK_CUR :
|
||||
** if (psf->current + offset < 0 || psf->current + offset > samplecount)
|
||||
** { psf->error = SFE_BAD_SEEK ;
|
||||
** return ((sf_count_t) -1) ;
|
||||
** } ;
|
||||
** newblock = (8 * (psf->current + offset)) / pg72x->samplesperblock ;
|
||||
** newsample = (8 * (psf->current + offset)) % pg72x->samplesperblock ;
|
||||
** break ;
|
||||
**
|
||||
** case SEEK_END :
|
||||
** if (offset > 0 || samplecount + offset < 0)
|
||||
** { psf->error = SFE_BAD_SEEK ;
|
||||
** return ((sf_count_t) -1) ;
|
||||
** } ;
|
||||
** newblock = (samplecount + offset) / pg72x->samplesperblock ;
|
||||
** newsample = (samplecount + offset) % pg72x->samplesperblock ;
|
||||
** break ;
|
||||
**
|
||||
** default :
|
||||
** psf->error = SFE_BAD_SEEK ;
|
||||
** return ((sf_count_t) -1) ;
|
||||
** } ;
|
||||
**
|
||||
** if (psf->mode == SFM_READ)
|
||||
** { psf_fseek (psf, psf->dataoffset + newblock * pg72x->blocksize, SEEK_SET) ;
|
||||
** pg72x->blockcount = newblock ;
|
||||
** au_g72x_decode_block (psf, pg72x) ;
|
||||
** pg72x->samplecount = newsample ;
|
||||
** }
|
||||
** else
|
||||
** { /+* What to do about write??? *+/
|
||||
** psf->error = SFE_BAD_SEEK ;
|
||||
** return ((sf_count_t) -1) ;
|
||||
** } ;
|
||||
**
|
||||
** psf->current = newblock * pg72x->samplesperblock + newsample ;
|
||||
** return psf->current ;
|
||||
**
|
||||
*/
|
||||
} /* au_g72x_seek */
|
||||
|
||||
/*==========================================================================================
|
||||
** G72x Write Functions.
|
||||
*/
|
||||
|
||||
static int
|
||||
au_g72x_encode_block (SF_PRIVATE *psf, G72x_DATA *pg72x)
|
||||
{ int k ;
|
||||
|
||||
/* Encode the samples. */
|
||||
g72x_encode_block (pg72x) ;
|
||||
|
||||
/* Write the block to disk. */
|
||||
if ((k = psf_fwrite (pg72x->block, 1, pg72x->blocksize, psf)) != pg72x->blocksize)
|
||||
psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pg72x->blocksize) ;
|
||||
|
||||
pg72x->samplecount = 0 ;
|
||||
pg72x->blockcount ++ ;
|
||||
|
||||
/* Set samples to zero for next block. */
|
||||
memset (pg72x->samples, 0, G72x_BLOCK_SIZE * sizeof (short)) ;
|
||||
|
||||
return 1 ;
|
||||
} /* au_g72x_encode_block */
|
||||
|
||||
static int
|
||||
au_g72x_write_block (SF_PRIVATE *psf, G72x_DATA *pg72x, short *ptr, int len)
|
||||
{ int count, total = 0, indx = 0 ;
|
||||
|
||||
while (indx < len)
|
||||
{ count = pg72x->samplesperblock - pg72x->samplecount ;
|
||||
|
||||
if (count > len - indx)
|
||||
count = len - indx ;
|
||||
|
||||
memcpy (&(pg72x->samples [pg72x->samplecount]), &(ptr [indx]), count * sizeof (short)) ;
|
||||
indx += count ;
|
||||
pg72x->samplecount += count ;
|
||||
total = indx ;
|
||||
|
||||
if (pg72x->samplecount >= pg72x->samplesperblock)
|
||||
au_g72x_encode_block (psf, pg72x) ;
|
||||
} ;
|
||||
|
||||
return total ;
|
||||
} /* au_g72x_write_block */
|
||||
|
||||
static sf_count_t
|
||||
au_g72x_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ G72x_DATA *pg72x ;
|
||||
int writecount, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
while (len > 0)
|
||||
{ writecount = (len > 0x10000000) ? 0x10000000 : (int) len ;
|
||||
|
||||
count = au_g72x_write_block (psf, pg72x, ptr, writecount) ;
|
||||
|
||||
total += count ;
|
||||
len -= count ;
|
||||
if (count != writecount)
|
||||
break ;
|
||||
} ;
|
||||
|
||||
return total ;
|
||||
} /* au_g72x_write_s */
|
||||
|
||||
static sf_count_t
|
||||
au_g72x_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ G72x_DATA *pg72x ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = ptr [total + k] >> 16 ;
|
||||
count = au_g72x_write_block (psf, pg72x, sptr, writecount) ;
|
||||
|
||||
total += count ;
|
||||
len -= writecount ;
|
||||
if (count != writecount)
|
||||
break ;
|
||||
} ;
|
||||
return total ;
|
||||
} /* au_g72x_write_i */
|
||||
|
||||
static sf_count_t
|
||||
au_g72x_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ G72x_DATA *pg72x ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
float normfact ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = lrintf (normfact * ptr [total + k]) ;
|
||||
count = au_g72x_write_block (psf, pg72x, sptr, writecount) ;
|
||||
|
||||
total += count ;
|
||||
len -= writecount ;
|
||||
if (count != writecount)
|
||||
break ;
|
||||
} ;
|
||||
|
||||
return total ;
|
||||
} /* au_g72x_write_f */
|
||||
|
||||
static sf_count_t
|
||||
au_g72x_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ G72x_DATA *pg72x ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
double normfact ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ;
|
||||
|
||||
sptr = psf->u.sbuf ;
|
||||
bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ;
|
||||
while (len > 0)
|
||||
{ writecount = (len >= bufferlen) ? bufferlen : len ;
|
||||
for (k = 0 ; k < writecount ; k++)
|
||||
sptr [k] = lrint (normfact * ptr [total + k]) ;
|
||||
count = au_g72x_write_block (psf, pg72x, sptr, writecount) ;
|
||||
|
||||
total += count ;
|
||||
len -= writecount ;
|
||||
if (count != writecount)
|
||||
break ;
|
||||
} ;
|
||||
|
||||
return total ;
|
||||
} /* au_g72x_write_d */
|
||||
|
||||
static int
|
||||
au_g72x_close (SF_PRIVATE *psf)
|
||||
{ G72x_DATA *pg72x ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
|
||||
pg72x = (G72x_DATA*) psf->fdata ;
|
||||
|
||||
if (psf->mode == SFM_WRITE)
|
||||
{ /* If a block has been partially assembled, write it out
|
||||
** as the final block.
|
||||
*/
|
||||
|
||||
if (pg72x->samplecount && pg72x->samplecount < G72x_BLOCK_SIZE)
|
||||
au_g72x_encode_block (psf, pg72x) ;
|
||||
|
||||
if (psf->write_header)
|
||||
psf->write_header (psf, SF_FALSE) ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
} /* au_g72x_close */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 3cc5439e-7247-486b-b2e6-11a4affa5744
|
||||
*/
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2004-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -78,8 +78,7 @@ static int avr_write_header (SF_PRIVATE *psf, int calc_length) ;
|
|||
|
||||
int
|
||||
avr_open (SF_PRIVATE *psf)
|
||||
{ int subformat ;
|
||||
int error = 0 ;
|
||||
{ int error = 0 ;
|
||||
|
||||
if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
|
||||
{ if ((error = avr_read_header (psf)))
|
||||
|
@ -89,8 +88,6 @@ avr_open (SF_PRIVATE *psf)
|
|||
if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_AVR)
|
||||
return SFE_BAD_OPEN_FORMAT ;
|
||||
|
||||
subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
|
||||
{ psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ;
|
||||
psf->endian = SF_ENDIAN_BIG ;
|
||||
|
@ -101,7 +98,7 @@ avr_open (SF_PRIVATE *psf)
|
|||
psf->write_header = avr_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = avr_close ;
|
||||
psf->container_close = avr_close ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
|
||||
|
||||
|
@ -150,7 +147,6 @@ avr_read_header (SF_PRIVATE *psf)
|
|||
default :
|
||||
psf_log_printf (psf, "Error : bad rez/sign combination.\n") ;
|
||||
return SFE_AVR_X ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
psf_binheader_readf (psf, "E4444", &hdr.srate, &hdr.frames, &hdr.lbeg, &hdr.lend) ;
|
||||
|
@ -177,8 +173,6 @@ avr_read_header (SF_PRIVATE *psf)
|
|||
if (psf_ftell (psf) != psf->dataoffset)
|
||||
psf_binheader_readf (psf, "j", psf->dataoffset - psf_ftell (psf)) ;
|
||||
|
||||
psf->close = avr_close ;
|
||||
|
||||
psf->blockwidth = psf->sf.channels * psf->bytewidth ;
|
||||
|
||||
if (psf->sf.frames == 0 && psf->blockwidth)
|
||||
|
@ -190,7 +184,7 @@ avr_read_header (SF_PRIVATE *psf)
|
|||
static int
|
||||
avr_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
{ sf_count_t current ;
|
||||
int sign, datalength ;
|
||||
int sign ;
|
||||
|
||||
if (psf->pipeoffset > 0)
|
||||
return 0 ;
|
||||
|
@ -218,9 +212,7 @@ avr_write_header (SF_PRIVATE *psf, int calc_length)
|
|||
if (psf->is_pipe == SF_FALSE)
|
||||
psf_fseek (psf, 0, SEEK_SET) ;
|
||||
|
||||
datalength = (int) (psf->datalength & 0x7FFFFFFF) ;
|
||||
|
||||
psf_binheader_writef (psf, "Emz22", TWOBIT_MARKER, (size_t) 8,
|
||||
psf_binheader_writef (psf, "Emz22", TWOBIT_MARKER, make_size_t (8),
|
||||
psf->sf.channels == 2 ? 0xFFFF : 0, psf->bytewidth * 8) ;
|
||||
|
||||
sign = ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_PCM_U8) ? 0 : 0xFFFF ;
|
||||
|
@ -228,7 +220,7 @@ avr_write_header (SF_PRIVATE *psf, int calc_length)
|
|||
psf_binheader_writef (psf, "E222", sign, 0, 0xFFFF) ;
|
||||
psf_binheader_writef (psf, "E4444", psf->sf.samplerate, psf->sf.frames, 0, 0) ;
|
||||
|
||||
psf_binheader_writef (psf, "E222zz", 0, 0, 0, (size_t) 20, (size_t) 64) ;
|
||||
psf_binheader_writef (psf, "E222zz", 0, 0, 0, make_size_t (20), make_size_t (64)) ;
|
||||
|
||||
/* Header construction complete so write it out. */
|
||||
psf_fwrite (psf->header, psf->headindex, 1, psf) ;
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
|
||||
static SF_FORMAT_INFO const simple_formats [] =
|
||||
|
@ -46,6 +47,16 @@ static SF_FORMAT_INFO const simple_formats [] =
|
|||
"AU (Sun/Next 8-bit u-law)", "au"
|
||||
},
|
||||
|
||||
{ SF_FORMAT_CAF | SF_FORMAT_PCM_16,
|
||||
"CAF (Apple 16 bit PCM)", "caf"
|
||||
},
|
||||
|
||||
#ifdef HAVE_FLAC_ALL_H
|
||||
{ SF_FORMAT_FLAC | SF_FORMAT_PCM_16,
|
||||
"FLAC 16 bit", "flac"
|
||||
},
|
||||
#endif
|
||||
|
||||
{ SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM,
|
||||
"OKI Dialogic VOX ADPCM", "vox"
|
||||
},
|
||||
|
@ -99,6 +110,10 @@ static SF_FORMAT_INFO const major_formats [] =
|
|||
{ SF_FORMAT_AIFF, "AIFF (Apple/SGI)", "aiff" },
|
||||
{ SF_FORMAT_AU, "AU (Sun/NeXT)", "au" },
|
||||
{ SF_FORMAT_AVR, "AVR (Audio Visual Research)", "avr" },
|
||||
{ SF_FORMAT_CAF, "CAF (Apple Core Audio File)", "caf" },
|
||||
#ifdef HAVE_FLAC_ALL_H
|
||||
{ SF_FORMAT_FLAC, "FLAC (FLAC Lossless Audio Codec)", "flac" },
|
||||
#endif
|
||||
{ SF_FORMAT_HTK, "HTK (HMM Tool Kit)", "htk" },
|
||||
{ SF_FORMAT_SVX, "IFF (Amiga IFF/SVX8/SV16)", "iff" },
|
||||
{ SF_FORMAT_MAT4, "MAT4 (GNU Octave 2.0 / Matlab 4.2)", "mat" },
|
||||
|
@ -106,10 +121,8 @@ static SF_FORMAT_INFO const major_formats [] =
|
|||
{ SF_FORMAT_PAF, "PAF (Ensoniq PARIS)", "paf" },
|
||||
{ SF_FORMAT_PVF, "PVF (Portable Voice Format)", "pvf" },
|
||||
{ SF_FORMAT_RAW, "RAW (header-less)", "raw" },
|
||||
{ SF_FORMAT_SD2, "SD2 (Sound Designer II)", "sd2" },
|
||||
{ SF_FORMAT_SDS, "SDS (Midi Sample Dump Standard)", "sds" },
|
||||
/* Not ready for mainstream use yet.
|
||||
{ SF_FORMAT_SD2, "SD2 (Sound Designer II)", "sd2" },
|
||||
*/
|
||||
{ SF_FORMAT_IRCAM, "SF (Berkeley/IRCAM/CARL)", "sf" },
|
||||
{ SF_FORMAT_VOC, "VOC (Creative Labs)", "voc" },
|
||||
{ SF_FORMAT_W64, "W64 (SoundFoundry WAVE 64)", "w64" },
|
||||
|
@ -170,7 +183,7 @@ static SF_FORMAT_INFO subtype_formats [] =
|
|||
{ SF_FORMAT_VOX_ADPCM, "VOX ADPCM", "vox" },
|
||||
|
||||
{ SF_FORMAT_DPCM_16, "16 bit DPCM", NULL },
|
||||
{ SF_FORMAT_DPCM_8, "8 bit DPCM", NULL },
|
||||
{ SF_FORMAT_DPCM_8, "8 bit DPCM", NULL }
|
||||
} ; /* subtype_formats */
|
||||
|
||||
int
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -35,12 +35,14 @@
|
|||
** logbuffer array.
|
||||
*/
|
||||
|
||||
#define LOG_PUTCHAR(a,b) \
|
||||
{ if ((a)->logindex < SIGNED_SIZEOF ((a)->logbuffer) - 1) \
|
||||
{ (a)->logbuffer [(a)->logindex++] = (b) ; \
|
||||
(a)->logbuffer [(a)->logindex] = 0 ; \
|
||||
} \
|
||||
}
|
||||
static inline void
|
||||
log_putchar (SF_PRIVATE *psf, char ch)
|
||||
{ if (psf->logindex < SIGNED_SIZEOF (psf->logbuffer) - 1)
|
||||
{ psf->logbuffer [psf->logindex++] = ch ;
|
||||
psf->logbuffer [psf->logindex] = 0 ;
|
||||
} ;
|
||||
return ;
|
||||
} /* log_putchar */
|
||||
|
||||
void
|
||||
psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
||||
|
@ -53,12 +55,12 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
|
||||
while ((c = *format++))
|
||||
{ if (c != '%')
|
||||
{ LOG_PUTCHAR (psf, c) ;
|
||||
{ log_putchar (psf, c) ;
|
||||
continue ;
|
||||
} ;
|
||||
|
||||
if (format [0] == '%') /* Handle %% */
|
||||
{ LOG_PUTCHAR (psf, '%') ;
|
||||
{ log_putchar (psf, '%') ;
|
||||
format ++ ;
|
||||
continue ;
|
||||
} ;
|
||||
|
@ -107,11 +109,11 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
width_specifier -= strlen (strptr) ;
|
||||
if (left_align == SF_FALSE)
|
||||
while (width_specifier -- > 0)
|
||||
LOG_PUTCHAR (psf, ' ') ;
|
||||
log_putchar (psf, ' ') ;
|
||||
while (*strptr)
|
||||
LOG_PUTCHAR (psf, *strptr++) ;
|
||||
log_putchar (psf, *strptr++) ;
|
||||
while (width_specifier -- > 0)
|
||||
LOG_PUTCHAR (psf, ' ') ;
|
||||
log_putchar (psf, ' ') ;
|
||||
break ;
|
||||
|
||||
case 'd': /* int */
|
||||
|
@ -134,7 +136,7 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
width_specifier -= width ;
|
||||
|
||||
if (sign_char == ' ')
|
||||
{ LOG_PUTCHAR (psf, ' ') ;
|
||||
{ log_putchar (psf, ' ') ;
|
||||
width_specifier -- ;
|
||||
} ;
|
||||
|
||||
|
@ -143,26 +145,26 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
width_specifier -- ;
|
||||
|
||||
while (width_specifier -- > 0)
|
||||
LOG_PUTCHAR (psf, lead_char) ;
|
||||
log_putchar (psf, lead_char) ;
|
||||
} ;
|
||||
|
||||
if (sign_char == '+' || sign_char == '-')
|
||||
{ LOG_PUTCHAR (psf, sign_char) ;
|
||||
{ log_putchar (psf, sign_char) ;
|
||||
width_specifier -- ;
|
||||
} ;
|
||||
|
||||
if (left_align == SF_FALSE)
|
||||
while (width_specifier -- > 0)
|
||||
LOG_PUTCHAR (psf, lead_char) ;
|
||||
log_putchar (psf, lead_char) ;
|
||||
|
||||
while (tens > 0)
|
||||
{ LOG_PUTCHAR (psf, '0' + d / tens) ;
|
||||
{ log_putchar (psf, '0' + d / tens) ;
|
||||
d %= tens ;
|
||||
tens /= 10 ;
|
||||
} ;
|
||||
|
||||
while (width_specifier -- > 0)
|
||||
LOG_PUTCHAR (psf, lead_char) ;
|
||||
log_putchar (psf, lead_char) ;
|
||||
break ;
|
||||
|
||||
case 'D': /* sf_count_t */
|
||||
|
@ -172,12 +174,12 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
|
||||
if (D == 0)
|
||||
{ while (-- width_specifier > 0)
|
||||
LOG_PUTCHAR (psf, lead_char) ;
|
||||
LOG_PUTCHAR (psf, '0') ;
|
||||
log_putchar (psf, lead_char) ;
|
||||
log_putchar (psf, '0') ;
|
||||
break ;
|
||||
}
|
||||
if (D < 0)
|
||||
{ LOG_PUTCHAR (psf, '-') ;
|
||||
{ log_putchar (psf, '-') ;
|
||||
D = -D ;
|
||||
} ;
|
||||
Tens = 1 ;
|
||||
|
@ -188,12 +190,12 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
} ;
|
||||
|
||||
while (width_specifier > width)
|
||||
{ LOG_PUTCHAR (psf, lead_char) ;
|
||||
{ log_putchar (psf, lead_char) ;
|
||||
width_specifier-- ;
|
||||
} ;
|
||||
|
||||
while (Tens > 0)
|
||||
{ LOG_PUTCHAR (psf, '0' + D / Tens) ;
|
||||
{ log_putchar (psf, '0' + D / Tens) ;
|
||||
D %= Tens ;
|
||||
Tens /= 10 ;
|
||||
} ;
|
||||
|
@ -213,7 +215,7 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
width_specifier -= width ;
|
||||
|
||||
if (sign_char == ' ')
|
||||
{ LOG_PUTCHAR (psf, ' ') ;
|
||||
{ log_putchar (psf, ' ') ;
|
||||
width_specifier -- ;
|
||||
} ;
|
||||
|
||||
|
@ -222,31 +224,31 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
width_specifier -- ;
|
||||
|
||||
while (width_specifier -- > 0)
|
||||
LOG_PUTCHAR (psf, lead_char) ;
|
||||
log_putchar (psf, lead_char) ;
|
||||
} ;
|
||||
|
||||
if (sign_char == '+' || sign_char == '-')
|
||||
{ LOG_PUTCHAR (psf, sign_char) ;
|
||||
{ log_putchar (psf, sign_char) ;
|
||||
width_specifier -- ;
|
||||
} ;
|
||||
|
||||
if (left_align == SF_FALSE)
|
||||
while (width_specifier -- > 0)
|
||||
LOG_PUTCHAR (psf, lead_char) ;
|
||||
log_putchar (psf, lead_char) ;
|
||||
|
||||
while (tens > 0)
|
||||
{ LOG_PUTCHAR (psf, '0' + u / tens) ;
|
||||
{ log_putchar (psf, '0' + u / tens) ;
|
||||
u %= tens ;
|
||||
tens /= 10 ;
|
||||
} ;
|
||||
|
||||
while (width_specifier -- > 0)
|
||||
LOG_PUTCHAR (psf, lead_char) ;
|
||||
log_putchar (psf, lead_char) ;
|
||||
break ;
|
||||
|
||||
case 'c': /* char */
|
||||
c = va_arg (ap, int) & 0xFF ;
|
||||
LOG_PUTCHAR (psf, c) ;
|
||||
log_putchar (psf, c) ;
|
||||
break ;
|
||||
|
||||
case 'x': /* hex */
|
||||
|
@ -255,8 +257,8 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
|
||||
if (d == 0)
|
||||
{ while (--width_specifier > 0)
|
||||
LOG_PUTCHAR (psf, lead_char) ;
|
||||
LOG_PUTCHAR (psf, '0') ;
|
||||
log_putchar (psf, lead_char) ;
|
||||
log_putchar (psf, '0') ;
|
||||
break ;
|
||||
} ;
|
||||
shift = 28 ;
|
||||
|
@ -267,13 +269,13 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
} ;
|
||||
|
||||
while (width > 0 && width_specifier > width)
|
||||
{ LOG_PUTCHAR (psf, lead_char) ;
|
||||
{ log_putchar (psf, lead_char) ;
|
||||
width_specifier-- ;
|
||||
} ;
|
||||
|
||||
while (shift >= 0)
|
||||
{ c = (d >> shift) & 0xF ;
|
||||
LOG_PUTCHAR (psf, (c > 9) ? c + 'A' - 10 : c + '0') ;
|
||||
log_putchar (psf, (c > 9) ? c + 'A' - 10 : c + '0') ;
|
||||
shift -= 4 ;
|
||||
} ;
|
||||
break ;
|
||||
|
@ -296,14 +298,14 @@ psf_log_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
strptr = istr ;
|
||||
while (*strptr)
|
||||
{ c = *strptr++ ;
|
||||
LOG_PUTCHAR (psf, c) ;
|
||||
log_putchar (psf, c) ;
|
||||
} ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
LOG_PUTCHAR (psf, '*') ;
|
||||
LOG_PUTCHAR (psf, c) ;
|
||||
LOG_PUTCHAR (psf, '*') ;
|
||||
log_putchar (psf, '*') ;
|
||||
log_putchar (psf, c) ;
|
||||
log_putchar (psf, '*') ;
|
||||
break ;
|
||||
} /* switch */
|
||||
} /* while */
|
||||
|
@ -387,99 +389,153 @@ psf_asciiheader_printf (SF_PRIVATE *psf, const char *format, ...)
|
|||
** seg. fault when asked to write an int or short to a non-int/short aligned address.
|
||||
*/
|
||||
|
||||
#define PUT_BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 1) \
|
||||
{ (psf)->header [(psf)->headindex++] = (x) ; }
|
||||
static inline void
|
||||
header_put_byte (SF_PRIVATE *psf, char x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 1)
|
||||
psf->header [psf->headindex++] = x ;
|
||||
} /* header_put_byte */
|
||||
|
||||
#if (CPU_IS_BIG_ENDIAN == 1)
|
||||
#define PUT_MARKER(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 4) \
|
||||
{ (psf)->header [(psf)->headindex++] = ((x) >> 24) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 16) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = (x) ; }
|
||||
static inline void
|
||||
header_put_marker (SF_PRIVATE *psf, int x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 4)
|
||||
{ psf->header [psf->headindex++] = (x >> 24) ;
|
||||
psf->header [psf->headindex++] = (x >> 16) ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = x ;
|
||||
} ;
|
||||
} /* header_put_marker */
|
||||
|
||||
#elif (CPU_IS_LITTLE_ENDIAN == 1)
|
||||
#define PUT_MARKER(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 4) \
|
||||
{ (psf)->header [(psf)->headindex++] = (x) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 16) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 24) ; }
|
||||
static inline void
|
||||
header_put_marker (SF_PRIVATE *psf, int x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 4)
|
||||
{ psf->header [psf->headindex++] = x ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = (x >> 16) ;
|
||||
psf->header [psf->headindex++] = (x >> 24) ;
|
||||
} ;
|
||||
} /* header_put_marker */
|
||||
|
||||
#else
|
||||
# error "Cannot determine endian-ness of processor."
|
||||
#endif
|
||||
|
||||
|
||||
#define PUT_BE_SHORT(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 2) \
|
||||
{ (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = (x) ; }
|
||||
static inline void
|
||||
header_put_be_short (SF_PRIVATE *psf, int x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 2)
|
||||
{ psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = x ;
|
||||
} ;
|
||||
} /* header_put_be_short */
|
||||
|
||||
#define PUT_LE_SHORT(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 2) \
|
||||
{ (psf)->header [(psf)->headindex++] = (x) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; }
|
||||
static inline void
|
||||
header_put_le_short (SF_PRIVATE *psf, int x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 2)
|
||||
{ psf->header [psf->headindex++] = x ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
} ;
|
||||
} /* header_put_le_short */
|
||||
|
||||
#define PUT_BE_3BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 3) \
|
||||
{ (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = (x) ; }
|
||||
static inline void
|
||||
header_put_be_3byte (SF_PRIVATE *psf, int x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 3)
|
||||
{ psf->header [psf->headindex++] = (x >> 16) ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = x ;
|
||||
} ;
|
||||
} /* header_put_be_3byte */
|
||||
|
||||
#define PUT_LE_3BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 3) \
|
||||
{ (psf)->header [(psf)->headindex++] = (x) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 16) ; }
|
||||
static inline void
|
||||
header_put_le_3byte (SF_PRIVATE *psf, int x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 3)
|
||||
{ psf->header [psf->headindex++] = x ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = (x >> 16) ;
|
||||
} ;
|
||||
} /* header_put_le_3byte */
|
||||
|
||||
#define PUT_BE_INT(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 4) \
|
||||
{ (psf)->header [(psf)->headindex++] = ((x) >> 24) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 16) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = (x) ; }
|
||||
static inline void
|
||||
header_put_be_int (SF_PRIVATE *psf, int x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 4)
|
||||
{ psf->header [psf->headindex++] = (x >> 24) ;
|
||||
psf->header [psf->headindex++] = (x >> 16) ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = x ;
|
||||
} ;
|
||||
} /* header_put_be_int */
|
||||
|
||||
#define PUT_LE_INT(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 4) \
|
||||
{ (psf)->header [(psf)->headindex++] = (x) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 16) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 24) ; }
|
||||
static inline void
|
||||
header_put_le_int (SF_PRIVATE *psf, int x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 4)
|
||||
{ psf->header [psf->headindex++] = x ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = (x >> 16) ;
|
||||
psf->header [psf->headindex++] = (x >> 24) ;
|
||||
} ;
|
||||
} /* header_put_le_int */
|
||||
|
||||
#if (SIZEOF_SF_COUNT_T == 4)
|
||||
#define PUT_BE_8BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 8) \
|
||||
{ (psf)->header [(psf)->headindex++] = 0 ; \
|
||||
(psf)->header [(psf)->headindex++] = 0 ; \
|
||||
(psf)->header [(psf)->headindex++] = 0 ; \
|
||||
(psf)->header [(psf)->headindex++] = 0 ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 24) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 16) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = (x) ; }
|
||||
|
||||
#define PUT_LE_8BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 8) \
|
||||
{ (psf)->header [(psf)->headindex++] = (x) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 16) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 24) ; \
|
||||
(psf)->header [(psf)->headindex++] = 0 ; \
|
||||
(psf)->header [(psf)->headindex++] = 0 ; \
|
||||
(psf)->header [(psf)->headindex++] = 0 ; \
|
||||
(psf)->header [(psf)->headindex++] = 0 ; }
|
||||
static inline void
|
||||
header_put_be_8byte (SF_PRIVATE *psf, sf_count_t x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 8)
|
||||
{ psf->header [psf->headindex++] = 0 ;
|
||||
psf->header [psf->headindex++] = 0 ;
|
||||
psf->header [psf->headindex++] = 0 ;
|
||||
psf->header [psf->headindex++] = 0 ;
|
||||
psf->header [psf->headindex++] = (x >> 24) ;
|
||||
psf->header [psf->headindex++] = (x >> 16) ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = x ;
|
||||
} ;
|
||||
} /* header_put_be_8byte */
|
||||
|
||||
static inline void
|
||||
header_put_le_8byte (SF_PRIVATE *psf, sf_count_t x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 8)
|
||||
{ psf->header [psf->headindex++] = x ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = (x >> 16) ;
|
||||
psf->header [psf->headindex++] = (x >> 24) ;
|
||||
psf->header [psf->headindex++] = 0 ;
|
||||
psf->header [psf->headindex++] = 0 ;
|
||||
psf->header [psf->headindex++] = 0 ;
|
||||
psf->header [psf->headindex++] = 0 ;
|
||||
} ;
|
||||
} /* header_put_le_8byte */
|
||||
|
||||
#elif (SIZEOF_SF_COUNT_T == 8)
|
||||
#define PUT_BE_8BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 8) \
|
||||
{ (psf)->header [(psf)->headindex++] = ((x) >> 56) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 48) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 40) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 32) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 24) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 16) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = (x) ; }
|
||||
|
||||
#define PUT_LE_8BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 8) \
|
||||
{ (psf)->header [(psf)->headindex++] = (x) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 8) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 16) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 24) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 32) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 40) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 48) ; \
|
||||
(psf)->header [(psf)->headindex++] = ((x) >> 56) ; }
|
||||
static inline void
|
||||
header_put_be_8byte (SF_PRIVATE *psf, sf_count_t x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 8)
|
||||
{ psf->header [psf->headindex++] = (x >> 56) ;
|
||||
psf->header [psf->headindex++] = (x >> 48) ;
|
||||
psf->header [psf->headindex++] = (x >> 40) ;
|
||||
psf->header [psf->headindex++] = (x >> 32) ;
|
||||
psf->header [psf->headindex++] = (x >> 24) ;
|
||||
psf->header [psf->headindex++] = (x >> 16) ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = x ;
|
||||
} ;
|
||||
} /* header_put_be_8byte */
|
||||
|
||||
static inline void
|
||||
header_put_le_8byte (SF_PRIVATE *psf, sf_count_t x)
|
||||
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 8)
|
||||
{ psf->header [psf->headindex++] = x ;
|
||||
psf->header [psf->headindex++] = (x >> 8) ;
|
||||
psf->header [psf->headindex++] = (x >> 16) ;
|
||||
psf->header [psf->headindex++] = (x >> 24) ;
|
||||
psf->header [psf->headindex++] = (x >> 32) ;
|
||||
psf->header [psf->headindex++] = (x >> 40) ;
|
||||
psf->header [psf->headindex++] = (x >> 48) ;
|
||||
psf->header [psf->headindex++] = (x >> 56) ;
|
||||
} ;
|
||||
} /* header_put_le_8byte */
|
||||
|
||||
#else
|
||||
#error "SIZEOF_SF_COUNT_T is not defined."
|
||||
#endif
|
||||
|
@ -521,23 +577,23 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
|||
|
||||
case 'm' :
|
||||
data = va_arg (argptr, unsigned int) ;
|
||||
PUT_MARKER (psf, data) ;
|
||||
header_put_marker (psf, data) ;
|
||||
count += 4 ;
|
||||
break ;
|
||||
|
||||
case '1' :
|
||||
data = va_arg (argptr, unsigned int) ;
|
||||
PUT_BYTE (psf, data) ;
|
||||
header_put_byte (psf, data) ;
|
||||
count += 1 ;
|
||||
break ;
|
||||
|
||||
case '2' :
|
||||
data = va_arg (argptr, unsigned int) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
{ PUT_BE_SHORT (psf, data) ;
|
||||
{ header_put_be_short (psf, data) ;
|
||||
}
|
||||
else
|
||||
{ PUT_LE_SHORT (psf, data) ;
|
||||
{ header_put_le_short (psf, data) ;
|
||||
} ;
|
||||
count += 2 ;
|
||||
break ;
|
||||
|
@ -545,10 +601,10 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
|||
case '3' : /* tribyte */
|
||||
data = va_arg (argptr, unsigned int) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
{ PUT_BE_3BYTE (psf, data) ;
|
||||
{ header_put_be_3byte (psf, data) ;
|
||||
}
|
||||
else
|
||||
{ PUT_LE_3BYTE (psf, data) ;
|
||||
{ header_put_le_3byte (psf, data) ;
|
||||
} ;
|
||||
count += 3 ;
|
||||
break ;
|
||||
|
@ -556,10 +612,10 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
|||
case '4' :
|
||||
data = va_arg (argptr, unsigned int) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
{ PUT_BE_INT (psf, data) ;
|
||||
{ header_put_be_int (psf, data) ;
|
||||
}
|
||||
else
|
||||
{ PUT_LE_INT (psf, data) ;
|
||||
{ header_put_le_int (psf, data) ;
|
||||
} ;
|
||||
count += 4 ;
|
||||
break ;
|
||||
|
@ -567,21 +623,21 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
|||
case '8' :
|
||||
countdata = va_arg (argptr, sf_count_t) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG && trunc_8to4 == SF_FALSE)
|
||||
{ PUT_BE_8BYTE (psf, countdata) ;
|
||||
{ header_put_be_8byte (psf, countdata) ;
|
||||
count += 8 ;
|
||||
}
|
||||
else if (psf->rwf_endian == SF_ENDIAN_LITTLE && trunc_8to4 == SF_FALSE)
|
||||
{ PUT_LE_8BYTE (psf, countdata) ;
|
||||
{ header_put_le_8byte (psf, countdata) ;
|
||||
count += 8 ;
|
||||
}
|
||||
else if (psf->rwf_endian == SF_ENDIAN_BIG && trunc_8to4 == SF_TRUE)
|
||||
{ longdata = countdata & 0xFFFFFFFF ;
|
||||
PUT_BE_INT (psf, longdata) ;
|
||||
header_put_be_int (psf, longdata) ;
|
||||
count += 4 ;
|
||||
}
|
||||
else if (psf->rwf_endian == SF_ENDIAN_LITTLE && trunc_8to4 == SF_TRUE)
|
||||
{ longdata = countdata & 0xFFFFFFFF ;
|
||||
PUT_LE_INT (psf, longdata) ;
|
||||
header_put_le_int (psf, longdata) ;
|
||||
count += 4 ;
|
||||
}
|
||||
break ;
|
||||
|
@ -608,15 +664,14 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
|||
break ;
|
||||
|
||||
case 's' :
|
||||
/* Write a C string (guaranteed to have a zero terminator). */
|
||||
strptr = va_arg (argptr, char *) ;
|
||||
size = strlen (strptr) + 1 ;
|
||||
size += (size & 1) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
{ PUT_BE_INT (psf, size) ;
|
||||
}
|
||||
header_put_be_int (psf, size) ;
|
||||
else
|
||||
{ PUT_LE_INT (psf, size) ;
|
||||
} ;
|
||||
header_put_le_int (psf, size) ;
|
||||
memcpy (&(psf->header [psf->headindex]), strptr, size) ;
|
||||
psf->headindex += size ;
|
||||
psf->header [psf->headindex - 1] = 0 ;
|
||||
|
@ -624,11 +679,21 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
|||
break ;
|
||||
|
||||
case 'S' :
|
||||
strptr = va_arg (argptr, char *) ;
|
||||
size = strlen (strptr) + 1 ;
|
||||
memcpy (&(psf->header [psf->headindex]), strptr, size) ;
|
||||
/*
|
||||
** Write an AIFF style string (no zero terminator but possibly
|
||||
** an extra pad byte if the string length is odd).
|
||||
*/
|
||||
strptr = va_arg (argptr, char *) ;
|
||||
size = strlen (strptr) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
header_put_be_int (psf, size) ;
|
||||
else
|
||||
header_put_le_int (psf, size) ;
|
||||
memcpy (&(psf->header [psf->headindex]), strptr, size + 1) ;
|
||||
size += (size & 1) ;
|
||||
psf->headindex += size ;
|
||||
count += size ;
|
||||
psf->header [psf->headindex] = 0 ;
|
||||
count += 4 + size ;
|
||||
break ;
|
||||
|
||||
case 'b' :
|
||||
|
@ -657,7 +722,7 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...)
|
|||
break ;
|
||||
|
||||
case 'j' :
|
||||
size = va_arg (argptr, int) ;
|
||||
size = va_arg (argptr, size_t) ;
|
||||
psf->headindex += size ;
|
||||
count = size ;
|
||||
break ;
|
||||
|
@ -731,13 +796,23 @@ static int
|
|||
header_read (SF_PRIVATE *psf, void *ptr, int bytes)
|
||||
{ int count = 0 ;
|
||||
|
||||
if (psf->headindex + bytes > SIGNED_SIZEOF (psf->header))
|
||||
{ if (psf->headend < SIGNED_SIZEOF (psf->header))
|
||||
psf_log_printf (psf, "Warning : Further header read would overflow buffer.\n") ;
|
||||
psf->headend = SIGNED_SIZEOF (psf->header) ;
|
||||
if (psf->headindex >= SIGNED_SIZEOF (psf->header))
|
||||
{ memset (ptr, 0, SIGNED_SIZEOF (psf->header) - psf->headindex) ;
|
||||
|
||||
/* This is the best that we can do. */
|
||||
return psf_fread (ptr, 1, bytes, psf) ;
|
||||
psf_fseek (psf, bytes, SEEK_CUR) ;
|
||||
return bytes ;
|
||||
} ;
|
||||
|
||||
if (psf->headindex + bytes > SIGNED_SIZEOF (psf->header))
|
||||
{ int most ;
|
||||
|
||||
most = SIGNED_SIZEOF (psf->header) - psf->headindex ;
|
||||
psf_fread (psf->header + psf->headend, 1, most, psf) ;
|
||||
memset (ptr + most, 0, bytes - most) ;
|
||||
|
||||
psf_fseek (psf, bytes - most, SEEK_CUR) ;
|
||||
return bytes ;
|
||||
} ;
|
||||
|
||||
if (psf->headindex + bytes > psf->headend)
|
||||
|
@ -879,11 +954,13 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
|
|||
|
||||
case '1' :
|
||||
charptr = va_arg (argptr, char*) ;
|
||||
*charptr = 0 ;
|
||||
byte_count += header_read (psf, charptr, sizeof (char)) ;
|
||||
break ;
|
||||
|
||||
case '2' :
|
||||
shortptr = va_arg (argptr, unsigned short*) ;
|
||||
*shortptr = 0 ;
|
||||
ucptr = (unsigned char*) shortptr ;
|
||||
byte_count += header_read (psf, ucptr, sizeof (short)) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
|
@ -894,6 +971,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
|
|||
|
||||
case '3' :
|
||||
intptr = va_arg (argptr, unsigned int*) ;
|
||||
*intptr = 0 ;
|
||||
byte_count += header_read (psf, sixteen_bytes, 3) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
*intptr = GET_BE_3BYTE (sixteen_bytes) ;
|
||||
|
@ -903,6 +981,7 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
|
|||
|
||||
case '4' :
|
||||
intptr = va_arg (argptr, unsigned int*) ;
|
||||
*intptr = 0 ;
|
||||
ucptr = (unsigned char*) intptr ;
|
||||
byte_count += header_read (psf, ucptr, sizeof (int)) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
|
@ -912,7 +991,8 @@ psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...)
|
|||
break ;
|
||||
|
||||
case '8' :
|
||||
countptr = va_arg (argptr, sf_count_t*) ;
|
||||
countptr = va_arg (argptr, sf_count_t *) ;
|
||||
*countptr = 0 ;
|
||||
byte_count += header_read (psf, sixteen_bytes, 8) ;
|
||||
if (psf->rwf_endian == SF_ENDIAN_BIG)
|
||||
countdata = GET_BE_8BYTE (sixteen_bytes) ;
|
||||
|
@ -1015,19 +1095,19 @@ psf_default_seek (SF_PRIVATE *psf, int mode, sf_count_t samples_from_start)
|
|||
|
||||
if (! (psf->blockwidth && psf->dataoffset >= 0))
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (! psf->sf.seekable)
|
||||
{ psf->error = SFE_NOT_SEEKABLE ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
position = psf->dataoffset + psf->blockwidth * samples_from_start ;
|
||||
|
||||
if ((retval = psf_fseek (psf, position, SEEK_SET)) != position)
|
||||
{ psf->error = SFE_SEEK_FAILED ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
mode = mode ;
|
||||
|
@ -1073,7 +1153,7 @@ psf_log_SF_INFO (SF_PRIVATE *psf)
|
|||
{ psf_log_printf (psf, "---------------------------------\n") ;
|
||||
|
||||
psf_log_printf (psf, " Sample rate : %d\n", psf->sf.samplerate) ;
|
||||
psf_log_printf (psf, " Frames : %C\n", psf->sf.frames) ;
|
||||
psf_log_printf (psf, " Frames : %D\n", psf->sf.frames) ;
|
||||
psf_log_printf (psf, " Channels : %d\n", psf->sf.channels) ;
|
||||
|
||||
psf_log_printf (psf, " Format : 0x%X\n", psf->sf.format) ;
|
||||
|
@ -1086,6 +1166,25 @@ psf_log_SF_INFO (SF_PRIVATE *psf)
|
|||
/*========================================================================================
|
||||
*/
|
||||
|
||||
SF_INSTRUMENT *
|
||||
psf_instrument_alloc (void)
|
||||
{ SF_INSTRUMENT *instr ;
|
||||
|
||||
instr = calloc (1, sizeof (SF_INSTRUMENT)) ;
|
||||
|
||||
if (instr == NULL)
|
||||
return NULL ;
|
||||
|
||||
/* Set non-zero default values. */
|
||||
instr->basenote = -1 ;
|
||||
instr->velocity_lo = -1 ;
|
||||
instr->velocity_hi = -1 ;
|
||||
instr->key_lo = -1 ;
|
||||
instr->key_hi = -1 ;
|
||||
|
||||
return instr ;
|
||||
} /* psf_instrument_alloc */
|
||||
|
||||
void*
|
||||
psf_memset (void *s, int c, sf_count_t len)
|
||||
{ char *ptr ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -16,19 +16,27 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_H_INCLUDED
|
||||
#define COMMON_H_INCLUDED
|
||||
#ifndef SNDFILE_COMMON_H
|
||||
#define SNDFILE_COMMON_H
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#ifndef SNDFILE_H
|
||||
#include <sndfile.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifndef SNDFILE_H
|
||||
#include "sndfile.h"
|
||||
#elif HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#error "This code is not designed to be compiled with a C++ compiler."
|
||||
#endif
|
||||
|
||||
#ifdef UNUSED
|
||||
#elif defined (__GNUC__)
|
||||
# define UNUSED(x) UNUSED_ ## x __attribute__ ((unused))
|
||||
|
@ -39,19 +47,19 @@
|
|||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define WARN_UNUSED __attribute__((warn_unused_result))
|
||||
# define WARN_UNUSED __attribute__ ((warn_unused_result))
|
||||
#else
|
||||
# define WARN_UNUSED
|
||||
#endif
|
||||
|
||||
#define SF_BUFFER_LEN (8192*2)
|
||||
#define SF_FILENAME_LEN (512)
|
||||
#define SF_HEADER_LEN (4096)
|
||||
#define SF_TEXT_LEN (1024)
|
||||
#define SF_SYSERR_LEN (256)
|
||||
#define SF_MAX_STRINGS (16)
|
||||
#define SF_STR_BUFFER_LEN (8192)
|
||||
#define SF_HEADER_LEN (4100 + SF_STR_BUFFER_LEN)
|
||||
|
||||
#define SF_SEEK_ERROR ((sf_count_t) -1)
|
||||
#define PSF_SEEK_ERROR ((sf_count_t) -1)
|
||||
|
||||
|
||||
#define BITWIDTH2BYTES(x) (((x) + 7) / 8)
|
||||
|
@ -111,7 +119,6 @@ enum
|
|||
SF_FORMAT_KRZ = 0x40E0000, /* Kurzweil sampler file */
|
||||
SF_FORMAT_WMA = 0x4100000, /* Windows Media Audio. */
|
||||
SF_FORMAT_SHN = 0x4110000, /* Shorten. */
|
||||
SF_FORMAT_FLAC = 0x4120000,
|
||||
|
||||
/* Unsupported encodings. */
|
||||
SF_FORMAT_VORBIS = 0x1001,
|
||||
|
@ -128,13 +135,21 @@ enum
|
|||
*/
|
||||
|
||||
typedef struct
|
||||
{ float value ; /* signed value of peak */
|
||||
unsigned int position ; /* the sample frame for the peak */
|
||||
{ double value ; /* signed value of peak */
|
||||
sf_count_t position ; /* the sample frame for the peak */
|
||||
} PEAK_POS ;
|
||||
|
||||
typedef struct
|
||||
{ unsigned int version ; /* version of the PEAK chunk */
|
||||
{ /* libsndfile internal : write a PEAK chunk at the start or end of the file? */
|
||||
int peak_loc ;
|
||||
|
||||
/* WAV/AIFF */
|
||||
unsigned int version ; /* version of the PEAK chunk */
|
||||
unsigned int timestamp ; /* secs since 1/1/1970 */
|
||||
|
||||
/* CAF */
|
||||
unsigned int edit_number ;
|
||||
|
||||
#if HAVE_FLEXIBLE_ARRAY
|
||||
/* the per channel peak info */
|
||||
PEAK_POS peaks [] ;
|
||||
|
@ -142,13 +157,18 @@ typedef struct
|
|||
/*
|
||||
** This is not ISO compliant C. It works on some compilers which
|
||||
** don't support the ISO standard flexible struct array which is
|
||||
** used above. If your compiler doesn't ike this I suggest you find
|
||||
** used above. If your compiler doesn't like this I suggest you find
|
||||
** youself a 1999 ISO C standards compilant compiler. GCC-3.X is
|
||||
** highly recommended.
|
||||
*/
|
||||
PEAK_POS peaks [0] ;
|
||||
#endif
|
||||
} PEAK_CHUNK ;
|
||||
} PEAK_INFO ;
|
||||
|
||||
static inline PEAK_INFO *
|
||||
peak_info_calloc (int channels)
|
||||
{ return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
|
||||
} /* peak_info_calloc */
|
||||
|
||||
typedef struct
|
||||
{ int type ;
|
||||
|
@ -156,6 +176,11 @@ typedef struct
|
|||
char *str ;
|
||||
} STR_DATA ;
|
||||
|
||||
static inline size_t
|
||||
make_size_t (int x)
|
||||
{ return (size_t) x ;
|
||||
} /* size_t_of_int */
|
||||
|
||||
/*=======================================================================================
|
||||
** SF_PRIVATE stuct - a pointer to this struct is passed back to the caller of the
|
||||
** sf_open_XXXX functions. The caller however has no knowledge of the struct's
|
||||
|
@ -181,6 +206,7 @@ typedef struct sf_private_tag
|
|||
|
||||
char filepath [SF_FILENAME_LEN] ;
|
||||
char rsrcpath [SF_FILENAME_LEN] ;
|
||||
char directory [SF_FILENAME_LEN] ;
|
||||
char filename [SF_FILENAME_LEN / 4] ;
|
||||
|
||||
char syserr [SF_SYSERR_LEN] ;
|
||||
|
@ -196,7 +222,7 @@ typedef struct sf_private_tag
|
|||
** sound files.
|
||||
*/
|
||||
STR_DATA strings [SF_MAX_STRINGS] ;
|
||||
char str_storage [SF_BUFFER_LEN] ;
|
||||
char str_storage [SF_STR_BUFFER_LEN] ;
|
||||
char *str_end ;
|
||||
int str_flags ;
|
||||
|
||||
|
@ -209,10 +235,17 @@ typedef struct sf_private_tag
|
|||
int has_text ;
|
||||
int do_not_close_descriptor ;
|
||||
|
||||
/* File descriptors for the file and (possibly) the resource fork. */
|
||||
int filedes, rsrcdes ;
|
||||
#if USE_WINDOWS_API
|
||||
/*
|
||||
** These fields can only be used in src/file_io.c.
|
||||
** They are basically the same as a windows file HANDLE.
|
||||
*/
|
||||
void *hfile, *hrsrc, *hsaved ;
|
||||
#else
|
||||
/* These fields can only be used in src/file_io.c. */
|
||||
int filedes, rsrcdes, savedes ;
|
||||
#endif
|
||||
|
||||
int end_of_file ;
|
||||
int error ;
|
||||
|
||||
int mode ; /* Open mode : SFM_READ, SFM_WRITE or SFM_RDWR. */
|
||||
|
@ -236,12 +269,11 @@ typedef struct sf_private_tag
|
|||
SF_INFO sf ;
|
||||
|
||||
int have_written ; /* Has a single write been done to the file? */
|
||||
int has_peak ; /* Has a PEAK chunk (AIFF and WAVE) been read? */
|
||||
int peak_loc ; /* Write a PEAK chunk at the start or end of the file? */
|
||||
PEAK_CHUNK *pchunk ;
|
||||
PEAK_INFO *peak_info ;
|
||||
|
||||
/* Loop Info */
|
||||
SF_LOOP_INFO *loop_info ;
|
||||
SF_INSTRUMENT *instrument ;
|
||||
|
||||
sf_count_t filelength ; /* Overall length of (embedded) file. */
|
||||
sf_count_t fileoffset ; /* Offset in number of bytes from beginning of file. */
|
||||
|
@ -282,25 +314,38 @@ typedef struct sf_private_tag
|
|||
sf_count_t (*read_float) (struct sf_private_tag*, float *ptr, sf_count_t len) ;
|
||||
sf_count_t (*read_double) (struct sf_private_tag*, double *ptr, sf_count_t len) ;
|
||||
|
||||
sf_count_t (*write_short) (struct sf_private_tag*, short *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_int) (struct sf_private_tag*, int *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_float) (struct sf_private_tag*, float *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_double) (struct sf_private_tag*, double *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_short) (struct sf_private_tag*, const short *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_int) (struct sf_private_tag*, const int *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_float) (struct sf_private_tag*, const float *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_double) (struct sf_private_tag*, const double *ptr, sf_count_t len) ;
|
||||
|
||||
sf_count_t (*seek) (struct sf_private_tag*, int mode, sf_count_t samples_from_start) ;
|
||||
int (*write_header) (struct sf_private_tag*, int calc_length) ;
|
||||
int (*command) (struct sf_private_tag*, int command, void *data, int datasize) ;
|
||||
int (*close) (struct sf_private_tag*) ;
|
||||
|
||||
/*
|
||||
** Separate close functions for the codec and the container.
|
||||
** The codec close function is always called first.
|
||||
*/
|
||||
int (*codec_close) (struct sf_private_tag*) ;
|
||||
int (*container_close) (struct sf_private_tag*) ;
|
||||
|
||||
char *format_desc ;
|
||||
|
||||
/* Virtual I/O functions. */
|
||||
int virtual_io ;
|
||||
SF_VIRTUAL_IO vio ;
|
||||
void *vio_user_data ;
|
||||
} SF_PRIVATE ;
|
||||
|
||||
|
||||
|
||||
enum
|
||||
{ SFE_NO_ERROR = SF_ERR_NO_ERROR,
|
||||
SFE_BAD_OPEN_FORMAT = SF_ERR_UNRECOGNISED_FORMAT,
|
||||
SFE_SYSTEM = SF_ERR_SYSTEM,
|
||||
{ SFE_NO_ERROR = SF_ERR_NO_ERROR,
|
||||
SFE_BAD_OPEN_FORMAT = SF_ERR_UNRECOGNISED_FORMAT,
|
||||
SFE_SYSTEM = SF_ERR_SYSTEM,
|
||||
SFE_MALFORMED_FILE = SF_ERR_MALFORMED_FILE,
|
||||
SFE_UNSUPPORTED_ENCODING = SF_ERR_UNSUPPORTED_ENCODING,
|
||||
|
||||
SFE_BAD_FILE,
|
||||
SFE_BAD_FILE_READ,
|
||||
|
@ -326,12 +371,13 @@ enum
|
|||
SFE_NO_PIPE_WRITE,
|
||||
|
||||
SFE_INTERNAL,
|
||||
SFE_LOG_OVERRUN,
|
||||
SFE_BAD_CONTROL_CMD,
|
||||
SFE_BAD_ENDIAN,
|
||||
SFE_CHANNEL_COUNT,
|
||||
SFE_BAD_RDWR_FORMAT,
|
||||
|
||||
SFE_BAD_VIRTUAL_IO,
|
||||
|
||||
SFE_INTERLEAVE_MODE,
|
||||
SFE_INTERLEAVE_SEEK,
|
||||
SFE_INTERLEAVE_READ,
|
||||
|
@ -360,13 +406,13 @@ enum
|
|||
SFE_WAV_NO_WAVE,
|
||||
SFE_WAV_NO_FMT,
|
||||
SFE_WAV_FMT_SHORT,
|
||||
SFE_WAV_FMT_TOO_BIG,
|
||||
SFE_WAV_BAD_FACT,
|
||||
SFE_WAV_BAD_PEAK,
|
||||
SFE_WAV_PEAK_B4_FMT,
|
||||
SFE_WAV_BAD_FORMAT,
|
||||
SFE_WAV_BAD_BLOCKALIGN,
|
||||
SFE_WAV_NO_DATA,
|
||||
SFE_WAV_BAD_LIST,
|
||||
SFE_WAV_ADPCM_NOT4BIT,
|
||||
SFE_WAV_ADPCM_CHANNELS,
|
||||
SFE_WAV_GSM610_FORMAT,
|
||||
|
@ -468,6 +514,13 @@ enum
|
|||
SFE_SD2_BAD_RSRC,
|
||||
SFE_SD2_BAD_SAMPLE_SIZE,
|
||||
|
||||
SFE_FLAC_BAD_HEADER,
|
||||
SFE_FLAC_NEW_DECODER,
|
||||
SFE_FLAC_INIT_DECODER,
|
||||
SFE_FLAC_LOST_SYNC,
|
||||
SFE_FLAC_BAD_SAMPLE_RATE,
|
||||
SFE_FLAC_UNKOWN_ERROR,
|
||||
|
||||
SFE_MAX_ERROR /* This must be last in list. */
|
||||
} ;
|
||||
|
||||
|
@ -549,8 +602,10 @@ int macos_guess_file_type (SF_PRIVATE *psf, const char *filename) ;
|
|||
|
||||
int psf_fopen (SF_PRIVATE *psf, const char *pathname, int flags) ;
|
||||
int psf_set_stdio (SF_PRIVATE *psf, int mode) ;
|
||||
int psf_filedes_valid (SF_PRIVATE *psf) ;
|
||||
int psf_file_valid (SF_PRIVATE *psf) ;
|
||||
void psf_set_file (SF_PRIVATE *psf, int fd) ;
|
||||
void psf_init_files (SF_PRIVATE *psf) ;
|
||||
void psf_use_rsrc (SF_PRIVATE *psf, int on_off) ;
|
||||
|
||||
sf_count_t psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence) ;
|
||||
sf_count_t psf_fread (void *ptr, sf_count_t bytes, sf_count_t count, SF_PRIVATE *psf) ;
|
||||
|
@ -559,6 +614,8 @@ sf_count_t psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf) ;
|
|||
sf_count_t psf_ftell (SF_PRIVATE *psf) ;
|
||||
sf_count_t psf_get_filelen (SF_PRIVATE *psf) ;
|
||||
|
||||
void psf_fsync (SF_PRIVATE *psf) ;
|
||||
|
||||
int psf_is_pipe (SF_PRIVATE *psf) ;
|
||||
|
||||
int psf_ftruncate (SF_PRIVATE *psf, sf_count_t len) ;
|
||||
|
@ -579,7 +636,6 @@ int psf_ferror (SF_PRIVATE *psf) ;
|
|||
|
||||
int aiff_open (SF_PRIVATE *psf) ;
|
||||
int au_open (SF_PRIVATE *psf) ;
|
||||
int au_nh_open (SF_PRIVATE *psf) ; /* Headerless version of AU. */
|
||||
int avr_open (SF_PRIVATE *psf) ;
|
||||
int htk_open (SF_PRIVATE *psf) ;
|
||||
int ircam_open (SF_PRIVATE *psf) ;
|
||||
|
@ -596,9 +652,12 @@ int voc_open (SF_PRIVATE *psf) ;
|
|||
int w64_open (SF_PRIVATE *psf) ;
|
||||
int wav_open (SF_PRIVATE *psf) ;
|
||||
int xi_open (SF_PRIVATE *psf) ;
|
||||
int flac_open (SF_PRIVATE *psf) ;
|
||||
int caf_open (SF_PRIVATE *psf) ;
|
||||
|
||||
/* In progress. Do not currently work. */
|
||||
|
||||
int mpeg_open (SF_PRIVATE *psf) ;
|
||||
int ogg_open (SF_PRIVATE *psf) ;
|
||||
int rx2_open (SF_PRIVATE *psf) ;
|
||||
int txw_open (SF_PRIVATE *psf) ;
|
||||
|
@ -611,14 +670,16 @@ int macbinary3_open (SF_PRIVATE *psf) ;
|
|||
** Init functions for a number of common data encodings.
|
||||
*/
|
||||
|
||||
int pcm_init (SF_PRIVATE *psf) ;
|
||||
int ulaw_init (SF_PRIVATE *psf) ;
|
||||
int alaw_init (SF_PRIVATE *psf) ;
|
||||
int float32_init (SF_PRIVATE *psf) ;
|
||||
int double64_init (SF_PRIVATE *psf) ;
|
||||
int dwvw_init (SF_PRIVATE *psf, int bitwidth) ;
|
||||
int gsm610_init (SF_PRIVATE *psf) ;
|
||||
int vox_adpcm_init (SF_PRIVATE *psf) ;
|
||||
int pcm_init (SF_PRIVATE *psf) ;
|
||||
int ulaw_init (SF_PRIVATE *psf) ;
|
||||
int alaw_init (SF_PRIVATE *psf) ;
|
||||
int float32_init (SF_PRIVATE *psf) ;
|
||||
int double64_init (SF_PRIVATE *psf) ;
|
||||
int dwvw_init (SF_PRIVATE *psf, int bitwidth) ;
|
||||
int gsm610_init (SF_PRIVATE *psf) ;
|
||||
int vox_adpcm_init (SF_PRIVATE *psf) ;
|
||||
int flac_init (SF_PRIVATE *psf) ;
|
||||
int g72x_init (SF_PRIVATE * psf) ;
|
||||
|
||||
int dither_init (SF_PRIVATE *psf, int mode) ;
|
||||
|
||||
|
@ -635,12 +696,14 @@ int interleave_init (SF_PRIVATE *psf) ;
|
|||
|
||||
void *psf_memset (void *s, int c, sf_count_t n) ;
|
||||
|
||||
SF_INSTRUMENT * psf_instrument_alloc (void) ;
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
** Here's how we fix systems which don't snprintf / vsnprintf.
|
||||
** Systems without these functions should use the
|
||||
*/
|
||||
|
||||
#if (defined (WIN32) || defined (_WIN32))
|
||||
#if USE_WINDOWS_API
|
||||
#define LSF_SNPRINTF _snprintf
|
||||
#elif (HAVE_SNPRINTF && ! FORCE_MISSING_SNPRINTF)
|
||||
#define LSF_SNPRINTF snprintf
|
||||
|
@ -649,7 +712,7 @@ int missing_snprintf (char *str, size_t n, char const *fmt, ...) ;
|
|||
#define LSF_SNPRINTF missing_snprintf
|
||||
#endif
|
||||
|
||||
#if (defined (WIN32) || defined (_WIN32))
|
||||
#if USE_WINDOWS_API
|
||||
#define LSF_VSNPRINTF _vsnprintf
|
||||
#elif (HAVE_VSNPRINTF && ! FORCE_MISSING_SNPRINTF)
|
||||
#define LSF_VSNPRINTF vsnprintf
|
||||
|
@ -658,8 +721,6 @@ int missing_vsnprintf (char *str, size_t n, const char *fmt, ...) ;
|
|||
#define LSF_VSNPRINTF missing_vsnprintf
|
||||
#endif
|
||||
|
||||
#endif /* COMMON_H_INCLUDED */
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
** Extra commands for sf_command(). Not for public use yet.
|
||||
*/
|
||||
|
@ -682,6 +743,9 @@ int sf_dither_int (const SF_DITHER_INFO *dither, const int *in, int *out, int c
|
|||
int sf_dither_float (const SF_DITHER_INFO *dither, const float *in, float *out, int count) ;
|
||||
int sf_dither_double (const SF_DITHER_INFO *dither, const double *in, double *out, int count) ;
|
||||
#endif
|
||||
|
||||
#endif /* SNDFILE_COMMON_H */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* src/config.h. Generated by configure. */
|
||||
/* src/config.h.in. Generated from configure.ac by autoheader. */
|
||||
//#error WTF
|
||||
|
||||
/* Set to 1 if the compile is GNU GCC. */
|
||||
#define COMPILER_IS_GCC 1
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
|||
#define ENABLE_EXPERIMENTAL_CODE 0
|
||||
|
||||
/* Major version of GCC or 3 otherwise. */
|
||||
#define GCC_MAJOR_VERSION 3
|
||||
#define GCC_MAJOR_VERSION 4
|
||||
|
||||
/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
|
||||
/* #undef HAVE_ALSA_ASOUNDLIB_H */
|
||||
|
@ -46,6 +46,12 @@
|
|||
/* Define to 1 if you have the `fdatasync' function. */
|
||||
/* #undef HAVE_FDATASYNC */
|
||||
|
||||
/* Define to 1 if you have libflac 1.1.1 */
|
||||
/* #undef HAVE_FLAC_1_1_1 */
|
||||
|
||||
/* Define to 1 if you have the <FLAC/all.h> header file. */
|
||||
/* #undef HAVE_FLAC_ALL_H */
|
||||
|
||||
/* Set to 1 if the compile supports the struct hack. */
|
||||
#define HAVE_FLEXIBLE_ARRAY 1
|
||||
|
||||
|
@ -82,11 +88,14 @@
|
|||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#define HAVE_LIBM 1
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define if you have C99's lrint function. */
|
||||
/* #undef HAVE_LRINT */
|
||||
#define HAVE_LRINT 1
|
||||
|
||||
/* Define if you have C99's lrintf function. */
|
||||
/* #undef HAVE_LRINTF */
|
||||
#define HAVE_LRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `lseek' function. */
|
||||
#define HAVE_LSEEK 1
|
||||
|
@ -115,9 +124,15 @@
|
|||
/* Define to 1 if you have the `realloc' function. */
|
||||
#define HAVE_REALLOC 1
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#define HAVE_SETLOCALE 1
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Set to 1 if you have libsqlite3. */
|
||||
#define HAVE_SQLITE3 0
|
||||
|
||||
/* Define to 1 if the system has the type `ssize_t'. */
|
||||
#define HAVE_SSIZE_T 1
|
||||
|
||||
|
@ -167,13 +182,13 @@
|
|||
#define PACKAGE_NAME "libsndfile"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libsndfile 1.0.11"
|
||||
#define PACKAGE_STRING "libsndfile 1.0.15"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libsndfile"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "1.0.11"
|
||||
#define PACKAGE_VERSION "1.0.15"
|
||||
|
||||
/* Set to maximum allowed value of sf_count_t type. */
|
||||
#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL
|
||||
|
@ -226,8 +241,11 @@
|
|||
/* Set to long if unknown. */
|
||||
#define TYPEOF_SF_COUNT_T off_t
|
||||
|
||||
/* Set to 1 to use the native windows API */
|
||||
#define USE_WINDOWS_API 0
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.0.11"
|
||||
#define VERSION "1.0.15"
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
/* #undef _FILE_OFFSET_BITS */
|
||||
|
|
|
@ -69,7 +69,9 @@ ALL_SYMBOLS = (
|
|||
( "sf_strerror", 50 ),
|
||||
( "sf_get_string", 60 ),
|
||||
( "sf_set_string", 61 ),
|
||||
( "sf_open_fd", 70 )
|
||||
( "sf_open_fd", 70 ),
|
||||
( "sf_open_virtual", 80 ),
|
||||
( "sf_write_sync", 90 )
|
||||
)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -94,9 +96,9 @@ def darwin_symbols (progname, version):
|
|||
print
|
||||
return
|
||||
|
||||
def win32_symbols (progname, version):
|
||||
def win32_symbols (progname, version, name):
|
||||
print "; Auto-generated by %s\n" %progname
|
||||
print "LIBRARY libsndfile.dll"
|
||||
print "LIBRARY %s-%s.dll" % (name, re.sub ("\..*", "", version))
|
||||
print "EXPORTS\n"
|
||||
for name, ordinal in ALL_SYMBOLS:
|
||||
print "%-20s @%s" % (name, ordinal)
|
||||
|
@ -122,6 +124,7 @@ if len (sys.argv) != 3:
|
|||
print " linux"
|
||||
print " darwin (ie MacOSX)"
|
||||
print " win32 (ie wintendo)"
|
||||
print " cygwin (Cygwin on wintendo)"
|
||||
print
|
||||
sys.exit (1)
|
||||
|
||||
|
@ -133,7 +136,9 @@ if os_name == "linux":
|
|||
elif os_name == "darwin":
|
||||
darwin_symbols (progname, version)
|
||||
elif os_name == "win32":
|
||||
win32_symbols (progname, version)
|
||||
win32_symbols (progname, version, "libsndfile")
|
||||
elif os_name == "cygwin":
|
||||
win32_symbols (progname, version, "cygsndfile")
|
||||
else:
|
||||
no_symbols (os_name)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2003,2005 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
|
||||
|
@ -16,10 +16,11 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
@ -66,10 +67,10 @@ typedef struct
|
|||
sf_count_t (*read_float) (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
sf_count_t (*read_double) (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
sf_count_t (*write_short) (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_int) (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_float) (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_double) (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_short) (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_int) (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_float) (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
sf_count_t (*write_double) (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
double buffer [SF_BUFFER_LEN / sizeof (double)] ;
|
||||
} DITHER_DATA ;
|
||||
|
@ -77,10 +78,10 @@ typedef struct
|
|||
static sf_count_t dither_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dither_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t dither_write_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dither_write_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t dither_write_float (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dither_write_double (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t dither_write_short (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dither_write_int (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t dither_write_float (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dither_write_double (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
int
|
||||
dither_init (SF_PRIVATE *psf, int mode)
|
||||
|
@ -210,7 +211,7 @@ dither_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static sf_count_t
|
||||
dither_write_short (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
dither_write_short (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ DITHER_DATA *pdither ;
|
||||
int bufferlen, writecount, thiswrite ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -250,7 +251,7 @@ dither_write_short (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* dither_write_short */
|
||||
|
||||
static sf_count_t
|
||||
dither_write_int (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
dither_write_int (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ DITHER_DATA *pdither ;
|
||||
int bufferlen, writecount, thiswrite ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -295,7 +296,7 @@ dither_write_int (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* dither_write_int */
|
||||
|
||||
static sf_count_t
|
||||
dither_write_float (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
dither_write_float (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ DITHER_DATA *pdither ;
|
||||
int bufferlen, writecount, thiswrite ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -339,7 +340,7 @@ dither_write_float (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* dither_write_float */
|
||||
|
||||
static sf_count_t
|
||||
dither_write_double (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
dither_write_double (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ DITHER_DATA *pdither ;
|
||||
int bufferlen, writecount, thiswrite ;
|
||||
sf_count_t total = 0 ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -16,13 +16,13 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
#include "float_cast.h"
|
||||
|
@ -36,7 +36,7 @@
|
|||
#endif
|
||||
|
||||
/* A 32 number which will not overflow when multiplied by sizeof (double). */
|
||||
#define SENSIBLE_LEN (0x8000000)
|
||||
#define SENSIBLE_LEN (0x8000000)
|
||||
|
||||
/*--------------------------------------------------------------------------------------------
|
||||
** Processor floating point capabilities. double64_get_capability () returns one of the
|
||||
|
@ -60,12 +60,12 @@ static sf_count_t host_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t host_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t host_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_s2d (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_i2d (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_f2d (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static void double64_peak_update (SF_PRIVATE *psf, double *buffer, int count, int indx) ;
|
||||
static void double64_peak_update (SF_PRIVATE *psf, const double *buffer, int count, sf_count_t indx) ;
|
||||
|
||||
static int double64_get_capability (SF_PRIVATE *psf) ;
|
||||
|
||||
|
@ -74,10 +74,10 @@ static sf_count_t replace_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t replace_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t replace_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_s2d (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_i2d (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_f2d (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static void d2bd_read (double *buffer, int count) ;
|
||||
static void bd2d_write (double *buffer, int count) ;
|
||||
|
@ -276,19 +276,20 @@ double64_init (SF_PRIVATE *psf)
|
|||
|
||||
double
|
||||
double64_be_read (unsigned char *cptr)
|
||||
{ int exponent, negative ;
|
||||
{ int exponent, negative, upper, lower ;
|
||||
double dvalue ;
|
||||
|
||||
negative = (cptr [0] & 0x80) ? 1 : 0 ;
|
||||
exponent = ((cptr [0] & 0x7F) << 4) | ((cptr [1] >> 4) & 0xF) ;
|
||||
|
||||
/* Might not have a 64 bit long, so load the mantissa into a double. */
|
||||
dvalue = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ;
|
||||
dvalue += ((cptr [5] << 16) | (cptr [6] << 8) | cptr [7]) / ((double) 0x1000000) ;
|
||||
upper = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ;
|
||||
lower = (cptr [5] << 16) | (cptr [6] << 8) | cptr [7] ;
|
||||
|
||||
if (exponent == 0 && dvalue == 0.0)
|
||||
if (exponent == 0 && upper == 0 && lower == 0)
|
||||
return 0.0 ;
|
||||
|
||||
dvalue = upper + lower / ((double) 0x1000000) ;
|
||||
dvalue += 0x10000000 ;
|
||||
|
||||
exponent = exponent - 0x3FF ;
|
||||
|
@ -308,19 +309,20 @@ double64_be_read (unsigned char *cptr)
|
|||
|
||||
double
|
||||
double64_le_read (unsigned char *cptr)
|
||||
{ int exponent, negative ;
|
||||
{ int exponent, negative, upper, lower ;
|
||||
double dvalue ;
|
||||
|
||||
negative = (cptr [7] & 0x80) ? 1 : 0 ;
|
||||
exponent = ((cptr [7] & 0x7F) << 4) | ((cptr [6] >> 4) & 0xF) ;
|
||||
|
||||
/* Might not have a 64 bit long, so load the mantissa into a double. */
|
||||
dvalue = (((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3]) ;
|
||||
dvalue += ((cptr [2] << 16) | (cptr [1] << 8) | cptr [0]) / ((double) 0x1000000) ;
|
||||
upper = ((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3] ;
|
||||
lower = (cptr [2] << 16) | (cptr [1] << 8) | cptr [0] ;
|
||||
|
||||
if (exponent == 0 && dvalue == 0.0)
|
||||
if (exponent == 0 && upper == 0 && lower == 0)
|
||||
return 0.0 ;
|
||||
|
||||
dvalue = upper + lower / ((double) 0x1000000) ;
|
||||
dvalue += 0x10000000 ;
|
||||
|
||||
exponent = exponent - 0x3FF ;
|
||||
|
@ -344,7 +346,7 @@ double64_be_write (double in, unsigned char *out)
|
|||
|
||||
memset (out, 0, sizeof (double)) ;
|
||||
|
||||
if (in == 0.0)
|
||||
if (fabs (in) < 1e-30)
|
||||
return ;
|
||||
|
||||
if (in < 0.0)
|
||||
|
@ -384,7 +386,7 @@ double64_le_write (double in, unsigned char *out)
|
|||
|
||||
memset (out, 0, sizeof (double)) ;
|
||||
|
||||
if (in == 0.0)
|
||||
if (fabs (in) < 1e-30)
|
||||
return ;
|
||||
|
||||
if (in < 0.0)
|
||||
|
@ -423,7 +425,7 @@ double64_le_write (double in, unsigned char *out)
|
|||
*/
|
||||
|
||||
static void
|
||||
double64_peak_update (SF_PRIVATE *psf, double *buffer, int count, int indx)
|
||||
double64_peak_update (SF_PRIVATE *psf, const double *buffer, int count, sf_count_t indx)
|
||||
{ int chan ;
|
||||
int k, position ;
|
||||
float fmaxval ;
|
||||
|
@ -437,9 +439,9 @@ double64_peak_update (SF_PRIVATE *psf, double *buffer, int count, int indx)
|
|||
position = k ;
|
||||
} ;
|
||||
|
||||
if (fmaxval > psf->pchunk->peaks [chan].value)
|
||||
{ psf->pchunk->peaks [chan].value = fmaxval ;
|
||||
psf->pchunk->peaks [chan].position = psf->write_current + indx + (position / psf->sf.channels) ;
|
||||
if (fmaxval > psf->peak_info->peaks [chan].value)
|
||||
{ psf->peak_info->peaks [chan].value = fmaxval ;
|
||||
psf->peak_info->peaks [chan].position = psf->write_current + indx + (position / psf->sf.channels) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
|
@ -478,42 +480,42 @@ double64_get_capability (SF_PRIVATE *psf)
|
|||
*/
|
||||
|
||||
static inline void
|
||||
d2s_array (double *src, int count, short *dest, double scale)
|
||||
d2s_array (const double *src, int count, short *dest, double scale)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = lrint (scale * src [count]) ;
|
||||
} ;
|
||||
} /* d2s_array */
|
||||
|
||||
static inline void
|
||||
d2i_array (double *src, int count, int *dest, double scale)
|
||||
d2i_array (const double *src, int count, int *dest, double scale)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = lrint (scale * src [count]) ;
|
||||
} ;
|
||||
} /* d2i_array */
|
||||
|
||||
static inline void
|
||||
d2f_array (double *src, int count, float *dest)
|
||||
d2f_array (const double *src, int count, float *dest)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = src [count] ;
|
||||
} ;
|
||||
} /* d2f_array */
|
||||
|
||||
static inline void
|
||||
s2d_array (short *src, double *dest, int count)
|
||||
s2d_array (const short *src, double *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = src [count] ;
|
||||
} ;
|
||||
} /* s2d_array */
|
||||
|
||||
static inline void
|
||||
i2d_array (int *src, double *dest, int count)
|
||||
i2d_array (const int *src, double *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = src [count] ;
|
||||
} ;
|
||||
} /* i2d_array */
|
||||
|
||||
static inline void
|
||||
f2d_array (float *src, double *dest, int count)
|
||||
f2d_array (const float *src, double *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = src [count] ;
|
||||
} ;
|
||||
|
@ -631,7 +633,7 @@ host_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
} /* host_read_d */
|
||||
|
||||
static sf_count_t
|
||||
host_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
host_write_s2d (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -643,8 +645,8 @@ host_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
|
||||
s2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_double_array (psf->u.dbuf, bufferlen) ;
|
||||
|
@ -660,7 +662,7 @@ host_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* host_write_s2d */
|
||||
|
||||
static sf_count_t
|
||||
host_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
host_write_i2d (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -671,8 +673,8 @@ host_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
bufferlen = (int) len ;
|
||||
i2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_double_array (psf->u.dbuf, bufferlen) ;
|
||||
|
@ -688,7 +690,7 @@ host_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* host_write_i2d */
|
||||
|
||||
static sf_count_t
|
||||
host_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
host_write_f2d (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -699,8 +701,8 @@ host_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
bufferlen = (int) len ;
|
||||
f2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_double_array (psf->u.dbuf, bufferlen) ;
|
||||
|
@ -716,11 +718,11 @@ host_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* host_write_f2d */
|
||||
|
||||
static sf_count_t
|
||||
host_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
host_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (psf->has_peak)
|
||||
if (psf->peak_info)
|
||||
double64_peak_update (psf, ptr, len, 0) ;
|
||||
|
||||
if (psf->float_endswap != SF_TRUE)
|
||||
|
@ -863,7 +865,7 @@ replace_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
} /* replace_read_d */
|
||||
|
||||
static sf_count_t
|
||||
replace_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
replace_write_s2d (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -874,8 +876,8 @@ replace_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
bufferlen = (int) len ;
|
||||
s2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
bd2d_write (psf->u.dbuf, bufferlen) ;
|
||||
|
||||
|
@ -893,7 +895,7 @@ replace_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* replace_write_s2d */
|
||||
|
||||
static sf_count_t
|
||||
replace_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
replace_write_i2d (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -904,8 +906,8 @@ replace_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
bufferlen = (int) len ;
|
||||
i2d_array (ptr + total, psf->u.dbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
double64_peak_update (psf, psf->u.dbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
bd2d_write (psf->u.dbuf, bufferlen) ;
|
||||
|
||||
|
@ -923,7 +925,7 @@ replace_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* replace_write_i2d */
|
||||
|
||||
static sf_count_t
|
||||
replace_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
replace_write_f2d (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -950,12 +952,12 @@ replace_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* replace_write_f2d */
|
||||
|
||||
static sf_count_t
|
||||
replace_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
replace_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
/* FIXME : This is probably nowhere near optimal. */
|
||||
if (psf->has_peak)
|
||||
if (psf->peak_info)
|
||||
double64_peak_update (psf, ptr, len, 0) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->u.dbuf) ;
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
@ -95,7 +96,7 @@ dwd_open (SF_PRIVATE *psf)
|
|||
-*/
|
||||
} ;
|
||||
|
||||
psf->close = dwd_close ;
|
||||
psf->container_close = dwd_close ;
|
||||
|
||||
/*-psf->blockwidth = psf->bytewidth * psf->sf.channels ;-*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2002-2005 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
|
||||
|
@ -26,12 +26,13 @@
|
|||
** Lidstrom and is copyright 1993 by NuEdge Development".
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "float_cast.h"
|
||||
#include "common.h"
|
||||
|
@ -54,10 +55,10 @@ static sf_count_t dwvw_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t dwvw_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dwvw_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t dwvw_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dwvw_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t dwvw_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dwvw_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t dwvw_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dwvw_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t dwvw_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dwvw_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t dwvw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
|
||||
static int dwvw_close (SF_PRIVATE *psf) ;
|
||||
|
@ -65,7 +66,7 @@ static int dwvw_close (SF_PRIVATE *psf) ;
|
|||
static int dwvw_decode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int *ptr, int len) ;
|
||||
static int dwvw_decode_load_bits (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int bit_count) ;
|
||||
|
||||
static int dwvw_encode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int *ptr, int len) ;
|
||||
static int dwvw_encode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, const int *ptr, int len) ;
|
||||
static void dwvw_encode_store_bits (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int data, int new_bits) ;
|
||||
static void dwvw_read_reset (DWVW_PRIVATE *pdwvw) ;
|
||||
|
||||
|
@ -77,6 +78,11 @@ int
|
|||
dwvw_init (SF_PRIVATE *psf, int bitwidth)
|
||||
{ DWVW_PRIVATE *pdwvw ;
|
||||
|
||||
if (psf->fdata != NULL)
|
||||
{ psf_log_printf (psf, "*** psf->fdata is not NULL.\n") ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
if (bitwidth > 24)
|
||||
return SFE_DWVW_BAD_BITWIDTH ;
|
||||
|
||||
|
@ -109,13 +115,13 @@ dwvw_init (SF_PRIVATE *psf, int bitwidth)
|
|||
psf->write_double = dwvw_write_d ;
|
||||
} ;
|
||||
|
||||
psf->seek = dwvw_seek ;
|
||||
psf->close = dwvw_close ;
|
||||
psf->codec_close = dwvw_close ;
|
||||
psf->seek = dwvw_seek ;
|
||||
|
||||
/* FIXME : This s bogus. */
|
||||
/* FIXME : This is bogus. */
|
||||
psf->sf.frames = SF_COUNT_MAX ;
|
||||
psf->datalength = psf->sf.frames ;
|
||||
/* EMXIF : This s bogus. */
|
||||
/* EMXIF : This is bogus. */
|
||||
|
||||
return 0 ;
|
||||
} /* dwvw_init */
|
||||
|
@ -155,7 +161,7 @@ dwvw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
if (! psf->fdata)
|
||||
{ psf->error = SFE_INTERNAL ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
pdwvw = (DWVW_PRIVATE*) psf->fdata ;
|
||||
|
@ -167,7 +173,7 @@ dwvw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
} ;
|
||||
|
||||
psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} /* dwvw_seek */
|
||||
|
||||
|
||||
|
@ -467,7 +473,7 @@ dump_bits (DWVW_PRIVATE *pdwvw)
|
|||
} ;
|
||||
|
||||
static int
|
||||
dwvw_encode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int *ptr, int len)
|
||||
dwvw_encode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, const int *ptr, int len)
|
||||
{ int count ;
|
||||
int delta_width_modifier, delta, delta_negative, delta_width, extra_bit ;
|
||||
|
||||
|
@ -542,7 +548,7 @@ dwvw_encode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int *ptr, int len)
|
|||
} /* dwvw_encode_data */
|
||||
|
||||
static sf_count_t
|
||||
dwvw_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
dwvw_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ DWVW_PRIVATE *pdwvw ;
|
||||
int *iptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
|
@ -570,7 +576,7 @@ dwvw_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* dwvw_write_s */
|
||||
|
||||
static sf_count_t
|
||||
dwvw_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
dwvw_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ DWVW_PRIVATE *pdwvw ;
|
||||
int writecount, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -595,7 +601,7 @@ dwvw_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* dwvw_write_i */
|
||||
|
||||
static sf_count_t
|
||||
dwvw_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
dwvw_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ DWVW_PRIVATE *pdwvw ;
|
||||
int *iptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
|
@ -626,7 +632,7 @@ dwvw_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* dwvw_write_f */
|
||||
|
||||
static sf_count_t
|
||||
dwvw_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
dwvw_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ DWVW_PRIVATE *pdwvw ;
|
||||
int *iptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2003 Ross Bencina <rbencina@iprimus.com.au>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
|
@ -18,16 +18,26 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
** This header file MUST be included before the others to ensure that
|
||||
** large file support is enabled.
|
||||
** The file is split into three sections as follows:
|
||||
** - The top section (USE_WINDOWS_API == 0) for Linux, Unix and MacOSX
|
||||
** systems (including Cygwin).
|
||||
** - The middle section (USE_WINDOWS_API == 1) for microsoft windows
|
||||
** (including MinGW) using the native windows API.
|
||||
** - A legacy windows section which attempted to work around grevious
|
||||
** bugs in microsoft's POSIX implementation.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
/*
|
||||
** The header file sfconfig.h MUST be included before the others to ensure
|
||||
** that large file support is enabled correctly on Unix systems.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -40,19 +50,21 @@
|
|||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if (defined (__MWERKS__) && defined (macintosh))
|
||||
typedef int ssize_t ;
|
||||
#include <Files.h>
|
||||
#endif
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "common.h"
|
||||
|
||||
#define SENSIBLE_SIZE (0x40000000)
|
||||
|
||||
static int psf_open_fd (const char * path, int mode) ;
|
||||
static int psf_close_fd (int fd) ;
|
||||
static void psf_log_syserr (SF_PRIVATE *psf, int error) ;
|
||||
|
||||
#if (USE_WINDOWS_API == 0)
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Win32 stuff at the bottom of the file. Unix and other sensible OSes here.
|
||||
*/
|
||||
|
||||
static int psf_close_fd (int fd) ;
|
||||
static int psf_open_fd (const char * path, int mode) ;
|
||||
static sf_count_t psf_get_filelen_fd (int fd) ;
|
||||
|
||||
int
|
||||
|
@ -79,6 +91,9 @@ int
|
|||
psf_fclose (SF_PRIVATE *psf)
|
||||
{ int retval ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return 0 ;
|
||||
|
||||
if (psf->do_not_close_descriptor)
|
||||
{ psf->filedes = -1 ;
|
||||
return 0 ;
|
||||
|
@ -94,22 +109,19 @@ psf_fclose (SF_PRIVATE *psf)
|
|||
|
||||
int
|
||||
psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
||||
{ char *fname ;
|
||||
|
||||
{
|
||||
if (psf->rsrcdes > 0)
|
||||
return 0 ;
|
||||
|
||||
/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
|
||||
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
|
||||
{ psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
|
||||
if (psf->rsrclength < 100)
|
||||
{ psf->error = SFE_SD2_BAD_RSRC ;
|
||||
return psf->error ;
|
||||
} ;
|
||||
return SFE_NO_ERROR ;
|
||||
if (psf->rsrclength > 0 || (open_mode & SFM_WRITE))
|
||||
return SFE_NO_ERROR ;
|
||||
psf_close_fd (psf->rsrcdes) ;
|
||||
psf->rsrcdes = -1 ;
|
||||
} ;
|
||||
|
||||
if (psf->rsrcdes == - SFE_BAD_OPEN_MODE)
|
||||
|
@ -118,28 +130,28 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
|||
} ;
|
||||
|
||||
/*
|
||||
** Now try for a resource fork stored as a separate file.
|
||||
** Grab the un-adulterated filename again.
|
||||
** Now try for a resource fork stored as a separate file in the same
|
||||
** directory, but preceded with a dot underscore.
|
||||
*/
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s", psf->filepath) ;
|
||||
|
||||
if ((fname = strrchr (psf->rsrcpath, '/')) != NULL)
|
||||
fname ++ ;
|
||||
else if ((fname = strrchr (psf->rsrcpath, '\\')) != NULL)
|
||||
fname ++ ;
|
||||
else
|
||||
fname = psf->rsrcpath ;
|
||||
|
||||
memmove (fname + 2, fname, strlen (fname) + 1) ;
|
||||
fname [0] = '.' ;
|
||||
fname [1] = '_' ;
|
||||
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
|
||||
{ psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
|
||||
return SFE_NO_ERROR ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
** Now try for a resource fork stored in a separate file in the
|
||||
** .AppleDouble/ directory.
|
||||
*/
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0)
|
||||
{ psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ;
|
||||
return SFE_NO_ERROR ;
|
||||
} ;
|
||||
|
||||
/* No resource file found. */
|
||||
if (psf->rsrcdes == -1)
|
||||
psf_log_syserr (psf, errno) ;
|
||||
|
||||
|
@ -148,18 +160,13 @@ psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
|||
return psf->error ;
|
||||
} /* psf_open_rsrc */
|
||||
|
||||
int
|
||||
psf_close_rsrc (SF_PRIVATE *psf)
|
||||
{
|
||||
psf_close_fd (psf->rsrcdes) ;
|
||||
psf->rsrcdes = -1 ;
|
||||
return 0 ;
|
||||
} /* psf_close_rsrc */
|
||||
|
||||
sf_count_t
|
||||
psf_get_filelen (SF_PRIVATE *psf)
|
||||
{ sf_count_t filelen ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.get_filelen (psf->vio_user_data) ;
|
||||
|
||||
filelen = psf_get_filelen_fd (psf->filedes) ;
|
||||
|
||||
if (filelen == -1)
|
||||
|
@ -198,11 +205,14 @@ psf_get_filelen (SF_PRIVATE *psf)
|
|||
return filelen ;
|
||||
} /* psf_get_filelen */
|
||||
|
||||
#if ((defined (WIN32) || defined (_WIN32)) == 0)
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Win32 stuff at the bottom of the file. Unix and other sensible OSes here.
|
||||
*/
|
||||
int
|
||||
psf_close_rsrc (SF_PRIVATE *psf)
|
||||
{
|
||||
if (psf->rsrcdes >= 0)
|
||||
psf_close_fd (psf->rsrcdes) ;
|
||||
psf->rsrcdes = -1 ;
|
||||
return 0 ;
|
||||
} /* psf_close_rsrc */
|
||||
|
||||
int
|
||||
psf_set_stdio (SF_PRIVATE *psf, int mode)
|
||||
|
@ -236,7 +246,7 @@ psf_set_file (SF_PRIVATE *psf, int fd)
|
|||
} /* psf_set_file */
|
||||
|
||||
int
|
||||
psf_filedes_valid (SF_PRIVATE *psf)
|
||||
psf_file_valid (SF_PRIVATE *psf)
|
||||
{ return (psf->filedes >= 0) ? SF_TRUE : SF_FALSE ;
|
||||
} /* psf_set_file */
|
||||
|
||||
|
@ -244,6 +254,9 @@ sf_count_t
|
|||
psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence)
|
||||
{ sf_count_t new_position ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.seek (offset, whence, psf->vio_user_data) ;
|
||||
|
||||
switch (whence)
|
||||
{ case SEEK_SET :
|
||||
offset += psf->fileoffset ;
|
||||
|
@ -287,6 +300,9 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
|
|||
{ sf_count_t total = 0 ;
|
||||
ssize_t count ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.read (ptr, bytes*items, psf->vio_user_data) / bytes ;
|
||||
|
||||
items *= bytes ;
|
||||
|
||||
/* Do this check after the multiplication above. */
|
||||
|
@ -294,7 +310,7 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
|
|||
return 0 ;
|
||||
|
||||
while (items > 0)
|
||||
{ /* Break the writes down to a sensible size. */
|
||||
{ /* Break the read down to a sensible size. */
|
||||
count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ;
|
||||
|
||||
count = read (psf->filedes, ((char*) ptr) + total, (size_t) count) ;
|
||||
|
@ -325,6 +341,9 @@ psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf
|
|||
{ sf_count_t total = 0 ;
|
||||
ssize_t count ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.write (ptr, bytes*items, psf->vio_user_data) / bytes ;
|
||||
|
||||
items *= bytes ;
|
||||
|
||||
/* Do this check after the multiplication above. */
|
||||
|
@ -362,6 +381,9 @@ sf_count_t
|
|||
psf_ftell (SF_PRIVATE *psf)
|
||||
{ sf_count_t pos ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.tell (psf->vio_user_data) ;
|
||||
|
||||
if (psf->is_pipe)
|
||||
return psf->pipeoffset ;
|
||||
|
||||
|
@ -375,7 +397,7 @@ psf_ftell (SF_PRIVATE *psf)
|
|||
return pos - psf->fileoffset ;
|
||||
} /* psf_ftell */
|
||||
|
||||
int
|
||||
static int
|
||||
psf_close_fd (int fd)
|
||||
{ int retval ;
|
||||
|
||||
|
@ -414,6 +436,9 @@ int
|
|||
psf_is_pipe (SF_PRIVATE *psf)
|
||||
{ struct stat statbuf ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return SF_FALSE ;
|
||||
|
||||
if (fstat (psf->filedes, &statbuf) == -1)
|
||||
{ psf_log_syserr (psf, errno) ;
|
||||
/* Default to maximum safety. */
|
||||
|
@ -437,11 +462,6 @@ psf_get_filelen_fd (int fd)
|
|||
if (sizeof (statbuf.st_size) == 4 && sizeof (sf_count_t) == 8)
|
||||
return (sf_count_t) -SFE_BAD_STAT_SIZE ;
|
||||
|
||||
/* Cygwin seems to need this. */
|
||||
#if (defined (__CYGWIN__) && HAVE_FSYNC)
|
||||
fsync (psf->filedes) ;
|
||||
#endif
|
||||
|
||||
if (fstat (fd, &statbuf) == -1)
|
||||
return (sf_count_t) -1 ;
|
||||
|
||||
|
@ -459,11 +479,7 @@ psf_ftruncate (SF_PRIVATE *psf, sf_count_t len)
|
|||
if ((sizeof (off_t) < sizeof (sf_count_t)) && len > 0x7FFFFFFF)
|
||||
return -1 ;
|
||||
|
||||
#if (defined (__MWERKS__) && defined (macintosh))
|
||||
retval = FSSetForkSize (psf->filedes, fsFromStart, len) ;
|
||||
#else
|
||||
retval = ftruncate (psf->filedes, len) ;
|
||||
#endif
|
||||
|
||||
if (retval == -1)
|
||||
psf_log_syserr (psf, errno) ;
|
||||
|
@ -471,6 +487,28 @@ psf_ftruncate (SF_PRIVATE *psf, sf_count_t len)
|
|||
return retval ;
|
||||
} /* psf_ftruncate */
|
||||
|
||||
void
|
||||
psf_init_files (SF_PRIVATE *psf)
|
||||
{ psf->filedes = -1 ;
|
||||
psf->rsrcdes = -1 ;
|
||||
psf->savedes = -1 ;
|
||||
} /* psf_init_files */
|
||||
|
||||
void
|
||||
psf_use_rsrc (SF_PRIVATE *psf, int on_off)
|
||||
{
|
||||
if (on_off)
|
||||
{ if (psf->filedes != psf->rsrcdes)
|
||||
{ psf->savedes = psf->filedes ;
|
||||
psf->filedes = psf->rsrcdes ;
|
||||
} ;
|
||||
}
|
||||
else if (psf->filedes == psf->rsrcdes)
|
||||
psf->filedes = psf->savedes ;
|
||||
|
||||
return ;
|
||||
} /* psf_use_rsrc */
|
||||
|
||||
static int
|
||||
psf_open_fd (const char * pathname, int open_mode)
|
||||
{ int fd, oflag, mode ;
|
||||
|
@ -478,7 +516,7 @@ psf_open_fd (const char * pathname, int open_mode)
|
|||
/*
|
||||
** Sanity check. If everything is OK, this test and the printfs will
|
||||
** be optimised out. This is meant to catch the problems caused by
|
||||
** "config.h" being included after <stdio.h>.
|
||||
** "sfconfig.h" being included after <stdio.h>.
|
||||
*/
|
||||
if (sizeof (off_t) != sizeof (sf_count_t))
|
||||
{ puts ("\n\n*** Fatal error : sizeof (off_t) != sizeof (sf_count_t)") ;
|
||||
|
@ -507,7 +545,8 @@ psf_open_fd (const char * pathname, int open_mode)
|
|||
break ;
|
||||
} ;
|
||||
|
||||
#if defined (__CYGWIN__)
|
||||
#if OS_IS_WIN32
|
||||
/* For Cygwin. */
|
||||
oflag |= O_BINARY ;
|
||||
#endif
|
||||
|
||||
|
@ -531,7 +570,18 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
|
|||
return ;
|
||||
} /* psf_log_syserr */
|
||||
|
||||
#elif OS_IS_WIN32
|
||||
void
|
||||
psf_fsync (SF_PRIVATE *psf)
|
||||
{
|
||||
#if HAVE_FSYNC
|
||||
if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
|
||||
fsync (psf->filedes) ;
|
||||
#else
|
||||
psf = NULL ;
|
||||
#endif
|
||||
} /* psf_fsync */
|
||||
|
||||
#elif USE_WINDOWS_API
|
||||
|
||||
/* Win32 file i/o functions implemented using native Win32 API */
|
||||
|
||||
|
@ -542,8 +592,158 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
|
|||
typedef long ssize_t ;
|
||||
#endif
|
||||
|
||||
/* Win32 */ static int
|
||||
psf_open_fd (const char * pathname, int open_mode)
|
||||
static int psf_close_handle (HANDLE handle) ;
|
||||
static HANDLE psf_open_handle (const char * path, int mode) ;
|
||||
static sf_count_t psf_get_filelen_handle (HANDLE handle) ;
|
||||
|
||||
/* USE_WINDOWS_API */ int
|
||||
psf_fopen (SF_PRIVATE *psf, const char *pathname, int open_mode)
|
||||
{
|
||||
psf->error = 0 ;
|
||||
psf->hfile = psf_open_handle (pathname, open_mode) ;
|
||||
|
||||
if (psf->hfile == NULL)
|
||||
psf_log_syserr (psf, errno) ;
|
||||
|
||||
psf->mode = open_mode ;
|
||||
|
||||
return psf->error ;
|
||||
} /* psf_fopen */
|
||||
|
||||
/* USE_WINDOWS_API */ int
|
||||
psf_fclose (SF_PRIVATE *psf)
|
||||
{ int retval ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return 0 ;
|
||||
|
||||
if (psf->do_not_close_descriptor)
|
||||
{ psf->hfile = NULL ;
|
||||
return 0 ;
|
||||
} ;
|
||||
|
||||
if ((retval = psf_close_handle (psf->hfile)) == -1)
|
||||
psf_log_syserr (psf, errno) ;
|
||||
|
||||
psf->hfile = NULL ;
|
||||
|
||||
return retval ;
|
||||
} /* psf_fclose */
|
||||
|
||||
/* USE_WINDOWS_API */ int
|
||||
psf_open_rsrc (SF_PRIVATE *psf, int open_mode)
|
||||
{
|
||||
if (psf->hrsrc != NULL)
|
||||
return 0 ;
|
||||
|
||||
/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
|
||||
{ psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
|
||||
return SFE_NO_ERROR ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
** Now try for a resource fork stored as a separate file in the same
|
||||
** directory, but preceded with a dot underscore.
|
||||
*/
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s._%s", psf->directory, psf->filename) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
|
||||
{ psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
|
||||
return SFE_NO_ERROR ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
** Now try for a resource fork stored in a separate file in the
|
||||
** .AppleDouble/ directory.
|
||||
*/
|
||||
LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s.AppleDouble/%s", psf->directory, psf->filename) ;
|
||||
psf->error = SFE_NO_ERROR ;
|
||||
if ((psf->hrsrc = psf_open_handle (psf->rsrcpath, open_mode)) != NULL)
|
||||
{ psf->rsrclength = psf_get_filelen_handle (psf->hrsrc) ;
|
||||
return SFE_NO_ERROR ;
|
||||
} ;
|
||||
|
||||
/* No resource file found. */
|
||||
if (psf->hrsrc == NULL)
|
||||
psf_log_syserr (psf, errno) ;
|
||||
|
||||
psf->hrsrc = NULL ;
|
||||
|
||||
return psf->error ;
|
||||
} /* psf_open_rsrc */
|
||||
|
||||
/* USE_WINDOWS_API */ sf_count_t
|
||||
psf_get_filelen (SF_PRIVATE *psf)
|
||||
{ sf_count_t filelen ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.get_filelen (psf->vio_user_data) ;
|
||||
|
||||
filelen = psf_get_filelen_handle (psf->hfile) ;
|
||||
|
||||
if (filelen == -1)
|
||||
{ psf_log_syserr (psf, errno) ;
|
||||
return (sf_count_t) -1 ;
|
||||
} ;
|
||||
|
||||
if (filelen == -SFE_BAD_STAT_SIZE)
|
||||
{ psf->error = SFE_BAD_STAT_SIZE ;
|
||||
return (sf_count_t) -1 ;
|
||||
} ;
|
||||
|
||||
switch (psf->mode)
|
||||
{ case SFM_WRITE :
|
||||
filelen = filelen - psf->fileoffset ;
|
||||
break ;
|
||||
|
||||
case SFM_READ :
|
||||
if (psf->fileoffset > 0 && psf->filelength > 0)
|
||||
filelen = psf->filelength ;
|
||||
break ;
|
||||
|
||||
case SFM_RDWR :
|
||||
/*
|
||||
** Cannot open embedded files SFM_RDWR so we don't need to
|
||||
** subtract psf->fileoffset. We already have the answer we
|
||||
** need.
|
||||
*/
|
||||
break ;
|
||||
|
||||
default :
|
||||
/* Shouldn't be here, so return error. */
|
||||
filelen = -1 ;
|
||||
} ;
|
||||
|
||||
return filelen ;
|
||||
} /* psf_get_filelen */
|
||||
|
||||
/* USE_WINDOWS_API */ void
|
||||
psf_init_files (SF_PRIVATE *psf)
|
||||
{ psf->hfile = NULL ;
|
||||
psf->hrsrc = NULL ;
|
||||
psf->hsaved = NULL ;
|
||||
} /* psf_init_files */
|
||||
|
||||
/* USE_WINDOWS_API */ void
|
||||
psf_use_rsrc (SF_PRIVATE *psf, int on_off)
|
||||
{
|
||||
if (on_off)
|
||||
{ if (psf->hfile != psf->hrsrc)
|
||||
{ psf->hsaved = psf->hfile ;
|
||||
psf->hfile = psf->hrsrc ;
|
||||
} ;
|
||||
}
|
||||
else if (psf->hfile == psf->hrsrc)
|
||||
psf->hfile = psf->hsaved ;
|
||||
|
||||
return ;
|
||||
} /* psf_use_rsrc */
|
||||
|
||||
/* USE_WINDOWS_API */ static HANDLE
|
||||
psf_open_handle (const char * pathname, int open_mode)
|
||||
{ DWORD dwDesiredAccess ;
|
||||
DWORD dwShareMode ;
|
||||
DWORD dwCreationDistribution ;
|
||||
|
@ -569,7 +769,7 @@ psf_open_fd (const char * pathname, int open_mode)
|
|||
break ;
|
||||
|
||||
default :
|
||||
return - SFE_BAD_OPEN_MODE ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
handle = CreateFile (
|
||||
|
@ -583,12 +783,12 @@ psf_open_fd (const char * pathname, int open_mode)
|
|||
) ;
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return -1 ;
|
||||
return NULL ;
|
||||
|
||||
return (int) handle ;
|
||||
} /* psf_open_fd */
|
||||
return handle ;
|
||||
} /* psf_open_handle */
|
||||
|
||||
/* Win32 */ static void
|
||||
/* USE_WINDOWS_API */ static void
|
||||
psf_log_syserr (SF_PRIVATE *psf, int error)
|
||||
{ LPVOID lpMsgBuf ;
|
||||
|
||||
|
@ -614,7 +814,17 @@ psf_log_syserr (SF_PRIVATE *psf, int error)
|
|||
} /* psf_log_syserr */
|
||||
|
||||
|
||||
/* Win32 */ int
|
||||
/* USE_WINDOWS_API */ int
|
||||
psf_close_rsrc (SF_PRIVATE *psf)
|
||||
{
|
||||
if (psf->hrsrc != NULL)
|
||||
psf_close_handle (psf->hrsrc) ;
|
||||
psf->hrsrc = NULL ;
|
||||
return 0 ;
|
||||
} /* psf_close_rsrc */
|
||||
|
||||
|
||||
/* USE_WINDOWS_API */ int
|
||||
psf_set_stdio (SF_PRIVATE *psf, int mode)
|
||||
{ HANDLE handle = NULL ;
|
||||
int error = 0 ;
|
||||
|
@ -639,13 +849,13 @@ psf_set_stdio (SF_PRIVATE *psf, int mode)
|
|||
break ;
|
||||
} ;
|
||||
|
||||
psf->filedes = (int) handle ;
|
||||
psf->hfile = handle ;
|
||||
psf->filelength = 0 ;
|
||||
|
||||
return error ;
|
||||
} /* psf_set_stdio */
|
||||
|
||||
/* Win32 */ void
|
||||
/* USE_WINDOWS_API */ void
|
||||
psf_set_file (SF_PRIVATE *psf, int fd)
|
||||
{ HANDLE handle ;
|
||||
long osfhandle ;
|
||||
|
@ -653,24 +863,28 @@ psf_set_file (SF_PRIVATE *psf, int fd)
|
|||
osfhandle = _get_osfhandle (fd) ;
|
||||
handle = (HANDLE) osfhandle ;
|
||||
|
||||
if (GetFileType (handle) == FILE_TYPE_DISK)
|
||||
psf->filedes = (int) handle ;
|
||||
else
|
||||
psf->filedes = fd ;
|
||||
psf->hfile = handle ;
|
||||
} /* psf_set_file */
|
||||
|
||||
/* Win32 */ int
|
||||
psf_filedes_valid (SF_PRIVATE *psf)
|
||||
{ return (((HANDLE) psf->filedes) != INVALID_HANDLE_VALUE) ? SF_TRUE : SF_FALSE ;
|
||||
/* USE_WINDOWS_API */ int
|
||||
psf_file_valid (SF_PRIVATE *psf)
|
||||
{ if (psf->hfile == NULL)
|
||||
return SF_FALSE ;
|
||||
if (psf->hfile == INVALID_HANDLE_VALUE)
|
||||
return SF_FALSE ;
|
||||
return SF_TRUE ;
|
||||
} /* psf_set_file */
|
||||
|
||||
/* Win32 */ sf_count_t
|
||||
/* USE_WINDOWS_API */ sf_count_t
|
||||
psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence)
|
||||
{ sf_count_t new_position ;
|
||||
LONG lDistanceToMove, lDistanceToMoveHigh ;
|
||||
DWORD dwMoveMethod ;
|
||||
DWORD dwResult, dwError ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.seek (offset, whence, psf->vio_user_data) ;
|
||||
|
||||
switch (whence)
|
||||
{ case SEEK_SET :
|
||||
offset += psf->fileoffset ;
|
||||
|
@ -689,7 +903,7 @@ psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence)
|
|||
lDistanceToMove = (DWORD) (offset & 0xFFFFFFFF) ;
|
||||
lDistanceToMoveHigh = (DWORD) ((offset >> 32) & 0xFFFFFFFF) ;
|
||||
|
||||
dwResult = SetFilePointer ((HANDLE) psf->filedes, lDistanceToMove, &lDistanceToMoveHigh, dwMoveMethod) ;
|
||||
dwResult = SetFilePointer (psf->hfile, lDistanceToMove, &lDistanceToMoveHigh, dwMoveMethod) ;
|
||||
|
||||
if (dwResult == 0xFFFFFFFF)
|
||||
dwError = GetLastError () ;
|
||||
|
@ -706,12 +920,15 @@ psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence)
|
|||
return new_position ;
|
||||
} /* psf_fseek */
|
||||
|
||||
/* Win32 */ sf_count_t
|
||||
/* USE_WINDOWS_API */ sf_count_t
|
||||
psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
|
||||
{ sf_count_t total = 0 ;
|
||||
ssize_t count ;
|
||||
DWORD dwNumberOfBytesRead ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.read (ptr, bytes*items, psf->vio_user_data) / bytes ;
|
||||
|
||||
items *= bytes ;
|
||||
|
||||
/* Do this check after the multiplication above. */
|
||||
|
@ -722,7 +939,7 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
|
|||
{ /* Break the writes down to a sensible size. */
|
||||
count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ;
|
||||
|
||||
if (ReadFile ((HANDLE) psf->filedes, ((char*) ptr) + total, count, &dwNumberOfBytesRead, 0) == 0)
|
||||
if (ReadFile (psf->hfile, ((char*) ptr) + total, count, &dwNumberOfBytesRead, 0) == 0)
|
||||
{ psf_log_syserr (psf, GetLastError ()) ;
|
||||
break ;
|
||||
}
|
||||
|
@ -742,12 +959,15 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
|
|||
return total / bytes ;
|
||||
} /* psf_fread */
|
||||
|
||||
/* Win32 */ sf_count_t
|
||||
/* USE_WINDOWS_API */ sf_count_t
|
||||
psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
|
||||
{ sf_count_t total = 0 ;
|
||||
ssize_t count ;
|
||||
DWORD dwNumberOfBytesWritten ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.write (ptr, bytes * items, psf->vio_user_data) / bytes ;
|
||||
|
||||
items *= bytes ;
|
||||
|
||||
/* Do this check after the multiplication above. */
|
||||
|
@ -758,7 +978,7 @@ psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf
|
|||
{ /* Break the writes down to a sensible size. */
|
||||
count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ;
|
||||
|
||||
if (WriteFile ((HANDLE) psf->filedes, ((const char*) ptr) + total, count, &dwNumberOfBytesWritten, 0) == 0)
|
||||
if (WriteFile (psf->hfile, ((const char*) ptr) + total, count, &dwNumberOfBytesWritten, 0) == 0)
|
||||
{ psf_log_syserr (psf, GetLastError ()) ;
|
||||
break ;
|
||||
}
|
||||
|
@ -778,19 +998,22 @@ psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf
|
|||
return total / bytes ;
|
||||
} /* psf_fwrite */
|
||||
|
||||
/* Win32 */ sf_count_t
|
||||
/* USE_WINDOWS_API */ sf_count_t
|
||||
psf_ftell (SF_PRIVATE *psf)
|
||||
{ sf_count_t pos ;
|
||||
LONG lDistanceToMoveLow, lDistanceToMoveHigh ;
|
||||
DWORD dwResult, dwError ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.tell (psf->vio_user_data) ;
|
||||
|
||||
if (psf->is_pipe)
|
||||
return psf->pipeoffset ;
|
||||
|
||||
lDistanceToMoveLow = 0 ;
|
||||
lDistanceToMoveHigh = 0 ;
|
||||
|
||||
dwResult = SetFilePointer ((HANDLE) psf->filedes, lDistanceToMoveLow, &lDistanceToMoveHigh, FILE_CURRENT) ;
|
||||
dwResult = SetFilePointer (psf->hfile, lDistanceToMoveLow, &lDistanceToMoveHigh, FILE_CURRENT) ;
|
||||
|
||||
if (dwResult == 0xFFFFFFFF)
|
||||
dwError = GetLastError () ;
|
||||
|
@ -807,22 +1030,22 @@ psf_ftell (SF_PRIVATE *psf)
|
|||
return pos - psf->fileoffset ;
|
||||
} /* psf_ftell */
|
||||
|
||||
/* Win32 */ int
|
||||
psf_close_fd (int fd)
|
||||
{ if (CloseHandle ((HANDLE) fd) == 0)
|
||||
/* USE_WINDOWS_API */ static int
|
||||
psf_close_handle (HANDLE handle)
|
||||
{ if (CloseHandle (handle) == 0)
|
||||
return -1 ;
|
||||
|
||||
return 0 ;
|
||||
} /* psf_close_fd */
|
||||
} /* psf_close_handle */
|
||||
|
||||
/* Win32 */ sf_count_t
|
||||
/* USE_WINDOWS_API */ sf_count_t
|
||||
psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf)
|
||||
{ sf_count_t k = 0 ;
|
||||
sf_count_t count ;
|
||||
DWORD dwNumberOfBytesRead ;
|
||||
|
||||
while (k < bufsize - 1)
|
||||
{ if (ReadFile ((HANDLE) psf->filedes, &(buffer [k]), 1, &dwNumberOfBytesRead, 0) == 0)
|
||||
{ if (ReadFile (psf->hfile, &(buffer [k]), 1, &dwNumberOfBytesRead, 0) == 0)
|
||||
{ psf_log_syserr (psf, GetLastError ()) ;
|
||||
break ;
|
||||
}
|
||||
|
@ -839,21 +1062,25 @@ psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf)
|
|||
return k ;
|
||||
} /* psf_fgets */
|
||||
|
||||
/* Win32 */ int
|
||||
/* USE_WINDOWS_API */ int
|
||||
psf_is_pipe (SF_PRIVATE *psf)
|
||||
{ if (GetFileType ((HANDLE) psf->filedes) == FILE_TYPE_DISK)
|
||||
{
|
||||
if (psf->virtual_io)
|
||||
return SF_FALSE ;
|
||||
|
||||
if (GetFileType (psf->hfile) == FILE_TYPE_DISK)
|
||||
return SF_FALSE ;
|
||||
|
||||
/* Default to maximum safety. */
|
||||
return SF_TRUE ;
|
||||
} /* psf_is_pipe */
|
||||
|
||||
/* Win32 */ sf_count_t
|
||||
psf_get_filelen_fd (int fd)
|
||||
/* USE_WINDOWS_API */ sf_count_t
|
||||
psf_get_filelen_handle (HANDLE handle)
|
||||
{ sf_count_t filelen ;
|
||||
DWORD dwFileSizeLow, dwFileSizeHigh, dwError = NO_ERROR ;
|
||||
|
||||
dwFileSizeLow = GetFileSize ((HANDLE) fd, &dwFileSizeHigh) ;
|
||||
dwFileSizeLow = GetFileSize (handle, &dwFileSizeHigh) ;
|
||||
|
||||
if (dwFileSizeLow == 0xFFFFFFFF)
|
||||
dwError = GetLastError () ;
|
||||
|
@ -864,9 +1091,15 @@ psf_get_filelen_fd (int fd)
|
|||
filelen = dwFileSizeLow + ((__int64) dwFileSizeHigh << 32) ;
|
||||
|
||||
return filelen ;
|
||||
} /* psf_get_filelen_fd */
|
||||
} /* psf_get_filelen_handle */
|
||||
|
||||
/* Win32 */ int
|
||||
/* USE_WINDOWS_API */ void
|
||||
psf_fsync (SF_PRIVATE *psf)
|
||||
{ FlushFileBuffers (psf->hfile) ;
|
||||
} /* psf_fsync */
|
||||
|
||||
|
||||
/* USE_WINDOWS_API */ int
|
||||
psf_ftruncate (SF_PRIVATE *psf, sf_count_t len)
|
||||
{ int retval = 0 ;
|
||||
LONG lDistanceToMoveLow, lDistanceToMoveHigh ;
|
||||
|
@ -884,7 +1117,7 @@ psf_ftruncate (SF_PRIVATE *psf, sf_count_t len)
|
|||
lDistanceToMoveLow = (DWORD) (len & 0xFFFFFFFF) ;
|
||||
lDistanceToMoveHigh = (DWORD) ((len >> 32) & 0xFFFFFFFF) ;
|
||||
|
||||
dwResult = SetFilePointer ((HANDLE) psf->filedes, lDistanceToMoveLow, &lDistanceToMoveHigh, FILE_BEGIN) ;
|
||||
dwResult = SetFilePointer (psf->hfile, lDistanceToMoveLow, &lDistanceToMoveHigh, FILE_BEGIN) ;
|
||||
|
||||
if (dwResult == 0xFFFFFFFF)
|
||||
dwError = GetLastError () ;
|
||||
|
@ -899,7 +1132,7 @@ psf_ftruncate (SF_PRIVATE *psf, sf_count_t len)
|
|||
** which guarantees that the new portion of the file will be zeroed.
|
||||
** Not sure if this is important or not.
|
||||
*/
|
||||
if (SetEndOfFile ((HANDLE) psf->filedes) == 0)
|
||||
if (SetEndOfFile (psf->hfile) == 0)
|
||||
{ retval = -1 ;
|
||||
psf_log_syserr (psf, GetLastError ()) ;
|
||||
} ;
|
||||
|
@ -973,6 +1206,9 @@ psf_fopen (SF_PRIVATE *psf, const char *pathname, int open_mode)
|
|||
psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence)
|
||||
{ sf_count_t new_position ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.seek (offset, whence, psf->vio_user_data) ;
|
||||
|
||||
switch (whence)
|
||||
{ case SEEK_SET :
|
||||
offset += psf->fileoffset ;
|
||||
|
@ -1025,6 +1261,9 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
|
|||
{ sf_count_t total = 0 ;
|
||||
ssize_t count ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.read (ptr, bytes*items, psf->vio_user_data) / bytes ;
|
||||
|
||||
items *= bytes ;
|
||||
|
||||
/* Do this check after the multiplication above. */
|
||||
|
@ -1060,6 +1299,9 @@ psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf
|
|||
{ sf_count_t total = 0 ;
|
||||
ssize_t count ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.write (ptr, bytes*items, psf->vio_user_data) / bytes ;
|
||||
|
||||
items *= bytes ;
|
||||
|
||||
/* Do this check after the multiplication above. */
|
||||
|
@ -1094,6 +1336,9 @@ psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf
|
|||
psf_ftell (SF_PRIVATE *psf)
|
||||
{ sf_count_t pos ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.tell (psf->vio_user_data) ;
|
||||
|
||||
pos = _telli64 (psf->filedes) ;
|
||||
|
||||
if (pos == ((sf_count_t) -1))
|
||||
|
@ -1148,8 +1393,10 @@ psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf)
|
|||
psf_is_pipe (SF_PRIVATE *psf)
|
||||
{ struct stat statbuf ;
|
||||
|
||||
/* Not sure if this works. */
|
||||
if (psf->virtual_io)
|
||||
return SF_FALSE ;
|
||||
|
||||
/* Not sure if this works. */
|
||||
if (fstat (psf->filedes, &statbuf) == -1)
|
||||
{ psf_log_syserr (psf, errno) ;
|
||||
/* Default to maximum safety. */
|
||||
|
@ -1183,6 +1430,9 @@ psf_get_filelen (SF_PRIVATE *psf)
|
|||
#else
|
||||
sf_count_t current, filelen ;
|
||||
|
||||
if (psf->virtual_io)
|
||||
return psf->vio.get_filelen (psf->vio_user_data) ;
|
||||
|
||||
if ((current = _telli64 (psf->filedes)) < 0)
|
||||
{ psf_log_syserr (psf, errno) ;
|
||||
return (sf_count_t) -1 ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -16,12 +16,13 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
#include "float_cast.h"
|
||||
|
@ -56,22 +57,22 @@ static sf_count_t host_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t host_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t host_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t host_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static void float32_peak_update (SF_PRIVATE *psf, float *buffer, int count, int indx) ;
|
||||
static void float32_peak_update (SF_PRIVATE *psf, const float *buffer, int count, sf_count_t indx) ;
|
||||
|
||||
static sf_count_t replace_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t replace_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t replace_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static void bf2f_array (float *buffer, int count) ;
|
||||
static void f2bf_array (float *buffer, int count) ;
|
||||
|
@ -306,7 +307,7 @@ float32_le_write (float in, unsigned char *out)
|
|||
|
||||
memset (out, 0, sizeof (int)) ;
|
||||
|
||||
if (in == 0.0)
|
||||
if (fabs (in) < 1e-30)
|
||||
return ;
|
||||
|
||||
if (in < 0.0)
|
||||
|
@ -341,7 +342,7 @@ float32_be_write (float in, unsigned char *out)
|
|||
|
||||
memset (out, 0, sizeof (int)) ;
|
||||
|
||||
if (in == 0.0)
|
||||
if (fabs (in) < 1e-30)
|
||||
return ;
|
||||
|
||||
if (in < 0.0)
|
||||
|
@ -375,7 +376,7 @@ float32_be_write (float in, unsigned char *out)
|
|||
*/
|
||||
|
||||
static void
|
||||
float32_peak_update (SF_PRIVATE *psf, float *buffer, int count, int indx)
|
||||
float32_peak_update (SF_PRIVATE *psf, const float *buffer, int count, sf_count_t indx)
|
||||
{ int chan ;
|
||||
int k, position ;
|
||||
float fmaxval ;
|
||||
|
@ -389,9 +390,9 @@ float32_peak_update (SF_PRIVATE *psf, float *buffer, int count, int indx)
|
|||
position = k ;
|
||||
} ;
|
||||
|
||||
if (fmaxval > psf->pchunk->peaks [chan].value)
|
||||
{ psf->pchunk->peaks [chan].value = fmaxval ;
|
||||
psf->pchunk->peaks [chan].position = psf->write_current + indx + (position / psf->sf.channels) ;
|
||||
if (fmaxval > psf->peak_info->peaks [chan].value)
|
||||
{ psf->peak_info->peaks [chan].value = fmaxval ;
|
||||
psf->peak_info->peaks [chan].position = psf->write_current + indx + (position / psf->sf.channels) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
|
@ -428,28 +429,28 @@ float32_get_capability (SF_PRIVATE *psf)
|
|||
*/
|
||||
|
||||
static inline void
|
||||
f2s_array (float *src, int count, short *dest, float scale)
|
||||
f2s_array (const float *src, int count, short *dest, float scale)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = lrintf (scale * src [count]) ;
|
||||
} ;
|
||||
} /* f2s_array */
|
||||
|
||||
static inline void
|
||||
f2i_array (float *src, int count, int *dest, float scale)
|
||||
f2i_array (const float *src, int count, int *dest, float scale)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = lrintf (scale * src [count]) ;
|
||||
} ;
|
||||
} /* f2i_array */
|
||||
|
||||
static inline void
|
||||
f2d_array (float *src, int count, double *dest)
|
||||
f2d_array (const float *src, int count, double *dest)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = src [count] ;
|
||||
} ;
|
||||
} /* f2d_array */
|
||||
|
||||
static inline void
|
||||
s2f_array (short *src, float *dest, int count)
|
||||
s2f_array (const short *src, float *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = src [count] ;
|
||||
} ;
|
||||
|
@ -457,14 +458,14 @@ s2f_array (short *src, float *dest, int count)
|
|||
} /* s2f_array */
|
||||
|
||||
static inline void
|
||||
i2f_array (int *src, float *dest, int count)
|
||||
i2f_array (const int *src, float *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = src [count] ;
|
||||
} ;
|
||||
} /* i2f_array */
|
||||
|
||||
static inline void
|
||||
d2f_array (double *src, float *dest, int count)
|
||||
d2f_array (const double *src, float *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
{ dest [count] = src [count] ;
|
||||
} ;
|
||||
|
@ -581,7 +582,7 @@ host_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
} /* host_read_f2d */
|
||||
|
||||
static sf_count_t
|
||||
host_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
host_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -592,8 +593,8 @@ host_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
bufferlen = (int) len ;
|
||||
s2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
@ -609,7 +610,7 @@ host_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* host_write_s2f */
|
||||
|
||||
static sf_count_t
|
||||
host_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
host_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -620,8 +621,8 @@ host_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
bufferlen = (int) len ;
|
||||
i2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
@ -637,11 +638,11 @@ host_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* host_write_i2f */
|
||||
|
||||
static sf_count_t
|
||||
host_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
host_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (psf->has_peak)
|
||||
if (psf->peak_info)
|
||||
float32_peak_update (psf, ptr, len, 0) ;
|
||||
|
||||
if (psf->float_endswap != SF_TRUE)
|
||||
|
@ -653,7 +654,7 @@ host_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
{ if (len < bufferlen)
|
||||
bufferlen = (int) len ;
|
||||
|
||||
endswap_int_copy (psf->u.ibuf, (int*) (ptr + total), bufferlen) ;
|
||||
endswap_int_copy (psf->u.ibuf, (const int*) (ptr + total), bufferlen) ;
|
||||
|
||||
writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ;
|
||||
total += writecount ;
|
||||
|
@ -666,7 +667,7 @@ host_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* host_write_f */
|
||||
|
||||
static sf_count_t
|
||||
host_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
host_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -678,8 +679,8 @@ host_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
|
||||
d2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
if (psf->float_endswap == SF_TRUE)
|
||||
endswap_int_array (psf->u.ibuf, bufferlen) ;
|
||||
|
@ -813,7 +814,7 @@ replace_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
} /* replace_read_f2d */
|
||||
|
||||
static sf_count_t
|
||||
replace_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
replace_write_s2f (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -824,8 +825,8 @@ replace_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
bufferlen = (int) len ;
|
||||
s2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
f2bf_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
|
@ -843,7 +844,7 @@ replace_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* replace_write_s2f */
|
||||
|
||||
static sf_count_t
|
||||
replace_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
replace_write_i2f (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -854,8 +855,8 @@ replace_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
bufferlen = (int) len ;
|
||||
i2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
f2bf_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
|
@ -873,12 +874,12 @@ replace_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* replace_write_i2f */
|
||||
|
||||
static sf_count_t
|
||||
replace_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
replace_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
/* FIX THIS */
|
||||
if (psf->has_peak)
|
||||
if (psf->peak_info)
|
||||
float32_peak_update (psf, ptr, len, 0) ;
|
||||
|
||||
bufferlen = ARRAY_LEN (psf->u.fbuf) ;
|
||||
|
@ -905,7 +906,7 @@ replace_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* replace_write_f */
|
||||
|
||||
static sf_count_t
|
||||
replace_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
replace_write_d2f (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -916,8 +917,8 @@ replace_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
bufferlen = (int) len ;
|
||||
d2f_array (ptr + total, psf->u.fbuf, bufferlen) ;
|
||||
|
||||
if (psf->has_peak)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ;
|
||||
if (psf->peak_info)
|
||||
float32_peak_update (psf, psf->u.fbuf, bufferlen, total / psf->sf.channels) ;
|
||||
|
||||
f2bf_array (psf->u.fbuf, bufferlen) ;
|
||||
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Version 1.3 */
|
||||
/* Version 1.4 */
|
||||
|
||||
#ifndef FLOAT_CAST_HEADER
|
||||
#define FLOAT_CAST_HEADER
|
||||
|
||||
/*============================================================================
|
||||
** On Intel Pentium processors (especially PIII and probably P4), converting
|
||||
|
@ -43,12 +45,12 @@
|
|||
** long int lrint (double x) ;
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
/*
|
||||
** The presence of the required functions are detected during the configure
|
||||
** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in
|
||||
** the config.h file.
|
||||
** the sfconfig.h file.
|
||||
*/
|
||||
|
||||
#define HAVE_LRINT_REPLACEMENT 0
|
||||
|
@ -71,10 +73,59 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
#elif (defined (__CYGWIN__))
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#undef HAVE_LRINT_REPLACEMENT
|
||||
#define HAVE_LRINT_REPLACEMENT 1
|
||||
|
||||
#undef lrint
|
||||
#undef lrintf
|
||||
|
||||
#define lrint double2int
|
||||
#define lrintf float2int
|
||||
|
||||
/*
|
||||
** The native CYGWIN lrint and lrintf functions are buggy:
|
||||
** http://sourceware.org/ml/cygwin/2005-06/msg00153.html
|
||||
** http://sourceware.org/ml/cygwin/2005-09/msg00047.html
|
||||
** and slow.
|
||||
** These functions (pulled from the Public Domain MinGW math.h header)
|
||||
** replace the native versions.
|
||||
*/
|
||||
|
||||
static inline long double2int (double in)
|
||||
{ long retval ;
|
||||
|
||||
__asm__ __volatile__
|
||||
( "fistpl %0"
|
||||
: "=m" (retval)
|
||||
: "t" (in)
|
||||
: "st"
|
||||
) ;
|
||||
|
||||
return retval ;
|
||||
} /* double2int */
|
||||
|
||||
static inline long float2int (float in)
|
||||
{ long retval ;
|
||||
|
||||
__asm__ __volatile__
|
||||
( "fistpl %0"
|
||||
: "=m" (retval)
|
||||
: "t" (in)
|
||||
: "st"
|
||||
) ;
|
||||
|
||||
return retval ;
|
||||
} /* float2int */
|
||||
|
||||
#elif (defined (WIN32) || defined (_WIN32))
|
||||
|
||||
#undef HAVE_LRINT_REPLACEMENT
|
||||
#define HAVE_LRINT_REPLACEMENT 1
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
|
@ -156,7 +207,7 @@
|
|||
#define lrint double2int
|
||||
#define lrintf float2int
|
||||
|
||||
inline static long int
|
||||
inline static long
|
||||
float2int (register float in)
|
||||
{ int res [2] ;
|
||||
|
||||
|
@ -171,7 +222,7 @@
|
|||
return res [1] ;
|
||||
} /* lrintf */
|
||||
|
||||
inline static long int
|
||||
inline static long
|
||||
double2int (register double in)
|
||||
{ int res [2] ;
|
||||
|
||||
|
@ -200,10 +251,11 @@
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* FLOAT_CAST_HEADER */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 42db1693-ff61-4051-bac1-e4d24c4e30b7
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -43,6 +43,7 @@ typedef struct gsm610_tag
|
|||
short samples [WAV_W64_GSM610_SAMPLES] ;
|
||||
unsigned char block [WAV_W64_GSM610_BLOCKSIZE] ;
|
||||
|
||||
/* Damn I hate typedef-ed pointers; yes, gsm is a pointer type. */
|
||||
gsm gsm_data ;
|
||||
} GSM610_PRIVATE ;
|
||||
|
||||
|
@ -51,13 +52,13 @@ static sf_count_t gsm610_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t gsm610_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t gsm610_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t gsm610_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t gsm610_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t gsm610_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t gsm610_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t gsm610_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t gsm610_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t gsm610_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t gsm610_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static int gsm610_read_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, short *ptr, int len) ;
|
||||
static int gsm610_write_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, short *ptr, int len) ;
|
||||
static int gsm610_write_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, const short *ptr, int len) ;
|
||||
|
||||
static int gsm610_decode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) ;
|
||||
static int gsm610_encode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) ;
|
||||
|
@ -78,12 +79,17 @@ gsm610_init (SF_PRIVATE *psf)
|
|||
{ GSM610_PRIVATE *pgsm610 ;
|
||||
int true_flag = 1 ;
|
||||
|
||||
if (psf->fdata != NULL)
|
||||
{ psf_log_printf (psf, "*** psf->fdata is not NULL.\n") ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
if (psf->mode == SFM_RDWR)
|
||||
return SFE_BAD_MODE_RW ;
|
||||
|
||||
psf->sf.seekable = SF_FALSE ;
|
||||
|
||||
if (! (pgsm610 = malloc (sizeof (GSM610_PRIVATE))))
|
||||
if ((pgsm610 = calloc (1, sizeof (GSM610_PRIVATE))) == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
|
||||
psf->fdata = (void*) pgsm610 ;
|
||||
|
@ -96,34 +102,53 @@ Need separate gsm_data structs for encode and decode.
|
|||
|
||||
============================================================*/
|
||||
|
||||
if (! (pgsm610->gsm_data = gsm_create ()))
|
||||
if ((pgsm610->gsm_data = gsm_create ()) == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
|
||||
if ((psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV ||
|
||||
(psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_W64)
|
||||
{ gsm_option (pgsm610->gsm_data, GSM_OPT_WAV49, &true_flag) ;
|
||||
switch (psf->sf.format & SF_FORMAT_TYPEMASK)
|
||||
{ case SF_FORMAT_WAV :
|
||||
case SF_FORMAT_WAVEX :
|
||||
case SF_FORMAT_W64 :
|
||||
gsm_option (pgsm610->gsm_data, GSM_OPT_WAV49, &true_flag) ;
|
||||
|
||||
pgsm610->encode_block = gsm610_wav_encode_block ;
|
||||
pgsm610->decode_block = gsm610_wav_decode_block ;
|
||||
pgsm610->encode_block = gsm610_wav_encode_block ;
|
||||
pgsm610->decode_block = gsm610_wav_decode_block ;
|
||||
|
||||
pgsm610->samplesperblock = WAV_W64_GSM610_SAMPLES ;
|
||||
pgsm610->blocksize = WAV_W64_GSM610_BLOCKSIZE ;
|
||||
}
|
||||
else
|
||||
{ pgsm610->encode_block = gsm610_encode_block ;
|
||||
pgsm610->decode_block = gsm610_decode_block ;
|
||||
pgsm610->samplesperblock = WAV_W64_GSM610_SAMPLES ;
|
||||
pgsm610->blocksize = WAV_W64_GSM610_BLOCKSIZE ;
|
||||
break ;
|
||||
|
||||
pgsm610->samplesperblock = GSM610_SAMPLES ;
|
||||
pgsm610->blocksize = GSM610_BLOCKSIZE ;
|
||||
case SF_FORMAT_AIFF :
|
||||
case SF_FORMAT_RAW :
|
||||
pgsm610->encode_block = gsm610_encode_block ;
|
||||
pgsm610->decode_block = gsm610_decode_block ;
|
||||
|
||||
pgsm610->samplesperblock = GSM610_SAMPLES ;
|
||||
pgsm610->blocksize = GSM610_BLOCKSIZE ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
return SFE_INTERNAL ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
if (psf->mode == SFM_READ)
|
||||
{ if (psf->datalength % pgsm610->blocksize)
|
||||
{ psf_log_printf (psf, "*** Warning : data chunk seems to be truncated.\n") ;
|
||||
pgsm610->blocks = psf->datalength / pgsm610->blocksize + 1 ;
|
||||
{ if (psf->datalength % pgsm610->blocksize == 0)
|
||||
pgsm610->blocks = psf->datalength / pgsm610->blocksize ;
|
||||
else if (psf->datalength % pgsm610->blocksize == 1 && pgsm610->blocksize == GSM610_BLOCKSIZE)
|
||||
{ /*
|
||||
** Weird AIFF specific case.
|
||||
** AIFF chunks must be at an odd offset from the start of file and
|
||||
** GSM610_BLOCKSIZE is odd which can result in an odd length SSND
|
||||
** chunk. The SSND chunk then gets padded on write which means that
|
||||
** when it is read the datalength is too big by 1.
|
||||
*/
|
||||
pgsm610->blocks = psf->datalength / pgsm610->blocksize ;
|
||||
}
|
||||
else
|
||||
pgsm610->blocks = psf->datalength / pgsm610->blocksize ;
|
||||
{ psf_log_printf (psf, "*** Warning : data chunk seems to be truncated.\n") ;
|
||||
pgsm610->blocks = psf->datalength / pgsm610->blocksize + 1 ;
|
||||
} ;
|
||||
|
||||
psf->sf.frames = pgsm610->samplesperblock * pgsm610->blocks ;
|
||||
|
||||
|
@ -145,7 +170,8 @@ Need separate gsm_data structs for encode and decode.
|
|||
psf->write_double = gsm610_write_d ;
|
||||
} ;
|
||||
|
||||
psf->close = gsm610_close ;
|
||||
psf->codec_close = gsm610_close ;
|
||||
|
||||
psf->seek = gsm610_seek ;
|
||||
|
||||
psf->filelength = psf_get_filelen (psf) ;
|
||||
|
@ -215,7 +241,7 @@ gsm610_read_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, short *ptr, int len
|
|||
|
||||
while (indx < len)
|
||||
{ if (pgsm610->blockcount >= pgsm610->blocks && pgsm610->samplecount >= pgsm610->samplesperblock)
|
||||
{ memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ;
|
||||
{ memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ;
|
||||
return total ;
|
||||
} ;
|
||||
|
||||
|
@ -240,7 +266,7 @@ gsm610_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
int readcount, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
|
@ -266,7 +292,7 @@ gsm610_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
int k, bufferlen, readcount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
|
@ -292,7 +318,7 @@ gsm610_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
sf_count_t total = 0 ;
|
||||
float normfact ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
|
@ -322,7 +348,7 @@ gsm610_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
|
||||
normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
|
@ -347,13 +373,13 @@ gsm610_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
mode = mode ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
if (psf->dataoffset < 0)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (offset == 0)
|
||||
|
@ -374,7 +400,7 @@ gsm610_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
if (offset < 0 || offset > pgsm610->blocks * pgsm610->samplesperblock)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
newblock = offset / pgsm610->samplesperblock ;
|
||||
|
@ -393,7 +419,7 @@ gsm610_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
/* What to do about write??? */
|
||||
psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} /* gsm610_seek */
|
||||
|
||||
/*==========================================================================================
|
||||
|
@ -442,7 +468,7 @@ gsm610_wav_encode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610)
|
|||
} /* gsm610_wav_encode_block */
|
||||
|
||||
static int
|
||||
gsm610_write_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, short *ptr, int len)
|
||||
gsm610_write_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, const short *ptr, int len)
|
||||
{ int count, total = 0, indx = 0 ;
|
||||
|
||||
while (indx < len)
|
||||
|
@ -464,12 +490,12 @@ gsm610_write_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, short *ptr, int le
|
|||
} /* gsm610_write_block */
|
||||
|
||||
static sf_count_t
|
||||
gsm610_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
gsm610_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ GSM610_PRIVATE *pgsm610 ;
|
||||
int writecount, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
|
@ -489,13 +515,13 @@ gsm610_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* gsm610_write_s */
|
||||
|
||||
static sf_count_t
|
||||
gsm610_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
gsm610_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ GSM610_PRIVATE *pgsm610 ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
|
@ -514,14 +540,14 @@ gsm610_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* gsm610_write_i */
|
||||
|
||||
static sf_count_t
|
||||
gsm610_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
gsm610_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ GSM610_PRIVATE *pgsm610 ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
float normfact ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
|
@ -542,14 +568,14 @@ gsm610_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* gsm610_write_f */
|
||||
|
||||
static sf_count_t
|
||||
gsm610_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
gsm610_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ GSM610_PRIVATE *pgsm610 ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
sf_count_t total = 0 ;
|
||||
double normfact ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
||||
|
@ -573,7 +599,7 @@ static int
|
|||
gsm610_close (SF_PRIVATE *psf)
|
||||
{ GSM610_PRIVATE *pgsm610 ;
|
||||
|
||||
if (! psf->fdata)
|
||||
if (psf->fdata == NULL)
|
||||
return 0 ;
|
||||
|
||||
pgsm610 = (GSM610_PRIVATE*) psf->fdata ;
|
||||
|
@ -585,9 +611,6 @@ gsm610_close (SF_PRIVATE *psf)
|
|||
|
||||
if (pgsm610->samplecount && pgsm610->samplecount < pgsm610->samplesperblock)
|
||||
pgsm610->encode_block (psf, pgsm610) ;
|
||||
|
||||
if (psf->write_header)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
} ;
|
||||
|
||||
if (pgsm610->gsm_data)
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
@ -73,7 +74,7 @@ htk_open (SF_PRIVATE *psf)
|
|||
psf->write_header = htk_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = htk_close ;
|
||||
psf->container_close = htk_close ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
|
||||
|
||||
|
@ -208,8 +209,6 @@ htk_read_header (SF_PRIVATE *psf)
|
|||
|
||||
psf->datalength = psf->filelength - psf->dataoffset ;
|
||||
|
||||
psf->close = htk_close ;
|
||||
|
||||
psf->blockwidth = psf->sf.channels * psf->bytewidth ;
|
||||
|
||||
if (! psf->sf.frames && psf->blockwidth)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -16,12 +16,13 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "float_cast.h"
|
||||
#include "common.h"
|
||||
|
@ -37,9 +38,9 @@ typedef struct IMA_ADPCM_PRIVATE_tag
|
|||
unsigned char *block ;
|
||||
short *samples ;
|
||||
#if HAVE_FLEXIBLE_ARRAY
|
||||
unsigned short data [] ; /* ISO C99 struct flexible array. */
|
||||
short data [] ; /* ISO C99 struct flexible array. */
|
||||
#else
|
||||
unsigned short data [0] ; /* This is a hack and might not work. */
|
||||
short data [0] ; /* This is a hack and might not work. */
|
||||
#endif
|
||||
} IMA_ADPCM_PRIVATE ;
|
||||
|
||||
|
@ -68,22 +69,21 @@ static int ima_reader_init (SF_PRIVATE *psf, int blockalign, int samplesperblock
|
|||
static int ima_writer_init (SF_PRIVATE *psf, int blockalign) ;
|
||||
|
||||
static int ima_read_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, short *ptr, int len) ;
|
||||
static int ima_write_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, short *ptr, int len) ;
|
||||
static int ima_write_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, const short *ptr, int len) ;
|
||||
|
||||
static sf_count_t ima_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t ima_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t ima_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t ima_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
|
||||
|
||||
static int wav_w64_ima_close (SF_PRIVATE *psf) ;
|
||||
static int aiff_ima_close (SF_PRIVATE *psf) ;
|
||||
static int ima_close (SF_PRIVATE *psf) ;
|
||||
|
||||
static int wav_w64_ima_decode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) ;
|
||||
static int wav_w64_ima_encode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) ;
|
||||
|
@ -101,6 +101,11 @@ int
|
|||
wav_w64_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock)
|
||||
{ int error ;
|
||||
|
||||
if (psf->fdata != NULL)
|
||||
{ psf_log_printf (psf, "*** psf->fdata is not NULL.\n") ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
if (psf->mode == SFM_RDWR)
|
||||
return SFE_BAD_MODE_RW ;
|
||||
|
||||
|
@ -112,40 +117,12 @@ wav_w64_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock)
|
|||
if ((error = ima_writer_init (psf, blockalign)))
|
||||
return error ;
|
||||
|
||||
psf->codec_close = ima_close ;
|
||||
psf->seek = ima_seek ;
|
||||
psf->close = wav_w64_ima_close ;
|
||||
|
||||
return 0 ;
|
||||
} /* wav_w64_ima_init */
|
||||
|
||||
static int
|
||||
wav_w64_ima_close (SF_PRIVATE *psf)
|
||||
{ IMA_ADPCM_PRIVATE *pima ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
|
||||
pima = (IMA_ADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
if (psf->mode == SFM_WRITE)
|
||||
{ /* If a block has been partially assembled, write it out
|
||||
** as the final block.
|
||||
*/
|
||||
if (pima->samplecount && pima->samplecount < pima->samplesperblock)
|
||||
pima->encode_block (psf, pima) ;
|
||||
|
||||
psf->sf.frames = pima->samplesperblock * pima->blockcount / psf->sf.channels ;
|
||||
|
||||
if (psf->write_header)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
} ;
|
||||
|
||||
free (psf->fdata) ;
|
||||
psf->fdata = NULL ;
|
||||
|
||||
return 0 ;
|
||||
} /* wav_w64_ima_close */
|
||||
|
||||
int
|
||||
aiff_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock)
|
||||
{ int error ;
|
||||
|
@ -161,38 +138,29 @@ aiff_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock)
|
|||
if ((error = ima_writer_init (psf, blockalign)))
|
||||
return error ;
|
||||
|
||||
psf->seek = ima_seek ;
|
||||
psf->close = aiff_ima_close ;
|
||||
psf->codec_close = ima_close ;
|
||||
|
||||
return 0 ;
|
||||
} /* aiff_ima_init */
|
||||
|
||||
static int
|
||||
aiff_ima_close (SF_PRIVATE *psf)
|
||||
ima_close (SF_PRIVATE *psf)
|
||||
{ IMA_ADPCM_PRIVATE *pima ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
|
||||
pima = (IMA_ADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
if (psf->mode == SFM_WRITE)
|
||||
{ /* If a block has been partially assembled, write it out
|
||||
** as the final block.
|
||||
*/
|
||||
|
||||
if (pima->samplecount && pima->samplecount < pima->samplesperblock)
|
||||
pima->encode_block (psf, pima) ;
|
||||
|
||||
if (psf->write_header)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
psf->sf.frames = pima->samplesperblock * pima->blockcount / psf->sf.channels ;
|
||||
} ;
|
||||
|
||||
free (psf->fdata) ;
|
||||
psf->fdata = NULL ;
|
||||
|
||||
return 0 ;
|
||||
} /* aiff_ima_close */
|
||||
} /* ima_close */
|
||||
|
||||
/*============================================================================================
|
||||
** IMA ADPCM Read Functions.
|
||||
|
@ -773,7 +741,7 @@ ima_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
if (psf->datalength < 0 || psf->dataoffset < 0)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (offset == 0)
|
||||
|
@ -786,7 +754,7 @@ ima_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
if (offset < 0 || offset > pima->blocks * pima->samplesperblock)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
newblock = offset / pima->samplesperblock ;
|
||||
|
@ -801,7 +769,7 @@ ima_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
else
|
||||
{ /* What to do about write??? */
|
||||
psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
return newblock * pima->samplesperblock + newsample ;
|
||||
|
@ -866,7 +834,7 @@ ima_writer_init (SF_PRIVATE *psf, int blockalign)
|
|||
*/
|
||||
|
||||
static int
|
||||
ima_write_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, short *ptr, int len)
|
||||
ima_write_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, const short *ptr, int len)
|
||||
{ int count, total = 0, indx = 0 ;
|
||||
|
||||
while (indx < len)
|
||||
|
@ -888,7 +856,7 @@ ima_write_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, short *ptr, int len)
|
|||
} /* ima_write_block */
|
||||
|
||||
static sf_count_t
|
||||
ima_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
ima_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ IMA_ADPCM_PRIVATE *pima ;
|
||||
int writecount, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -912,7 +880,7 @@ ima_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* ima_write_s */
|
||||
|
||||
static sf_count_t
|
||||
ima_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
ima_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ IMA_ADPCM_PRIVATE *pima ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -939,7 +907,7 @@ ima_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* ima_write_i */
|
||||
|
||||
static sf_count_t
|
||||
ima_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
ima_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ IMA_ADPCM_PRIVATE *pima ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -969,7 +937,7 @@ ima_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* ima_write_f */
|
||||
|
||||
static sf_count_t
|
||||
ima_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
ima_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ IMA_ADPCM_PRIVATE *pima ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "sfendian.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
#define INTERLEAVE_CHANNELS 6
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
@ -40,7 +41,7 @@
|
|||
#define IRCAM_LE_MASK (MAKE_MARKER (0xFF, 0x00, 0xFF, 0xFF))
|
||||
#define IRCAM_LE_MARKER (MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
|
||||
|
||||
#define IRCAM_02B_MARKER (MAKE_MARKER (0x00, 0x02, 0xA3, 0x64))
|
||||
#define IRCAM_02B_MARKER (MAKE_MARKER (0x64, 0xA3, 0x02, 0x00))
|
||||
#define IRCAM_03L_MARKER (MAKE_MARKER (0x64, 0xA3, 0x03, 0x00))
|
||||
|
||||
#define IRCAM_DATA_OFFSET (1024)
|
||||
|
@ -102,7 +103,7 @@ ircam_open (SF_PRIVATE *psf)
|
|||
psf->write_header = ircam_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = ircam_close ;
|
||||
psf->container_close = ircam_close ;
|
||||
|
||||
switch (subformat)
|
||||
{ case SF_FORMAT_ULAW : /* 8-bit Ulaw encoding. */
|
||||
|
@ -139,8 +140,7 @@ ircam_read_header (SF_PRIVATE *psf)
|
|||
|
||||
psf_binheader_readf (psf, "epmf44", 0, &marker, &samplerate, &(psf->sf.channels), &encoding) ;
|
||||
|
||||
if (((marker & IRCAM_LE_MASK) != IRCAM_LE_MARKER) &&
|
||||
((marker & IRCAM_BE_MASK) != IRCAM_BE_MARKER))
|
||||
if (((marker & IRCAM_BE_MASK) != IRCAM_BE_MARKER) && ((marker & IRCAM_LE_MASK) != IRCAM_LE_MARKER))
|
||||
{ psf_log_printf (psf, "marker: 0x%X\n", marker) ;
|
||||
return SFE_IRCAM_NO_MARKER ;
|
||||
} ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; Auto-generated by create_symbols_file.py
|
||||
|
||||
LIBRARY libsndfile.dll
|
||||
LIBRARY libsndfile-1.dll
|
||||
EXPORTS
|
||||
|
||||
sf_command @1
|
||||
|
@ -34,4 +34,6 @@ sf_strerror @50
|
|||
sf_get_string @60
|
||||
sf_set_string @61
|
||||
sf_open_fd @70
|
||||
sf_open_virtual @80
|
||||
sf_write_sync @90
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2003-2005 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2003-2005 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
#include "float_cast.h"
|
||||
|
@ -101,7 +102,7 @@ mat4_open (SF_PRIVATE *psf)
|
|||
psf->write_header = mat4_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = mat4_close ;
|
||||
psf->container_close = mat4_close ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
|
||||
|
||||
|
@ -242,8 +243,8 @@ mat4_read_header (SF_PRIVATE *psf)
|
|||
|
||||
psf_binheader_readf (psf, "d", &value) ;
|
||||
|
||||
LSF_SNPRINTF (psf->u.scbuf, sizeof (psf->u.scbuf), " Value : %f\n", value) ;
|
||||
psf_log_printf (psf, psf->u.scbuf) ;
|
||||
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), " Value : %f\n", value) ;
|
||||
psf_log_printf (psf, psf->u.cbuf) ;
|
||||
|
||||
if ((rows != 1) || (cols != 1))
|
||||
return SFE_MAT4_NO_SAMPLERATE ;
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
#include "float_cast.h"
|
||||
|
@ -111,7 +112,7 @@ mat5_open (SF_PRIVATE *psf)
|
|||
psf->write_header = mat5_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = mat5_close ;
|
||||
psf->container_close = mat5_close ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
|
||||
|
||||
|
@ -153,7 +154,8 @@ mat5_close (SF_PRIVATE *psf)
|
|||
|
||||
static int
|
||||
mat5_write_header (SF_PRIVATE *psf, int calc_length)
|
||||
{ static const char *sr_name = "samplerate\0\0\0\0\0\0\0\0\0\0\0" ;
|
||||
{ static const char *filename = "MATLAB 5.0 MAT-file, written by " PACKAGE "-" VERSION ", " ;
|
||||
static const char *sr_name = "samplerate\0\0\0\0\0\0\0\0\0\0\0" ;
|
||||
static const char *wd_name = "wavedata\0" ;
|
||||
sf_count_t current, datasize ;
|
||||
int encoding ;
|
||||
|
@ -202,9 +204,8 @@ mat5_write_header (SF_PRIVATE *psf, int calc_length)
|
|||
psf->headindex = 0 ;
|
||||
psf_fseek (psf, 0, SEEK_SET) ;
|
||||
|
||||
psf_binheader_writef (psf, "S", "MATLAB 5.0 MAT-file, written by " PACKAGE "-" VERSION ", ") ;
|
||||
psf_get_date_str (psf->u.scbuf, sizeof (psf->u.scbuf)) ;
|
||||
psf_binheader_writef (psf, "jS", -1, psf->u.scbuf) ;
|
||||
psf_get_date_str (psf->u.cbuf, sizeof (psf->u.scbuf)) ;
|
||||
psf_binheader_writef (psf, "bb", filename, strlen (filename), psf->u.cbuf, strlen (psf->u.cbuf) + 1) ;
|
||||
|
||||
memset (psf->u.scbuf, ' ', 124 - psf->headindex) ;
|
||||
psf_binheader_writef (psf, "b", psf->u.scbuf, 124 - psf->headindex) ;
|
||||
|
@ -260,11 +261,11 @@ mat5_read_header (SF_PRIVATE *psf)
|
|||
short version, endian ;
|
||||
int type, size, flags1, flags2, rows, cols ;
|
||||
|
||||
psf_binheader_readf (psf, "pb", 0, psf->u.scbuf, 124) ;
|
||||
psf_binheader_readf (psf, "pb", 0, psf->u.cbuf, 124) ;
|
||||
|
||||
psf->u.scbuf [125] = 0 ;
|
||||
|
||||
if (strlen (psf->u.scbuf) >= 124)
|
||||
if (strlen (psf->u.cbuf) >= 124)
|
||||
return SFE_UNIMPLEMENTED ;
|
||||
|
||||
if (strstr (psf->u.cbuf, "MATLAB 5.0 MAT-file") == psf->u.cbuf)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -16,12 +16,13 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "float_cast.h"
|
||||
#include "common.h"
|
||||
|
@ -40,13 +41,13 @@
|
|||
typedef struct
|
||||
{ int channels, blocksize, samplesperblock, blocks, dataremaining ;
|
||||
int blockcount ;
|
||||
sf_count_t samplecount ;
|
||||
sf_count_t samplecount ;
|
||||
short *samples ;
|
||||
unsigned char *block ;
|
||||
#if HAVE_FLEXIBLE_ARRAY
|
||||
unsigned short dummydata [] ; /* ISO C99 struct flexible array. */
|
||||
short dummydata [] ; /* ISO C99 struct flexible array. */
|
||||
#else
|
||||
unsigned short dummydata [0] ; /* This is a hack an might not work. */
|
||||
short dummydata [0] ; /* This is a hack an might not work. */
|
||||
#endif
|
||||
} MSADPCM_PRIVATE ;
|
||||
|
||||
|
@ -104,17 +105,17 @@ static int msadpcm_decode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms) ;
|
|||
static sf_count_t msadpcm_read_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, short *ptr, int len) ;
|
||||
|
||||
static int msadpcm_encode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms) ;
|
||||
static sf_count_t msadpcm_write_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, short *ptr, int len) ;
|
||||
static sf_count_t msadpcm_write_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, const short *ptr, int len) ;
|
||||
|
||||
static sf_count_t msadpcm_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t msadpcm_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t msadpcm_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t msadpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
|
||||
static int msadpcm_close (SF_PRIVATE *psf) ;
|
||||
|
@ -131,6 +132,11 @@ wav_w64_msadpcm_init (SF_PRIVATE *psf, int blockalign, int samplesperblock)
|
|||
unsigned int pmssize ;
|
||||
int count ;
|
||||
|
||||
if (psf->fdata != NULL)
|
||||
{ psf_log_printf (psf, "*** psf->fdata is not NULL.\n") ;
|
||||
return SFE_INTERNAL ;
|
||||
} ;
|
||||
|
||||
if (psf->mode == SFM_WRITE)
|
||||
samplesperblock = 2 + 2 * (blockalign - 7 * psf->sf.channels) / psf->sf.channels ;
|
||||
|
||||
|
@ -183,8 +189,8 @@ wav_w64_msadpcm_init (SF_PRIVATE *psf, int blockalign, int samplesperblock)
|
|||
psf->write_double = msadpcm_write_d ;
|
||||
} ;
|
||||
|
||||
psf->seek = msadpcm_seek ;
|
||||
psf->close = msadpcm_close ;
|
||||
psf->codec_close = msadpcm_close ;
|
||||
psf->seek = msadpcm_seek ;
|
||||
|
||||
return 0 ;
|
||||
} /* wav_w64_msadpcm_init */
|
||||
|
@ -442,7 +448,7 @@ msadpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
if (psf->datalength < 0 || psf->dataoffset < 0)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (offset == 0)
|
||||
|
@ -455,7 +461,7 @@ msadpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
if (offset < 0 || offset > pms->blocks * pms->samplesperblock)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
newblock = offset / pms->samplesperblock ;
|
||||
|
@ -470,7 +476,7 @@ msadpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
else
|
||||
{ /* What to do about write??? */
|
||||
psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
return newblock * pms->samplesperblock + newsample ;
|
||||
|
@ -485,7 +491,7 @@ msadpcm_write_adapt_coeffs (SF_PRIVATE *psf)
|
|||
{ int k ;
|
||||
|
||||
for (k = 0 ; k < MSADPCM_ADAPT_COEFF_COUNT ; k++)
|
||||
psf_binheader_writef (psf, "e22", AdaptCoeff1 [k], AdaptCoeff2 [k]) ;
|
||||
psf_binheader_writef (psf, "22", AdaptCoeff1 [k], AdaptCoeff2 [k]) ;
|
||||
} /* msadpcm_write_adapt_coeffs */
|
||||
|
||||
/*==========================================================================================
|
||||
|
@ -613,7 +619,7 @@ msadpcm_encode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms)
|
|||
} /* msadpcm_encode_block */
|
||||
|
||||
static sf_count_t
|
||||
msadpcm_write_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, short *ptr, int len)
|
||||
msadpcm_write_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, const short *ptr, int len)
|
||||
{ int count, total = 0, indx = 0 ;
|
||||
|
||||
while (indx < len)
|
||||
|
@ -635,7 +641,7 @@ msadpcm_write_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, short *ptr, int len)
|
|||
} /* msadpcm_write_block */
|
||||
|
||||
static sf_count_t
|
||||
msadpcm_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
msadpcm_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ MSADPCM_PRIVATE *pms ;
|
||||
int writecount, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -659,7 +665,7 @@ msadpcm_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* msadpcm_write_s */
|
||||
|
||||
static sf_count_t
|
||||
msadpcm_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
msadpcm_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ MSADPCM_PRIVATE *pms ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -685,7 +691,7 @@ msadpcm_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* msadpcm_write_i */
|
||||
|
||||
static sf_count_t
|
||||
msadpcm_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
msadpcm_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ MSADPCM_PRIVATE *pms ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -714,7 +720,7 @@ msadpcm_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* msadpcm_write_f */
|
||||
|
||||
static sf_count_t
|
||||
msadpcm_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
msadpcm_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ MSADPCM_PRIVATE *pms ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -749,9 +755,6 @@ static int
|
|||
msadpcm_close (SF_PRIVATE *psf)
|
||||
{ MSADPCM_PRIVATE *pms ;
|
||||
|
||||
if (! psf->fdata)
|
||||
return 0 ;
|
||||
|
||||
pms = (MSADPCM_PRIVATE*) psf->fdata ;
|
||||
|
||||
if (psf->mode == SFM_WRITE)
|
||||
|
@ -761,9 +764,6 @@ msadpcm_close (SF_PRIVATE *psf)
|
|||
|
||||
if (pms->samplecount && pms->samplecount < pms->samplesperblock)
|
||||
msadpcm_encode_block (psf, pms) ;
|
||||
|
||||
if (psf->write_header)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
|
|
|
@ -23,13 +23,14 @@
|
|||
** However, no code from that package was used.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
@ -51,15 +52,13 @@ static int nist_read_header (SF_PRIVATE *psf) ;
|
|||
|
||||
int
|
||||
nist_open (SF_PRIVATE *psf)
|
||||
{ int subformat, error ;
|
||||
{ int error ;
|
||||
|
||||
if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
|
||||
{ if ((error = nist_read_header (psf)))
|
||||
return error ;
|
||||
} ;
|
||||
|
||||
subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
|
||||
{ if (psf->is_pipe)
|
||||
return SFE_NO_PIPE_WRITE ;
|
||||
|
@ -72,6 +71,7 @@ nist_open (SF_PRIVATE *psf)
|
|||
psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
|
||||
psf->sf.frames = 0 ;
|
||||
|
||||
if ((error = nist_write_header (psf, SF_FALSE)))
|
||||
return error ;
|
||||
|
@ -79,7 +79,7 @@ nist_open (SF_PRIVATE *psf)
|
|||
psf->write_header = nist_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = nist_close ;
|
||||
psf->container_close = nist_close ;
|
||||
|
||||
switch (psf->sf.format & SF_FORMAT_SUBMASK)
|
||||
{ case SF_FORMAT_PCM_S8 :
|
||||
|
@ -146,11 +146,18 @@ nist_read_header (SF_PRIVATE *psf)
|
|||
return SFE_NIST_CRLF_CONVERISON ;
|
||||
|
||||
/* Make sure its a NIST file. */
|
||||
if (strstr (psf_header, "NIST_1A\n 1024\n") != psf_header)
|
||||
if (strstr (psf_header, "NIST_1A\n") != psf_header)
|
||||
{ psf_log_printf (psf, "Not a NIST file.\n") ;
|
||||
return SFE_NIST_BAD_HEADER ;
|
||||
} ;
|
||||
|
||||
if (sscanf (psf_header, "NIST_1A\n%d\n", &count) == 1)
|
||||
psf->dataoffset = count ;
|
||||
else
|
||||
{ psf_log_printf (psf, "*** Suspicious header length.\n") ;
|
||||
psf->dataoffset = NIST_HEADER_LENGTH ;
|
||||
} ;
|
||||
|
||||
/* Determine sample encoding, start by assuming PCM. */
|
||||
encoding = SF_FORMAT_PCM_U8 ;
|
||||
if ((cptr = strstr (psf_header, "sample_coding -s")))
|
||||
|
@ -217,12 +224,9 @@ nist_read_header (SF_PRIVATE *psf)
|
|||
return SFE_NIST_BAD_ENCODING ;
|
||||
} ;
|
||||
|
||||
psf->dataoffset = NIST_HEADER_LENGTH ;
|
||||
psf->blockwidth = psf->sf.channels * psf->bytewidth ;
|
||||
psf->datalength = psf->filelength - psf->dataoffset ;
|
||||
|
||||
psf->close = nist_close ;
|
||||
|
||||
psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
|
||||
|
||||
if (encoding == SF_FORMAT_PCM_U8)
|
||||
|
@ -274,8 +278,17 @@ nist_write_header (SF_PRIVATE *psf, int calc_length)
|
|||
|
||||
current = psf_ftell (psf) ;
|
||||
|
||||
/* Prevent compiler warning. */
|
||||
calc_length = calc_length ;
|
||||
if (calc_length)
|
||||
{ psf->filelength = psf_get_filelen (psf) ;
|
||||
|
||||
psf->datalength = psf->filelength - psf->dataoffset ;
|
||||
|
||||
if (psf->dataend)
|
||||
psf->datalength -= psf->filelength - psf->dataend ;
|
||||
|
||||
if (psf->bytewidth > 0)
|
||||
psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ;
|
||||
} ;
|
||||
|
||||
if (psf->endian == SF_ENDIAN_BIG)
|
||||
end_str = "10" ;
|
||||
|
|
|
@ -16,18 +16,17 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
#if (ENABLE_EXPERIMENTAL_CODE == 0)
|
||||
|
||||
int
|
||||
ogg_open (SF_PRIVATE *psf)
|
||||
{ if (psf)
|
||||
|
@ -35,859 +34,6 @@ ogg_open (SF_PRIVATE *psf)
|
|||
return (psf && 0) ;
|
||||
} /* ogg_open */
|
||||
|
||||
#else
|
||||
|
||||
#define SFE_OGG_NOT_OGG 666
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Macros to handle big/little endian issues.
|
||||
*/
|
||||
|
||||
#define ALAW_MARKER MAKE_MARKER ('A', 'L', 'a', 'w')
|
||||
#define SOUN_MARKER MAKE_MARKER ('S', 'o', 'u', 'n')
|
||||
#define DFIL_MARKER MAKE_MARKER ('d', 'F', 'i', 'l')
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Private static functions.
|
||||
*/
|
||||
|
||||
static int ogg_read_header (SF_PRIVATE *psf) ;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Public function.
|
||||
*/
|
||||
|
||||
int
|
||||
ogg_open (SF_PRIVATE *psf)
|
||||
{ OGG_PRIVATE *pogg ;
|
||||
int subformat, error = 0 ;
|
||||
|
||||
if (psf->mode == SFM_RDWR)
|
||||
return SFE_UNIMPLEMENTED ;
|
||||
|
||||
psf->sf.sections = 1 ;
|
||||
|
||||
psf->datalength = psf->filelength ;
|
||||
psf->dataoffset = 0 ;
|
||||
psf->blockwidth = 0 ;
|
||||
psf->bytewidth = 1 ;
|
||||
|
||||
if (! (pogg = calloc (1, sizeof (OGG_PRIVATE))))
|
||||
return SFE_MALLOC_FAILED ;
|
||||
psf->fdata = pogg ;
|
||||
|
||||
if (psf->mode == SFM_READ)
|
||||
{ if ((error = pogg_read_header (psf)))
|
||||
return error ;
|
||||
} ;
|
||||
|
||||
if (psf->mode == SFM_WRITE)
|
||||
{ psf->str_flags = SF_STR_ALLOW_START ;
|
||||
|
||||
if ((error = pogg_write_header (psf)))
|
||||
return error ;
|
||||
} ;
|
||||
|
||||
if ((psf->sf.format & SF_FORMAT_TYPEMASK) == 0)
|
||||
return SFE_BAD_OPEN_FORMAT ;
|
||||
|
||||
subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
|
||||
if (subformat == 0)
|
||||
return SFE_BAD_OPEN_FORMAT ;
|
||||
|
||||
return pogg_init (psf) ;
|
||||
} /* ogg_open */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Private functions
|
||||
*/
|
||||
|
||||
static int
|
||||
pogg_init (SF_PRIVATE * psf)
|
||||
{
|
||||
psf->close = pogg_close ;
|
||||
|
||||
if (psf->mode == SFM_READ)
|
||||
{ /* set the virtual functions for reading */
|
||||
psf->read_short = pogg_read_s ;
|
||||
psf->read_int = pogg_read_i ;
|
||||
psf->read_float = pogg_read_f ;
|
||||
psf->read_double = pogg_read_d ;
|
||||
|
||||
/* set the virtual function for seeking */
|
||||
psf->seek = pogg_seek ;
|
||||
} ;
|
||||
|
||||
if (psf->mode == SFM_WRITE)
|
||||
{ /* set the virtual functions for writing */
|
||||
psf->write_short = pogg_write_s ;
|
||||
psf->write_int = pogg_write_i ;
|
||||
psf->write_float = pogg_write_f ;
|
||||
psf->write_double = pogg_write_d ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
} /* pogg_init */
|
||||
|
||||
static int
|
||||
pogg_close (SF_PRIVATE * psf)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
long n ;
|
||||
|
||||
if (psf->mode == SFM_READ)
|
||||
{ if (pogg->cache_pcm != NULL)
|
||||
free (pogg->cache_pcm) ;
|
||||
/* MUST NOT free pogg->ptr, it is a pointer into the user's buffers */
|
||||
} ;
|
||||
|
||||
if (psf->mode == SFM_WRITE)
|
||||
{ fish_sound_flush (pogg->fsound) ;
|
||||
while ((n = oggz_write (pogg->oggz, 1024)) > 0) ;
|
||||
} ;
|
||||
|
||||
if (pogg->oggz)
|
||||
oggz_close (pogg->oggz) ;
|
||||
if (pogg->fsound)
|
||||
fish_sound_delete (pogg->fsound) ;
|
||||
|
||||
return 0 ;
|
||||
} /* pogg_close */
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** OggzIO methods
|
||||
*/
|
||||
|
||||
static size_t
|
||||
pogg_io_read (void * user_handle, void * buf, size_t n)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) user_handle ;
|
||||
|
||||
return (size_t) psf_fread (buf, 1, n, psf) ;
|
||||
} /* pogg_io_read */
|
||||
|
||||
static int
|
||||
pogg_io_seek (void * user_handle, long offset, int whence)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) user_handle ;
|
||||
|
||||
return (size_t) psf_fseek (psf, offset, whence) ;
|
||||
} /* pogg_io_seek */
|
||||
|
||||
static long
|
||||
pogg_io_tell (void * user_handle)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) user_handle ;
|
||||
|
||||
return (size_t) psf_ftell (psf) ;
|
||||
} /* pogg_io_tell */
|
||||
|
||||
static size_t
|
||||
pogg_io_write (void * user_handle, void * buf, size_t n)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) user_handle ;
|
||||
|
||||
return (size_t) psf_fwrite (buf, 1, n, psf) ;
|
||||
} /* pogg_io_write */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Read last packet -- set the number of frames to be the last recorded
|
||||
** granulepos.
|
||||
*/
|
||||
|
||||
static int
|
||||
pogg_read_last_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * data)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) data ;
|
||||
|
||||
/* Avoid compiler warning. */
|
||||
oggz = NULL ;
|
||||
serialno = 0 ;
|
||||
|
||||
if (op->granulepos == -1)
|
||||
return OGGZ_CONTINUE ;
|
||||
|
||||
psf->sf.frames = op->granulepos ;
|
||||
|
||||
return OGGZ_STOP_OK ;
|
||||
} /* pogg_read_least_packet */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Decode header -- by the time FishSound calls this, all header codebooks etc.
|
||||
** have been parsed and the Oggz is ready for seeking.
|
||||
*/
|
||||
|
||||
static int
|
||||
pogg_decode_header (FishSound * fsound, float ** pcm, long frames, void * user_data)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) user_data ;
|
||||
FishSoundInfo fsinfo ;
|
||||
const FishSoundComment * comment ;
|
||||
|
||||
/* Avoid compiler warnings. */
|
||||
pcm = NULL ;
|
||||
frames = 0 ;
|
||||
|
||||
fish_sound_command (fsound, FISH_SOUND_GET_INFO, &fsinfo, sizeof (FishSoundInfo)) ;
|
||||
|
||||
switch (fsinfo.format)
|
||||
{ case FISH_SOUND_VORBIS :
|
||||
psf_log_printf (psf, "Vorbis\n") ;
|
||||
psf->sf.format |= SF_FORMAT_VORBIS ;
|
||||
break ;
|
||||
case FISH_SOUND_SPEEX :
|
||||
psf_log_printf (psf, "Speex\n") ;
|
||||
psf->sf.format |= SF_FORMAT_SPEEX ;
|
||||
break ;
|
||||
default :
|
||||
psf_log_printf (psf, "Unknown Ogg codec\n") ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
psf->sf.samplerate = fsinfo.samplerate ;
|
||||
psf->sf.channels = fsinfo.channels ;
|
||||
|
||||
/* Get comments */
|
||||
for (comment = fish_sound_comment_first (fsound) ; comment ;
|
||||
comment = fish_sound_comment_next (fsound, comment))
|
||||
{ psf_log_printf (psf, "%s : %s\n", comment->name, comment->value) ;
|
||||
|
||||
if (strcasecmp (comment->name, "TITLE") == 0)
|
||||
psf_store_string (psf, SF_STR_TITLE, comment->value) ;
|
||||
else if (strcasecmp (comment->name, "COPYRIGHT") == 0)
|
||||
psf_store_string (psf, SF_STR_COPYRIGHT, comment->value) ;
|
||||
else if (strcasecmp (comment->name, "ENCODER") == 0)
|
||||
psf_store_string (psf, SF_STR_SOFTWARE, comment->value) ;
|
||||
else if (strcasecmp (comment->name, "ARTIST") == 0)
|
||||
psf_store_string (psf, SF_STR_ARTIST, comment->value) ;
|
||||
else if (strcasecmp (comment->name, "DATE") == 0)
|
||||
psf_store_string (psf, SF_STR_DATE, comment->value) ;
|
||||
else if (strcasecmp (comment->name, "author") == 0)
|
||||
{ /* speexenc provides this */
|
||||
psf_store_string (psf, SF_STR_ARTIST, comment->value) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
puts (psf->logbuffer) ;
|
||||
|
||||
return 1 ;
|
||||
} /* pogg_decode_header */
|
||||
|
||||
static int
|
||||
pogg_read_header_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * data)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) data ;
|
||||
OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
int format ;
|
||||
|
||||
/* Avoid compiler warning. */
|
||||
oggz = NULL ;
|
||||
|
||||
if (pogg->serialno == -1)
|
||||
psf_log_printf (psf, "Read Ogg packet header : [%s]\n", op->packet) ;
|
||||
|
||||
if (pogg->serialno == -1 && op->bytes >= 8)
|
||||
{ format = fish_sound_identify (op->packet, 8) ;
|
||||
if (format == FISH_SOUND_VORBIS || format == FISH_SOUND_SPEEX)
|
||||
{ /*
|
||||
** Detect this is (probably) the audio stream. Don't set the subformat
|
||||
** yet, do that in the decoded callback, once FishSound has had a proper
|
||||
** look at all the headers and codebooks etc. and the file is ready for
|
||||
** decoding and seeking. We use the value of (psf->sf.format & _SUBMASK)
|
||||
** below to determine whether the headers have all been read or not.
|
||||
*/
|
||||
pogg->serialno = serialno ;
|
||||
}
|
||||
else if (strncmp (op->packet, "Annodex", 8) == 0)
|
||||
{ /* The overall stream encpasulation is Annodex */
|
||||
psf->sf.format = SF_FORMAT_ANX ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
if (serialno == pogg->serialno)
|
||||
fish_sound_decode (pogg->fsound, op->packet, op->bytes) ;
|
||||
|
||||
if ((psf->sf.format & SF_FORMAT_SUBMASK) == 0)
|
||||
return OGGZ_CONTINUE ;
|
||||
|
||||
return OGGZ_STOP_OK ;
|
||||
} /* pogg_read_header_packet */
|
||||
|
||||
static int
|
||||
pogg_read_header (SF_PRIVATE *psf)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
unsigned char buf [1024] ;
|
||||
|
||||
OGGZ * oggz ;
|
||||
FishSound * fsound ;
|
||||
FishSoundInfo fsinfo ;
|
||||
int nread = 1024 ;
|
||||
|
||||
psf->sf.format = SF_FORMAT_OGG ;
|
||||
psf->sf.frames = 0 ;
|
||||
|
||||
oggz = oggz_new (OGGZ_READ|OGGZ_AUTO) ;
|
||||
|
||||
oggz_io_set_read (oggz, pogg_io_read, psf) ;
|
||||
oggz_io_set_seek (oggz, pogg_io_seek, psf) ;
|
||||
oggz_io_set_tell (oggz, pogg_io_tell, psf) ;
|
||||
|
||||
fsound = fish_sound_new (FISH_SOUND_DECODE, &fsinfo) ;
|
||||
fish_sound_set_interleave (fsound, 1) ;
|
||||
fish_sound_set_decoded_callback (fsound, pogg_decode_header, psf) ;
|
||||
|
||||
pogg->oggz = oggz ;
|
||||
pogg->fsound = fsound ;
|
||||
pogg->serialno = -1 ;
|
||||
pogg->cache_pcm = NULL ;
|
||||
pogg->cache_size = 0 ;
|
||||
pogg->cache_granulepos = 0 ; /* We set this to a known value of zero to begin */
|
||||
pogg->cache_frames = 0 ;
|
||||
pogg->cache_remaining = 0 ;
|
||||
pogg->ptr = NULL ;
|
||||
pogg->pcmtype = POGG_PCM_SHORT ;
|
||||
pogg->remaining = 0 ;
|
||||
pogg->seek_from_start = 0 ;
|
||||
|
||||
/* Set position to start of file to begin reading header. */
|
||||
psf_binheader_readf (psf, "p", 0) ;
|
||||
|
||||
/* Get the header info */
|
||||
oggz_set_read_callback (oggz, -1, pogg_read_header_packet, psf) ;
|
||||
while (nread > 0 && ((psf->sf.format & SF_FORMAT_SUBMASK) == 0))
|
||||
{ nread = psf_binheader_readf (psf, "b", buf, sizeof (buf)) ;
|
||||
oggz_read_input (oggz, buf, nread) ;
|
||||
} ;
|
||||
|
||||
/* Get the duration */
|
||||
oggz_set_read_callback (oggz, -1, NULL, NULL) ;
|
||||
oggz_set_read_callback (oggz, pogg->serialno, pogg_read_last_packet, psf) ;
|
||||
oggz_seek_units (oggz, 0, SEEK_END) ;
|
||||
nread = 1024 ;
|
||||
while (nread > 0)
|
||||
nread = oggz_read (oggz, 1024) ;
|
||||
|
||||
/* reset to the beginning of the audio data */
|
||||
oggz_seek_units (oggz, 0, SEEK_SET) ;
|
||||
|
||||
psf->dataoffset = oggz_tell (oggz) ;
|
||||
psf->datalength = psf->filelength - psf->dataoffset ;
|
||||
|
||||
/* set the Oggz and FishSound up for decoding */
|
||||
oggz_set_read_callback (oggz, -1, NULL, NULL) ;
|
||||
oggz_set_read_callback (oggz, pogg->serialno, pogg_read_packet, psf) ;
|
||||
fish_sound_set_decoded_callback (fsound, pogg_decode, psf) ;
|
||||
|
||||
return 0 ;
|
||||
} /* pogg_read_header */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Decode functions
|
||||
*/
|
||||
|
||||
static int
|
||||
pogg_copyout (SF_PRIVATE * psf)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
size_t frame_size, bytes, cache_offset ;
|
||||
long cache_usable, i ;
|
||||
unsigned char * src ;
|
||||
|
||||
if (pogg->seek_from_start > 0)
|
||||
{ /* If we've seeked and don't know where we are, don't do anything yet */
|
||||
if (pogg->cache_granulepos == -1)
|
||||
return -1 ;
|
||||
|
||||
/* If we've seeked and are before the seek point, don't do anything yet */
|
||||
else if (pogg->cache_granulepos < pogg->seek_from_start)
|
||||
return -1 ;
|
||||
|
||||
/* If this block contains the seek point, adjust the cache offset accordingly */
|
||||
else if (pogg->cache_granulepos - pogg->cache_frames <= pogg->seek_from_start)
|
||||
{ pogg->cache_remaining = pogg->cache_granulepos - pogg->seek_from_start ;
|
||||
pogg->seek_from_start = 0 ; /* bingo */
|
||||
} ;
|
||||
} ;
|
||||
|
||||
frame_size = psf->sf.channels * sizeof (float) ;
|
||||
cache_usable = SF_MIN (pogg->remaining, pogg->cache_remaining) ;
|
||||
|
||||
if (cache_usable <= 0)
|
||||
return 0 ;
|
||||
|
||||
bytes = cache_usable * frame_size ;
|
||||
cache_offset = (pogg->cache_frames - pogg->cache_remaining) * frame_size ;
|
||||
src = (unsigned char *) pogg->cache_pcm + cache_offset ;
|
||||
|
||||
switch (pogg->pcmtype)
|
||||
{ case POGG_PCM_SHORT :
|
||||
for (i = 0 ; i < cache_usable ; i++)
|
||||
((short *) pogg->ptr) [i] = (short) (((float *) src) [i] * SHRT_MAX) ;
|
||||
break ;
|
||||
|
||||
case POGG_PCM_INT :
|
||||
for (i = 0 ; i < cache_usable ; i++)
|
||||
((double *) pogg->ptr) [i] = (double) (((float *) src) [i] * INT_MAX) ;
|
||||
break ;
|
||||
|
||||
case POGG_PCM_FLOAT :
|
||||
memcpy (pogg->ptr, src, bytes) ;
|
||||
break ;
|
||||
|
||||
case POGG_PCM_DOUBLE :
|
||||
for (i = 0 ; i < cache_usable ; i++)
|
||||
((double *) pogg->ptr) [i] = (double) ((float *) src) [i] ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
pogg->ptr += bytes ;
|
||||
pogg->cache_remaining -= cache_usable ;
|
||||
pogg->remaining -= cache_usable ;
|
||||
|
||||
return 0 ;
|
||||
} /* pogg_copyout*/
|
||||
|
||||
static int
|
||||
pogg_decode (FishSound * fsound, float ** pcm, long frames, void * user_data)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) user_data ;
|
||||
OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
size_t bytes ;
|
||||
float ** new_block ;
|
||||
|
||||
/* Avoid compiler warning. */
|
||||
fsound = NULL ;
|
||||
|
||||
bytes = sizeof (float) * psf->sf.channels * frames ;
|
||||
|
||||
if (bytes > pogg->cache_size)
|
||||
{ new_block = realloc (pogg->cache_pcm, bytes) ;
|
||||
if (new_block == NULL)
|
||||
/* XXX : SFE_MALLOC_FAILED */
|
||||
return -1 ;
|
||||
|
||||
pogg->cache_pcm = new_block ;
|
||||
pogg->cache_size = bytes ;
|
||||
} ;
|
||||
|
||||
memcpy (pogg->cache_pcm, pcm, bytes) ;
|
||||
pogg->cache_frames = frames ;
|
||||
pogg->cache_remaining = frames ;
|
||||
|
||||
if (pogg->cache_granulepos != -1)
|
||||
pogg->cache_granulepos += frames ;
|
||||
|
||||
pogg_copyout (psf) ;
|
||||
|
||||
return 0 ;
|
||||
} /* pogg_decode */
|
||||
|
||||
static int
|
||||
pogg_read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * data)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) data ;
|
||||
OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
FishSound * fsound = pogg->fsound ;
|
||||
|
||||
/* Avoid warning message. */
|
||||
oggz = NULL ;
|
||||
serialno = 0 ;
|
||||
|
||||
fish_sound_decode (fsound, op->packet, op->bytes) ;
|
||||
|
||||
if (op->granulepos != -1)
|
||||
pogg->cache_granulepos = op->granulepos ;
|
||||
|
||||
if (pogg->remaining == 0)
|
||||
return OGGZ_STOP_OK ;
|
||||
|
||||
return OGGZ_CONTINUE ;
|
||||
} /* pogg_read_packet */
|
||||
|
||||
static sf_count_t
|
||||
pogg_read_loop (SF_PRIVATE *psf, sf_count_t len)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
long nread = 1024 ;
|
||||
sf_count_t ret = len ;
|
||||
|
||||
/** Calculate nr. frames remaining */
|
||||
pogg->remaining = len / psf->sf.channels ;
|
||||
|
||||
/** Serve out any remaining cached data first */
|
||||
pogg_copyout (psf) ;
|
||||
|
||||
while (nread > 0 && pogg->remaining > 0)
|
||||
nread = oggz_read (pogg->oggz, 1024) ;
|
||||
|
||||
if (nread == 0)
|
||||
ret -= pogg->remaining * psf->sf.channels ;
|
||||
|
||||
return ret ;
|
||||
} /* pogg_read_loop */
|
||||
|
||||
static sf_count_t
|
||||
pogg_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
|
||||
pogg->ptr = ptr ;
|
||||
pogg->pcmtype = POGG_PCM_SHORT ;
|
||||
|
||||
return pogg_read_loop (psf, len) ;
|
||||
} /* pogg_read_s */
|
||||
|
||||
static sf_count_t
|
||||
pogg_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
|
||||
pogg->ptr = ptr ;
|
||||
pogg->pcmtype = POGG_PCM_INT ;
|
||||
|
||||
return pogg_read_loop (psf, len) ;
|
||||
} /* pogg_read_i */
|
||||
|
||||
static sf_count_t
|
||||
pogg_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
|
||||
pogg->ptr = ptr ;
|
||||
pogg->pcmtype = POGG_PCM_FLOAT ;
|
||||
|
||||
return pogg_read_loop (psf, len) ;
|
||||
} /* pogg_read_f */
|
||||
|
||||
static sf_count_t
|
||||
pogg_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
|
||||
pogg->ptr = ptr ;
|
||||
pogg->pcmtype = POGG_PCM_DOUBLE ;
|
||||
|
||||
return pogg_read_loop (psf, len) ;
|
||||
} /* pogg_read_d */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Seek functions
|
||||
*/
|
||||
|
||||
static sf_count_t
|
||||
pogg_seek (SF_PRIVATE *psf, int mode, sf_count_t seek_from_start)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
ogg_int64_t units = seek_from_start * 1000 / psf->sf.samplerate ;
|
||||
|
||||
if (mode != SFM_READ)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return SF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
oggz_seek_units (pogg->oggz, units, SEEK_SET) ;
|
||||
|
||||
/* Invalidate cache and set the desired seek position */
|
||||
pogg->cache_remaining = 0 ;
|
||||
pogg->cache_granulepos = -1 ;
|
||||
pogg->seek_from_start = seek_from_start ;
|
||||
|
||||
return seek_from_start ;
|
||||
} /* pogg_seek */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Write functions
|
||||
*/
|
||||
|
||||
static int
|
||||
pogg_encoded (FishSound * fsound, unsigned char * buf, long bytes, void * user_data)
|
||||
{ SF_PRIVATE * psf = (SF_PRIVATE *) user_data ;
|
||||
OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
ogg_packet op ;
|
||||
int err ;
|
||||
|
||||
op.packet = buf ;
|
||||
op.bytes = bytes ;
|
||||
op.b_o_s = pogg->b_o_s ;
|
||||
op.e_o_s = 0 ;
|
||||
op.granulepos = fish_sound_get_frameno (fsound) ;
|
||||
op.packetno = -1 ;
|
||||
|
||||
err = oggz_write_feed (pogg->oggz, &op, pogg->serialno, 0, NULL) ;
|
||||
|
||||
pogg->b_o_s = 0 ;
|
||||
|
||||
return OGGZ_CONTINUE ;
|
||||
} /* pogg_encoded */
|
||||
|
||||
static int
|
||||
pogg_write_anx_headers (SF_PRIVATE *psf, int format)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
unsigned char buf [128] ;
|
||||
long anx_serialno ;
|
||||
int headers_len = 0 ;
|
||||
const char * content_type ;
|
||||
ogg_packet op ;
|
||||
int err ;
|
||||
|
||||
anx_serialno = oggz_serialno_new (pogg->oggz) ;
|
||||
|
||||
/* Write Annodex header */
|
||||
memset (buf, 0, 48) ;
|
||||
snprintf (buf, 8, "Annodex") ;
|
||||
|
||||
/* Version */
|
||||
*(ogg_int16_t *) &buf [8] = (ogg_int16_t) POGG_ANX_VERSION_MAJOR ;
|
||||
*(ogg_int16_t *) &buf [10] = (ogg_int16_t) POGG_ANX_VERSION_MINOR ;
|
||||
if (CPU_IS_BIG_ENDIAN)
|
||||
endswap_short_array ((short *) &buf [8], 2) ;
|
||||
|
||||
/* Timebase numerator */
|
||||
*(ogg_int64_t *) &buf [12] = (ogg_int64_t) 0 ;
|
||||
|
||||
/* Timebase denominator */
|
||||
*(ogg_int64_t *) &buf [20] = (ogg_int64_t) 1 ;
|
||||
|
||||
if (CPU_IS_BIG_ENDIAN)
|
||||
endswap_long_array ((long *) &buf [12], 2) ;
|
||||
|
||||
op.packet = buf ;
|
||||
op.bytes = 48 ;
|
||||
op.b_o_s = 1 ;
|
||||
op.e_o_s = 0 ;
|
||||
op.granulepos = 0 ;
|
||||
op.packetno = -1 ;
|
||||
|
||||
err = oggz_write_feed (pogg->oggz, &op, anx_serialno, 0, NULL) ;
|
||||
|
||||
pogg->b_o_s = 0 ;
|
||||
|
||||
/* Write AnxData header */
|
||||
memset (buf, 0, 48) ;
|
||||
snprintf (buf, 8, "AnxData") ;
|
||||
|
||||
/* Granule rate numerator */
|
||||
*(ogg_int64_t *) &buf [8] = (ogg_int64_t) psf->sf.samplerate ;
|
||||
|
||||
/* Granule rate denominator */
|
||||
*(ogg_int64_t *) &buf [16] = (ogg_int64_t) 1 ;
|
||||
|
||||
if (CPU_IS_BIG_ENDIAN)
|
||||
endswap_long_array ((long *) &buf [8], 2) ;
|
||||
|
||||
/* Number of secondary header pages */
|
||||
*(ogg_int32_t *) &buf [24] = (ogg_int32_t) 3 ;
|
||||
if (CPU_IS_BIG_ENDIAN)
|
||||
endswap_int_array ((int *) &buf [24], 1) ;
|
||||
|
||||
/* Headers */
|
||||
if (format == FISH_SOUND_VORBIS)
|
||||
content_type = POGG_VORBIS_CONTENT_TYPE ;
|
||||
else
|
||||
content_type = POGG_SPEEX_CONTENT_TYPE ;
|
||||
|
||||
headers_len = snprintf ((char *) &buf [28], 100, "Content-Type : %s\r\n", content_type) ;
|
||||
|
||||
op.packet = buf ;
|
||||
op.bytes = 28 + headers_len + 1 ;
|
||||
op.b_o_s = 1 ;
|
||||
op.e_o_s = 0 ;
|
||||
op.granulepos = 0 ;
|
||||
op.packetno = -1 ;
|
||||
|
||||
err = oggz_write_feed (pogg->oggz, &op, pogg->serialno, 0, NULL) ;
|
||||
|
||||
/* Write Annodex eos packet */
|
||||
op.packet = NULL ;
|
||||
op.bytes = 0 ;
|
||||
op.b_o_s = 0 ;
|
||||
op.e_o_s = 1 ;
|
||||
op.granulepos = 0 ;
|
||||
op.packetno = -1 ;
|
||||
|
||||
err = oggz_write_feed (pogg->oggz, &op, anx_serialno, 0, NULL) ;
|
||||
|
||||
return 0 ;
|
||||
} /* pogg_write_anx_headers */
|
||||
|
||||
static int
|
||||
pogg_write_header (SF_PRIVATE *psf)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
|
||||
OGGZ * oggz ;
|
||||
FishSound * fsound ;
|
||||
FishSoundInfo fsinfo ;
|
||||
|
||||
oggz = oggz_new (OGGZ_WRITE) ;
|
||||
|
||||
oggz_io_set_write (oggz, pogg_io_write, psf) ;
|
||||
|
||||
fsinfo.samplerate = psf->sf.samplerate ;
|
||||
fsinfo.channels = psf->sf.channels ;
|
||||
|
||||
switch (psf->sf.format & SF_FORMAT_SUBMASK)
|
||||
{ case SF_FORMAT_VORBIS :
|
||||
fsinfo.format = FISH_SOUND_VORBIS ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_SPEEX :
|
||||
fsinfo.format = FISH_SOUND_SPEEX ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
fsound = fish_sound_new (FISH_SOUND_ENCODE, &fsinfo) ;
|
||||
fish_sound_set_interleave (fsound, 1) ;
|
||||
fish_sound_set_encoded_callback (fsound, pogg_encoded, psf) ;
|
||||
|
||||
pogg->oggz = oggz ;
|
||||
pogg->fsound = fsound ;
|
||||
pogg->serialno = oggz_serialno_new (oggz) ;
|
||||
pogg->b_o_s = 1 ;
|
||||
pogg->comments_written = 0 ;
|
||||
pogg->granulepos = 0 ;
|
||||
pogg->fptr = (float *) malloc (sizeof (float) * 1024) ;
|
||||
|
||||
if ((psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_ANX)
|
||||
pogg_write_anx_headers (psf, fsinfo.format) ;
|
||||
|
||||
return 0 ;
|
||||
} /* pogg_write_header */
|
||||
|
||||
static void
|
||||
pogg_write_comments (SF_PRIVATE *psf)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
int k ;
|
||||
int err ;
|
||||
|
||||
for (k = 0 ; k < SF_MAX_STRINGS ; k++)
|
||||
{ printf ("hrumf comment : %d => %s\n", psf->strings [k].type, psf->strings [k].str) ;
|
||||
/*
|
||||
if (psf->strings [k].type == 0)
|
||||
break ;
|
||||
*/
|
||||
|
||||
if (psf->strings [k].type != 0)
|
||||
{ printf ("adding comment : %d => %s\n", psf->strings [k].type, psf->strings [k].str) ;
|
||||
|
||||
switch (psf->strings [k].type)
|
||||
{ case SF_STR_SOFTWARE :
|
||||
err = fish_sound_comment_add_byname (pogg->fsound, "ENCODER", psf->strings [k].str) ;
|
||||
break ;
|
||||
|
||||
case SF_STR_TITLE :
|
||||
err = fish_sound_comment_add_byname (pogg->fsound, "TITLE", psf->strings [k].str) ;
|
||||
break ;
|
||||
|
||||
case SF_STR_COPYRIGHT :
|
||||
err = fish_sound_comment_add_byname (pogg->fsound, "COPYRIGHT", psf->strings [k].str) ;
|
||||
break ;
|
||||
|
||||
case SF_STR_ARTIST :
|
||||
err = fish_sound_comment_add_byname (pogg->fsound, "ARTIST", psf->strings [k].str) ;
|
||||
break ;
|
||||
|
||||
/*
|
||||
case SF_STR_COMMENT :
|
||||
fish_sound_comment_add_byname (pogg->fsound, "COMMENT", psf->strings [k].str) ;
|
||||
break ;
|
||||
*/
|
||||
|
||||
case SF_STR_DATE :
|
||||
err = fish_sound_comment_add_byname (pogg->fsound, "DATE", psf->strings [k].str) ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
} ; /* if type !0 */
|
||||
} ;
|
||||
|
||||
pogg->comments_written = 1 ;
|
||||
|
||||
return ;
|
||||
} /* pogg_write_comments*/
|
||||
|
||||
static sf_count_t
|
||||
pogg_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
long n, i, remaining = len / psf->sf.channels ;
|
||||
|
||||
if (pogg->comments_written == 0)
|
||||
pogg_write_comments (psf) ;
|
||||
|
||||
while (remaining > 0)
|
||||
{ n = SF_MIN (remaining, 1024) ;
|
||||
|
||||
for (i = 0 ; i < n * psf->sf.channels ; i++)
|
||||
pogg->fptr [i] = (float) ptr [i] ;
|
||||
|
||||
fish_sound_encode (pogg->fsound, (float **) ptr, n) ;
|
||||
|
||||
while (oggz_write (pogg->oggz, 1024) > 0) ;
|
||||
|
||||
ptr += n * psf->sf.channels ;
|
||||
remaining -= n ;
|
||||
} ;
|
||||
|
||||
return len ;
|
||||
} /* pogg_write_s */
|
||||
|
||||
static sf_count_t
|
||||
pogg_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
{
|
||||
OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
long n, i, remaining = len / psf->sf.channels ;
|
||||
|
||||
if (pogg->comments_written == 0)
|
||||
pogg_write_comments (psf) ;
|
||||
|
||||
while (remaining > 0)
|
||||
{ n = SF_MIN (remaining, 1024) ;
|
||||
|
||||
for (i = 0 ; i < n * psf->sf.channels ; i++)
|
||||
pogg->fptr [i] = (float) ptr [i] ;
|
||||
|
||||
fish_sound_encode (pogg->fsound, (float **) ptr, n) ;
|
||||
|
||||
while (oggz_write (pogg->oggz, 1024) > 0) ;
|
||||
|
||||
ptr += n * psf->sf.channels ;
|
||||
remaining -= n ;
|
||||
} ;
|
||||
|
||||
return len ;
|
||||
} /* pogg_write_i */
|
||||
|
||||
static sf_count_t
|
||||
pogg_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
long n, remaining = len / psf->sf.channels ;
|
||||
|
||||
if (pogg->comments_written == 0)
|
||||
pogg_write_comments (psf) ;
|
||||
|
||||
while (remaining > 0)
|
||||
{ n = SF_MIN (remaining, 1024) ;
|
||||
|
||||
fish_sound_encode (pogg->fsound, (float **) ptr, n) ;
|
||||
|
||||
while (oggz_write (pogg->oggz, 1024) > 0) ;
|
||||
|
||||
ptr += n * psf->sf.channels ;
|
||||
remaining -= n ;
|
||||
} ;
|
||||
|
||||
return len ;
|
||||
} /* pog_write_f */
|
||||
|
||||
static sf_count_t
|
||||
pogg_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ;
|
||||
long n, i, remaining = len / psf->sf.channels ;
|
||||
|
||||
if (pogg->comments_written == 0)
|
||||
pogg_write_comments (psf) ;
|
||||
|
||||
while (remaining > 0)
|
||||
{ n = SF_MIN (remaining, 1024) ;
|
||||
|
||||
for (i = 0 ; i < n * psf->sf.channels ; i++)
|
||||
pogg->fptr [i] = (float) ptr [i] ;
|
||||
|
||||
fish_sound_encode (pogg->fsound, (float **) ptr, n) ;
|
||||
|
||||
while (oggz_write (pogg->oggz, 1024) > 0) ;
|
||||
|
||||
ptr += n * psf->sf.channels ;
|
||||
remaining -= n ;
|
||||
} ;
|
||||
|
||||
return len ;
|
||||
} /* pogg_write_d */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -85,10 +85,10 @@ static sf_count_t paf24_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t paf24_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t paf24_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t paf24_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t paf24_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t paf24_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t paf24_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t paf24_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t paf24_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t paf24_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t paf24_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t paf24_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
|
||||
|
||||
|
@ -163,6 +163,7 @@ paf_read_header (SF_PRIVATE *psf)
|
|||
{ PAF_FMT paf_fmt ;
|
||||
int marker ;
|
||||
|
||||
memset (&paf_fmt, 0, sizeof (paf_fmt)) ;
|
||||
psf_binheader_readf (psf, "pm", 0, &marker) ;
|
||||
|
||||
psf_log_printf (psf, "Signature : '%M'\n", marker) ;
|
||||
|
@ -349,7 +350,7 @@ static int paf24_close (SF_PRIVATE *psf) ;
|
|||
static int
|
||||
paf24_init (SF_PRIVATE *psf)
|
||||
{ PAF24_PRIVATE *ppaf24 ;
|
||||
int paf24size, max_blocks ;
|
||||
int paf24size ;
|
||||
|
||||
paf24size = sizeof (PAF24_PRIVATE) + psf->sf.channels *
|
||||
(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
|
||||
|
@ -390,7 +391,7 @@ paf24_init (SF_PRIVATE *psf)
|
|||
} ;
|
||||
|
||||
psf->seek = paf24_seek ;
|
||||
psf->close = paf24_close ;
|
||||
psf->container_close = paf24_close ;
|
||||
|
||||
psf->filelength = psf_get_filelen (psf) ;
|
||||
psf->datalength = psf->filelength - psf->dataoffset ;
|
||||
|
@ -398,18 +399,18 @@ paf24_init (SF_PRIVATE *psf)
|
|||
if (psf->datalength % PAF24_BLOCK_SIZE)
|
||||
{ if (psf->mode == SFM_READ)
|
||||
psf_log_printf (psf, "*** Warning : file seems to be truncated.\n") ;
|
||||
max_blocks = psf->datalength / ppaf24->blocksize + 1 ;
|
||||
ppaf24->max_blocks = psf->datalength / ppaf24->blocksize + 1 ;
|
||||
}
|
||||
else
|
||||
max_blocks = psf->datalength / ppaf24->blocksize ;
|
||||
ppaf24->max_blocks = psf->datalength / ppaf24->blocksize ;
|
||||
|
||||
ppaf24->read_block = 0 ;
|
||||
if (psf->mode == SFM_RDWR)
|
||||
ppaf24->write_block = max_blocks ;
|
||||
ppaf24->write_block = ppaf24->max_blocks ;
|
||||
else
|
||||
ppaf24->write_block = 0 ;
|
||||
|
||||
psf->sf.frames = ppaf24->samplesperblock * max_blocks ;
|
||||
psf->sf.frames = ppaf24->samplesperblock * ppaf24->max_blocks ;
|
||||
ppaf24->sample_count = psf->sf.frames ;
|
||||
|
||||
return 0 ;
|
||||
|
@ -422,7 +423,7 @@ paf24_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
if (psf->fdata == NULL)
|
||||
{ psf->error = SFE_INTERNAL ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
ppaf24 = (PAF24_PRIVATE*) psf->fdata ;
|
||||
|
@ -435,11 +436,6 @@ paf24_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
switch (mode)
|
||||
{ case SFM_READ :
|
||||
if (offset > ppaf24->read_block * ppaf24->samplesperblock + ppaf24->read_count)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return SF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (psf->last_op == SFM_WRITE && ppaf24->write_count)
|
||||
paf24_write_block (psf, ppaf24) ;
|
||||
|
||||
|
@ -452,7 +448,7 @@ paf24_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
case SFM_WRITE :
|
||||
if (offset > ppaf24->sample_count)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (psf->last_op == SFM_WRITE && ppaf24->write_count)
|
||||
|
@ -466,7 +462,7 @@ paf24_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
default :
|
||||
psf->error = SFE_BAD_SEEK ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
return newblock * ppaf24->samplesperblock + newsample ;
|
||||
|
@ -707,7 +703,7 @@ paf24_write_block (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24)
|
|||
} /* paf24_write_block */
|
||||
|
||||
static int
|
||||
paf24_write (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24, int *ptr, int len)
|
||||
paf24_write (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24, const int *ptr, int len)
|
||||
{ int count, total = 0 ;
|
||||
|
||||
while (total < len)
|
||||
|
@ -728,7 +724,7 @@ paf24_write (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24, int *ptr, int len)
|
|||
} /* paf24_write */
|
||||
|
||||
static sf_count_t
|
||||
paf24_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
paf24_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ PAF24_PRIVATE *ppaf24 ;
|
||||
int *iptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
|
@ -754,7 +750,7 @@ paf24_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* paf24_write_s */
|
||||
|
||||
static sf_count_t
|
||||
paf24_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
paf24_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ PAF24_PRIVATE *ppaf24 ;
|
||||
int writecount, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -778,7 +774,7 @@ paf24_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* paf24_write_i */
|
||||
|
||||
static sf_count_t
|
||||
paf24_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
paf24_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ PAF24_PRIVATE *ppaf24 ;
|
||||
int *iptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
|
@ -808,7 +804,7 @@ paf24_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* paf24_write_f */
|
||||
|
||||
static sf_count_t
|
||||
paf24_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
paf24_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ PAF24_PRIVATE *ppaf24 ;
|
||||
int *iptr ;
|
||||
int k, bufferlen, writecount = 0, count ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -16,8 +16,9 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "float_cast.h"
|
||||
#include "common.h"
|
||||
|
@ -66,41 +67,41 @@ static sf_count_t pcm_read_let2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
static sf_count_t pcm_read_bei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_read_lei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t pcm_write_s2sc (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2uc (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2bes (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2les (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2bet (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2let (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2bei (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2lei (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2sc (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2uc (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2bes (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2les (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2bet (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2let (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2bei (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_s2lei (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t pcm_write_i2sc (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2uc (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2bes (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2les (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2bet (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2let (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2bei (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2lei (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2sc (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2uc (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2bes (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2les (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2bet (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2let (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2bei (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_i2lei (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t pcm_write_f2sc (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2uc (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2bes (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2les (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2bet (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2let (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2bei (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2lei (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2sc (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2uc (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2bes (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2les (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2bet (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2let (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2bei (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_f2lei (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t pcm_write_d2sc (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2uc (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2bes (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2les (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2bet (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2let (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2bei (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2lei (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2sc (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2uc (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2bes (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2les (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2bet (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2let (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2bei (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
static sf_count_t pcm_write_d2lei (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
/*-----------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -558,19 +559,19 @@ bei2d_array (int *src, int count, double *dest, double normfact)
|
|||
*/
|
||||
|
||||
static inline void
|
||||
s2sc_array (short *src, signed char *dest, int count)
|
||||
s2sc_array (const short *src, signed char *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
dest [count] = src [count] >> 8 ;
|
||||
} /* s2sc_array */
|
||||
|
||||
static inline void
|
||||
s2uc_array (short *src, unsigned char *dest, int count)
|
||||
s2uc_array (const short *src, unsigned char *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
dest [count] = (src [count] >> 8) + 0x80 ;
|
||||
} /* s2uc_array */
|
||||
|
||||
static inline void
|
||||
s2let_array (short *src, tribyte *dest, int count)
|
||||
s2let_array (const short *src, tribyte *dest, int count)
|
||||
{ unsigned char *ucptr ;
|
||||
|
||||
ucptr = ((unsigned char*) dest) + 3 * count ;
|
||||
|
@ -583,7 +584,7 @@ s2let_array (short *src, tribyte *dest, int count)
|
|||
} /* s2let_array */
|
||||
|
||||
static inline void
|
||||
s2bet_array (short *src, tribyte *dest, int count)
|
||||
s2bet_array (const short *src, tribyte *dest, int count)
|
||||
{ unsigned char *ucptr ;
|
||||
|
||||
ucptr = ((unsigned char*) dest) + 3 * count ;
|
||||
|
@ -596,7 +597,7 @@ s2bet_array (short *src, tribyte *dest, int count)
|
|||
} /* s2bet_array */
|
||||
|
||||
static inline void
|
||||
s2lei_array (short *src, int *dest, int count)
|
||||
s2lei_array (const short *src, int *dest, int count)
|
||||
{ unsigned char *ucptr ;
|
||||
|
||||
ucptr = ((unsigned char*) dest) + 4 * count ;
|
||||
|
@ -610,7 +611,7 @@ s2lei_array (short *src, int *dest, int count)
|
|||
} /* s2lei_array */
|
||||
|
||||
static inline void
|
||||
s2bei_array (short *src, int *dest, int count)
|
||||
s2bei_array (const short *src, int *dest, int count)
|
||||
{ unsigned char *ucptr ;
|
||||
|
||||
ucptr = ((unsigned char*) dest) + 4 * count ;
|
||||
|
@ -627,19 +628,19 @@ s2bei_array (short *src, int *dest, int count)
|
|||
*/
|
||||
|
||||
static inline void
|
||||
i2sc_array (int *src, signed char *dest, int count)
|
||||
i2sc_array (const int *src, signed char *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
dest [count] = (src [count] >> 24) ;
|
||||
} /* i2sc_array */
|
||||
|
||||
static inline void
|
||||
i2uc_array (int *src, unsigned char *dest, int count)
|
||||
i2uc_array (const int *src, unsigned char *dest, int count)
|
||||
{ while (--count >= 0)
|
||||
dest [count] = ((src [count] >> 24) + 128) ;
|
||||
} /* i2uc_array */
|
||||
|
||||
static inline void
|
||||
i2bes_array (int *src, short *dest, int count)
|
||||
i2bes_array (const int *src, short *dest, int count)
|
||||
{ unsigned char *ucptr ;
|
||||
|
||||
ucptr = ((unsigned char*) dest) + 2 * count ;
|
||||
|
@ -651,7 +652,7 @@ i2bes_array (int *src, short *dest, int count)
|
|||
} /* i2bes_array */
|
||||
|
||||
static inline void
|
||||
i2les_array (int *src, short *dest, int count)
|
||||
i2les_array (const int *src, short *dest, int count)
|
||||
{ unsigned char *ucptr ;
|
||||
|
||||
ucptr = ((unsigned char*) dest) + 2 * count ;
|
||||
|
@ -663,7 +664,7 @@ i2les_array (int *src, short *dest, int count)
|
|||
} /* i2les_array */
|
||||
|
||||
static inline void
|
||||
i2let_array (int *src, tribyte *dest, int count)
|
||||
i2let_array (const int *src, tribyte *dest, int count)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
|
||||
|
@ -678,7 +679,7 @@ i2let_array (int *src, tribyte *dest, int count)
|
|||
} /* i2let_array */
|
||||
|
||||
static inline void
|
||||
i2bet_array (int *src, tribyte *dest, int count)
|
||||
i2bet_array (const int *src, tribyte *dest, int count)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
|
||||
|
@ -1393,7 +1394,7 @@ pcm_read_lei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_s2sc (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
pcm_write_s2sc (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1414,7 +1415,7 @@ pcm_write_s2sc (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* pcm_write_s2sc */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_s2uc (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
pcm_write_s2uc (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1435,7 +1436,7 @@ pcm_write_s2uc (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* pcm_write_s2uc */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_s2bes (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
pcm_write_s2bes (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1460,7 +1461,7 @@ pcm_write_s2bes (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* pcm_write_s2bes */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_s2les (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
pcm_write_s2les (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1484,7 +1485,7 @@ pcm_write_s2les (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* pcm_write_s2les */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_s2bet (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
pcm_write_s2bet (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1505,7 +1506,7 @@ pcm_write_s2bet (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* pcm_write_s2bet */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_s2let (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
pcm_write_s2let (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1526,7 +1527,7 @@ pcm_write_s2let (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* pcm_write_s2let */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_s2bei (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
pcm_write_s2bei (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1547,7 +1548,7 @@ pcm_write_s2bei (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* pcm_write_s2bei */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_s2lei (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
pcm_write_s2lei (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1571,7 +1572,7 @@ pcm_write_s2lei (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_i2sc (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
pcm_write_i2sc (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1592,7 +1593,7 @@ pcm_write_i2sc (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* pcm_write_i2sc */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_i2uc (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
pcm_write_i2uc (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1613,7 +1614,7 @@ pcm_write_i2uc (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* pcm_write_i2uc */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_i2bes (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
pcm_write_i2bes (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1634,7 +1635,7 @@ pcm_write_i2bes (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* pcm_write_i2bes */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_i2les (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
pcm_write_i2les (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1655,7 +1656,7 @@ pcm_write_i2les (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* pcm_write_i2les */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_i2bet (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
pcm_write_i2bet (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1676,7 +1677,7 @@ pcm_write_i2bet (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* pcm_write_i2bet */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_i2let (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
pcm_write_i2let (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1697,7 +1698,7 @@ pcm_write_i2let (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* pcm_write_i2les */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_i2bei (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
pcm_write_i2bei (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1721,7 +1722,7 @@ pcm_write_i2bei (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* pcm_write_i2bei */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_i2lei (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
pcm_write_i2lei (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1750,7 +1751,7 @@ pcm_write_i2lei (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
f2sc_array (float *src, signed char *dest, int count, int normalize)
|
||||
f2sc_array (const float *src, signed char *dest, int count, int normalize)
|
||||
{ float normfact ;
|
||||
|
||||
normfact = normalize ? (1.0 * 0x7F) : 1.0 ;
|
||||
|
@ -1761,7 +1762,7 @@ f2sc_array (float *src, signed char *dest, int count, int normalize)
|
|||
} /* f2sc_array */
|
||||
|
||||
static void
|
||||
f2sc_clip_array (float *src, signed char *dest, int count, int normalize)
|
||||
f2sc_clip_array (const float *src, signed char *dest, int count, int normalize)
|
||||
{ float normfact, scaled_value ;
|
||||
|
||||
normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ;
|
||||
|
@ -1782,8 +1783,8 @@ f2sc_clip_array (float *src, signed char *dest, int count, int normalize)
|
|||
} /* f2sc_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_f2sc (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ void (*convert) (float *, signed char *, int, int) ;
|
||||
pcm_write_f2sc (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ void (*convert) (const float *, signed char *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1808,7 +1809,7 @@ pcm_write_f2sc (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
f2uc_array (float *src, unsigned char *dest, int count, int normalize)
|
||||
f2uc_array (const float *src, unsigned char *dest, int count, int normalize)
|
||||
{ float normfact ;
|
||||
|
||||
normfact = normalize ? (1.0 * 0x7F) : 1.0 ;
|
||||
|
@ -1819,7 +1820,7 @@ f2uc_array (float *src, unsigned char *dest, int count, int normalize)
|
|||
} /* f2uc_array */
|
||||
|
||||
static void
|
||||
f2uc_clip_array (float *src, unsigned char *dest, int count, int normalize)
|
||||
f2uc_clip_array (const float *src, unsigned char *dest, int count, int normalize)
|
||||
{ float normfact, scaled_value ;
|
||||
|
||||
normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ;
|
||||
|
@ -1840,8 +1841,8 @@ f2uc_clip_array (float *src, unsigned char *dest, int count, int normalize)
|
|||
} /* f2uc_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_f2uc (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ void (*convert) (float *, unsigned char *, int, int) ;
|
||||
pcm_write_f2uc (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ void (*convert) (const float *, unsigned char *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1866,7 +1867,7 @@ pcm_write_f2uc (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
f2bes_array (float *src, short *dest, int count, int normalize)
|
||||
f2bes_array (const float *src, short *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact ;
|
||||
short value ;
|
||||
|
@ -1883,7 +1884,7 @@ f2bes_array (float *src, short *dest, int count, int normalize)
|
|||
} /* f2bes_array */
|
||||
|
||||
static void
|
||||
f2bes_clip_array (float *src, short *dest, int count, int normalize)
|
||||
f2bes_clip_array (const float *src, short *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact, scaled_value ;
|
||||
int value ;
|
||||
|
@ -1912,8 +1913,8 @@ f2bes_clip_array (float *src, short *dest, int count, int normalize)
|
|||
} /* f2bes_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_f2bes (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ void (*convert) (float *, short *t, int, int) ;
|
||||
pcm_write_f2bes (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ void (*convert) (const float *, short *t, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -1938,7 +1939,7 @@ pcm_write_f2bes (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
f2les_array (float *src, short *dest, int count, int normalize)
|
||||
f2les_array (const float *src, short *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact ;
|
||||
int value ;
|
||||
|
@ -1955,7 +1956,7 @@ f2les_array (float *src, short *dest, int count, int normalize)
|
|||
} /* f2les_array */
|
||||
|
||||
static void
|
||||
f2les_clip_array (float *src, short *dest, int count, int normalize)
|
||||
f2les_clip_array (const float *src, short *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact, scaled_value ;
|
||||
int value ;
|
||||
|
@ -1984,8 +1985,8 @@ f2les_clip_array (float *src, short *dest, int count, int normalize)
|
|||
} /* f2les_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_f2les (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ void (*convert) (float *, short *t, int, int) ;
|
||||
pcm_write_f2les (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ void (*convert) (const float *, short *t, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2010,7 +2011,7 @@ pcm_write_f2les (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
f2let_array (float *src, tribyte *dest, int count, int normalize)
|
||||
f2let_array (const float *src, tribyte *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact ;
|
||||
int value ;
|
||||
|
@ -2028,7 +2029,7 @@ f2let_array (float *src, tribyte *dest, int count, int normalize)
|
|||
} /* f2let_array */
|
||||
|
||||
static void
|
||||
f2let_clip_array (float *src, tribyte *dest, int count, int normalize)
|
||||
f2let_clip_array (const float *src, tribyte *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact, scaled_value ;
|
||||
int value ;
|
||||
|
@ -2060,8 +2061,8 @@ f2let_clip_array (float *src, tribyte *dest, int count, int normalize)
|
|||
} /* f2let_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_f2let (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ void (*convert) (float *, tribyte *, int, int) ;
|
||||
pcm_write_f2let (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ void (*convert) (const float *, tribyte *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2086,7 +2087,7 @@ pcm_write_f2let (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
f2bet_array (float *src, tribyte *dest, int count, int normalize)
|
||||
f2bet_array (const float *src, tribyte *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact ;
|
||||
int value ;
|
||||
|
@ -2104,7 +2105,7 @@ f2bet_array (float *src, tribyte *dest, int count, int normalize)
|
|||
} /* f2bet_array */
|
||||
|
||||
static void
|
||||
f2bet_clip_array (float *src, tribyte *dest, int count, int normalize)
|
||||
f2bet_clip_array (const float *src, tribyte *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact, scaled_value ;
|
||||
int value ;
|
||||
|
@ -2136,8 +2137,8 @@ f2bet_clip_array (float *src, tribyte *dest, int count, int normalize)
|
|||
} /* f2bet_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_f2bet (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ void (*convert) (float *, tribyte *, int, int) ;
|
||||
pcm_write_f2bet (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ void (*convert) (const float *, tribyte *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2162,7 +2163,7 @@ pcm_write_f2bet (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
f2bei_array (float *src, int *dest, int count, int normalize)
|
||||
f2bei_array (const float *src, int *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact ;
|
||||
int value ;
|
||||
|
@ -2180,7 +2181,7 @@ f2bei_array (float *src, int *dest, int count, int normalize)
|
|||
} /* f2bei_array */
|
||||
|
||||
static void
|
||||
f2bei_clip_array (float *src, int *dest, int count, int normalize)
|
||||
f2bei_clip_array (const float *src, int *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact, scaled_value ;
|
||||
int value ;
|
||||
|
@ -2215,8 +2216,8 @@ f2bei_clip_array (float *src, int *dest, int count, int normalize)
|
|||
} /* f2bei_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_f2bei (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ void (*convert) (float *, int *, int, int) ;
|
||||
pcm_write_f2bei (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ void (*convert) (const float *, int *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2241,7 +2242,7 @@ pcm_write_f2bei (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
f2lei_array (float *src, int *dest, int count, int normalize)
|
||||
f2lei_array (const float *src, int *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact ;
|
||||
int value ;
|
||||
|
@ -2260,7 +2261,7 @@ f2lei_array (float *src, int *dest, int count, int normalize)
|
|||
} /* f2lei_array */
|
||||
|
||||
static void
|
||||
f2lei_clip_array (float *src, int *dest, int count, int normalize)
|
||||
f2lei_clip_array (const float *src, int *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
float normfact, scaled_value ;
|
||||
int value ;
|
||||
|
@ -2295,8 +2296,8 @@ f2lei_clip_array (float *src, int *dest, int count, int normalize)
|
|||
} /* f2lei_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_f2lei (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
{ void (*convert) (float *, int *, int, int) ;
|
||||
pcm_write_f2lei (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ void (*convert) (const float *, int *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2321,7 +2322,7 @@ pcm_write_f2lei (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
d2sc_array (double *src, signed char *dest, int count, int normalize)
|
||||
d2sc_array (const double *src, signed char *dest, int count, int normalize)
|
||||
{ double normfact ;
|
||||
|
||||
normfact = normalize ? (1.0 * 0x7F) : 1.0 ;
|
||||
|
@ -2332,7 +2333,7 @@ d2sc_array (double *src, signed char *dest, int count, int normalize)
|
|||
} /* d2sc_array */
|
||||
|
||||
static void
|
||||
d2sc_clip_array (double *src, signed char *dest, int count, int normalize)
|
||||
d2sc_clip_array (const double *src, signed char *dest, int count, int normalize)
|
||||
{ double normfact, scaled_value ;
|
||||
|
||||
normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ;
|
||||
|
@ -2353,8 +2354,8 @@ d2sc_clip_array (double *src, signed char *dest, int count, int normalize)
|
|||
} /* d2sc_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_d2sc (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ void (*convert) (double *, signed char *, int, int) ;
|
||||
pcm_write_d2sc (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ void (*convert) (const double *, signed char *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2379,7 +2380,7 @@ pcm_write_d2sc (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
d2uc_array (double *src, unsigned char *dest, int count, int normalize)
|
||||
d2uc_array (const double *src, unsigned char *dest, int count, int normalize)
|
||||
{ double normfact ;
|
||||
|
||||
normfact = normalize ? (1.0 * 0x7F) : 1.0 ;
|
||||
|
@ -2390,7 +2391,7 @@ d2uc_array (double *src, unsigned char *dest, int count, int normalize)
|
|||
} /* d2uc_array */
|
||||
|
||||
static void
|
||||
d2uc_clip_array (double *src, unsigned char *dest, int count, int normalize)
|
||||
d2uc_clip_array (const double *src, unsigned char *dest, int count, int normalize)
|
||||
{ double normfact, scaled_value ;
|
||||
|
||||
normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ;
|
||||
|
@ -2411,8 +2412,8 @@ d2uc_clip_array (double *src, unsigned char *dest, int count, int normalize)
|
|||
} /* d2uc_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_d2uc (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ void (*convert) (double *, unsigned char *, int, int) ;
|
||||
pcm_write_d2uc (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ void (*convert) (const double *, unsigned char *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2437,7 +2438,7 @@ pcm_write_d2uc (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
d2bes_array (double *src, short *dest, int count, int normalize)
|
||||
d2bes_array (const double *src, short *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
short value ;
|
||||
double normfact ;
|
||||
|
@ -2454,7 +2455,7 @@ d2bes_array (double *src, short *dest, int count, int normalize)
|
|||
} /* d2bes_array */
|
||||
|
||||
static void
|
||||
d2bes_clip_array (double *src, short *dest, int count, int normalize)
|
||||
d2bes_clip_array (const double *src, short *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
double normfact, scaled_value ;
|
||||
int value ;
|
||||
|
@ -2483,8 +2484,8 @@ d2bes_clip_array (double *src, short *dest, int count, int normalize)
|
|||
} /* d2bes_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_d2bes (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ void (*convert) (double *, short *, int, int) ;
|
||||
pcm_write_d2bes (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ void (*convert) (const double *, short *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2509,7 +2510,7 @@ pcm_write_d2bes (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
d2les_array (double *src, short *dest, int count, int normalize)
|
||||
d2les_array (const double *src, short *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
short value ;
|
||||
double normfact ;
|
||||
|
@ -2526,7 +2527,7 @@ d2les_array (double *src, short *dest, int count, int normalize)
|
|||
} /* d2les_array */
|
||||
|
||||
static void
|
||||
d2les_clip_array (double *src, short *dest, int count, int normalize)
|
||||
d2les_clip_array (const double *src, short *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
double normfact, scaled_value ;
|
||||
|
@ -2555,8 +2556,8 @@ d2les_clip_array (double *src, short *dest, int count, int normalize)
|
|||
} /* d2les_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_d2les (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ void (*convert) (double *, short *, int, int) ;
|
||||
pcm_write_d2les (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ void (*convert) (const double *, short *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2581,7 +2582,7 @@ pcm_write_d2les (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
d2let_array (double *src, tribyte *dest, int count, int normalize)
|
||||
d2let_array (const double *src, tribyte *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
double normfact ;
|
||||
|
@ -2599,7 +2600,7 @@ d2let_array (double *src, tribyte *dest, int count, int normalize)
|
|||
} /* d2let_array */
|
||||
|
||||
static void
|
||||
d2let_clip_array (double *src, tribyte *dest, int count, int normalize)
|
||||
d2let_clip_array (const double *src, tribyte *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
double normfact, scaled_value ;
|
||||
|
@ -2631,8 +2632,8 @@ d2let_clip_array (double *src, tribyte *dest, int count, int normalize)
|
|||
} /* d2let_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_d2let (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ void (*convert) (double *, tribyte *, int, int) ;
|
||||
pcm_write_d2let (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ void (*convert) (const double *, tribyte *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2657,7 +2658,7 @@ pcm_write_d2let (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
d2bet_array (double *src, tribyte *dest, int count, int normalize)
|
||||
d2bet_array (const double *src, tribyte *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
double normfact ;
|
||||
|
@ -2675,7 +2676,7 @@ d2bet_array (double *src, tribyte *dest, int count, int normalize)
|
|||
} /* d2bet_array */
|
||||
|
||||
static void
|
||||
d2bet_clip_array (double *src, tribyte *dest, int count, int normalize)
|
||||
d2bet_clip_array (const double *src, tribyte *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
double normfact, scaled_value ;
|
||||
|
@ -2707,8 +2708,8 @@ d2bet_clip_array (double *src, tribyte *dest, int count, int normalize)
|
|||
} /* d2bet_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_d2bet (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ void (*convert) (double *, tribyte *, int, int) ;
|
||||
pcm_write_d2bet (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ void (*convert) (const double *, tribyte *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2733,7 +2734,7 @@ pcm_write_d2bet (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
d2bei_array (double *src, int *dest, int count, int normalize)
|
||||
d2bei_array (const double *src, int *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
double normfact ;
|
||||
|
@ -2752,7 +2753,7 @@ d2bei_array (double *src, int *dest, int count, int normalize)
|
|||
} /* d2bei_array */
|
||||
|
||||
static void
|
||||
d2bei_clip_array (double *src, int *dest, int count, int normalize)
|
||||
d2bei_clip_array (const double *src, int *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
double normfact, scaled_value ;
|
||||
|
@ -2787,8 +2788,8 @@ d2bei_clip_array (double *src, int *dest, int count, int normalize)
|
|||
} /* d2bei_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_d2bei (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ void (*convert) (double *, int *, int, int) ;
|
||||
pcm_write_d2bei (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ void (*convert) (const double *, int *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -2813,7 +2814,7 @@ pcm_write_d2bei (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static void
|
||||
d2lei_array (double *src, int *dest, int count, int normalize)
|
||||
d2lei_array (const double *src, int *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
double normfact ;
|
||||
|
@ -2832,7 +2833,7 @@ d2lei_array (double *src, int *dest, int count, int normalize)
|
|||
} /* d2lei_array */
|
||||
|
||||
static void
|
||||
d2lei_clip_array (double *src, int *dest, int count, int normalize)
|
||||
d2lei_clip_array (const double *src, int *dest, int count, int normalize)
|
||||
{ unsigned char *ucptr ;
|
||||
int value ;
|
||||
double normfact, scaled_value ;
|
||||
|
@ -2867,8 +2868,8 @@ d2lei_clip_array (double *src, int *dest, int count, int normalize)
|
|||
} /* d2lei_clip_array */
|
||||
|
||||
static sf_count_t
|
||||
pcm_write_d2lei (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
{ void (*convert) (double *, int *, int, int) ;
|
||||
pcm_write_d2lei (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ void (*convert) (const double *, int *, int, int) ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
@ -69,7 +70,7 @@ pvf_open (SF_PRIVATE *psf)
|
|||
psf->write_header = pvf_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = pvf_close ;
|
||||
psf->container_close = pvf_close ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
|
||||
|
||||
|
@ -184,8 +185,6 @@ pvf_read_header (SF_PRIVATE *psf)
|
|||
psf->datalength = psf->filelength - psf->dataoffset ;
|
||||
psf->blockwidth = psf->sf.channels * psf->bytewidth ;
|
||||
|
||||
psf->close = pvf_close ;
|
||||
|
||||
if (! psf->sf.frames && psf->blockwidth)
|
||||
psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
|
||||
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
@ -289,7 +290,7 @@ rx2_open (SF_PRIVATE *psf)
|
|||
if ((error = dwvw_init (psf, 16)))
|
||||
return error ;
|
||||
|
||||
psf->close = rx2_close ;
|
||||
psf->container_close = rx2_close ;
|
||||
|
||||
if (! psf->sf.frames && psf->blockwidth)
|
||||
psf->sf.frames = psf->datalength / psf->blockwidth ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2001-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2004 Paavo Jumppanen
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
|
@ -27,13 +27,14 @@
|
|||
** http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-99.html
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
@ -97,23 +98,22 @@ static int sd2_write_rsrc_fork (SF_PRIVATE *psf, int calc_length) ;
|
|||
|
||||
int
|
||||
sd2_open (SF_PRIVATE *psf)
|
||||
{ int saved_filedes, subformat, error = 0 ;
|
||||
{ int subformat, error = 0, valid ;
|
||||
|
||||
/* SD2 is always big endian. */
|
||||
psf->endian = SF_ENDIAN_BIG ;
|
||||
|
||||
if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->rsrclength > 0))
|
||||
{ if (psf->rsrcdes < 0)
|
||||
{ psf_log_printf (psf, "sd2_open : psf->rsrcdes < 0\n") ;
|
||||
return SFE_SD2_BAD_RSRC ;
|
||||
} ;
|
||||
|
||||
saved_filedes = psf->filedes ;
|
||||
psf->filedes = psf->rsrcdes ;
|
||||
{ psf_use_rsrc (psf, SF_TRUE) ;
|
||||
valid = psf_file_valid (psf) ;
|
||||
psf_use_rsrc (psf, SF_FALSE) ;
|
||||
if (! valid)
|
||||
{ psf_log_printf (psf, "sd2_open : psf->rsrcdes < 0\n") ;
|
||||
return SFE_SD2_BAD_RSRC ;
|
||||
} ;
|
||||
|
||||
error = sd2_parse_rsrc_fork (psf) ;
|
||||
|
||||
psf->filedes = saved_filedes ;
|
||||
if (error)
|
||||
goto error_cleanup ;
|
||||
} ;
|
||||
|
@ -130,12 +130,8 @@ sd2_open (SF_PRIVATE *psf)
|
|||
if (psf->mode == SFM_WRITE || (psf->mode == SFM_RDWR && psf->rsrclength == 0))
|
||||
{ psf_open_rsrc (psf, psf->mode) ;
|
||||
|
||||
saved_filedes = psf->filedes ;
|
||||
psf->filedes = psf->rsrcdes ;
|
||||
|
||||
error = sd2_write_rsrc_fork (psf, SF_FALSE) ;
|
||||
|
||||
psf->filedes = saved_filedes ;
|
||||
if (error)
|
||||
goto error_cleanup ;
|
||||
|
||||
|
@ -143,7 +139,7 @@ sd2_open (SF_PRIVATE *psf)
|
|||
psf->write_header = NULL ;
|
||||
} ;
|
||||
|
||||
psf->close = sd2_close ;
|
||||
psf->container_close = sd2_close ;
|
||||
|
||||
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
|
||||
|
||||
|
@ -207,6 +203,23 @@ write_int (unsigned char * data, int offset, int value)
|
|||
data [offset + 3] = value ;
|
||||
} /* write_int */
|
||||
|
||||
static inline void
|
||||
write_marker (unsigned char * data, int offset, int value)
|
||||
{
|
||||
if (CPU_IS_BIG_ENDIAN)
|
||||
{ data [offset] = value >> 24 ;
|
||||
data [offset + 1] = value >> 16 ;
|
||||
data [offset + 2] = value >> 8 ;
|
||||
data [offset + 3] = value ;
|
||||
}
|
||||
else
|
||||
{ data [offset] = value ;
|
||||
data [offset + 1] = value >> 8 ;
|
||||
data [offset + 2] = value >> 16 ;
|
||||
data [offset + 3] = value >> 24 ;
|
||||
} ;
|
||||
} /* write_marker */
|
||||
|
||||
static void
|
||||
write_str (unsigned char * data, int offset, char * buffer, int buffer_len)
|
||||
{ memcpy (data + offset, buffer, buffer_len) ;
|
||||
|
@ -224,6 +237,8 @@ sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length))
|
|||
|
||||
int k, str_offset, data_offset, next_str ;
|
||||
|
||||
psf_use_rsrc (psf, SF_TRUE) ;
|
||||
|
||||
memset (&rsrc, 0, sizeof (rsrc)) ;
|
||||
|
||||
rsrc.sample_rate = psf->sf.samplerate ;
|
||||
|
@ -269,8 +284,8 @@ sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length))
|
|||
write_str (rsrc.rsrc_data, 0x31, psf->filename, strlen (psf->filename)) ;
|
||||
|
||||
write_short (rsrc.rsrc_data, 0x50, 0) ;
|
||||
write_int (rsrc.rsrc_data, 0x52, Sd2f_MARKER) ;
|
||||
write_int (rsrc.rsrc_data, 0x56, lsf1_MARKER) ;
|
||||
write_marker (rsrc.rsrc_data, 0x52, Sd2f_MARKER) ;
|
||||
write_marker (rsrc.rsrc_data, 0x56, lsf1_MARKER) ;
|
||||
|
||||
/* Very start of resource map. */
|
||||
write_int (rsrc.rsrc_data, rsrc.map_offset + 0, rsrc.data_offset) ;
|
||||
|
@ -304,12 +319,12 @@ sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length))
|
|||
|
||||
/* Write 'STR ' resource type. */
|
||||
rsrc.str_count = 3 ;
|
||||
write_int (rsrc.rsrc_data, rsrc.type_offset, STR_MARKER) ;
|
||||
write_marker (rsrc.rsrc_data, rsrc.type_offset, STR_MARKER) ;
|
||||
write_short (rsrc.rsrc_data, rsrc.type_offset + 4, rsrc.str_count - 1) ;
|
||||
write_short (rsrc.rsrc_data, rsrc.type_offset + 6, 0x12) ;
|
||||
|
||||
/* Write 'sdML' resource type. */
|
||||
write_int (rsrc.rsrc_data, rsrc.type_offset + 8, sdML_MARKER) ;
|
||||
write_marker (rsrc.rsrc_data, rsrc.type_offset + 8, sdML_MARKER) ;
|
||||
write_short (rsrc.rsrc_data, rsrc.type_offset + 12, 0) ;
|
||||
write_short (rsrc.rsrc_data, rsrc.type_offset + 14, 0x36) ;
|
||||
|
||||
|
@ -340,6 +355,9 @@ sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length))
|
|||
rsrc.rsrc_len = rsrc.map_offset + rsrc.map_length ;
|
||||
|
||||
psf_fwrite (rsrc.rsrc_data, rsrc.rsrc_len, 1, psf) ;
|
||||
|
||||
psf_use_rsrc (psf, SF_FALSE) ;
|
||||
|
||||
if (psf->error)
|
||||
return psf->error ;
|
||||
|
||||
|
@ -357,12 +375,23 @@ read_char (const unsigned char * data, int offset)
|
|||
static inline int
|
||||
read_short (const unsigned char * data, int offset)
|
||||
{ return (data [offset] << 8) + data [offset + 1] ;
|
||||
} /* read_char */
|
||||
} /* read_short */
|
||||
|
||||
static inline int
|
||||
read_int (const unsigned char * data, int offset)
|
||||
{ return (data [offset] << 24) + (data [offset + 1] << 16) + (data [offset + 2] << 8) + data [offset + 3] ;
|
||||
} /* read_char */
|
||||
} /* read_int */
|
||||
|
||||
static inline int
|
||||
read_marker (const unsigned char * data, int offset)
|
||||
{
|
||||
if (CPU_IS_BIG_ENDIAN)
|
||||
return (data [offset] << 24) + (data [offset + 1] << 16) + (data [offset + 2] << 8) + data [offset + 3] ;
|
||||
else if (CPU_IS_LITTLE_ENDIAN)
|
||||
return data [offset] + (data [offset + 1] << 8) + (data [offset + 2] << 16) + (data [offset + 3] << 24) ;
|
||||
else
|
||||
return 0x666 ;
|
||||
} /* read_marker */
|
||||
|
||||
static void
|
||||
read_str (const unsigned char * data, int offset, char * buffer, int buffer_len)
|
||||
|
@ -383,6 +412,8 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
|
|||
{ SD2_RSRC rsrc ;
|
||||
int k, marker, error = 0 ;
|
||||
|
||||
psf_use_rsrc (psf, SF_TRUE) ;
|
||||
|
||||
memset (&rsrc, 0, sizeof (rsrc)) ;
|
||||
|
||||
rsrc.rsrc_len = psf_get_filelen (psf) ;
|
||||
|
@ -404,12 +435,20 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
|
|||
rsrc.data_length = read_int (rsrc.rsrc_data, 8) ;
|
||||
rsrc.map_length = read_int (rsrc.rsrc_data, 12) ;
|
||||
|
||||
if (rsrc.data_offset == 0x51607 && rsrc.map_offset == 0x20000)
|
||||
{ psf_log_printf (psf, "Trying offset of 0x52 bytes.\n") ;
|
||||
rsrc.data_offset = read_int (rsrc.rsrc_data, 0x52 + 0) + 0x52 ;
|
||||
rsrc.map_offset = read_int (rsrc.rsrc_data, 0x52 + 4) + 0x52 ;
|
||||
rsrc.data_length = read_int (rsrc.rsrc_data, 0x52 + 8) ;
|
||||
rsrc.map_length = read_int (rsrc.rsrc_data, 0x52 + 12) ;
|
||||
} ;
|
||||
|
||||
psf_log_printf (psf, " data offset : 0x%04X\n map offset : 0x%04X\n"
|
||||
" data length : 0x%04X\n map length : 0x%04X\n",
|
||||
rsrc.data_offset, rsrc.map_offset, rsrc.data_length, rsrc.map_length) ;
|
||||
|
||||
if (rsrc.data_offset > rsrc.rsrc_len)
|
||||
{ psf_log_printf (psf, "Error : rsrc.data_offset > len\n") ;
|
||||
{ psf_log_printf (psf, "Error : rsrc.data_offset (%d, 0x%x) > len\n", rsrc.data_offset, rsrc.data_offset) ;
|
||||
error = SFE_SD2_BAD_DATA_OFFSET ;
|
||||
goto parse_rsrc_fork_cleanup ;
|
||||
} ;
|
||||
|
@ -463,7 +502,7 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
|
|||
|
||||
rsrc.str_index = -1 ;
|
||||
for (k = 0 ; k < rsrc.type_count ; k ++)
|
||||
{ marker = read_int (rsrc.rsrc_data, rsrc.type_offset + k * 8) ;
|
||||
{ marker = read_marker (rsrc.rsrc_data, rsrc.type_offset + k * 8) ;
|
||||
|
||||
if (marker == STR_MARKER)
|
||||
{ rsrc.str_index = k ;
|
||||
|
@ -478,6 +517,8 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
|
|||
|
||||
parse_rsrc_fork_cleanup :
|
||||
|
||||
psf_use_rsrc (psf, SF_FALSE) ;
|
||||
|
||||
if ((void *) rsrc.rsrc_data < (void *) psf || (void *) rsrc.rsrc_data > (void *) (psf + 1))
|
||||
free (rsrc.rsrc_data) ;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2002-2005 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -76,10 +76,10 @@ static sf_count_t sds_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t sds_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t sds_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t sds_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t sds_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t sds_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t sds_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t sds_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t sds_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t sds_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t sds_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t sds_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ;
|
||||
|
||||
|
@ -93,7 +93,7 @@ static int sds_2byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds) ;
|
|||
static int sds_3byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds) ;
|
||||
static int sds_4byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds) ;
|
||||
|
||||
static int sds_write (SF_PRIVATE *psf, SDS_PRIVATE *psds, int *iptr, int writecount) ;
|
||||
static int sds_write (SF_PRIVATE *psf, SDS_PRIVATE *psds, const int *iptr, int writecount) ;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
** Public function.
|
||||
|
@ -102,7 +102,7 @@ static int sds_write (SF_PRIVATE *psf, SDS_PRIVATE *psds, int *iptr, int writeco
|
|||
int
|
||||
sds_open (SF_PRIVATE *psf)
|
||||
{ SDS_PRIVATE *psds ;
|
||||
int subformat, error = 0 ;
|
||||
int error = 0 ;
|
||||
|
||||
/* Hmmmm, need this here to pass update_header_test. */
|
||||
psf->sf.frames = 0 ;
|
||||
|
@ -119,8 +119,6 @@ sds_open (SF_PRIVATE *psf)
|
|||
if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_SDS)
|
||||
return SFE_BAD_OPEN_FORMAT ;
|
||||
|
||||
subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
|
||||
{ if (sds_write_header (psf, SF_FALSE))
|
||||
return psf->error ;
|
||||
|
@ -134,7 +132,7 @@ sds_open (SF_PRIVATE *psf)
|
|||
return error ;
|
||||
|
||||
psf->seek = sds_seek ;
|
||||
psf->close = sds_close ;
|
||||
psf->container_close = sds_close ;
|
||||
|
||||
psf->blockwidth = 0 ;
|
||||
|
||||
|
@ -674,17 +672,17 @@ sds_seek (SF_PRIVATE *psf, int mode, sf_count_t seek_from_start)
|
|||
|
||||
if ((psds = psf->fdata) == NULL)
|
||||
{ psf->error = SFE_INTERNAL ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (psf->datalength < 0 || psf->dataoffset < 0)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (seek_from_start < 0 || seek_from_start > psf->sf.frames)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (mode == SFM_READ && psds->write_count > 0)
|
||||
|
@ -697,14 +695,14 @@ sds_seek (SF_PRIVATE *psf, int mode, sf_count_t seek_from_start)
|
|||
{ case SFM_READ :
|
||||
if (newblock > psds->total_blocks)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
file_offset = psf->dataoffset + newblock * SDS_BLOCK_SIZE ;
|
||||
|
||||
if (psf_fseek (psf, file_offset, SEEK_SET) != file_offset)
|
||||
{ psf->error = SFE_SEEK_FAILED ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
psds->read_block = newblock ;
|
||||
|
@ -715,14 +713,14 @@ sds_seek (SF_PRIVATE *psf, int mode, sf_count_t seek_from_start)
|
|||
case SFM_WRITE :
|
||||
if (newblock > psds->total_blocks)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
file_offset = psf->dataoffset + newblock * SDS_BLOCK_SIZE ;
|
||||
|
||||
if (psf_fseek (psf, file_offset, SEEK_SET) != file_offset)
|
||||
{ psf->error = SFE_SEEK_FAILED ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
psds->write_block = newblock ;
|
||||
|
@ -732,7 +730,7 @@ sds_seek (SF_PRIVATE *psf, int mode, sf_count_t seek_from_start)
|
|||
|
||||
default :
|
||||
psf->error = SFE_BAD_SEEK ;
|
||||
return SF_SEEK_ERROR ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
|
@ -866,7 +864,7 @@ sds_4byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds)
|
|||
} /* sds_4byte_write */
|
||||
|
||||
static sf_count_t
|
||||
sds_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
sds_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ SDS_PRIVATE *psds ;
|
||||
int *iptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -891,7 +889,7 @@ sds_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* sds_write_s */
|
||||
|
||||
static sf_count_t
|
||||
sds_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
sds_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ SDS_PRIVATE *psds ;
|
||||
int total ;
|
||||
|
||||
|
@ -905,7 +903,7 @@ sds_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* sds_write_i */
|
||||
|
||||
static sf_count_t
|
||||
sds_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
sds_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ SDS_PRIVATE *psds ;
|
||||
int *iptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -936,7 +934,7 @@ sds_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* sds_write_f */
|
||||
|
||||
static sf_count_t
|
||||
sds_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
sds_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ SDS_PRIVATE *psds ;
|
||||
int *iptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -967,7 +965,7 @@ sds_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
} /* sds_write_d */
|
||||
|
||||
static int
|
||||
sds_write (SF_PRIVATE *psf, SDS_PRIVATE *psds, int *ptr, int len)
|
||||
sds_write (SF_PRIVATE *psf, SDS_PRIVATE *psds, const int *ptr, int len)
|
||||
{ int count, total = 0 ;
|
||||
|
||||
while (total < len)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -16,17 +16,19 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#elif HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if (defined (SIZEOF_INT64_T) && (SIZEOF_INT64_T == 8))
|
||||
/* Good, we have int64_t. */
|
||||
#elif (defined (SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8))
|
||||
#elif (defined (SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8))
|
||||
typedef long long int64_t ;
|
||||
#elif (defined (SIZEOF_LONG) && (SIZEOF_LONG == 8))
|
||||
#elif (defined (SIZEOF_LONG) && (SIZEOF_LONG == 8))
|
||||
typedef long int64_t ;
|
||||
#elif (defined (WIN32) || defined (_WIN32))
|
||||
typedef __int64 int64_t ;
|
||||
|
@ -34,8 +36,6 @@ typedef __int64 int64_t ;
|
|||
#error "No 64 bit integer type."
|
||||
#endif
|
||||
|
||||
#undef HAVE_BYTESWAP_H
|
||||
|
||||
#if HAVE_BYTESWAP_H
|
||||
|
||||
#include <byteswap.h>
|
||||
|
@ -47,7 +47,7 @@ typedef __int64 int64_t ;
|
|||
|
||||
#define ENDSWAP_SHORT(x) ((((x)>>8)&0xFF)+(((x)&0xFF)<<8))
|
||||
#define ENDSWAP_INT(x) ((((x)>>24)&0xFF)+(((x)>>8)&0xFF00)+(((x)&0xFF00)<<8)+(((x)&0xFF)<<24))
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -58,11 +58,11 @@ typedef __int64 int64_t ;
|
|||
*/
|
||||
|
||||
#if (CPU_IS_LITTLE_ENDIAN == 1)
|
||||
#define MAKE_MARKER(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24))
|
||||
#define MAKE_MARKER(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
|
||||
#elif (CPU_IS_BIG_ENDIAN == 1)
|
||||
#define MAKE_MARKER(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d))
|
||||
#define MAKE_MARKER(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
|
||||
#else
|
||||
#error "Target CPU endian-ness unknown. May need to hand edit src/config.h"
|
||||
#error "Target CPU endian-ness unknown. May need to hand edit src/sfconfig.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -75,27 +75,25 @@ typedef __int64 int64_t ;
|
|||
#if (CPU_IS_LITTLE_ENDIAN == 1)
|
||||
#define LES2H_SHORT(x) (x)
|
||||
#define LEI2H_INT(x) (x)
|
||||
#define BES2H_SHORT(x) ENDSWAP_SHORT(x)
|
||||
#define BEI2H_INT(x) ENDSWAP_INT(x)
|
||||
|
||||
#define H2BE_SHORT(x) ENDSWAP_SHORT(x)
|
||||
#define H2BE_INT(x) ENDSWAP_INT(x)
|
||||
#define H2LE_SHORT(x) (x)
|
||||
#define H2LE_INT(x) (x)
|
||||
#define BES2H_SHORT(x) ENDSWAP_SHORT (x)
|
||||
#define BEI2H_INT(x) ENDSWAP_INT (x)
|
||||
|
||||
#define H2BE_SHORT(x) ENDSWAP_SHORT (x)
|
||||
#define H2BE_INT(x) ENDSWAP_INT (x)
|
||||
|
||||
#elif (CPU_IS_BIG_ENDIAN == 1)
|
||||
#define LES2H_SHORT(x) ENDSWAP_SHORT(x)
|
||||
#define LEI2H_INT(x) ENDSWAP_INT(x)
|
||||
#define LES2H_SHORT(x) ENDSWAP_SHORT (x)
|
||||
#define LEI2H_INT(x) ENDSWAP_INT (x)
|
||||
|
||||
#define BES2H_SHORT(x) (x)
|
||||
#define BEI2H_INT(x) (x)
|
||||
|
||||
#define H2BE_SHORT(x) (x)
|
||||
#define H2BE_INT(x) (x)
|
||||
#define H2LE_SHORT(x) ENDSWAP_SHORT(x)
|
||||
#define H2LE_INT(x) ENDSWAP_INT(x)
|
||||
#define H2LE_SHORT(x) ENDSWAP_SHORT (x)
|
||||
#define H2LE_INT(x) ENDSWAP_INT (x)
|
||||
|
||||
#else
|
||||
#error "Target CPU endian-ness unknown. May need to hand edit src/config.h"
|
||||
#error "Target CPU endian-ness unknown. May need to hand edit src/sfconfig.h"
|
||||
#endif
|
||||
|
||||
#define LET2H_SHORT_PTR(x) ((x) [1] + ((x) [2] << 8))
|
||||
|
@ -202,7 +200,7 @@ static inline void
|
|||
endswap_int64_t_copy (int64_t *dest, const int64_t *src, int len)
|
||||
{ const unsigned char *psrc ;
|
||||
unsigned char *pdest ;
|
||||
|
||||
|
||||
if (dest == src)
|
||||
{ endswap_int64_t_array (dest, len) ;
|
||||
return ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -40,6 +40,8 @@ ErrorStruct SndfileErrors [] =
|
|||
{ SF_ERR_NO_ERROR , "No Error." },
|
||||
{ SF_ERR_UNRECOGNISED_FORMAT , "File opened for read. Format not recognised." },
|
||||
{ SF_ERR_SYSTEM , "System error." /* Often replaced. */ },
|
||||
{ SF_ERR_MALFORMED_FILE , "Supported file format but file is malformed." },
|
||||
{ SF_ERR_UNSUPPORTED_ENCODING , "Supported file format but unsupported encoding." },
|
||||
|
||||
/* Private error values and their associated strings. */
|
||||
{ SFE_BAD_FILE , "File does not exist or is not a regular file (possibly a pipe?)." },
|
||||
|
@ -66,25 +68,25 @@ ErrorStruct SndfileErrors [] =
|
|||
{ SFE_NO_EMBEDDED_RDWR , "Error : cannot open embedded file read/write." },
|
||||
{ SFE_NO_PIPE_WRITE , "Error : this file format does not support pipe write." },
|
||||
{ SFE_BAD_RDWR_FORMAT , "Attempted to open read only format for RDWR." },
|
||||
{ SFE_BAD_VIRTUAL_IO , "Error : bad pointer on SF_VIRTUAL_IO struct." },
|
||||
|
||||
{ SFE_INTERLEAVE_MODE , "Attempt to write to file with non-interleaved data." },
|
||||
{ SFE_INTERLEAVE_SEEK , "Bad karma in seek during interleave read operation." },
|
||||
{ SFE_INTERLEAVE_READ , "Bad karma in read during interleave read operation." },
|
||||
|
||||
{ SFE_INTERNAL , "Unspecified internal error." },
|
||||
{ SFE_LOG_OVERRUN , "Log buffer has overrun. File probably broken." },
|
||||
{ SFE_BAD_CONTROL_CMD , "Bad command passed to function sf_command()." },
|
||||
{ SFE_BAD_ENDIAN , "Bad endian-ness. Try default endian-ness" },
|
||||
{ SFE_CHANNEL_COUNT , "Too many channels specified." },
|
||||
|
||||
{ SFE_BAD_SEEK , "Internal psf_fseek() failed." },
|
||||
{ SFE_NOT_SEEKABLE , "Seek attempted on unseekable file type." },
|
||||
{ SFE_AMBIGUOUS_SEEK , "Error: combination of file open mode and seek command is ambiguous." },
|
||||
{ SFE_WRONG_SEEK , "Error: invalid seek parameters." },
|
||||
{ SFE_SEEK_FAILED , "Error: parameters OK, but psf_seek() failed." },
|
||||
{ SFE_AMBIGUOUS_SEEK , "Error : combination of file open mode and seek command is ambiguous." },
|
||||
{ SFE_WRONG_SEEK , "Error : invalid seek parameters." },
|
||||
{ SFE_SEEK_FAILED , "Error : parameters OK, but psf_seek() failed." },
|
||||
|
||||
{ SFE_BAD_OPEN_MODE , "Error: bad mode parameter for file open." },
|
||||
{ SFE_OPEN_PIPE_RDWR , "Error: attempt toopen a pipe in read/write mode." },
|
||||
{ SFE_BAD_OPEN_MODE , "Error : bad mode parameter for file open." },
|
||||
{ SFE_OPEN_PIPE_RDWR , "Error : attempt toopen a pipe in read/write mode." },
|
||||
{ SFE_RDWR_POSITION , "Error on RDWR position (cryptic)." },
|
||||
{ SFE_RDWR_BAD_HEADER , "Error : Cannot open file in read/write mode due to string data in header." },
|
||||
|
||||
|
@ -102,7 +104,6 @@ ErrorStruct SndfileErrors [] =
|
|||
{ SFE_WAV_NO_FMT , "Error in WAV file. No 'fmt ' chunk marker." },
|
||||
{ SFE_WAV_FMT_SHORT , "Error in WAV file. Short 'fmt ' chunk." },
|
||||
|
||||
{ SFE_WAV_FMT_TOO_BIG , "Error in WAV file. 'fmt ' chunk too large." },
|
||||
{ SFE_WAV_BAD_FACT , "Error in WAV file. 'fact' chunk out of place." },
|
||||
{ SFE_WAV_BAD_PEAK , "Error in WAV file. Bad 'PEAK' chunk." },
|
||||
{ SFE_WAV_PEAK_B4_FMT , "Error in WAV file. 'PEAK' chunk found before 'fmt ' chunk." },
|
||||
|
@ -110,6 +111,7 @@ ErrorStruct SndfileErrors [] =
|
|||
{ SFE_WAV_BAD_FORMAT , "Error in WAV file. Errors in 'fmt ' chunk." },
|
||||
{ SFE_WAV_BAD_BLOCKALIGN , "Error in WAV file. Block alignment in 'fmt ' chunk is incorrect." },
|
||||
{ SFE_WAV_NO_DATA , "Error in WAV file. No 'data' chunk marker." },
|
||||
{ SFE_WAV_BAD_LIST , "Error in WAV file. Malformed LIST chunk." },
|
||||
{ SFE_WAV_UNKNOWN_CHUNK , "Error in WAV file. File contains an unknown chunk marker." },
|
||||
{ SFE_WAV_WVPK_DATA , "Error in WAV file. Data is in WAVPACK format." },
|
||||
|
||||
|
@ -214,6 +216,13 @@ ErrorStruct SndfileErrors [] =
|
|||
{ SFE_SD2_BAD_RSRC , "Error : bad resource fork." },
|
||||
{ SFE_SD2_BAD_SAMPLE_SIZE , "Error : bad sample size." },
|
||||
|
||||
{ SFE_FLAC_BAD_HEADER , "Error : bad flac header." },
|
||||
{ SFE_FLAC_NEW_DECODER , "Error : problem while creating flac decoder." },
|
||||
{ SFE_FLAC_INIT_DECODER , "Error : problem while initialization of the flac decoder." },
|
||||
{ SFE_FLAC_LOST_SYNC , "Error : flac decoder lost sync." },
|
||||
{ SFE_FLAC_BAD_SAMPLE_RATE, "Error : flac does not support this sample rate." },
|
||||
{ SFE_FLAC_UNKOWN_ERROR , "Error : unkown error in flac decoder." },
|
||||
|
||||
{ SFE_DWVW_BAD_BITWIDTH , "Error : Bad bit width for DWVW encoding. Must be 12, 16 or 24." },
|
||||
{ SFE_G72X_NOT_MONO , "Error : G72x encoding does not support more than 1 channel." },
|
||||
|
||||
|
@ -224,8 +233,8 @@ ErrorStruct SndfileErrors [] =
|
|||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int format_from_extension (const char *filename) ;
|
||||
static int guess_file_type (SF_PRIVATE *psf, const char *filename) ;
|
||||
static int format_from_extension (SF_PRIVATE *psf) ;
|
||||
static int guess_file_type (SF_PRIVATE *psf) ;
|
||||
static int validate_sfinfo (SF_INFO *sfinfo) ;
|
||||
static int validate_psf (SF_PRIVATE *psf) ;
|
||||
static void save_header_info (SF_PRIVATE *psf) ;
|
||||
|
@ -252,7 +261,8 @@ static char sf_syserr [SF_SYSERR_LEN] = { 0 } ;
|
|||
return 0 ; \
|
||||
} ; \
|
||||
(b) = (SF_PRIVATE*) (a) ; \
|
||||
if (psf_filedes_valid (b) == 0) \
|
||||
if ((b)->virtual_io == SF_FALSE && \
|
||||
psf_file_valid (b) == 0) \
|
||||
{ (b)->error = SFE_BAD_FILE_PTR ; \
|
||||
return 0 ; \
|
||||
} ; \
|
||||
|
@ -278,7 +288,7 @@ sf_open (const char *path, int mode, SF_INFO *sfinfo)
|
|||
} ;
|
||||
|
||||
memset (psf, 0, sizeof (SF_PRIVATE)) ;
|
||||
psf->rsrcdes = -1 ;
|
||||
psf_init_files (psf) ;
|
||||
|
||||
psf_log_printf (psf, "File : %s\n", path) ;
|
||||
|
||||
|
@ -321,8 +331,9 @@ sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc)
|
|||
return NULL ;
|
||||
} ;
|
||||
|
||||
psf_init_files (psf) ;
|
||||
|
||||
psf_set_file (psf, fd) ;
|
||||
psf->rsrcdes = -1 ;
|
||||
psf->is_pipe = psf_is_pipe (psf) ;
|
||||
psf->fileoffset = psf_ftell (psf) ;
|
||||
|
||||
|
@ -345,8 +356,58 @@ sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc)
|
|||
return (SNDFILE*) psf ;
|
||||
} /* sf_open_fd */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
SNDFILE*
|
||||
sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data)
|
||||
{ SF_PRIVATE *psf ;
|
||||
int error = 0 ;
|
||||
|
||||
/* Make sure we have a valid set ot virtual pointers. */
|
||||
if (sfvirtual->get_filelen == NULL || sfvirtual->seek == NULL || sfvirtual->tell == NULL)
|
||||
{ sf_errno = SFE_BAD_VIRTUAL_IO ;
|
||||
LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_get_filelen / vio_seek / vio_tell in SF_VIRTUAL_IO struct.\n") ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
if ((mode == SFM_READ || mode == SFM_RDWR) && sfvirtual->read == NULL)
|
||||
{ sf_errno = SFE_BAD_VIRTUAL_IO ;
|
||||
LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_read in SF_VIRTUAL_IO struct.\n") ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
if ((mode == SFM_WRITE || mode == SFM_RDWR) && sfvirtual->write == NULL)
|
||||
{ sf_errno = SFE_BAD_VIRTUAL_IO ;
|
||||
LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "Bad vio_write in SF_VIRTUAL_IO struct.\n") ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
if ((psf = calloc (1, sizeof (SF_PRIVATE))) == NULL)
|
||||
{ sf_errno = SFE_MALLOC_FAILED ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
psf_init_files (psf) ;
|
||||
|
||||
psf->virtual_io = SF_TRUE ;
|
||||
psf->vio = *sfvirtual ;
|
||||
psf->vio_user_data = user_data ;
|
||||
|
||||
psf->mode = mode ;
|
||||
|
||||
error = psf_open_file (psf, mode, sfinfo) ;
|
||||
|
||||
if (error)
|
||||
{ sf_errno = error ;
|
||||
if (error == SFE_SYSTEM)
|
||||
LSF_SNPRINTF (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
|
||||
LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ;
|
||||
psf_close (psf) ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
memcpy (sfinfo, &(psf->sf), sizeof (SF_INFO)) ;
|
||||
|
||||
return (SNDFILE*) psf ;
|
||||
} /* sf_open_virtual */
|
||||
|
||||
int
|
||||
sf_close (SNDFILE *sndfile)
|
||||
|
@ -357,6 +418,18 @@ sf_close (SNDFILE *sndfile)
|
|||
return psf_close (psf) ;
|
||||
} /* sf_close */
|
||||
|
||||
void
|
||||
sf_write_sync (SNDFILE *sndfile)
|
||||
{ SF_PRIVATE *psf ;
|
||||
|
||||
if ((psf = (SF_PRIVATE *) sndfile) == NULL)
|
||||
return ;
|
||||
|
||||
psf_fsync (psf) ;
|
||||
|
||||
return ;
|
||||
} /* sf_write_sync */
|
||||
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
|
@ -416,14 +489,14 @@ sf_error (SNDFILE *sndfile)
|
|||
|
||||
if (! sndfile)
|
||||
{ if (sf_error != 0)
|
||||
return 1 ;
|
||||
return sf_errno ;
|
||||
return 0 ;
|
||||
} ;
|
||||
|
||||
VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 0) ;
|
||||
|
||||
if (psf->error)
|
||||
return 1 ;
|
||||
return psf->error ;
|
||||
|
||||
return 0 ;
|
||||
} /* sf_error */
|
||||
|
@ -496,9 +569,7 @@ sf_format_check (const SF_INFO *info)
|
|||
switch (info->format & SF_FORMAT_TYPEMASK)
|
||||
{ case SF_FORMAT_WAV :
|
||||
case SF_FORMAT_WAVEX :
|
||||
/* WAV is strictly little endian. */
|
||||
if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
|
||||
return 0 ;
|
||||
/* WAV now allows both endian, RIFF or RIFX (little or big respectively) */
|
||||
if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16)
|
||||
return 1 ;
|
||||
if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
|
||||
|
@ -507,6 +578,8 @@ sf_format_check (const SF_INFO *info)
|
|||
return 1 ;
|
||||
if (subformat == SF_FORMAT_GSM610 && info->channels == 1)
|
||||
return 1 ;
|
||||
if (subformat == SF_FORMAT_G721_32 && info->channels == 1)
|
||||
return 1 ;
|
||||
if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
|
||||
return 1 ;
|
||||
if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
|
||||
|
@ -552,6 +625,17 @@ sf_format_check (const SF_INFO *info)
|
|||
return 1 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_CAF :
|
||||
if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16)
|
||||
return 1 ;
|
||||
if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
|
||||
return 1 ;
|
||||
if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
|
||||
return 1 ;
|
||||
if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
|
||||
return 1 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_RAW :
|
||||
if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16)
|
||||
return 1 ;
|
||||
|
@ -685,12 +769,20 @@ sf_format_check (const SF_INFO *info)
|
|||
/* SDS is strictly big endian. */
|
||||
if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU)
|
||||
return 0 ;
|
||||
if (info->channels < 1 || info->channels > 2)
|
||||
if (info->channels > 2)
|
||||
return 0 ;
|
||||
if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16)
|
||||
return 1 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_FLAC :
|
||||
/* FLAC can't do more than 8 channels. */
|
||||
if (info->channels > 8)
|
||||
return 0 ;
|
||||
if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24)
|
||||
return 1 ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_SD2 :
|
||||
/* SD2 is strictly big endian. */
|
||||
if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU)
|
||||
|
@ -710,7 +802,8 @@ sf_format_check (const SF_INFO *info)
|
|||
|
||||
int
|
||||
sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
{ SF_PRIVATE *psf = NULL ;
|
||||
{ SF_PRIVATE *psf = NULL ;
|
||||
int old_value ;
|
||||
|
||||
/* This set of commands do not need the sndfile parameter. */
|
||||
switch (command)
|
||||
|
@ -721,7 +814,7 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
|||
LSF_SNPRINTF (data, datasize, "%s-%s-exp", PACKAGE_NAME, PACKAGE_VERSION) ;
|
||||
else
|
||||
LSF_SNPRINTF (data, datasize, "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
|
||||
return 0 ;
|
||||
return strlen (data) ;
|
||||
|
||||
case SFC_GET_SIMPLE_FORMAT_COUNT :
|
||||
if (data == NULL || datasize != SIGNED_SIZEOF (int))
|
||||
|
@ -766,19 +859,21 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
|||
{ if (data == NULL)
|
||||
return (psf->error = SFE_BAD_CONTROL_CMD) ;
|
||||
LSF_SNPRINTF (data, datasize, "%s", sf_logbuffer) ;
|
||||
return 0 ;
|
||||
return strlen (data) ;
|
||||
} ;
|
||||
|
||||
VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
|
||||
|
||||
switch (command)
|
||||
{ case SFC_SET_NORM_FLOAT :
|
||||
old_value = psf->norm_float ;
|
||||
psf->norm_float = (datasize) ? SF_TRUE : SF_FALSE ;
|
||||
return psf->norm_float ;
|
||||
return old_value ;
|
||||
|
||||
case SFC_SET_NORM_DOUBLE :
|
||||
old_value = psf->norm_double ;
|
||||
psf->norm_double = (datasize) ? SF_TRUE : SF_FALSE ;
|
||||
return psf->norm_double ;
|
||||
return old_value ;
|
||||
|
||||
case SFC_GET_NORM_FLOAT :
|
||||
return psf->norm_float ;
|
||||
|
@ -787,14 +882,12 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
|||
return psf->norm_double ;
|
||||
|
||||
case SFC_SET_SCALE_FLOAT_INT_READ :
|
||||
{ int old_value = psf->float_int_mult ;
|
||||
old_value = psf->float_int_mult ;
|
||||
|
||||
psf->float_int_mult = (datasize != 0) ? SF_TRUE : SF_FALSE ;
|
||||
if (psf->float_int_mult && psf->float_max < 0.0)
|
||||
psf->float_max = psf_calc_signal_max (psf, SF_FALSE) ;
|
||||
return old_value ;
|
||||
}
|
||||
break ;
|
||||
psf->float_int_mult = (datasize != 0) ? SF_TRUE : SF_FALSE ;
|
||||
if (psf->float_int_mult && psf->float_max < 0.0)
|
||||
psf->float_max = psf_calc_signal_max (psf, SF_FALSE) ;
|
||||
return old_value ;
|
||||
|
||||
case SFC_SET_ADD_PEAK_CHUNK :
|
||||
{ int format = psf->sf.format & SF_FORMAT_TYPEMASK ;
|
||||
|
@ -815,12 +908,21 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
|||
return SF_FALSE ;
|
||||
/* If data has already been written this must fail. */
|
||||
if (psf->have_written)
|
||||
return psf->has_peak ;
|
||||
return SF_FALSE ;
|
||||
/* Everything seems OK, so set psf->has_peak and re-write header. */
|
||||
psf->has_peak = (datasize) ? SF_TRUE : SF_FALSE ;
|
||||
if (datasize == SF_FALSE)
|
||||
{ if (psf->peak_info)
|
||||
{ free (psf->peak_info) ;
|
||||
psf->peak_info = NULL ;
|
||||
} ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
if (psf->peak_info == NULL)
|
||||
psf->peak_info = peak_info_calloc (psf->sf.channels) ;
|
||||
|
||||
if (psf->write_header)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
return psf->has_peak ;
|
||||
return SF_TRUE ;
|
||||
|
||||
case SFC_GET_LOG_INFO :
|
||||
if (data == NULL)
|
||||
|
@ -943,16 +1045,30 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
|||
return psf->add_clipping ;
|
||||
|
||||
case SFC_GET_LOOP_INFO :
|
||||
if (datasize != sizeof (SF_LOOP_INFO))
|
||||
if (datasize != sizeof (SF_LOOP_INFO) || data == NULL)
|
||||
return SF_FALSE ;
|
||||
if (psf->loop_info != NULL)
|
||||
{ SF_LOOP_INFO *temp = (SF_LOOP_INFO *) data ;
|
||||
memcpy (temp, psf->loop_info, sizeof (SF_LOOP_INFO)) ;
|
||||
if (psf->loop_info == NULL)
|
||||
return SF_FALSE ;
|
||||
memcpy (data, psf->loop_info, sizeof (SF_LOOP_INFO)) ;
|
||||
return SF_TRUE ;
|
||||
|
||||
return SF_TRUE ;
|
||||
case SFC_GET_INSTRUMENT :
|
||||
if (datasize != sizeof (SF_INSTRUMENT) || data == NULL)
|
||||
return SF_FALSE ;
|
||||
if (psf->instrument == NULL)
|
||||
return SF_FALSE ;
|
||||
memcpy (data, psf->instrument, sizeof (SF_INSTRUMENT)) ;
|
||||
return SF_TRUE ;
|
||||
|
||||
case SFC_SET_INSTRUMENT :
|
||||
if (datasize != sizeof (SF_INSTRUMENT) || data == NULL)
|
||||
return SF_FALSE ;
|
||||
if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
|
||||
{ psf->error = SFE_MALLOC_FAILED ;
|
||||
return SF_FALSE ;
|
||||
} ;
|
||||
|
||||
return SF_FALSE ;
|
||||
memcpy (psf->instrument, data, sizeof (SF_INSTRUMENT)) ;
|
||||
return SF_TRUE ;
|
||||
|
||||
default :
|
||||
/* Must be a file specific command. Pass it on. */
|
||||
|
@ -978,7 +1094,7 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence)
|
|||
|
||||
if (! psf->sf.seekable)
|
||||
{ psf->error = SFE_NOT_SEEKABLE ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
/* If the whence parameter has a mode ORed in, check to see that
|
||||
|
@ -987,7 +1103,7 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence)
|
|||
if (((whence & SFM_MASK) == SFM_WRITE && psf->mode == SFM_READ) ||
|
||||
((whence & SFM_MASK) == SFM_WRITE && psf->mode == SFM_WRITE))
|
||||
{ psf->error = SFE_WRONG_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
/* Convert all SEEK_CUR and SEEK_END into seek_from_start to be
|
||||
|
@ -1043,11 +1159,11 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence)
|
|||
} ;
|
||||
|
||||
if (psf->error)
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
|
||||
if (seek_from_start < 0 || seek_from_start > psf->sf.frames)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (psf->seek)
|
||||
|
@ -1075,7 +1191,7 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence)
|
|||
} ;
|
||||
|
||||
psf->error = SFE_AMBIGUOUS_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} /* sf_seek */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
|
@ -1555,7 +1671,7 @@ sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames)
|
|||
*/
|
||||
|
||||
sf_count_t
|
||||
sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t len)
|
||||
sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
sf_count_t count ;
|
||||
int bytewidth, blockwidth ;
|
||||
|
@ -1595,7 +1711,7 @@ sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
sf_count_t
|
||||
sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t len)
|
||||
sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
sf_count_t count ;
|
||||
|
||||
|
@ -1630,7 +1746,7 @@ sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t len)
|
|||
|
||||
psf->last_op = SFM_WRITE ;
|
||||
|
||||
if (psf->auto_header)
|
||||
if (psf->auto_header && psf->write_header != NULL)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
|
||||
if (psf->write_current > psf->sf.frames)
|
||||
|
@ -1640,7 +1756,7 @@ sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t len)
|
|||
} /* sf_write_short */
|
||||
|
||||
sf_count_t
|
||||
sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames)
|
||||
sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
sf_count_t count ;
|
||||
|
||||
|
@ -1670,7 +1786,7 @@ sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames)
|
|||
|
||||
psf->last_op = SFM_WRITE ;
|
||||
|
||||
if (psf->auto_header)
|
||||
if (psf->auto_header && psf->write_header != NULL)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
|
||||
if (psf->write_current > psf->sf.frames)
|
||||
|
@ -1683,7 +1799,7 @@ sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames)
|
|||
*/
|
||||
|
||||
sf_count_t
|
||||
sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t len)
|
||||
sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
sf_count_t count ;
|
||||
|
||||
|
@ -1718,7 +1834,7 @@ sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t len)
|
|||
|
||||
psf->last_op = SFM_WRITE ;
|
||||
|
||||
if (psf->auto_header)
|
||||
if (psf->auto_header && psf->write_header != NULL)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
|
||||
if (psf->write_current > psf->sf.frames)
|
||||
|
@ -1728,7 +1844,7 @@ sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t len)
|
|||
} /* sf_write_int */
|
||||
|
||||
sf_count_t
|
||||
sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames)
|
||||
sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
sf_count_t count ;
|
||||
|
||||
|
@ -1758,7 +1874,7 @@ sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames)
|
|||
|
||||
psf->last_op = SFM_WRITE ;
|
||||
|
||||
if (psf->auto_header)
|
||||
if (psf->auto_header && psf->write_header != NULL)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
|
||||
if (psf->write_current > psf->sf.frames)
|
||||
|
@ -1771,7 +1887,7 @@ sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames)
|
|||
*/
|
||||
|
||||
sf_count_t
|
||||
sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t len)
|
||||
sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
sf_count_t count ;
|
||||
|
||||
|
@ -1806,7 +1922,7 @@ sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t len)
|
|||
|
||||
psf->last_op = SFM_WRITE ;
|
||||
|
||||
if (psf->auto_header)
|
||||
if (psf->auto_header && psf->write_header != NULL)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
|
||||
if (psf->write_current > psf->sf.frames)
|
||||
|
@ -1816,7 +1932,7 @@ sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t len)
|
|||
} /* sf_write_float */
|
||||
|
||||
sf_count_t
|
||||
sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames)
|
||||
sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
sf_count_t count ;
|
||||
|
||||
|
@ -1846,7 +1962,7 @@ sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames)
|
|||
|
||||
psf->last_op = SFM_WRITE ;
|
||||
|
||||
if (psf->auto_header)
|
||||
if (psf->auto_header && psf->write_header != NULL)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
|
||||
if (psf->write_current > psf->sf.frames)
|
||||
|
@ -1859,7 +1975,7 @@ sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames)
|
|||
*/
|
||||
|
||||
sf_count_t
|
||||
sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t len)
|
||||
sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
sf_count_t count ;
|
||||
|
||||
|
@ -1894,7 +2010,7 @@ sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t len)
|
|||
|
||||
psf->last_op = SFM_WRITE ;
|
||||
|
||||
if (psf->auto_header)
|
||||
if (psf->auto_header && psf->write_header != NULL)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
|
||||
if (psf->write_current > psf->sf.frames)
|
||||
|
@ -1904,7 +2020,7 @@ sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t len)
|
|||
} /* sf_write_double */
|
||||
|
||||
sf_count_t
|
||||
sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames)
|
||||
sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
sf_count_t count ;
|
||||
|
||||
|
@ -1934,7 +2050,7 @@ sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames)
|
|||
|
||||
psf->last_op = SFM_WRITE ;
|
||||
|
||||
if (psf->auto_header)
|
||||
if (psf->auto_header && psf->write_header != NULL)
|
||||
psf->write_header (psf, SF_TRUE) ;
|
||||
|
||||
if (psf->write_current > psf->sf.frames)
|
||||
|
@ -1960,14 +2076,14 @@ try_resource_fork (SF_PRIVATE * psf, int mode)
|
|||
} /* try_resource_fork */
|
||||
|
||||
static int
|
||||
format_from_extension (const char *filename)
|
||||
format_from_extension (SF_PRIVATE *psf)
|
||||
{ char *cptr ;
|
||||
char buffer [16] ;
|
||||
|
||||
if (filename == NULL)
|
||||
if (psf->filename == NULL)
|
||||
return 0 ;
|
||||
|
||||
if ((cptr = strrchr (filename, '.')) == NULL)
|
||||
if ((cptr = strrchr (psf->filename, '.')) == NULL)
|
||||
return 0 ;
|
||||
|
||||
cptr ++ ;
|
||||
|
@ -1987,19 +2103,34 @@ format_from_extension (const char *filename)
|
|||
cptr = buffer ;
|
||||
|
||||
if (strcmp (cptr, "au") == 0)
|
||||
return SF_FORMAT_AU | SF_FORMAT_ULAW ;
|
||||
{ psf->sf.channels = 1 ;
|
||||
psf->sf.samplerate = 8000 ;
|
||||
return SF_FORMAT_RAW | SF_FORMAT_ULAW ;
|
||||
} ;
|
||||
|
||||
if (strcmp (cptr, "snd") == 0)
|
||||
return SF_FORMAT_AU | SF_FORMAT_ULAW ;
|
||||
{ psf->sf.channels = 1 ;
|
||||
psf->sf.samplerate = 8000 ;
|
||||
return SF_FORMAT_RAW | SF_FORMAT_ULAW ;
|
||||
} ;
|
||||
|
||||
if (strcmp (cptr, "vox") == 0)
|
||||
{ psf->sf.channels = 1 ;
|
||||
psf->sf.samplerate = 8000 ;
|
||||
return SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
|
||||
} ;
|
||||
|
||||
if (strcmp (cptr, "gsm") == 0)
|
||||
{ psf->sf.channels = 1 ;
|
||||
psf->sf.samplerate = 8000 ;
|
||||
return SF_FORMAT_RAW | SF_FORMAT_GSM610 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
} /* format_from_extension */
|
||||
|
||||
static int
|
||||
guess_file_type (SF_PRIVATE *psf, const char *filename)
|
||||
guess_file_type (SF_PRIVATE *psf)
|
||||
{ int buffer [3], format ;
|
||||
|
||||
if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
|
||||
|
@ -2007,7 +2138,8 @@ guess_file_type (SF_PRIVATE *psf, const char *filename)
|
|||
return 0 ;
|
||||
} ;
|
||||
|
||||
if (buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
|
||||
if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
|
||||
&& buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
|
||||
return SF_FORMAT_WAV ;
|
||||
|
||||
if (buffer [0] == MAKE_MARKER ('F', 'O', 'R', 'M'))
|
||||
|
@ -2055,6 +2187,9 @@ guess_file_type (SF_PRIVATE *psf, const char *filename)
|
|||
buffer [2] == MAKE_MARKER (' ', 'I', 'n', 's'))
|
||||
return SF_FORMAT_XI ;
|
||||
|
||||
if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
|
||||
return SF_FORMAT_CAF ;
|
||||
|
||||
if (ENABLE_EXPERIMENTAL_CODE && buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
|
||||
return SF_FORMAT_OGG ;
|
||||
|
||||
|
@ -2083,7 +2218,7 @@ guess_file_type (SF_PRIVATE *psf, const char *filename)
|
|||
return SF_FORMAT_HTK ;
|
||||
|
||||
if (buffer [0] == MAKE_MARKER ('f', 'L', 'a', 'C'))
|
||||
return 0 /*-SF_FORMAT_FLAC-*/ ;
|
||||
return SF_FORMAT_FLAC ;
|
||||
|
||||
/* Turtle Beach SMP 16-bit */
|
||||
if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A'))
|
||||
|
@ -2102,12 +2237,7 @@ guess_file_type (SF_PRIVATE *psf, const char *filename)
|
|||
if (psf->filelength > 0 && (format = try_resource_fork (psf, SFM_READ)) != 0)
|
||||
return format ;
|
||||
|
||||
/* This must be the last one. */
|
||||
if ((format = format_from_extension (filename)) != 0)
|
||||
return format ;
|
||||
|
||||
/* Default to header-less RAW PCM file type. */
|
||||
return SF_FORMAT_RAW ;
|
||||
return 0 ;
|
||||
} /* guess_file_type */
|
||||
|
||||
|
||||
|
@ -2154,19 +2284,25 @@ save_header_info (SF_PRIVATE *psf)
|
|||
|
||||
static void
|
||||
copy_filename (SF_PRIVATE *psf, const char *path)
|
||||
{ const char *cptr ;
|
||||
{ const char *ccptr ;
|
||||
char *cptr ;
|
||||
|
||||
LSF_SNPRINTF (psf->filepath, sizeof (psf->filepath), "%s", path) ;
|
||||
|
||||
if ((cptr = strrchr (path, '/')) || (cptr = strrchr (path, '\\')))
|
||||
cptr ++ ;
|
||||
if ((ccptr = strrchr (path, '/')) || (ccptr = strrchr (path, '\\')))
|
||||
ccptr ++ ;
|
||||
else
|
||||
cptr = path ;
|
||||
ccptr = path ;
|
||||
|
||||
memset (psf->filename, 0, sizeof (psf->filename)) ;
|
||||
LSF_SNPRINTF (psf->filename, sizeof (psf->filename), "%s", ccptr) ;
|
||||
|
||||
LSF_SNPRINTF (psf->filename, sizeof (psf->filename), "%s", cptr) ;
|
||||
/* Now grab the directory. */
|
||||
LSF_SNPRINTF (psf->directory, sizeof (psf->directory), "%s", path) ;
|
||||
if ((cptr = strrchr (psf->directory, '/')) || (cptr = strrchr (psf->directory, '\\')))
|
||||
cptr [1] = 0 ;
|
||||
else
|
||||
psf->directory [0] = 0 ;
|
||||
|
||||
return ;
|
||||
} /* copy_filename */
|
||||
|
||||
/*==============================================================================
|
||||
|
@ -2174,15 +2310,15 @@ copy_filename (SF_PRIVATE *psf, const char *path)
|
|||
|
||||
static int
|
||||
psf_close (SF_PRIVATE *psf)
|
||||
{ int error ;
|
||||
{ int error ;
|
||||
|
||||
if (psf->close)
|
||||
error = psf->close (psf) ;
|
||||
if (psf->codec_close)
|
||||
error = psf->codec_close (psf) ;
|
||||
if (psf->container_close)
|
||||
error = psf->container_close (psf) ;
|
||||
|
||||
psf_fclose (psf) ;
|
||||
|
||||
if (psf->rsrcdes >= 0)
|
||||
psf_close_rsrc (psf) ;
|
||||
psf_close_rsrc (psf) ;
|
||||
|
||||
if (psf->fdata)
|
||||
free (psf->fdata) ;
|
||||
|
@ -2193,8 +2329,14 @@ psf_close (SF_PRIVATE *psf)
|
|||
if (psf->dither)
|
||||
free (psf->dither) ;
|
||||
|
||||
if (psf->pchunk)
|
||||
free (psf->pchunk) ;
|
||||
if (psf->peak_info)
|
||||
free (psf->peak_info) ;
|
||||
|
||||
if (psf->loop_info)
|
||||
free (psf->loop_info) ;
|
||||
|
||||
if (psf->instrument)
|
||||
free (psf->instrument) ;
|
||||
|
||||
if (psf->format_desc)
|
||||
{ memset (psf->format_desc, 0, strlen (psf->format_desc)) ;
|
||||
|
@ -2301,7 +2443,10 @@ psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo)
|
|||
}
|
||||
else if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RAW)
|
||||
{ /* If type RAW has not been specified then need to figure out file type. */
|
||||
psf->sf.format = guess_file_type (psf, psf->filename) ;
|
||||
psf->sf.format = guess_file_type (psf) ;
|
||||
|
||||
if (psf->sf.format == 0)
|
||||
psf->sf.format = format_from_extension (psf) ;
|
||||
} ;
|
||||
|
||||
/* Prevent unnecessary seeks */
|
||||
|
@ -2351,10 +2496,6 @@ psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo)
|
|||
error = au_open (psf) ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_AU | SF_FORMAT_ULAW :
|
||||
error = au_nh_open (psf) ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_RAW :
|
||||
error = raw_open (psf) ;
|
||||
break ;
|
||||
|
@ -2436,6 +2577,14 @@ psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo)
|
|||
error = avr_open (psf) ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_FLAC :
|
||||
error = flac_open (psf) ;
|
||||
break ;
|
||||
|
||||
case SF_FORMAT_CAF :
|
||||
error = caf_open (psf) ;
|
||||
break ;
|
||||
|
||||
/* Lite remove end */
|
||||
|
||||
default :
|
||||
|
@ -2443,7 +2592,13 @@ psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo)
|
|||
} ;
|
||||
|
||||
if (error)
|
||||
{ if (error != SF_ERR_SYSTEM && error != SF_ERR_UNSUPPORTED_ENCODING)
|
||||
{ psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
|
||||
error = SF_ERR_MALFORMED_FILE ;
|
||||
} ;
|
||||
|
||||
return error ;
|
||||
} ;
|
||||
|
||||
/* For now, check whether embedding is supported. */
|
||||
format = psf->sf.format & SF_FORMAT_TYPEMASK ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -52,7 +52,7 @@ extern "C" {
|
|||
|
||||
enum
|
||||
{ /* Major formats. */
|
||||
SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian). */
|
||||
SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian default). */
|
||||
SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */
|
||||
SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */
|
||||
SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */
|
||||
|
@ -71,6 +71,8 @@ enum
|
|||
SF_FORMAT_AVR = 0x120000, /* Audio Visual Research */
|
||||
SF_FORMAT_WAVEX = 0x130000, /* MS WAVE with WAVEFORMATEX */
|
||||
SF_FORMAT_SD2 = 0x160000, /* Sound Designer 2 */
|
||||
SF_FORMAT_FLAC = 0x170000, /* FLAC lossless file format */
|
||||
SF_FORMAT_CAF = 0x180000, /* Core Audio File format */
|
||||
|
||||
/* Subtypes from here on. */
|
||||
|
||||
|
@ -104,7 +106,6 @@ enum
|
|||
SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */
|
||||
SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */
|
||||
|
||||
|
||||
/* Endian-ness options. */
|
||||
|
||||
SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */
|
||||
|
@ -230,7 +231,9 @@ enum
|
|||
enum
|
||||
{ SF_ERR_NO_ERROR = 0,
|
||||
SF_ERR_UNRECOGNISED_FORMAT = 1,
|
||||
SF_ERR_SYSTEM = 2
|
||||
SF_ERR_SYSTEM = 2,
|
||||
SF_ERR_MALFORMED_FILE = 3,
|
||||
SF_ERR_UNSUPPORTED_ENCODING = 4
|
||||
} ;
|
||||
|
||||
/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
|
||||
|
@ -309,32 +312,43 @@ typedef struct
|
|||
sf_count_t length ;
|
||||
} SF_EMBED_FILE_INFO ;
|
||||
|
||||
/* Struct used to retrieve music sample information from a file.
|
||||
/*
|
||||
** Structs used to retrieve music sample information from a file.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ /*
|
||||
** The loop mode field in SF_INSTRUMENT will be one of the following.
|
||||
*/
|
||||
SF_LOOP_NONE = 800,
|
||||
SF_LOOP_FORWARD,
|
||||
SF_LOOP_BACKWARD,
|
||||
SF_LOOP_ALTERNATING
|
||||
} ;
|
||||
|
||||
typedef struct
|
||||
{ int basenote ;
|
||||
int gain ;
|
||||
int sustain_mode ;
|
||||
int sustain_start, sustain_end ;
|
||||
int release_mode ;
|
||||
int release_start, reslease_end ;
|
||||
{ int gain ;
|
||||
char basenote, detune ;
|
||||
char velocity_lo, velocity_hi ;
|
||||
char key_lo, key_hi ;
|
||||
int loop_count ;
|
||||
|
||||
struct
|
||||
{ int mode ;
|
||||
unsigned int start ;
|
||||
unsigned int end ;
|
||||
unsigned int count ;
|
||||
} loops [16] ; /* make variable in a sensible way */
|
||||
} SF_INSTRUMENT ;
|
||||
|
||||
/* sustain_mode and release_mode will be one of the following. */
|
||||
|
||||
enum
|
||||
{ SF_LOOP_NONE = 800,
|
||||
SF_LOOP_FORWARD,
|
||||
SF_LOOP_BACKWARD
|
||||
} ;
|
||||
|
||||
/* Struct used to retrieve loop information from a file.*/
|
||||
typedef struct
|
||||
{
|
||||
short time_sig_num ; /* any positive integer >0 */
|
||||
short time_sig_den ; /* any positive power of 2 >0 */
|
||||
int loop_mode ; /* see SF_LOOP enum */
|
||||
short time_sig_num ; /* any positive integer > 0 */
|
||||
short time_sig_den ; /* any positive power of 2 > 0 */
|
||||
int loop_mode ; /* see SF_LOOP enum */
|
||||
|
||||
int num_beats ; /* this is NOT the amount of quarter notes !!!*/
|
||||
/* a full bar of 4/4 is 4 beats */
|
||||
|
@ -348,6 +362,22 @@ typedef struct
|
|||
int future [6] ;
|
||||
} SF_LOOP_INFO ;
|
||||
|
||||
typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_tell) (void *user_data) ;
|
||||
|
||||
struct SF_VIRTUAL_IO
|
||||
{ sf_vio_get_filelen get_filelen ;
|
||||
sf_vio_seek seek ;
|
||||
sf_vio_read read ;
|
||||
sf_vio_write write ;
|
||||
sf_vio_tell tell ;
|
||||
} ;
|
||||
|
||||
typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ;
|
||||
|
||||
/* Open the specified file for read, write or both. On error, this will
|
||||
** return a NULL pointer. To find the error number, pass a NULL SNDFILE
|
||||
** to sf_perror () or sf_error_str ().
|
||||
|
@ -370,6 +400,8 @@ SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ;
|
|||
|
||||
SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
|
||||
|
||||
SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ;
|
||||
|
||||
/* sf_error () returns a error number which can be translated to a text
|
||||
** string using sf_error_number().
|
||||
*/
|
||||
|
@ -436,7 +468,7 @@ const char* sf_get_string (SNDFILE *sndfile, int str_type) ;
|
|||
*/
|
||||
|
||||
sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
|
||||
sf_count_t sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
|
||||
sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ;
|
||||
|
||||
/* Functions for reading and writing the data chunk in terms of frames.
|
||||
** The number of items actually read/written = frames * number of channels.
|
||||
|
@ -449,16 +481,16 @@ sf_count_t sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
|
|||
*/
|
||||
|
||||
sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ;
|
||||
|
||||
/* Functions for reading and writing the data chunk in terms of items.
|
||||
** Otherwise similar to above.
|
||||
|
@ -466,16 +498,16 @@ sf_count_t sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
|
|||
*/
|
||||
|
||||
sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ;
|
||||
|
||||
/* Close the SNDFILE and clean up all memory allocations associated with this
|
||||
** file.
|
||||
|
@ -484,6 +516,13 @@ sf_count_t sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
|
|||
|
||||
int sf_close (SNDFILE *sndfile) ;
|
||||
|
||||
/* If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file
|
||||
** to force the writing of data to disk. If the file is opened SFM_READ
|
||||
** no action is taken.
|
||||
*/
|
||||
|
||||
void sf_write_sync (SNDFILE *sndfile) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
|
||||
#define STRINGS_DEBUG 0
|
||||
|
@ -84,9 +85,9 @@ psf_store_string (SF_PRIVATE *psf, int str_type, const char *str)
|
|||
|
||||
|
||||
#if STRINGS_DEBUG
|
||||
psf_log_printf (psf, "str_storage : %X\n", (int) psf->str_storage) ;
|
||||
psf_log_printf (psf, "str_end : %X\n", (int) psf->str_end) ;
|
||||
psf_log_printf (psf, "sizeof (storage) : %d\n", SIGNED_SIZEOF (psf->str_storage)) ;
|
||||
psf_log_printf (psf, "str_storage : %X\n", (int) psf->str_storage) ;
|
||||
psf_log_printf (psf, "str_end : %X\n", (int) psf->str_end) ;
|
||||
psf_log_printf (psf, "sizeof (str_storage) : %d\n", SIGNED_SIZEOF (psf->str_storage)) ;
|
||||
#endif
|
||||
|
||||
len_remaining = SIGNED_SIZEOF (psf->str_storage) - (psf->str_end - psf->str_storage) ;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -80,7 +80,7 @@ static int svx_read_header (SF_PRIVATE *psf) ;
|
|||
|
||||
int
|
||||
svx_open (SF_PRIVATE *psf)
|
||||
{ int error, subformat ;
|
||||
{ int error ;
|
||||
|
||||
if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0))
|
||||
{ if ((error = svx_read_header (psf)))
|
||||
|
@ -95,8 +95,6 @@ svx_open (SF_PRIVATE *psf)
|
|||
psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
|
||||
} ;
|
||||
|
||||
subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
|
||||
|
||||
if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR)
|
||||
{ if (psf->is_pipe)
|
||||
return SFE_NO_PIPE_WRITE ;
|
||||
|
@ -118,7 +116,7 @@ svx_open (SF_PRIVATE *psf)
|
|||
psf->write_header = svx_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = svx_close ;
|
||||
psf->container_close = svx_close ;
|
||||
|
||||
if ((error = pcm_init (psf)))
|
||||
return error ;
|
||||
|
@ -136,9 +134,10 @@ svx_read_header (SF_PRIVATE *psf)
|
|||
int filetype = 0, parsestage = 0, done = 0 ;
|
||||
int bytecount = 0, channels ;
|
||||
|
||||
memset (&vhdr, 0, sizeof (vhdr)) ;
|
||||
psf_binheader_readf (psf, "p", 0) ;
|
||||
|
||||
/* Set default number of channels. */
|
||||
/* Set default number of channels. Currently can't handle stereo SVX files. */
|
||||
psf->sf.channels = 1 ;
|
||||
|
||||
psf->sf.format = SF_FORMAT_SVX ;
|
||||
|
@ -279,8 +278,9 @@ svx_read_header (SF_PRIVATE *psf)
|
|||
psf_log_printf (psf, " %M : %d\n", marker, dword) ;
|
||||
|
||||
bytecount += psf_binheader_readf (psf, "E4", &channels) ;
|
||||
psf->sf.channels = channels ;
|
||||
|
||||
psf_log_printf (psf, " Channels : %d => %d\n", channels) ;
|
||||
psf_log_printf (psf, " Channels : %d\n", channels) ;
|
||||
|
||||
psf_binheader_readf (psf, "j", dword - bytecount) ;
|
||||
break ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2002-2005 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
|
||||
|
@ -16,12 +16,12 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -76,15 +76,15 @@ test_endswap_short (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) == 0)
|
||||
{ printf ("\n\nLine %d : test 1 : these two array should not be the same:\n\n", __LINE__) ;
|
||||
dump_short_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_short_array ("first", first, ARRAY_LEN (first));
|
||||
dump_short_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_short_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (memcmp (orig, second, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 2 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_short_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_short_array ("second", second, ARRAY_LEN (second));
|
||||
dump_short_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_short_array ("second", second, ARRAY_LEN (second)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -92,8 +92,8 @@ test_endswap_short (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 3 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_short_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_short_array ("first", first, ARRAY_LEN (first));
|
||||
dump_short_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_short_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -102,8 +102,8 @@ test_endswap_short (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 4 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_short_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_short_array ("first", first, ARRAY_LEN (first));
|
||||
dump_short_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_short_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -135,15 +135,15 @@ test_endswap_int (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) == 0)
|
||||
{ printf ("\n\nLine %d : test 1 : these two array should not be the same:\n\n", __LINE__) ;
|
||||
dump_int_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_int_array ("first", first, ARRAY_LEN (first));
|
||||
dump_int_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_int_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (memcmp (orig, second, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 2 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_int_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_int_array ("second", second, ARRAY_LEN (second));
|
||||
dump_int_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_int_array ("second", second, ARRAY_LEN (second)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -151,8 +151,8 @@ test_endswap_int (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 3 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_int_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_int_array ("first", first, ARRAY_LEN (first));
|
||||
dump_int_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_int_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -161,8 +161,8 @@ test_endswap_int (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 4 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_int_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_int_array ("first", first, ARRAY_LEN (first));
|
||||
dump_int_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_int_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -194,15 +194,15 @@ test_endswap_int64_t (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) == 0)
|
||||
{ printf ("\n\nLine %d : test 1 : these two array should not be the same:\n\n", __LINE__) ;
|
||||
dump_int64_t_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_int64_t_array ("first", first, ARRAY_LEN (first));
|
||||
dump_int64_t_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_int64_t_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (memcmp (orig, second, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 2 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_int64_t_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_int64_t_array ("second", second, ARRAY_LEN (second));
|
||||
dump_int64_t_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_int64_t_array ("second", second, ARRAY_LEN (second)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -210,8 +210,8 @@ test_endswap_int64_t (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 3 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_int64_t_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_int64_t_array ("first", first, ARRAY_LEN (first));
|
||||
dump_int64_t_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_int64_t_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -220,8 +220,8 @@ test_endswap_int64_t (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 4 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_int64_t_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_int64_t_array ("first", first, ARRAY_LEN (first));
|
||||
dump_int64_t_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_int64_t_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[+ AutoGen5 template c +]
|
||||
/*
|
||||
** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2002-2005 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
|
||||
|
@ -17,12 +17,12 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -78,15 +78,15 @@ test_endswap_[+ (get "name") +] (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) == 0)
|
||||
{ printf ("\n\nLine %d : test 1 : these two array should not be the same:\n\n", __LINE__) ;
|
||||
dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_[+ (get "name") +]_array ("first", first, ARRAY_LEN (first));
|
||||
dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_[+ (get "name") +]_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
if (memcmp (orig, second, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 2 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_[+ (get "name") +]_array ("second", second, ARRAY_LEN (second));
|
||||
dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_[+ (get "name") +]_array ("second", second, ARRAY_LEN (second)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -94,8 +94,8 @@ test_endswap_[+ (get "name") +] (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 3 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_[+ (get "name") +]_array ("first", first, ARRAY_LEN (first));
|
||||
dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_[+ (get "name") +]_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
@ -104,8 +104,8 @@ test_endswap_[+ (get "name") +] (void)
|
|||
|
||||
if (memcmp (orig, first, sizeof (orig)) != 0)
|
||||
{ printf ("\n\nLine %d : test 4 : these two array should be the same:\n\n", __LINE__) ;
|
||||
dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig));
|
||||
dump_[+ (get "name") +]_array ("first", first, ARRAY_LEN (first));
|
||||
dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig)) ;
|
||||
dump_[+ (get "name") +]_array ("first", first, ARRAY_LEN (first)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
@ -360,8 +360,8 @@ static void
|
|||
test_close_or_die (SF_PRIVATE *psf, int linenum)
|
||||
{
|
||||
psf_fclose (psf) ;
|
||||
if (psf->filedes >= 0)
|
||||
{ printf ("\n\nLine %d: psf->filedes should be < 0.\n\n", linenum) ;
|
||||
if (psf_file_valid (psf))
|
||||
{ printf ("\n\nLine %d: psf->filedes should not be valid.\n\n", linenum) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2003-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
/*
|
||||
** This is a bit rough, but it is the nicest way to do it.
|
||||
|
|
|
@ -23,13 +23,14 @@
|
|||
** and trial and error experimentation. The code here however is all original.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -25,10 +25,10 @@ static sf_count_t ulaw_read_ulaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t ulaw_read_ulaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t ulaw_read_ulaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t ulaw_write_s2ulaw (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t ulaw_write_i2ulaw (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t ulaw_write_f2ulaw (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t ulaw_write_d2ulaw (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t ulaw_write_s2ulaw (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t ulaw_write_i2ulaw (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t ulaw_write_f2ulaw (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t ulaw_write_d2ulaw (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
int
|
||||
ulaw_init (SF_PRIVATE *psf)
|
||||
|
@ -806,13 +806,13 @@ ulaw2f_array (unsigned char *buffer, int count, float *ptr, float normfact)
|
|||
} /* ulaw2f_array */
|
||||
|
||||
static inline void
|
||||
ulaw2d_array (unsigned char *buffer, int count, double *ptr, double normfact)
|
||||
ulaw2d_array (const unsigned char *buffer, int count, double *ptr, double normfact)
|
||||
{ while (--count >= 0)
|
||||
ptr [count] = normfact * ulaw_decode [(int) buffer [count]] ;
|
||||
} /* ulaw2d_array */
|
||||
|
||||
static inline void
|
||||
s2ulaw_array (short *ptr, int count, unsigned char *buffer)
|
||||
s2ulaw_array (const short *ptr, int count, unsigned char *buffer)
|
||||
{ while (--count >= 0)
|
||||
{ if (ptr [count] >= 0)
|
||||
buffer [count] = ulaw_encode [ptr [count] / 4] ;
|
||||
|
@ -822,7 +822,7 @@ s2ulaw_array (short *ptr, int count, unsigned char *buffer)
|
|||
} /* s2ulaw_array */
|
||||
|
||||
static inline void
|
||||
i2ulaw_array (int *ptr, int count, unsigned char *buffer)
|
||||
i2ulaw_array (const int *ptr, int count, unsigned char *buffer)
|
||||
{ while (--count >= 0)
|
||||
{ if (ptr [count] >= 0)
|
||||
buffer [count] = ulaw_encode [ptr [count] >> (16 + 2)] ;
|
||||
|
@ -832,7 +832,7 @@ i2ulaw_array (int *ptr, int count, unsigned char *buffer)
|
|||
} /* i2ulaw_array */
|
||||
|
||||
static inline void
|
||||
f2ulaw_array (float *ptr, int count, unsigned char *buffer, float normfact)
|
||||
f2ulaw_array (const float *ptr, int count, unsigned char *buffer, float normfact)
|
||||
{ while (--count >= 0)
|
||||
{ if (ptr [count] >= 0)
|
||||
buffer [count] = ulaw_encode [lrintf (normfact * ptr [count])] ;
|
||||
|
@ -842,7 +842,7 @@ f2ulaw_array (float *ptr, int count, unsigned char *buffer, float normfact)
|
|||
} /* f2ulaw_array */
|
||||
|
||||
static inline void
|
||||
d2ulaw_array (double *ptr, int count, unsigned char *buffer, double normfact)
|
||||
d2ulaw_array (const double *ptr, int count, unsigned char *buffer, double normfact)
|
||||
{ while (--count >= 0)
|
||||
{ if (ptr [count] >= 0)
|
||||
buffer [count] = ulaw_encode [lrint (normfact * ptr [count])] ;
|
||||
|
@ -947,7 +947,7 @@ ulaw_read_ulaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static sf_count_t
|
||||
ulaw_write_s2ulaw (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
ulaw_write_s2ulaw (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -968,7 +968,7 @@ ulaw_write_s2ulaw (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* ulaw_write_s2ulaw */
|
||||
|
||||
static sf_count_t
|
||||
ulaw_write_i2ulaw (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
ulaw_write_i2ulaw (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
||||
|
@ -989,7 +989,7 @@ ulaw_write_i2ulaw (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* ulaw_write_i2ulaw */
|
||||
|
||||
static sf_count_t
|
||||
ulaw_write_f2ulaw (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
ulaw_write_f2ulaw (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
float normfact ;
|
||||
|
@ -1014,7 +1014,7 @@ ulaw_write_f2ulaw (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* ulaw_write_f2ulaw */
|
||||
|
||||
static sf_count_t
|
||||
ulaw_write_d2ulaw (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
ulaw_write_d2ulaw (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
double normfact ;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
** Utterly woeful.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -128,7 +128,7 @@ voc_open (SF_PRIVATE *psf)
|
|||
|
||||
psf->blockwidth = psf->bytewidth * psf->sf.channels ;
|
||||
|
||||
psf->close = voc_close ;
|
||||
psf->container_close = voc_close ;
|
||||
|
||||
switch (subformat)
|
||||
{ case SF_FORMAT_PCM_U8 :
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2002-2005 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
|
||||
|
@ -29,12 +29,13 @@
|
|||
** http://ibiblio.org/pub/linux/apps/sound/convert/vox.tar.gz
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "float_cast.h"
|
||||
#include "common.h"
|
||||
|
@ -63,13 +64,12 @@ static sf_count_t vox_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t vox_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t vox_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t vox_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t vox_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t vox_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t vox_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t vox_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t vox_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t vox_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t vox_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static int vox_read_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len) ;
|
||||
static int vox_write_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len) ;
|
||||
|
||||
/*============================================================================================
|
||||
** Predefined OKI ADPCM encoder/decoder tables.
|
||||
|
@ -397,7 +397,7 @@ vox_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
*/
|
||||
|
||||
static int
|
||||
vox_write_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len)
|
||||
vox_write_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, const short *ptr, int len)
|
||||
{ int indx = 0, k ;
|
||||
|
||||
while (indx < len)
|
||||
|
@ -417,7 +417,7 @@ vox_write_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len)
|
|||
} /* vox_write_block */
|
||||
|
||||
static sf_count_t
|
||||
vox_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
vox_write_s (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ VOX_ADPCM_PRIVATE *pvox ;
|
||||
int writecount, count ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -441,7 +441,7 @@ vox_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* vox_write_s */
|
||||
|
||||
static sf_count_t
|
||||
vox_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
vox_write_i (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ VOX_ADPCM_PRIVATE *pvox ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -468,7 +468,7 @@ vox_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* vox_write_i */
|
||||
|
||||
static sf_count_t
|
||||
vox_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
vox_write_f (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ VOX_ADPCM_PRIVATE *pvox ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
@ -498,7 +498,7 @@ vox_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* vox_write_f */
|
||||
|
||||
static sf_count_t
|
||||
vox_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
vox_write_d (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ VOX_ADPCM_PRIVATE *pvox ;
|
||||
short *sptr ;
|
||||
int k, bufferlen, writecount, count ;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -16,13 +16,14 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
#include "wav_w64.h"
|
||||
|
@ -140,7 +141,7 @@ w64_open (SF_PRIVATE *psf)
|
|||
psf->write_header = w64_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = w64_close ;
|
||||
psf->container_close = w64_close ;
|
||||
|
||||
switch (subformat)
|
||||
{ case SF_FORMAT_PCM_U8 :
|
||||
|
@ -201,6 +202,7 @@ w64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
|
|||
int parsestage = 0, error, done = 0 ;
|
||||
|
||||
/* Set position to start of file to begin reading header. */
|
||||
memset (&wav_fmt, 0, sizeof (wav_fmt)) ;
|
||||
psf_binheader_readf (psf, "p", 0) ;
|
||||
|
||||
while (! done)
|
||||
|
@ -304,9 +306,6 @@ w64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
|
|||
|
||||
if (psf_ftell (psf) >= (psf->filelength - (2 * SIGNED_SIZEOF (dword))))
|
||||
break ;
|
||||
|
||||
if (psf->logindex >= SIGNED_SIZEOF (psf->logbuffer) - 2)
|
||||
return SFE_LOG_OVERRUN ;
|
||||
} ; /* while (1) */
|
||||
|
||||
if (! psf->dataoffset)
|
||||
|
@ -317,8 +316,6 @@ w64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock)
|
|||
if (psf_ftell (psf) != psf->dataoffset)
|
||||
psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
|
||||
|
||||
psf->close = w64_close ;
|
||||
|
||||
if (psf->blockwidth)
|
||||
{ if (psf->filelength - psf->dataoffset < psf->datalength)
|
||||
psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
|
||||
|
@ -546,7 +543,7 @@ w64_write_header (SF_PRIVATE *psf, int calc_length)
|
|||
psf_binheader_writef (psf, "z", fmt_pad) ;
|
||||
|
||||
if (add_fact_chunk)
|
||||
psf_binheader_writef (psf, "eh88", fact_MARKER16, 16 + 8 + 8, psf->sf.frames) ;
|
||||
psf_binheader_writef (psf, "eh88", fact_MARKER16, (sf_count_t) (16 + 8 + 8), psf->sf.frames) ;
|
||||
|
||||
psf_binheader_writef (psf, "eh8", data_MARKER16, psf->datalength + 24) ;
|
||||
psf_fwrite (psf->header, psf->headindex, 1, psf) ;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2004-2005 David Viens <davidv@plogue.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
|
||||
|
@ -16,21 +17,72 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
#include "wav_w64.h"
|
||||
|
||||
/* Known WAVEFORMATEXTENSIBLE GUIDS. */
|
||||
static const EXT_SUBFORMAT MSGUID_SUBTYPE_PCM =
|
||||
{ 0x00000001, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
|
||||
} ;
|
||||
|
||||
static const EXT_SUBFORMAT MSGUID_SUBTYPE_MS_ADPCM =
|
||||
{ 0x00000002, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
|
||||
} ;
|
||||
|
||||
static const EXT_SUBFORMAT MSGUID_SUBTYPE_IEEE_FLOAT =
|
||||
{ 0x00000003, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
|
||||
} ;
|
||||
|
||||
static const EXT_SUBFORMAT MSGUID_SUBTYPE_ALAW =
|
||||
{ 0x00000006, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
|
||||
} ;
|
||||
|
||||
static const EXT_SUBFORMAT MSGUID_SUBTYPE_MULAW =
|
||||
{ 0x00000007, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
|
||||
} ;
|
||||
|
||||
/*
|
||||
** the next two are from
|
||||
** http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html
|
||||
*/
|
||||
|
||||
static const EXT_SUBFORMAT MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM =
|
||||
{ 0x00000001, 0x0721, 0x11d3, { 0x86, 0x44, 0xC8, 0xC1, 0xCA, 0x00, 0x00, 0x00 }
|
||||
} ;
|
||||
|
||||
static const EXT_SUBFORMAT MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT =
|
||||
{ 0x00000003, 0x0721, 0x11d3, { 0x86, 0x44, 0xC8, 0xC1, 0xCA, 0x00, 0x00, 0x00 }
|
||||
} ;
|
||||
|
||||
|
||||
#if 0
|
||||
/* maybe interesting one day to read the following through sf_read_raw */
|
||||
/* http://www.bath.ac.uk/~masrwd/pvocex/pvocex.html */
|
||||
static const EXT_SUBFORMAT MSGUID_SUBTYPE_PVOCEX =
|
||||
{ 0x8312B9C2, 0x2E6E, 0x11d4, { 0xA8, 0x24, 0xDE, 0x5B, 0x96, 0xC3, 0xAB, 0x21 }
|
||||
} ;
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Private static functions.
|
||||
*/
|
||||
|
||||
static int
|
||||
wavex_write_guid_equal (const EXT_SUBFORMAT * first, const EXT_SUBFORMAT * second)
|
||||
{ return !memcmp (first, second, sizeof (EXT_SUBFORMAT)) ;
|
||||
} /* wavex_write_guid_equal */
|
||||
|
||||
|
||||
|
||||
int
|
||||
wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
||||
{ int bytesread, k, bytespersec = 0 ;
|
||||
|
@ -39,12 +91,12 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
|
||||
if (structsize < 16)
|
||||
return SFE_WAV_FMT_SHORT ;
|
||||
if (structsize > SIGNED_SIZEOF (WAV_FMT))
|
||||
return SFE_WAV_FMT_TOO_BIG ;
|
||||
|
||||
/* assume psf->rwf_endian is already properly set */
|
||||
|
||||
/* Read the minimal WAV file header here. */
|
||||
bytesread =
|
||||
psf_binheader_readf (psf, "e224422", &(wav_fmt->format), &(wav_fmt->min.channels),
|
||||
psf_binheader_readf (psf, "224422", &(wav_fmt->format), &(wav_fmt->min.channels),
|
||||
&(wav_fmt->min.samplerate), &(wav_fmt->min.bytespersec),
|
||||
&(wav_fmt->min.blockalign), &(wav_fmt->min.bitwidth)) ;
|
||||
|
||||
|
@ -62,12 +114,13 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
wav_fmt->min.bitwidth = 32 ;
|
||||
wav_fmt->format = WAVE_FORMAT_IEEE_FLOAT ;
|
||||
}
|
||||
else if (wav_fmt->format != WAVE_FORMAT_GSM610 && wav_fmt->min.bitwidth == 0)
|
||||
psf_log_printf (psf, " Bit Width : %d (should not be 0)\n", wav_fmt->min.bitwidth) ;
|
||||
else if (wav_fmt->format == WAVE_FORMAT_GSM610 && wav_fmt->min.bitwidth != 0)
|
||||
psf_log_printf (psf, " Bit Width : %d (should be 0)\n", wav_fmt->min.bitwidth) ;
|
||||
else
|
||||
psf_log_printf (psf, " Bit Width : %d\n", wav_fmt->min.bitwidth) ;
|
||||
|
||||
|
||||
psf->sf.samplerate = wav_fmt->min.samplerate ;
|
||||
psf->sf.frames = 0 ; /* Correct this when reading data chunk. */
|
||||
psf->sf.channels = wav_fmt->min.channels ;
|
||||
|
@ -93,7 +146,7 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
|
||||
psf->bytewidth = 1 ;
|
||||
if (structsize >= 18)
|
||||
{ bytesread += psf_binheader_readf (psf, "e2", &(wav_fmt->size20.extrabytes)) ;
|
||||
{ bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
|
||||
psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->size20.extrabytes) ;
|
||||
} ;
|
||||
break ;
|
||||
|
@ -105,7 +158,7 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
return SFE_WAV_ADPCM_CHANNELS ;
|
||||
|
||||
bytesread +=
|
||||
psf_binheader_readf (psf, "e22", &(wav_fmt->ima.extrabytes), &(wav_fmt->ima.samplesperblock)) ;
|
||||
psf_binheader_readf (psf, "22", &(wav_fmt->ima.extrabytes), &(wav_fmt->ima.samplesperblock)) ;
|
||||
|
||||
bytespersec = (wav_fmt->ima.samplerate * wav_fmt->ima.blockalign) / wav_fmt->ima.samplesperblock ;
|
||||
if (wav_fmt->ima.bytespersec != (unsigned) bytespersec)
|
||||
|
@ -125,7 +178,7 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
return SFE_WAV_ADPCM_CHANNELS ;
|
||||
|
||||
bytesread +=
|
||||
psf_binheader_readf (psf, "e222", &(wav_fmt->msadpcm.extrabytes),
|
||||
psf_binheader_readf (psf, "222", &(wav_fmt->msadpcm.extrabytes),
|
||||
&(wav_fmt->msadpcm.samplesperblock), &(wav_fmt->msadpcm.numcoeffs)) ;
|
||||
|
||||
bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / wav_fmt->msadpcm.samplesperblock ;
|
||||
|
@ -150,7 +203,7 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
psf_log_printf (psf, " Index Coeffs1 Coeffs2\n") ;
|
||||
for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++)
|
||||
{ bytesread +=
|
||||
psf_binheader_readf (psf, "e22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
|
||||
psf_binheader_readf (psf, "22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
|
||||
LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), " %2d %7d %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
|
||||
psf_log_printf (psf, psf->u.cbuf) ;
|
||||
} ;
|
||||
|
@ -161,7 +214,7 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
return SFE_WAV_GSM610_FORMAT ;
|
||||
|
||||
bytesread +=
|
||||
psf_binheader_readf (psf, "e22", &(wav_fmt->gsm610.extrabytes), &(wav_fmt->gsm610.samplesperblock)) ;
|
||||
psf_binheader_readf (psf, "22", &(wav_fmt->gsm610.extrabytes), &(wav_fmt->gsm610.samplesperblock)) ;
|
||||
|
||||
if (wav_fmt->gsm610.samplesperblock != 320)
|
||||
return SFE_WAV_GSM610_FORMAT ;
|
||||
|
@ -184,17 +237,17 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->ext.bytespersec) ;
|
||||
|
||||
bytesread +=
|
||||
psf_binheader_readf (psf, "e224", &(wav_fmt->ext.extrabytes), &(wav_fmt->ext.validbits),
|
||||
psf_binheader_readf (psf, "224", &(wav_fmt->ext.extrabytes), &(wav_fmt->ext.validbits),
|
||||
&(wav_fmt->ext.channelmask)) ;
|
||||
|
||||
psf_log_printf (psf, " Valid Bits : %d\n", wav_fmt->ext.validbits) ;
|
||||
psf_log_printf (psf, " Channel Mask : 0x%X\n", wav_fmt->ext.channelmask) ;
|
||||
|
||||
bytesread +=
|
||||
psf_binheader_readf (psf, "e422", &(wav_fmt->ext.esf.esf_field1), &(wav_fmt->ext.esf.esf_field2),
|
||||
psf_binheader_readf (psf, "422", &(wav_fmt->ext.esf.esf_field1), &(wav_fmt->ext.esf.esf_field2),
|
||||
&(wav_fmt->ext.esf.esf_field3)) ;
|
||||
|
||||
/* compare the esf_fields with each known GUID? and print?*/
|
||||
/* compare the esf_fields with each known GUID? and print? */
|
||||
psf_log_printf (psf, " Subformat\n") ;
|
||||
psf_log_printf (psf, " esf_field1 : 0x%X\n", wav_fmt->ext.esf.esf_field1) ;
|
||||
psf_log_printf (psf, " esf_field2 : 0x%X\n", wav_fmt->ext.esf.esf_field2) ;
|
||||
|
@ -206,9 +259,55 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
} ;
|
||||
psf_log_printf (psf, "\n") ;
|
||||
psf->bytewidth = BITWIDTH2BYTES (wav_fmt->ext.bitwidth) ;
|
||||
|
||||
/* Compare GUIDs for known ones. */
|
||||
if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_PCM)
|
||||
|| wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
|
||||
{ psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
|
||||
psf_log_printf (psf, " format : pcm\n") ;
|
||||
}
|
||||
else if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MS_ADPCM))
|
||||
{ psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM) ;
|
||||
psf_log_printf (psf, " format : ms adpcm\n") ;
|
||||
}
|
||||
else if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_IEEE_FLOAT)
|
||||
|| wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
|
||||
{ psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
|
||||
psf_log_printf (psf, " format : IEEE float\n") ;
|
||||
}
|
||||
else if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_ALAW))
|
||||
{ psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ALAW) ;
|
||||
psf_log_printf (psf, " format : A-law\n") ;
|
||||
}
|
||||
else if (wavex_write_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MULAW))
|
||||
{ psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ULAW) ;
|
||||
psf_log_printf (psf, " format : u-law\n") ;
|
||||
}
|
||||
else
|
||||
return SFE_UNIMPLEMENTED ;
|
||||
break ;
|
||||
|
||||
default : break ;
|
||||
case WAVE_FORMAT_G721_ADPCM :
|
||||
psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->g72x.bytespersec) ;
|
||||
if (structsize >= 20)
|
||||
{ bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->g72x.extrabytes), &(wav_fmt->g72x.auxblocksize)) ;
|
||||
if (wav_fmt->g72x.extrabytes == 0)
|
||||
psf_log_printf (psf, " Extra Bytes : %d (should be 2)\n", wav_fmt->g72x.extrabytes) ;
|
||||
else
|
||||
psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->g72x.extrabytes) ;
|
||||
psf_log_printf (psf, " Aux Blk Size : %d\n", wav_fmt->g72x.auxblocksize) ;
|
||||
}
|
||||
else if (structsize == 18)
|
||||
{ bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->g72x.extrabytes)) ;
|
||||
psf_log_printf (psf, " Extra Bytes : %d%s\n", wav_fmt->g72x.extrabytes, wav_fmt->g72x.extrabytes != 0 ? " (should be 0)" : "") ;
|
||||
}
|
||||
else
|
||||
psf_log_printf (psf, "*** 'fmt ' chunk should be bigger than this!\n") ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
psf_log_printf (psf, "*** No 'fmt ' chunk dumper for this format!\n") ;
|
||||
break ;
|
||||
} ;
|
||||
|
||||
if (bytesread > structsize)
|
||||
|
@ -223,6 +322,15 @@ wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize)
|
|||
return 0 ;
|
||||
} /* wav_w64_read_fmt_chunk */
|
||||
|
||||
void
|
||||
wavex_write_guid (SF_PRIVATE *psf, const EXT_SUBFORMAT * subformat)
|
||||
{
|
||||
psf_binheader_writef (psf, "422b", subformat->esf_field1,
|
||||
subformat->esf_field2, subformat->esf_field3,
|
||||
subformat->esf_field4, 8) ;
|
||||
} /* wavex_write_guid */
|
||||
|
||||
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 1999-2005 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
|
||||
|
@ -265,12 +265,13 @@ typedef struct
|
|||
void msadpcm_write_adapt_coeffs (SF_PRIVATE *psf) ;
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
** Functions defined in wav_gsm610.c
|
||||
** Functions defined in wav_w64.c
|
||||
*/
|
||||
|
||||
int wav_w64_srate2blocksize (int srate_chan_product) ;
|
||||
char const* wav_w64_format_str (int k) ;
|
||||
int wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize) ;
|
||||
void wavex_write_guid (SF_PRIVATE *psf, const EXT_SUBFORMAT * subformat) ;
|
||||
|
||||
#endif
|
||||
/*
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sndfile.h"
|
||||
#include "config.h"
|
||||
#include "sfendian.h"
|
||||
#include "common.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2003,2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
** Copyright (C) 2003-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -16,7 +16,7 @@
|
|||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "sfconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -105,7 +105,7 @@ xi_open (SF_PRIVATE *psf)
|
|||
psf->write_header = xi_write_header ;
|
||||
} ;
|
||||
|
||||
psf->close = xi_close ;
|
||||
psf->container_close = xi_close ;
|
||||
psf->seek = dpcm_seek ;
|
||||
|
||||
psf->sf.seekable = SF_FALSE ;
|
||||
|
@ -143,20 +143,20 @@ static sf_count_t dpcm_read_dsc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
|||
static sf_count_t dpcm_read_dsc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_read_dsc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t dpcm_write_s2dsc (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_i2dsc (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_f2dsc (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_d2dsc (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_s2dsc (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_i2dsc (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_f2dsc (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_d2dsc (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t dpcm_read_dles2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_read_dles2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_read_dles2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_read_dles2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
|
||||
static sf_count_t dpcm_write_s2dles (SF_PRIVATE *psf, short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_i2dles (SF_PRIVATE *psf, int *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_f2dles (SF_PRIVATE *psf, float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_d2dles (SF_PRIVATE *psf, double *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_s2dles (SF_PRIVATE *psf, const short *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_i2dles (SF_PRIVATE *psf, const int *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_f2dles (SF_PRIVATE *psf, const float *ptr, sf_count_t len) ;
|
||||
static sf_count_t dpcm_write_d2dles (SF_PRIVATE *psf, const double *ptr, sf_count_t len) ;
|
||||
|
||||
static int
|
||||
dpcm_init (SF_PRIVATE *psf)
|
||||
|
@ -226,7 +226,7 @@ dpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
if (psf->datalength < 0 || psf->dataoffset < 0)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (offset == 0)
|
||||
|
@ -237,13 +237,13 @@ dpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset)
|
|||
|
||||
if (offset < 0 || offset > psf->sf.frames)
|
||||
{ psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
if (mode != SFM_READ)
|
||||
{ /* What to do about write??? */
|
||||
psf->error = SFE_BAD_SEEK ;
|
||||
return ((sf_count_t) -1) ;
|
||||
return PSF_SEEK_ERROR ;
|
||||
} ;
|
||||
|
||||
psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
|
||||
|
@ -303,11 +303,10 @@ xi_write_header (SF_PRIVATE *psf, int calc_length)
|
|||
/* Jump volume loop (3 bytes), pan loop (3), envelope flags (3), vibrato (3)
|
||||
** fade out (2), 22 unknown bytes, and then write sample_count (2 bytes).
|
||||
*/
|
||||
psf_binheader_writef (psf, "ez2z2", (size_t) (4 * 3), 0x1234, (size_t) 22, 1) ;
|
||||
psf_binheader_writef (psf, "ez2z2", (size_t) (4 * 3), 0x1234, make_size_t (22), 1) ;
|
||||
|
||||
psf->sf.frames = 12 ;
|
||||
pxi->loop_begin = 0 ;
|
||||
pxi->loop_end = 0 ;
|
||||
pxi->loop_begin = 0 ;
|
||||
pxi->loop_end = 0 ;
|
||||
|
||||
psf_binheader_writef (psf, "et844", psf->sf.frames, pxi->loop_begin, pxi->loop_end) ;
|
||||
|
||||
|
@ -389,6 +388,9 @@ xi_read_header (SF_PRIVATE *psf)
|
|||
if (sample_count > MAX_XI_SAMPLES)
|
||||
return SFE_XI_EXCESS_SAMPLES ;
|
||||
|
||||
if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
|
||||
return SFE_MALLOC_FAILED ;
|
||||
|
||||
/* Log all data for each sample. */
|
||||
for (k = 0 ; k < sample_count ; k++)
|
||||
{ psf_binheader_readf (psf, "e444", &(sample_sizes [k]), &loop_begin, &loop_end) ;
|
||||
|
@ -397,7 +399,12 @@ xi_read_header (SF_PRIVATE *psf)
|
|||
psf_binheader_readf (psf, "bb", buffer, 6, name, 22) ;
|
||||
name [21] = 0 ;
|
||||
|
||||
psf_log_printf (psf, "Sample #%d\n name : %s\n size : %d\n", k + 1, name, sample_sizes [k]) ;
|
||||
psf_log_printf (psf, "Sample #%d\n name : %s\n", k + 1, name) ;
|
||||
|
||||
psf_log_printf (psf, " size : %d\n", sample_sizes [k]) ;
|
||||
|
||||
|
||||
|
||||
psf_log_printf (psf, " loop\n begin : %d\n end : %d\n", loop_begin, loop_end) ;
|
||||
|
||||
psf_log_printf (psf, " volume : %u\n f. tune : %d\n flags : 0x%02X ",
|
||||
|
@ -453,8 +460,6 @@ xi_read_header (SF_PRIVATE *psf)
|
|||
if (psf_fseek (psf, psf->dataoffset, SEEK_SET) != psf->dataoffset)
|
||||
return SFE_BAD_SEEK ;
|
||||
|
||||
psf->close = xi_close ;
|
||||
|
||||
psf->endian = SF_ENDIAN_LITTLE ;
|
||||
psf->sf.channels = 1 ; /* Always mono */
|
||||
psf->sf.samplerate = 44100 ; /* Always */
|
||||
|
@ -464,6 +469,11 @@ xi_read_header (SF_PRIVATE *psf)
|
|||
if (! psf->sf.frames && psf->blockwidth)
|
||||
psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
|
||||
|
||||
psf->instrument->basenote = 0 ;
|
||||
psf->instrument->gain = 1 ;
|
||||
psf->instrument->velocity_lo = psf->instrument->key_lo = 0 ;
|
||||
psf->instrument->velocity_hi = psf->instrument->key_hi = 127 ;
|
||||
|
||||
return 0 ;
|
||||
} /* xi_read_header */
|
||||
|
||||
|
@ -698,19 +708,19 @@ dpcm_read_dles2d (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
/*==============================================================================
|
||||
*/
|
||||
|
||||
static void s2dsc_array (XI_PRIVATE *pxi, short *src, signed char *dest, int count) ;
|
||||
static void i2dsc_array (XI_PRIVATE *pxi, int *src, signed char *dest, int count) ;
|
||||
static void f2dsc_array (XI_PRIVATE *pxi, float *src, signed char *dest, int count, float normfact) ;
|
||||
static void d2dsc_array (XI_PRIVATE *pxi, double *src, signed char *dest, int count, double normfact) ;
|
||||
static void s2dsc_array (XI_PRIVATE *pxi, const short *src, signed char *dest, int count) ;
|
||||
static void i2dsc_array (XI_PRIVATE *pxi, const int *src, signed char *dest, int count) ;
|
||||
static void f2dsc_array (XI_PRIVATE *pxi, const float *src, signed char *dest, int count, float normfact) ;
|
||||
static void d2dsc_array (XI_PRIVATE *pxi, const double *src, signed char *dest, int count, double normfact) ;
|
||||
|
||||
static void s2dles_array (XI_PRIVATE *pxi, short *src, short *dest, int count) ;
|
||||
static void i2dles_array (XI_PRIVATE *pxi, int *src, short *dest, int count) ;
|
||||
static void f2dles_array (XI_PRIVATE *pxi, float *src, short *dest, int count, float normfact) ;
|
||||
static void d2dles_array (XI_PRIVATE *pxi, double *src, short *dest, int count, double normfact) ;
|
||||
static void s2dles_array (XI_PRIVATE *pxi, const short *src, short *dest, int count) ;
|
||||
static void i2dles_array (XI_PRIVATE *pxi, const int *src, short *dest, int count) ;
|
||||
static void f2dles_array (XI_PRIVATE *pxi, const float *src, short *dest, int count, float normfact) ;
|
||||
static void d2dles_array (XI_PRIVATE *pxi, const double *src, short *dest, int count, double normfact) ;
|
||||
|
||||
|
||||
static sf_count_t
|
||||
dpcm_write_s2dsc (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
dpcm_write_s2dsc (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ XI_PRIVATE *pxi ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -735,7 +745,7 @@ dpcm_write_s2dsc (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* dpcm_write_s2dsc */
|
||||
|
||||
static sf_count_t
|
||||
dpcm_write_i2dsc (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
dpcm_write_i2dsc (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ XI_PRIVATE *pxi ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -760,7 +770,7 @@ dpcm_write_i2dsc (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* dpcm_write_i2dsc */
|
||||
|
||||
static sf_count_t
|
||||
dpcm_write_f2dsc (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
dpcm_write_f2dsc (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ XI_PRIVATE *pxi ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -788,7 +798,7 @@ dpcm_write_f2dsc (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* dpcm_write_f2dsc */
|
||||
|
||||
static sf_count_t
|
||||
dpcm_write_d2dsc (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
dpcm_write_d2dsc (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ XI_PRIVATE *pxi ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -817,7 +827,7 @@ dpcm_write_d2dsc (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
|||
|
||||
|
||||
static sf_count_t
|
||||
dpcm_write_s2dles (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
||||
dpcm_write_s2dles (SF_PRIVATE *psf, const short *ptr, sf_count_t len)
|
||||
{ XI_PRIVATE *pxi ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -842,7 +852,7 @@ dpcm_write_s2dles (SF_PRIVATE *psf, short *ptr, sf_count_t len)
|
|||
} /* dpcm_write_s2dles */
|
||||
|
||||
static sf_count_t
|
||||
dpcm_write_i2dles (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
||||
dpcm_write_i2dles (SF_PRIVATE *psf, const int *ptr, sf_count_t len)
|
||||
{ XI_PRIVATE *pxi ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -867,7 +877,7 @@ dpcm_write_i2dles (SF_PRIVATE *psf, int *ptr, sf_count_t len)
|
|||
} /* dpcm_write_i2dles */
|
||||
|
||||
static sf_count_t
|
||||
dpcm_write_f2dles (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
||||
dpcm_write_f2dles (SF_PRIVATE *psf, const float *ptr, sf_count_t len)
|
||||
{ XI_PRIVATE *pxi ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -895,7 +905,7 @@ dpcm_write_f2dles (SF_PRIVATE *psf, float *ptr, sf_count_t len)
|
|||
} /* dpcm_write_f2dles */
|
||||
|
||||
static sf_count_t
|
||||
dpcm_write_d2dles (SF_PRIVATE *psf, double *ptr, sf_count_t len)
|
||||
dpcm_write_d2dles (SF_PRIVATE *psf, const double *ptr, sf_count_t len)
|
||||
{ XI_PRIVATE *pxi ;
|
||||
int bufferlen, writecount ;
|
||||
sf_count_t total = 0 ;
|
||||
|
@ -990,7 +1000,7 @@ dsc2d_array (XI_PRIVATE *pxi, signed char *src, int count, double *dest, double
|
|||
*/
|
||||
|
||||
static void
|
||||
s2dsc_array (XI_PRIVATE *pxi, short *src, signed char *dest, int count)
|
||||
s2dsc_array (XI_PRIVATE *pxi, const short *src, signed char *dest, int count)
|
||||
{ signed char last_val, current ;
|
||||
int k ;
|
||||
|
||||
|
@ -1006,7 +1016,7 @@ s2dsc_array (XI_PRIVATE *pxi, short *src, signed char *dest, int count)
|
|||
} /* s2dsc_array */
|
||||
|
||||
static void
|
||||
i2dsc_array (XI_PRIVATE *pxi, int *src, signed char *dest, int count)
|
||||
i2dsc_array (XI_PRIVATE *pxi, const int *src, signed char *dest, int count)
|
||||
{ signed char last_val, current ;
|
||||
int k ;
|
||||
|
||||
|
@ -1022,7 +1032,7 @@ i2dsc_array (XI_PRIVATE *pxi, int *src, signed char *dest, int count)
|
|||
} /* i2dsc_array */
|
||||
|
||||
static void
|
||||
f2dsc_array (XI_PRIVATE *pxi, float *src, signed char *dest, int count, float normfact)
|
||||
f2dsc_array (XI_PRIVATE *pxi, const float *src, signed char *dest, int count, float normfact)
|
||||
{ signed char last_val, current ;
|
||||
int k ;
|
||||
|
||||
|
@ -1038,7 +1048,7 @@ f2dsc_array (XI_PRIVATE *pxi, float *src, signed char *dest, int count, float no
|
|||
} /* f2dsc_array */
|
||||
|
||||
static void
|
||||
d2dsc_array (XI_PRIVATE *pxi, double *src, signed char *dest, int count, double normfact)
|
||||
d2dsc_array (XI_PRIVATE *pxi, const double *src, signed char *dest, int count, double normfact)
|
||||
{ signed char last_val, current ;
|
||||
int k ;
|
||||
|
||||
|
@ -1120,7 +1130,7 @@ dles2d_array (XI_PRIVATE *pxi, short *src, int count, double *dest, double normf
|
|||
*/
|
||||
|
||||
static void
|
||||
s2dles_array (XI_PRIVATE *pxi, short *src, short *dest, int count)
|
||||
s2dles_array (XI_PRIVATE *pxi, const short *src, short *dest, int count)
|
||||
{ short diff, last_val ;
|
||||
int k ;
|
||||
|
||||
|
@ -1136,7 +1146,7 @@ s2dles_array (XI_PRIVATE *pxi, short *src, short *dest, int count)
|
|||
} /* s2dles_array */
|
||||
|
||||
static void
|
||||
i2dles_array (XI_PRIVATE *pxi, int *src, short *dest, int count)
|
||||
i2dles_array (XI_PRIVATE *pxi, const int *src, short *dest, int count)
|
||||
{ short diff, last_val ;
|
||||
int k ;
|
||||
|
||||
|
@ -1152,7 +1162,7 @@ i2dles_array (XI_PRIVATE *pxi, int *src, short *dest, int count)
|
|||
} /* i2dles_array */
|
||||
|
||||
static void
|
||||
f2dles_array (XI_PRIVATE *pxi, float *src, short *dest, int count, float normfact)
|
||||
f2dles_array (XI_PRIVATE *pxi, const float *src, short *dest, int count, float normfact)
|
||||
{ short diff, last_val, current ;
|
||||
int k ;
|
||||
|
||||
|
@ -1169,7 +1179,7 @@ f2dles_array (XI_PRIVATE *pxi, float *src, short *dest, int count, float normfac
|
|||
} /* f2dles_array */
|
||||
|
||||
static void
|
||||
d2dles_array (XI_PRIVATE *pxi, double *src, short *dest, int count, double normfact)
|
||||
d2dles_array (XI_PRIVATE *pxi, const double *src, short *dest, int count, double normfact)
|
||||
{ short diff, last_val, current ;
|
||||
int k ;
|
||||
|
||||
|
|
|
@ -8,82 +8,84 @@
|
|||
|
||||
/* Begin PBXBuildFile section */
|
||||
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
|
||||
8E756E5309F318170080F1EE /* aiff.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DF109F318160080F1EE /* aiff.c */; };
|
||||
8E756E5409F318170080F1EE /* alaw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DF209F318160080F1EE /* alaw.c */; };
|
||||
8E756E5509F318170080F1EE /* au_g72x.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DF309F318160080F1EE /* au_g72x.c */; };
|
||||
8E756E5609F318170080F1EE /* au.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DF409F318160080F1EE /* au.c */; };
|
||||
8E756E5709F318170080F1EE /* au.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756DF509F318160080F1EE /* au.h */; };
|
||||
8E756E5809F318170080F1EE /* avr.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DF609F318160080F1EE /* avr.c */; };
|
||||
8E756E5909F318170080F1EE /* command.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DF709F318160080F1EE /* command.c */; };
|
||||
8E756E5A09F318170080F1EE /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DF809F318160080F1EE /* common.c */; };
|
||||
8E756E5B09F318170080F1EE /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756DF909F318160080F1EE /* common.h */; };
|
||||
8E756E5C09F318170080F1EE /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756DFA09F318160080F1EE /* config.h */; };
|
||||
8E756E5E09F318170080F1EE /* dither.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DFC09F318160080F1EE /* dither.c */; };
|
||||
8E756E5F09F318170080F1EE /* double64.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DFD09F318160080F1EE /* double64.c */; };
|
||||
8E756E6009F318170080F1EE /* dwd.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DFE09F318160080F1EE /* dwd.c */; };
|
||||
8E756E6109F318170080F1EE /* dwvw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756DFF09F318160080F1EE /* dwvw.c */; };
|
||||
8E756E6209F318170080F1EE /* file_io.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E0009F318160080F1EE /* file_io.c */; };
|
||||
8E756E6309F318170080F1EE /* float_cast.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E0109F318160080F1EE /* float_cast.h */; };
|
||||
8E756E6409F318170080F1EE /* float32.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E0209F318160080F1EE /* float32.c */; };
|
||||
8E756E6609F318170080F1EE /* g721.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E0509F318160080F1EE /* g721.c */; };
|
||||
8E756E6709F318170080F1EE /* g723_16.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E0609F318160080F1EE /* g723_16.c */; };
|
||||
8E756E6809F318170080F1EE /* g723_24.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E0709F318160080F1EE /* g723_24.c */; };
|
||||
8E756E6909F318170080F1EE /* g723_40.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E0809F318160080F1EE /* g723_40.c */; };
|
||||
8E756E6A09F318170080F1EE /* g72x.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E0909F318160080F1EE /* g72x.c */; };
|
||||
8E756E6B09F318170080F1EE /* g72x.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E0A09F318160080F1EE /* g72x.h */; };
|
||||
8E756E6C09F318170080F1EE /* g72x_priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E0B09F318160080F1EE /* g72x_priv.h */; };
|
||||
8E756E7209F318170080F1EE /* add.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E1209F318160080F1EE /* add.c */; };
|
||||
8E756E7409F318170080F1EE /* code.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E1409F318160080F1EE /* code.c */; };
|
||||
8E756E7509F318170080F1EE /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E1509F318160080F1EE /* config.h */; };
|
||||
8E756E7709F318170080F1EE /* decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E1709F318160080F1EE /* decode.c */; };
|
||||
8E756E7809F318170080F1EE /* gsm.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E1809F318160080F1EE /* gsm.h */; };
|
||||
8E756E7909F318170080F1EE /* gsm610_priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E1909F318160080F1EE /* gsm610_priv.h */; };
|
||||
8E756E7A09F318170080F1EE /* gsm_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E1A09F318160080F1EE /* gsm_create.c */; };
|
||||
8E756E7B09F318170080F1EE /* gsm_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E1B09F318160080F1EE /* gsm_decode.c */; };
|
||||
8E756E7C09F318170080F1EE /* gsm_destroy.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E1C09F318160080F1EE /* gsm_destroy.c */; };
|
||||
8E756E7D09F318170080F1EE /* gsm_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E1D09F318160080F1EE /* gsm_encode.c */; };
|
||||
8E756E7E09F318170080F1EE /* gsm_option.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E1E09F318160080F1EE /* gsm_option.c */; };
|
||||
8E756E7F09F318170080F1EE /* long_term.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E1F09F318160080F1EE /* long_term.c */; };
|
||||
8E756E8009F318170080F1EE /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2009F318160080F1EE /* lpc.c */; };
|
||||
8E756E8309F318170080F1EE /* preprocess.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2309F318160080F1EE /* preprocess.c */; };
|
||||
8E756E8509F318170080F1EE /* rpe.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2509F318160080F1EE /* rpe.c */; };
|
||||
8E756E8609F318170080F1EE /* short_term.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2609F318160080F1EE /* short_term.c */; };
|
||||
8E756E8709F318170080F1EE /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2709F318160080F1EE /* table.c */; };
|
||||
8E756E8809F318170080F1EE /* gsm610.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2809F318160080F1EE /* gsm610.c */; };
|
||||
8E756E8909F318170080F1EE /* htk.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2909F318160080F1EE /* htk.c */; };
|
||||
8E756E8A09F318170080F1EE /* ima_adpcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2A09F318160080F1EE /* ima_adpcm.c */; };
|
||||
8E756E8B09F318170080F1EE /* interleave.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2B09F318160080F1EE /* interleave.c */; };
|
||||
8E756E8C09F318170080F1EE /* ircam.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2C09F318160080F1EE /* ircam.c */; };
|
||||
8E756E8E09F318170080F1EE /* macbinary3.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2E09F318160080F1EE /* macbinary3.c */; };
|
||||
8E756E8F09F318170080F1EE /* macos.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E2F09F318160080F1EE /* macos.c */; };
|
||||
8E756E9009F318170080F1EE /* mat4.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3009F318160080F1EE /* mat4.c */; };
|
||||
8E756E9109F318170080F1EE /* mat5.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3109F318160080F1EE /* mat5.c */; };
|
||||
8E756E9209F318170080F1EE /* ms_adpcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3209F318160080F1EE /* ms_adpcm.c */; };
|
||||
8E756E9309F318170080F1EE /* nist.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3309F318160080F1EE /* nist.c */; };
|
||||
8E756E9409F318170080F1EE /* ogg.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3409F318160080F1EE /* ogg.c */; };
|
||||
8E756E9509F318170080F1EE /* paf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3509F318160080F1EE /* paf.c */; };
|
||||
8E756E9609F318170080F1EE /* pcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3609F318160080F1EE /* pcm.c */; };
|
||||
8E756E9709F318170080F1EE /* pvf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3709F318160080F1EE /* pvf.c */; };
|
||||
8E756E9809F318170080F1EE /* raw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3809F318160080F1EE /* raw.c */; };
|
||||
8E756E9909F318170080F1EE /* rx2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3909F318160080F1EE /* rx2.c */; };
|
||||
8E756E9A09F318170080F1EE /* sd2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3A09F318160080F1EE /* sd2.c */; };
|
||||
8E756E9B09F318170080F1EE /* sds.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3B09F318160080F1EE /* sds.c */; };
|
||||
8E756E9C09F318170080F1EE /* sf_unistd.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E3C09F318160080F1EE /* sf_unistd.h */; };
|
||||
8E756E9D09F318170080F1EE /* sfendian.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E3D09F318160080F1EE /* sfendian.h */; };
|
||||
8E756E9E09F318170080F1EE /* sndfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E3E09F318160080F1EE /* sndfile.c */; };
|
||||
8E756E9F09F318170080F1EE /* sndfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E3F09F318160080F1EE /* sndfile.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
8E756EA009F318170080F1EE /* strings.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E4009F318160080F1EE /* strings.c */; };
|
||||
8E756EA109F318170080F1EE /* svx.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E4109F318160080F1EE /* svx.c */; };
|
||||
8E756EA909F318170080F1EE /* txw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E4909F318170080F1EE /* txw.c */; };
|
||||
8E756EAA09F318170080F1EE /* ulaw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E4A09F318170080F1EE /* ulaw.c */; };
|
||||
8E756EAB09F318170080F1EE /* voc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E4B09F318170080F1EE /* voc.c */; };
|
||||
8E756EAC09F318170080F1EE /* vox_adpcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E4C09F318170080F1EE /* vox_adpcm.c */; };
|
||||
8E756EAD09F318170080F1EE /* w64.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E4D09F318170080F1EE /* w64.c */; };
|
||||
8E756EAE09F318170080F1EE /* wav_w64.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E4E09F318170080F1EE /* wav_w64.c */; };
|
||||
8E756EAF09F318170080F1EE /* wav_w64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E756E4F09F318170080F1EE /* wav_w64.h */; };
|
||||
8E756EB009F318170080F1EE /* wav.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E5009F318170080F1EE /* wav.c */; };
|
||||
8E756EB109F318170080F1EE /* wve.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E5109F318170080F1EE /* wve.c */; };
|
||||
8E756EB209F318170080F1EE /* xi.c in Sources */ = {isa = PBXBuildFile; fileRef = 8E756E5209F318170080F1EE /* xi.c */; };
|
||||
8EF6C98509FB14730045E26A /* aiff.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C91A09FB14720045E26A /* aiff.c */; };
|
||||
8EF6C98609FB14730045E26A /* alaw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C91B09FB14720045E26A /* alaw.c */; };
|
||||
8EF6C98809FB14730045E26A /* au.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C91D09FB14720045E26A /* au.c */; };
|
||||
8EF6C98A09FB14730045E26A /* avr.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C91F09FB14720045E26A /* avr.c */; };
|
||||
8EF6C98B09FB14730045E26A /* caf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92009FB14720045E26A /* caf.c */; };
|
||||
8EF6C98C09FB14730045E26A /* command.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92109FB14720045E26A /* command.c */; };
|
||||
8EF6C98D09FB14730045E26A /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92209FB14720045E26A /* common.c */; };
|
||||
8EF6C98E09FB14730045E26A /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C92309FB14720045E26A /* common.h */; };
|
||||
8EF6C98F09FB14730045E26A /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C92409FB14720045E26A /* config.h */; };
|
||||
8EF6C99309FB14730045E26A /* dither.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92809FB14720045E26A /* dither.c */; };
|
||||
8EF6C99409FB14730045E26A /* double64.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92909FB14720045E26A /* double64.c */; };
|
||||
8EF6C99509FB14730045E26A /* dwd.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92A09FB14720045E26A /* dwd.c */; };
|
||||
8EF6C99609FB14730045E26A /* dwvw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92B09FB14720045E26A /* dwvw.c */; };
|
||||
8EF6C99709FB14730045E26A /* file_io.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92C09FB14720045E26A /* file_io.c */; };
|
||||
8EF6C99809FB14730045E26A /* flac.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92D09FB14720045E26A /* flac.c */; };
|
||||
8EF6C99909FB14730045E26A /* float_cast.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C92E09FB14720045E26A /* float_cast.h */; };
|
||||
8EF6C99A09FB14730045E26A /* float32.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C92F09FB14720045E26A /* float32.c */; };
|
||||
8EF6C99C09FB14730045E26A /* g721.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C93209FB14720045E26A /* g721.c */; };
|
||||
8EF6C99D09FB14730045E26A /* g723_16.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C93309FB14720045E26A /* g723_16.c */; };
|
||||
8EF6C99E09FB14730045E26A /* g723_24.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C93409FB14720045E26A /* g723_24.c */; };
|
||||
8EF6C99F09FB14730045E26A /* g723_40.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C93509FB14720045E26A /* g723_40.c */; };
|
||||
8EF6C9A009FB14730045E26A /* g72x.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C93609FB14720045E26A /* g72x.c */; };
|
||||
8EF6C9A109FB14730045E26A /* g72x.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C93709FB14720045E26A /* g72x.h */; };
|
||||
8EF6C9A209FB14730045E26A /* g72x_priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C93809FB14720045E26A /* g72x_priv.h */; };
|
||||
8EF6C9A809FB14730045E26A /* g72x.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C93E09FB14720045E26A /* g72x.c */; };
|
||||
8EF6C9A909FB14730045E26A /* add.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94009FB14720045E26A /* add.c */; };
|
||||
8EF6C9AB09FB14730045E26A /* code.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94209FB14720045E26A /* code.c */; };
|
||||
8EF6C9AC09FB14730045E26A /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C94309FB14720045E26A /* config.h */; };
|
||||
8EF6C9AE09FB14730045E26A /* decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94509FB14720045E26A /* decode.c */; };
|
||||
8EF6C9AF09FB14730045E26A /* gsm.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C94609FB14730045E26A /* gsm.h */; };
|
||||
8EF6C9B009FB14730045E26A /* gsm610_priv.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C94709FB14730045E26A /* gsm610_priv.h */; };
|
||||
8EF6C9B109FB14730045E26A /* gsm_create.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94809FB14730045E26A /* gsm_create.c */; };
|
||||
8EF6C9B209FB14730045E26A /* gsm_decode.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94909FB14730045E26A /* gsm_decode.c */; };
|
||||
8EF6C9B309FB14730045E26A /* gsm_destroy.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94A09FB14730045E26A /* gsm_destroy.c */; };
|
||||
8EF6C9B409FB14730045E26A /* gsm_encode.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94B09FB14730045E26A /* gsm_encode.c */; };
|
||||
8EF6C9B509FB14730045E26A /* gsm_option.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94C09FB14730045E26A /* gsm_option.c */; };
|
||||
8EF6C9B609FB14730045E26A /* long_term.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94D09FB14730045E26A /* long_term.c */; };
|
||||
8EF6C9B709FB14730045E26A /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C94E09FB14730045E26A /* lpc.c */; };
|
||||
8EF6C9BA09FB14730045E26A /* preprocess.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95109FB14730045E26A /* preprocess.c */; };
|
||||
8EF6C9BC09FB14730045E26A /* rpe.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95309FB14730045E26A /* rpe.c */; };
|
||||
8EF6C9BD09FB14730045E26A /* short_term.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95409FB14730045E26A /* short_term.c */; };
|
||||
8EF6C9BE09FB14730045E26A /* table.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95509FB14730045E26A /* table.c */; };
|
||||
8EF6C9BF09FB14730045E26A /* gsm610.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95609FB14730045E26A /* gsm610.c */; };
|
||||
8EF6C9C009FB14730045E26A /* htk.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95709FB14730045E26A /* htk.c */; };
|
||||
8EF6C9C109FB14730045E26A /* ima_adpcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95809FB14730045E26A /* ima_adpcm.c */; };
|
||||
8EF6C9C209FB14730045E26A /* interleave.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95909FB14730045E26A /* interleave.c */; };
|
||||
8EF6C9C309FB14730045E26A /* ircam.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95A09FB14730045E26A /* ircam.c */; };
|
||||
8EF6C9C509FB14730045E26A /* macbinary3.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95C09FB14730045E26A /* macbinary3.c */; };
|
||||
8EF6C9C609FB14730045E26A /* macos.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C95D09FB14730045E26A /* macos.c */; };
|
||||
8EF6C9C909FB14730045E26A /* mat4.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96009FB14730045E26A /* mat4.c */; };
|
||||
8EF6C9CA09FB14730045E26A /* mat5.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96109FB14730045E26A /* mat5.c */; };
|
||||
8EF6C9CB09FB14730045E26A /* ms_adpcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96209FB14730045E26A /* ms_adpcm.c */; };
|
||||
8EF6C9CC09FB14730045E26A /* nist.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96309FB14730045E26A /* nist.c */; };
|
||||
8EF6C9CD09FB14730045E26A /* ogg.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96409FB14730045E26A /* ogg.c */; };
|
||||
8EF6C9CE09FB14730045E26A /* paf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96509FB14730045E26A /* paf.c */; };
|
||||
8EF6C9CF09FB14730045E26A /* pcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96609FB14730045E26A /* pcm.c */; };
|
||||
8EF6C9D009FB14730045E26A /* pvf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96709FB14730045E26A /* pvf.c */; };
|
||||
8EF6C9D109FB14730045E26A /* raw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96809FB14730045E26A /* raw.c */; };
|
||||
8EF6C9D209FB14730045E26A /* rx2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96909FB14730045E26A /* rx2.c */; };
|
||||
8EF6C9D309FB14730045E26A /* sd2.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96A09FB14730045E26A /* sd2.c */; };
|
||||
8EF6C9D409FB14730045E26A /* sds.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96B09FB14730045E26A /* sds.c */; };
|
||||
8EF6C9D509FB14730045E26A /* sf_unistd.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C96C09FB14730045E26A /* sf_unistd.h */; };
|
||||
8EF6C9D609FB14730045E26A /* sfconfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C96D09FB14730045E26A /* sfconfig.h */; };
|
||||
8EF6C9D709FB14730045E26A /* sfendian.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C96E09FB14730045E26A /* sfendian.h */; };
|
||||
8EF6C9D809FB14730045E26A /* sndfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C96F09FB14730045E26A /* sndfile.c */; };
|
||||
8EF6C9D909FB14730045E26A /* sndfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C97009FB14730045E26A /* sndfile.h */; };
|
||||
8EF6C9DB09FB14730045E26A /* strings.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C97209FB14730045E26A /* strings.c */; };
|
||||
8EF6C9DC09FB14730045E26A /* svx.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C97309FB14730045E26A /* svx.c */; };
|
||||
8EF6C9E409FB14730045E26A /* txw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C97B09FB14730045E26A /* txw.c */; };
|
||||
8EF6C9E509FB14730045E26A /* ulaw.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C97C09FB14730045E26A /* ulaw.c */; };
|
||||
8EF6C9E609FB14730045E26A /* voc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C97D09FB14730045E26A /* voc.c */; };
|
||||
8EF6C9E709FB14730045E26A /* vox_adpcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C97E09FB14730045E26A /* vox_adpcm.c */; };
|
||||
8EF6C9E809FB14730045E26A /* w64.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C97F09FB14730045E26A /* w64.c */; };
|
||||
8EF6C9E909FB14730045E26A /* wav_w64.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C98009FB14730045E26A /* wav_w64.c */; };
|
||||
8EF6C9EA09FB14730045E26A /* wav_w64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EF6C98109FB14730045E26A /* wav_w64.h */; };
|
||||
8EF6C9EB09FB14730045E26A /* wav.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C98209FB14730045E26A /* wav.c */; };
|
||||
8EF6C9EC09FB14730045E26A /* wve.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C98309FB14730045E26A /* wve.c */; };
|
||||
8EF6C9ED09FB14730045E26A /* xi.c in Sources */ = {isa = PBXBuildFile; fileRef = 8EF6C98409FB14730045E26A /* xi.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXBuildStyle section */
|
||||
|
@ -105,86 +107,84 @@
|
|||
089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
8DC2EF5B0486A6940098B216 /* SndFile.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SndFile.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8E756DF109F318160080F1EE /* aiff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = aiff.c; path = Files/src/aiff.c; sourceTree = "<group>"; };
|
||||
8E756DF209F318160080F1EE /* alaw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = alaw.c; path = Files/src/alaw.c; sourceTree = "<group>"; };
|
||||
8E756DF309F318160080F1EE /* au_g72x.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = au_g72x.c; path = Files/src/au_g72x.c; sourceTree = "<group>"; };
|
||||
8E756DF409F318160080F1EE /* au.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = au.c; path = Files/src/au.c; sourceTree = "<group>"; };
|
||||
8E756DF509F318160080F1EE /* au.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = au.h; path = Files/src/au.h; sourceTree = "<group>"; };
|
||||
8E756DF609F318160080F1EE /* avr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = avr.c; path = Files/src/avr.c; sourceTree = "<group>"; };
|
||||
8E756DF709F318160080F1EE /* command.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = command.c; path = Files/src/command.c; sourceTree = "<group>"; };
|
||||
8E756DF809F318160080F1EE /* common.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = common.c; path = Files/src/common.c; sourceTree = "<group>"; };
|
||||
8E756DF909F318160080F1EE /* common.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = common.h; path = Files/src/common.h; sourceTree = "<group>"; };
|
||||
8E756DFA09F318160080F1EE /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config.h; path = Files/src/config.h; sourceTree = "<group>"; };
|
||||
8E756DFC09F318160080F1EE /* dither.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dither.c; path = Files/src/dither.c; sourceTree = "<group>"; };
|
||||
8E756DFD09F318160080F1EE /* double64.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = double64.c; path = Files/src/double64.c; sourceTree = "<group>"; };
|
||||
8E756DFE09F318160080F1EE /* dwd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dwd.c; path = Files/src/dwd.c; sourceTree = "<group>"; };
|
||||
8E756DFF09F318160080F1EE /* dwvw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dwvw.c; path = Files/src/dwvw.c; sourceTree = "<group>"; };
|
||||
8E756E0009F318160080F1EE /* file_io.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = file_io.c; path = Files/src/file_io.c; sourceTree = "<group>"; };
|
||||
8E756E0109F318160080F1EE /* float_cast.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = float_cast.h; path = Files/src/float_cast.h; sourceTree = "<group>"; };
|
||||
8E756E0209F318160080F1EE /* float32.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = float32.c; path = Files/src/float32.c; sourceTree = "<group>"; };
|
||||
8E756E0509F318160080F1EE /* g721.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g721.c; sourceTree = "<group>"; };
|
||||
8E756E0609F318160080F1EE /* g723_16.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g723_16.c; sourceTree = "<group>"; };
|
||||
8E756E0709F318160080F1EE /* g723_24.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g723_24.c; sourceTree = "<group>"; };
|
||||
8E756E0809F318160080F1EE /* g723_40.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g723_40.c; sourceTree = "<group>"; };
|
||||
8E756E0909F318160080F1EE /* g72x.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g72x.c; sourceTree = "<group>"; };
|
||||
8E756E0A09F318160080F1EE /* g72x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = g72x.h; sourceTree = "<group>"; };
|
||||
8E756E0B09F318160080F1EE /* g72x_priv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = g72x_priv.h; sourceTree = "<group>"; };
|
||||
8E756E0C09F318160080F1EE /* g72x_test.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g72x_test.c; sourceTree = "<group>"; };
|
||||
8E756E1209F318160080F1EE /* add.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = add.c; sourceTree = "<group>"; };
|
||||
8E756E1409F318160080F1EE /* code.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = code.c; sourceTree = "<group>"; };
|
||||
8E756E1509F318160080F1EE /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
|
||||
8E756E1709F318160080F1EE /* decode.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = decode.c; sourceTree = "<group>"; };
|
||||
8E756E1809F318160080F1EE /* gsm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gsm.h; sourceTree = "<group>"; };
|
||||
8E756E1909F318160080F1EE /* gsm610_priv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gsm610_priv.h; sourceTree = "<group>"; };
|
||||
8E756E1A09F318160080F1EE /* gsm_create.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_create.c; sourceTree = "<group>"; };
|
||||
8E756E1B09F318160080F1EE /* gsm_decode.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_decode.c; sourceTree = "<group>"; };
|
||||
8E756E1C09F318160080F1EE /* gsm_destroy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_destroy.c; sourceTree = "<group>"; };
|
||||
8E756E1D09F318160080F1EE /* gsm_encode.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_encode.c; sourceTree = "<group>"; };
|
||||
8E756E1E09F318160080F1EE /* gsm_option.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_option.c; sourceTree = "<group>"; };
|
||||
8E756E1F09F318160080F1EE /* long_term.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = long_term.c; sourceTree = "<group>"; };
|
||||
8E756E2009F318160080F1EE /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = "<group>"; };
|
||||
8E756E2309F318160080F1EE /* preprocess.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = preprocess.c; sourceTree = "<group>"; };
|
||||
8E756E2509F318160080F1EE /* rpe.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = rpe.c; sourceTree = "<group>"; };
|
||||
8E756E2609F318160080F1EE /* short_term.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = short_term.c; sourceTree = "<group>"; };
|
||||
8E756E2709F318160080F1EE /* table.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = "<group>"; };
|
||||
8E756E2809F318160080F1EE /* gsm610.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = gsm610.c; path = Files/src/gsm610.c; sourceTree = "<group>"; };
|
||||
8E756E2909F318160080F1EE /* htk.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = htk.c; path = Files/src/htk.c; sourceTree = "<group>"; };
|
||||
8E756E2A09F318160080F1EE /* ima_adpcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ima_adpcm.c; path = Files/src/ima_adpcm.c; sourceTree = "<group>"; };
|
||||
8E756E2B09F318160080F1EE /* interleave.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = interleave.c; path = Files/src/interleave.c; sourceTree = "<group>"; };
|
||||
8E756E2C09F318160080F1EE /* ircam.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ircam.c; path = Files/src/ircam.c; sourceTree = "<group>"; };
|
||||
8E756E2E09F318160080F1EE /* macbinary3.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = macbinary3.c; path = Files/src/macbinary3.c; sourceTree = "<group>"; };
|
||||
8E756E2F09F318160080F1EE /* macos.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = macos.c; path = Files/src/macos.c; sourceTree = "<group>"; };
|
||||
8E756E3009F318160080F1EE /* mat4.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mat4.c; path = Files/src/mat4.c; sourceTree = "<group>"; };
|
||||
8E756E3109F318160080F1EE /* mat5.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mat5.c; path = Files/src/mat5.c; sourceTree = "<group>"; };
|
||||
8E756E3209F318160080F1EE /* ms_adpcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ms_adpcm.c; path = Files/src/ms_adpcm.c; sourceTree = "<group>"; };
|
||||
8E756E3309F318160080F1EE /* nist.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = nist.c; path = Files/src/nist.c; sourceTree = "<group>"; };
|
||||
8E756E3409F318160080F1EE /* ogg.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ogg.c; path = Files/src/ogg.c; sourceTree = "<group>"; };
|
||||
8E756E3509F318160080F1EE /* paf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = paf.c; path = Files/src/paf.c; sourceTree = "<group>"; };
|
||||
8E756E3609F318160080F1EE /* pcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pcm.c; path = Files/src/pcm.c; sourceTree = "<group>"; };
|
||||
8E756E3709F318160080F1EE /* pvf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pvf.c; path = Files/src/pvf.c; sourceTree = "<group>"; };
|
||||
8E756E3809F318160080F1EE /* raw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = raw.c; path = Files/src/raw.c; sourceTree = "<group>"; };
|
||||
8E756E3909F318160080F1EE /* rx2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = rx2.c; path = Files/src/rx2.c; sourceTree = "<group>"; };
|
||||
8E756E3A09F318160080F1EE /* sd2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sd2.c; path = Files/src/sd2.c; sourceTree = "<group>"; };
|
||||
8E756E3B09F318160080F1EE /* sds.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sds.c; path = Files/src/sds.c; sourceTree = "<group>"; };
|
||||
8E756E3C09F318160080F1EE /* sf_unistd.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sf_unistd.h; path = Files/src/sf_unistd.h; sourceTree = "<group>"; };
|
||||
8E756E3D09F318160080F1EE /* sfendian.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sfendian.h; path = Files/src/sfendian.h; sourceTree = "<group>"; };
|
||||
8E756E3E09F318160080F1EE /* sndfile.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sndfile.c; path = Files/src/sndfile.c; sourceTree = "<group>"; };
|
||||
8E756E3F09F318160080F1EE /* sndfile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sndfile.h; path = Files/src/sndfile.h; sourceTree = "<group>"; };
|
||||
8E756E4009F318160080F1EE /* strings.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = strings.c; path = Files/src/strings.c; sourceTree = "<group>"; };
|
||||
8E756E4109F318160080F1EE /* svx.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = svx.c; path = Files/src/svx.c; sourceTree = "<group>"; };
|
||||
8E756E4409F318170080F1EE /* test_endswap.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = test_endswap.c; path = Files/src/test_endswap.c; sourceTree = "<group>"; };
|
||||
8E756E4709F318170080F1EE /* test_file_io.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = test_file_io.c; path = Files/src/test_file_io.c; sourceTree = "<group>"; };
|
||||
8E756E4809F318170080F1EE /* test_log_printf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = test_log_printf.c; path = Files/src/test_log_printf.c; sourceTree = "<group>"; };
|
||||
8E756E4909F318170080F1EE /* txw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = txw.c; path = Files/src/txw.c; sourceTree = "<group>"; };
|
||||
8E756E4A09F318170080F1EE /* ulaw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ulaw.c; path = Files/src/ulaw.c; sourceTree = "<group>"; };
|
||||
8E756E4B09F318170080F1EE /* voc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = voc.c; path = Files/src/voc.c; sourceTree = "<group>"; };
|
||||
8E756E4C09F318170080F1EE /* vox_adpcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = vox_adpcm.c; path = Files/src/vox_adpcm.c; sourceTree = "<group>"; };
|
||||
8E756E4D09F318170080F1EE /* w64.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = w64.c; path = Files/src/w64.c; sourceTree = "<group>"; };
|
||||
8E756E4E09F318170080F1EE /* wav_w64.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = wav_w64.c; path = Files/src/wav_w64.c; sourceTree = "<group>"; };
|
||||
8E756E4F09F318170080F1EE /* wav_w64.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = wav_w64.h; path = Files/src/wav_w64.h; sourceTree = "<group>"; };
|
||||
8E756E5009F318170080F1EE /* wav.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = wav.c; path = Files/src/wav.c; sourceTree = "<group>"; };
|
||||
8E756E5109F318170080F1EE /* wve.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = wve.c; path = Files/src/wve.c; sourceTree = "<group>"; };
|
||||
8E756E5209F318170080F1EE /* xi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = xi.c; path = Files/src/xi.c; sourceTree = "<group>"; };
|
||||
8EF6C91A09FB14720045E26A /* aiff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = aiff.c; path = Files/src/aiff.c; sourceTree = "<group>"; };
|
||||
8EF6C91B09FB14720045E26A /* alaw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = alaw.c; path = Files/src/alaw.c; sourceTree = "<group>"; };
|
||||
8EF6C91D09FB14720045E26A /* au.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = au.c; path = Files/src/au.c; sourceTree = "<group>"; };
|
||||
8EF6C91F09FB14720045E26A /* avr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = avr.c; path = Files/src/avr.c; sourceTree = "<group>"; };
|
||||
8EF6C92009FB14720045E26A /* caf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = caf.c; path = Files/src/caf.c; sourceTree = "<group>"; };
|
||||
8EF6C92109FB14720045E26A /* command.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = command.c; path = Files/src/command.c; sourceTree = "<group>"; };
|
||||
8EF6C92209FB14720045E26A /* common.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = common.c; path = Files/src/common.c; sourceTree = "<group>"; };
|
||||
8EF6C92309FB14720045E26A /* common.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = common.h; path = Files/src/common.h; sourceTree = "<group>"; };
|
||||
8EF6C92409FB14720045E26A /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config.h; path = Files/src/config.h; sourceTree = "<group>"; };
|
||||
8EF6C92809FB14720045E26A /* dither.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dither.c; path = Files/src/dither.c; sourceTree = "<group>"; };
|
||||
8EF6C92909FB14720045E26A /* double64.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = double64.c; path = Files/src/double64.c; sourceTree = "<group>"; };
|
||||
8EF6C92A09FB14720045E26A /* dwd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dwd.c; path = Files/src/dwd.c; sourceTree = "<group>"; };
|
||||
8EF6C92B09FB14720045E26A /* dwvw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dwvw.c; path = Files/src/dwvw.c; sourceTree = "<group>"; };
|
||||
8EF6C92C09FB14720045E26A /* file_io.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = file_io.c; path = Files/src/file_io.c; sourceTree = "<group>"; };
|
||||
8EF6C92D09FB14720045E26A /* flac.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = flac.c; path = Files/src/flac.c; sourceTree = "<group>"; };
|
||||
8EF6C92E09FB14720045E26A /* float_cast.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = float_cast.h; path = Files/src/float_cast.h; sourceTree = "<group>"; };
|
||||
8EF6C92F09FB14720045E26A /* float32.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = float32.c; path = Files/src/float32.c; sourceTree = "<group>"; };
|
||||
8EF6C93209FB14720045E26A /* g721.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g721.c; sourceTree = "<group>"; };
|
||||
8EF6C93309FB14720045E26A /* g723_16.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g723_16.c; sourceTree = "<group>"; };
|
||||
8EF6C93409FB14720045E26A /* g723_24.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g723_24.c; sourceTree = "<group>"; };
|
||||
8EF6C93509FB14720045E26A /* g723_40.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g723_40.c; sourceTree = "<group>"; };
|
||||
8EF6C93609FB14720045E26A /* g72x.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = g72x.c; sourceTree = "<group>"; };
|
||||
8EF6C93709FB14720045E26A /* g72x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = g72x.h; sourceTree = "<group>"; };
|
||||
8EF6C93809FB14720045E26A /* g72x_priv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = g72x_priv.h; sourceTree = "<group>"; };
|
||||
8EF6C93E09FB14720045E26A /* g72x.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = g72x.c; path = Files/src/g72x.c; sourceTree = "<group>"; };
|
||||
8EF6C94009FB14720045E26A /* add.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = add.c; sourceTree = "<group>"; };
|
||||
8EF6C94209FB14720045E26A /* code.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = code.c; sourceTree = "<group>"; };
|
||||
8EF6C94309FB14720045E26A /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
|
||||
8EF6C94509FB14720045E26A /* decode.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = decode.c; sourceTree = "<group>"; };
|
||||
8EF6C94609FB14730045E26A /* gsm.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gsm.h; sourceTree = "<group>"; };
|
||||
8EF6C94709FB14730045E26A /* gsm610_priv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = gsm610_priv.h; sourceTree = "<group>"; };
|
||||
8EF6C94809FB14730045E26A /* gsm_create.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_create.c; sourceTree = "<group>"; };
|
||||
8EF6C94909FB14730045E26A /* gsm_decode.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_decode.c; sourceTree = "<group>"; };
|
||||
8EF6C94A09FB14730045E26A /* gsm_destroy.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_destroy.c; sourceTree = "<group>"; };
|
||||
8EF6C94B09FB14730045E26A /* gsm_encode.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_encode.c; sourceTree = "<group>"; };
|
||||
8EF6C94C09FB14730045E26A /* gsm_option.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gsm_option.c; sourceTree = "<group>"; };
|
||||
8EF6C94D09FB14730045E26A /* long_term.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = long_term.c; sourceTree = "<group>"; };
|
||||
8EF6C94E09FB14730045E26A /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = "<group>"; };
|
||||
8EF6C95109FB14730045E26A /* preprocess.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = preprocess.c; sourceTree = "<group>"; };
|
||||
8EF6C95309FB14730045E26A /* rpe.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = rpe.c; sourceTree = "<group>"; };
|
||||
8EF6C95409FB14730045E26A /* short_term.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = short_term.c; sourceTree = "<group>"; };
|
||||
8EF6C95509FB14730045E26A /* table.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = "<group>"; };
|
||||
8EF6C95609FB14730045E26A /* gsm610.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = gsm610.c; path = Files/src/gsm610.c; sourceTree = "<group>"; };
|
||||
8EF6C95709FB14730045E26A /* htk.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = htk.c; path = Files/src/htk.c; sourceTree = "<group>"; };
|
||||
8EF6C95809FB14730045E26A /* ima_adpcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ima_adpcm.c; path = Files/src/ima_adpcm.c; sourceTree = "<group>"; };
|
||||
8EF6C95909FB14730045E26A /* interleave.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = interleave.c; path = Files/src/interleave.c; sourceTree = "<group>"; };
|
||||
8EF6C95A09FB14730045E26A /* ircam.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ircam.c; path = Files/src/ircam.c; sourceTree = "<group>"; };
|
||||
8EF6C95C09FB14730045E26A /* macbinary3.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = macbinary3.c; path = Files/src/macbinary3.c; sourceTree = "<group>"; };
|
||||
8EF6C95D09FB14730045E26A /* macos.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = macos.c; path = Files/src/macos.c; sourceTree = "<group>"; };
|
||||
8EF6C96009FB14730045E26A /* mat4.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mat4.c; path = Files/src/mat4.c; sourceTree = "<group>"; };
|
||||
8EF6C96109FB14730045E26A /* mat5.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = mat5.c; path = Files/src/mat5.c; sourceTree = "<group>"; };
|
||||
8EF6C96209FB14730045E26A /* ms_adpcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ms_adpcm.c; path = Files/src/ms_adpcm.c; sourceTree = "<group>"; };
|
||||
8EF6C96309FB14730045E26A /* nist.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = nist.c; path = Files/src/nist.c; sourceTree = "<group>"; };
|
||||
8EF6C96409FB14730045E26A /* ogg.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ogg.c; path = Files/src/ogg.c; sourceTree = "<group>"; };
|
||||
8EF6C96509FB14730045E26A /* paf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = paf.c; path = Files/src/paf.c; sourceTree = "<group>"; };
|
||||
8EF6C96609FB14730045E26A /* pcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pcm.c; path = Files/src/pcm.c; sourceTree = "<group>"; };
|
||||
8EF6C96709FB14730045E26A /* pvf.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pvf.c; path = Files/src/pvf.c; sourceTree = "<group>"; };
|
||||
8EF6C96809FB14730045E26A /* raw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = raw.c; path = Files/src/raw.c; sourceTree = "<group>"; };
|
||||
8EF6C96909FB14730045E26A /* rx2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = rx2.c; path = Files/src/rx2.c; sourceTree = "<group>"; };
|
||||
8EF6C96A09FB14730045E26A /* sd2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sd2.c; path = Files/src/sd2.c; sourceTree = "<group>"; };
|
||||
8EF6C96B09FB14730045E26A /* sds.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sds.c; path = Files/src/sds.c; sourceTree = "<group>"; };
|
||||
8EF6C96C09FB14730045E26A /* sf_unistd.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sf_unistd.h; path = Files/src/sf_unistd.h; sourceTree = "<group>"; };
|
||||
8EF6C96D09FB14730045E26A /* sfconfig.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sfconfig.h; path = Files/src/sfconfig.h; sourceTree = "<group>"; };
|
||||
8EF6C96E09FB14730045E26A /* sfendian.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sfendian.h; path = Files/src/sfendian.h; sourceTree = "<group>"; };
|
||||
8EF6C96F09FB14730045E26A /* sndfile.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = sndfile.c; path = Files/src/sndfile.c; sourceTree = "<group>"; };
|
||||
8EF6C97009FB14730045E26A /* sndfile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = sndfile.h; path = Files/src/sndfile.h; sourceTree = "<group>"; };
|
||||
8EF6C97209FB14730045E26A /* strings.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = strings.c; path = Files/src/strings.c; sourceTree = "<group>"; };
|
||||
8EF6C97309FB14730045E26A /* svx.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = svx.c; path = Files/src/svx.c; sourceTree = "<group>"; };
|
||||
8EF6C97B09FB14730045E26A /* txw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = txw.c; path = Files/src/txw.c; sourceTree = "<group>"; };
|
||||
8EF6C97C09FB14730045E26A /* ulaw.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ulaw.c; path = Files/src/ulaw.c; sourceTree = "<group>"; };
|
||||
8EF6C97D09FB14730045E26A /* voc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = voc.c; path = Files/src/voc.c; sourceTree = "<group>"; };
|
||||
8EF6C97E09FB14730045E26A /* vox_adpcm.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = vox_adpcm.c; path = Files/src/vox_adpcm.c; sourceTree = "<group>"; };
|
||||
8EF6C97F09FB14730045E26A /* w64.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = w64.c; path = Files/src/w64.c; sourceTree = "<group>"; };
|
||||
8EF6C98009FB14730045E26A /* wav_w64.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = wav_w64.c; path = Files/src/wav_w64.c; sourceTree = "<group>"; };
|
||||
8EF6C98109FB14730045E26A /* wav_w64.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = wav_w64.h; path = Files/src/wav_w64.h; sourceTree = "<group>"; };
|
||||
8EF6C98209FB14730045E26A /* wav.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = wav.c; path = Files/src/wav.c; sourceTree = "<group>"; };
|
||||
8EF6C98309FB14730045E26A /* wve.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = wve.c; path = Files/src/wve.c; sourceTree = "<group>"; };
|
||||
8EF6C98409FB14730045E26A /* xi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = xi.c; path = Files/src/xi.c; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -252,103 +252,101 @@
|
|||
8E756DF009F318090080F1EE /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8E756DF109F318160080F1EE /* aiff.c */,
|
||||
8E756DF209F318160080F1EE /* alaw.c */,
|
||||
8E756DF309F318160080F1EE /* au_g72x.c */,
|
||||
8E756DF409F318160080F1EE /* au.c */,
|
||||
8E756DF509F318160080F1EE /* au.h */,
|
||||
8E756DF609F318160080F1EE /* avr.c */,
|
||||
8E756DF709F318160080F1EE /* command.c */,
|
||||
8E756DF809F318160080F1EE /* common.c */,
|
||||
8E756DF909F318160080F1EE /* common.h */,
|
||||
8E756DFA09F318160080F1EE /* config.h */,
|
||||
8E756DFC09F318160080F1EE /* dither.c */,
|
||||
8E756DFD09F318160080F1EE /* double64.c */,
|
||||
8E756DFE09F318160080F1EE /* dwd.c */,
|
||||
8E756DFF09F318160080F1EE /* dwvw.c */,
|
||||
8E756E0009F318160080F1EE /* file_io.c */,
|
||||
8E756E0109F318160080F1EE /* float_cast.h */,
|
||||
8E756E0209F318160080F1EE /* float32.c */,
|
||||
8E756E0309F318160080F1EE /* G72x */,
|
||||
8E756E1109F318160080F1EE /* GSM610 */,
|
||||
8E756E2809F318160080F1EE /* gsm610.c */,
|
||||
8E756E2909F318160080F1EE /* htk.c */,
|
||||
8E756E2A09F318160080F1EE /* ima_adpcm.c */,
|
||||
8E756E2B09F318160080F1EE /* interleave.c */,
|
||||
8E756E2C09F318160080F1EE /* ircam.c */,
|
||||
8E756E2E09F318160080F1EE /* macbinary3.c */,
|
||||
8E756E2F09F318160080F1EE /* macos.c */,
|
||||
8E756E3009F318160080F1EE /* mat4.c */,
|
||||
8E756E3109F318160080F1EE /* mat5.c */,
|
||||
8E756E3209F318160080F1EE /* ms_adpcm.c */,
|
||||
8E756E3309F318160080F1EE /* nist.c */,
|
||||
8E756E3409F318160080F1EE /* ogg.c */,
|
||||
8E756E3509F318160080F1EE /* paf.c */,
|
||||
8E756E3609F318160080F1EE /* pcm.c */,
|
||||
8E756E3709F318160080F1EE /* pvf.c */,
|
||||
8E756E3809F318160080F1EE /* raw.c */,
|
||||
8E756E3909F318160080F1EE /* rx2.c */,
|
||||
8E756E3A09F318160080F1EE /* sd2.c */,
|
||||
8E756E3B09F318160080F1EE /* sds.c */,
|
||||
8E756E3C09F318160080F1EE /* sf_unistd.h */,
|
||||
8E756E3D09F318160080F1EE /* sfendian.h */,
|
||||
8E756E3E09F318160080F1EE /* sndfile.c */,
|
||||
8E756E3F09F318160080F1EE /* sndfile.h */,
|
||||
8E756E4009F318160080F1EE /* strings.c */,
|
||||
8E756E4109F318160080F1EE /* svx.c */,
|
||||
8E756E4409F318170080F1EE /* test_endswap.c */,
|
||||
8E756E4709F318170080F1EE /* test_file_io.c */,
|
||||
8E756E4809F318170080F1EE /* test_log_printf.c */,
|
||||
8E756E4909F318170080F1EE /* txw.c */,
|
||||
8E756E4A09F318170080F1EE /* ulaw.c */,
|
||||
8E756E4B09F318170080F1EE /* voc.c */,
|
||||
8E756E4C09F318170080F1EE /* vox_adpcm.c */,
|
||||
8E756E4D09F318170080F1EE /* w64.c */,
|
||||
8E756E4E09F318170080F1EE /* wav_w64.c */,
|
||||
8E756E4F09F318170080F1EE /* wav_w64.h */,
|
||||
8E756E5009F318170080F1EE /* wav.c */,
|
||||
8E756E5109F318170080F1EE /* wve.c */,
|
||||
8E756E5209F318170080F1EE /* xi.c */,
|
||||
8EF6C91A09FB14720045E26A /* aiff.c */,
|
||||
8EF6C91B09FB14720045E26A /* alaw.c */,
|
||||
8EF6C91D09FB14720045E26A /* au.c */,
|
||||
8EF6C91F09FB14720045E26A /* avr.c */,
|
||||
8EF6C92009FB14720045E26A /* caf.c */,
|
||||
8EF6C92109FB14720045E26A /* command.c */,
|
||||
8EF6C92209FB14720045E26A /* common.c */,
|
||||
8EF6C92309FB14720045E26A /* common.h */,
|
||||
8EF6C92409FB14720045E26A /* config.h */,
|
||||
8EF6C92809FB14720045E26A /* dither.c */,
|
||||
8EF6C92909FB14720045E26A /* double64.c */,
|
||||
8EF6C92A09FB14720045E26A /* dwd.c */,
|
||||
8EF6C92B09FB14720045E26A /* dwvw.c */,
|
||||
8EF6C92C09FB14720045E26A /* file_io.c */,
|
||||
8EF6C92D09FB14720045E26A /* flac.c */,
|
||||
8EF6C92E09FB14720045E26A /* float_cast.h */,
|
||||
8EF6C92F09FB14720045E26A /* float32.c */,
|
||||
8EF6C93009FB14720045E26A /* G72x */,
|
||||
8EF6C93E09FB14720045E26A /* g72x.c */,
|
||||
8EF6C93F09FB14720045E26A /* GSM610 */,
|
||||
8EF6C95609FB14730045E26A /* gsm610.c */,
|
||||
8EF6C95709FB14730045E26A /* htk.c */,
|
||||
8EF6C95809FB14730045E26A /* ima_adpcm.c */,
|
||||
8EF6C95909FB14730045E26A /* interleave.c */,
|
||||
8EF6C95A09FB14730045E26A /* ircam.c */,
|
||||
8EF6C95C09FB14730045E26A /* macbinary3.c */,
|
||||
8EF6C95D09FB14730045E26A /* macos.c */,
|
||||
8EF6C96009FB14730045E26A /* mat4.c */,
|
||||
8EF6C96109FB14730045E26A /* mat5.c */,
|
||||
8EF6C96209FB14730045E26A /* ms_adpcm.c */,
|
||||
8EF6C96309FB14730045E26A /* nist.c */,
|
||||
8EF6C96409FB14730045E26A /* ogg.c */,
|
||||
8EF6C96509FB14730045E26A /* paf.c */,
|
||||
8EF6C96609FB14730045E26A /* pcm.c */,
|
||||
8EF6C96709FB14730045E26A /* pvf.c */,
|
||||
8EF6C96809FB14730045E26A /* raw.c */,
|
||||
8EF6C96909FB14730045E26A /* rx2.c */,
|
||||
8EF6C96A09FB14730045E26A /* sd2.c */,
|
||||
8EF6C96B09FB14730045E26A /* sds.c */,
|
||||
8EF6C96C09FB14730045E26A /* sf_unistd.h */,
|
||||
8EF6C96D09FB14730045E26A /* sfconfig.h */,
|
||||
8EF6C96E09FB14730045E26A /* sfendian.h */,
|
||||
8EF6C96F09FB14730045E26A /* sndfile.c */,
|
||||
8EF6C97009FB14730045E26A /* sndfile.h */,
|
||||
8EF6C97209FB14730045E26A /* strings.c */,
|
||||
8EF6C97309FB14730045E26A /* svx.c */,
|
||||
8EF6C97B09FB14730045E26A /* txw.c */,
|
||||
8EF6C97C09FB14730045E26A /* ulaw.c */,
|
||||
8EF6C97D09FB14730045E26A /* voc.c */,
|
||||
8EF6C97E09FB14730045E26A /* vox_adpcm.c */,
|
||||
8EF6C97F09FB14730045E26A /* w64.c */,
|
||||
8EF6C98009FB14730045E26A /* wav_w64.c */,
|
||||
8EF6C98109FB14730045E26A /* wav_w64.h */,
|
||||
8EF6C98209FB14730045E26A /* wav.c */,
|
||||
8EF6C98309FB14730045E26A /* wve.c */,
|
||||
8EF6C98409FB14730045E26A /* xi.c */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8E756E0309F318160080F1EE /* G72x */ = {
|
||||
8EF6C93009FB14720045E26A /* G72x */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8E756E0509F318160080F1EE /* g721.c */,
|
||||
8E756E0609F318160080F1EE /* g723_16.c */,
|
||||
8E756E0709F318160080F1EE /* g723_24.c */,
|
||||
8E756E0809F318160080F1EE /* g723_40.c */,
|
||||
8E756E0909F318160080F1EE /* g72x.c */,
|
||||
8E756E0A09F318160080F1EE /* g72x.h */,
|
||||
8E756E0B09F318160080F1EE /* g72x_priv.h */,
|
||||
8E756E0C09F318160080F1EE /* g72x_test.c */,
|
||||
8EF6C93209FB14720045E26A /* g721.c */,
|
||||
8EF6C93309FB14720045E26A /* g723_16.c */,
|
||||
8EF6C93409FB14720045E26A /* g723_24.c */,
|
||||
8EF6C93509FB14720045E26A /* g723_40.c */,
|
||||
8EF6C93609FB14720045E26A /* g72x.c */,
|
||||
8EF6C93709FB14720045E26A /* g72x.h */,
|
||||
8EF6C93809FB14720045E26A /* g72x_priv.h */,
|
||||
);
|
||||
name = G72x;
|
||||
path = Files/src/G72x;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8E756E1109F318160080F1EE /* GSM610 */ = {
|
||||
8EF6C93F09FB14720045E26A /* GSM610 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8E756E1209F318160080F1EE /* add.c */,
|
||||
8E756E1409F318160080F1EE /* code.c */,
|
||||
8E756E1509F318160080F1EE /* config.h */,
|
||||
8E756E1709F318160080F1EE /* decode.c */,
|
||||
8E756E1809F318160080F1EE /* gsm.h */,
|
||||
8E756E1909F318160080F1EE /* gsm610_priv.h */,
|
||||
8E756E1A09F318160080F1EE /* gsm_create.c */,
|
||||
8E756E1B09F318160080F1EE /* gsm_decode.c */,
|
||||
8E756E1C09F318160080F1EE /* gsm_destroy.c */,
|
||||
8E756E1D09F318160080F1EE /* gsm_encode.c */,
|
||||
8E756E1E09F318160080F1EE /* gsm_option.c */,
|
||||
8E756E1F09F318160080F1EE /* long_term.c */,
|
||||
8E756E2009F318160080F1EE /* lpc.c */,
|
||||
8E756E2309F318160080F1EE /* preprocess.c */,
|
||||
8E756E2509F318160080F1EE /* rpe.c */,
|
||||
8E756E2609F318160080F1EE /* short_term.c */,
|
||||
8E756E2709F318160080F1EE /* table.c */,
|
||||
8EF6C94009FB14720045E26A /* add.c */,
|
||||
8EF6C94209FB14720045E26A /* code.c */,
|
||||
8EF6C94309FB14720045E26A /* config.h */,
|
||||
8EF6C94509FB14720045E26A /* decode.c */,
|
||||
8EF6C94609FB14730045E26A /* gsm.h */,
|
||||
8EF6C94709FB14730045E26A /* gsm610_priv.h */,
|
||||
8EF6C94809FB14730045E26A /* gsm_create.c */,
|
||||
8EF6C94909FB14730045E26A /* gsm_decode.c */,
|
||||
8EF6C94A09FB14730045E26A /* gsm_destroy.c */,
|
||||
8EF6C94B09FB14730045E26A /* gsm_encode.c */,
|
||||
8EF6C94C09FB14730045E26A /* gsm_option.c */,
|
||||
8EF6C94D09FB14730045E26A /* long_term.c */,
|
||||
8EF6C94E09FB14730045E26A /* lpc.c */,
|
||||
8EF6C95109FB14730045E26A /* preprocess.c */,
|
||||
8EF6C95309FB14730045E26A /* rpe.c */,
|
||||
8EF6C95409FB14730045E26A /* short_term.c */,
|
||||
8EF6C95509FB14730045E26A /* table.c */,
|
||||
);
|
||||
name = GSM610;
|
||||
path = Files/src/GSM610;
|
||||
|
@ -361,19 +359,19 @@
|
|||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8E756E5709F318170080F1EE /* au.h in Headers */,
|
||||
8E756E5B09F318170080F1EE /* common.h in Headers */,
|
||||
8E756E5C09F318170080F1EE /* config.h in Headers */,
|
||||
8E756E6309F318170080F1EE /* float_cast.h in Headers */,
|
||||
8E756E6B09F318170080F1EE /* g72x.h in Headers */,
|
||||
8E756E6C09F318170080F1EE /* g72x_priv.h in Headers */,
|
||||
8E756E7509F318170080F1EE /* config.h in Headers */,
|
||||
8E756E7809F318170080F1EE /* gsm.h in Headers */,
|
||||
8E756E7909F318170080F1EE /* gsm610_priv.h in Headers */,
|
||||
8E756E9C09F318170080F1EE /* sf_unistd.h in Headers */,
|
||||
8E756E9D09F318170080F1EE /* sfendian.h in Headers */,
|
||||
8E756E9F09F318170080F1EE /* sndfile.h in Headers */,
|
||||
8E756EAF09F318170080F1EE /* wav_w64.h in Headers */,
|
||||
8EF6C98E09FB14730045E26A /* common.h in Headers */,
|
||||
8EF6C98F09FB14730045E26A /* config.h in Headers */,
|
||||
8EF6C99909FB14730045E26A /* float_cast.h in Headers */,
|
||||
8EF6C9A109FB14730045E26A /* g72x.h in Headers */,
|
||||
8EF6C9A209FB14730045E26A /* g72x_priv.h in Headers */,
|
||||
8EF6C9AC09FB14730045E26A /* config.h in Headers */,
|
||||
8EF6C9AF09FB14730045E26A /* gsm.h in Headers */,
|
||||
8EF6C9B009FB14730045E26A /* gsm610_priv.h in Headers */,
|
||||
8EF6C9D509FB14730045E26A /* sf_unistd.h in Headers */,
|
||||
8EF6C9D609FB14730045E26A /* sfconfig.h in Headers */,
|
||||
8EF6C9D709FB14730045E26A /* sfendian.h in Headers */,
|
||||
8EF6C9D909FB14730045E26A /* sndfile.h in Headers */,
|
||||
8EF6C9EA09FB14730045E26A /* wav_w64.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -439,69 +437,71 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8E756E5309F318170080F1EE /* aiff.c in Sources */,
|
||||
8E756E5409F318170080F1EE /* alaw.c in Sources */,
|
||||
8E756E5509F318170080F1EE /* au_g72x.c in Sources */,
|
||||
8E756E5609F318170080F1EE /* au.c in Sources */,
|
||||
8E756E5809F318170080F1EE /* avr.c in Sources */,
|
||||
8E756E5909F318170080F1EE /* command.c in Sources */,
|
||||
8E756E5A09F318170080F1EE /* common.c in Sources */,
|
||||
8E756E5E09F318170080F1EE /* dither.c in Sources */,
|
||||
8E756E5F09F318170080F1EE /* double64.c in Sources */,
|
||||
8E756E6009F318170080F1EE /* dwd.c in Sources */,
|
||||
8E756E6109F318170080F1EE /* dwvw.c in Sources */,
|
||||
8E756E6209F318170080F1EE /* file_io.c in Sources */,
|
||||
8E756E6409F318170080F1EE /* float32.c in Sources */,
|
||||
8E756E6609F318170080F1EE /* g721.c in Sources */,
|
||||
8E756E6709F318170080F1EE /* g723_16.c in Sources */,
|
||||
8E756E6809F318170080F1EE /* g723_24.c in Sources */,
|
||||
8E756E6909F318170080F1EE /* g723_40.c in Sources */,
|
||||
8E756E6A09F318170080F1EE /* g72x.c in Sources */,
|
||||
8E756E7209F318170080F1EE /* add.c in Sources */,
|
||||
8E756E7409F318170080F1EE /* code.c in Sources */,
|
||||
8E756E7709F318170080F1EE /* decode.c in Sources */,
|
||||
8E756E7A09F318170080F1EE /* gsm_create.c in Sources */,
|
||||
8E756E7B09F318170080F1EE /* gsm_decode.c in Sources */,
|
||||
8E756E7C09F318170080F1EE /* gsm_destroy.c in Sources */,
|
||||
8E756E7D09F318170080F1EE /* gsm_encode.c in Sources */,
|
||||
8E756E7E09F318170080F1EE /* gsm_option.c in Sources */,
|
||||
8E756E7F09F318170080F1EE /* long_term.c in Sources */,
|
||||
8E756E8009F318170080F1EE /* lpc.c in Sources */,
|
||||
8E756E8309F318170080F1EE /* preprocess.c in Sources */,
|
||||
8E756E8509F318170080F1EE /* rpe.c in Sources */,
|
||||
8E756E8609F318170080F1EE /* short_term.c in Sources */,
|
||||
8E756E8709F318170080F1EE /* table.c in Sources */,
|
||||
8E756E8809F318170080F1EE /* gsm610.c in Sources */,
|
||||
8E756E8909F318170080F1EE /* htk.c in Sources */,
|
||||
8E756E8A09F318170080F1EE /* ima_adpcm.c in Sources */,
|
||||
8E756E8B09F318170080F1EE /* interleave.c in Sources */,
|
||||
8E756E8C09F318170080F1EE /* ircam.c in Sources */,
|
||||
8E756E8E09F318170080F1EE /* macbinary3.c in Sources */,
|
||||
8E756E8F09F318170080F1EE /* macos.c in Sources */,
|
||||
8E756E9009F318170080F1EE /* mat4.c in Sources */,
|
||||
8E756E9109F318170080F1EE /* mat5.c in Sources */,
|
||||
8E756E9209F318170080F1EE /* ms_adpcm.c in Sources */,
|
||||
8E756E9309F318170080F1EE /* nist.c in Sources */,
|
||||
8E756E9409F318170080F1EE /* ogg.c in Sources */,
|
||||
8E756E9509F318170080F1EE /* paf.c in Sources */,
|
||||
8E756E9609F318170080F1EE /* pcm.c in Sources */,
|
||||
8E756E9709F318170080F1EE /* pvf.c in Sources */,
|
||||
8E756E9809F318170080F1EE /* raw.c in Sources */,
|
||||
8E756E9909F318170080F1EE /* rx2.c in Sources */,
|
||||
8E756E9A09F318170080F1EE /* sd2.c in Sources */,
|
||||
8E756E9B09F318170080F1EE /* sds.c in Sources */,
|
||||
8E756E9E09F318170080F1EE /* sndfile.c in Sources */,
|
||||
8E756EA009F318170080F1EE /* strings.c in Sources */,
|
||||
8E756EA109F318170080F1EE /* svx.c in Sources */,
|
||||
8E756EA909F318170080F1EE /* txw.c in Sources */,
|
||||
8E756EAA09F318170080F1EE /* ulaw.c in Sources */,
|
||||
8E756EAB09F318170080F1EE /* voc.c in Sources */,
|
||||
8E756EAC09F318170080F1EE /* vox_adpcm.c in Sources */,
|
||||
8E756EAD09F318170080F1EE /* w64.c in Sources */,
|
||||
8E756EAE09F318170080F1EE /* wav_w64.c in Sources */,
|
||||
8E756EB009F318170080F1EE /* wav.c in Sources */,
|
||||
8E756EB109F318170080F1EE /* wve.c in Sources */,
|
||||
8E756EB209F318170080F1EE /* xi.c in Sources */,
|
||||
8EF6C98509FB14730045E26A /* aiff.c in Sources */,
|
||||
8EF6C98609FB14730045E26A /* alaw.c in Sources */,
|
||||
8EF6C98809FB14730045E26A /* au.c in Sources */,
|
||||
8EF6C98A09FB14730045E26A /* avr.c in Sources */,
|
||||
8EF6C98B09FB14730045E26A /* caf.c in Sources */,
|
||||
8EF6C98C09FB14730045E26A /* command.c in Sources */,
|
||||
8EF6C98D09FB14730045E26A /* common.c in Sources */,
|
||||
8EF6C99309FB14730045E26A /* dither.c in Sources */,
|
||||
8EF6C99409FB14730045E26A /* double64.c in Sources */,
|
||||
8EF6C99509FB14730045E26A /* dwd.c in Sources */,
|
||||
8EF6C99609FB14730045E26A /* dwvw.c in Sources */,
|
||||
8EF6C99709FB14730045E26A /* file_io.c in Sources */,
|
||||
8EF6C99809FB14730045E26A /* flac.c in Sources */,
|
||||
8EF6C99A09FB14730045E26A /* float32.c in Sources */,
|
||||
8EF6C99C09FB14730045E26A /* g721.c in Sources */,
|
||||
8EF6C99D09FB14730045E26A /* g723_16.c in Sources */,
|
||||
8EF6C99E09FB14730045E26A /* g723_24.c in Sources */,
|
||||
8EF6C99F09FB14730045E26A /* g723_40.c in Sources */,
|
||||
8EF6C9A009FB14730045E26A /* g72x.c in Sources */,
|
||||
8EF6C9A809FB14730045E26A /* g72x.c in Sources */,
|
||||
8EF6C9A909FB14730045E26A /* add.c in Sources */,
|
||||
8EF6C9AB09FB14730045E26A /* code.c in Sources */,
|
||||
8EF6C9AE09FB14730045E26A /* decode.c in Sources */,
|
||||
8EF6C9B109FB14730045E26A /* gsm_create.c in Sources */,
|
||||
8EF6C9B209FB14730045E26A /* gsm_decode.c in Sources */,
|
||||
8EF6C9B309FB14730045E26A /* gsm_destroy.c in Sources */,
|
||||
8EF6C9B409FB14730045E26A /* gsm_encode.c in Sources */,
|
||||
8EF6C9B509FB14730045E26A /* gsm_option.c in Sources */,
|
||||
8EF6C9B609FB14730045E26A /* long_term.c in Sources */,
|
||||
8EF6C9B709FB14730045E26A /* lpc.c in Sources */,
|
||||
8EF6C9BA09FB14730045E26A /* preprocess.c in Sources */,
|
||||
8EF6C9BC09FB14730045E26A /* rpe.c in Sources */,
|
||||
8EF6C9BD09FB14730045E26A /* short_term.c in Sources */,
|
||||
8EF6C9BE09FB14730045E26A /* table.c in Sources */,
|
||||
8EF6C9BF09FB14730045E26A /* gsm610.c in Sources */,
|
||||
8EF6C9C009FB14730045E26A /* htk.c in Sources */,
|
||||
8EF6C9C109FB14730045E26A /* ima_adpcm.c in Sources */,
|
||||
8EF6C9C209FB14730045E26A /* interleave.c in Sources */,
|
||||
8EF6C9C309FB14730045E26A /* ircam.c in Sources */,
|
||||
8EF6C9C509FB14730045E26A /* macbinary3.c in Sources */,
|
||||
8EF6C9C609FB14730045E26A /* macos.c in Sources */,
|
||||
8EF6C9C909FB14730045E26A /* mat4.c in Sources */,
|
||||
8EF6C9CA09FB14730045E26A /* mat5.c in Sources */,
|
||||
8EF6C9CB09FB14730045E26A /* ms_adpcm.c in Sources */,
|
||||
8EF6C9CC09FB14730045E26A /* nist.c in Sources */,
|
||||
8EF6C9CD09FB14730045E26A /* ogg.c in Sources */,
|
||||
8EF6C9CE09FB14730045E26A /* paf.c in Sources */,
|
||||
8EF6C9CF09FB14730045E26A /* pcm.c in Sources */,
|
||||
8EF6C9D009FB14730045E26A /* pvf.c in Sources */,
|
||||
8EF6C9D109FB14730045E26A /* raw.c in Sources */,
|
||||
8EF6C9D209FB14730045E26A /* rx2.c in Sources */,
|
||||
8EF6C9D309FB14730045E26A /* sd2.c in Sources */,
|
||||
8EF6C9D409FB14730045E26A /* sds.c in Sources */,
|
||||
8EF6C9D809FB14730045E26A /* sndfile.c in Sources */,
|
||||
8EF6C9DB09FB14730045E26A /* strings.c in Sources */,
|
||||
8EF6C9DC09FB14730045E26A /* svx.c in Sources */,
|
||||
8EF6C9E409FB14730045E26A /* txw.c in Sources */,
|
||||
8EF6C9E509FB14730045E26A /* ulaw.c in Sources */,
|
||||
8EF6C9E609FB14730045E26A /* voc.c in Sources */,
|
||||
8EF6C9E709FB14730045E26A /* vox_adpcm.c in Sources */,
|
||||
8EF6C9E809FB14730045E26A /* w64.c in Sources */,
|
||||
8EF6C9E909FB14730045E26A /* wav_w64.c in Sources */,
|
||||
8EF6C9EB09FB14730045E26A /* wav.c in Sources */,
|
||||
8EF6C9EC09FB14730045E26A /* wve.c in Sources */,
|
||||
8EF6C9ED09FB14730045E26A /* xi.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -556,10 +556,7 @@
|
|||
GCC_PREFIX_HEADER = "";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "@executable_path/../Frameworks";
|
||||
OTHER_CFLAGS = (
|
||||
"-DHAVE_LRINT",
|
||||
"-DHAVE_LRINTF",
|
||||
);
|
||||
OTHER_CFLAGS = "";
|
||||
PRODUCT_NAME = SndFile;
|
||||
WRAPPER_EXTENSION = framework;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue