mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-12 15:21:50 +00:00
Updated SpanDSP to snapshot on 2009-06-03 with some additions:
Fixed VS2005 version of make_modem_filter Fixed a couple of places where declaration and definition of functions do not have the same calling conventions. Only relevant for Win32 compiles. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13831 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
+20
-18
@@ -16,7 +16,7 @@
|
||||
## License along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Id: Makefile.am,v 1.46 2009/03/19 14:13:12 steveu Exp $
|
||||
## $Id: Makefile.am,v 1.49 2009/05/30 05:55:22 steveu Exp $
|
||||
|
||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||
@@ -27,17 +27,6 @@ MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = autogen.sh \
|
||||
DueDiligence \
|
||||
README.testdata \
|
||||
spandsp.pc \
|
||||
spandsp.spec \
|
||||
wrapper.xsl \
|
||||
unpack_g722_data.sh \
|
||||
unpack_g726_data.sh \
|
||||
unpack_gsm0610_data.sh \
|
||||
unpack_v56ter_data.sh \
|
||||
spandsp/global-tones.xml \
|
||||
spandsp/tones.dtd \
|
||||
spandsp/tsb85.xml \
|
||||
debian/changelog \
|
||||
debian/compat \
|
||||
debian/control \
|
||||
@@ -46,20 +35,33 @@ EXTRA_DIST = autogen.sh \
|
||||
debian/libspandsp-dev.install \
|
||||
debian/libspandsp-doc.install \
|
||||
debian/rules \
|
||||
debian/watch
|
||||
debian/watch \
|
||||
README.testdata \
|
||||
spandsp.pc \
|
||||
spandsp.spec \
|
||||
spandsp/fax-tests.dtd \
|
||||
spandsp/global-tones.xml \
|
||||
spandsp/tones.dtd \
|
||||
spandsp/tsb85.xml \
|
||||
unpack_g722_data.sh \
|
||||
unpack_g726_data.sh \
|
||||
unpack_gsm0610_data.sh \
|
||||
unpack_v56ter_data.sh \
|
||||
wrapper.xsl
|
||||
|
||||
if COND_DOC
|
||||
MAYBE_DOC=doc
|
||||
endif
|
||||
if COND_TESTS
|
||||
MAYBE_TESTS=spandsp-sim tests
|
||||
endif
|
||||
if COND_TESTDATA
|
||||
MAYBE_TESTDATA=test-data
|
||||
endif
|
||||
SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTS) $(MAYBE_TESTDATA)
|
||||
if COND_TESTS
|
||||
MAYBE_TESTDATA=test-data
|
||||
MAYBE_TESTS=spandsp-sim tests
|
||||
endif
|
||||
SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTDATA) $(MAYBE_TESTS)
|
||||
|
||||
DIST_SUBDIRS = src doc spandsp-sim tests test-data
|
||||
DIST_SUBDIRS = src doc test-data spandsp-sim tests
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = spandsp.pc
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# $Id: configure.ac,v 1.67 2009/03/28 17:14:53 steveu Exp $
|
||||
# $Id: configure.ac,v 1.70 2009/06/02 11:51:57 steveu Exp $
|
||||
|
||||
# @start 1
|
||||
|
||||
@@ -162,6 +162,7 @@ AC_CHECK_FUNCS([strerror])
|
||||
AC_CHECK_FUNCS([strstr])
|
||||
AC_CHECK_FUNCS([strtol])
|
||||
AC_CHECK_FUNCS([gettimeofday])
|
||||
AC_CHECK_FUNCS([drand48])
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
@@ -184,7 +185,7 @@ AC_CHECK_HEADERS([sys/time.h])
|
||||
AC_CHECK_HEADERS([sys/select.h])
|
||||
AC_CHECK_HEADERS([sys/ioctl.h])
|
||||
AC_CHECK_HEADERS([sys/fcntl.h])
|
||||
AC_CHECK_HEADERS([audiofile.h])
|
||||
AC_CHECK_HEADERS([sndfile.h])
|
||||
AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])])
|
||||
AC_CHECK_HEADERS([tiffio.h])
|
||||
AC_CHECK_HEADERS([pthread.h])
|
||||
@@ -266,12 +267,12 @@ AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Can't build without libtiff (does your system require a libtiff-devel package?)"), -lm)
|
||||
|
||||
AC_CHECK_LIB([xml2], [xmlParseFile], [AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have the 'libxml2' library (-lxml2).]) TESTLIBS="$TESTLIBS -lxml2"])
|
||||
AC_CHECK_LIB([xml2], [xmlParseFile], [AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have the 'libxml2' library (-lxml2).]) SIMLIBS="$SIMLIBS -lxml2"])
|
||||
|
||||
if test -n "$enable_tests" ; then
|
||||
AC_LANG([C])
|
||||
AC_CHECK_LIB([audiofile], [afOpenFile], TESTLIBS="$TESTLIBS -laudiofile", AC_MSG_ERROR("Can't make tests without libaudiofile (does your system require a libaudiofile-devel package?)"))
|
||||
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], TESTLIBS="$TESTLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], TESTLIBS="$TESTLIBS -lfftw", AC_MSG_ERROR("Can't make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))])
|
||||
AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Can't make tests without libsndfile (does your system require a libsndfile-devel package?)"))
|
||||
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Can't make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))])
|
||||
AC_CHECK_LIB([pthread], [pthread_attr_init], TESTLIBS="$TESTLIBS -lpthread")
|
||||
AC_CHECK_LIB([dl], [dlopen], TESTLIBS="$TESTLIBS -ldl")
|
||||
AC_CHECK_LIB([Xft], [XftFontOpen], TESTLIBS="$TESTLIBS -lXft",, $TESTLIBS)
|
||||
@@ -406,10 +407,13 @@ if test "$enable_mmx" = "yes" ; then
|
||||
AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
|
||||
fi
|
||||
|
||||
TESTLIBS="$SIMLIBS $TESTLIBS"
|
||||
|
||||
AC_SUBST(CC_FOR_BUILD)
|
||||
AC_SUBST(CPPFLAGS_FOR_BUILD)
|
||||
AC_SUBST(COMP_VENDOR_CFLAGS)
|
||||
AC_SUBST(COMP_VENDOR_LDFLAGS)
|
||||
AC_SUBST(SIMLIBS)
|
||||
AC_SUBST(TESTLIBS)
|
||||
AC_SUBST(SPANDSP_USE_FIXED_POINT)
|
||||
AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS)
|
||||
|
||||
@@ -16,15 +16,26 @@
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Id: Makefile.am,v 1.7 2008/05/03 13:05:04 steveu Exp $
|
||||
## $Id: Makefile.am,v 1.10 2009/06/02 16:03:55 steveu Exp $
|
||||
|
||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||
|
||||
LIBS += $(TESTLIBS)
|
||||
LIBS += -L$(top_builddir)/src -lspandsp $(SIMLIBS)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = libspandsp_sim.dsp \
|
||||
libspandsp_sim.2005.vcproj \
|
||||
libspandsp_sim.2008.vcproj \
|
||||
msvc/make_line_models.2008.vcproj \
|
||||
msvc/msvcproj.head \
|
||||
msvc/msvcproj.foot \
|
||||
msvc/vc8proj.head \
|
||||
msvc/vc8proj.foot \
|
||||
msvc/vc9proj.head \
|
||||
msvc/vc9proj.foot
|
||||
|
||||
INCLUDES = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
|
||||
|
||||
noinst_PROGRAMS = make_line_models
|
||||
@@ -38,7 +49,7 @@ libspandsp_sim_la_SOURCES = g1050.c \
|
||||
|
||||
nodist_libspandsp_sim_la_SOURCES = line_models.c
|
||||
|
||||
libspandsp_sim_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@
|
||||
libspandsp_sim_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
|
||||
|
||||
nobase_include_HEADERS = spandsp/g1050.h \
|
||||
spandsp/line_model.h \
|
||||
@@ -60,14 +71,16 @@ line_models.$(OBJEXT): make_line_models$(EXEEXT) line_models.c
|
||||
line_models.c: make_line_models$(EXEEXT)
|
||||
./make_line_models$(EXEEXT)
|
||||
|
||||
DSP = libspandsp-sim.dsp
|
||||
VCPROJ = libspandsp-sim.vcproj
|
||||
DSP = libspandsp_sim.dsp
|
||||
VCPROJ8 = libspandsp_sim.2005.vcproj
|
||||
VCPROJ9 = libspandsp_sim.2008.vcproj
|
||||
|
||||
WIN32SOURCES = $(libspandsp_sim_la_SOURCES) msvc/gettimeofday.c
|
||||
WIN32HEADERS = $(nobase_include_HEADERS) spandsp-sim.h
|
||||
WIN32SOURCES = $(libspandsp_sim_la_SOURCES)
|
||||
WIN32HEADERS = $(nobase_include_HEADERS)
|
||||
|
||||
DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP)
|
||||
VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ)
|
||||
VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8)
|
||||
VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9)
|
||||
|
||||
$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
|
||||
echo "creating $(DSP)"
|
||||
@@ -90,14 +103,26 @@ $(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
|
||||
echo "# End Group" $(DSPOUT); \
|
||||
cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) )
|
||||
|
||||
$(VCPROJ): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
|
||||
echo "creating $(VCPROJ)"
|
||||
@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ); \
|
||||
$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
|
||||
echo "creating $(VCPROJ8)"
|
||||
@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \
|
||||
for file in $(WIN32SOURCES); do \
|
||||
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
|
||||
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
|
||||
done; \
|
||||
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT); \
|
||||
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT8); \
|
||||
for file in $(WIN32HEADERS); do \
|
||||
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
|
||||
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
|
||||
done; \
|
||||
cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT) )
|
||||
cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) )
|
||||
|
||||
$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am
|
||||
echo "creating $(VCPROJ9)"
|
||||
@(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \
|
||||
for file in $(WIN32SOURCES); do \
|
||||
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
|
||||
done; \
|
||||
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT9); \
|
||||
for file in $(WIN32HEADERS); do \
|
||||
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
|
||||
done; \
|
||||
cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) )
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: g1050.c,v 1.13 2009/02/03 16:28:39 steveu Exp $
|
||||
* $Id: g1050.c,v 1.17 2009/06/02 14:55:36 steveu Exp $
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <audiofile.h>
|
||||
#if defined(HAVE_TGMATH_H)
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
@@ -669,11 +668,31 @@ g1050_model_t g1050_standard_models[9] =
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(HAVE_DRAND48)
|
||||
static __inline__ void q1050_rand_init(void)
|
||||
{
|
||||
srand48(time(NULL));
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ double q1050_rand(void)
|
||||
{
|
||||
return drand48();
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
#else
|
||||
static __inline__ void q1050_rand_init(void)
|
||||
{
|
||||
srand(time(NULL));
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ double q1050_rand(void)
|
||||
{
|
||||
return (double) rand()/(double) RAND_MAX;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
static __inline__ double scale_probability(double prob, double scale)
|
||||
{
|
||||
@@ -1070,10 +1089,10 @@ static void g1050_simulate_chunk(g1050_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(g1050_state_t) *g1050_init(int model,
|
||||
int speed_pattern,
|
||||
int packet_size,
|
||||
int packet_rate)
|
||||
SPAN_DECLARE(g1050_state_t *) g1050_init(int model,
|
||||
int speed_pattern,
|
||||
int packet_size,
|
||||
int packet_rate)
|
||||
{
|
||||
g1050_state_t *s;
|
||||
g1050_constants_t *constants;
|
||||
@@ -1089,7 +1108,7 @@ SPAN_DECLARE(g1050_state_t) *g1050_init(int model,
|
||||
break;
|
||||
}
|
||||
if (i >= 10)
|
||||
srand48(time(NULL));
|
||||
q1050_rand_init();
|
||||
if ((s = (g1050_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
memset(s, 0, sizeof(*s));
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libspandsp_sim"
|
||||
ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
|
||||
RootNamespace="libspandsp_sim"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)Debug"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="./Debug\spandsp_sim.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)Release"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="./Release\spandsp_sim.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File RelativePath="g1050.c"></File>
|
||||
<File RelativePath="line_model.c"></File>
|
||||
<File RelativePath="rfc2198_sim.c"></File>
|
||||
<File RelativePath="test_utils.c"></File>
|
||||
</Filter><Filter Name="Header Files">
|
||||
<File RelativePath="spandsp/g1050.h"></File>
|
||||
<File RelativePath="spandsp/line_model.h"></File>
|
||||
<File RelativePath="spandsp/line_models.h"></File>
|
||||
<File RelativePath="spandsp/rfc2198_sim.h"></File>
|
||||
<File RelativePath="spandsp/test_utils.h"></File>
|
||||
<File RelativePath="spandsp-sim.h"></File>
|
||||
</Filter>
|
||||
|
||||
</Files>
|
||||
|
||||
<Globals>
|
||||
@@ -0,0 +1,270 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="libspandsp_sim"
|
||||
ProjectGUID="{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
|
||||
RootNamespace="libspandsp_sim"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)Debug"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="./Debug\spandsp_sim.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)Release"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="./Release\spandsp_sim.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(TargetDir)spandsp_sim.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(TargetDir)spandsp_sim.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File RelativePath="g1050.c"></File>
|
||||
<File RelativePath="line_model.c"></File>
|
||||
<File RelativePath="rfc2198_sim.c"></File>
|
||||
<File RelativePath="test_utils.c"></File>
|
||||
</Filter><Filter Name="Header Files">
|
||||
<File RelativePath="spandsp/g1050.h"></File>
|
||||
<File RelativePath="spandsp/line_model.h"></File>
|
||||
<File RelativePath="spandsp/line_models.h"></File>
|
||||
<File RelativePath="spandsp/rfc2198_sim.h"></File>
|
||||
<File RelativePath="spandsp/test_utils.h"></File>
|
||||
<File RelativePath="spandsp-sim.h"></File>
|
||||
</Filter>
|
||||
|
||||
</Files>
|
||||
|
||||
<Globals>
|
||||
@@ -0,0 +1,143 @@
|
||||
# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=spandsp - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "spandsp.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "spandsp.mak" CFG="spandsp - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "spandsp - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
|
||||
|
||||
!ELSEIF "$(CFG)" == "spandsp - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
|
||||
# SUBTRACT CPP /WX /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "spandsp - Win32 Release"
|
||||
# Name "spandsp - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\g1050.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\line_model.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\rfc2198_sim.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\test_utils.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\spandsp/g1050.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\spandsp/line_model.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\spandsp/line_models.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\spandsp/rfc2198_sim.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\spandsp/test_utils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\spandsp-sim.h
|
||||
# End Source File
|
||||
# End Group
|
||||
|
||||
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: line_model.c,v 1.8 2009/02/03 16:28:39 steveu Exp $
|
||||
* $Id: line_model.c,v 1.12 2009/06/01 16:27:12 steveu Exp $
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <audiofile.h>
|
||||
#if defined(HAVE_TGMATH_H)
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
@@ -270,10 +269,10 @@ static float calc_far_line_filter(one_way_line_model_state_t *s, float v)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
void one_way_line_model(one_way_line_model_state_t *s,
|
||||
int16_t output[],
|
||||
const int16_t input[],
|
||||
int samples)
|
||||
SPAN_DECLARE(void) one_way_line_model(one_way_line_model_state_t *s,
|
||||
int16_t output[],
|
||||
const int16_t input[],
|
||||
int samples)
|
||||
{
|
||||
int i;
|
||||
float in;
|
||||
@@ -336,13 +335,13 @@ void one_way_line_model(one_way_line_model_state_t *s,
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
void one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc)
|
||||
SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc)
|
||||
{
|
||||
s->dc_offset = dc;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
void one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level)
|
||||
SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level)
|
||||
{
|
||||
tone_gen_descriptor_t mains_tone_desc;
|
||||
|
||||
@@ -355,12 +354,12 @@ void one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, f
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
void both_ways_line_model(both_ways_line_model_state_t *s,
|
||||
int16_t output1[],
|
||||
const int16_t input1[],
|
||||
int16_t output2[],
|
||||
const int16_t input2[],
|
||||
int samples)
|
||||
SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s,
|
||||
int16_t output1[],
|
||||
const int16_t input1[],
|
||||
int16_t output2[],
|
||||
const int16_t input2[],
|
||||
int samples)
|
||||
{
|
||||
int i;
|
||||
float in1;
|
||||
@@ -444,14 +443,14 @@ void both_ways_line_model(both_ways_line_model_state_t *s,
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
void both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2)
|
||||
SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2)
|
||||
{
|
||||
s->line1.dc_offset = dc1;
|
||||
s->line2.dc_offset = dc2;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
void both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2)
|
||||
SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2)
|
||||
{
|
||||
tone_gen_descriptor_t mains_tone_desc;
|
||||
|
||||
@@ -467,7 +466,7 @@ void both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
one_way_line_model_state_t *one_way_line_model_init(int model, float noise, int codec, int rbs_pattern)
|
||||
SPAN_DECLARE(one_way_line_model_state_t *) one_way_line_model_init(int model, float noise, int codec, int rbs_pattern)
|
||||
{
|
||||
one_way_line_model_state_t *s;
|
||||
|
||||
@@ -486,8 +485,9 @@ one_way_line_model_state_t *one_way_line_model_init(int model, float noise, int
|
||||
s->far_filter = models[model];
|
||||
s->far_filter_len = 129;
|
||||
|
||||
awgn_init_dbm0(&s->near_noise, 1234567, noise);
|
||||
awgn_init_dbm0(&s->far_noise, 1234567, noise);
|
||||
/* Put half the noise in each analogue section */
|
||||
awgn_init_dbm0(&s->near_noise, 1234567, noise - 3.02f);
|
||||
awgn_init_dbm0(&s->far_noise, 1234567, noise - 3.02f);
|
||||
|
||||
s->dc_offset = 0.0f;
|
||||
s->mains_interference = 0;
|
||||
@@ -496,19 +496,19 @@ one_way_line_model_state_t *one_way_line_model_init(int model, float noise, int
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int one_way_line_model_release(one_way_line_model_state_t *s)
|
||||
SPAN_DECLARE(int) one_way_line_model_release(one_way_line_model_state_t *s)
|
||||
{
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
both_ways_line_model_state_t *both_ways_line_model_init(int model1,
|
||||
float noise1,
|
||||
int model2,
|
||||
float noise2,
|
||||
int codec,
|
||||
int rbs_pattern)
|
||||
SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1,
|
||||
float noise1,
|
||||
int model2,
|
||||
float noise2,
|
||||
int codec,
|
||||
int rbs_pattern)
|
||||
{
|
||||
float echo_level;
|
||||
both_ways_line_model_state_t *s;
|
||||
@@ -536,11 +536,12 @@ both_ways_line_model_state_t *both_ways_line_model_init(int model1,
|
||||
s->line2.far_filter = models[model2];
|
||||
s->line2.far_filter_len = 129;
|
||||
|
||||
awgn_init_dbm0(&s->line1.near_noise, 1234567, noise1);
|
||||
awgn_init_dbm0(&s->line2.near_noise, 7654321, noise2);
|
||||
/* Put half the noise in each analogue section */
|
||||
awgn_init_dbm0(&s->line1.near_noise, 1234567, noise1 - 3.02f);
|
||||
awgn_init_dbm0(&s->line2.near_noise, 7654321, noise2 - 3.02f);
|
||||
|
||||
awgn_init_dbm0(&s->line1.far_noise, 1234567, noise1);
|
||||
awgn_init_dbm0(&s->line2.far_noise, 7654321, noise2);
|
||||
awgn_init_dbm0(&s->line1.far_noise, 1234567, noise1 - 3.02f);
|
||||
awgn_init_dbm0(&s->line2.far_noise, 7654321, noise2 - 3.02f);
|
||||
|
||||
s->line1.dc_offset = 0.0f;
|
||||
s->line2.dc_offset = 0.0f;
|
||||
@@ -549,16 +550,16 @@ both_ways_line_model_state_t *both_ways_line_model_init(int model1,
|
||||
|
||||
/* Echos */
|
||||
echo_level = -15; /* in dB */
|
||||
s->line1.near_co_hybrid_echo = pow(10, echo_level/20.0);
|
||||
s->line2.near_co_hybrid_echo = pow(10, echo_level/20.0);
|
||||
s->line1.near_cpe_hybrid_echo = pow(10, echo_level/20.0);
|
||||
s->line2.near_cpe_hybrid_echo = pow(10, echo_level/20.0);
|
||||
s->line1.near_co_hybrid_echo = pow(10, echo_level/20.0f);
|
||||
s->line2.near_co_hybrid_echo = pow(10, echo_level/20.0f);
|
||||
s->line1.near_cpe_hybrid_echo = pow(10, echo_level/20.0f);
|
||||
s->line2.near_cpe_hybrid_echo = pow(10, echo_level/20.0f);
|
||||
|
||||
return s;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int both_ways_line_model_release(both_ways_line_model_state_t *s)
|
||||
SPAN_DECLARE(int) both_ways_line_model_release(both_ways_line_model_state_t *s)
|
||||
{
|
||||
free(s);
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="make_line_models"
|
||||
ProjectGUID="{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
|
||||
RootNamespace="make_line_models"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="All|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\..\src;..\..\src\msvc;..\..\src\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine=""$(TargetPath)"
"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\msvc\getopt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\make_line_models.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,92 @@
|
||||
# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=spandsp - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "spandsp.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "spandsp.mak" CFG="spandsp - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "spandsp - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
|
||||
|
||||
!ELSEIF "$(CFG)" == "spandsp - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
|
||||
# SUBTRACT CPP /WX /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "spandsp - Win32 Release"
|
||||
# Name "spandsp - Win32 Debug"
|
||||
@@ -0,0 +1,5 @@
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libspandsp_sim"
|
||||
ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
|
||||
RootNamespace="libspandsp_sim"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)Debug"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="./Debug\spandsp_sim.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)Release"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="./Release\spandsp_sim.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
@@ -0,0 +1,5 @@
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,254 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="libspandsp_sim"
|
||||
ProjectGUID="{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
|
||||
RootNamespace="libspandsp_sim"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)Debug"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="./Debug\spandsp_sim.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)Release"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="./Release\spandsp_sim.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(TargetDir)spandsp_sim.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="1"
|
||||
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4127"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(TargetDir)spandsp_sim.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: rfc2198_sim.c,v 1.7 2009/02/03 16:28:39 steveu Exp $
|
||||
* $Id: rfc2198_sim.c,v 1.10 2009/06/01 16:27:12 steveu Exp $
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <audiofile.h>
|
||||
#if defined(HAVE_TGMATH_H)
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
@@ -55,11 +54,11 @@
|
||||
#define FALSE 0
|
||||
#define TRUE (!FALSE)
|
||||
|
||||
rfc2198_sim_state_t *rfc2198_sim_init(int model,
|
||||
int speed_pattern,
|
||||
int packet_size,
|
||||
int packet_rate,
|
||||
int redundancy_depth)
|
||||
SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model,
|
||||
int speed_pattern,
|
||||
int packet_size,
|
||||
int packet_rate,
|
||||
int redundancy_depth)
|
||||
{
|
||||
rfc2198_sim_state_t *s;
|
||||
|
||||
@@ -73,11 +72,11 @@ rfc2198_sim_state_t *rfc2198_sim_init(int model,
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int rfc2198_sim_put(rfc2198_sim_state_t *s,
|
||||
const uint8_t buf[],
|
||||
int len,
|
||||
int seq_no,
|
||||
double departure_time)
|
||||
SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s,
|
||||
const uint8_t buf[],
|
||||
int len,
|
||||
int seq_no,
|
||||
double departure_time)
|
||||
{
|
||||
uint8_t buf2[8192];
|
||||
uint8_t *p;
|
||||
@@ -110,19 +109,23 @@ int rfc2198_sim_put(rfc2198_sim_state_t *s,
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int rfc2198_sim_get(rfc2198_sim_state_t *s,
|
||||
uint8_t buf[],
|
||||
int max_len,
|
||||
double current_time,
|
||||
int *seq_no,
|
||||
double *departure_time,
|
||||
double *arrival_time)
|
||||
SPAN_DECLARE(int) rfc2198_sim_get(rfc2198_sim_state_t *s,
|
||||
uint8_t buf[],
|
||||
int max_len,
|
||||
double current_time,
|
||||
int *seq_no,
|
||||
double *departure_time,
|
||||
double *arrival_time)
|
||||
{
|
||||
int len;
|
||||
int lenx;
|
||||
int seq_nox;
|
||||
int i;
|
||||
#if defined(_MSC_VER)
|
||||
uint8_t *bufx = (uint8_t *) _alloca(s->redundancy_depth*1024);
|
||||
#else
|
||||
uint8_t bufx[s->redundancy_depth*1024];
|
||||
#endif
|
||||
uint8_t *p;
|
||||
uint16_t *q;
|
||||
int redundancy_depth;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: g1050.h,v 1.10 2009/01/31 08:48:10 steveu Exp $
|
||||
* $Id: g1050.h,v 1.12 2009/06/01 16:27:12 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -269,12 +269,12 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
SPAN_DECLARE(g1050_state_t) *g1050_init(int model,
|
||||
int speed_pattern,
|
||||
int packet_size,
|
||||
int packet_rate);
|
||||
SPAN_DECLARE(g1050_state_t *) g1050_init(int model,
|
||||
int speed_pattern,
|
||||
int packet_size,
|
||||
int packet_rate);
|
||||
|
||||
void g1050_dump_parms(int model, int speed_pattern);
|
||||
SPAN_DECLARE(void) g1050_dump_parms(int model, int speed_pattern);
|
||||
|
||||
SPAN_DECLARE(int) g1050_put(g1050_state_t *s,
|
||||
const uint8_t buf[],
|
||||
@@ -290,7 +290,7 @@ SPAN_DECLARE(int) g1050_get(g1050_state_t *s,
|
||||
double *departure_time,
|
||||
double *arrival_time);
|
||||
|
||||
void g1050_queue_dump(g1050_state_t *s);
|
||||
SPAN_DECLARE(void) g1050_queue_dump(g1050_state_t *s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: line_model.h,v 1.5 2009/01/31 08:48:10 steveu Exp $
|
||||
* $Id: line_model.h,v 1.6 2009/05/31 14:47:10 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -143,12 +143,12 @@ SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s,
|
||||
|
||||
SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2);
|
||||
|
||||
SPAN_DECLARE(both_ways_line_model_state_t) *both_ways_line_model_init(int model1,
|
||||
float noise1,
|
||||
int model2,
|
||||
float noise2,
|
||||
int codec,
|
||||
int rbs_pattern);
|
||||
SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1,
|
||||
float noise1,
|
||||
int model2,
|
||||
float noise2,
|
||||
int codec,
|
||||
int rbs_pattern);
|
||||
|
||||
SPAN_DECLARE(int) both_ways_line_model_release(both_ways_line_model_state_t *s);
|
||||
|
||||
@@ -161,7 +161,7 @@ SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, floa
|
||||
|
||||
SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level);
|
||||
|
||||
SPAN_DECLARE(one_way_line_model_state_t) *one_way_line_model_init(int model, float noise, int codec, int rbs_pattern);
|
||||
SPAN_DECLARE(one_way_line_model_state_t *) one_way_line_model_init(int model, float noise, int codec, int rbs_pattern);
|
||||
|
||||
SPAN_DECLARE(int) one_way_line_model_release(one_way_line_model_state_t *s);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: rfc2198_sim.h,v 1.5 2009/01/31 08:48:10 steveu Exp $
|
||||
* $Id: rfc2198_sim.h,v 1.6 2009/05/31 14:47:10 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -69,11 +69,11 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
SPAN_DECLARE(rfc2198_sim_state_t) *rfc2198_sim_init(int model,
|
||||
int speed_pattern,
|
||||
int packet_size,
|
||||
int packet_rate,
|
||||
int redundancy_depth);
|
||||
SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model,
|
||||
int speed_pattern,
|
||||
int packet_size,
|
||||
int packet_rate,
|
||||
int redundancy_depth);
|
||||
|
||||
SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s,
|
||||
const uint8_t buf[],
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: test_utils.h,v 1.7 2009/01/31 08:48:10 steveu Exp $
|
||||
* $Id: test_utils.h,v 1.9 2009/05/31 14:47:10 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -30,7 +30,7 @@
|
||||
#if !defined(_TEST_UTILS_H_)
|
||||
#define _TEST_UTILS_H_
|
||||
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -51,7 +51,7 @@ typedef struct complexify_state_s complexify_state_t;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
SPAN_DECLARE(complexify_state_t) *complexify_init(void);
|
||||
SPAN_DECLARE(complexify_state_t *) complexify_init(void);
|
||||
|
||||
SPAN_DECLARE(void) complexify_release(complexify_state_t *s);
|
||||
|
||||
@@ -61,15 +61,15 @@ SPAN_DECLARE(void) fft(complex_t data[], int len);
|
||||
|
||||
SPAN_DECLARE(void) ifft(complex_t data[], int len);
|
||||
|
||||
SPAN_DECLARE(codec_munge_state_t) *codec_munge_init(int codec, int info);
|
||||
SPAN_DECLARE(codec_munge_state_t *) codec_munge_init(int codec, int info);
|
||||
|
||||
SPAN_DECLARE(void) codec_munge_release(codec_munge_state_t *s);
|
||||
|
||||
SPAN_DECLARE(void) codec_munge(codec_munge_state_t *s, int16_t amp[], int len);
|
||||
|
||||
SPAN_DECLARE(AFfilehandle) afOpenFile_telephony_read(const char *name, int channels);
|
||||
SPAN_DECLARE(SNDFILE *) sf_open_telephony_read(const char *name, int channels);
|
||||
|
||||
SPAN_DECLARE(AFfilehandle) afOpenFile_telephony_write(const char *name, int channels);
|
||||
SPAN_DECLARE(SNDFILE *) sf_open_telephony_write(const char *name, int channels);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: test_utils.c,v 1.12 2009/02/03 16:28:39 steveu Exp $
|
||||
* $Id: test_utils.c,v 1.14 2009/06/01 16:27:12 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "floating_fudge.h"
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
#include "spandsp.h"
|
||||
@@ -72,7 +72,7 @@ static int circle_init = FALSE;
|
||||
static complex_t icircle[MAX_FFT_LEN/2];
|
||||
static int icircle_init = FALSE;
|
||||
|
||||
SPAN_DECLARE(complexify_state_t) *complexify_init(void)
|
||||
SPAN_DECLARE(complexify_state_t *) complexify_init(void)
|
||||
{
|
||||
complexify_state_t *s;
|
||||
int i;
|
||||
@@ -261,7 +261,7 @@ SPAN_DECLARE(void) ifft(complex_t data[], int len)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(codec_munge_state_t) *codec_munge_init(int codec, int info)
|
||||
SPAN_DECLARE(codec_munge_state_t *) codec_munge_init(int codec, int info)
|
||||
{
|
||||
codec_munge_state_t *s;
|
||||
|
||||
@@ -351,29 +351,25 @@ SPAN_DECLARE(void) codec_munge(codec_munge_state_t *s, int16_t amp[], int len)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(AFfilehandle) afOpenFile_telephony_read(const char *name, int channels)
|
||||
SPAN_DECLARE(SNDFILE *) sf_open_telephony_read(const char *name, int channels)
|
||||
{
|
||||
float x;
|
||||
AFfilehandle handle;
|
||||
SNDFILE *handle;
|
||||
SF_INFO info;
|
||||
|
||||
if ((handle = afOpenFile(name, "r", 0)) == AF_NULL_FILEHANDLE)
|
||||
memset(&info, 0, sizeof(info));
|
||||
if ((handle = sf_open(name, SFM_READ, &info)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", name);
|
||||
fprintf(stderr, " Cannot open audio file '%s' for reading\n", name);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetFrameSize(handle, AF_DEFAULT_TRACK, 1)) != 2.0)
|
||||
if (info.samplerate != SAMPLE_RATE)
|
||||
{
|
||||
fprintf(stderr, " Unexpected frame size in wave file '%s'\n", name);
|
||||
printf(" Unexpected sample rate in audio file '%s'\n", name);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetRate(handle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
|
||||
if (info.channels != channels)
|
||||
{
|
||||
printf(" Unexpected sample rate in wave file '%s'\n", name);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetChannels(handle, AF_DEFAULT_TRACK)) != (float) channels)
|
||||
{
|
||||
printf(" Unexpected number of channels in wave file '%s'\n", name);
|
||||
printf(" Unexpected number of channels in audio file '%s'\n", name);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@@ -381,27 +377,24 @@ SPAN_DECLARE(AFfilehandle) afOpenFile_telephony_read(const char *name, int chann
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(AFfilehandle) afOpenFile_telephony_write(const char *name, int channels)
|
||||
SPAN_DECLARE(SNDFILE *) sf_open_telephony_write(const char *name, int channels)
|
||||
{
|
||||
AFfilesetup setup;
|
||||
AFfilehandle handle;
|
||||
SNDFILE *handle;
|
||||
SF_INFO info;
|
||||
|
||||
if ((setup = afNewFileSetup()) == AF_NULL_FILESETUP)
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.frames = 0;
|
||||
info.samplerate = SAMPLE_RATE;
|
||||
info.channels = channels;
|
||||
info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
|
||||
info.sections = 1;
|
||||
info.seekable = 1;
|
||||
|
||||
if ((handle = sf_open(name, SFM_WRITE, &info)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " %s: Failed to create file setup\n", name);
|
||||
fprintf(stderr, " Cannot open audio file '%s' for writing\n", name);
|
||||
exit(2);
|
||||
}
|
||||
afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afInitRate(setup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
|
||||
afInitFileFormat(setup, AF_FILE_WAVE);
|
||||
afInitChannels(setup, AF_DEFAULT_TRACK, channels);
|
||||
|
||||
if ((handle = afOpenFile(name, "w", setup)) == AF_NULL_FILEHANDLE)
|
||||
{
|
||||
fprintf(stderr, " Failed to open result file\n");
|
||||
exit(2);
|
||||
}
|
||||
afFreeFileSetup(setup);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<!-- FAX test scripts -->
|
||||
<!ELEMENT fax-tests (config|messages|test-group)* >
|
||||
<!ELEMENT config (path)* >
|
||||
<!ATTLIST path
|
||||
type CDATA #REQUIRED
|
||||
value CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT messages (message)* >
|
||||
<!ELEMENT message (EMPTY)* >
|
||||
<!ATTLIST message
|
||||
type CDATA #REQUIRED
|
||||
value CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT test-group (test)* >
|
||||
<!ATTLIST test-group
|
||||
name CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT test (step|possible-step)* >
|
||||
<!ATTLIST test
|
||||
name CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT possible-step (step)* >
|
||||
|
||||
<!ELEMENT step (check|EMPTY)* >
|
||||
<!ATTLIST step
|
||||
dir CDATA #IMPLIED
|
||||
type CDATA #IMPLIED
|
||||
modem CDATA #IMPLIED
|
||||
tag CDATA #IMPLIED
|
||||
value CDATA #IMPLIED
|
||||
timeout CDATA #IMPLIED
|
||||
crc_error CDATA #IMPLIED
|
||||
pattern CDATA #IMPLIED
|
||||
bad_rows CDATA #IMPLIED
|
||||
min_bits CDATA #IMPLIED
|
||||
frame_size CDATA #IMPLIED
|
||||
compression CDATA #IMPLIED
|
||||
block CDATA #IMPLIED
|
||||
xxx CDATA #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT check (EMPTY)* >
|
||||
<!ATTLIST check
|
||||
name CDATA #IMPLIED
|
||||
desc CDATA #IMPLIED
|
||||
>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fax-tests SYSTEM "./fax-tests.dtd">
|
||||
<fax-tests>
|
||||
<!-- $Id: tsb85.xml,v 1.21 2008/09/12 14:41:55 steveu Exp $ -->
|
||||
<!-- $Id: tsb85.xml,v 1.22 2009/05/24 07:18:36 steveu Exp $ -->
|
||||
<config>
|
||||
<path type="IMAGE" value="../test-data/etsi/fax"/>
|
||||
</config>
|
||||
@@ -2202,7 +2202,7 @@
|
||||
|
||||
<step type="WAIT" value="75"/>
|
||||
<step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
|
||||
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" min_bits="302" frame_size="256"/>
|
||||
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" min_bits="303" frame_size="256"/>
|
||||
<step dir="T" type="POSTAMBLE"/>
|
||||
<step type="WAIT" value="75"/>
|
||||
<step dir="T" type="PREAMBLE" modem="V.21"/>
|
||||
@@ -2541,8 +2541,8 @@
|
||||
|
||||
<step type="WAIT" value="75"/>
|
||||
<!-- UNKNOWN_BCS_1 -->
|
||||
<step dir="T" type="HDLC" modem="V.21" tag="GARBAGE" value="FF C0 00"/>
|
||||
<step dir="T" type="POSTAMBLE"/>
|
||||
<step dir="T" type="PREAMBLE" modem="V.21" value="37"/>
|
||||
<step dir="T" type="HDLC" tag="GARBAGE" value="FF C0 00"/>
|
||||
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 50 00"/>
|
||||
<step dir="T" type="POSTAMBLE"/>
|
||||
<step type="WAIT" value="75"/>
|
||||
@@ -5513,7 +5513,7 @@
|
||||
|
||||
<step dir="R" type="CNG"/>
|
||||
|
||||
<step type="WAIT" value="140001"/>
|
||||
<step type="WAIT" value="40001"/>
|
||||
<step dir="T" type="CED"/>
|
||||
<step type="WAIT" value="75"/>
|
||||
<step dir="T" type="PREAMBLE" modem="V.21"/>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
## License along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Id: Makefile.am,v 1.130 2009/04/16 13:09:40 steveu Exp $
|
||||
## $Id: Makefile.am,v 1.134 2009/06/02 11:51:57 steveu Exp $
|
||||
|
||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||
@@ -24,7 +24,6 @@ AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = floating_fudge.h \
|
||||
spandsp/version.h.in \
|
||||
libspandsp.dsp \
|
||||
libspandsp.2005.sln \
|
||||
libspandsp.2008.sln \
|
||||
@@ -42,19 +41,20 @@ EXTRA_DIST = floating_fudge.h \
|
||||
msvc/make_at_dictionary.2008.vcproj \
|
||||
msvc/make_modem_filter.2005.vcproj \
|
||||
msvc/make_modem_filter.2008.vcproj \
|
||||
msvc/spandsp.h \
|
||||
msvc/unistd.h \
|
||||
msvc/tgmath.h \
|
||||
msvc/msvcproj.head \
|
||||
msvc/msvcproj.foot \
|
||||
msvc/util.vbs \
|
||||
msvc/vc8proj.head \
|
||||
msvc/vc8proj.foot \
|
||||
msvc/vc9proj.head \
|
||||
msvc/vc9proj.foot \
|
||||
msvc/sys/time.h \
|
||||
msvc/spandsp.h \
|
||||
msvc/tgmath.h \
|
||||
msvc/tiff/cleancount \
|
||||
spandsp/private/README
|
||||
msvc/unistd.h \
|
||||
msvc/util.vbs \
|
||||
msvc/vc8proj.foot \
|
||||
msvc/vc8proj.head \
|
||||
msvc/vc9proj.foot \
|
||||
msvc/vc9proj.head \
|
||||
msvc/sys/time.h \
|
||||
spandsp/private/README \
|
||||
spandsp/version.h.in
|
||||
|
||||
INCLUDES = -I$(top_builddir)
|
||||
|
||||
@@ -139,7 +139,7 @@ libspandsp_la_SOURCES = adsi.c \
|
||||
vector_float.c \
|
||||
vector_int.c
|
||||
|
||||
libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_FLAGS)
|
||||
libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
|
||||
|
||||
nobase_include_HEADERS = spandsp/adsi.h \
|
||||
spandsp/async.h \
|
||||
@@ -277,8 +277,8 @@ noinst_HEADERS = faxfont.h \
|
||||
lpc10_encdecs.h \
|
||||
t30_local.h \
|
||||
t4_states.h \
|
||||
v17rx_constellation_maps.h \
|
||||
v17tx_constellation_maps.h \
|
||||
v17_v32bis_rx_constellation_maps.h \
|
||||
v17_v32bis_tx_constellation_maps.h \
|
||||
v29tx_constellation_maps.h
|
||||
|
||||
noinst_PROGRAMS = make_at_dictionary \
|
||||
@@ -301,25 +301,25 @@ t4.$(OBJEXT): spandsp/version.h
|
||||
|
||||
t4.lo: spandsp/version.h
|
||||
|
||||
v17rx.$(OBJEXT): v17rx_fixed_rrc.h v17rx_floating_rrc.h
|
||||
v17rx.$(OBJEXT): v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h
|
||||
|
||||
v17rx.lo: v17rx_fixed_rrc.h v17rx_floating_rrc.h
|
||||
v17rx.lo: v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h
|
||||
|
||||
v17rx_fixed_rrc.h: make_modem_filter$(EXEEXT)
|
||||
./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17rx_fixed_rrc.h
|
||||
v17_v32bis_rx_fixed_rrc.h: make_modem_filter$(EXEEXT)
|
||||
./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17_v32bis_rx_fixed_rrc.h
|
||||
|
||||
v17rx_floating_rrc.h: make_modem_filter$(EXEEXT)
|
||||
./make_modem_filter$(EXEEXT) -m V.17 -r >v17rx_floating_rrc.h
|
||||
v17_v32bis_rx_floating_rrc.h: make_modem_filter$(EXEEXT)
|
||||
./make_modem_filter$(EXEEXT) -m V.17 -r >v17_v32bis_rx_floating_rrc.h
|
||||
|
||||
v17tx.$(OBJEXT): v17tx_fixed_rrc.h v17tx_floating_rrc.h
|
||||
v17tx.$(OBJEXT): v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h
|
||||
|
||||
v17tx.lo: v17tx_fixed_rrc.h v17tx_floating_rrc.h
|
||||
v17tx.lo: v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h
|
||||
|
||||
v17tx_fixed_rrc.h: make_modem_filter$(EXEEXT)
|
||||
./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17tx_fixed_rrc.h
|
||||
v17_v32bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT)
|
||||
./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17_v32bis_tx_fixed_rrc.h
|
||||
|
||||
v17tx_floating_rrc.h: make_modem_filter$(EXEEXT)
|
||||
./make_modem_filter$(EXEEXT) -m V.17 -t >v17tx_floating_rrc.h
|
||||
v17_v32bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT)
|
||||
./make_modem_filter$(EXEEXT) -m V.17 -t >v17_v32bis_tx_floating_rrc.h
|
||||
|
||||
v22bis_rx.$(OBJEXT): v22bis_rx_1200_fixed_rrc.h \
|
||||
v22bis_rx_2400_fixed_rrc.h \
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: fax.c,v 1.92 2009/04/23 15:48:21 steveu Exp $
|
||||
* $Id: fax.c,v 1.93 2009/05/24 07:18:36 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -98,7 +98,7 @@
|
||||
#include "spandsp/private/t30.h"
|
||||
#include "spandsp/private/fax.h"
|
||||
|
||||
#define HDLC_FRAMING_OK_THRESHOLD 5
|
||||
#define HDLC_FRAMING_OK_THRESHOLD 8
|
||||
|
||||
static void fax_send_hdlc(void *user_data, const uint8_t *msg, int len)
|
||||
{
|
||||
@@ -387,7 +387,7 @@ static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_t
|
||||
{
|
||||
put_bit_func = (put_bit_func_t) hdlc_rx_put_bit;
|
||||
put_bit_user_data = (void *) &t->hdlc_rx;
|
||||
hdlc_rx_init(&t->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
|
||||
hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: fsk.c,v 1.58 2009/04/01 13:22:40 steveu Exp $
|
||||
* $Id: fsk.c,v 1.59 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: hdlc.c,v 1.71 2009/02/12 12:38:39 steveu Exp $
|
||||
* $Id: hdlc.c,v 1.72 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -264,7 +264,7 @@ SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte)
|
||||
SPAN_DECLARE_NONSTD(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -282,7 +282,7 @@ SPAN_DECLARE(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len)
|
||||
SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -440,7 +440,7 @@ SPAN_DECLARE(int) hdlc_tx_corrupt_frame(hdlc_tx_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
|
||||
SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
|
||||
{
|
||||
int i;
|
||||
int byte_in_progress;
|
||||
@@ -561,7 +561,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len)
|
||||
SPAN_DECLARE_NONSTD(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len)
|
||||
{
|
||||
size_t i;
|
||||
int x;
|
||||
|
||||
@@ -12,6 +12,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.20
|
||||
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2005.vcproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
|
||||
{DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330}
|
||||
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2005.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}
|
||||
|
||||
@@ -12,6 +12,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.20
|
||||
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_line_models", "..\spandsp-sim\msvc\make_line_models.2008.vcproj", "{F290BADE-82DE-4037-B49D-D563E43169DA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2008.vcproj", "{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libtiff.2008.vcproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}
|
||||
@@ -91,6 +101,15 @@ Global
|
||||
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
|
||||
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64
|
||||
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64
|
||||
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.ActiveCfg = Release|Win32
|
||||
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.Build.0 = Release|Win32
|
||||
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|x64.ActiveCfg = Release|Win32
|
||||
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.Build.0 = Release|Win32
|
||||
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|x64.ActiveCfg = Release|Win32
|
||||
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64
|
||||
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64
|
||||
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64
|
||||
@@ -174,6 +193,15 @@ Global
|
||||
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.Build.0 = Release|Win32
|
||||
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|x64.ActiveCfg = Release|Win32
|
||||
{F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.ActiveCfg = All|Win32
|
||||
{F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.Build.0 = All|Win32
|
||||
{F290BADE-82DE-4037-B49D-D563E43169DA}.All|x64.ActiveCfg = All|Win32
|
||||
{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.ActiveCfg = All|Win32
|
||||
{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.Build.0 = All|Win32
|
||||
{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|x64.ActiveCfg = All|Win32
|
||||
{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.ActiveCfg = All|Win32
|
||||
{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.Build.0 = All|Win32
|
||||
{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|x64.ActiveCfg = All|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: make_modem_filter.c,v 1.14 2009/02/10 17:16:57 steveu Exp $
|
||||
* $Id: make_modem_filter.c,v 1.15 2009/06/02 11:51:57 steveu Exp $
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@@ -355,6 +355,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
if (strcmp(modem, "V.17") == 0)
|
||||
{
|
||||
/* This applies to V.32bis as well as V.17 */
|
||||
rx_coeff_sets = 192;
|
||||
rx_coeffs_per_filter = 27;
|
||||
rx_excess_bandwidth = 0.5;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: modem_connect_tones.c,v 1.35 2009/02/16 09:57:22 steveu Exp $
|
||||
* $Id: modem_connect_tones.c,v 1.37 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -88,8 +88,8 @@ SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone)
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s,
|
||||
int16_t amp[],
|
||||
int len)
|
||||
int16_t amp[],
|
||||
int len)
|
||||
{
|
||||
int16_t mod;
|
||||
int i;
|
||||
@@ -354,7 +354,9 @@ static void v21_put_bit(void *user_data, int bit)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, const int16_t amp[], int len)
|
||||
SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s,
|
||||
const int16_t amp[],
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
int16_t notched;
|
||||
@@ -399,6 +401,10 @@ SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, cons
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MODEM_CONNECT_TONES_FAX_PREAMBLE:
|
||||
/* Ignore any CED tone, and just look for V.21 preamble. */
|
||||
fsk_rx(&(s->v21rx), amp, len);
|
||||
break;
|
||||
case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE:
|
||||
/* Also look for V.21 preamble. A lot of machines don't send the 2100Hz burst. It
|
||||
might also not be seen all the way through the channel, due to switching delays. */
|
||||
@@ -520,6 +526,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
|
||||
s->tone_type = tone_type;
|
||||
switch (s->tone_type)
|
||||
{
|
||||
case MODEM_CONNECT_TONES_FAX_PREAMBLE:
|
||||
case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE:
|
||||
fsk_rx_init(&(s->v21rx), &preset_fsk_specs[FSK_V21CH2], TRUE, v21_put_bit, s);
|
||||
fsk_rx_signal_cutoff(&(s->v21rx), -45.5f);
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef __int8 __int8_t;
|
||||
typedef __int16 __int16_t;
|
||||
typedef __int32 __int32_t;
|
||||
typedef __int64 __int64_t;
|
||||
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
@@ -28,11 +33,11 @@ typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
|
||||
#define INT16_MAX 0x7fff
|
||||
#define INT16_MAX 0x7FFF
|
||||
#define INT16_MIN (-INT16_MAX - 1)
|
||||
|
||||
#if !defined(INFINITY)
|
||||
#define INFINITY 0x7fffffff
|
||||
#define INFINITY 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
#define INT32_MAX (2147483647)
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine=""$(TargetPath)" -m V.17 -i -r >"$(ProjectDir)..\v17rx_fixed_rrc.h"
"$(TargetPath)" -m V.17 -r >"$(ProjectDir)..\v17rx_floating_rrc.h"

"$(TargetPath)" -m V.17 -i -t >"$(ProjectDir)..\v17tx_fixed_rrc.h"
"$(TargetPath)" -m V.17 -t >"$(ProjectDir)..\v17tx_floating_rrc.h"

"$(TargetPath)" -m V.22bis1200 -i -r >"$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h"
"$(TargetPath)" -m V.22bis2400 -i -r >"$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.22bis1200 -r >"$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h"
"$(TargetPath)" -m V.22bis2400 -r >"$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h"
"$(TargetPath)" -m V.22bis -i -t >"$(ProjectDir)..\v22bis_tx_fixed_rrc.h"
"$(TargetPath)" -m V.22bis -t >"$(ProjectDir)..\v22bis_tx_floating_rrc.h"

"$(TargetPath)" -m V.27ter2400 -i -r >"$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.27ter4800 -i -r >"$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h"
"$(TargetPath)" -m V.27ter2400 -r >"$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h"
"$(TargetPath)" -m V.27ter4800 -r >"$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h"
"$(TargetPath)" -m V.27ter2400 -i -t >"$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.27ter4800 -i -t >"$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h"
"$(TargetPath)" -m V.27ter2400 -t >"$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h"
"$(TargetPath)" -m V.27ter4800 -t >"$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h"

"$(TargetPath)" -m V.29 -i -r >"$(ProjectDir)..\v29rx_fixed_rrc.h"
"$(TargetPath)" -m V.29 -r >"$(ProjectDir)..\v29rx_floating_rrc.h"
"$(TargetPath)" -m V.29 -i -t >"$(ProjectDir)..\v29tx_fixed_rrc.h"
"$(TargetPath)" -m V.29 -t >"$(ProjectDir)..\v29tx_floating_rrc.h"

"
|
||||
CommandLine=""$(TargetPath)" -m V.17 -i -r >"$(ProjectDir)..\v17_v32bis_rx_fixed_rrc.h"
"$(TargetPath)" -m V.17 -r >"$(ProjectDir)..\v17_v32bis_rx_floating_rrc.h"

"$(TargetPath)" -m V.17 -i -t >"$(ProjectDir)..\v17_v32bis_tx_fixed_rrc.h"
"$(TargetPath)" -m V.17 -t >"$(ProjectDir)..\v17_v32bis_tx_floating_rrc.h"

"$(TargetPath)" -m V.22bis1200 -i -r >"$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h"
"$(TargetPath)" -m V.22bis2400 -i -r >"$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.22bis1200 -r >"$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h"
"$(TargetPath)" -m V.22bis2400 -r >"$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h"
"$(TargetPath)" -m V.22bis -i -t >"$(ProjectDir)..\v22bis_tx_fixed_rrc.h"
"$(TargetPath)" -m V.22bis -t >"$(ProjectDir)..\v22bis_tx_floating_rrc.h"

"$(TargetPath)" -m V.27ter2400 -i -r >"$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.27ter4800 -i -r >"$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h"
"$(TargetPath)" -m V.27ter2400 -r >"$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h"
"$(TargetPath)" -m V.27ter4800 -r >"$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h"
"$(TargetPath)" -m V.27ter2400 -i -t >"$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.27ter4800 -i -t >"$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h"
"$(TargetPath)" -m V.27ter2400 -t >"$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h"
"$(TargetPath)" -m V.27ter4800 -t >"$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h"

"$(TargetPath)" -m V.29 -i -r >"$(ProjectDir)..\v29rx_fixed_rrc.h"
"$(TargetPath)" -m V.29 -r >"$(ProjectDir)..\v29rx_floating_rrc.h"
"$(TargetPath)" -m V.29 -i -t >"$(ProjectDir)..\v29tx_fixed_rrc.h"
"$(TargetPath)" -m V.29 -t >"$(ProjectDir)..\v29tx_floating_rrc.h"
"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine=""$(TargetPath)" -m V.17 -i -r >"$(ProjectDir)..\v17rx_fixed_rrc.h"
"$(TargetPath)" -m V.17 -r >"$(ProjectDir)..\v17rx_floating_rrc.h"

"$(TargetPath)" -m V.17 -i -t >"$(ProjectDir)..\v17tx_fixed_rrc.h"
"$(TargetPath)" -m V.17 -t >"$(ProjectDir)..\v17tx_floating_rrc.h"

"$(TargetPath)" -m V.22bis1200 -i -r >"$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h"
"$(TargetPath)" -m V.22bis2400 -i -r >"$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.22bis1200 -r >"$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h"
"$(TargetPath)" -m V.22bis2400 -r >"$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h"
"$(TargetPath)" -m V.22bis -i -t >"$(ProjectDir)..\v22bis_tx_fixed_rrc.h"
"$(TargetPath)" -m V.22bis -t >"$(ProjectDir)..\v22bis_tx_floating_rrc.h"

"$(TargetPath)" -m V.27ter2400 -i -r >"$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.27ter4800 -i -r >"$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h"
"$(TargetPath)" -m V.27ter2400 -r >"$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h"
"$(TargetPath)" -m V.27ter4800 -r >"$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h"
"$(TargetPath)" -m V.27ter2400 -i -t >"$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.27ter4800 -i -t >"$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h"
"$(TargetPath)" -m V.27ter2400 -t >"$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h"
"$(TargetPath)" -m V.27ter4800 -t >"$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h"

"$(TargetPath)" -m V.29 -i -r >"$(ProjectDir)..\v29rx_fixed_rrc.h"
"$(TargetPath)" -m V.29 -r >"$(ProjectDir)..\v29rx_floating_rrc.h"
"$(TargetPath)" -m V.29 -i -t >"$(ProjectDir)..\v29tx_fixed_rrc.h"
"$(TargetPath)" -m V.29 -t >"$(ProjectDir)..\v29tx_floating_rrc.h"
"
|
||||
CommandLine=""$(TargetPath)" -m V.17 -i -r >"$(ProjectDir)..\v17_v32bis_rx_fixed_rrc.h"
"$(TargetPath)" -m V.17 -r >"$(ProjectDir)..\v17_v32bis_rx_floating_rrc.h"

"$(TargetPath)" -m V.17 -i -t >"$(ProjectDir)..\v17_v32bis_tx_fixed_rrc.h"
"$(TargetPath)" -m V.17 -t >"$(ProjectDir)..\v17_v32bis_tx_floating_rrc.h"

"$(TargetPath)" -m V.22bis1200 -i -r >"$(ProjectDir)..\v22bis_rx_1200_fixed_rrc.h"
"$(TargetPath)" -m V.22bis2400 -i -r >"$(ProjectDir)..\v22bis_rx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.22bis1200 -r >"$(ProjectDir)..\v22bis_rx_1200_floating_rrc.h"
"$(TargetPath)" -m V.22bis2400 -r >"$(ProjectDir)..\v22bis_rx_2400_floating_rrc.h"
"$(TargetPath)" -m V.22bis -i -t >"$(ProjectDir)..\v22bis_tx_fixed_rrc.h"
"$(TargetPath)" -m V.22bis -t >"$(ProjectDir)..\v22bis_tx_floating_rrc.h"

"$(TargetPath)" -m V.27ter2400 -i -r >"$(ProjectDir)..\v27ter_rx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.27ter4800 -i -r >"$(ProjectDir)..\v27ter_rx_4800_fixed_rrc.h"
"$(TargetPath)" -m V.27ter2400 -r >"$(ProjectDir)..\v27ter_rx_2400_floating_rrc.h"
"$(TargetPath)" -m V.27ter4800 -r >"$(ProjectDir)..\v27ter_rx_4800_floating_rrc.h"
"$(TargetPath)" -m V.27ter2400 -i -t >"$(ProjectDir)..\v27ter_tx_2400_fixed_rrc.h"
"$(TargetPath)" -m V.27ter4800 -i -t >"$(ProjectDir)..\v27ter_tx_4800_fixed_rrc.h"
"$(TargetPath)" -m V.27ter2400 -t >"$(ProjectDir)..\v27ter_tx_2400_floating_rrc.h"
"$(TargetPath)" -m V.27ter4800 -t >"$(ProjectDir)..\v27ter_tx_4800_floating_rrc.h"

"$(TargetPath)" -m V.29 -i -r >"$(ProjectDir)..\v29rx_fixed_rrc.h"
"$(TargetPath)" -m V.29 -r >"$(ProjectDir)..\v29rx_floating_rrc.h"
"$(TargetPath)" -m V.29 -i -t >"$(ProjectDir)..\v29tx_fixed_rrc.h"
"$(TargetPath)" -m V.29 -t >"$(ProjectDir)..\v29tx_floating_rrc.h"
"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
AdditionalIncludeDirectories=".;..\..\src\spandsp;..\..\src;..\..\src\msvc;.\spandsp;.\msvc;..\..\tiff-3.8.2\libtiff"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: power_meter.c,v 1.28 2009/02/10 13:06:46 steveu Exp $
|
||||
* $Id: power_meter.c,v 1.31 2009/05/30 17:29:23 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -122,7 +122,7 @@ SPAN_DECLARE(int32_t) power_meter_current(power_meter_t *s)
|
||||
SPAN_DECLARE(float) power_meter_current_dbm0(power_meter_t *s)
|
||||
{
|
||||
if (s->reading <= 0)
|
||||
return FLT_MIN;
|
||||
return -96.329f + DBM0_MAX_POWER;
|
||||
/* This is based on A-law, but u-law is only 0.03dB different, so don't worry. */
|
||||
return log10f((float) s->reading/(32767.0f*32767.0f))*10.0f + DBM0_MAX_POWER;
|
||||
}
|
||||
@@ -131,8 +131,84 @@ SPAN_DECLARE(float) power_meter_current_dbm0(power_meter_t *s)
|
||||
SPAN_DECLARE(float) power_meter_current_dbov(power_meter_t *s)
|
||||
{
|
||||
if (s->reading <= 0)
|
||||
return FLT_MIN;
|
||||
return -96.329f;
|
||||
return log10f((float) s->reading/(32767.0f*32767.0f))*10.0f;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int16_t amp)
|
||||
{
|
||||
int32_t pow_short;
|
||||
int32_t pow_medium;
|
||||
|
||||
pow_short = power_meter_update(&s->short_term, amp);
|
||||
pow_medium = power_meter_update(&s->medium_term, amp);
|
||||
if (pow_medium < s->min)
|
||||
return 0;
|
||||
if (!s->signal_present)
|
||||
{
|
||||
if (pow_short <= s->surge*(pow_medium >> 10))
|
||||
return 0;
|
||||
s->signal_present = TRUE;
|
||||
s->medium_term.reading = s->short_term.reading;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pow_short < s->sag*(pow_medium >> 10))
|
||||
{
|
||||
s->signal_present = FALSE;
|
||||
s->medium_term.reading = s->short_term.reading;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return pow_short;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(float) power_surge_detector_current_dbm0(power_surge_detector_state_t *s)
|
||||
{
|
||||
return power_meter_current_dbm0(&s->short_term);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(float) power_surge_detector_current_dbov(power_surge_detector_state_t *s)
|
||||
{
|
||||
return power_meter_current_dbov(&s->short_term);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_surge_detector_state_t *s, float min, float surge)
|
||||
{
|
||||
float ratio;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (power_surge_detector_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
memset(s, 0, sizeof(*s));
|
||||
power_meter_init(&s->short_term, 4);
|
||||
power_meter_init(&s->medium_term, 7);
|
||||
ratio = powf(10.0f, surge/10.0f);
|
||||
s->surge = 1024.0f*ratio;
|
||||
s->sag = 1024.0f/ratio;
|
||||
s->min = power_meter_level_dbm0(min);
|
||||
s->medium_term.reading = s->min + 1;
|
||||
return s;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s)
|
||||
{
|
||||
if (s)
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: silence_gen.c,v 1.21 2009/04/12 03:29:58 steveu Exp $
|
||||
* $Id: silence_gen.c,v 1.22 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: adsi.h,v 1.39 2009/04/11 18:11:19 steveu Exp $
|
||||
* $Id: adsi.h,v 1.40 2009/05/22 16:39:01 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -476,7 +476,8 @@ SPAN_DECLARE(void) adsi_tx_send_alert_tone(adsi_tx_state_t *s);
|
||||
\param len The length of the message.
|
||||
\return The length actually added. If a message is already in progress
|
||||
in the transmitter, this function will return zero, as it will
|
||||
not successfully add the message to the buffer.
|
||||
not successfully add the message to the buffer. If the message is
|
||||
invalid (e.g. it is too long), this function will return -1.
|
||||
*/
|
||||
SPAN_DECLARE(int) adsi_tx_put_message(adsi_tx_state_t *s, const uint8_t *msg, int len);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: expose.h,v 1.12 2009/04/12 03:29:58 steveu Exp $
|
||||
* $Id: expose.h,v 1.13 2009/05/16 03:34:45 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -77,6 +77,7 @@
|
||||
#include <spandsp/private/t38_terminal.h>
|
||||
#include <spandsp/private/t31.h>
|
||||
#include <spandsp/private/v8.h>
|
||||
#include <spandsp/private/v18.h>
|
||||
#include <spandsp/private/v42.h>
|
||||
#include <spandsp/private/v42bis.h>
|
||||
#include <spandsp/private/adsi.h>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: fsk.h,v 1.39 2009/04/01 13:22:40 steveu Exp $
|
||||
* $Id: fsk.h,v 1.40 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: hdlc.h,v 1.44 2009/02/12 12:38:39 steveu Exp $
|
||||
* $Id: hdlc.h,v 1.45 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -160,14 +160,14 @@ SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit);
|
||||
\param s A pointer to an HDLC receiver context.
|
||||
\param new_byte The byte of data.
|
||||
*/
|
||||
SPAN_DECLARE(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte);
|
||||
SPAN_DECLARE_NONSTD(void) hdlc_rx_put_byte(hdlc_rx_state_t *s, int new_byte);
|
||||
|
||||
/*! \brief Put a series of bytes of data to an HDLC receiver.
|
||||
\param s A pointer to an HDLC receiver context.
|
||||
\param buf The buffer of data.
|
||||
\param len The length of the data in the buffer.
|
||||
*/
|
||||
SPAN_DECLARE(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len);
|
||||
SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len);
|
||||
|
||||
/*! \brief Initialise an HDLC transmitter context.
|
||||
\param s A pointer to an HDLC transmitter context.
|
||||
@@ -234,7 +234,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s);
|
||||
\param s A pointer to an HDLC transmitter context.
|
||||
\return The next byte for transmission.
|
||||
*/
|
||||
SPAN_DECLARE(int) hdlc_tx_get_byte(hdlc_tx_state_t *s);
|
||||
SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s);
|
||||
|
||||
/*! \brief Get the next sequence of bytes for transmission.
|
||||
\param s A pointer to an HDLC transmitter context.
|
||||
@@ -242,7 +242,7 @@ SPAN_DECLARE(int) hdlc_tx_get_byte(hdlc_tx_state_t *s);
|
||||
\param max_len The number of bytes to get.
|
||||
\return The number of bytes actually got.
|
||||
*/
|
||||
SPAN_DECLARE(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len);
|
||||
SPAN_DECLARE_NONSTD(int) hdlc_tx_get(hdlc_tx_state_t *s, uint8_t buf[], size_t max_len);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: modem_connect_tones.h,v 1.22 2009/02/10 13:06:47 steveu Exp $
|
||||
* $Id: modem_connect_tones.h,v 1.24 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -72,8 +72,7 @@ enum
|
||||
/*! \brief The ANSam with phase reversals tone is a version of ANS_PR with 20% of 15Hz+-0.1Hz AM
|
||||
modulation, as per V.8 */
|
||||
MODEM_CONNECT_TONES_ANSAM_PR = 5,
|
||||
/*! \brief FAX preamble in a string of V.21 HDLC flag octets. This is only valid as a result of tone
|
||||
detection. It should not be specified as a tone type to transmit or receive. */
|
||||
/*! \brief FAX preamble in a string of V.21 HDLC flag octets. */
|
||||
MODEM_CONNECT_TONES_FAX_PREAMBLE = 6,
|
||||
/*! \brief CED tone is the same as ANS tone. FAX preamble in a string of V.21 HDLC flag octets.
|
||||
This is only valid as a tone type to receive. It is never reported as a detected tone
|
||||
@@ -126,8 +125,8 @@ SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s)
|
||||
\return The number of samples generated.
|
||||
*/
|
||||
SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s,
|
||||
int16_t amp[],
|
||||
int len);
|
||||
int16_t amp[],
|
||||
int len);
|
||||
|
||||
/*! \brief Process a block of samples through an instance of the modem connect
|
||||
tones detector.
|
||||
@@ -136,9 +135,9 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *
|
||||
\param len The number of samples in the array.
|
||||
\return The number of unprocessed samples.
|
||||
*/
|
||||
SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s,
|
||||
const int16_t amp[],
|
||||
int len);
|
||||
SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s,
|
||||
const int16_t amp[],
|
||||
int len);
|
||||
|
||||
/*! \brief Test if a modem_connect tone has been detected.
|
||||
\param s The context.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: power_meter.h,v 1.18 2009/02/10 13:06:47 steveu Exp $
|
||||
* $Id: power_meter.h,v 1.19 2009/05/19 14:15:09 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_POWER_METER_H_)
|
||||
@@ -56,6 +56,16 @@ typedef struct
|
||||
int32_t reading;
|
||||
} power_meter_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
power_meter_t short_term;
|
||||
power_meter_t medium_term;
|
||||
int signal_present;
|
||||
int32_t surge;
|
||||
int32_t sag;
|
||||
int32_t min;
|
||||
} power_surge_detector_state_t;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
@@ -116,6 +126,26 @@ SPAN_DECLARE(int32_t) power_meter_level_dbm0(float level);
|
||||
\return The equivalent power meter reading. */
|
||||
SPAN_DECLARE(int32_t) power_meter_level_dbov(float level);
|
||||
|
||||
SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int16_t amp);
|
||||
|
||||
/*! Get the current surge detector short term meter reading, in dBm0.
|
||||
\brief Get the current surge detector meter reading, in dBm0.
|
||||
\param s The power surge detector context.
|
||||
\return The current power surge detector power reading, in dBm0. */
|
||||
SPAN_DECLARE(float) power_surge_detector_current_dbm0(power_surge_detector_state_t *s);
|
||||
|
||||
/*! Get the current surge detector short term meter reading, in dBOv.
|
||||
\brief Get the current surge detector meter reading, in dBOv.
|
||||
\param s The power surge detector context.
|
||||
\return The current power surge detector power reading, in dBOv. */
|
||||
SPAN_DECLARE(float) power_surge_detector_current_dbov(power_surge_detector_state_t *s);
|
||||
|
||||
SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_surge_detector_state_t *s, float min, float surge);
|
||||
|
||||
SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s);
|
||||
|
||||
SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t38_gateway.h,v 1.3 2009/04/12 14:18:02 steveu Exp $
|
||||
* $Id: t38_gateway.h,v 1.4 2009/05/16 03:34:45 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -168,11 +168,8 @@ typedef struct
|
||||
/*! \brief The type of fast receive modem currently active, which may be T38_NONE */
|
||||
int fast_rx_active;
|
||||
|
||||
/*! \brief TRUE if between DCS and TCF, and we want the fast image modem to
|
||||
start in the T.38 data at a predictable time from the end of the
|
||||
V.21 signal. */
|
||||
int tcf_mode_predictable_modem_start;
|
||||
|
||||
/*! \brief The current timed operation. */
|
||||
int timed_mode;
|
||||
/*! \brief The number of samples until the next timeout event */
|
||||
int samples_to_timeout;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: silence_gen.h,v 1.17 2009/04/12 03:29:58 steveu Exp $
|
||||
* $Id: silence_gen.h,v 1.18 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_SPANDSP_SILENCE_GEN_H_)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: tone_generate.h,v 1.38 2009/02/10 13:06:47 steveu Exp $
|
||||
* $Id: tone_generate.h,v 1.39 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v17rx.h,v 1.63 2009/04/12 04:20:01 steveu Exp $
|
||||
* $Id: v17rx.h,v 1.64 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v17tx.h,v 1.41 2009/04/12 09:12:11 steveu Exp $
|
||||
* $Id: v17tx.h,v 1.42 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v18.h,v 1.3 2009/04/12 09:12:11 steveu Exp $
|
||||
* $Id: v18.h,v 1.5 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -100,7 +100,7 @@ SPAN_DECLARE(int) v18_free(v18_state_t *s);
|
||||
\param max_len The number of samples to be generated.
|
||||
\return The number of samples actually generated.
|
||||
*/
|
||||
SPAN_DECLARE(int) v18_tx(v18_state_t *s, int16_t amp[], int max_len);
|
||||
SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t amp[], int max_len);
|
||||
|
||||
/*! Process a block of received V.18 audio samples.
|
||||
\brief Process a block of received V.18 audio samples.
|
||||
@@ -108,7 +108,7 @@ SPAN_DECLARE(int) v18_tx(v18_state_t *s, int16_t amp[], int max_len);
|
||||
\param amp The audio sample buffer.
|
||||
\param len The number of samples in the buffer.
|
||||
*/
|
||||
SPAN_DECLARE(int) v18_rx(v18_state_t *s, const int16_t amp[], int len);
|
||||
SPAN_DECLARE_NONSTD(int) v18_rx(v18_state_t *s, const int16_t amp[], int len);
|
||||
|
||||
/*! \brief Put a string to a V.18 context's input buffer.
|
||||
\param s The V.18 context.
|
||||
@@ -116,7 +116,8 @@ SPAN_DECLARE(int) v18_rx(v18_state_t *s, const int16_t amp[], int len);
|
||||
\param len The length of the string. If negative, the string is
|
||||
assumed to be a NULL terminated string.
|
||||
\return The number of characters actually added. This may be less than the
|
||||
length of the digit string, if the buffer fills up. */
|
||||
length of the digit string, if the buffer fills up. If the string is
|
||||
invalid, this function will return -1. */
|
||||
SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len);
|
||||
|
||||
/*! Convert a text string to a V.18 DTMF string.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v22bis.h,v 1.42 2009/04/29 12:37:45 steveu Exp $
|
||||
* $Id: v22bis.h,v 1.43 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -87,7 +87,7 @@ extern "C"
|
||||
\param amp The audio sample buffer.
|
||||
\param len The number of samples in the buffer.
|
||||
\return The number of samples unprocessed. */
|
||||
SPAN_DECLARE(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len);
|
||||
SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len);
|
||||
|
||||
/*! Fake processing of a missing block of received V.22bis modem audio samples.
|
||||
(e.g due to packet loss).
|
||||
@@ -135,7 +135,7 @@ SPAN_DECLARE(void) v22bis_rx_set_qam_report_handler(v22bis_state_t *s, qam_repor
|
||||
\param amp The audio sample buffer.
|
||||
\param len The number of samples to be generated.
|
||||
\return The number of samples actually generated. */
|
||||
SPAN_DECLARE(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len);
|
||||
SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len);
|
||||
|
||||
/*! Adjust a V.22bis modem transmit context's power output.
|
||||
\brief Adjust a V.22bis modem transmit context's output power.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v27ter_rx.h,v 1.59 2009/04/12 09:12:11 steveu Exp $
|
||||
* $Id: v27ter_rx.h,v 1.60 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v27ter_tx.h,v 1.41 2009/04/12 09:12:11 steveu Exp $
|
||||
* $Id: v27ter_tx.h,v 1.42 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v29rx.h,v 1.70 2009/04/12 09:12:11 steveu Exp $
|
||||
* $Id: v29rx.h,v 1.71 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v29tx.h,v 1.39 2009/04/12 09:12:11 steveu Exp $
|
||||
* $Id: v29tx.h,v 1.40 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v8.h,v 1.27 2009/02/03 16:28:41 steveu Exp $
|
||||
* $Id: v8.h,v 1.28 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -155,7 +155,7 @@ SPAN_DECLARE(logging_state_t *) v8_get_logging_state(v8_state_t *s);
|
||||
\param max_len The number of samples to be generated.
|
||||
\return The number of samples actually generated.
|
||||
*/
|
||||
SPAN_DECLARE(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len);
|
||||
SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len);
|
||||
|
||||
/*! Process a block of received V.8 audio samples.
|
||||
\brief Process a block of received V.8 audio samples.
|
||||
@@ -163,7 +163,7 @@ SPAN_DECLARE(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len);
|
||||
\param amp The audio sample buffer.
|
||||
\param len The number of samples in the buffer.
|
||||
*/
|
||||
SPAN_DECLARE(int) v8_rx(v8_state_t *s, const int16_t *amp, int len);
|
||||
SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len);
|
||||
|
||||
/*! Log the list of supported modulations.
|
||||
\brief Log the list of supported modulations.
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
|
||||
/* The date and time of the version are in UTC form. */
|
||||
|
||||
#define SPANDSP_RELEASE_DATE 20090502
|
||||
#define SPANDSP_RELEASE_TIME 044449
|
||||
#define SPANDSP_RELEASE_DATETIME_STRING "20090502 044449"
|
||||
#define SPANDSP_RELEASE_DATE 20090602
|
||||
#define SPANDSP_RELEASE_TIME 160509
|
||||
#define SPANDSP_RELEASE_DATETIME_STRING "20090602 160509"
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
|
||||
+52
-27
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t30.c,v 1.298 2009/04/30 18:46:14 steveu Exp $
|
||||
* $Id: t30.c,v 1.301 2009/05/25 12:37:38 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -319,6 +319,11 @@ received. If the timer T8 expires, a DCN command is transmitted for call release
|
||||
variable. */
|
||||
#define PPR_LIMIT_BEFORE_CTC_OR_EOR 4
|
||||
|
||||
/* HDLC message header byte values */
|
||||
#define ADDRESS_FIELD 0xFF
|
||||
#define CONTROL_FIELD_NON_FINAL_FRAME 0x03
|
||||
#define CONTROL_FIELD_FINAL_FRAME 0x13
|
||||
|
||||
enum
|
||||
{
|
||||
TIMER_IS_IDLE = 0,
|
||||
@@ -660,8 +665,8 @@ static int get_partial_ecm_page(t30_state_t *s)
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
s->ecm_len[i] = -1;
|
||||
s->ecm_data[i][0] = 0xFF;
|
||||
s->ecm_data[i][1] = 0x03;
|
||||
s->ecm_data[i][0] = ADDRESS_FIELD;
|
||||
s->ecm_data[i][1] = CONTROL_FIELD_NON_FINAL_FRAME;
|
||||
s->ecm_data[i][2] = T4_FCD;
|
||||
/* These frames contain a frame sequence number within the partial page (one octet) followed
|
||||
by some image data. */
|
||||
@@ -749,8 +754,8 @@ static int send_next_ecm_frame(t30_state_t *s)
|
||||
/* The RCP frame is an odd man out, as its a simple 1 byte control
|
||||
frame, but is specified to not have the final bit set. It doesn't
|
||||
seem to have the DIS received bit set, either. */
|
||||
frame[0] = 0xFF;
|
||||
frame[1] = 0x03;
|
||||
frame[0] = ADDRESS_FIELD;
|
||||
frame[1] = CONTROL_FIELD_NON_FINAL_FRAME;
|
||||
frame[2] = T4_RCP;
|
||||
send_frame(s, frame, 3);
|
||||
/* In case we are just after a CTC/CTR exchange, which kicked us back to long training */
|
||||
@@ -806,8 +811,8 @@ static void send_simple_frame(t30_state_t *s, int type)
|
||||
uint8_t frame[3];
|
||||
|
||||
/* The simple command/response frames are always final frames */
|
||||
frame[0] = 0xFF;
|
||||
frame[1] = 0x13;
|
||||
frame[0] = ADDRESS_FIELD;
|
||||
frame[1] = CONTROL_FIELD_FINAL_FRAME;
|
||||
frame[2] = (uint8_t) (type | s->dis_received);
|
||||
send_frame(s, frame, 3);
|
||||
}
|
||||
@@ -821,8 +826,8 @@ static void send_20digit_msg_frame(t30_state_t *s, int cmd, char *msg)
|
||||
|
||||
len = strlen(msg);
|
||||
p = 0;
|
||||
frame[p++] = 0xFF;
|
||||
frame[p++] = 0x03;
|
||||
frame[p++] = ADDRESS_FIELD;
|
||||
frame[p++] = CONTROL_FIELD_NON_FINAL_FRAME;
|
||||
frame[p++] = (uint8_t) (cmd | s->dis_received);
|
||||
while (len > 0)
|
||||
frame[p++] = msg[--len];
|
||||
@@ -838,8 +843,8 @@ static int send_nsf_frame(t30_state_t *s)
|
||||
if (s->tx_info.nsf && s->tx_info.nsf_len)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSF - %d octets\n", s->tx_info.nsf_len);
|
||||
s->tx_info.nsf[0] = 0xFF;
|
||||
s->tx_info.nsf[1] = 0x03;
|
||||
s->tx_info.nsf[0] = ADDRESS_FIELD;
|
||||
s->tx_info.nsf[1] = CONTROL_FIELD_NON_FINAL_FRAME;
|
||||
s->tx_info.nsf[2] = (uint8_t) (T30_NSF | s->dis_received);
|
||||
send_frame(s, s->tx_info.nsf, s->tx_info.nsf_len + 3);
|
||||
return TRUE;
|
||||
@@ -854,8 +859,8 @@ static int send_nss_frame(t30_state_t *s)
|
||||
if (s->tx_info.nss && s->tx_info.nss_len)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSS - %d octets\n", s->tx_info.nss_len);
|
||||
s->tx_info.nss[0] = 0xFF;
|
||||
s->tx_info.nss[1] = 0x03;
|
||||
s->tx_info.nss[0] = ADDRESS_FIELD;
|
||||
s->tx_info.nss[1] = CONTROL_FIELD_NON_FINAL_FRAME;
|
||||
s->tx_info.nss[2] = (uint8_t) (T30_NSS | s->dis_received);
|
||||
send_frame(s, s->tx_info.nss, s->tx_info.nss_len + 3);
|
||||
return TRUE;
|
||||
@@ -870,8 +875,8 @@ static int send_nsc_frame(t30_state_t *s)
|
||||
if (s->tx_info.nsc && s->tx_info.nsc_len)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Sending user supplied NSC - %d octets\n", s->tx_info.nsc_len);
|
||||
s->tx_info.nsc[0] = 0xFF;
|
||||
s->tx_info.nsc[1] = 0x03;
|
||||
s->tx_info.nsc[0] = ADDRESS_FIELD;
|
||||
s->tx_info.nsc[1] = CONTROL_FIELD_NON_FINAL_FRAME;
|
||||
s->tx_info.nsc[2] = (uint8_t) (T30_NSC | s->dis_received);
|
||||
send_frame(s, s->tx_info.nsc, s->tx_info.nsc_len + 3);
|
||||
return TRUE;
|
||||
@@ -1033,8 +1038,8 @@ static int send_pps_frame(t30_state_t *s)
|
||||
{
|
||||
uint8_t frame[7];
|
||||
|
||||
frame[0] = 0xFF;
|
||||
frame[1] = 0x13;
|
||||
frame[0] = ADDRESS_FIELD;
|
||||
frame[1] = CONTROL_FIELD_FINAL_FRAME;
|
||||
frame[2] = (uint8_t) (T30_PPS | s->dis_received);
|
||||
frame[3] = (s->ecm_at_page_end) ? ((uint8_t) (s->next_tx_step | s->dis_received)) : T30_NULL;
|
||||
frame[4] = (uint8_t) (s->ecm_tx_page & 0xFF);
|
||||
@@ -1074,8 +1079,8 @@ int t30_build_dis_or_dtc(t30_state_t *s)
|
||||
it is sent. It might also be edited if the application changes our
|
||||
capabilities (e.g. disabling fine mode). Right now we set up all the
|
||||
unchanging stuff about what we are capable of doing. */
|
||||
s->local_dis_dtc_frame[0] = 0xFF;
|
||||
s->local_dis_dtc_frame[1] = 0x13;
|
||||
s->local_dis_dtc_frame[0] = ADDRESS_FIELD;
|
||||
s->local_dis_dtc_frame[1] = CONTROL_FIELD_FINAL_FRAME;
|
||||
s->local_dis_dtc_frame[2] = (uint8_t) (T30_DIS | s->dis_received);
|
||||
for (i = 3; i < 19; i++)
|
||||
s->local_dis_dtc_frame[i] = 0x00;
|
||||
@@ -1258,8 +1263,8 @@ static int build_dcs(t30_state_t *s)
|
||||
|
||||
/* Make a DCS frame based on local issues and the latest received DIS/DTC frame. Negotiate
|
||||
the result based on what both parties can do. */
|
||||
s->dcs_frame[0] = 0xFF;
|
||||
s->dcs_frame[1] = 0x13;
|
||||
s->dcs_frame[0] = ADDRESS_FIELD;
|
||||
s->dcs_frame[1] = CONTROL_FIELD_FINAL_FRAME;
|
||||
s->dcs_frame[2] = (uint8_t) (T30_DCS | s->dis_received);
|
||||
for (i = 3; i < 19; i++)
|
||||
s->dcs_frame[i] = 0x00;
|
||||
@@ -1608,6 +1613,7 @@ static void send_dcn(t30_state_t *s)
|
||||
static void return_to_phase_b(t30_state_t *s, int with_fallback)
|
||||
{
|
||||
/* This is what we do after things like T30_EOM is exchanged. */
|
||||
#if 0
|
||||
if (step_fallback_entry(s) < 0)
|
||||
{
|
||||
/* We have fallen back as far as we can go. Give up. */
|
||||
@@ -1622,6 +1628,12 @@ static void return_to_phase_b(t30_state_t *s, int with_fallback)
|
||||
else
|
||||
set_state(s, T30_STATE_R);
|
||||
}
|
||||
#else
|
||||
if (s->calling_party)
|
||||
set_state(s, T30_STATE_T);
|
||||
else
|
||||
set_state(s, T30_STATE_R);
|
||||
#endif
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@@ -2309,8 +2321,8 @@ static int send_deferred_pps_response(t30_state_t *s)
|
||||
{
|
||||
/* We need to send the PPR frame we have created, to try to fill in the missing/bad data. */
|
||||
set_state(s, T30_STATE_F_POST_RCP_PPR);
|
||||
s->ecm_frame_map[0] = 0xFF;
|
||||
s->ecm_frame_map[1] = 0x13;
|
||||
s->ecm_frame_map[0] = ADDRESS_FIELD;
|
||||
s->ecm_frame_map[1] = CONTROL_FIELD_FINAL_FRAME;
|
||||
s->ecm_frame_map[2] = (uint8_t) (T30_PPR | s->dis_received);
|
||||
send_frame(s, s->ecm_frame_map, 3 + 32);
|
||||
}
|
||||
@@ -2474,8 +2486,8 @@ static void process_rx_ppr(t30_state_t *s, const uint8_t *msg, int len)
|
||||
{
|
||||
set_state(s, T30_STATE_IV_EOR);
|
||||
queue_phase(s, T30_PHASE_D_TX);
|
||||
frame[0] = 0xFF;
|
||||
frame[1] = 0x13;
|
||||
frame[0] = ADDRESS_FIELD;
|
||||
frame[1] = CONTROL_FIELD_FINAL_FRAME;
|
||||
frame[2] = (uint8_t) (T30_EOR | s->dis_received);
|
||||
frame[3] = (s->ecm_at_page_end) ? ((uint8_t) (s->next_tx_step | s->dis_received)) : T30_NULL;
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Sending EOR + %s\n", t30_frametype(frame[3]));
|
||||
@@ -5489,7 +5501,7 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
|
||||
*/
|
||||
if (!ok)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Bad CRC received\n");
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC CRC received\n");
|
||||
if (s->phase != T30_PHASE_C_ECM_RX)
|
||||
{
|
||||
/* We either force a resend, or we wait until a resend occurs through a timeout. */
|
||||
@@ -5502,6 +5514,13 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
|
||||
queue_phase(s, T30_PHASE_D_TX);
|
||||
send_simple_frame(s, T30_CRP);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Cancel the command or response timer (if one is running) */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Bad CRC and timer is %d\n", s->timer_t2_t4_is);
|
||||
if (s->timer_t2_t4_is == TIMER_IS_T2A)
|
||||
timer_t2_t4_stop(s);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -5509,11 +5528,17 @@ SPAN_DECLARE_NONSTD(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, i
|
||||
if (len < 3)
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC frame length - %d\n", len);
|
||||
/* Cancel the command or response timer (if one is running) */
|
||||
timer_t2_t4_stop(s);
|
||||
return;
|
||||
}
|
||||
if (msg[0] != 0xFF || !(msg[1] == 0x03 || msg[1] == 0x13))
|
||||
if (msg[0] != ADDRESS_FIELD
|
||||
||
|
||||
!(msg[1] == CONTROL_FIELD_NON_FINAL_FRAME || msg[1] == CONTROL_FIELD_FINAL_FRAME))
|
||||
{
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Bad HDLC frame header - %02x %02x\n", msg[0], msg[1]);
|
||||
/* Cancel the command or response timer (if one is running) */
|
||||
timer_t2_t4_stop(s);
|
||||
return;
|
||||
}
|
||||
s->rx_frame_received = TRUE;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t35.c,v 1.30 2009/04/12 09:12:10 steveu Exp $
|
||||
* $Id: t35.c,v 1.31 2009/05/16 03:34:45 steveu Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -525,7 +525,7 @@ static const model_data_t Muratec48[] =
|
||||
static const nsf_data_t known_nsf[] =
|
||||
{
|
||||
/* Japan */
|
||||
{"\x00\x00\x00", 3, "unknown - indeterminate", TRUE, NULL},
|
||||
{"\x00\x00\x00", 3, "Unknown - indeterminate", TRUE, NULL},
|
||||
{"\x00\x00\x01", 3, "Anjitsu", FALSE, NULL},
|
||||
{"\x00\x00\x02", 3, "Nippon Telephone", FALSE, NULL},
|
||||
{"\x00\x00\x05", 3, "Mitsuba Electric", FALSE, NULL},
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t38_gateway.c,v 1.162 2009/04/12 14:18:02 steveu Exp $
|
||||
* $Id: t38_gateway.c,v 1.163 2009/05/16 03:34:45 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -152,11 +152,12 @@ enum
|
||||
|
||||
enum
|
||||
{
|
||||
TCF_MODE_PREDICTABLE_MODEM_START_OFF = 0,
|
||||
TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED,
|
||||
TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN,
|
||||
TCF_MODE_PREDICTABLE_MODEM_START_PAST_V21_MODEM,
|
||||
TCF_MODE_PREDICTABLE_MODEM_START_BEGIN
|
||||
TIMED_MODE_STARTUP = 0,
|
||||
TIMED_MODE_IDLE,
|
||||
TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED,
|
||||
TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN,
|
||||
TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM,
|
||||
TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN,
|
||||
};
|
||||
|
||||
/*! The maximum number of bytes to be zapped, in order to corrupt NSF,
|
||||
@@ -765,7 +766,7 @@ static void monitor_control_messages(t38_gateway_state_t *s,
|
||||
if (len < 3)
|
||||
return;
|
||||
/*endif*/
|
||||
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_OFF;
|
||||
s->core.timed_mode = TIMED_MODE_IDLE;
|
||||
switch (buf[2])
|
||||
{
|
||||
case T30_CFR:
|
||||
@@ -822,7 +823,7 @@ static void monitor_control_messages(t38_gateway_state_t *s,
|
||||
s->core.image_data_mode = FALSE;
|
||||
s->core.short_train = FALSE;
|
||||
if (from_modem)
|
||||
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_BEGIN;
|
||||
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN;
|
||||
/*endif*/
|
||||
break;
|
||||
case T30_PPS:
|
||||
@@ -1510,14 +1511,14 @@ static void non_ecm_rx_status(void *user_data, int status)
|
||||
switch (status)
|
||||
{
|
||||
case SIG_STATUS_TRAINING_IN_PROGRESS:
|
||||
if (s->core.tcf_mode_predictable_modem_start == TCF_MODE_PREDICTABLE_MODEM_START_OFF)
|
||||
if (s->core.timed_mode == TIMED_MODE_IDLE)
|
||||
{
|
||||
announce_training(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s->core.tcf_mode_predictable_modem_start == TCF_MODE_PREDICTABLE_MODEM_START_PAST_V21_MODEM)
|
||||
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN;
|
||||
if (s->core.timed_mode == TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM)
|
||||
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN;
|
||||
else
|
||||
s->core.samples_to_timeout = ms_to_samples(500);
|
||||
set_fast_packetisation(s);
|
||||
@@ -1529,7 +1530,7 @@ static void non_ecm_rx_status(void *user_data, int status)
|
||||
/* The modem is now trained */
|
||||
s->audio.modems.rx_signal_present = TRUE;
|
||||
s->audio.modems.rx_trained = TRUE;
|
||||
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_OFF;
|
||||
s->core.timed_mode = TIMED_MODE_IDLE;
|
||||
s->core.samples_to_timeout = 0;
|
||||
to_t38_buffer_init(&s->core.to_t38);
|
||||
break;
|
||||
@@ -1546,7 +1547,7 @@ static void non_ecm_rx_status(void *user_data, int status)
|
||||
case T38_DATA_V27TER_4800:
|
||||
case T38_DATA_V29_7200:
|
||||
case T38_DATA_V29_9600:
|
||||
if (s->core.tcf_mode_predictable_modem_start != TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED)
|
||||
if (s->core.timed_mode != TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED)
|
||||
{
|
||||
/* TODO: If the carrier really did fall for good during the 500ms TEP blocking timeout, we
|
||||
won't declare the no-signal condition. */
|
||||
@@ -1716,7 +1717,7 @@ static void hdlc_rx_status(hdlc_rx_state_t *t, int status)
|
||||
t->framing_ok_announced = FALSE;
|
||||
}
|
||||
restart_rx_modem(s);
|
||||
if (s->core.tcf_mode_predictable_modem_start == TCF_MODE_PREDICTABLE_MODEM_START_BEGIN)
|
||||
if (s->core.timed_mode == TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN)
|
||||
{
|
||||
/* If we are doing TCF, we need to announce the fast carrier training very
|
||||
quickly, to ensure it starts 75+-20ms after the HDLC carrier ends. Waiting until
|
||||
@@ -1724,7 +1725,7 @@ static void hdlc_rx_status(hdlc_rx_state_t *t, int status)
|
||||
the end of the V.21 carrier, in anticipation of its arrival. If we announce it,
|
||||
and it doesn't arrive, we will worry about that later. */
|
||||
s->core.samples_to_timeout = ms_to_samples(75);
|
||||
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_PAST_V21_MODEM;
|
||||
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -2001,28 +2002,35 @@ SPAN_DECLARE(int) t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], int len)
|
||||
#if defined(LOG_FAX_AUDIO)
|
||||
if (s->audio.modems.audio_rx_log >= 0)
|
||||
write(s->audio.modems.audio_rx_log, amp, len*sizeof(int16_t));
|
||||
/*endif*/
|
||||
#endif
|
||||
if (s->core.samples_to_timeout > 0)
|
||||
{
|
||||
if ((s->core.samples_to_timeout -= len) <= 0)
|
||||
{
|
||||
switch (s->core.tcf_mode_predictable_modem_start)
|
||||
switch (s->core.timed_mode)
|
||||
{
|
||||
case TCF_MODE_PREDICTABLE_MODEM_START_PAST_V21_MODEM:
|
||||
case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM:
|
||||
/* Timed announcement of training, 75ms after the DCS carrier fell. */
|
||||
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED;
|
||||
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED;
|
||||
announce_training(s);
|
||||
break;
|
||||
case TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN:
|
||||
case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN:
|
||||
/* Timed announcement of training, 75ms after the DCS carrier fell. */
|
||||
/* Use a timeout to ride over TEP, if it is present */
|
||||
s->core.samples_to_timeout = ms_to_samples(500);
|
||||
s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED;
|
||||
announce_training(s);
|
||||
break;
|
||||
case TCF_MODE_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED:
|
||||
s->core.tcf_mode_predictable_modem_start = TCF_MODE_PREDICTABLE_MODEM_START_OFF;
|
||||
case TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_ANNOUNCED:
|
||||
s->core.timed_mode = TIMED_MODE_IDLE;
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "TEP jamming expired\n");
|
||||
break;
|
||||
case TIMED_MODE_STARTUP:
|
||||
/* Ensure a no-signal condition goes out the moment the received audio starts */
|
||||
t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL, s->t38x.t38.indicator_tx_count);
|
||||
s->core.timed_mode = TIMED_MODE_IDLE;
|
||||
break;
|
||||
}
|
||||
/*endswitch*/
|
||||
}
|
||||
@@ -2129,10 +2137,10 @@ SPAN_DECLARE(void) t38_gateway_set_supported_modems(t38_gateway_state_t *s, int
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(void) t38_gateway_set_nsx_suppression(t38_gateway_state_t *s,
|
||||
const uint8_t *from_t38,
|
||||
int from_t38_len,
|
||||
const uint8_t *from_modem,
|
||||
int from_modem_len)
|
||||
const uint8_t *from_t38,
|
||||
int from_t38_len,
|
||||
const uint8_t *from_modem,
|
||||
int from_modem_len)
|
||||
{
|
||||
s->t38x.suppress_nsx_len[0] = (from_t38_len < 0 || from_t38_len < MAX_NSX_SUPPRESSION) ? (from_t38_len + 3) : 0;
|
||||
s->t38x.suppress_nsx_len[1] = (from_modem_len < 0 || from_modem_len < MAX_NSX_SUPPRESSION) ? (from_modem_len + 3) : 0;
|
||||
@@ -2232,6 +2240,8 @@ SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s,
|
||||
s->core.ecm_allowed = FALSE;
|
||||
t38_non_ecm_buffer_init(&s->core.non_ecm_to_modem, FALSE, 0);
|
||||
restart_rx_modem(s);
|
||||
s->core.timed_mode = TIMED_MODE_STARTUP;
|
||||
s->core.samples_to_timeout = 1;
|
||||
#if defined(LOG_FAX_AUDIO)
|
||||
{
|
||||
char buf[100 + 1];
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: t4.c,v 1.130 2009/04/12 09:12:10 steveu Exp $
|
||||
* $Id: t4.c,v 1.131 2009/05/16 03:34:45 steveu Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: tone_generate.c,v 1.52 2009/04/12 09:12:10 steveu Exp $
|
||||
* $Id: tone_generate.c,v 1.53 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* v17_v32bis_tx_constellation_maps.h - ITU V.17 and V.32bis modems
|
||||
* transmit part.
|
||||
* Constellation mapping.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2004 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v17_v32bis_tx_constellation_maps.h,v 1.1 2009/06/02 11:51:57 steveu Exp $
|
||||
*/
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
static const complexi16_t v17_v32bis_14400_constellation[128] =
|
||||
#else
|
||||
static const complexf_t v17_v32bis_14400_constellation[128] =
|
||||
#endif
|
||||
{
|
||||
{-8, -3}, /* 0x00 */
|
||||
{ 9, 2}, /* 0x01 */
|
||||
{ 2, -9}, /* 0x02 */
|
||||
{-3, 8}, /* 0x03 */
|
||||
{ 8, 3}, /* 0x04 */
|
||||
{-9, -2}, /* 0x05 */
|
||||
{-2, 9}, /* 0x06 */
|
||||
{ 3, -8}, /* 0x07 */
|
||||
{-8, 1}, /* 0x08 */
|
||||
{ 9, -2}, /* 0x09 */
|
||||
{-2, -9}, /* 0x0A */
|
||||
{ 1, 8}, /* 0x0B */
|
||||
{ 8, -1}, /* 0x0C */
|
||||
{-9, 2}, /* 0x0D */
|
||||
{ 2, 9}, /* 0x0E */
|
||||
{-1, -8}, /* 0x0F */
|
||||
{-4, -3}, /* 0x10 */
|
||||
{ 5, 2}, /* 0x11 */
|
||||
{ 2, -5}, /* 0x12 */
|
||||
{-3, 4}, /* 0x13 */
|
||||
{ 4, 3}, /* 0x14 */
|
||||
{-5, -2}, /* 0x15 */
|
||||
{-2, 5}, /* 0x16 */
|
||||
{ 3, -4}, /* 0x17 */
|
||||
{-4, 1}, /* 0x18 */
|
||||
{ 5, -2}, /* 0x19 */
|
||||
{-2, -5}, /* 0x1A */
|
||||
{ 1, 4}, /* 0x1B */
|
||||
{ 4, -1}, /* 0x1C */
|
||||
{-5, 2}, /* 0x1D */
|
||||
{ 2, 5}, /* 0x1E */
|
||||
{-1, -4}, /* 0x1F */
|
||||
{ 4, -3}, /* 0x20 */
|
||||
{-3, 2}, /* 0x21 */
|
||||
{ 2, 3}, /* 0x22 */
|
||||
{-3, -4}, /* 0x23 */
|
||||
{-4, 3}, /* 0x24 */
|
||||
{ 3, -2}, /* 0x25 */
|
||||
{-2, -3}, /* 0x26 */
|
||||
{ 3, 4}, /* 0x27 */
|
||||
{ 4, 1}, /* 0x28 */
|
||||
{-3, -2}, /* 0x29 */
|
||||
{-2, 3}, /* 0x2A */
|
||||
{ 1, -4}, /* 0x2B */
|
||||
{-4, -1}, /* 0x2C */
|
||||
{ 3, 2}, /* 0x2D */
|
||||
{ 2, -3}, /* 0x2E */
|
||||
{-1, 4}, /* 0x2F */
|
||||
{ 0, -3}, /* 0x30 */
|
||||
{ 1, 2}, /* 0x31 */
|
||||
{ 2, -1}, /* 0x32 */
|
||||
{-3, 0}, /* 0x33 */
|
||||
{ 0, 3}, /* 0x34 */
|
||||
{-1, -2}, /* 0x35 */
|
||||
{-2, 1}, /* 0x36 */
|
||||
{ 3, 0}, /* 0x37 */
|
||||
{ 0, 1}, /* 0x38 */
|
||||
{ 1, -2}, /* 0x39 */
|
||||
{-2, -1}, /* 0x3A */
|
||||
{ 1, 0}, /* 0x3B */
|
||||
{ 0, -1}, /* 0x3C */
|
||||
{-1, 2}, /* 0x3D */
|
||||
{ 2, 1}, /* 0x3E */
|
||||
{-1, 0}, /* 0x3F */
|
||||
{ 8, -3}, /* 0x40 */
|
||||
{-7, 2}, /* 0x41 */
|
||||
{ 2, 7}, /* 0x42 */
|
||||
{-3, -8}, /* 0x43 */
|
||||
{-8, 3}, /* 0x44 */
|
||||
{ 7, -2}, /* 0x45 */
|
||||
{-2, -7}, /* 0x46 */
|
||||
{ 3, 8}, /* 0x47 */
|
||||
{ 8, 1}, /* 0x48 */
|
||||
{-7, -2}, /* 0x49 */
|
||||
{-2, 7}, /* 0x4A */
|
||||
{ 1, -8}, /* 0x4B */
|
||||
{-8, -1}, /* 0x4C */
|
||||
{ 7, 2}, /* 0x4D */
|
||||
{ 2, -7}, /* 0x4E */
|
||||
{-1, 8}, /* 0x4F */
|
||||
{-4, -7}, /* 0x50 */
|
||||
{ 5, 6}, /* 0x51 */
|
||||
{ 6, -5}, /* 0x52 */
|
||||
{-7, 4}, /* 0x53 */
|
||||
{ 4, 7}, /* 0x54 */
|
||||
{-5, -6}, /* 0x55 */
|
||||
{-6, 5}, /* 0x56 */
|
||||
{ 7, -4}, /* 0x57 */
|
||||
{-4, 5}, /* 0x58 */
|
||||
{ 5, -6}, /* 0x59 */
|
||||
{-6, -5}, /* 0x5A */
|
||||
{ 5, 4}, /* 0x5B */
|
||||
{ 4, -5}, /* 0x5C */
|
||||
{-5, 6}, /* 0x5D */
|
||||
{ 6, 5}, /* 0x5E */
|
||||
{-5, -4}, /* 0x5F */
|
||||
{ 4, -7}, /* 0x60 */
|
||||
{-3, 6}, /* 0x61 */
|
||||
{ 6, 3}, /* 0x62 */
|
||||
{-7, -4}, /* 0x63 */
|
||||
{-4, 7}, /* 0x64 */
|
||||
{ 3, -6}, /* 0x65 */
|
||||
{-6, -3}, /* 0x66 */
|
||||
{ 7, 4}, /* 0x67 */
|
||||
{ 4, 5}, /* 0x68 */
|
||||
{-3, -6}, /* 0x69 */
|
||||
{-6, 3}, /* 0x6A */
|
||||
{ 5, -4}, /* 0x6B */
|
||||
{-4, -5}, /* 0x6C */
|
||||
{ 3, 6}, /* 0x6D */
|
||||
{ 6, -3}, /* 0x6E */
|
||||
{-5, 4}, /* 0x6F */
|
||||
{ 0, -7}, /* 0x70 */
|
||||
{ 1, 6}, /* 0x71 */
|
||||
{ 6, -1}, /* 0x72 */
|
||||
{-7, 0}, /* 0x73 */
|
||||
{ 0, 7}, /* 0x74 */
|
||||
{-1, -6}, /* 0x75 */
|
||||
{-6, 1}, /* 0x76 */
|
||||
{ 7, 0}, /* 0x77 */
|
||||
{ 0, 5}, /* 0x78 */
|
||||
{ 1, -6}, /* 0x79 */
|
||||
{-6, -1}, /* 0x7A */
|
||||
{ 5, 0}, /* 0x7B */
|
||||
{ 0, -5}, /* 0x7C */
|
||||
{-1, 6}, /* 0x7D */
|
||||
{ 6, 1}, /* 0x7E */
|
||||
{-5, 0} /* 0x7F */
|
||||
};
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
static const complexi16_t v17_v32bis_12000_constellation[64] =
|
||||
#else
|
||||
static const complexf_t v17_v32bis_12000_constellation[64] =
|
||||
#endif
|
||||
{
|
||||
{ 7, 1}, /* 0x00 */
|
||||
{-5, -1}, /* 0x01 */
|
||||
{-1, 5}, /* 0x02 */
|
||||
{ 1, -7}, /* 0x03 */
|
||||
{-7, -1}, /* 0x04 */
|
||||
{ 5, 1}, /* 0x05 */
|
||||
{ 1, -5}, /* 0x06 */
|
||||
{-1, 7}, /* 0x07 */
|
||||
{ 3, -3}, /* 0x08 */
|
||||
{-1, 3}, /* 0x09 */
|
||||
{ 3, 1}, /* 0x0A */
|
||||
{-3, -3}, /* 0x0B */
|
||||
{-3, 3}, /* 0x0C */
|
||||
{ 1, -3}, /* 0x0D */
|
||||
{-3, -1}, /* 0x0E */
|
||||
{ 3, 3}, /* 0x0F */
|
||||
{ 7, -7}, /* 0x10 */
|
||||
{-5, 7}, /* 0x11 */
|
||||
{ 7, 5}, /* 0x12 */
|
||||
{-7, -7}, /* 0x13 */
|
||||
{-7, 7}, /* 0x14 */
|
||||
{ 5, -7}, /* 0x15 */
|
||||
{-7, -5}, /* 0x16 */
|
||||
{ 7, 7}, /* 0x17 */
|
||||
{-1, -7}, /* 0x18 */
|
||||
{ 3, 7}, /* 0x19 */
|
||||
{ 7, -3}, /* 0x1A */
|
||||
{-7, 1}, /* 0x1B */
|
||||
{ 1, 7}, /* 0x1C */
|
||||
{-3, -7}, /* 0x1D */
|
||||
{-7, 3}, /* 0x1E */
|
||||
{ 7, -1}, /* 0x1F */
|
||||
{ 3, 5}, /* 0x20 */
|
||||
{-1, -5}, /* 0x21 */
|
||||
{-5, 1}, /* 0x22 */
|
||||
{ 5, -3}, /* 0x23 */
|
||||
{-3, -5}, /* 0x24 */
|
||||
{ 1, 5}, /* 0x25 */
|
||||
{ 5, -1}, /* 0x26 */
|
||||
{-5, 3}, /* 0x27 */
|
||||
{-1, 1}, /* 0x28 */
|
||||
{ 3, -1}, /* 0x29 */
|
||||
{-1, -3}, /* 0x2A */
|
||||
{ 1, 1}, /* 0x2B */
|
||||
{ 1, -1}, /* 0x2C */
|
||||
{-3, 1}, /* 0x2D */
|
||||
{ 1, 3}, /* 0x2E */
|
||||
{-1, -1}, /* 0x2F */
|
||||
{-5, 5}, /* 0x30 */
|
||||
{ 7, -5}, /* 0x31 */
|
||||
{-5, -7}, /* 0x32 */
|
||||
{ 5, 5}, /* 0x33 */
|
||||
{ 5, -5}, /* 0x34 */
|
||||
{-7, 5}, /* 0x35 */
|
||||
{ 5, 7}, /* 0x36 */
|
||||
{-5, -5}, /* 0x37 */
|
||||
{-5, -3}, /* 0x38 */
|
||||
{ 7, 3}, /* 0x39 */
|
||||
{ 3, -7}, /* 0x3A */
|
||||
{-3, 5}, /* 0x3B */
|
||||
{ 5, 3}, /* 0x3C */
|
||||
{-7, -3}, /* 0x3D */
|
||||
{-3, 7}, /* 0x3E */
|
||||
{ 3, -5} /* 0x3F */
|
||||
};
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
static const complexi16_t v17_v32bis_9600_constellation[32] =
|
||||
#else
|
||||
static const complexf_t v17_v32bis_9600_constellation[32] =
|
||||
#endif
|
||||
{
|
||||
{-8, 2}, /* 0x00 */
|
||||
{-6, -4}, /* 0x01 */
|
||||
{-4, 6}, /* 0x02 */
|
||||
{ 2, 8}, /* 0x03 */
|
||||
{ 8, -2}, /* 0x04 */
|
||||
{ 6, 4}, /* 0x05 */
|
||||
{ 4, -6}, /* 0x06 */
|
||||
{-2, -8}, /* 0x07 */
|
||||
{ 0, 2}, /* 0x08 */
|
||||
{-6, 4}, /* 0x09 */
|
||||
{ 4, 6}, /* 0x0A */
|
||||
{ 2, 0}, /* 0x0B */
|
||||
{ 0, -2}, /* 0x0C */
|
||||
{ 6, -4}, /* 0x0D */
|
||||
{-4, -6}, /* 0x0E */
|
||||
{-2, 0}, /* 0x0F */
|
||||
{ 0, -6}, /* 0x10 */
|
||||
{ 2, -4}, /* 0x11 */
|
||||
{-4, -2}, /* 0x12 */
|
||||
{-6, 0}, /* 0x13 */
|
||||
{ 0, 6}, /* 0x14 */
|
||||
{-2, 4}, /* 0x15 */
|
||||
{ 4, 2}, /* 0x16 */
|
||||
{ 6, 0}, /* 0x17 */
|
||||
{ 8, 2}, /* 0x18 */
|
||||
{ 2, 4}, /* 0x19 */
|
||||
{ 4, -2}, /* 0x1A */
|
||||
{ 2, -8}, /* 0x1B */
|
||||
{-8, -2}, /* 0x1C */
|
||||
{-2, -4}, /* 0x1D */
|
||||
{-4, 2}, /* 0x1E */
|
||||
{-2, 8} /* 0x1F */
|
||||
};
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
static const complexi16_t v17_v32bis_7200_constellation[16] =
|
||||
#else
|
||||
static const complexf_t v17_v32bis_7200_constellation[16] =
|
||||
#endif
|
||||
{
|
||||
{ 6, -6}, /* 0x00 */
|
||||
{-2, 6}, /* 0x01 */
|
||||
{ 6, 2}, /* 0x02 */
|
||||
{-6, -6}, /* 0x03 */
|
||||
{-6, 6}, /* 0x04 */
|
||||
{ 2, -6}, /* 0x05 */
|
||||
{-6, -2}, /* 0x06 */
|
||||
{ 6, 6}, /* 0x07 */
|
||||
{-2, 2}, /* 0x08 */
|
||||
{ 6, -2}, /* 0x09 */
|
||||
{-2, -6}, /* 0x0A */
|
||||
{ 2, 2}, /* 0x0B */
|
||||
{ 2, -2}, /* 0x0C */
|
||||
{-6, 2}, /* 0x0D */
|
||||
{ 2, 6}, /* 0x0E */
|
||||
{-2, -2} /* 0x0F */
|
||||
};
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
static const complexi16_t v17_v32bis_4800_constellation[4] =
|
||||
#else
|
||||
static const complexf_t v17_v32bis_4800_constellation[4] =
|
||||
#endif
|
||||
{
|
||||
{-6, -2},
|
||||
{ 2, -6},
|
||||
{ 6, 2},
|
||||
{-2, 6}
|
||||
};
|
||||
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
+83
-86
@@ -23,7 +23,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v17rx.c,v 1.146 2009/04/21 13:59:07 steveu Exp $
|
||||
* $Id: v17rx.c,v 1.149 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -64,12 +64,12 @@
|
||||
#include "spandsp/private/logging.h"
|
||||
#include "spandsp/private/v17rx.h"
|
||||
|
||||
#include "v17tx_constellation_maps.h"
|
||||
#include "v17rx_constellation_maps.h"
|
||||
#include "v17_v32bis_tx_constellation_maps.h"
|
||||
#include "v17_v32bis_rx_constellation_maps.h"
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
#include "v17rx_fixed_rrc.h"
|
||||
#include "v17_v32bis_rx_fixed_rrc.h"
|
||||
#else
|
||||
#include "v17rx_floating_rrc.h"
|
||||
#include "v17_v32bis_rx_floating_rrc.h"
|
||||
#endif
|
||||
|
||||
/*! The nominal frequency of the carrier, in Hertz */
|
||||
@@ -295,18 +295,6 @@ static int descramble(v17_rx_state_t *s, int in_bit)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ int find_quadrant(complexf_t *z)
|
||||
{
|
||||
int b1;
|
||||
int b2;
|
||||
|
||||
/* Split the space along the two diagonals. */
|
||||
b1 = (z->im > z->re);
|
||||
b2 = (z->im < -z->re);
|
||||
return (b2 << 1) | (b1 ^ b2);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static void track_carrier(v17_rx_state_t *s, const complexf_t *z, const complexf_t *target)
|
||||
{
|
||||
float error;
|
||||
@@ -1008,12 +996,81 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ int signal_detect(v17_rx_state_t *s, int16_t amp)
|
||||
{
|
||||
int16_t diff;
|
||||
int16_t x;
|
||||
int32_t power;
|
||||
|
||||
/* There should be no DC in the signal, but sometimes there is.
|
||||
We need to measure the power with the DC blocked, but not using
|
||||
a slow to respond DC blocker. Use the most elementary HPF. */
|
||||
x = amp >> 1;
|
||||
/* There could be overflow here, but it isn't a problem in practice */
|
||||
diff = x - s->last_sample;
|
||||
s->last_sample = x;
|
||||
power = power_meter_update(&(s->power), diff);
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Quick power drop fudge */
|
||||
diff = abs(diff);
|
||||
if (10*diff < s->high_sample)
|
||||
{
|
||||
if (++s->low_samples > 120)
|
||||
{
|
||||
power_meter_init(&(s->power), 4);
|
||||
s->high_sample = 0;
|
||||
s->low_samples = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s->low_samples = 0;
|
||||
if (diff > s->high_sample)
|
||||
s->high_sample = diff;
|
||||
}
|
||||
#endif
|
||||
if (s->signal_present > 0)
|
||||
{
|
||||
/* Look for power below turn-off threshold to turn the carrier off */
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
if (s->carrier_drop_pending || power < s->carrier_off_power)
|
||||
#else
|
||||
if (power < s->carrier_off_power)
|
||||
#endif
|
||||
{
|
||||
if (--s->signal_present <= 0)
|
||||
{
|
||||
/* Count down a short delay, to ensure we push the last
|
||||
few bits through the filters before stopping. */
|
||||
v17_rx_restart(s, s->bit_rate, s->short_train);
|
||||
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
|
||||
return 0;
|
||||
}
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Carrier has dropped, but the put_bit is pending the signal_present delay. */
|
||||
s->carrier_drop_pending = TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Look for power exceeding turn-on threshold to turn the carrier on */
|
||||
if (power < s->carrier_on_power)
|
||||
return 0;
|
||||
s->signal_present = 1;
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
s->carrier_drop_pending = FALSE;
|
||||
#endif
|
||||
report_status_change(s, SIG_STATUS_CARRIER_UP);
|
||||
}
|
||||
return power;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len)
|
||||
{
|
||||
int i;
|
||||
int step;
|
||||
int16_t x;
|
||||
int16_t diff;
|
||||
complexf_t z;
|
||||
complexf_t zz;
|
||||
complexf_t sample;
|
||||
@@ -1033,68 +1090,8 @@ SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len)
|
||||
if (++s->rrc_filter_step >= V17_RX_FILTER_STEPS)
|
||||
s->rrc_filter_step = 0;
|
||||
|
||||
/* There should be no DC in the signal, but sometimes there is.
|
||||
We need to measure the power with the DC blocked, but not using
|
||||
a slow to respond DC blocker. Use the most elementary HPF. */
|
||||
x = amp[i] >> 1;
|
||||
/* There could be overflow here, but it isn't a problem in practice */
|
||||
diff = x - s->last_sample;
|
||||
power = power_meter_update(&(s->power), diff);
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Quick power drop fudge */
|
||||
diff = abs(diff);
|
||||
if (10*diff < s->high_sample)
|
||||
{
|
||||
if (++s->low_samples > 120)
|
||||
{
|
||||
power_meter_init(&(s->power), 4);
|
||||
s->high_sample = 0;
|
||||
s->low_samples = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s->low_samples = 0;
|
||||
if (diff > s->high_sample)
|
||||
s->high_sample = diff;
|
||||
}
|
||||
#endif
|
||||
s->last_sample = x;
|
||||
if (s->signal_present)
|
||||
{
|
||||
/* Look for power below turnoff threshold to turn the carrier off */
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
if (s->carrier_drop_pending || power < s->carrier_off_power)
|
||||
#else
|
||||
if (power < s->carrier_off_power)
|
||||
#endif
|
||||
{
|
||||
if (--s->signal_present <= 0)
|
||||
{
|
||||
/* Count down a short delay, to ensure we push the last
|
||||
few bits through the filters before stopping. */
|
||||
v17_rx_restart(s, s->bit_rate, s->short_train);
|
||||
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
|
||||
continue;
|
||||
}
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Carrier has dropped, but the put_bit is
|
||||
pending the signal_present delay. */
|
||||
s->carrier_drop_pending = TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Look for power exceeding turnon threshold to turn the carrier on */
|
||||
if (power < s->carrier_on_power)
|
||||
continue;
|
||||
s->signal_present = 1;
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
s->carrier_drop_pending = FALSE;
|
||||
#endif
|
||||
report_status_change(s, SIG_STATUS_CARRIER_UP);
|
||||
}
|
||||
if ((power = signal_detect(s, amp[i])) == 0)
|
||||
continue;
|
||||
if (s->training_stage == TRAINING_STAGE_PARKED)
|
||||
continue;
|
||||
/* Only spend effort processing this data if the modem is not
|
||||
@@ -1171,7 +1168,7 @@ SPAN_DECLARE(int) v17_rx_fillin(v17_rx_state_t *s, int len)
|
||||
/* We want to sustain the current state (i.e carrier on<->carrier off), and
|
||||
try to sustain the carrier phase. We should probably push the filters, as well */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
|
||||
if (!s->signal_present)
|
||||
if (s->signal_present <= 0)
|
||||
return 0;
|
||||
if (s->training_stage == TRAINING_STAGE_PARKED)
|
||||
return 0;
|
||||
@@ -1220,22 +1217,22 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai
|
||||
switch (bit_rate)
|
||||
{
|
||||
case 14400:
|
||||
s->constellation = v17_14400_constellation;
|
||||
s->constellation = v17_v32bis_14400_constellation;
|
||||
s->space_map = 0;
|
||||
s->bits_per_symbol = 6;
|
||||
break;
|
||||
case 12000:
|
||||
s->constellation = v17_12000_constellation;
|
||||
s->constellation = v17_v32bis_12000_constellation;
|
||||
s->space_map = 1;
|
||||
s->bits_per_symbol = 5;
|
||||
break;
|
||||
case 9600:
|
||||
s->constellation = v17_9600_constellation;
|
||||
s->constellation = v17_v32bis_9600_constellation;
|
||||
s->space_map = 2;
|
||||
s->bits_per_symbol = 4;
|
||||
break;
|
||||
case 7200:
|
||||
s->constellation = v17_7200_constellation;
|
||||
s->constellation = v17_v32bis_7200_constellation;
|
||||
s->space_map = 3;
|
||||
s->bits_per_symbol = 3;
|
||||
break;
|
||||
|
||||
+12
-12
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v17tx.c,v 1.73 2009/04/21 13:59:07 steveu Exp $
|
||||
* $Id: v17tx.c,v 1.75 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -62,11 +62,11 @@
|
||||
#define SPANDSP_USE_FIXED_POINTx
|
||||
#endif
|
||||
|
||||
#include "v17tx_constellation_maps.h"
|
||||
#include "v17_v32bis_tx_constellation_maps.h"
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
#include "v17tx_fixed_rrc.h"
|
||||
#include "v17_v32bis_tx_fixed_rrc.h"
|
||||
#else
|
||||
#include "v17tx_floating_rrc.h"
|
||||
#include "v17_v32bis_tx_floating_rrc.h"
|
||||
#endif
|
||||
|
||||
/*! The nominal frequency of the carrier, in Hertz */
|
||||
@@ -135,7 +135,7 @@ static __inline__ complexf_t training_get(v17_tx_state_t *s)
|
||||
if (s->training_step <= V17_TRAINING_SEG_TEP_B)
|
||||
{
|
||||
/* Optional segment: Unmodulated carrier (talker echo protection) */
|
||||
return v17_abcd_constellation[0];
|
||||
return v17_v32bis_4800_constellation[0];
|
||||
}
|
||||
if (s->training_step <= V17_TRAINING_SEG_1)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ static __inline__ complexf_t training_get(v17_tx_state_t *s)
|
||||
return zero;
|
||||
}
|
||||
/* Segment 1: ABAB... */
|
||||
return v17_abcd_constellation[(s->training_step & 1) ^ 1];
|
||||
return v17_v32bis_4800_constellation[(s->training_step & 1) ^ 1];
|
||||
}
|
||||
/* Segment 2: CDBA... */
|
||||
/* Apply the scrambler */
|
||||
@@ -155,7 +155,7 @@ static __inline__ complexf_t training_get(v17_tx_state_t *s)
|
||||
/* Go straight to the ones test. */
|
||||
s->training_step = V17_TRAINING_SEG_4;
|
||||
}
|
||||
return v17_abcd_constellation[s->constellation_state];
|
||||
return v17_v32bis_4800_constellation[s->constellation_state];
|
||||
}
|
||||
/* Segment 3: Bridge... */
|
||||
shift = ((s->training_step - V17_TRAINING_SEG_3 - 1) & 0x7) << 1;
|
||||
@@ -163,7 +163,7 @@ static __inline__ complexf_t training_get(v17_tx_state_t *s)
|
||||
bits = scramble(s, V17_BRIDGE_WORD >> shift);
|
||||
bits = (bits << 1) | scramble(s, V17_BRIDGE_WORD >> (shift + 1));
|
||||
s->constellation_state = (s->constellation_state + dibit_to_step[bits]) & 3;
|
||||
return v17_abcd_constellation[s->constellation_state];
|
||||
return v17_v32bis_4800_constellation[s->constellation_state];
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@@ -359,19 +359,19 @@ SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int s
|
||||
{
|
||||
case 14400:
|
||||
s->bits_per_symbol = 6;
|
||||
s->constellation = v17_14400_constellation;
|
||||
s->constellation = v17_v32bis_14400_constellation;
|
||||
break;
|
||||
case 12000:
|
||||
s->bits_per_symbol = 5;
|
||||
s->constellation = v17_12000_constellation;
|
||||
s->constellation = v17_v32bis_12000_constellation;
|
||||
break;
|
||||
case 9600:
|
||||
s->bits_per_symbol = 4;
|
||||
s->constellation = v17_9600_constellation;
|
||||
s->constellation = v17_v32bis_9600_constellation;
|
||||
break;
|
||||
case 7200:
|
||||
s->bits_per_symbol = 3;
|
||||
s->constellation = v17_7200_constellation;
|
||||
s->constellation = v17_v32bis_7200_constellation;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
|
||||
+72
-62
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v18.c,v 1.7 2009/04/26 07:00:38 steveu Exp $
|
||||
* $Id: v18.c,v 1.10 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -379,50 +379,50 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
|
||||
{
|
||||
static const uint8_t conv[128] =
|
||||
{
|
||||
0x00, /* NUL */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* NUL */
|
||||
0xFF, /* SOH */
|
||||
0xFF, /* STX */
|
||||
0xFF, /* ETX */
|
||||
0xFF, /* EOT */
|
||||
0xFF, /* ENQ */
|
||||
0xFF, /* ACK */
|
||||
0xFF, /* BEL */
|
||||
0x00, /* BS */
|
||||
0x44, /* HT >> SPACE */
|
||||
0x42, /* LF */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0x42, /* VT >> LF */
|
||||
0x42, /* FF >> LF */
|
||||
0x48, /* CR */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* */
|
||||
0xFF, /* SO */
|
||||
0xFF, /* SI */
|
||||
0xFF, /* DLE */
|
||||
0xFF, /* DC1 */
|
||||
0xFF, /* DC2 */
|
||||
0xFF, /* DC3 */
|
||||
0xFF, /* DC4 */
|
||||
0xFF, /* NAK */
|
||||
0xFF, /* SYN */
|
||||
0xFF, /* ETB */
|
||||
0xFF, /* CAN */
|
||||
0xFF, /* EM */
|
||||
0x99, /* SUB >> ? */
|
||||
0xFF, /* ESC */
|
||||
0x42, /* IS4 >> LF */
|
||||
0x42, /* IS3 >> LF */
|
||||
0x42, /* IS2 >> LF */
|
||||
0x44, /* IS1 >> SPACE */
|
||||
0x44, /* */
|
||||
0xFF, /* ! */
|
||||
0xFF, /* " */
|
||||
0x94, /* # */
|
||||
0x8D, /* ! */
|
||||
0x91, /* " */
|
||||
0x89, /* # >> $ */
|
||||
0x89, /* $ */
|
||||
0xFF, /* % */
|
||||
0xFF, /* & */
|
||||
0x85, /* ' */
|
||||
0x9D, /* % >> / */
|
||||
0x9A, /* & >> + */
|
||||
0x8B, /* ' */
|
||||
0x8F, /* ( */
|
||||
0x92, /* ) */
|
||||
0x8B, /* * */
|
||||
0x91, /* + */
|
||||
0x9C, /* * >> . */
|
||||
0x9A, /* + */
|
||||
0x8C, /* , */
|
||||
0x83, /* - */
|
||||
0x9C, /* . */
|
||||
@@ -438,12 +438,12 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
|
||||
0x86, /* 8 */
|
||||
0x98, /* 9 */
|
||||
0x8E, /* : */
|
||||
0xFF, /* ; */
|
||||
0xFF, /* < */
|
||||
0x9E, /* = */
|
||||
0xFF, /* > */
|
||||
0x9E, /* ; */
|
||||
0x8F, /* < >> )*/
|
||||
0x94, /* = */
|
||||
0x92, /* > >> ( */
|
||||
0x99, /* ? */
|
||||
0xFF, /* @ */
|
||||
0x1D, /* @ >> X */
|
||||
0x03, /* A */
|
||||
0x19, /* B */
|
||||
0x0E, /* C */
|
||||
@@ -470,12 +470,12 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
|
||||
0x1D, /* X */
|
||||
0x15, /* Y */
|
||||
0x11, /* Z */
|
||||
0xFF, /* [ */
|
||||
0xFF, /* \ */
|
||||
0xFF, /* ] */
|
||||
0x9B, /* ^ */
|
||||
0xFF, /* _ */
|
||||
0xFF, /* ` */
|
||||
0x8F, /* [ >> (*/
|
||||
0x9D, /* \ >> / */
|
||||
0x92, /* ] >> ) */
|
||||
0x8B, /* ^ >> ' */
|
||||
0x44, /* _ >> Space */
|
||||
0x8B, /* ` >> ' */
|
||||
0x03, /* a */
|
||||
0x19, /* b */
|
||||
0x0E, /* c */
|
||||
@@ -502,19 +502,29 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
|
||||
0x1D, /* x */
|
||||
0x15, /* y */
|
||||
0x11, /* z */
|
||||
0xFF, /* { */
|
||||
0xFF, /* | */
|
||||
0xFF, /* } */
|
||||
0xFF, /* ~ */
|
||||
0x8F, /* { >> ( */
|
||||
0x8D, /* | >> ! */
|
||||
0x92, /* } >> ) */
|
||||
0x44, /* ~ >> Space */
|
||||
0xFF, /* DEL */
|
||||
};
|
||||
uint16_t shift;
|
||||
|
||||
if (ch == 0x7F)
|
||||
{
|
||||
/* DLE is a special character meaning "force a
|
||||
change to the letter character set */
|
||||
shift = BAUDOT_LETTER_SHIFT;
|
||||
return 0;
|
||||
}
|
||||
ch = conv[ch];
|
||||
/* Is it a non-existant code? */
|
||||
if (ch == 0xFF)
|
||||
return 0;
|
||||
/* Is it a code present in both character sets? */
|
||||
if ((ch & 0x40))
|
||||
return ch & 0x1F;
|
||||
return 0x8000 | (ch & 0x1F);
|
||||
/* Need to allow for a possible character set change. */
|
||||
if ((ch & 0x80))
|
||||
{
|
||||
if (s->baudot_tx_shift == 1)
|
||||
@@ -529,7 +539,7 @@ SPAN_DECLARE(uint16_t) v18_encode_baudot(v18_state_t *s, uint8_t ch)
|
||||
s->baudot_tx_shift = 0;
|
||||
shift = BAUDOT_LETTER_SHIFT;
|
||||
}
|
||||
return (shift << 5) | (ch & 0x1F);
|
||||
return 0x8000 | (shift << 5) | (ch & 0x1F);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@@ -537,8 +547,8 @@ SPAN_DECLARE(uint8_t) v18_decode_baudot(v18_state_t *s, uint8_t ch)
|
||||
{
|
||||
static const uint8_t conv[2][32] =
|
||||
{
|
||||
{"\000E\nA SIU\rDRJNFCKTZLWHYPQOBG^MXV^"},
|
||||
{"\0003\n- '87\r$4*,*:(5+)2#6019?*^./=^"}
|
||||
{"\bE\nA SIU\rDRJNFCKTZLWHYPQOBG^MXV^"},
|
||||
{"\b3\n- -87\r$4',!:(5\")2=6019?+^./;^"}
|
||||
};
|
||||
|
||||
switch (ch)
|
||||
@@ -633,7 +643,7 @@ static void v18_tdd_put_async_byte(void *user_data, int byte)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len)
|
||||
SPAN_DECLARE_NONSTD(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len)
|
||||
{
|
||||
int len;
|
||||
int lenx;
|
||||
@@ -661,7 +671,7 @@ SPAN_DECLARE(int) v18_tx(v18_state_t *s, int16_t *amp, int max_len)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) v18_rx(v18_state_t *s, const int16_t amp[], int len)
|
||||
SPAN_DECLARE_NONSTD(int) v18_rx(v18_state_t *s, const int16_t amp[], int len)
|
||||
{
|
||||
switch (s->mode)
|
||||
{
|
||||
@@ -709,11 +719,11 @@ SPAN_DECLARE(int) v18_put(v18_state_t *s, const char msg[], int len)
|
||||
buf[n++] = (uint8_t) (x & 0x1F);
|
||||
/* TODO: Deal with out of space condition */
|
||||
if (queue_write(&s->queue.queue, (const uint8_t *) buf, n) < 0)
|
||||
return 0;
|
||||
return i;
|
||||
s->tx_signal_on = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
return len;
|
||||
case V18_MODE_DTMF:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v22bis_rx.c,v 1.67 2009/04/29 12:37:45 steveu Exp $
|
||||
* $Id: v22bis_rx.c,v 1.68 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -691,7 +691,7 @@ static void process_half_baud(v22bis_state_t *s, const complexf_t *sample)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len)
|
||||
SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v22bis_tx.c,v 1.62 2009/04/29 12:37:45 steveu Exp $
|
||||
* $Id: v22bis_tx.c,v 1.63 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -448,7 +448,7 @@ static complexf_t getbaud(v22bis_state_t *s)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len)
|
||||
SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len)
|
||||
{
|
||||
complexf_t x;
|
||||
complexf_t z;
|
||||
|
||||
+119
-158
@@ -23,7 +23,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v27ter_rx.c,v 1.126 2009/04/21 13:59:07 steveu Exp $
|
||||
* $Id: v27ter_rx.c,v 1.130 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -522,13 +522,23 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
|
||||
{
|
||||
0, 4
|
||||
};
|
||||
complexf_t z;
|
||||
complexf_t zz;
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
complexf_t z1;
|
||||
complexi16_t z;
|
||||
const complexi16_t *target;
|
||||
static const complexi16_t zero = {0, 0};
|
||||
#else
|
||||
complexf_t z;
|
||||
const complexf_t *target;
|
||||
static const complexf_t zero = {0.0f, 0.0f};
|
||||
#endif
|
||||
float p;
|
||||
int i;
|
||||
int j;
|
||||
int32_t angle;
|
||||
int32_t ang;
|
||||
int constellation_state;
|
||||
|
||||
/* Add a sample to the equalizer's circular buffer, but don't calculate anything
|
||||
at this time. */
|
||||
@@ -550,16 +560,20 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
|
||||
z = equalizer_get(s);
|
||||
|
||||
//span_log(&s->logging, SPAN_LOG_FLOW, "Equalized symbol - %15.5f %15.5f\n", z.re, z.im);
|
||||
constellation_state = s->constellation_state;
|
||||
switch (s->training_stage)
|
||||
{
|
||||
case TRAINING_STAGE_NORMAL_OPERATION:
|
||||
decode_baud(s, &z);
|
||||
constellation_state = (s->bit_rate == 4800) ? s->constellation_state : (s->constellation_state << 1);
|
||||
target = &v27ter_constellation[constellation_state];
|
||||
break;
|
||||
case TRAINING_STAGE_SYMBOL_ACQUISITION:
|
||||
/* Allow time for the Gardner algorithm to settle the baud timing */
|
||||
/* Don't start narrowing the bandwidth of the Gardner algorithm too early.
|
||||
Some modems are a bit wobbly when they start sending the signal. Also, we start
|
||||
this analysis before our filter buffers have completely filled. */
|
||||
target = &zero;
|
||||
if (++s->training_count >= 30)
|
||||
{
|
||||
s->gardner_step = 32;
|
||||
@@ -570,6 +584,7 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
|
||||
break;
|
||||
case TRAINING_STAGE_LOG_PHASE:
|
||||
/* Record the current alternate phase angle */
|
||||
target = &zero;
|
||||
angle = arctan2(z.im, z.re);
|
||||
s->angles[1] =
|
||||
s->start_angles[1] = angle;
|
||||
@@ -577,6 +592,7 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
|
||||
s->training_stage = TRAINING_STAGE_WAIT_FOR_HOP;
|
||||
break;
|
||||
case TRAINING_STAGE_WAIT_FOR_HOP:
|
||||
target = &zero;
|
||||
angle = arctan2(z.im, z.re);
|
||||
/* Look for the initial ABAB sequence to display a phase reversal, which will
|
||||
signal the start of the scrambled ABAB segment */
|
||||
@@ -634,14 +650,15 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
|
||||
s->eq_buf[i] = complex_mulf(&s->eq_buf[i], &zz);
|
||||
#endif
|
||||
s->carrier_phase += angle;
|
||||
|
||||
s->gardner_step = 2;
|
||||
/* We have just seen the first element of the scrambled sequence so skip it. */
|
||||
s->training_bc = 1;
|
||||
s->training_bc ^= descramble(s, 1);
|
||||
descramble(s, 1);
|
||||
descramble(s, 1);
|
||||
constellation_state =
|
||||
s->constellation_state = abab_pos[s->training_bc];
|
||||
target = &v27ter_constellation[constellation_state];
|
||||
s->training_count = 1;
|
||||
s->training_stage = TRAINING_STAGE_TRAIN_ON_ABAB;
|
||||
report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS);
|
||||
@@ -661,41 +678,40 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
|
||||
s->training_bc ^= descramble(s, 1);
|
||||
descramble(s, 1);
|
||||
descramble(s, 1);
|
||||
constellation_state =
|
||||
s->constellation_state = abab_pos[s->training_bc];
|
||||
track_carrier(s, &z, &v27ter_constellation[s->constellation_state]);
|
||||
tune_equalizer(s, &z, &v27ter_constellation[s->constellation_state]);
|
||||
target = &v27ter_constellation[constellation_state];
|
||||
track_carrier(s, &z, target);
|
||||
tune_equalizer(s, &z, target);
|
||||
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
s->carrier_track_i = 400 + (200000 - 400)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
|
||||
s->carrier_track_p = 1000000 + (10000000 - 1000000)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
|
||||
#else
|
||||
s->carrier_track_i = 400.0f + (200000.0f - 400.0f)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
|
||||
s->carrier_track_p = 1000000.0f + (10000000.0f - 1000000.0f)*(float) (V27TER_TRAINING_SEG_5_LEN - s->training_count)/(float) V27TER_TRAINING_SEG_5_LEN;
|
||||
#endif
|
||||
if (++s->training_count >= V27TER_TRAINING_SEG_5_LEN)
|
||||
{
|
||||
constellation_state = 4;
|
||||
s->constellation_state = (s->bit_rate == 4800) ? 4 : 2;
|
||||
s->training_count = 0;
|
||||
s->training_stage = TRAINING_STAGE_TEST_ONES;
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
s->carrier_track_i = 400;
|
||||
s->carrier_track_p = 1000000;
|
||||
#else
|
||||
s->carrier_track_i = 400.0f;
|
||||
s->carrier_track_p = 1000000.0f;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case TRAINING_STAGE_TEST_ONES:
|
||||
decode_baud(s, &z);
|
||||
constellation_state = (s->bit_rate == 4800) ? s->constellation_state : (s->constellation_state << 1);
|
||||
target = &v27ter_constellation[constellation_state];
|
||||
/* Measure the training error */
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
z1.re = z.re/(float) FP_FACTOR;
|
||||
z1.im = z.im/(float) FP_FACTOR;
|
||||
if (s->bit_rate == 4800)
|
||||
zz = complex_subf(&z, &v27ter_constellation[s->constellation_state]);
|
||||
else
|
||||
zz = complex_subf(&z, &v27ter_constellation[s->constellation_state << 1]);
|
||||
zz = complex_subf(&z, target);
|
||||
zz = complex_subf(&z1, &zz);
|
||||
s->training_error += powerf(&zz);
|
||||
#else
|
||||
if (s->bit_rate == 4800)
|
||||
zz = complex_subf(&z, &v27ter_constellation[s->constellation_state]);
|
||||
else
|
||||
zz = complex_subf(&z, &v27ter_constellation[s->constellation_state << 1]);
|
||||
zz = complex_subf(&z, target);
|
||||
s->training_error += powerf(&zz);
|
||||
#endif
|
||||
if (++s->training_count >= V27TER_TRAINING_SEG_6_LEN)
|
||||
@@ -728,8 +744,10 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
|
||||
}
|
||||
break;
|
||||
case TRAINING_STAGE_PARKED:
|
||||
default:
|
||||
/* We failed to train! */
|
||||
/* Park here until the carrier drops. */
|
||||
target = &zero;
|
||||
break;
|
||||
}
|
||||
if (s->qam_report)
|
||||
@@ -737,28 +755,92 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t
|
||||
#if defined(SPANDSP_USE_FIXED_POINTx)
|
||||
z1.re = z.re/(float) FP_FACTOR;
|
||||
z1.im = z.im/(float) FP_FACTOR;
|
||||
zz.re = v27ter_constellation[s->constellation_state].re;
|
||||
zz.im = v27ter_constellation[s->constellation_state].im;
|
||||
s->qam_report(s->qam_user_data,
|
||||
&z1,
|
||||
&zz,
|
||||
s->constellation_state);
|
||||
zz.re = target->re;
|
||||
zz.im = target->im;
|
||||
s->qam_report(s->qam_user_data, &z1, &zz, s->constellation_state);
|
||||
#else
|
||||
s->qam_report(s->qam_user_data,
|
||||
&z,
|
||||
&v27ter_constellation[s->constellation_state],
|
||||
s->constellation_state);
|
||||
s->qam_report(s->qam_user_data, &z, target, s->constellation_state);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ int signal_detect(v27ter_rx_state_t *s, int16_t amp)
|
||||
{
|
||||
int16_t diff;
|
||||
int16_t x;
|
||||
int32_t power;
|
||||
|
||||
/* There should be no DC in the signal, but sometimes there is.
|
||||
We need to measure the power with the DC blocked, but not using
|
||||
a slow to respond DC blocker. Use the most elementary HPF. */
|
||||
x = amp >> 1;
|
||||
/* There could be overflow here, but it isn't a problem in practice */
|
||||
diff = x - s->last_sample;
|
||||
s->last_sample = x;
|
||||
power = power_meter_update(&(s->power), diff);
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Quick power drop fudge */
|
||||
diff = abs(diff);
|
||||
if (10*diff < s->high_sample)
|
||||
{
|
||||
if (++s->low_samples > 120)
|
||||
{
|
||||
power_meter_init(&(s->power), 4);
|
||||
s->high_sample = 0;
|
||||
s->low_samples = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s->low_samples = 0;
|
||||
if (diff > s->high_sample)
|
||||
s->high_sample = diff;
|
||||
}
|
||||
#endif
|
||||
//span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power)));
|
||||
if (s->signal_present > 0)
|
||||
{
|
||||
/* Look for power below turn-off threshold to turn the carrier off */
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
if (s->carrier_drop_pending || power < s->carrier_off_power)
|
||||
#else
|
||||
if (power < s->carrier_off_power)
|
||||
#endif
|
||||
{
|
||||
if (--s->signal_present <= 0)
|
||||
{
|
||||
/* Count down a short delay, to ensure we push the last
|
||||
few bits through the filters before stopping. */
|
||||
v27ter_rx_restart(s, s->bit_rate, FALSE);
|
||||
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
|
||||
return 0;
|
||||
}
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Carrier has dropped, but the put_bit is pending the signal_present delay. */
|
||||
s->carrier_drop_pending = TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Look for power exceeding turn-on threshold to turn the carrier on */
|
||||
if (power < s->carrier_on_power)
|
||||
return 0;
|
||||
s->signal_present = 1;
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
s->carrier_drop_pending = FALSE;
|
||||
#endif
|
||||
report_status_change(s, SIG_STATUS_CARRIER_UP);
|
||||
}
|
||||
return power;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], int len)
|
||||
{
|
||||
int i;
|
||||
int step;
|
||||
int16_t x;
|
||||
int16_t diff;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi16_t z;
|
||||
complexi16_t zz;
|
||||
@@ -780,68 +862,8 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in
|
||||
if (++s->rrc_filter_step >= V27TER_RX_4800_FILTER_STEPS)
|
||||
s->rrc_filter_step = 0;
|
||||
|
||||
/* There should be no DC in the signal, but sometimes there is.
|
||||
We need to measure the power with the DC blocked, but not using
|
||||
a slow to respond DC blocker. Use the most elementary HPF. */
|
||||
x = amp[i] >> 1;
|
||||
/* There could be overflow here, but it isn't a problem in practice */
|
||||
diff = x - s->last_sample;
|
||||
power = power_meter_update(&(s->power), diff);
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Quick power drop fudge */
|
||||
diff = abs(diff);
|
||||
if (10*diff < s->high_sample)
|
||||
{
|
||||
if (++s->low_samples > 120)
|
||||
{
|
||||
power_meter_init(&(s->power), 4);
|
||||
s->high_sample = 0;
|
||||
s->low_samples = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s->low_samples = 0;
|
||||
if (diff > s->high_sample)
|
||||
s->high_sample = diff;
|
||||
}
|
||||
#endif
|
||||
s->last_sample = x;
|
||||
//span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power)));
|
||||
if (s->signal_present)
|
||||
{
|
||||
/* Look for power below turnoff threshold to turn the carrier off */
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
if (s->carrier_drop_pending || power < s->carrier_off_power)
|
||||
#else
|
||||
if (power < s->carrier_off_power)
|
||||
#endif
|
||||
{
|
||||
if (--s->signal_present <= 0)
|
||||
{
|
||||
/* Count down a short delay, to ensure we push the last
|
||||
few bits through the filters before stopping. */
|
||||
v27ter_rx_restart(s, s->bit_rate, FALSE);
|
||||
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
|
||||
continue;
|
||||
}
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Carrier has dropped, but the put_bit is pending the signal_present delay. */
|
||||
s->carrier_drop_pending = TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Look for power exceeding turnon threshold to turn the carrier on */
|
||||
if (power < s->carrier_on_power)
|
||||
continue;
|
||||
s->signal_present = 1;
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
s->carrier_drop_pending = FALSE;
|
||||
#endif
|
||||
report_status_change(s, SIG_STATUS_CARRIER_UP);
|
||||
}
|
||||
if ((power = signal_detect(s, amp[i])) == 0)
|
||||
continue;
|
||||
/* Only spend effort processing this data if the modem is not
|
||||
parked, after training failure. */
|
||||
if (s->training_stage == TRAINING_STAGE_PARKED)
|
||||
@@ -902,69 +924,8 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in
|
||||
if (++s->rrc_filter_step >= V27TER_RX_2400_FILTER_STEPS)
|
||||
s->rrc_filter_step = 0;
|
||||
|
||||
/* There should be no DC in the signal, but sometimes there is.
|
||||
We need to measure the power with the DC blocked, but not using
|
||||
a slow to respond DC blocker. Use the most elementary HPF. */
|
||||
x = amp[i] >> 1;
|
||||
/* There could be overflow here, but it isn't a problem in practice */
|
||||
diff = x - s->last_sample;
|
||||
power = power_meter_update(&(s->power), diff);
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Quick power drop fudge */
|
||||
diff = abs(diff);
|
||||
if (10*diff < s->high_sample)
|
||||
{
|
||||
if (++s->low_samples > 120)
|
||||
{
|
||||
power_meter_init(&(s->power), 4);
|
||||
s->high_sample = 0;
|
||||
s->low_samples = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s->low_samples = 0;
|
||||
if (diff > s->high_sample)
|
||||
s->high_sample = diff;
|
||||
}
|
||||
#endif
|
||||
s->last_sample = x;
|
||||
//span_log(&s->logging, SPAN_LOG_FLOW, "Power = %f\n", power_meter_current_dbm0(&(s->power)));
|
||||
if (s->signal_present)
|
||||
{
|
||||
/* Look for power below turnoff threshold to turn the carrier off */
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
if (s->carrier_drop_pending || power < s->carrier_off_power)
|
||||
#else
|
||||
if (power < s->carrier_off_power)
|
||||
#endif
|
||||
{
|
||||
if (--s->signal_present <= 0)
|
||||
{
|
||||
/* Count down a short delay, to ensure we push the last
|
||||
few bits through the filters before stopping. */
|
||||
v27ter_rx_restart(s, s->bit_rate, FALSE);
|
||||
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
|
||||
continue;
|
||||
}
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Carrier has dropped, but the put_bit is
|
||||
pending the signal_present delay. */
|
||||
s->carrier_drop_pending = TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Look for power exceeding turnon threshold to turn the carrier on */
|
||||
if (power < s->carrier_on_power)
|
||||
continue;
|
||||
s->signal_present = 1;
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
s->carrier_drop_pending = FALSE;
|
||||
#endif
|
||||
report_status_change(s, SIG_STATUS_CARRIER_UP);
|
||||
}
|
||||
if ((power = signal_detect(s, amp[i])) == 0)
|
||||
continue;
|
||||
/* Only spend effort processing this data if the modem is not
|
||||
parked, after training failure. */
|
||||
if (s->training_stage == TRAINING_STAGE_PARKED)
|
||||
@@ -1028,7 +989,7 @@ SPAN_DECLARE(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len)
|
||||
/* We want to sustain the current state (i.e carrier on<->carrier off), and
|
||||
try to sustain the carrier phase. We should probably push the filters, as well */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
|
||||
if (!s->signal_present)
|
||||
if (s->signal_present <= 0)
|
||||
return 0;
|
||||
if (s->training_stage == TRAINING_STAGE_PARKED)
|
||||
return 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v27ter_tx.c,v 1.75 2009/04/21 13:59:07 steveu Exp $
|
||||
* $Id: v27ter_tx.c,v 1.76 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
+76
-66
@@ -23,7 +23,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v29rx.c,v 1.164 2009/04/21 13:59:07 steveu Exp $
|
||||
* $Id: v29rx.c,v 1.166 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -841,12 +841,82 @@ static void process_half_baud(v29_rx_state_t *s, complexf_t *sample)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ int signal_detect(v29_rx_state_t *s, int16_t amp)
|
||||
{
|
||||
int16_t diff;
|
||||
int16_t x;
|
||||
int32_t power;
|
||||
|
||||
/* There should be no DC in the signal, but sometimes there is.
|
||||
We need to measure the power with the DC blocked, but not using
|
||||
a slow to respond DC blocker. Use the most elementary HPF. */
|
||||
x = amp >> 1;
|
||||
/* There could be overflow here, but it isn't a problem in practice */
|
||||
diff = x - s->last_sample;
|
||||
s->last_sample = x;
|
||||
power = power_meter_update(&(s->power), diff);
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Quick power drop fudge */
|
||||
diff = abs(diff);
|
||||
if (10*diff < s->high_sample)
|
||||
{
|
||||
if (++s->low_samples > 120)
|
||||
{
|
||||
power_meter_init(&(s->power), 4);
|
||||
s->high_sample = 0;
|
||||
s->low_samples = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s->low_samples = 0;
|
||||
if (diff > s->high_sample)
|
||||
s->high_sample = diff;
|
||||
}
|
||||
#endif
|
||||
if (s->signal_present > 0)
|
||||
{
|
||||
/* Look for power below turn-off threshold to turn the carrier off */
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
if (s->carrier_drop_pending || power < s->carrier_off_power)
|
||||
#else
|
||||
if (power < s->carrier_off_power)
|
||||
#endif
|
||||
{
|
||||
if (--s->signal_present <= 0)
|
||||
{
|
||||
/* Count down a short delay, to ensure we push the last
|
||||
few bits through the filters before stopping. */
|
||||
v29_rx_restart(s, s->bit_rate, FALSE);
|
||||
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
|
||||
return 0;
|
||||
}
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Carrier has dropped, but the put_bit is
|
||||
pending the signal_present delay. */
|
||||
s->carrier_drop_pending = TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Look for power exceeding turn-on threshold to turn the carrier on */
|
||||
if (power < s->carrier_on_power)
|
||||
return 0;
|
||||
s->signal_present = 1;
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
s->carrier_drop_pending = FALSE;
|
||||
#endif
|
||||
report_status_change(s, SIG_STATUS_CARRIER_UP);
|
||||
}
|
||||
return power;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len)
|
||||
{
|
||||
int i;
|
||||
int step;
|
||||
int16_t x;
|
||||
int16_t diff;
|
||||
#if defined(SPANDSP_USE_FIXED_POINT)
|
||||
complexi16_t z;
|
||||
complexi16_t zz;
|
||||
@@ -866,68 +936,8 @@ SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len)
|
||||
if (++s->rrc_filter_step >= V29_RX_FILTER_STEPS)
|
||||
s->rrc_filter_step = 0;
|
||||
|
||||
/* There should be no DC in the signal, but sometimes there is.
|
||||
We need to measure the power with the DC blocked, but not using
|
||||
a slow to respond DC blocker. Use the most elementary HPF. */
|
||||
x = amp[i] >> 1;
|
||||
/* There could be overflow here, but it isn't a problem in practice */
|
||||
diff = x - s->last_sample;
|
||||
power = power_meter_update(&(s->power), diff);
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Quick power drop fudge */
|
||||
diff = abs(diff);
|
||||
if (10*diff < s->high_sample)
|
||||
{
|
||||
if (++s->low_samples > 120)
|
||||
{
|
||||
power_meter_init(&(s->power), 4);
|
||||
s->high_sample = 0;
|
||||
s->low_samples = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s->low_samples = 0;
|
||||
if (diff > s->high_sample)
|
||||
s->high_sample = diff;
|
||||
}
|
||||
#endif
|
||||
s->last_sample = x;
|
||||
if (s->signal_present)
|
||||
{
|
||||
/* Look for power below turn-off threshold to turn the carrier off */
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
if (s->carrier_drop_pending || power < s->carrier_off_power)
|
||||
#else
|
||||
if (power < s->carrier_off_power)
|
||||
#endif
|
||||
{
|
||||
if (--s->signal_present <= 0)
|
||||
{
|
||||
/* Count down a short delay, to ensure we push the last
|
||||
few bits through the filters before stopping. */
|
||||
v29_rx_restart(s, s->bit_rate, FALSE);
|
||||
report_status_change(s, SIG_STATUS_CARRIER_DOWN);
|
||||
continue;
|
||||
}
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
/* Carrier has dropped, but the put_bit is
|
||||
pending the signal_present delay. */
|
||||
s->carrier_drop_pending = TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Look for power exceeding turn-on threshold to turn the carrier on */
|
||||
if (power < s->carrier_on_power)
|
||||
continue;
|
||||
s->signal_present = 1;
|
||||
#if defined(IAXMODEM_STUFF)
|
||||
s->carrier_drop_pending = FALSE;
|
||||
#endif
|
||||
report_status_change(s, SIG_STATUS_CARRIER_UP);
|
||||
}
|
||||
if ((power = signal_detect(s, amp[i])) == 0)
|
||||
continue;
|
||||
if (s->training_stage == TRAINING_STAGE_PARKED)
|
||||
continue;
|
||||
/* Only spend effort processing this data if the modem is not
|
||||
@@ -1018,7 +1028,7 @@ SPAN_DECLARE(int) v29_rx_fillin(v29_rx_state_t *s, int len)
|
||||
/* We want to sustain the current state (i.e carrier on<->carrier off), and
|
||||
try to sustain the carrier phase. We should probably push the filters, as well */
|
||||
span_log(&s->logging, SPAN_LOG_FLOW, "Fill-in %d samples\n", len);
|
||||
if (!s->signal_present)
|
||||
if (s->signal_present <= 0)
|
||||
return 0;
|
||||
if (s->training_stage == TRAINING_STAGE_PARKED)
|
||||
return 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: v29tx.c,v 1.88 2009/04/21 13:59:07 steveu Exp $
|
||||
* $Id: v29tx.c,v 1.89 2009/06/02 16:03:56 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -609,7 +609,7 @@ static int select_modulation(int mask)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len)
|
||||
SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len)
|
||||
{
|
||||
int len;
|
||||
|
||||
@@ -632,7 +632,7 @@ SPAN_DECLARE(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len)
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(int) v8_rx(v8_state_t *s, const int16_t *amp, int len)
|
||||
SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len)
|
||||
{
|
||||
int i;
|
||||
int residual_samples;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
##
|
||||
## $Id: Makefile.am,v 1.114 2009/04/26 08:25:37 steveu Exp $
|
||||
## $Id: Makefile.am,v 1.116 2009/05/30 15:23:13 steveu Exp $
|
||||
|
||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||
@@ -172,7 +172,7 @@ dc_restore_tests_SOURCES = dc_restore_tests.c
|
||||
dc_restore_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
|
||||
dds_tests_SOURCES = dds_tests.c
|
||||
dds_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
dds_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
dtmf_rx_tests_SOURCES = dtmf_rx_tests.c
|
||||
dtmf_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
@@ -196,7 +196,7 @@ g1050_tests_SOURCES = g1050_tests.c media_monitor.cpp
|
||||
g1050_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
g168_tests_SOURCES = g168_tests.c
|
||||
g168_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
g168_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
g711_tests_SOURCES = g711_tests.c
|
||||
g711_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
@@ -244,10 +244,10 @@ playout_tests_SOURCES = playout_tests.c media_monitor.cpp
|
||||
playout_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
plc_tests_SOURCES = plc_tests.c
|
||||
plc_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
plc_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
power_meter_tests_SOURCES = power_meter_tests.c
|
||||
power_meter_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
power_meter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
queue_tests_SOURCES = queue_tests.c
|
||||
queue_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
@@ -268,7 +268,7 @@ sig_tone_tests_SOURCES = sig_tone_tests.c
|
||||
sig_tone_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
super_tone_rx_tests_SOURCES = super_tone_rx_tests.c
|
||||
super_tone_rx_tests_LDADD = $(LIBDIR) -lspandsp
|
||||
super_tone_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
super_tone_tx_tests_SOURCES = super_tone_tx_tests.c
|
||||
super_tone_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: adsi_tests.c,v 1.56 2009/04/26 07:24:35 steveu Exp $
|
||||
* $Id: adsi_tests.c,v 1.57 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page adsi_tests_page ADSI tests
|
||||
@@ -48,7 +48,7 @@ tests, these tests do not include line modelling.
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -87,7 +87,7 @@ adsi_tx_state_t *tx_adsi;
|
||||
int current_standard = 0;
|
||||
int good_message_received;
|
||||
int log_audio = FALSE;
|
||||
AFfilehandle outhandle = NULL;
|
||||
SNDFILE *outhandle = NULL;
|
||||
int short_preamble = FALSE;
|
||||
|
||||
static int adsi_create_message(adsi_tx_state_t *s, uint8_t *msg)
|
||||
@@ -674,13 +674,12 @@ static void basic_tests(int standard)
|
||||
}
|
||||
if (log_audio)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle,
|
||||
amp,
|
||||
len);
|
||||
if (outframes != len)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -696,27 +695,27 @@ static void mitel_cm7291_side_2_and_bellcore_tests(int standard)
|
||||
{
|
||||
int j;
|
||||
int16_t amp[BLOCK_LEN];
|
||||
AFfilehandle inhandle;
|
||||
SNDFILE *inhandle;
|
||||
int frames;
|
||||
|
||||
/* The remainder of the Mitel tape is the talk-off test */
|
||||
/* Here we use the Bellcore test tapes (much tougher), in six
|
||||
wave files - 1 from each side of the original 3 cassette tapes */
|
||||
files - 1 from each side of the original 3 cassette tapes */
|
||||
printf("Talk-off tests for %s\n", adsi_standard_to_str(standard));
|
||||
rx_adsi = adsi_rx_init(NULL, standard, put_adsi_msg, NULL);
|
||||
for (j = 0; bellcore_files[j][0]; j++)
|
||||
{
|
||||
printf("Testing with %s\n", bellcore_files[j]);
|
||||
if ((inhandle = afOpenFile_telephony_read(bellcore_files[j], 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL)
|
||||
{
|
||||
printf(" Cannot open speech file '%s'\n", bellcore_files[j]);
|
||||
exit(2);
|
||||
}
|
||||
while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, BLOCK_LEN)))
|
||||
while ((frames = sf_readf_short(inhandle, amp, BLOCK_LEN)))
|
||||
{
|
||||
adsi_rx(rx_adsi, amp, frames);
|
||||
}
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
printf(" Cannot close speech file '%s'\n", bellcore_files[j]);
|
||||
exit(2);
|
||||
@@ -735,7 +734,7 @@ static void mitel_cm7291_side_2_and_bellcore_tests(int standard)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int16_t amp[BLOCK_LEN];
|
||||
AFfilehandle inhandle;
|
||||
SNDFILE *inhandle;
|
||||
int len;
|
||||
int test_standard;
|
||||
int first_standard;
|
||||
@@ -793,16 +792,16 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
}
|
||||
outhandle = AF_NULL_FILEHANDLE;
|
||||
outhandle = NULL;
|
||||
|
||||
tdd_character_set_tests();
|
||||
|
||||
if (decode_test_file)
|
||||
{
|
||||
/* We will decode the audio from a wave file. */
|
||||
if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
|
||||
/* We will decode the audio from a file. */
|
||||
if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", decode_test_file);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file);
|
||||
exit(2);
|
||||
}
|
||||
if (test_standard < 0)
|
||||
@@ -817,17 +816,14 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
for (;;)
|
||||
{
|
||||
len = afReadFrames(inhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
BLOCK_LEN);
|
||||
len = sf_readf_short(inhandle, amp, BLOCK_LEN);
|
||||
if (len == 0)
|
||||
break;
|
||||
adsi_rx(rx_adsi, amp, len);
|
||||
}
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", decode_test_file);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file);
|
||||
exit(2);
|
||||
}
|
||||
adsi_rx_free(rx_adsi);
|
||||
@@ -836,9 +832,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (log_audio)
|
||||
{
|
||||
if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -863,9 +859,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (log_audio)
|
||||
{
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: async_tests.c,v 1.18 2008/11/30 10:17:31 steveu Exp $
|
||||
* $Id: async_tests.c,v 1.19 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: at_interpreter_tests.c,v 1.22 2009/04/24 22:35:25 steveu Exp $
|
||||
* $Id: at_interpreter_tests.c,v 1.23 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -42,7 +42,7 @@ These tests exercise all the commands which should be understood by the AT inter
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
#include "spandsp.h"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bell_mf_rx_tests.c,v 1.15 2009/04/11 18:11:19 steveu Exp $
|
||||
* $Id: bell_mf_rx_tests.c,v 1.16 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -48,7 +48,7 @@ a fair test of performance in a real PSTN channel.
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bell_mf_tx_tests.c,v 1.14 2008/11/30 10:17:31 steveu Exp $
|
||||
* $Id: bell_mf_tx_tests.c,v 1.15 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -60,55 +60,40 @@ int main(int argc, char *argv[])
|
||||
bell_mf_tx_state_t *gen;
|
||||
int16_t amp[16384];
|
||||
int len;
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *outhandle;
|
||||
int outframes;
|
||||
int add_digits;
|
||||
|
||||
if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
gen = bell_mf_tx_init(NULL);
|
||||
len = bell_mf_tx(gen, amp, 16384);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (bell_mf_tx_put(gen, "123", -1))
|
||||
printf("Ooops\n");
|
||||
len = bell_mf_tx(gen, amp, 16384);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (bell_mf_tx_put(gen, "456", -1))
|
||||
printf("Ooops\n");
|
||||
len = bell_mf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (bell_mf_tx_put(gen, "789", -1))
|
||||
printf("Ooops\n");
|
||||
len = bell_mf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (bell_mf_tx_put(gen, "*#", -1))
|
||||
printf("Ooops\n");
|
||||
len = bell_mf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
add_digits = 1;
|
||||
do
|
||||
{
|
||||
@@ -116,10 +101,7 @@ int main(int argc, char *argv[])
|
||||
printf("Generated %d samples\n", len);
|
||||
if (len > 0)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
}
|
||||
if (add_digits)
|
||||
{
|
||||
@@ -135,50 +117,32 @@ int main(int argc, char *argv[])
|
||||
bell_mf_tx_init(gen);
|
||||
len = bell_mf_tx(gen, amp, 16384);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (bell_mf_tx_put(gen, "123", -1))
|
||||
printf("Ooops\n");
|
||||
len = bell_mf_tx(gen, amp, 16384);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (bell_mf_tx_put(gen, "456", -1))
|
||||
printf("Ooops\n");
|
||||
len = bell_mf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (bell_mf_tx_put(gen, "789", -1))
|
||||
printf("Ooops\n");
|
||||
len = bell_mf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (bell_mf_tx_put(gen, "0*#", -1))
|
||||
printf("Ooops\n");
|
||||
len = bell_mf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (bell_mf_tx_put(gen, "ABC", -1))
|
||||
printf("Ooops\n");
|
||||
len = bell_mf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
add_digits = 1;
|
||||
do
|
||||
{
|
||||
@@ -186,10 +150,7 @@ int main(int argc, char *argv[])
|
||||
printf("Generated %d samples\n", len);
|
||||
if (len > 0)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
}
|
||||
if (add_digits)
|
||||
{
|
||||
@@ -202,9 +163,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
while (len > 0);
|
||||
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit (2);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: bert_tests.c,v 1.27 2009/04/14 16:04:54 steveu Exp $
|
||||
* $Id: bert_tests.c,v 1.28 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -40,7 +40,7 @@ These tests exercise each of the BERT standards supported by the BERT module.
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: dds_tests.c,v 1.24 2008/05/13 13:17:25 steveu Exp $
|
||||
* $Id: dds_tests.c,v 1.26 2009/06/02 14:55:36 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -43,9 +43,10 @@
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <memory.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "spandsp.h"
|
||||
#include "spandsp-sim.h"
|
||||
|
||||
#define OUTPUT_FILE_NAME "dds.wav"
|
||||
#define OUTPUT_FILE_NAME_COMPLEX "complex_dds.wav"
|
||||
@@ -60,8 +61,7 @@ int main(int argc, char *argv[])
|
||||
int outframes;
|
||||
complexf_t camp;
|
||||
int16_t buf[2*SAMPLES_PER_CHUNK];
|
||||
AFfilehandle outhandle;
|
||||
AFfilesetup filesetup;
|
||||
SNDFILE *outhandle;
|
||||
power_meter_t meter;
|
||||
power_meter_t meter_i;
|
||||
power_meter_t meter_q;
|
||||
@@ -70,19 +70,9 @@ int main(int argc, char *argv[])
|
||||
power_meter_init(&meter, 10);
|
||||
|
||||
printf("Non-complex DDS tests.\n");
|
||||
if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
|
||||
if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to create file setup\n");
|
||||
exit(2);
|
||||
}
|
||||
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
|
||||
afInitFileFormat(filesetup, AF_FILE_WAVE);
|
||||
afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
|
||||
|
||||
if ((outhandle = afOpenFile(OUTPUT_FILE_NAME, "w", filesetup)) == AF_NULL_FILEHANDLE)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@@ -96,13 +86,10 @@ int main(int argc, char *argv[])
|
||||
buf[i] = alaw_to_linear(linear_to_alaw((dds(&phase, phase_inc)*scale) >> 15));
|
||||
power_meter_update(&meter, buf[i]);
|
||||
}
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
buf,
|
||||
SAMPLES_PER_CHUNK);
|
||||
outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
|
||||
if (outframes != SAMPLES_PER_CHUNK)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter));
|
||||
@@ -119,13 +106,10 @@ int main(int argc, char *argv[])
|
||||
buf[i] = alaw_to_linear(linear_to_alaw(dds(&phase, phase_inc)));
|
||||
power_meter_update(&meter, buf[i]);
|
||||
}
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
buf,
|
||||
SAMPLES_PER_CHUNK);
|
||||
outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
|
||||
if (outframes != SAMPLES_PER_CHUNK)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter));
|
||||
@@ -144,13 +128,10 @@ int main(int argc, char *argv[])
|
||||
buf[i] = alaw_to_linear(linear_to_alaw((dds(&phase, phase_inc)*scale) >> 15));
|
||||
power_meter_update(&meter, buf[i]);
|
||||
}
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
buf,
|
||||
SAMPLES_PER_CHUNK);
|
||||
outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
|
||||
if (outframes != SAMPLES_PER_CHUNK)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter));
|
||||
@@ -167,13 +148,10 @@ int main(int argc, char *argv[])
|
||||
buf[i] = alaw_to_linear(linear_to_alaw(dds(&phase, phase_inc)));
|
||||
power_meter_update(&meter, buf[i]);
|
||||
}
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
buf,
|
||||
SAMPLES_PER_CHUNK);
|
||||
outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
|
||||
if (outframes != SAMPLES_PER_CHUNK)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
printf("Level is %fdBOv/%fdBm0\n", power_meter_current_dbov(&meter), power_meter_current_dbm0(&meter));
|
||||
@@ -183,27 +161,16 @@ int main(int argc, char *argv[])
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
afFreeFileSetup(filesetup);
|
||||
|
||||
printf("Complex DDS tests,\n");
|
||||
if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
|
||||
if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME_COMPLEX, 2)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to create file setup\n");
|
||||
exit(2);
|
||||
}
|
||||
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
|
||||
afInitFileFormat(filesetup, AF_FILE_WAVE);
|
||||
afInitChannels(filesetup, AF_DEFAULT_TRACK, 2);
|
||||
|
||||
if ((outhandle = afOpenFile(OUTPUT_FILE_NAME_COMPLEX, "w", filesetup)) == AF_NULL_FILEHANDLE)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUTPUT_FILE_NAME_COMPLEX);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_COMPLEX);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@@ -220,13 +187,10 @@ int main(int argc, char *argv[])
|
||||
power_meter_update(&meter_i, buf[2*i]);
|
||||
power_meter_update(&meter_q, buf[2*i]);
|
||||
}
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
buf,
|
||||
SAMPLES_PER_CHUNK);
|
||||
outframes = sf_writef_short(outhandle, buf, SAMPLES_PER_CHUNK);
|
||||
if (outframes != SAMPLES_PER_CHUNK)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
printf("Level is %fdBOv/%fdBm0, %fdBOv/%fdBm0\n",
|
||||
@@ -242,12 +206,11 @@ int main(int argc, char *argv[])
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUTPUT_FILE_NAME_COMPLEX);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_COMPLEX);
|
||||
exit(2);
|
||||
}
|
||||
afFreeFileSetup(filesetup);
|
||||
|
||||
printf("Tests passed.\n");
|
||||
return 0;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: dtmf_rx_tests.c,v 1.44 2008/11/30 10:17:31 steveu Exp $
|
||||
* $Id: dtmf_rx_tests.c,v 1.45 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -94,7 +94,7 @@ they wish to give it away for free.
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -623,7 +623,7 @@ static void mitel_cm7291_side_2_and_bellcore_tests(void)
|
||||
int hits;
|
||||
int hit_types[256];
|
||||
char buf[128 + 1];
|
||||
AFfilehandle inhandle;
|
||||
SNDFILE *inhandle;
|
||||
int frames;
|
||||
dtmf_rx_state_t *dtmf_state;
|
||||
|
||||
@@ -633,7 +633,7 @@ static void mitel_cm7291_side_2_and_bellcore_tests(void)
|
||||
|
||||
/* The remainder of the Mitel tape is the talk-off test */
|
||||
/* Here we use the Bellcore test tapes (much tougher), in six
|
||||
wave files - 1 from each side of the original 3 cassette tapes */
|
||||
files - 1 from each side of the original 3 cassette tapes */
|
||||
/* Bellcore say you should get no more than 470 false detections with
|
||||
a good receiver. Dialogic claim 20. Of course, we can do better than
|
||||
that, eh? */
|
||||
@@ -641,13 +641,13 @@ static void mitel_cm7291_side_2_and_bellcore_tests(void)
|
||||
memset(hit_types, '\0', sizeof(hit_types));
|
||||
for (j = 0; bellcore_files[j][0]; j++)
|
||||
{
|
||||
if ((inhandle = afOpenFile_telephony_read(bellcore_files[j], 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL)
|
||||
{
|
||||
printf(" Cannot open speech file '%s'\n", bellcore_files[j]);
|
||||
exit(2);
|
||||
}
|
||||
hits = 0;
|
||||
while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, SAMPLE_RATE)))
|
||||
while ((frames = sf_readf_short(inhandle, amp, SAMPLE_RATE)))
|
||||
{
|
||||
dtmf_rx(dtmf_state, amp, frames);
|
||||
len = dtmf_rx_get(dtmf_state, buf, 128);
|
||||
@@ -658,7 +658,7 @@ static void mitel_cm7291_side_2_and_bellcore_tests(void)
|
||||
hits += len;
|
||||
}
|
||||
}
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
printf(" Cannot close speech file '%s'\n", bellcore_files[j]);
|
||||
exit(2);
|
||||
@@ -804,7 +804,7 @@ static void callback_function_tests(void)
|
||||
static void decode_test(const char *test_file)
|
||||
{
|
||||
int16_t amp[SAMPLES_PER_CHUNK];
|
||||
AFfilehandle inhandle;
|
||||
SNDFILE *inhandle;
|
||||
dtmf_rx_state_t *dtmf_state;
|
||||
char buf[128 + 1];
|
||||
int actual;
|
||||
@@ -815,16 +815,16 @@ static void decode_test(const char *test_file)
|
||||
if (use_dialtone_filter)
|
||||
dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99);
|
||||
|
||||
/* We will decode the audio from a wave file. */
|
||||
/* We will decode the audio from a file. */
|
||||
|
||||
if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", decode_test_file);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
total = 0;
|
||||
while ((samples = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, SAMPLES_PER_CHUNK)) > 0)
|
||||
while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK)) > 0)
|
||||
{
|
||||
codec_munge(munge, amp, samples);
|
||||
dtmf_rx(dtmf_state, amp, samples);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: dtmf_tx_tests.c,v 1.22 2008/11/30 10:17:31 steveu Exp $
|
||||
* $Id: dtmf_tx_tests.c,v 1.23 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -60,40 +60,52 @@ int main(int argc, char *argv[])
|
||||
dtmf_tx_state_t *gen;
|
||||
int16_t amp[16384];
|
||||
int len;
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *outhandle;
|
||||
int outframes;
|
||||
int add_digits;
|
||||
|
||||
if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
gen = dtmf_tx_init(NULL);
|
||||
len = dtmf_tx(gen, amp, 16384);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (dtmf_tx_put(gen, "123", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
len = dtmf_tx(gen, amp, 16384);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (dtmf_tx_put(gen, "456", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
len = dtmf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (dtmf_tx_put(gen, "789", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
len = dtmf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (dtmf_tx_put(gen, "*#", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
len = dtmf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
add_digits = 1;
|
||||
do
|
||||
{
|
||||
@@ -101,7 +113,7 @@ int main(int argc, char *argv[])
|
||||
printf("Generated %d samples\n", len);
|
||||
if (len > 0)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
}
|
||||
if (add_digits)
|
||||
{
|
||||
@@ -117,52 +129,73 @@ int main(int argc, char *argv[])
|
||||
dtmf_tx_init(gen);
|
||||
len = dtmf_tx(gen, amp, 16384);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (dtmf_tx_put(gen, "123", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
len = dtmf_tx(gen, amp, 16384);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (dtmf_tx_put(gen, "456", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
len = dtmf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (dtmf_tx_put(gen, "789", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
len = dtmf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (dtmf_tx_put(gen, "0*#", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
len = dtmf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
if (dtmf_tx_put(gen, "ABCD", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
len = dtmf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
|
||||
/* Try modifying the level and length of the digits */
|
||||
printf("Try different levels and timing\n");
|
||||
dtmf_tx_set_level(gen, -20, 5);
|
||||
dtmf_tx_set_timing(gen, 100, 200);
|
||||
if (dtmf_tx_put(gen, "123", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
do
|
||||
{
|
||||
len = dtmf_tx(gen, amp, 160);
|
||||
printf("Generated %d samples\n", len);
|
||||
if (len > 0)
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
}
|
||||
while (len > 0);
|
||||
printf("Restore normal levels and timing\n");
|
||||
dtmf_tx_set_level(gen, -10, 0);
|
||||
dtmf_tx_set_timing(gen, 50, 55);
|
||||
if (dtmf_tx_put(gen, "A", -1))
|
||||
{
|
||||
printf("Ooops\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
add_digits = TRUE;
|
||||
do
|
||||
@@ -171,7 +204,7 @@ int main(int argc, char *argv[])
|
||||
printf("Generated %d samples\n", len);
|
||||
if (len > 0)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, len);
|
||||
outframes = sf_writef_short(outhandle, amp, len);
|
||||
}
|
||||
if (add_digits)
|
||||
{
|
||||
@@ -184,10 +217,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
while (len > 0);
|
||||
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit (2);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: echo_tests.c,v 1.38 2009/02/10 13:06:47 steveu Exp $
|
||||
* $Id: echo_tests.c,v 1.39 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page echo_can_tests_page Line echo cancellation for voice tests
|
||||
@@ -54,7 +54,7 @@ all the tests in G.168 are fully implemented at this time.
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <assert.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
#define GEN_CONST
|
||||
#include <math.h>
|
||||
@@ -107,7 +107,7 @@ typedef struct
|
||||
int max;
|
||||
int cur;
|
||||
float gain;
|
||||
AFfilehandle handle;
|
||||
SNDFILE *handle;
|
||||
int16_t signal[SAMPLE_RATE];
|
||||
} signal_source_t;
|
||||
|
||||
@@ -139,7 +139,7 @@ signal_source_t far_css;
|
||||
awgn_state_t local_noise_source;
|
||||
awgn_state_t far_noise_source;
|
||||
|
||||
AFfilehandle residue_handle;
|
||||
SNDFILE *residue_handle;
|
||||
int16_t residue_sound[SAMPLE_RATE];
|
||||
int residue_cur = 0;
|
||||
|
||||
@@ -157,7 +157,7 @@ level_measurement_device_t *sout_power_meter; /* Also known as Lret (pre NLP v
|
||||
level_measurement_device_t *sgen_power_meter;
|
||||
|
||||
#define RESULT_CHANNELS 7
|
||||
AFfilehandle result_handle;
|
||||
SNDFILE *result_handle;
|
||||
int16_t result_sound[SAMPLE_RATE*RESULT_CHANNELS];
|
||||
int result_cur;
|
||||
|
||||
@@ -188,10 +188,7 @@ static inline void put_residue(int16_t amp)
|
||||
residue_sound[residue_cur++] = amp;
|
||||
if (residue_cur >= SAMPLE_RATE)
|
||||
{
|
||||
outframes = afWriteFrames(residue_handle,
|
||||
AF_DEFAULT_TRACK,
|
||||
residue_sound,
|
||||
residue_cur);
|
||||
outframes = sf_writef_short(residue_handle, residue_sound, residue_cur);
|
||||
if (outframes != residue_cur)
|
||||
{
|
||||
fprintf(stderr, " Error writing residue sound\n");
|
||||
@@ -204,9 +201,9 @@ static inline void put_residue(int16_t amp)
|
||||
|
||||
static void signal_load(signal_source_t *sig, const char *name)
|
||||
{
|
||||
sig->handle = afOpenFile_telephony_read(name, 1);
|
||||
sig->handle = sf_open_telephony_read(name, 1);
|
||||
sig->name = name;
|
||||
sig->max = afReadFrames(sig->handle, AF_DEFAULT_TRACK, sig->signal, SAMPLE_RATE);
|
||||
sig->max = sf_readf_short(sig->handle, sig->signal, SAMPLE_RATE);
|
||||
if (sig->max < 0)
|
||||
{
|
||||
fprintf(stderr, " Error reading sound file '%s'\n", sig->name);
|
||||
@@ -217,7 +214,7 @@ static void signal_load(signal_source_t *sig, const char *name)
|
||||
|
||||
static void signal_free(signal_source_t *sig)
|
||||
{
|
||||
if (afCloseFile(sig->handle) != 0)
|
||||
if (sf_close(sig->handle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close sound file '%s'\n", sig->name);
|
||||
exit(2);
|
||||
@@ -597,10 +594,7 @@ static void run_test(echo_can_state_t *ctx, int16_t (*tx_source)(void), int16_t
|
||||
result_sound[result_cur++] = 0; // TODO: insert the EC's internal status here
|
||||
if (result_cur >= RESULT_CHANNELS*SAMPLE_RATE)
|
||||
{
|
||||
outframes = afWriteFrames(result_handle,
|
||||
AF_DEFAULT_TRACK,
|
||||
result_sound,
|
||||
result_cur/RESULT_CHANNELS);
|
||||
outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS);
|
||||
if (outframes != result_cur/RESULT_CHANNELS)
|
||||
{
|
||||
fprintf(stderr, " Error writing result sound\n");
|
||||
@@ -615,10 +609,7 @@ static void run_test(echo_can_state_t *ctx, int16_t (*tx_source)(void), int16_t
|
||||
#endif
|
||||
if (result_cur >= 0)
|
||||
{
|
||||
outframes = afWriteFrames(result_handle,
|
||||
AF_DEFAULT_TRACK,
|
||||
result_sound,
|
||||
result_cur/RESULT_CHANNELS);
|
||||
outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS);
|
||||
if (outframes != result_cur/RESULT_CHANNELS)
|
||||
{
|
||||
fprintf(stderr, " Error writing result sound\n");
|
||||
@@ -678,7 +669,7 @@ static int perform_test_sanity(void)
|
||||
/* Inject a burst of far sound */
|
||||
if (far_cur >= far_max)
|
||||
{
|
||||
far_max = afReadFrames(farhandle, AF_DEFAULT_TRACK, far_sound, SAMPLE_RATE);
|
||||
far_max = sf_readf_short(farhandle, far_sound, SAMPLE_RATE);
|
||||
if (far_max < 0)
|
||||
{
|
||||
fprintf(stderr, " Error reading far sound\n");
|
||||
@@ -734,10 +725,7 @@ static int perform_test_sanity(void)
|
||||
put_residue(clean - far_tx);
|
||||
if (result_cur >= RESULT_CHANNELS*SAMPLE_RATE)
|
||||
{
|
||||
outframes = afWriteFrames(result_handle,
|
||||
AF_DEFAULT_TRACK,
|
||||
result_sound,
|
||||
result_cur/RESULT_CHANNELS);
|
||||
outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS);
|
||||
if (outframes != result_cur/RESULT_CHANNELS)
|
||||
{
|
||||
fprintf(stderr, " Error writing result sound\n");
|
||||
@@ -748,10 +736,7 @@ static int perform_test_sanity(void)
|
||||
}
|
||||
if (result_cur > 0)
|
||||
{
|
||||
outframes = afWriteFrames(result_handle,
|
||||
AF_DEFAULT_TRACK,
|
||||
result_sound,
|
||||
result_cur/RESULT_CHANNELS);
|
||||
outframes = sf_writef_short(result_handle, result_sound, result_cur/RESULT_CHANNELS);
|
||||
if (outframes != result_cur/RESULT_CHANNELS)
|
||||
{
|
||||
fprintf(stderr, " Error writing result sound\n");
|
||||
@@ -1494,10 +1479,10 @@ static int match_test_name(const char *name)
|
||||
static void simulate_ec(char *argv[], int two_channel_file, int mode)
|
||||
{
|
||||
echo_can_state_t *ctx;
|
||||
AFfilehandle txfile;
|
||||
AFfilehandle rxfile;
|
||||
AFfilehandle rxtxfile;
|
||||
AFfilehandle ecfile;
|
||||
SNDFILE *txfile;
|
||||
SNDFILE *rxfile;
|
||||
SNDFILE *rxtxfile;
|
||||
SNDFILE *ecfile;
|
||||
int ntx;
|
||||
int nrx;
|
||||
int nec;
|
||||
@@ -1515,14 +1500,14 @@ static void simulate_ec(char *argv[], int two_channel_file, int mode)
|
||||
ecfile = NULL;
|
||||
if (two_channel_file)
|
||||
{
|
||||
txfile = afOpenFile_telephony_read(argv[0], 1);
|
||||
rxfile = afOpenFile_telephony_read(argv[1], 1);
|
||||
ecfile = afOpenFile_telephony_write(argv[2], 1);
|
||||
txfile = sf_open_telephony_read(argv[0], 1);
|
||||
rxfile = sf_open_telephony_read(argv[1], 1);
|
||||
ecfile = sf_open_telephony_write(argv[2], 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
rxtxfile = afOpenFile_telephony_read(argv[0], 2);
|
||||
ecfile = afOpenFile_telephony_write(argv[1], 1);
|
||||
rxtxfile = sf_open_telephony_read(argv[0], 2);
|
||||
ecfile = sf_open_telephony_write(argv[1], 1);
|
||||
}
|
||||
|
||||
ctx = echo_can_init(TEST_EC_TAPS, 0);
|
||||
@@ -1532,7 +1517,7 @@ static void simulate_ec(char *argv[], int two_channel_file, int mode)
|
||||
{
|
||||
if (two_channel_file)
|
||||
{
|
||||
if ((ntx = afReadFrames(rxtxfile, AF_DEFAULT_TRACK, buf, 1)) < 0)
|
||||
if ((ntx = sf_readf_short(rxtxfile, buf, 1)) < 0)
|
||||
{
|
||||
fprintf(stderr, " Error reading tx sound file\n");
|
||||
exit(2);
|
||||
@@ -1543,12 +1528,12 @@ static void simulate_ec(char *argv[], int two_channel_file, int mode)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ntx = afReadFrames(txfile, AF_DEFAULT_TRACK, &rin, 1)) < 0)
|
||||
if ((ntx = sf_readf_short(txfile, &rin, 1)) < 0)
|
||||
{
|
||||
fprintf(stderr, " Error reading tx sound file\n");
|
||||
exit(2);
|
||||
}
|
||||
if ((nrx = afReadFrames(rxfile, AF_DEFAULT_TRACK, &sin, 1)) < 0)
|
||||
if ((nrx = sf_readf_short(rxfile, &sin, 1)) < 0)
|
||||
{
|
||||
fprintf(stderr, " Error reading rx sound file\n");
|
||||
exit(2);
|
||||
@@ -1557,7 +1542,7 @@ static void simulate_ec(char *argv[], int two_channel_file, int mode)
|
||||
rout = echo_can_hpf_tx(ctx, rin);
|
||||
sout = echo_can_update(ctx, rout, sin);
|
||||
|
||||
if ((nec = afWriteFrames(ecfile, AF_DEFAULT_TRACK, &sout, 1)) != 1)
|
||||
if ((nec = sf_writef_short(ecfile, &sout, 1)) != 1)
|
||||
{
|
||||
fprintf(stderr, " Error writing ec sound file\n");
|
||||
exit(2);
|
||||
@@ -1576,14 +1561,14 @@ static void simulate_ec(char *argv[], int two_channel_file, int mode)
|
||||
|
||||
if (two_channel_file)
|
||||
{
|
||||
afCloseFile(rxtxfile);
|
||||
sf_close(rxtxfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
afCloseFile(txfile);
|
||||
afCloseFile(rxfile);
|
||||
sf_close(txfile);
|
||||
sf_close(rxfile);
|
||||
}
|
||||
afCloseFile(ecfile);
|
||||
sf_close(ecfile);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@@ -1666,8 +1651,8 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
if (simulate)
|
||||
{
|
||||
/* Process a pair of transmitted and received wave files, and produce
|
||||
an echo cancelled wave file. */
|
||||
/* Process a pair of transmitted and received audio files, and produce
|
||||
an echo cancelled audio file. */
|
||||
if (argc < ((two_channel_file) ? 2 : 3))
|
||||
{
|
||||
printf("not enough arguments for a simulation\n");
|
||||
@@ -1692,7 +1677,7 @@ int main(int argc, char *argv[])
|
||||
signal_load(&local_css, "sound_c1_8k.wav");
|
||||
signal_load(&far_css, "sound_c3_8k.wav");
|
||||
|
||||
if ((residue_handle = afOpenFile_telephony_write(RESIDUE_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((residue_handle = sf_open_telephony_write(RESIDUE_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to open '%s'\n", RESIDUE_FILE_NAME);
|
||||
exit(2);
|
||||
@@ -1704,7 +1689,7 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
time(&now);
|
||||
if ((result_handle = afOpenFile_telephony_write("echo_tests_result.wav", RESULT_CHANNELS)) == AF_NULL_FILEHANDLE)
|
||||
if ((result_handle = sf_open_telephony_write("echo_tests_result.wav", RESULT_CHANNELS)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to open result file\n");
|
||||
exit(2);
|
||||
@@ -1720,7 +1705,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
match_test_name(argv[i]);
|
||||
}
|
||||
if (afCloseFile(result_handle) != 0)
|
||||
if (sf_close(result_handle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close speech file '%s'\n", "result_sound.wav");
|
||||
exit(2);
|
||||
@@ -1729,7 +1714,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
signal_free(&local_css);
|
||||
signal_free(&far_css);
|
||||
if (afCloseFile(residue_handle) != 0)
|
||||
if (sf_close(residue_handle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close speech file '%s'\n", RESIDUE_FILE_NAME);
|
||||
exit(2);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: fax_decode.c,v 1.55 2009/04/29 12:37:45 steveu Exp $
|
||||
* $Id: fax_decode.c,v 1.56 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page fax_decode_page FAX decoder
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -446,10 +446,10 @@ int main(int argc, char *argv[])
|
||||
v29_rx_state_t *v29;
|
||||
v27ter_rx_state_t *v27ter;
|
||||
int16_t amp[SAMPLES_PER_CHUNK];
|
||||
AFfilehandle inhandle;
|
||||
SNDFILE *inhandle;
|
||||
SF_INFO info;
|
||||
int len;
|
||||
const char *filename;
|
||||
float x;
|
||||
logging_state_t *logging;
|
||||
|
||||
filename = "fax_samp.wav";
|
||||
@@ -457,26 +457,23 @@ int main(int argc, char *argv[])
|
||||
if (argc > 1)
|
||||
filename = argv[1];
|
||||
|
||||
if ((inhandle = afOpenFile(filename, "r", NULL)) == AF_NULL_FILEHANDLE)
|
||||
memset(&info, 0, sizeof(info));
|
||||
if ((inhandle = sf_open(filename, SFM_READ, &info)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", filename);
|
||||
fprintf(stderr, " Cannot open audio file '%s' for reading\n", filename);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
|
||||
if (info.samplerate != SAMPLE_RATE)
|
||||
{
|
||||
printf(" Unexpected frame size in speech file '%s' (%f)\n", filename, x);
|
||||
printf(" Unexpected sample rate in audio file '%s'\n", filename);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetRate(inhandle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
|
||||
if (info.channels != 1)
|
||||
{
|
||||
printf(" Unexpected sample rate in speech file '%s' (%f)\n", filename, x);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
|
||||
{
|
||||
printf(" Unexpected number of channels in speech file '%s' (%f)\n", filename, x);
|
||||
printf(" Unexpected number of channels in audio file '%s'\n", filename);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
memset(&t30_dummy, 0, sizeof(t30_dummy));
|
||||
span_log_init(&t30_dummy.logging, SPAN_LOG_FLOW, NULL);
|
||||
span_log_set_protocol(&t30_dummy.logging, "T.30");
|
||||
@@ -517,7 +514,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (;;)
|
||||
{
|
||||
len = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, SAMPLES_PER_CHUNK);
|
||||
len = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK);
|
||||
if (len < SAMPLES_PER_CHUNK)
|
||||
break;
|
||||
fsk_rx(fsk, amp, len);
|
||||
@@ -527,9 +524,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
t4_rx_release(&t4_state);
|
||||
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", filename);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", filename);
|
||||
exit(2);
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: fax_tests.c,v 1.101 2009/02/20 12:34:20 steveu Exp $
|
||||
* $Id: fax_tests.c,v 1.102 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page fax_tests_page FAX tests
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -179,8 +179,8 @@ static int document_handler(t30_state_t *s, void *user_data, int event)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
AFfilehandle wave_handle;
|
||||
AFfilehandle input_wave_handle;
|
||||
SNDFILE *wave_handle;
|
||||
SNDFILE *input_wave_handle;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
@@ -282,22 +282,22 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
input_wave_handle = AF_NULL_FILEHANDLE;
|
||||
input_wave_handle = NULL;
|
||||
if (input_audio_file_name)
|
||||
{
|
||||
if ((input_wave_handle = afOpenFile_telephony_read(input_audio_file_name, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((input_wave_handle = sf_open_telephony_read(input_audio_file_name, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", input_audio_file_name);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", input_audio_file_name);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
wave_handle = AF_NULL_FILEHANDLE;
|
||||
wave_handle = NULL;
|
||||
if (log_audio)
|
||||
{
|
||||
if ((wave_handle = afOpenFile_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == AF_NULL_FILEHANDLE)
|
||||
if ((wave_handle = sf_open_telephony_write(OUTPUT_FILE_NAME_WAVE, 2)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -427,7 +427,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if ((j & 1) == 0 && input_audio_file_name)
|
||||
{
|
||||
mc->len = afReadFrames(input_wave_handle, AF_DEFAULT_TRACK, mc->amp, SAMPLES_PER_CHUNK);
|
||||
mc->len = sf_readf_short(input_wave_handle, mc->amp, SAMPLES_PER_CHUNK);
|
||||
if (mc->len == 0)
|
||||
break;
|
||||
}
|
||||
@@ -492,7 +492,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (log_audio)
|
||||
{
|
||||
outframes = afWriteFrames(wave_handle, AF_DEFAULT_TRACK, out_amp, SAMPLES_PER_CHUNK);
|
||||
outframes = sf_writef_short(wave_handle, out_amp, SAMPLES_PER_CHUNK);
|
||||
if (outframes != SAMPLES_PER_CHUNK)
|
||||
break;
|
||||
}
|
||||
@@ -508,17 +508,17 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (log_audio)
|
||||
{
|
||||
if (afCloseFile(wave_handle))
|
||||
if (sf_close(wave_handle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUTPUT_FILE_NAME_WAVE);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME_WAVE);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
if (input_audio_file_name)
|
||||
{
|
||||
if (afCloseFile(input_wave_handle))
|
||||
if (sf_close(input_wave_handle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", input_audio_file_name);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", input_audio_file_name);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: fax_utils.c,v 1.2 2009/04/25 14:17:47 steveu Exp $
|
||||
* $Id: fax_utils.c,v 1.3 2009/05/16 03:34:45 steveu Exp $
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@@ -93,7 +93,7 @@ void log_transfer_statistics(t30_state_t *s, const char *tag)
|
||||
t30_get_transfer_statistics(s, &t);
|
||||
printf("%s: bit rate %d\n", tag, t.bit_rate);
|
||||
printf("%s: ECM %s\n", tag, (t.error_correcting_mode) ? "on" : "off");
|
||||
printf("%s: pages tx %d, pages rx %d\n", tag, t.pages_tx, t.pages_rx);
|
||||
printf("%s: tx pages %d, rx pages %d\n", tag, t.pages_tx, t.pages_rx);
|
||||
printf("%s: pages in the file %d\n", tag, t.pages_in_file);
|
||||
printf("%s: image size %d x %d\n", tag, t.width, t.length);
|
||||
printf("%s: image resolution %d x %d\n", tag, t.x_resolution, t.y_resolution);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: fsk_tests.c,v 1.56 2009/04/14 16:04:54 steveu Exp $
|
||||
* $Id: fsk_tests.c,v 1.57 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page fsk_tests_page FSK modem tests
|
||||
@@ -35,7 +35,7 @@ These tests allow either:
|
||||
the basic performance of the receive modem. It is also the only test mode
|
||||
provided for evaluating the transmit modem.
|
||||
|
||||
- An FSK receive modem is used to decode FSK audio, stored in a wave file.
|
||||
- An FSK receive modem is used to decode FSK audio, stored in a file.
|
||||
This is good way to evaluate performance with audio recorded from other
|
||||
models of modem, and with real world problematic telephone lines.
|
||||
|
||||
@@ -51,7 +51,7 @@ These tests allow either:
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -178,8 +178,8 @@ int main(int argc, char *argv[])
|
||||
int16_t caller_model_amp[BLOCK_LEN];
|
||||
int16_t answerer_model_amp[BLOCK_LEN];
|
||||
int16_t out_amp[2*BLOCK_LEN];
|
||||
AFfilehandle inhandle;
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *inhandle;
|
||||
SNDFILE *outhandle;
|
||||
int outframes;
|
||||
int i;
|
||||
int j;
|
||||
@@ -255,13 +255,13 @@ int main(int argc, char *argv[])
|
||||
if (modem_under_test_2 >= 0)
|
||||
printf("Modem channel 2 is '%s'\n", preset_fsk_specs[modem_under_test_2].name);
|
||||
|
||||
outhandle = AF_NULL_FILEHANDLE;
|
||||
outhandle = NULL;
|
||||
|
||||
if (log_audio)
|
||||
{
|
||||
if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 2)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 2)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -278,9 +278,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (decode_test_file)
|
||||
{
|
||||
if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", decode_test_file);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file);
|
||||
exit(2);
|
||||
}
|
||||
caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], TRUE, put_bit, NULL);
|
||||
@@ -289,10 +289,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (;;)
|
||||
{
|
||||
samples = afReadFrames(inhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
caller_model_amp,
|
||||
BLOCK_LEN);
|
||||
samples = sf_readf_short(inhandle, caller_model_amp, BLOCK_LEN);
|
||||
if (samples < BLOCK_LEN)
|
||||
break;
|
||||
for (i = 0; i < samples; i++)
|
||||
@@ -300,9 +297,9 @@ int main(int argc, char *argv[])
|
||||
fsk_rx(caller_rx, caller_model_amp, samples);
|
||||
}
|
||||
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", decode_test_file);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -429,13 +426,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (log_audio)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
out_amp,
|
||||
BLOCK_LEN);
|
||||
outframes = sf_writef_short(outhandle, out_amp, BLOCK_LEN);
|
||||
if (outframes != BLOCK_LEN)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -477,12 +471,7 @@ int main(int argc, char *argv[])
|
||||
if (log_audio)
|
||||
{
|
||||
for (i = 0; i < 200; i++)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
out_amp,
|
||||
BLOCK_LEN);
|
||||
}
|
||||
outframes = sf_writef_short(outhandle, out_amp, BLOCK_LEN);
|
||||
}
|
||||
if (modem_under_test_1 >= 0)
|
||||
{
|
||||
@@ -514,9 +503,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (log_audio)
|
||||
{
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: g1050_tests.c,v 1.17 2008/11/30 10:17:31 steveu Exp $
|
||||
* $Id: g1050_tests.c,v 1.18 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
#if defined(HAVE_MATH_H)
|
||||
#define GEN_CONST
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: g168_tests.c,v 1.19 2008/11/30 10:17:31 steveu Exp $
|
||||
* $Id: g168_tests.c,v 1.20 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "spandsp.h"
|
||||
#include "spandsp/g168models.h"
|
||||
#include "spandsp-sim.h"
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE (!FALSE)
|
||||
@@ -52,76 +53,18 @@ typedef struct
|
||||
int max;
|
||||
int cur;
|
||||
float gain;
|
||||
AFfilehandle handle;
|
||||
SNDFILE *handle;
|
||||
int16_t signal[SAMPLE_RATE];
|
||||
} signal_source_t;
|
||||
|
||||
signal_source_t local_css;
|
||||
signal_source_t far_css;
|
||||
|
||||
static AFfilehandle afOpenFile_telephony_read(const char *name, int channels)
|
||||
{
|
||||
float x;
|
||||
AFfilehandle handle;
|
||||
|
||||
if ((handle = afOpenFile(name, "r", 0)) == AF_NULL_FILEHANDLE)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", name);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetFrameSize(handle, AF_DEFAULT_TRACK, 1)) != 2.0)
|
||||
{
|
||||
fprintf(stderr, " Unexpected frame size in wave file '%s'\n", name);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetRate(handle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
|
||||
{
|
||||
printf(" Unexpected sample rate in wave file '%s'\n", name);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetChannels(handle, AF_DEFAULT_TRACK)) != (float) channels)
|
||||
{
|
||||
printf(" Unexpected number of channels in wave file '%s'\n", name);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
#if 0
|
||||
static AFfilehandle afOpenFile_telephony_write(const char *name, int channels)
|
||||
{
|
||||
AFfilesetup setup;
|
||||
AFfilehandle handle;
|
||||
|
||||
if ((setup = afNewFileSetup()) == AF_NULL_FILESETUP)
|
||||
{
|
||||
fprintf(stderr, " %s: Failed to create file setup\n", name);
|
||||
exit(2);
|
||||
}
|
||||
afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afInitRate(setup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
|
||||
afInitFileFormat(setup, AF_FILE_WAVE);
|
||||
afInitChannels(setup, AF_DEFAULT_TRACK, channels);
|
||||
|
||||
if ((handle = afOpenFile(name, "w", setup)) == AF_NULL_FILEHANDLE)
|
||||
{
|
||||
fprintf(stderr, " Failed to open result file\n");
|
||||
exit(2);
|
||||
}
|
||||
afFreeFileSetup(setup);
|
||||
|
||||
return handle;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
static void signal_load(signal_source_t *sig, const char *name)
|
||||
{
|
||||
sig->handle = afOpenFile_telephony_read(name, 1);
|
||||
sig->handle = sf_open_telephony_read(name, 1);
|
||||
sig->name = name;
|
||||
sig->max = afReadFrames(sig->handle, AF_DEFAULT_TRACK, sig->signal, SAMPLE_RATE);
|
||||
sig->max = sf_readf_short(sig->handle, sig->signal, SAMPLE_RATE);
|
||||
if (sig->max < 0)
|
||||
{
|
||||
fprintf(stderr, " Error reading sound file '%s'\n", sig->name);
|
||||
@@ -132,7 +75,7 @@ static void signal_load(signal_source_t *sig, const char *name)
|
||||
|
||||
static void signal_free(signal_source_t *sig)
|
||||
{
|
||||
if (afCloseFile(sig->handle) != 0)
|
||||
if (sf_close(sig->handle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close sound file '%s'\n", sig->name);
|
||||
exit(2);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: g711_tests.c,v 1.16 2009/04/22 12:57:40 steveu Exp $
|
||||
* $Id: g711_tests.c,v 1.17 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page g711_tests_page A-law and u-law conversion tests
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -64,7 +64,7 @@ const uint8_t ulaw_1khz_sine[] = {0x1E, 0x0B, 0x0B, 0x1E, 0x9E, 0x8B, 0x8B, 0x9E
|
||||
|
||||
static void compliance_tests(int log_audio)
|
||||
{
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *outhandle;
|
||||
power_meter_t power_meter;
|
||||
int outframes;
|
||||
int i;
|
||||
@@ -82,12 +82,12 @@ static void compliance_tests(int log_audio)
|
||||
g711_state_t *transcode;
|
||||
g711_state_t *dec_state;
|
||||
|
||||
outhandle = AF_NULL_FILEHANDLE;
|
||||
outhandle = NULL;
|
||||
if (log_audio)
|
||||
{
|
||||
if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -127,13 +127,10 @@ static void compliance_tests(int log_audio)
|
||||
}
|
||||
if (log_audio)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
65536);
|
||||
outframes = sf_writef_short(outhandle, amp, 65536);
|
||||
if (outframes != 65536)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -165,13 +162,10 @@ static void compliance_tests(int log_audio)
|
||||
}
|
||||
if (log_audio)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
65536);
|
||||
outframes = sf_writef_short(outhandle, amp, 65536);
|
||||
if (outframes != 65536)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -224,13 +218,10 @@ static void compliance_tests(int log_audio)
|
||||
printf("Reference u-law 1kHz tone is %fdBm0\n", power_meter_current_dbm0(&power_meter));
|
||||
if (log_audio)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
8000);
|
||||
outframes = sf_writef_short(outhandle, amp, 8000);
|
||||
if (outframes != 8000)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -248,13 +239,10 @@ static void compliance_tests(int log_audio)
|
||||
printf("Reference A-law 1kHz tone is %fdBm0\n", power_meter_current_dbm0(&power_meter));
|
||||
if (log_audio)
|
||||
{
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
8000);
|
||||
outframes = sf_writef_short(outhandle, amp, 8000);
|
||||
if (outframes != 8000)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -338,9 +326,9 @@ static void compliance_tests(int log_audio)
|
||||
|
||||
if (log_audio)
|
||||
{
|
||||
if (afCloseFile(outhandle))
|
||||
if (sf_close(outhandle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -351,8 +339,8 @@ static void compliance_tests(int log_audio)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
AFfilehandle inhandle;
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *inhandle;
|
||||
SNDFILE *outhandle;
|
||||
int outframes;
|
||||
int opt;
|
||||
int samples;
|
||||
@@ -427,16 +415,16 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
out_file = (decode) ? OUT_FILE_NAME : ENCODED_FILE_NAME;
|
||||
}
|
||||
inhandle = AF_NULL_FILEHANDLE;
|
||||
outhandle = AF_NULL_FILEHANDLE;
|
||||
inhandle = NULL;
|
||||
outhandle = NULL;
|
||||
file = -1;
|
||||
enc_state = NULL;
|
||||
dec_state = NULL;
|
||||
if (encode)
|
||||
{
|
||||
if ((inhandle = afOpenFile_telephony_read(in_file, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(in_file, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", in_file);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", in_file);
|
||||
exit(2);
|
||||
}
|
||||
enc_state = g711_init(NULL, law);
|
||||
@@ -451,9 +439,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (decode)
|
||||
{
|
||||
if ((outhandle = afOpenFile_telephony_write(out_file, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(out_file, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", out_file);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", out_file);
|
||||
exit(2);
|
||||
}
|
||||
dec_state = g711_init(NULL, law);
|
||||
@@ -470,10 +458,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (encode)
|
||||
{
|
||||
samples = afReadFrames(inhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
indata,
|
||||
BLOCK_LEN);
|
||||
samples = sf_readf_short(inhandle, indata, BLOCK_LEN);
|
||||
if (samples <= 0)
|
||||
break;
|
||||
len2 = g711_encode(enc_state, g711data, indata, samples);
|
||||
@@ -487,13 +472,10 @@ int main(int argc, char *argv[])
|
||||
if (decode)
|
||||
{
|
||||
len3 = g711_decode(dec_state, outdata, g711data, len2);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
outdata,
|
||||
len3);
|
||||
outframes = sf_writef_short(outhandle, outdata, len3);
|
||||
if (outframes != len3)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -506,9 +488,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (encode)
|
||||
{
|
||||
if (afCloseFile(inhandle))
|
||||
if (sf_close(inhandle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", IN_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -518,9 +500,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (decode)
|
||||
{
|
||||
if (afCloseFile(outhandle))
|
||||
if (sf_close(outhandle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: g722_tests.c,v 1.30 2009/04/22 12:57:40 steveu Exp $
|
||||
* $Id: g722_tests.c,v 1.32 2009/06/02 14:55:36 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -69,7 +69,7 @@ and the resulting audio stored in post_g722.wav.
|
||||
#include <unistd.h>
|
||||
#include <memory.h>
|
||||
#include <ctype.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
#include "spandsp.h"
|
||||
|
||||
@@ -357,9 +357,9 @@ int main(int argc, char *argv[])
|
||||
int len3;
|
||||
int i;
|
||||
int file;
|
||||
AFfilehandle inhandle;
|
||||
AFfilehandle outhandle;
|
||||
AFfilesetup filesetup;
|
||||
SNDFILE *inhandle;
|
||||
SNDFILE *outhandle;
|
||||
SF_INFO info;
|
||||
int outframes;
|
||||
int samples;
|
||||
int opt;
|
||||
@@ -370,7 +370,6 @@ int main(int argc, char *argv[])
|
||||
int encode;
|
||||
int decode;
|
||||
int tone_test;
|
||||
float x;
|
||||
const char *in_file;
|
||||
const char *out_file;
|
||||
int16_t indata[BLOCK_LEN];
|
||||
@@ -477,54 +476,44 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
out_file = (decode) ? OUT_FILE_NAME : ENCODED_FILE_NAME;
|
||||
}
|
||||
inhandle = AF_NULL_FILEHANDLE;
|
||||
outhandle = AF_NULL_FILEHANDLE;
|
||||
inhandle = NULL;
|
||||
outhandle = NULL;
|
||||
file = -1;
|
||||
if (encode)
|
||||
{
|
||||
if (eight_k_in)
|
||||
{
|
||||
if ((inhandle = afOpenFile(in_file, "r", NULL)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open(in_file, SFM_READ, &info)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", in_file);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", in_file);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
|
||||
if (info.samplerate != SAMPLE_RATE)
|
||||
{
|
||||
fprintf(stderr, " Unexpected frame size in wave file '%s'\n", in_file);
|
||||
fprintf(stderr, " Unexpected sample rate %d in audio file '%s'\n", info.samplerate, in_file);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetRate(inhandle, AF_DEFAULT_TRACK)) != (float) SAMPLE_RATE)
|
||||
if (info.channels != 1)
|
||||
{
|
||||
fprintf(stderr, " Unexpected sample rate %f in wave file '%s'\n", x, in_file);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
|
||||
{
|
||||
fprintf(stderr, " Unexpected number of channels in wave file '%s'\n", in_file);
|
||||
fprintf(stderr, " Unexpected number of channels in audio file '%s'\n", in_file);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((inhandle = afOpenFile(in_file, "r", NULL)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open(in_file, SFM_READ, &info)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", in_file);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", in_file);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetFrameSize(inhandle, AF_DEFAULT_TRACK, 1)) != 2.0)
|
||||
if (info.samplerate != G722_SAMPLE_RATE)
|
||||
{
|
||||
fprintf(stderr, " Unexpected frame size in wave file '%s'\n", in_file);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetRate(inhandle, AF_DEFAULT_TRACK)) != (float) G722_SAMPLE_RATE)
|
||||
{
|
||||
fprintf(stderr, " Unexpected sample rate %f in wave file '%s'\n", x, in_file);
|
||||
fprintf(stderr, " Unexpected sample rate %d in audio file '%s'\n", info.samplerate, in_file);
|
||||
exit(2);
|
||||
}
|
||||
if ((x = afGetChannels(inhandle, AF_DEFAULT_TRACK)) != 1.0)
|
||||
if (info.channels != 1)
|
||||
{
|
||||
fprintf(stderr, " Unexpected number of channels in wave file '%s'\n", in_file);
|
||||
fprintf(stderr, " Unexpected number of channels in audio file '%s'\n", in_file);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -543,24 +532,18 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (decode)
|
||||
{
|
||||
if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.frames = 0;
|
||||
info.samplerate = (eight_k_out) ? SAMPLE_RATE : G722_SAMPLE_RATE;
|
||||
info.channels = 1;
|
||||
info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
|
||||
info.sections = 1;
|
||||
info.seekable = 1;
|
||||
if ((outhandle = sf_open(out_file, SFM_WRITE, &info)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to create file setup\n");
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", out_file);
|
||||
exit(2);
|
||||
}
|
||||
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
if (eight_k_out)
|
||||
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
|
||||
else
|
||||
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) G722_SAMPLE_RATE);
|
||||
afInitFileFormat(filesetup, AF_FILE_WAVE);
|
||||
afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
|
||||
if ((outhandle = afOpenFile(out_file, "w", filesetup)) == AF_NULL_FILEHANDLE)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", out_file);
|
||||
exit(2);
|
||||
}
|
||||
afFreeFileSetup(filesetup);
|
||||
if (eight_k_out)
|
||||
g722_decode_init(&dec_state, bit_rate, G722_PACKED | G722_SAMPLE_RATE_8000);
|
||||
else
|
||||
@@ -578,10 +561,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (encode)
|
||||
{
|
||||
samples = afReadFrames(inhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
indata,
|
||||
BLOCK_LEN);
|
||||
samples = sf_readf_short(inhandle, indata, BLOCK_LEN);
|
||||
if (samples <= 0)
|
||||
break;
|
||||
if (tone_test)
|
||||
@@ -600,13 +580,10 @@ int main(int argc, char *argv[])
|
||||
if (decode)
|
||||
{
|
||||
len3 = g722_decode(&dec_state, outdata, adpcmdata, len2);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
outdata,
|
||||
len3);
|
||||
outframes = sf_writef_short(outhandle, outdata, len3);
|
||||
if (outframes != len3)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -619,9 +596,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (encode)
|
||||
{
|
||||
if (afCloseFile(inhandle))
|
||||
if (sf_close(inhandle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", IN_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -631,9 +608,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
if (decode)
|
||||
{
|
||||
if (afCloseFile(outhandle))
|
||||
if (sf_close(outhandle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: g726_tests.c,v 1.32 2009/04/22 12:57:40 steveu Exp $
|
||||
* $Id: g726_tests.c,v 1.33 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -73,7 +73,7 @@ decompressed, and the resulting audio stored in post_g726.wav.
|
||||
#include <unistd.h>
|
||||
#include <memory.h>
|
||||
#include <ctype.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -1224,8 +1224,8 @@ int main(int argc, char *argv[])
|
||||
int opt;
|
||||
int itutests;
|
||||
int bit_rate;
|
||||
AFfilehandle inhandle;
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *inhandle;
|
||||
SNDFILE *outhandle;
|
||||
int16_t amp[1024];
|
||||
int frames;
|
||||
int outframes;
|
||||
@@ -1266,14 +1266,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((inhandle = afOpenFile_telephony_read(IN_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(IN_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", IN_FILE_NAME);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@@ -1281,20 +1281,20 @@ int main(int argc, char *argv[])
|
||||
g726_init(&enc_state, bit_rate, G726_ENCODING_LINEAR, packing);
|
||||
g726_init(&dec_state, bit_rate, G726_ENCODING_LINEAR, packing);
|
||||
|
||||
while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, 159)))
|
||||
while ((frames = sf_readf_short(inhandle, amp, 159)))
|
||||
{
|
||||
adpcm = g726_encode(&enc_state, adpcmdata, amp, frames);
|
||||
frames = g726_decode(&dec_state, amp, adpcmdata, adpcm);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, amp, frames);
|
||||
outframes = sf_writef_short(outhandle, amp, frames);
|
||||
}
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
printf(" Cannot close wave file '%s'\n", IN_FILE_NAME);
|
||||
printf(" Cannot close audio file '%s'\n", IN_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
printf(" Cannot close wave file '%s'\n", OUT_FILE_NAME);
|
||||
printf(" Cannot close audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
printf("'%s' transcoded to '%s' at %dbps.\n", IN_FILE_NAME, OUT_FILE_NAME, bit_rate);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: gsm0610_tests.c,v 1.24 2009/04/22 12:57:40 steveu Exp $
|
||||
* $Id: gsm0610_tests.c,v 1.25 2009/05/30 15:23:13 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -123,7 +123,7 @@ will be compressed to GSM 06.10 data, decompressed, and the resulting audio stor
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -542,8 +542,8 @@ static void etsi_compliance_tests(void)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
AFfilehandle inhandle;
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *inhandle;
|
||||
SNDFILE *outhandle;
|
||||
int frames;
|
||||
int outframes;
|
||||
int bytes;
|
||||
@@ -580,14 +580,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((inhandle = afOpenFile_telephony_read(IN_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(IN_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", IN_FILE_NAME);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@@ -603,21 +603,21 @@ int main(int argc, char *argv[])
|
||||
exit(2);
|
||||
}
|
||||
|
||||
while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, pre_amp, 2*BLOCK_LEN)))
|
||||
while ((frames = sf_readf_short(inhandle, pre_amp, 2*BLOCK_LEN)))
|
||||
{
|
||||
bytes = gsm0610_encode(gsm0610_enc_state, gsm0610_data, pre_amp, frames);
|
||||
gsm0610_decode(gsm0610_dec_state, post_amp, gsm0610_data, bytes);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, post_amp, frames);
|
||||
outframes = sf_writef_short(outhandle, post_amp, frames);
|
||||
}
|
||||
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", IN_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
gsm0610_release(gsm0610_enc_state);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: ima_adpcm_tests.c,v 1.35 2008/11/30 10:17:31 steveu Exp $
|
||||
* $Id: ima_adpcm_tests.c,v 1.36 2009/05/30 15:23:14 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -49,7 +49,7 @@ of the degradation in quality caused by the compression.
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -66,8 +66,8 @@ of the degradation in quality caused by the compression.
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
AFfilehandle inhandle;
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *inhandle;
|
||||
SNDFILE *outhandle;
|
||||
int frames;
|
||||
int dec_frames;
|
||||
int outframes;
|
||||
@@ -126,15 +126,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if ((inhandle = afOpenFile_telephony_read(in_file_name, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(in_file_name, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", in_file_name);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", in_file_name);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
|
||||
total_pre_samples = 0;
|
||||
total_compressed_bytes = 0;
|
||||
total_post_samples = 0;
|
||||
while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, pre_amp, chunk_size)))
|
||||
while ((frames = sf_readf_short(inhandle, pre_amp, chunk_size)))
|
||||
{
|
||||
total_pre_samples += frames;
|
||||
ima_bytes = ima_adpcm_encode(ima_enc_state, ima_data, pre_amp, frames);
|
||||
@@ -182,16 +182,16 @@ int main(int argc, char *argv[])
|
||||
hist_out = 0;
|
||||
diff_energy += (double) xx * (double) xx;
|
||||
}
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, post_amp, dec_frames);
|
||||
outframes = sf_writef_short(outhandle, post_amp, dec_frames);
|
||||
}
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", in_file_name);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", in_file_name);
|
||||
exit(2);
|
||||
}
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
ima_adpcm_release(ima_enc_state);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: line_model_tests.c,v 1.26 2009/01/12 17:20:59 steveu Exp $
|
||||
* $Id: line_model_tests.c,v 1.27 2009/05/30 15:23:14 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page line_model_tests_page Telephony line model tests
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -73,25 +73,14 @@ static void complexify_tests(void)
|
||||
complexf_t cc;
|
||||
int16_t amp;
|
||||
int i;
|
||||
AFfilehandle outhandle;
|
||||
AFfilesetup filesetup;
|
||||
SNDFILE *outhandle;
|
||||
int outframes;
|
||||
int16_t out[40000];
|
||||
awgn_state_t noise1;
|
||||
|
||||
if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
|
||||
{
|
||||
fprintf(stderr, " Failed to create file setup\n");
|
||||
exit(2);
|
||||
}
|
||||
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
|
||||
afInitFileFormat(filesetup, AF_FILE_WAVE);
|
||||
afInitChannels(filesetup, AF_DEFAULT_TRACK, 2);
|
||||
|
||||
if ((outhandle = afOpenFile(OUT_FILE_COMPLEXIFY, "w", filesetup)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUT_FILE_COMPLEXIFY, 2)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_COMPLEXIFY);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_COMPLEXIFY);
|
||||
exit(2);
|
||||
}
|
||||
awgn_init_dbm0(&noise1, 1234567, -10.0f);
|
||||
@@ -103,21 +92,17 @@ static void complexify_tests(void)
|
||||
out[2*i] = cc.re;
|
||||
out[2*i + 1] = cc.im;
|
||||
}
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
out,
|
||||
20000);
|
||||
outframes = sf_writef_short(outhandle, out, 20000);
|
||||
if (outframes != 20000)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
if (afCloseFile(outhandle))
|
||||
if (sf_close(outhandle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_COMPLEXIFY);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_COMPLEXIFY);
|
||||
exit(2);
|
||||
}
|
||||
afFreeFileSetup(filesetup);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@@ -127,9 +112,8 @@ static void test_one_way_model(int line_model_no, int speech_test)
|
||||
int16_t input1[BLOCK_LEN];
|
||||
int16_t output1[BLOCK_LEN];
|
||||
int16_t amp[2*BLOCK_LEN];
|
||||
AFfilehandle inhandle1;
|
||||
AFfilehandle outhandle;
|
||||
AFfilesetup filesetup;
|
||||
SNDFILE *inhandle1;
|
||||
SNDFILE *outhandle;
|
||||
int outframes;
|
||||
int samples;
|
||||
int i;
|
||||
@@ -144,34 +128,21 @@ static void test_one_way_model(int line_model_no, int speech_test)
|
||||
|
||||
awgn_init_dbm0(&noise1, 1234567, -10.0f);
|
||||
|
||||
if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
|
||||
if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to create file setup\n");
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1);
|
||||
exit(2);
|
||||
}
|
||||
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
|
||||
afInitFileFormat(filesetup, AF_FILE_WAVE);
|
||||
afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
|
||||
|
||||
if ((inhandle1 = afOpenFile(IN_FILE_NAME1, "r", NULL)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME1, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", IN_FILE_NAME1);
|
||||
exit(2);
|
||||
}
|
||||
if ((outhandle = afOpenFile(OUT_FILE_NAME1, "w", filesetup)) == AF_NULL_FILEHANDLE)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_NAME1);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME1);
|
||||
exit(2);
|
||||
}
|
||||
for (i = 0; i < 10000; i++)
|
||||
{
|
||||
if (speech_test)
|
||||
{
|
||||
samples = afReadFrames(inhandle1,
|
||||
AF_DEFAULT_TRACK,
|
||||
input1,
|
||||
BLOCK_LEN);
|
||||
samples = sf_readf_short(inhandle1, input1, BLOCK_LEN);
|
||||
if (samples == 0)
|
||||
break;
|
||||
}
|
||||
@@ -189,27 +160,23 @@ static void test_one_way_model(int line_model_no, int speech_test)
|
||||
1);
|
||||
amp[j] = output1[j];
|
||||
}
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
samples);
|
||||
outframes = sf_writef_short(outhandle, amp, samples);
|
||||
if (outframes != samples)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
if (afCloseFile(inhandle1))
|
||||
if (sf_close(inhandle1))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", IN_FILE_NAME1);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1);
|
||||
exit(2);
|
||||
}
|
||||
if (afCloseFile(outhandle))
|
||||
if (sf_close(outhandle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME1);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME1);
|
||||
exit(2);
|
||||
}
|
||||
afFreeFileSetup(filesetup);
|
||||
one_way_line_model_release(model);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@@ -222,10 +189,9 @@ static void test_both_ways_model(int line_model_no, int speech_test)
|
||||
int16_t output1[BLOCK_LEN];
|
||||
int16_t output2[BLOCK_LEN];
|
||||
int16_t amp[2*BLOCK_LEN];
|
||||
AFfilehandle inhandle1;
|
||||
AFfilehandle inhandle2;
|
||||
AFfilehandle outhandle;
|
||||
AFfilesetup filesetup;
|
||||
SNDFILE *inhandle1;
|
||||
SNDFILE *inhandle2;
|
||||
SNDFILE *outhandle;
|
||||
int outframes;
|
||||
int samples;
|
||||
int i;
|
||||
@@ -242,49 +208,29 @@ static void test_both_ways_model(int line_model_no, int speech_test)
|
||||
awgn_init_dbm0(&noise1, 1234567, -10.0f);
|
||||
awgn_init_dbm0(&noise2, 1234567, -10.0f);
|
||||
|
||||
filesetup = afNewFileSetup();
|
||||
if (filesetup == AF_NULL_FILESETUP)
|
||||
if ((inhandle1 = sf_open_telephony_read(IN_FILE_NAME1, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to create file setup\n");
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME1);
|
||||
exit(2);
|
||||
}
|
||||
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afInitRate(filesetup, AF_DEFAULT_TRACK, (float) SAMPLE_RATE);
|
||||
afInitFileFormat(filesetup, AF_FILE_WAVE);
|
||||
afInitChannels(filesetup, AF_DEFAULT_TRACK, 2);
|
||||
|
||||
inhandle1 = afOpenFile(IN_FILE_NAME1, "r", NULL);
|
||||
if (inhandle1 == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle2 = sf_open_telephony_read(IN_FILE_NAME2, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", IN_FILE_NAME1);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", IN_FILE_NAME2);
|
||||
exit(2);
|
||||
}
|
||||
inhandle2 = afOpenFile(IN_FILE_NAME2, "r", NULL);
|
||||
if (inhandle2 == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 2)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", IN_FILE_NAME2);
|
||||
exit(2);
|
||||
}
|
||||
outhandle = afOpenFile(OUT_FILE_NAME, "w", filesetup);
|
||||
if (outhandle == AF_NULL_FILEHANDLE)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
for (i = 0; i < 10000; i++)
|
||||
{
|
||||
if (speech_test)
|
||||
{
|
||||
samples = afReadFrames(inhandle1,
|
||||
AF_DEFAULT_TRACK,
|
||||
input1,
|
||||
BLOCK_LEN);
|
||||
samples = sf_readf_short(inhandle1, input1, BLOCK_LEN);
|
||||
if (samples == 0)
|
||||
break;
|
||||
samples = afReadFrames(inhandle2,
|
||||
AF_DEFAULT_TRACK,
|
||||
input2,
|
||||
samples);
|
||||
samples = sf_readf_short(inhandle2, input2, samples);
|
||||
if (samples == 0)
|
||||
break;
|
||||
}
|
||||
@@ -308,32 +254,28 @@ static void test_both_ways_model(int line_model_no, int speech_test)
|
||||
amp[2*j] = output1[j];
|
||||
amp[2*j + 1] = output2[j];
|
||||
}
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
samples);
|
||||
outframes = sf_writef_short(outhandle, amp, samples);
|
||||
if (outframes != samples)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
if (afCloseFile(inhandle1))
|
||||
if (sf_close(inhandle1))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", IN_FILE_NAME1);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME1);
|
||||
exit(2);
|
||||
}
|
||||
if (afCloseFile(inhandle2))
|
||||
if (sf_close(inhandle2))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", IN_FILE_NAME2);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", IN_FILE_NAME2);
|
||||
exit(2);
|
||||
}
|
||||
if (afCloseFile(outhandle))
|
||||
if (sf_close(outhandle))
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
afFreeFileSetup(filesetup);
|
||||
both_ways_line_model_release(model);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: lpc10_tests.c,v 1.23 2009/01/12 17:20:59 steveu Exp $
|
||||
* $Id: lpc10_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
@@ -46,7 +46,7 @@ will be compressed to LPC10 data, decompressed, and the resulting audio stored i
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -67,9 +67,9 @@ will be compressed to LPC10 data, decompressed, and the resulting audio stored i
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
AFfilehandle inhandle;
|
||||
AFfilehandle refhandle;
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *inhandle;
|
||||
SNDFILE *refhandle;
|
||||
SNDFILE *outhandle;
|
||||
int frames;
|
||||
int outframes;
|
||||
double pre_energy;
|
||||
@@ -125,20 +125,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
compress_file = -1;
|
||||
decompress_file = -1;
|
||||
inhandle = AF_NULL_FILEHANDLE;
|
||||
refhandle = AF_NULL_FILEHANDLE;
|
||||
outhandle = AF_NULL_FILEHANDLE;
|
||||
inhandle = NULL;
|
||||
refhandle = NULL;
|
||||
outhandle = NULL;
|
||||
if (!decompress)
|
||||
{
|
||||
if ((inhandle = afOpenFile_telephony_read(in_file_name, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(in_file_name, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", in_file_name);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", in_file_name);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if ((refhandle = afOpenFile_telephony_read(REF_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((refhandle = sf_open_telephony_read(REF_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open wave file '%s'\n", REF_FILE_NAME);
|
||||
fprintf(stderr, " Cannot open audio file '%s'\n", REF_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
@@ -151,9 +151,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if ((outhandle = afOpenFile_telephony_write(OUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@@ -188,15 +188,15 @@ int main(int argc, char *argv[])
|
||||
while ((len = read(decompress_file, lpc10_data, BLOCKS_PER_READ*7)) > 0)
|
||||
{
|
||||
lpc10_decode(lpc10_dec_state, post_amp, lpc10_data, len/7);
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, post_amp, BLOCK_LEN*len/7);
|
||||
outframes = sf_writef_short(outhandle, post_amp, BLOCK_LEN*len/7);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
block_no = 0;
|
||||
while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, pre_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN
|
||||
while ((frames = sf_readf_short(inhandle, pre_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN
|
||||
&&
|
||||
(frames = afReadFrames(refhandle, AF_DEFAULT_TRACK, ref_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN)
|
||||
(frames = sf_readf_short(refhandle, ref_amp, BLOCKS_PER_READ*BLOCK_LEN)) == BLOCKS_PER_READ*BLOCK_LEN)
|
||||
{
|
||||
enc_len = lpc10_encode(lpc10_enc_state, lpc10_data, pre_amp, BLOCKS_PER_READ*BLOCK_LEN);
|
||||
if (compress)
|
||||
@@ -218,25 +218,25 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
block_no++;
|
||||
if (log_error)
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, log_amp, dec_len);
|
||||
outframes = sf_writef_short(outhandle, log_amp, dec_len);
|
||||
else
|
||||
outframes = afWriteFrames(outhandle, AF_DEFAULT_TRACK, post_amp, dec_len);
|
||||
outframes = sf_writef_short(outhandle, post_amp, dec_len);
|
||||
}
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", in_file_name);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", in_file_name);
|
||||
exit(2);
|
||||
}
|
||||
if (afCloseFile(refhandle) != 0)
|
||||
if (sf_close(refhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", REF_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", REF_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close wave file '%s'\n", OUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot close audio file '%s'\n", OUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
if (compress)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: make_g168_css.c,v 1.17 2009/02/10 17:49:20 steveu Exp $
|
||||
* $Id: make_g168_css.c,v 1.18 2009/05/30 15:23:14 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page makecss_page CSS construction for G.168 testing
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
#include <fftw3.h>
|
||||
#else
|
||||
@@ -139,20 +139,18 @@ int main(int argc, char *argv[])
|
||||
double pk;
|
||||
double ms;
|
||||
double scale;
|
||||
AFfilehandle filehandle;
|
||||
AFfilesetup filesetup;
|
||||
SNDFILE *filehandle;
|
||||
SF_INFO info;
|
||||
awgn_state_t noise_source;
|
||||
|
||||
if ((filesetup = afNewFileSetup()) == AF_NULL_FILESETUP)
|
||||
{
|
||||
fprintf(stderr, " Failed to create file setup\n");
|
||||
exit(2);
|
||||
}
|
||||
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afInitRate(filesetup, AF_DEFAULT_TRACK, FAST_SAMPLE_RATE);
|
||||
afInitFileFormat(filesetup, AF_FILE_WAVE);
|
||||
afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
|
||||
if ((filehandle = afOpenFile("sound_c1.wav", "w", filesetup)) == AF_NULL_FILEHANDLE)
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.frames = 0;
|
||||
info.samplerate = FAST_SAMPLE_RATE;
|
||||
info.channels = 1;
|
||||
info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
|
||||
info.sections = 1;
|
||||
info.seekable = 1;
|
||||
if ((filehandle = sf_open("sound_c1.wav", SFM_WRITE, &info)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to open result file\n");
|
||||
exit(2);
|
||||
@@ -243,26 +241,12 @@ int main(int argc, char *argv[])
|
||||
silence_sound[i] = 0.0;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
voiced_sound,
|
||||
voiced_length);
|
||||
}
|
||||
outframes = sf_writef_short(filehandle, voiced_sound, voiced_length);
|
||||
printf("%d samples of voice\n", 16*voiced_length);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
noise_sound,
|
||||
8192);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
noise_sound,
|
||||
C1_NOISE_SAMPLES - 8192);
|
||||
outframes = sf_writef_short(filehandle, noise_sound, 8192);
|
||||
outframes = sf_writef_short(filehandle, noise_sound, C1_NOISE_SAMPLES - 8192);
|
||||
printf("%d samples of noise\n", C1_NOISE_SAMPLES);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
silence_sound,
|
||||
C1_SILENCE_SAMPLES);
|
||||
outframes = sf_writef_short(filehandle, silence_sound, C1_SILENCE_SAMPLES);
|
||||
printf("%d samples of silence\n", C1_SILENCE_SAMPLES);
|
||||
|
||||
/* Now phase invert the C1 set of voice samples. */
|
||||
@@ -277,40 +261,28 @@ int main(int argc, char *argv[])
|
||||
noise_sound[i] = -noise_sound[i];
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
voiced_sound,
|
||||
voiced_length);
|
||||
}
|
||||
outframes = sf_writef_short(filehandle, voiced_sound, voiced_length);
|
||||
printf("%d samples of voice\n", 16*voiced_length);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
noise_sound,
|
||||
8192);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
noise_sound,
|
||||
C1_NOISE_SAMPLES - 8192);
|
||||
outframes = sf_writef_short(filehandle, noise_sound, 8192);
|
||||
outframes = sf_writef_short(filehandle, noise_sound, C1_NOISE_SAMPLES - 8192);
|
||||
printf("%d samples of noise\n", C1_NOISE_SAMPLES);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
silence_sound,
|
||||
C1_SILENCE_SAMPLES);
|
||||
outframes = sf_writef_short(filehandle, silence_sound, C1_SILENCE_SAMPLES);
|
||||
printf("%d samples of silence\n", C1_SILENCE_SAMPLES);
|
||||
|
||||
if (afCloseFile(filehandle) != 0)
|
||||
if (sf_close(filehandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close speech file '%s'\n", "sound_c1.wav");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
afInitSampleFormat(filesetup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
|
||||
afInitRate(filesetup, AF_DEFAULT_TRACK, FAST_SAMPLE_RATE);
|
||||
afInitFileFormat(filesetup, AF_FILE_WAVE);
|
||||
afInitChannels(filesetup, AF_DEFAULT_TRACK, 1);
|
||||
filehandle = afOpenFile("sound_c3.wav", "w", filesetup);
|
||||
if (filehandle == AF_NULL_FILEHANDLE)
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.frames = 0;
|
||||
info.samplerate = FAST_SAMPLE_RATE;
|
||||
info.channels = 1;
|
||||
info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
|
||||
info.sections = 1;
|
||||
info.seekable = 1;
|
||||
if ((filehandle = sf_open("sound_c3.wav", SFM_WRITE, &info)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Failed to open result file\n");
|
||||
exit(2);
|
||||
@@ -333,27 +305,13 @@ int main(int argc, char *argv[])
|
||||
printf("Noise level = %.2fdB, crest factor = %.2fdB\n", rms_to_dbm0(ms), rms_to_db(pk/ms));
|
||||
|
||||
for (i = 0; i < 14; i++)
|
||||
{
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
voiced_sound,
|
||||
voiced_length);
|
||||
}
|
||||
outframes = sf_writef_short(filehandle, voiced_sound, voiced_length);
|
||||
printf("%d samples of voice\n", 14*voiced_length);
|
||||
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
noise_sound,
|
||||
8192);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
noise_sound,
|
||||
C3_NOISE_SAMPLES - 8192);
|
||||
outframes = sf_writef_short(filehandle, noise_sound, 8192);
|
||||
outframes = sf_writef_short(filehandle, noise_sound, C3_NOISE_SAMPLES - 8192);
|
||||
printf("%d samples of noise\n", C3_NOISE_SAMPLES);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
silence_sound,
|
||||
C3_SILENCE_SAMPLES);
|
||||
outframes = sf_writef_short(filehandle, silence_sound, C3_SILENCE_SAMPLES);
|
||||
printf("%d samples of silence\n", C3_SILENCE_SAMPLES);
|
||||
|
||||
/* Now phase invert the set of voice samples. */
|
||||
@@ -369,34 +327,19 @@ int main(int argc, char *argv[])
|
||||
noise_sound[i] = -noise_sound[i];
|
||||
|
||||
for (i = 0; i < 14; i++)
|
||||
{
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
voiced_sound,
|
||||
voiced_length);
|
||||
}
|
||||
outframes = sf_writef_short(filehandle, voiced_sound, voiced_length);
|
||||
printf("%d samples of voice\n", 14*i);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
noise_sound,
|
||||
8192);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
noise_sound,
|
||||
C3_NOISE_SAMPLES - 8192);
|
||||
outframes = sf_writef_short(filehandle, noise_sound, 8192);
|
||||
outframes = sf_writef_short(filehandle, noise_sound, C3_NOISE_SAMPLES - 8192);
|
||||
printf("%d samples of noise\n", C3_NOISE_SAMPLES);
|
||||
outframes = afWriteFrames(filehandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
silence_sound,
|
||||
C3_SILENCE_SAMPLES);
|
||||
outframes = sf_writef_short(filehandle, silence_sound, C3_SILENCE_SAMPLES);
|
||||
printf("%d samples of silence\n", C3_SILENCE_SAMPLES);
|
||||
|
||||
if (afCloseFile(filehandle) != 0)
|
||||
if (sf_close(filehandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close speech file '%s'\n", "sound_c3.wav");
|
||||
exit(2);
|
||||
}
|
||||
afFreeFileSetup(filesetup);
|
||||
|
||||
fftw_destroy_plan(p);
|
||||
return 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: modem_connect_tones_tests.c,v 1.29 2008/11/30 10:17:31 steveu Exp $
|
||||
* $Id: modem_connect_tones_tests.c,v 1.30 2009/05/30 15:23:14 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \page modem_connect_tones_tests_page Modem connect tones tests
|
||||
@@ -42,7 +42,7 @@ These tests...
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <audiofile.h>
|
||||
#include <sndfile.h>
|
||||
|
||||
//#if defined(WITH_SPANDSP_INTERNALS)
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
@@ -186,8 +186,8 @@ int main(int argc, char *argv[])
|
||||
modem_connect_tones_rx_state_t ans_pr_rx;
|
||||
modem_connect_tones_tx_state_t modem_tone_tx;
|
||||
awgn_state_t chan_noise_source;
|
||||
AFfilehandle inhandle;
|
||||
AFfilehandle outhandle;
|
||||
SNDFILE *inhandle;
|
||||
SNDFILE *outhandle;
|
||||
int outframes;
|
||||
int frames;
|
||||
int samples;
|
||||
@@ -264,9 +264,9 @@ int main(int argc, char *argv[])
|
||||
if (decode_test_file == NULL && test_list == 0)
|
||||
test_list = 0xFFFFFFFF;
|
||||
|
||||
if ((outhandle = afOpenFile_telephony_write(OUTPUT_FILE_NAME, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot create wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@@ -277,13 +277,10 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK)
|
||||
{
|
||||
samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
samples);
|
||||
outframes = sf_writef_short(outhandle, amp, samples);
|
||||
if (outframes != samples)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
@@ -299,13 +296,10 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK)
|
||||
{
|
||||
samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
samples);
|
||||
outframes = sf_writef_short(outhandle, amp, samples);
|
||||
if (outframes != samples)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
@@ -322,13 +316,10 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK)
|
||||
{
|
||||
samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
samples);
|
||||
outframes = sf_writef_short(outhandle, amp, samples);
|
||||
if (outframes != samples)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
@@ -345,13 +336,10 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK)
|
||||
{
|
||||
samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
samples);
|
||||
outframes = sf_writef_short(outhandle, amp, samples);
|
||||
if (outframes != samples)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
@@ -368,13 +356,10 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; i < 20*SAMPLE_RATE; i += SAMPLES_PER_CHUNK)
|
||||
{
|
||||
samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
|
||||
outframes = afWriteFrames(outhandle,
|
||||
AF_DEFAULT_TRACK,
|
||||
amp,
|
||||
samples);
|
||||
outframes = sf_writef_short(outhandle, amp, samples);
|
||||
if (outframes != samples)
|
||||
{
|
||||
fprintf(stderr, " Error writing wave file\n");
|
||||
fprintf(stderr, " Error writing audio file\n");
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
@@ -383,9 +368,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
/*endif*/
|
||||
|
||||
if (afCloseFile(outhandle) != 0)
|
||||
if (sf_close(outhandle) != 0)
|
||||
{
|
||||
printf(" Cannot close wave file '%s'\n", OUTPUT_FILE_NAME);
|
||||
printf(" Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
|
||||
exit(2);
|
||||
}
|
||||
/*endif*/
|
||||
@@ -926,7 +911,7 @@ int main(int argc, char *argv[])
|
||||
hits = 0;
|
||||
for (j = 0; bellcore_files[j][0]; j++)
|
||||
{
|
||||
if ((inhandle = afOpenFile_telephony_read(bellcore_files[j], 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open speech file '%s'\n", bellcore_files[j]);
|
||||
exit (2);
|
||||
@@ -935,7 +920,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
when = 0;
|
||||
hits = 0;
|
||||
while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, 8000)))
|
||||
while ((frames = sf_readf_short(inhandle, amp, 8000)))
|
||||
{
|
||||
when++;
|
||||
modem_connect_tones_rx(&cng_rx, amp, frames);
|
||||
@@ -967,7 +952,7 @@ int main(int argc, char *argv[])
|
||||
/*endif*/
|
||||
}
|
||||
/*endwhile*/
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close speech file '%s'\n", bellcore_files[j]);
|
||||
exit(2);
|
||||
@@ -993,7 +978,7 @@ int main(int argc, char *argv[])
|
||||
modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, ced_detected, NULL);
|
||||
modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, ec_dis_detected, NULL);
|
||||
hits = 0;
|
||||
if ((inhandle = afOpenFile_telephony_read(decode_test_file, 1)) == AF_NULL_FILEHANDLE)
|
||||
if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
|
||||
{
|
||||
fprintf(stderr, " Cannot open speech file '%s'\n", decode_test_file);
|
||||
exit (2);
|
||||
@@ -1002,7 +987,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
when = 0;
|
||||
hits = 0;
|
||||
while ((frames = afReadFrames(inhandle, AF_DEFAULT_TRACK, amp, 8000)))
|
||||
while ((frames = sf_readf_short(inhandle, amp, 8000)))
|
||||
{
|
||||
when++;
|
||||
modem_connect_tones_rx(&cng_rx, amp, frames);
|
||||
@@ -1010,7 +995,7 @@ int main(int argc, char *argv[])
|
||||
modem_connect_tones_rx(&ans_pr_rx, amp, frames);
|
||||
}
|
||||
/*endwhile*/
|
||||
if (afCloseFile(inhandle) != 0)
|
||||
if (sf_close(inhandle) != 0)
|
||||
{
|
||||
fprintf(stderr, " Cannot close speech file '%s'\n", decode_test_file);
|
||||
exit(2);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user