- Code: Select all
void __fastcall TdtaTapi::pPlayerFormat(TObject *Sender,
PWaveFormatEx pWaveFormat, bool &FreeIt)
{
pWaveFormat=new WAVEFORMATEX;
FreeIt=true;
pWaveFormat->wFormatTag=WAVE_FORMAT_PCM;
pWaveFormat->nChannels=1;
pWaveFormat->nSamplesPerSec=8000;
pWaveFormat->nAvgBytesPerSec=16000;
pWaveFormat->nBlockAlign=2;
pWaveFormat->wBitsPerSample=16;
pWaveFormat->cbSize=0;
}
When I debug your Delphi code when leaving the event, I see that pWaveFormat retrieves its value before the event call. So, the following instruction fails :
if Success(WaveOutOpen(nil, DeviceID, pWaveFormat, 0, 0, WAVE_FORMAT_QUERY)) then
and FreeMem(pWaveFormat); throws an exception.
Since the predefined values of wave format do not match my format, it seems this event is mandatory. Is there another way to ask to your control to use my WAVEFORMATEX structure ?
Thanks.