|
Audio::Play::MPG321 - A frontend to MPG321. |
Audio::Play::MPG321 - A frontend to MPG321.
use Audio::Play::MPG321; my $player = new Audio::Play::MPG321;
$SIG{CHLD} = 'IGNORE'; # May not work everywhere! $SIG{INT} = sub { $player->stop(); exit 0; };
$player->play(``/home/dabreegster/foo.mp3'');
do {
$player->poll();
print $player->{sofar}, `` '', $player->{remains}, `` '',
$player->state(), ``\n'';
} until $player->state() == 0;
$player->play("/home/dabreegster/bar.mp3");
sleep until $player->state() == 0;
This is a frontend to the MPG321 MP3 player. It talks to it in remote mode and
provides constant feedback about the time elapsed so far, the time remaining,
and the state of the player. If you use Audio::Play::MPG321 directly, then you
will have to do some extra work outside of the module, as demonstrated in the
synopsis. If you want to build a basic queue (Play one song, then play
another), then you must keep calling poll() to make sure Audio::Play::MPG321
knows how MPG321 is doing and testing state() to be 0.
poll() will call it for you. This just
takes a line of input from MPG321 and parses it.
poll() are necessary if this
information is to be kept current.
Da-Breegster <dabreegster@gmail.com>
|
Audio::Play::MPG321 - A frontend to MPG321. |