3 # This example plays a .WAV sound sample
11 SDL::Init(SDL_INIT_AUDIO);
13 my $filename = shift || 'data/sample.wav';
15 my $mixer = SDL::Mixer->new(
18 print "Using audio driver: ", SDL::AudioDriverName(), "\n";
20 my $wave = SDL::Sound->new($filename);
22 # we don't care what channel, and we only want to play it once
23 my $channel = $mixer->play_channel( -1, $wave, 0 );
25 # wait until it has finished playing
26 while ( $mixer->playing($channel) ) {