Trying workaround for directx forcing
[sdlgit/SDL_perl.git] / test / wave.pl
1 #!/usr/bin/env perl
2 #
3 # This example plays a .WAV sound sample
4 #
5 use strict;
6 use warnings;
7 use SDL;
8 use SDL::Mixer;
9 use SDL::Sound;
10
11 my $filename = shift || 'data/sample.wav';
12
13 # we want a frequency that is higher than the default
14 my $mixer = SDL::Mixer->new(
15     -frequency => 44100,
16 );
17 print "Using audio driver: ", SDL::AudioDriverName(), "\n";
18
19 my $wave = SDL::Sound->new($filename);
20
21 # we don't care what channel, and we only want to play it once
22 my $channel = $mixer->play_channel( -1, $wave, 0 );
23
24 # wait until it has finished playing
25 while ( $mixer->playing($channel) ) {
26     SDL::Delay(10);
27 }
28