from => 'src/Core/objects/MixChunk.xs',
to => 'lib/SDL/MixChunk.xs',
},
- libraries => [qw( SDL )],
+ libraries => [qw( SDL SDL_mixer )],
+ },
+ MixMusic => {
+ file => {
+ from => 'src/Core/objects/MixMusic.xs',
+ to => 'lib/SDL/MixMusic.xs',
+ },
+ libraries => [qw( SDL SDL_mixer )],
},
Palette => {
file => {
--- /dev/null
+package SDL::MixMusic;
+use strict;
+use warnings;
+require Exporter;
+require DynaLoader;
+our @ISA = qw(Exporter DynaLoader);
+bootstrap SDL::MixMusic;
+
+1;
--- /dev/null
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifndef aTHX_
+#define aTHX_
+#endif
+
+#include <SDL.h>
+#include <SDL_mixer.h>
+
+MODULE = SDL::MixMusic PACKAGE = SDL::MixMusic PREFIX = mixmusic_
+
+=for documentation
+
+SDL_mixmusic - This is an opaque data type used for Music data
+
+ typedef struct _Mix_Music Mix_Music;
+
+=cut
+
+void
+mixmusic_DESTROY(mixmusic)
+ Mix_Chunk *mixmusic
+ CODE:
+ Mix_FreeMusic(mixmusic);
RETVAL
Mix_Music *
-MixLoadMusic ( filename )
+MixLoadMUS ( filename )
char *filename
+ PREINIT:
+ char * CLASS = "SDL::MixMusic";
CODE:
- RETVAL = Mix_LoadMUS(filename);
+ Mix_Music * mixmusic;
+ mixmusic = Mix_LoadMUS(filename);
+ if (mixmusic == NULL) {
+ fprintf(stderr, "Could not load %s\n", filename);
+ }
+ RETVAL = mixmusic;
OUTPUT:
RETVAL
--- /dev/null
+#!perl
+use strict;
+use warnings;
+use SDL;
+use SDL::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::MixMusic' );
+};
+
+SDL::MixPlayMusic( $mix_music, 0 );
+
+# we close straight away so no audio is actually played
+
+SDL::MixCloseAudio;
+
+ok( 1, 'Got to the end' );
SDL_AudioCVT * T_PTR
Mix_Fading T_UV
Mix_Chunk * O_OBJECT
-Mix_Music * T_PTR
+Mix_Music * O_OBJECT
SDL_GLattr T_IV
int * T_PTR
void * T_PTR