class << Audio
@@battle_channel = nil
@@map_channel = nil
#--------------------------------------------------------------------------
# ※ BGM
#--------------------------------------------------------------------------
def bgm_play(filename, volume = 80, pitch = 100)
if $game_system.map_bgm_playing == true
if @@map_channel != nil
SNSER.chn_stop(@@map_channel)
end
@@map_channel = SNSER.midi_play(filename+ ".mid")
end
if $game_system.battle_bgm_playing == true
if @@battle_channel != nil
SNSER.chn_stop(@@battle_channel)
end
@@battle_channel = SNSER.midi_play(filename+ ".mid")
end
end
def bgm_stop
if $game_system.map_bgm_playing == false
if @@map_channel.nil?
else
if $game_system.battle_bgm_pause == false
SNSER.chn_stop(@@map_channel)
@@map_channel = nil
end
end
end
if $game_system.battle_bgm_playing == false
if @@battle_channel.nil?
else
SNSER.chn_stop(@@battle_channel)
@@battle_channel = nil
end
end
end
def bgm_pause
if $game_system.battle_bgm_pause == true
if @@map_channel.nil?
else
SNSER.chn_pause(@@map_channel)
end
end
end
def bgm_resume
if $game_system.battle_bgm_pause == false
if @@map_channel.nil?
else
SNSER.chn_resume(@@map_channel)
end
end
end
end
class Game_System
attr_accessor :map_bgm_playing
attr_accessor :battle_bgm_playing
attr_accessor :battle_bgm_pause
alias ori_initialize initialize
def initialize
@battle_bgm_playing = false
@map_bgm_playing = false
@battle_bgm_pause = false
ori_initialize
end
#--------------------------------------------------------------------------
# ● 获取战斗 BGM
#--------------------------------------------------------------------------
def battle_bgm
if @battle_bgm == nil
return $data_system.battle_bgm
else
return @battle_bgm
end
end
#--------------------------------------------------------------------------
# ● 设置战斗 BGM
# battle_bgm : 新的战斗 BGM
#--------------------------------------------------------------------------
def battle_bgm=(battle_bgm)
@battle_bgm = battle_bgm
end
#--------------------------------------------------------------------------
# ● 演奏 BGM
# bgm : 演奏的 BGM
#--------------------------------------------------------------------------
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != ""
Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch)
else
Audio.bgm_stop
end
Graphics.frame_reset
end
end
class Game_Map
#--------------------------------------------------------------------------
# ● BGM / BGS 自动切换
#--------------------------------------------------------------------------
def autoplay
if @map.autoplay_bgm
if SNSER.bgm_pause?
Audio.bgm_resume
else
$game_system.map_bgm_playing = true
$game_system.bgm_play(@map.bgm)
end
end
if @map.autoplay_bgs
$game_system.bgs_play(@map.bgs)
end
end
end