new index
[sdlgit/SDL-Site.git] / pages / SDL-Mixer-Music.html-inc
index 69c059b..f6550f1 100644 (file)
 <div id="hook_music_CONTENT">
 <pre> SDL::Mixer::Music::hook_music( $callback, $position );
 
- or
-
- SDL::Mixer::Music::hook_music( &amp;callback, $position );
-
 </pre>
 <p>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 <code>position</code> passed into the first parameter when the <code>callback</code> is called.
@@ -69,7 +65,7 @@ Using a custom music player and the internal music player is not possible, the c
 <p><strong>Note</strong>: NEVER call <code>SDL::Mixer</code> functions, nor <a href="/SDL-Audio.html#lock">SDL::Audio::lock</a>, from a callback function.</p>
 <p><strong>Note</strong>: At program termination also call <code>SDL::Mixer::Music::hook_music()</code> to stop this callback.</p>
 <p>Example:</p>
-<pre> my $callback = sub
+<pre> 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 );
 
 </pre>
 
 </div>
 <h2 id="hook_music_finished">hook_music_finished</h2>
 <div id="hook_music_finished_CONTENT">
-<pre> SDL::Mixer::Music::hook_music_finished( $callback );
+<pre> SDL::Mixer::Music::hook_music_finished( 'main::callback' );
 
 </pre>
 <p>This callback is called when music called by e.g. <a href="/SDL-Mixer-Music.html#play_music">SDL::Mixer::Music::play_music</a> or <a href="/SDL-Mixer-Music.html#fade_in_music">SDL::Mixer::Music::fade_in_music</a> stops naturally. 
@@ -101,8 +97,12 @@ This happens when the music is over or is fading out.</p>
 <p>Example:</p>
 <pre> 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. </p>
                <p>Jumps to position seconds from the current position in the stream.
 So you may want to call <a href="/SDL-Mixer-Music.html#rewind_music">SDL::Mixer::Music::rewind_music</a> before this.
 Does not go in reverse... negative values do nothing. </p>
-               <p>Returns: <code>0</code> on success, or <code>-1</code> if the codec doesn't support this function. </p>
+       </dd>
+</dl>
+<p>Returns: <code>0</code> on success, or <code>-1</code> if the codec doesn't support this function. </p>
 
 </div>
 <h2 id="paused_music">paused_music</h2>
@@ -252,7 +254,7 @@ Does not go in reverse... negative values do nothing. </p>
 <pre> my $paused = SDL::Mixer::Music::paused_music();
 
 </pre>
-               <p>Returns <code>1</code> if the music is paused, otherwise <code>0</code>.</p>
+<p>Returns <code>1</code> if the music is paused, otherwise <code>0</code>.</p>
 
 </div>
 <h2 id="playing_music">playing_music</h2>
@@ -260,12 +262,12 @@ Does not go in reverse... negative values do nothing. </p>
 <pre> my $playing_music = SDL::Mixer::Music::playing_music();
 
 </pre>
-               <p>Returns <code>1</code> if the music is playing sound, otherwise <code>0</code>. It does'nt check if the music is paused.</p>
+<p>Returns <code>1</code> if the music is playing sound, otherwise <code>0</code>. It does'nt check if the music is paused.</p>
 
 </div>
 <h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
 <div id="AUTHOR_CONTENT">
-               <p>Tobias Leich [FROGGS]</p>
+<p>Tobias Leich [FROGGS]</p>
 
 </div>
 </div>
\ No newline at end of file