> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Spencer Chase
> Sent: Monday, February 19, 2007 12:36 PM
> To: [email protected]
> Subject: audio questions
> 
> Greetings perl-win32-users,
> 
> The recent discussion of audio on the PC has me thinking 
> again about something I have been trying to do for years. I 
> want to play MIDI files from a perl TK script. I have checked 
> out all of the modules available on CPAN and nothing does 
> what I want. There are issues with selecting devices and a 
> whole host of other problems. I have looked briefly into 
> using WIN32::API but trying to understand the terrible 
> documentation on Multimedia that Microsoft provides is more 
> than I can manage. I am hoping to find a module that allows 
> me easy access to the multimedia functions necessary to play 
> MIDI files. If anyone has any leads or code to share please 
> let me know. Again, I have tried everything on CPAN and some 
> modules come close but not close enough.
>

# This should work for you...
use Tk;
use Win32::MultiMedia::Mci;

my $mci;
my $mw=tkinit;
my $start = $mw->Button(-text=>'Start',-command=>\&start)->pack;
my $stop = $mw->Button(-text=>'Stop',-command=>\&stop)->pack;
MainLoop;

sub start
{
my $midi = "/path/to/midi/file.mid";
$mci = Win32::MultiMedia::Mci->open($midi);
$mci->seek(to=>'start');
$mci->play;
}

sub stop
{
$mci->stop;
}

__END__

Jack

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to