Board index » delphi » Beep in Delphi???

Beep in Delphi???

Hi,

Being new to Delphi/Windows programming I was wondering if there's a way to
get a 'beep' sound other than the standard predefined windows beeps?
Anything similar to 'sound' in TP?

Thanks for any replies via e-mail please!
(li...@wintermute.co.uk)

Iain

Iain Russell
http://www.wintermute.co.uk/users/libra/

 

Re:Beep in Delphi???


Quote
li...@wintermute.co.uk (Iain Russell) wrote:
>Hi,
>Being new to Delphi/Windows programming I was wondering if there's a way to
>get a 'beep' sound other than the standard predefined windows beeps?
>Anything similar to 'sound' in TP?
>Thanks for any replies via e-mail please!
>(li...@wintermute.co.uk)
>Iain
>Iain Russell
>http://www.wintermute.co.uk/users/libra/

There was much discussion recently on this issue.  The consenses was
basically no.  You can do the standard beep using the API but no other
beep.  The only solution that I saw offered was to use a wav file and
play it.  Some people suggested geting the sound card specs etc and
and basically using DSP to do it...yuck!  The future looks somewhat
brighter as MS has a solution coming and I can't remember what its
name is.

Eric Miles
mil...@usafe14.ramstein.af.mil
.............................................
My opinions and comments are my own and ONLY
my own and reflect in no way the Air Force's.
.............................................

Re:Beep in Delphi???


Quote
mil...@usafe14.ramstein.af.mil (Eric Miles) wrote:
>li...@wintermute.co.uk (Iain Russell) wrote:
>[Can I get Delphi to beep as in Turbo Pascal?]
>There was much discussion recently on this issue.  The consenses was
>basically no.  

Well, from the latest Delphi Developer's Group newsletter (I just went to
one of their conferences) there's a routine by Steve Keyser (CIS). I'm not
sure if it works properly since the PC I use has some werid kinda sound
setup, but here it is, using 'obsolete' Windows API calls... maybe you
discussed this before? Is it valid code?

procedure MakeSound(note, duration: Integer);
{Purpose: Play a sound on the PC's speaker}
var
  result:Integer;
begin

  if (note<1) or (note>84) then exit;
  if (duration < 1 ) or (duration > 128) then exit;

  result:=OpenSound;
  result:=SetVoiceQueueSize(1, 6);
  result:=StartSound;
  result:=WaitSoundState(S_QUEUEEMPTY);
  CloseSound;  

end;

Iain Russell
http://www.wintermute.co.uk/users/libra/

Other Threads