Hi,
How good is the Win32::GUI timer for semi realtime applications? I've
codedd a drum machine, minus some final tweaks and testing, in Perl
using Win32::GUI as the GUI lib and Win32::MIDI for MIDI. I generate my
own note off events (note on velocity 0) so that Win32::MIDI does not
have to sleep. As I want the ability to operate the GUI while the thing
plays back stuff, I use Win32::GUI::Timer as the heart beat for my step
sequencer. I need the ability to time pretty exactly 32th notes from 50
to 250 bpm (150 to 30 ms), since I want to be able to quantize the
user's input to the closest 16th note (step). I'd also need a pretty
exact sleep for generating lag for swing, at max one 32th note and
possibly much smaller values, too. I'm using Win32::Sleep for the swing,
at the moment.

Timing seems surprisingly stable and even though I use large amounts of
objects (each step is one) and hash lookups Perl's CPU usage shows 0,
even when playing simultaneously 12 parts at 250 bpm. However, at some
pretty normal tempo ranges like 130 to 140 BPM, changing the tempo does
seem to have very little effect. However, if I export the data as MIDi
at 960 PPQ, I use the MIDI Perl modules for that, the tempo does change.

This has left me wondering whether Perl is the right tool for this job,
though the programmer convenience of Win32::GUI, Storable, Archive::Zip
and  MIDI Perl is huge over C and the Win32 API (without GUI builders). 

My question is, is there a tighter timing module available than what
Win32::GUI::Timer offers such that it doesn't freeze the GUI? What do
the pros use, i.e. old Windows apps like ReBirth or early versions of
Cakewalk for Windows. I'd also like to know about the Win32::GUI::Timer
how it quantizes values on a Windows NT system (XP SP2 and high res
timers  in hardware in my case). I've heard about some multimedia
timers, so can I use them in Perl and how? Howabout even more high res
sleeping, is that feasible?  Since I send MIDI on the wire lagging the
input deliberately is about the only way to implement a simplistic swing
function, as in most step and MIDI sequencers. Maybe polling would be
more exact than sleeping. MIDI Export is another story, though.

-- 
With kind regards Veli-Pekka Tätilä ([EMAIL PROTECTED])
Accessibility, game music, synthesizers and programming:
http://www.student.oulu.fi/~vtatila

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to