Thanks to all.
On Jan 3, 2006, at 6:06 PM, everyone wrote:
Subject: Re: Beat Counter doesn't play in time
From: Lee Unsworth <[EMAIL PROTECTED]>
Date: Tue, 3 Jan 2006 21:49:01 +0000
are you trying to speed the sound up to a certain tempo
The example is supposed to play a sound every beat at 100bpm. It
doesn't and the individual hits are completely uneven.
i downloaded the counter and it seems like it is just playing it
depending on processor power and not in any time.
Correct. This is the problem... Using Microseconds seems very unstable
How exactly does it do that? Can you post the code in the thread
(which I imagine is quite short)? (No, I don't want to download the
example project.)
A thread in a tight loop isn't a bad approach to this, albiet rather
processor-hungry. Another approach would be a timer with a very
short period. When the timer fires, and it sees that it's within a
period or two of the time it should play, then it goes into a tight
loop and waits for the proper time to come.
Joseph J. Strout
Joe: Here is the code in the Run of a Thread called PlayLoop:
Dim LastBeat as double
LastBeat=Microseconds
while window1.playon = true
if Microseconds - LastBeat >= 150000 then
HighHat.play
window1.LastBeat = Microseconds
end if
wend
I can't find the array. What's it called and where is it?
Also, what is the purpose of the property
window1.CurrentBeat ?
It counts up to 32 and is then reset but nothing ever seems to check =
Steve: This was a snippet from the actual code... In the other code
it plays a sound s(X) from an array...
CurrentBeat keeps track of the number of beats in a measure (32 = 2
measures) used elsewhere in the app
If you're going to use Microseconds, check it once per iteration.
dim now as double
while window1.playon =3d true
now =3d Microseconds
if now - window1.LastBeat >=3d 150000 then
window1.LastBeat =3d now
Steve Garman
Steve isn't the above code only checking once per iteration?
Thanks to all who have responded... The example project shows in a
"Bear Bones" sort of way that RB might not be the sort of language to
do this kind of thing... I might be missing another way to do it
better...
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>