#include "WaveFormats.h"
|
#include "../../Tracer/Tracer.h"
|
|
WaveFormat::WaveFormat()
|
{
|
}
|
|
WaveFormat::~WaveFormat()
|
{
|
}
|
|
WAVEFORMATEX
|
WaveFormat::GetWaveFormat(int nWaveFormat)
|
{
|
WAVEFORMATEX wfx;
|
switch(nWaveFormat)
|
{
|
case WaveFormat_ULaw:
|
wfx.wFormatTag = WAVE_FORMAT_MULAW;
|
wfx.cbSize = 0;
|
wfx.nAvgBytesPerSec = 8000;
|
wfx.nBlockAlign = 1;
|
wfx.nChannels = 1;
|
wfx.nSamplesPerSec = 8000;
|
wfx.wBitsPerSample = 8;
|
break;
|
case WaveFormat_ALaw:
|
wfx.wFormatTag = WAVE_FORMAT_ALAW;
|
wfx.cbSize = 0;
|
wfx.nAvgBytesPerSec = 8000;
|
wfx.nBlockAlign = 1;
|
wfx.nChannels = 1;
|
wfx.nSamplesPerSec = 8000;
|
wfx.wBitsPerSample = 8;
|
break;
|
case WaveFormat_G729:
|
wfx.wFormatTag = WAVE_FORMAT_CISCO_G729;
|
wfx.cbSize = 0;
|
wfx.nAvgBytesPerSec = 1000;
|
wfx.nBlockAlign = 1;
|
wfx.nChannels = 1;
|
wfx.nSamplesPerSec = 8000;
|
wfx.wBitsPerSample = 8;
|
break;
|
case WaveFormat_G723_53:
|
wfx.wFormatTag = WAVE_FORMAT_CISCO_G723_53;
|
wfx.cbSize = 0;
|
wfx.nAvgBytesPerSec = 667;
|
wfx.nBlockAlign = 1;
|
wfx.nChannels = 1;
|
wfx.nSamplesPerSec = 8000;
|
wfx.wBitsPerSample = 8;
|
case WaveFormat_G723_63:
|
wfx.wFormatTag = WAVE_FORMAT_CISCO_G723_63;
|
wfx.cbSize = 0;
|
wfx.nAvgBytesPerSec = 800;
|
wfx.nBlockAlign = 1;
|
wfx.nChannels = 1;
|
wfx.nSamplesPerSec = 8000;
|
wfx.wBitsPerSample = 8;
|
break;
|
case WaveFormat_PCM_16_8_1:
|
wfx.wFormatTag = WAVE_FORMAT_PCM;
|
wfx.cbSize = 0;
|
wfx.nAvgBytesPerSec = 16000;
|
wfx.nBlockAlign = 2;
|
wfx.nChannels = 1;
|
wfx.nSamplesPerSec = 8000;
|
wfx.wBitsPerSample = 16;
|
break;
|
default:
|
break;
|
}
|
return wfx;
|
}
|
|
void
|
WaveFormat::TraceFormat(Tracer *tracer, unsigned long traceLevel, WAVEFORMATEX &wfx)
|
{
|
tracer->tracef(traceLevel, "WAVEFORMATEX wFormatTag=%u, nAvgBytesPerSec=%u, nSamplesPerSec=%u, wBitsPerSample=%u, nChannels=%u, nBlockAlign=%u, cbSize=%u\n", wfx.wFormatTag, wfx.nAvgBytesPerSec, wfx.nSamplesPerSec, wfx.wBitsPerSample, wfx.nChannels, wfx.nBlockAlign, wfx.cbSize);
|
}
|