Ok, so the user plays a song with the keyboard. The note that are played are
saved in a dictionary (song as dictionary). The key is Ticks and the value
is like this: "PlayNote|69|60+PlayNote|49|60". PlayNote means to play a
note, the first value is pitch and the second value is velocity. As you can
see, different notes are seperated from each other with a "+".
Now, I want to play those notes. I've a thread with a loop in it to the
window. In the run event looks like this:
-dim BegintTime as Integer=Ticks
-dim time as Integer
-dim Ignore as Dictionary
-Do
- time=Ticks-BeginTime
- if song.HasKey(time) and not Ignore.HasKey(time) then
- Ignore.Value(time)=1
- ProcessCommand song.Value(time)
- end if
-Loop Until Time>=Song.Value("EndTime")
ProcessCommand processes the command, wich can be
"ChangeInstrument|Instrument" or "PlayNote|Pitch|Velocity" or any
combinations seperated by "+". I don't do this in the thread to make the
thread not skip any ticks (in case it would take some time to process the
command).
An now the problem:
It does play most of the notes, but it skips a few (when there are a lot of
PlayNote commands). Why does it do this? Can you see any obvious reason why
this doesn't work perfectly? My guess is that it skips a some Ticks because
the script would take a few ticks to process. But how could it take that
long? There is no return value for ProcessCommand, so it shouldn't wait for
it to be done. Or does it? If so, how can I solve it?
Thanks,
Maarten
_______________________________________________
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>