From 9b2974d340fa0c82dfb255388e6f9ea8f187edf6 Mon Sep 17 00:00:00 2001 From: mdb Date: Mon, 11 Feb 2002 18:25:44 +0000 Subject: [PATCH] Configure MP3 library to automatically close the MP3 source when stop() is called, this apparently also causes the audio device to be released; undef the playing song when we stop so that we do the right thing when we start back up again. git-svn-id: https://samskivert.googlecode.com/svn/trunk@573 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- projects/robodj/bin/musicd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/robodj/bin/musicd b/projects/robodj/bin/musicd index 314213eb..e94774d0 100755 --- a/projects/robodj/bin/musicd +++ b/projects/robodj/bin/musicd @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# $Id: musicd,v 1.11 2001/07/26 19:26:55 mdb Exp $ +# $Id: musicd,v 1.12 2002/02/11 18:25:44 mdb Exp $ # # MP3 audio server. Manages playlists of mp3 files that live on a local # filesystem. The playlists can be manipulated by connecting to the server @@ -9,7 +9,7 @@ use strict; use IO::Socket; use IO::Select; -use MPEG::MP3Play; +use MPEG::MP3Play ':state'; use Data::Dumper; use Getopt::Long; @@ -49,6 +49,7 @@ main: { # create our MP3 interface $mp3 = new MPEG::MP3Play; + $mp3->set_player_mode(&XA_PLAYER_MODE_OUTPUT_AUTO_CLOSE_ON_STOP); # manage our various inputs my $sel = new IO::Select($sock); @@ -162,6 +163,7 @@ sub handle_client } elsif ($input =~ m/^STOP/) { $mp3->stop(); + undef $playing; print $cfh "200 Music stopped.\n"; } elsif ($input =~ m/^PLAY/) {