X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-Mixer-Music.html-inc;h=4fa2a7215c55b21679b709d6b149cb12adaf5e63;hb=c7e8d3c612049580c9a96b3006c4c89a00410643;hp=69c059b2394b1ae72e5bb7579a015edf83c09012;hpb=195e87cbe35d61baa88b34f1ff134de5e68836b2;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-Mixer-Music.html-inc b/pages/SDL-Mixer-Music.html-inc index 69c059b..4fa2a72 100644 --- a/pages/SDL-Mixer-Music.html-inc +++ b/pages/SDL-Mixer-Music.html-inc @@ -23,7 +23,7 @@
SDL::Mixer::Music::hook_music( $callback, $position ); - or - - SDL::Mixer::Music::hook_music( &callback, $position ); -
This sets up a custom music player function, so you can pass your own audio stream data into the SDL::Mixer.
The function will be called with position
passed into the first parameter when the callback
is called.
@@ -69,7 +65,7 @@ Using a custom music player and the internal music player is not possible, the c
Note: NEVER call SDL::Mixer
functions, nor SDL::Audio::lock, from a callback function.
Note: At program termination also call SDL::Mixer::Music::hook_music()
to stop this callback.
Example:
-my $callback = sub +sub callback { my $position = shift; # position (first time its 0, on each call $length is added) my $length = shift; # length of bytes we have to put in stream @@ -83,16 +79,16 @@ Using a custom music player and the internal music player is not possible, the c } return @stream; - }; + } - SDL::Mixer::Music::hook_music( $callback, 0 ); + SDL::Mixer::Music::hook_music( 'main::callback', 0 );
SDL::Mixer::Music::hook_music_finished( $callback ); +SDL::Mixer::Music::hook_music_finished( 'main::callback' );This callback is called when music called by e.g. SDL::Mixer::Music::play_music or SDL::Mixer::Music::fade_in_music stops naturally. @@ -101,8 +97,12 @@ This happens when the music is over or is fading out.
Example:
my $music_is_playing = 0; my @music = qw(first.mp3 next.mp3 other.mp3 last.mp3); - my $callback = sub{ $music_is_playing = 0; }; - SDL::Mixer::Music::hook_music_finished( $callback ); + sub callback + { + $music_is_playing = 0; + } + + SDL::Mixer::Music::hook_music_finished( 'main::callback' ); foreach my $this_song ( @music ) { @@ -244,7 +244,9 @@ Passing zero is similar to rewinding the song.Jumps to position seconds from the current position in the stream. So you may want to call SDL::Mixer::Music::rewind_music before this. Does not go in reverse... negative values do nothing.
-Returns:
+ + +0
on success, or-1
if the codec doesn't support this function.Returns:
0
on success, or-1
if the codec doesn't support this function.
my $paused = SDL::Mixer::Music::paused_music();-
Returns 1
if the music is paused, otherwise 0
.
Returns 1
if the music is paused, otherwise 0
.
my $playing_music = SDL::Mixer::Music::playing_music();-
Returns 1
if the music is playing sound, otherwise 0
. It does'nt check if the music is paused.
Returns 1
if the music is playing sound, otherwise 0
. It does'nt check if the music is paused.