The data class for BGM.This class has functionality for playing itself using an Audio module.
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.
Stops BGM playback.
Starts BGM fadeout. time is the length of the fadeout in milliseconds.
Starts the BGM playback.
The playback starting position can be specified by pos for ogg or wav files. (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