Audio-MikMod

 view release on metacpan or  search on metacpan

demo/player-gtk-fork  view on Meta::CPAN

#!/usr/bin/perl -w

# $Id: player-gtk-fork,v 1.1 1999/07/29 18:43:42 daniel Exp $
use strict;
use ExtUtils::testlib;
use Audio::MikMod qw(:MikMod :Player);
use Gtk;
use Pixmaps;
use Time::HiRes qw(usleep);

use constant TRUE  => 1;
use constant FALSE => 0;

# A threaded version might come in the future,
# but for now fork() will have to do.
$SIG{'HUP'}  = \&_real_pause;
$SIG{'USR1'} = \&_real_back;
$SIG{'USR2'} = \&_real_forward;
$SIG{'KILL'} = \&_exit;
$SIG{'INT'}  = \&_exit;
$SIG{'ALRM'} = \&_exit;

my ($song_loaded,$song_playing,$song_paused) = (0,0,0);
my ($songfile,$songpath,$player_busy);
my ($filelabel,$songlabel,$child);
my $url = 'http://electricrain.com/';

my $subs = {
	'exit'    => \&_exit,
	'back'    => \&_back,
	'play'    => \&_play,
	'pause'   => \&_pause,
	'stop'    => \&_stop,
	'forward' => \&_forward,
	'open'    => \&_open_fw,
};

##############
# Here we go..
Gtk->init;
_init();

my $window = Gtk::Widget->new('Gtk::Window','type' => '-toplevel' );

$window->set_usize(300, 200);
$window->set_title('Foo!');
$window->signal_connect('delete_event' => \&_exit);
$window->realize;

init_ui($window);

_open($ARGV[0]) if defined $ARGV[0];

Gtk->main;

exit;

##############
# Thanks Tom!
sub forksub (&) {
	my $coderef = shift;
	my $pid     = fork();
	die "Can't fork: $!" unless defined $pid;
	return $pid if $pid;
	goto &$coderef;
}

############
# Gtk setup.
sub init_ui ($) {
	my $window = shift;

	my $mask  = '';
    	my $style = $window->get_style;



( run in 0.459 second using v1.01-cache-2.11-cpan-e1769b4cff6 )