lib/SDL/Config.pm
lib/SDL/*.c
lib/SDL/*.xs
+lib/SDL/Mixer/*.c
+lib/SDL/Mixer/*.xs
SDL_perl.c
SDL_perl.xs
stage
},
MixChunk => {
file => {
- from => 'src/Core/objects/MixChunk.xs',
- to => 'lib/SDL/MixChunk.xs',
+ from => 'src/Mixer/objects/MixChunk.xs',
+ to => 'lib/SDL/Mixer/MixChunk.xs',
},
libraries => [qw( SDL SDL_mixer )],
},
MixMusic => {
file => {
- from => 'src/Core/objects/MixMusic.xs',
- to => 'lib/SDL/MixMusic.xs',
+ from => 'src/Mixer/objects/MixMusic.xs',
+ to => 'lib/SDL/Mixer/MixMusic.xs',
},
libraries => [qw( SDL SDL_mixer )],
},
-package SDL::MixChunk;
+package SDL::Mixer::MixChunk;
use strict;
use warnings;
require Exporter;
require DynaLoader;
our @ISA = qw(Exporter DynaLoader);
-bootstrap SDL::MixChunk;
+bootstrap SDL::Mixer::MixChunk;
1;
-package SDL::MixMusic;
+package SDL::Mixer::MixMusic;
use strict;
use warnings;
require Exporter;
require DynaLoader;
our @ISA = qw(Exporter DynaLoader);
-bootstrap SDL::MixMusic;
+bootstrap SDL::Mixer::MixMusic;
1;
#include <SDL.h>
#include <SDL_mixer.h>
-MODULE = SDL::MixChunk PACKAGE = SDL::MixChunk PREFIX = mixchunk_
+MODULE = SDL::Mixer::MixChunk PACKAGE = SDL::Mixer::MixChunk PREFIX = mixchunk_
=for documentation
#include <SDL.h>
#include <SDL_mixer.h>
-MODULE = SDL::MixMusic PACKAGE = SDL::MixMusic PREFIX = mixmusic_
+MODULE = SDL::Mixer::MixMusic PACKAGE = SDL::Mixer::MixMusic PREFIX = mixmusic_
=for documentation
MixLoadWAV ( filename )
char *filename
PREINIT:
- char * CLASS = "SDL::MixChunk";
+ char * CLASS = "SDL::Mixer::MixChunk";
CODE:
Mix_Chunk * mixchunk;
mixchunk = Mix_LoadWAV(filename);
MixLoadMUS ( filename )
char *filename
PREINIT:
- char * CLASS = "SDL::MixMusic";
+ char * CLASS = "SDL::Mixer::MixMusic";
CODE:
Mix_Music * mixmusic;
mixmusic = Mix_LoadMUS(filename);
MixQuickLoadWAV ( buf )
Uint8 *buf
PREINIT:
- char * CLASS = "SDL::MixChunk";
+ char * CLASS = "SDL::Mixer::MixChunk";
CODE:
RETVAL = Mix_QuickLoad_WAV(buf);
OUTPUT:
use strict;
use warnings;
use SDL;
-use SDL::MixChunk;
-use Test::More tests => 7;
+use SDL::Mixer::MixChunk;
+use Test::More;
-is( SDL::init(SDL_INIT_AUDIO), 0, '[init] returns 0 on success' );
+if ( SDL::init(SDL_INIT_AUDIO) < 0 ) {
+ plan( skip_all => 'No sound card?' );
+
+} else {
+ plan( tests => 6 );
+}
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' );
+isa_ok( $mix_chunk, 'SDL::Mixer::MixChunk' );
is( $mix_chunk->volume, 128, 'Default volume is 128' );
$mix_chunk->volume(100);
use strict;
use warnings;
use SDL;
-use SDL::MixMusic;
-use Test::More tests => 4;
+use SDL::Mixer::MixMusic;
+use Test::More;
-is( SDL::init(SDL_INIT_AUDIO), 0, '[init] returns 0 on success' );
+if ( SDL::init(SDL_INIT_AUDIO) < 0 ) {
+ plan( skip_all => 'No sound card?' );
+
+} else {
+ plan( tests => 3 );
+}
is( SDL::MixOpenAudio( 44100, SDL::Constants::AUDIO_S16, 2, 4096 ),
0, 'MixOpenAudio passed' );
local $TODO = 1;
# I'm not sure why this fails
- isa_ok( $mix_music, 'SDL::MixMusic' );
+ isa_ok( $mix_music, 'SDL::Mixer::MixMusic' );
};
SDL::MixPlayMusic( $mix_music, 0 );
--- /dev/null
+#!perl
+use strict;
+use warnings;
+use SDL;
+use SDL::Mixer::MixChunk;
+use Test::More tests => 7;
+
+is( SDL::init(SDL_INIT_AUDIO), 0, '[init] returns 0 on success' );
+
+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::Mixer::MixChunk' );
+
+is( $mix_chunk->volume, 128, 'Default volume is 128' );
+$mix_chunk->volume(100);
+is( $mix_chunk->volume, 100, 'Can change volume to 100' );
+
+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' );
--- /dev/null
+#!perl
+use strict;
+use warnings;
+use SDL;
+use SDL::Mixer::MixMusic;
+use Test::More tests => 4;
+
+is( SDL::init(SDL_INIT_AUDIO), 0, '[init] returns 0 on success' );
+
+is( SDL::MixOpenAudio( 44100, SDL::Constants::AUDIO_S16, 2, 4096 ),
+ 0, 'MixOpenAudio passed' );
+
+my $mix_music = SDL::MixLoadMUS('test/data/sample.wav');
+
+{
+ local $TODO = 1;
+
+ # I'm not sure why this fails
+ isa_ok( $mix_music, 'SDL::Mixer::MixMusic' );
+};
+
+SDL::MixPlayMusic( $mix_music, 0 );
+
+# we close straight away so no audio is actually played
+
+SDL::MixCloseAudio;
+
+ok( 1, 'Got to the end' );