3 # This example plays a .WAV sound sample
11 my $filename = shift || 'data/sample.wav';
13 # we want a frequency that is higher than the default
14 my $mixer = SDL::Mixer->new(
17 print "Using audio driver: ", SDL::AudioDriverName(), "\n";
19 my $wave = SDL::Sound->new($filename);
21 # we don't care what channel, and we only want to play it once
22 my $channel = $mixer->play_channel( -1, $wave, 0 );
24 # wait until it has finished playing
25 while ( $mixer->playing($channel) ) {