# File lib/rubygame/music.rb, line 184
  def play( options={} )

    fade_in  = (options[:fade_in]  or 0)
    repeats  = (options[:repeats]  or 0)
    start_at = (options[:start_at] or 0)


    fade_in =
      if( fade_in < 0 )
        raise ArgumentError, ":fade_in cannot be negative (got %.2f)"%fade_in
      elsif( fade_in < 0.05 )
        # Work-around for a bug with SDL_mixer not working with small
        # non-zero fade-ins
        0
      else
        (fade_in * 1000).to_i
      end


    repeats =
      if( repeats < -1 )
        raise( ArgumentError,
               ":repeats cannot be negative, except -1 (got #{repeats})" )
      elsif( repeats > -1 )
        # Adjust so repeats means the same as it does for Sound
        (repeats + 1).to_i
      else
        -1
      end


    start_at =
      if( start_at < 0 )
        raise( ArgumentError,
               ":start_at cannot be negative, (got %.2f)"%start_at )
      else
        start_at.to_f
      end


    Rubygame.open_audio


    # Doing a little restart dance to please the SDL_mixer gods.
    SDL::Mixer.PlayMusic( @struct, 0 )
    SDL::Mixer.HaltMusic()

    # Set music channel volume before we play
    SDL::Mixer.VolumeMusic( (SDL::Mixer::MAX_VOLUME * @volume).to_i )


    @repeats = repeats

    result = SDL::Mixer.FadeInMusicPos( @struct, repeats, fade_in, start_at )

    if( result == -1 )
      raise Rubygame::SDLError, "Could not play Music: #{SDL.GetError()}"
    end

    self.class.__current_music = self

    return self

  end