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