delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/23/09:37:00

From: tdixon DOT no AT spam DOT fwi DOT com (Timothy Dixon)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Sound C++ with DJGPP
Date: Wed, 23 Jun 1999 13:05:02 GMT
Organization: Posted via RemarQ, http://www.remarQ.com - The Internet's Discussion Network
Lines: 56
Message-ID: <3770daa4.482619239@midpoint>
References: <3768A98B DOT 47FBAC85 AT computerpro DOT com> <376944DE DOT 2EEABF6B AT computerpro DOT com> <929775095 DOT 676729 AT diddley DOT primus DOT com DOT au> <37703244 DOT 48BB0E5C AT computerpro DOT com>
NNTP-Posting-Host: 208.153.194.246
NNTP-Posting-Date: Wed, 23 Jun 1999 13:05:52 GMT
X-Trace: 930143152.947.77 QYJKPSJLTC2F6D099C qube-02.us-ca.remarq.com
X-Complaints-To: newsabuse AT remarQ DOT com
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Tue, 22 Jun 1999 20:03:00 -0500, paradise AT computerpro DOT com wrote:

>hmm...
>
>The problem I'm having with sound( ) and nosound( ) and delay( ) is that I
>don't know the syntax of what goes in ( ).
>
>In replace of sound( int _Frequency)
>ie. sound(A5)?????????? or something??????
>anyone know what I mean
>
>
>
>
>C++
>
>
>
>
>
>Steven Taylor wrote:
>
>> > The library reference on sound says the syntax is:
>> > ------------------------------------------------
>> >     #include <pc.h>
>> >
>> >     void sound(int _frequency);
>> > ------------------------------------------------
>> > _frequency being a number for the tone, I guess.
>> >
>> > I keep getting errors when compiling.
>> > I don't think I'm putting these lines in my code properly.
>> >
>> > Help!!!
>> oh dear. If you're getting a linker error, then you haven't installed DJGPP
>> properly. If you're getting a compiler error, you either haven't read the
>> docs properly or you need to learn how to program in C or C++.
>


sound() starts the speaker oscillating at a specific frequency
specified by _frequency (an integer).  Frequencies between 250hz and
1500hz make useful sounds; way back when I had a sheet that listed
various notes and their frequencies (middle C, etc).

You would make a call like
	sound(1000);
to start a 1Khz tone and some time later,
	nosound();

to turn it off.  If you are doing anything complex at all between
sound() and nosound(), you might want to create a program that
consists only of a call to nosound() so that if your program crashes
you can shut the sound off before you go bonkers. :-)


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019