/*  call-seq:
 *     jump( time )  ->  self
 *
 *  Jump to a certain time in the music.
 *  Only works when music is playing or paused (but not stopped).
 *  Only works for OGG and MP3 files.
 *
 *  Raises SDLError if something goes wrong, or if the music type does not
 *  support setting the position.
 *
 *  time::  Time to jump to, in seconds from the beginning.
 *
 */
VALUE rbgm_mixmusic_jump(VALUE self, VALUE vtime)
{
  double time = NUM2DBL(vtime);

  switch( Mix_GetMusicType(NULL) )
        {
    case MUS_OGG:
    case MUS_MP3:
      Mix_RewindMusic(); // Needed for MP3, and OK with OGG

      int result = Mix_SetMusicPosition(time);
      if( result < 0 )
      {
        rb_raise(eSDLError, "Error jumping to time in music: %s", Mix_GetError());
      }

      return self;

    case MUS_NONE:
      rb_raise(eSDLError, "Cannot jump when no music is playing.");

    default:
      rb_raise(eSDLError, "Music type does not support jumping.");
  }
}