Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (20 sloc) 596 Bytes
#!/usr/bin/env perl
# This example plays a .WAV sound sample
use strict;
use warnings;
use SDL;
use SDL::Mixer;
use SDL::Sound;
my $filename = shift || 'data/sample.wav';
# we want a frequency that is higher than the default
my $mixer = SDL::Mixer->new( -frequency => 44100, );
print "Using audio driver: ", SDL::AudioDriverName(), "\n";
my $wave = SDL::Sound->new($filename);
# we don't care what channel, and we only want to play it once
my $channel = $mixer->play_channel( -1, $wave, 0 );
# wait until it has finished playing
while ( $mixer->playing($channel) ) {
Jump to Line
Something went wrong with that request. Please try again.