Page 1 of 1

BeatsPerMinute useage in code running smooth

PostPosted: Apr 16, 2002 @ 3:14pm
by Fuzzajakka
:? hmm.... H'm workin on this drum-pattern editor for PocketPC and now it's just about done... The only thing i just cant figure out is how i'm supposed to make the BPM run smoothly. At this time i'm using a SetTimer(win,1,60000/BPM/4,(TIMERPROC)Updatesong);... I think the reason why it isnt running smooth is that the program loop slows down the process and Phantom told me something about high resolution timers but i couldnt figure it out. No i'm not a pro. :lol: Just tryin to make something i can use for mixing in my band and it's GOTTA run smooth. :x well well. please help. thx!

PostPosted: Apr 16, 2002 @ 3:42pm
by Dan East
For time-critical applications you are better off not using a message-based technique as you are now.

The idea is to have a main loop and not relinquish control to the system. You can use GetTickCount to get a millisecond value to determine how much time elapses in each loop. Use Sleep to give up unused clock cycles (Sleeping saves battery life, allows other multi-tasking applications to still function properly, and is necessary if you take the multithreaded route below).

Regarding the GUI; you can either create a new thread to do the above mentioned processing in, or you can use the main thread, and add a Message Pump to your loop. Let me know if you want to go the latter route and I'll post some code.

Dan East

PostPosted: Apr 16, 2002 @ 3:53pm
by refractor

Sorry but i dont think i got that...

PostPosted: Apr 16, 2002 @ 3:57pm
by Fuzzajakka

Oh! Another reply. =)

PostPosted: Apr 16, 2002 @ 4:01pm
by Fuzzajakka

PostPosted: Apr 16, 2002 @ 4:07pm
by refractor

PostPosted: Apr 16, 2002 @ 4:11pm
by Dan East

PostPosted: Apr 16, 2002 @ 4:14pm
by Dan East

PostPosted: Apr 16, 2002 @ 4:21pm
by refractor

Awesome!

PostPosted: Apr 16, 2002 @ 4:56pm
by Fuzzajakka
=D =D =D THANKS!!! ok. so it's workin now... cant thank you enough! :P :lol: :twisted: ALLRIGHT!!! SHOWTIME!!! okok... easy.... Well... Thanks for the help!