DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

WaveAudio tweaks

 
   Reply to topic    DELPHI AREA Forum Index -> DELPHI AREA's Products
View previous topic :: View next topic  
Author Message
Roko
Member


Joined: 13 Oct 2003
Posts: 1
Location: Khmelnitsky, Ukraine

PostPosted: 13/10/03 14:17    Post subject: WaveAudio tweaks Reply with quote

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;
Back to top
View user's profile
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 206

PostPosted: 13/10/03 20:15    Post subject: Reply with quote

Thanks a lot! Smile
Back to top
View user's profile Send e-mail Visit poster's website
Display posts from previous:   
   Reply to topic    DELPHI AREA Forum Index -> DELPHI AREA's Products All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group