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:
Robert Joly committed 2009-06-18 06:13:59 +00:00
1 parent 832bab2a4a
commit e791f33545
131 files changed
+8988 -2017

No files matched your search

+55 -22
View File
@@ -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;