replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - How do I make the computer beep?
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do I make the computer beep?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Sat Nov 22, 2008 1:27 am    Post subject: How do I make the computer beep? Reply with quote

I'm sending ASCII characters to a text window. I call a subroutine with the integer value of the ASCII character (0-127), and the subroutine uses CHAR to convert to a character, then appends the character to the end of a buffer that's being displayed in the text window, and update. All is well and good, it works. Printable ones appear as though the window were a console of some kind, no problem. Even the CR/LF combo performs as expected - very cool.

When I send it a 7, which is the ASCII "BEL" character, I'd like the computer to go "beep". It doesn't - I just get a small black block for that character in the text window. I can suppress the black block easily enough. But how do I make the computer go "beep"? The HELP file describes some kind of BEEP function, and uses it in a line where a button is pressed to go "beep". But I'm not using a button-press to do this. How to simply produce a "beep" sound?

Thanks all!

-----------------------------------

ON EDIT:

I'm using FTN95, of course.

After fiddling with it for a while, I found that including <windows.ins> in the subroutine, and using the statement LB=BEEP("EXCLAMATION",J) where J is an integer and LB is a logical variable, it compiles without error and runs just fine... except I still don't hear any beeps when that statement is executed. (I put a PRINT statement right before it, and I can see the printed stuff just fine, so it's definitely executing this statement too).

Is there some place in the HELP files that explains how to use this function?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Sat Nov 22, 2008 9:28 am    Post subject: Reply with quote

There is a "standard" callback with the name BEEP that is described in the help file but you cannot call it in the way that you mention.

It turns out that the documentation in this context is incorrect because MBOK should be OK instead.

There is a Windows API function in windows.ins in the form

LOGICAL L = MessageBeep(integer)

where "integer" is one of the constants MB_OK etc.

At the moment I cannot get either of the above to work on my machine so I will have to check further.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Sat Nov 22, 2008 11:48 am    Post subject: Reply with quote

I still cannot get either of the above methods to work (both use MessageBeep) even though I have reset the sounds to the Windows default via the "Sounds and Audio Devices Properties" in the "Control Panel" (click on Start and the Control Panel).

However, the following function call works OK...

Code:
include <windows.ins>
logical L
L = Beep( 250, 175 )


The first argument is the sound frequency and the second is the duration in milliseconds.
Back to top
View user's profile Send private message AIM Address
Little-Acorn



Joined: 06 Jul 2008
Posts: 111
Location: San Diego

PostPosted: Sat Nov 22, 2008 4:50 pm    Post subject: Reply with quote

Paul, BINGO!!! The simple version (freq and duration) worked perfectly. That's what I was looking for.

Thank you!
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Mon Nov 24, 2008 2:00 pm    Post subject: Reply with quote

Here is another simple way to provide a sound...

Code:
include <windows.ins>
iret=play_sound_resource@("mysound")
end

RESOURCES
mysound SOUND "C:\\windows\\media\\Windows XP Logon Sound.wav"


There are a large number of standard sounds in the media folder.
Back to top
View user's profile Send private message AIM Address
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Mon Nov 24, 2008 2:14 pm    Post subject: Reply with quote

I simply use this:-

Code:
CALL BEEP@


which I have used in my code since the days of DOS with FTN77 and is still part of FTN95. It does not require any include files or resources.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Mon Nov 24, 2008 4:38 pm    Post subject: Reply with quote

Thanks for this.

BEEP@ is equivalent to Beep(frequency, duration) but with a fixed frequency and duration. The alternative gives you fancy wav sounds.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
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


Powered by phpBB © 2001, 2005 phpBB Group