RPG::BGM

The data class for BGM.This class has functionality for playing itself using an Audio module.

Superclass

Referrers

Class Methods

RPG::BGM.last

Gets the BGM (RPG::BGM) that is currently playing.

Also saves the current playback position in the obtained object. (RGSS3)

Returns an empty object if no BGM is playing.

RPG::BGM.stop

Stops BGM playback.

RPG::BGM.fade(time)

Starts BGM fadeout. time is the length of the fadeout in milliseconds.

Methods

play([pos]) (RGSS3)

Starts the BGM playback.

The playback starting position can be specified by pos for ogg or wav files. (RGSS3)

replay (RGSS3)

Replays the BGM obtained by RPG::BGM.last.

’è‹`

class RPG::BGM < RPG::AudioFile
  @@last = RPG::BGM.new
  def play(pos = 0)
    if @name.empty?
      Audio.bgm_stop
      @@last = RPG::BGM.new
    else
      Audio.bgm_play('Audio/BGM/' + @name, @volume, @pitch, pos)
      @@last = self.clone
    end
  end
  def replay
    play(@pos)
  end
  def self.stop
    Audio.bgm_stop
    @@last = RPG::BGM.new
  end
  def self.fade(time)
    Audio.bgm_fade(time)
    @@last = RPG::BGM.new
  end
  def self.last
    @@last.pos = Audio.bgm_pos
    @@last
  end
  attr_accessor :pos
end