Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Module RPG::Audiofile Extentions [RMXP]
- # ■ Author: Bigace360
- # ■ Date: May 18, 2012
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # Like VX, this script adds four subclasses to RPG::Audiofile, (BGM, BGS, ME,
- # and SE) turning it into a parent class. This is a script for developers, not
- # non-scripters.
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- module RPG
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ RPG::BGM (Data class for BGM. This class has a method to play oneself with
- # Audio module.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class BGM < AudioFile
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ Class Methods
- # ● RPG::BGM.last
- # Returns BGM (RPG::BGM) that playing now. If no playing BGM, returns nil.
- # ● RPG::BGM.stop
- # Stops BGM playback.
- # ● RPG::BGM.fade(time)
- # Starts BGM fadeout. time is the length of the fadeout in milliseconds.
- # ------------------------------------------------------------------------
- # ■ Method
- # ● play
- # Starts the BGM playback.
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- @@last = BGM.new
- def play
- if @name.empty?
- Audio.bgm_stop; @@last = BGM.new
- else
- Audio.bgm_play("Audio/BGM/" + @name, @volume, @pitch)
- @@last = self
- end
- end
- def self.stop
- Audio.bgm_stop
- @@last = BGM.new
- end
- def self.fade(time)
- Audio.bgm_fade(time)
- @@last = BGM.new
- end
- def self.last
- @@last
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ RPG::BGS (Data class for BGS. This class has a method to play oneself with
- # Audio module.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class BGS < AudioFile
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ Class Methods
- # ● RPG::BGS.last
- # Returns BGS (RPG::BGS) that playing now. If no playing BGS, returns nil.
- # ● RPG::BGS.stop
- # Stops BGS playback.
- # ● RPG::BGS.fade(time)
- # Starts BGS fadeout. time is the length of the fadeout in milliseconds.
- # ------------------------------------------------------------------------
- # ■ Method
- # ● play
- # Starts the BGM playback.
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- @@last = BGS.new
- def play
- if @name.empty?
- Audio.bgs_stop; @@last = BGS.new
- else
- Audio.bgs_play("Audio/BGS/" + @name, @volume, @pitch)
- @@last = self
- end
- end
- def self.stop
- Audio.bgs_stop
- @@last = BGS.new
- end
- def self.fade(time)
- Audio.bgs_fade(time)
- @@last = BGS.new
- end
- def self.last
- @@last
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ RPG::ME (Data class for ME. This class has a method to play oneself with
- # Audio module.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class ME < AudioFile
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ Class Methods
- # ● RPG::ME.stop
- # Stops ME playback.
- # ● RPG::ME.fade(time)
- # Starts ME fadeout. time is the length of the fadeout in milliseconds.
- # ------------------------------------------------------------------------
- # ■ Method
- # ● play
- # Starts the ME playback.
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- def play
- if @name.empty?
- Audio.me_stop
- else
- Audio.me_play("Audio/ME/" + @name, @volume, @pitch)
- end
- end
- def self.stop
- Audio.me_stop
- end
- def self.fade(time)
- Audio.me_fade(time)
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ RPG::SE (Data class for SE. This class has a method to play oneself with
- # Audio module.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class SE < AudioFile
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ Class Methods
- # ● RPG::SE.stop
- # Stops SE playback.
- # ------------------------------------------------------------------------
- # ■ Method
- # ● play
- # Starts the SE playback.
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- def play
- Audio.se_play("Audio/SE/" + @name, @volume, @pitch) unless @name.empty?
- end
- def self.stop
- Audio.se_stop
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment