I'm trying Wave Audio components for possible usage in some upcoming project. So far they look good. Especially promising is WaveCollection in addition to Stock Recorder/Player.
My wav files will be A-Law coded, so I used nonePCM PCMFormat and tried setting format in OnFormat event. This event is missing in TStockAudioRecorder! So I added following line to published section of TStockAudioRecorder class declaration
property OnFormat;
to make it published. It worked OK after that.
Another possible correction is in WaveIn.pas. When OnFormat call returns with pWaveFormat = nil in TWaveAudioIn.InternalOpen, AV is generated. So I added check:
function TWaveAudioIn.InternalOpen: Boolean;
var
pWaveFormat: PWaveFormatEx;
FreeWaveFormat: Boolean;
begin
Result := False;
if not Active then
begin
FreeWaveFormat := True;
GetWaveFormat(pWaveFormat, FreeWaveFormat);
if pWaveFormat <> nil then // this is check
try
if Success(WaveInOpen(nil, DeviceID, pWaveFormat, 0, 0, WAVE_FORMAT_QUERY)) then
begin
AvgBytesPerSec := pWaveFormat^.nAvgBytesPerSec;
SamplesPerSec := pWaveFormat^.nSamplesPerSec;
BlockAlign := pWaveFormat^.nBlockAlign;
Result := Success(WaveInOpen(@fHandle, DeviceID, pWaveFormat, CallbackWND, 0, CALLBACK_WINDOW));
end;
finally
if FreeWaveFormat then
FreeMem(pWaveFormat);
end;
end
else if not Closing then
raise EWaveAudioInvalidOperation.Create('Device is aleardy open');
end;