Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Playing windows.beep through EXTERNAL speakers

Status
Not open for further replies.

DomAntPallot

Programmer
May 26, 2007
16
0
0
GB
Hello,

I have created a couple of programs using the windows.beep function to make interesting computer instruments.

I created the program on my laptop (Windows 2000) and the beeps came through the headphones and so I could control the level. It was only when I gave the program to my brother did I find out that in XP it puts the beeps out through the internal speakers.

This means that because the sound it not going through the sound card it can not be recorded!

This is very annoying and I can not seem to find a way around it.

I would be very grateful for any ones help.
 
by default xp beeps through the sound card,
i think that it only uses the pc speaker if

1. theres no sound card.
2. the card drivers are not installed.
3. a pc speaker driver is installed and set as the prefered device.

Aaron
 
Thanks for the reply.

I have a sound card and the drivers must be installed because I use the speakers and headphones everyday.

So is it problem 3, that the pc speaker is set as the preferred device. If so how do I change it?

Dom
 
Just had another thought.

You are correct in saying that the beep function plays through the speakers. (That is the function that is called directly by just typing 'Beep')

But the function

windows.beep(frequency, duration)

plays through the system speaker
 
Hi Sorry,

I am using the function

windows.beep(frequency, duration)
 
ok so if you want internal speaker beep
windows.beep(50,50);

if you want sound card beep
beep;

problem solved ,yes?

from delphi sdk help

The Beep function generates simple tones on the speaker. The function is synchronous; it does not return control to its caller until the sound finishes.

On computers with a sound card, the function plays the default sound event. On computers without a sound card, the function plays the standard system beep.

Aaron
 
The problem is that the function 'Beep' plays just the system beep.

By using the function windows.beep what I am doing is actually creating music.

I can not create music with one simple system beep.

I need to use the windows.beep so that I can create different tones - hence make music.

On my laptop (windows 2000) its plays the simple tone through my soundcard BUT On my desktop and my brothers laptop (windows xp) it generates the simple tones through the internal speaker. Which is of no use to me.

Is there a way to create the simple tones through the soundcard?
 
If you call messagebeep (Windows API function) directly you can pass the required frequency. (see the SDK help)


Steve [The sane]: Delphi a feersum engin indeed.
 
This is what I found about messagebeep()

"...this function can also play a beep on the computer's INTERNAL speaker. The function returns 1 if successful, or 0 if an error occured. "

However the problem again is that it plays the beeps on the internal speaker.

Maybe there is a setting on the PC to route the internal speakers through the sound card.
 
Maybe there is a setting on the PC to route the internal speakers through the sound card.
Actually, it could be hardware in the case of the desktop. Most motherboards (MB) and sound cards have (2) jumper pins to connect the PC internal speaker. If you connect the internal speaker to the pins on the MB, the PC sound goes to the speaker. If you connect it to the sound card with the included wire, you'll here it out the sound card's speakers. Most PC manufacturers don't bother.

In the case of an on-board sound card, it may be software selectable.

Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top