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
2009-06-18 06:13:59 +00:00
parent 832bab2a4a
commit e791f33545
131 changed files with 8988 additions and 2017 deletions
+22 -59
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: 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;