I installed Win32::MediaPlayer on Windows 7 and created the following test program based on the Synopsis. The test program operates correctly and the mp3 file is played, but the 'while' loop that keeps the program from ending before the media file is finished playing uses an enormous amount of CPU (25% of my available CPU). Is there another (better) way to make the program wait until the media file has finished playing that is not so CPU intensive? My thanks to all you helpful souls in the Monastery.
#!/usr/bin/perl
use strict;
use warnings;
use Win32::MediaPlayer;
my $winmm = new Win32::MediaPlayer;
$winmm->load('test1.mp3');
$winmm->play;
$winmm->volume(100);
while ($winmm->pos < $winmm->length) {
# Loop until finished playing media file
}
"Its not how hard you work, its how much you get done."