[futurebasic] Re: [FB] Making Sounds

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2000 : Group Archive : Group : All Groups

From: tedd@...
Date: Mon, 23 Oct 2000 10:52:08 -0400
Ken:

It was I (tedd) instead of Pierre that was asking the sound question.
Pierre simply replied that I should look into the examples of FBII (which I
had already investigated) for the solution to my sound problem.

I find your FB^3 code interesting in that one can reference FN playSound
several times without any change in program performance -- such as:

   FN playSound
   FN playSound
   FN playSound

   DO
      HANDLEEVENTS
   UNTIL 0

as compared to:

   FN playSound

   DO
      HANDLEEVENTS
   UNTIL 0

Interesting... There appears to be no difference in the length or duration
of the sound played. It appears to be played only once regardless of the
number of times the function is called.

Still, the question remains as to how one may make a sound at a specific
frequency.

tedd

--- you wrote:
>
>Ken
>
>'------------------- Begin Code -----------------------
>
>BEGIN RECORD SndCommand
>DIM cmd AS unsigned short
>DIM param1 AS short
>DIM param2 AS long
>END RECORD
>
>CLEAr LOCAL MODE
>DIM @ chanPtr AS Pointer
>DIM count   AS unsigned long
>DIM change  as short
>DIM err     AS short
>DIM mycmd   AS SndCommand
>LOCAL FN playSound
>err = FN SndNewChannel(chanPtr, _squareWaveSynth, 0, _nil)
>
>mycmd.cmd = _freqCmd
>mycmd.param1 = 0
>mycmd.param2 = 50
>
>err = FN SndDoImmediate(chanPtr, mycmd)
>
>mycmd.cmd = _timbreCmd
>mycmd.param1 = 0
>mycmd.param2 = 86
>
>err = FN SndDoImmediate(chanPtr, mycmd)
>
>DELAY 2000
>
>err = FN SndDisposeChannel(chanPtr,_false)
>
>END
>
>END FN
>
>FN playSound
>
>DO
>HANDLEEVENTS
>UNTIL 0
>
>'------------------- End Code -------------------------
>
>
>or you can also use some FB predefined constants like this:
>
>
>'------------------- Begin Code -----------------------
>
>
>CLEAR LOCAL MODE
>DIM @ chanPtr AS Pointer
>DIM count   AS unsigned long
>DIM change  as short
>DIM err     AS short
>DIM mycmd.sndcsize
>LOCAL FN playSound
>err = FN SndNewChannel(chanPtr, _squareWaveSynth, 0, _nil)
>
>mycmd.cmd%` = _freqCmd
>mycmd.param1% = 0
>mycmd.param2& = 50
>
>err = FN SndDoImmediate(chanPtr, mycmd)
>
>mycmd.cmd%` = _timbreCmd
>mycmd.param1% = 0
>mycmd.param2& = 86
>
>err = FN SndDoImmediate(chanPtr, mycmd)
>
>DELAY 2000
>
>err = FN SndDisposeChannel(chanPtr,_false)
>
>END
>
>END FN
>
>FN playSound
>
>DO
>HANDLEEVENTS
>UNTIL 0
>END
>
>'------------------- End Code -------------------------
>
>--
>To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>


http://sperling.com/
_______________________________________________________
Thinking about buying Jewelry?
Try our site: http://earthstones.com