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
This commit is contained in:
@@ -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/) {
|
||||
|
||||
Reference in New Issue
Block a user