[futurebasic] Re: [FB] ON TIMER event handling

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2002 : Group Archive : Group : All Groups

From: Richard Goodman <bhomme@...>
Date: Thu, 20 Jun 2002 08:34:43 -0700
 Peter Bancroft wrote:

TIMER once set going never stops running. You can't turn it off. It's been
this way forever.

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

Yes, I understand that. When I want to "disable" TIMER, I simply set TIMER
to some very large value so that my timer routine won't be accessed. When I
want to resume TIMER activation, I reset TIMER to the proper value.

My question had to do with error messages I got with certain TIMER
statements that appear in the reference manual:

ON TIMER END, ON TIMER OFF, TIMER(0) OFF, and TIMER OFF.

=============================
tedd  wrote:

Richard:

If you are trying to find when a melody is done by using ON TIMER,
then you're heading down a complicated road.

I suggest that you become familiar with the Apple's Sound Manager. In
there, it provides a way for a program to know when a melody is done
and much, much more. It's a bit of a steep learning curve, but well
worth it if you're doing sound stuff.

Besides, using the ON TIMER thing is not only difficult to use for
things like that, but can never be turned off.

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

tedd:

In fact, as I mentioned in my first message, I have got TIMER event
handling working. Although TIMER event handling cannot be turned off once
it is started, one can trick FB into ignoring it by setting the TIMER to a
very large value. As for the Sound Manager, I am using it for audio output
by Sebastian. Alain Pastor and others suggested that I use
SoundChannelStatus as a means to signal when a piece of music has finished
playing. However, this failed for me. The reason that I can't use it is
that my melodies are stored as strings of data. One character of each pair
of characters in the string is used for the frequency of the note and the
other character for the duration. The Sound Manager's SndPlay function is
accessed for _each note_ as it was done in Hommel's Sound Tutor. Therefore,
after each note has sounded, SndChannelStatus would give a signal that the
channel is empty. I don't see how I can used the Sound Manager to indicate
that the melody is completed because of this. If it were possible to sound
the music synchronously rather than asynchronously, then I would have no
problem. However, FB^3 apparently plays all music asynchronously via the
Sound Manager. Therefore, the entire melody string is read and supplied to
the sound queue while the first note is just sounding.

Richard