use warnings;
use SDL;
use SDL::MixChunk;
-use Test::More tests => 6;
+use Test::More tests => 7;
is( SDL::init(SDL_INIT_AUDIO), 0, '[init] returns 0 on success' );
-is( SDL::MixOpenAudio(
- SDL::MIX_DEFAULT_FREQUENCY(), SDL::MIX_DEFAULT_FORMAT(),
- SDL::MIX_DEFAULT_CHANNELS(), 4096
- ),
- 0,
- 'MixOpenAudio passed'
-);
+is( SDL::MixOpenAudio( 44100, SDL::Constants::AUDIO_S16, 2, 4096 ),
+ 0, 'MixOpenAudio passed' );
my $mix_chunk = SDL::MixLoadWAV('test/data/sample.wav');
isa_ok( $mix_chunk, 'SDL::MixChunk' );
$mix_chunk->volume(100);
is( $mix_chunk->volume, 100, 'Can change volume to 100' );
-is( $mix_chunk->alen, 963424, 'Alen is 963424' );
+is( $mix_chunk->alen, 1926848, 'Alen is 1926848' );
+
+SDL::MixPlayChannel( -1, $mix_chunk, 0 );
+
+# we close straight away so no audio is actually played
+
+SDL::MixCloseAudio;
+
+ok( 1, 'Got to the end' );