Baphi has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I have just signed up to the site and I am also very new to perl but very interested. My question is how to run a loop in the background of my main program... I personaly want to play songs in a playlist (one starts after the other is done) while I goto(); another part of my program while maintaining the loop. (i am using Win32::MediaPlayer to play the music) here is my code (sub program that gets required into my main code):
while (($music_playlist_line_number, $music_file) = each(%AllFiles)){ $winmm = new Win32::MediaPlayer; $winmm->load("User Files\\$name\\Pro Playlist\\$music_file"); $winmm->play; $winmm->volume($volume); $song_length_micro = $winmm->length; $song_length = ($song_length_micro * .001) + .05; ### + .05 second buffer between songs; $song_pos_micro = $winmm->pos; sleep ($song_length); }
now, this code works for me however im not able to go somwhere in my program while it keeps going to different songs after Im there. I can do it with single songs, they will keep playing but I would need to run this in some kind of background process for it to keep working, independent on the main program but able to use the main programs variables and hashes I use to make it work.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Looping in the background of your main program
by almut (Canon) on Dec 30, 2009 at 17:22 UTC | |
by Baphi (Acolyte) on Dec 30, 2009 at 17:40 UTC | |
by almut (Canon) on Dec 30, 2009 at 17:51 UTC | |
by dk (Chaplain) on Jan 01, 2010 at 15:05 UTC | |
by pdltiger (Acolyte) on Jan 01, 2010 at 15:47 UTC | |
by pdltiger (Acolyte) on Jan 01, 2010 at 15:40 UTC | |
|
Re: Looping in the background of your main program
by ahmad (Hermit) on Dec 31, 2009 at 05:19 UTC |