Class: RPG::BGM

Inherits:
AudioFile show all
Extended by:
RgssDb::JsonableConstructor
Includes:
RgssDb::Jsonable
Defined in:
lib/rgss_db/model/rpg_maker_data/vx/rpg/bgm.rb,
lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/bgm.rb

Overview

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

Constant Summary collapse

@@last =
RPG::BGM.new

Instance Attribute Summary collapse

Attributes inherited from AudioFile

#name, #pitch, #volume

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RgssDb::JsonableConstructor

json_create, json_new

Methods included from RgssDb::Jsonable

#as_json, #to_json

Methods inherited from AudioFile

#initialize, #to_s

Constructor Details

This class inherits a constructor from RPG::AudioFile

Instance Attribute Details

#posObject

Returns the value of attribute pos.



41
42
43
# File 'lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/bgm.rb', line 41

def pos
  @pos
end

Class Method Details

.fade(time) ⇒ Object



27
28
29
30
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/bgm.rb', line 27

def self.fade(time)
  Audio.bgm_fade(time)
  @@last = BGM.new
end

.lastObject



32
33
34
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/bgm.rb', line 32

def self.last
  @@last
end

.stopObject



22
23
24
25
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/bgm.rb', line 22

def self.stop
  Audio.bgm_stop
  @@last = BGM.new
end

Instance Method Details

#play(pos = 0) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/rgss_db/model/rpg_maker_data/vx/rpg/bgm.rb', line 12

def play
  if @name.empty?
    Audio.bgm_stop
    @@last = BGM.new
  else
    Audio.bgm_play("Audio/BGM/" + @name, @volume, @pitch)
    @@last = self
  end
end

#replayObject



22
23
24
# File 'lib/rgss_db/model/rpg_maker_data/vx_ace/rpg/bgm.rb', line 22

def replay
  play(@pos)
end