Advertisement
QuasiXi

Master Volume

Aug 25th, 2014
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.70 KB | None | 0 0
  1. #==============================================================================
  2. # ** Quasi Master Volume [[ Snippet ]]
  3. #==============================================================================
  4. # Lowers all of rpg makers audio volume.
  5. # Can set it to a low value so you don't have to turn off each sound
  6. # if you want to test quitely.
  7. # -100 should be silent
  8. #==============================================================================#
  9. # By Quasi (http://quasixi.wordpress.com/)
  10. #  - 7/13/14
  11. #==============================================================================#
  12. module Quasi
  13.   VOLUME = -70
  14. end
  15.  
  16. class RPG::SE < RPG::AudioFile
  17.   def play
  18.     unless @name.empty?
  19.       volume = @volume + Quasi::VOLUME
  20.       volume = 0 if volume < 0
  21.       Audio.se_play('Audio/SE/' + @name, volume, @pitch)
  22.     end
  23.   end
  24. end
  25.  
  26. class RPG::BGM < RPG::AudioFile
  27.   def play(pos = 0)
  28.     if @name.empty?
  29.       Audio.bgm_stop
  30.       @@last = RPG::BGM.new
  31.     else
  32.       volume = @volume + Quasi::VOLUME
  33.       volume = 0 if volume < 0
  34.       Audio.bgm_play('Audio/BGM/' + @name, volume, @pitch, pos)
  35.       @@last = self.clone
  36.     end
  37.   end
  38. end
  39.  
  40. class RPG::ME < RPG::AudioFile
  41.   def play
  42.     if @name.empty?
  43.       Audio.me_stop
  44.     else
  45.       volume = @volume + Quasi::VOLUME
  46.       volume = 0 if volume < 0
  47.       Audio.me_play('Audio/ME/' + @name, volume, @pitch)
  48.     end
  49.   end
  50. end
  51.  
  52. class RPG::BGS < RPG::AudioFile
  53.   def play(pos = 0)
  54.     if @name.empty?
  55.       Audio.bgs_stop
  56.       @@last = RPG::BGS.new
  57.     else
  58.       volume = @volume + Quasi::VOLUME
  59.       volume = 0 if volume < 0
  60.       Audio.bgs_play('Audio/BGS/' + @name, volume, @pitch, pos)
  61.       @@last = self.clone
  62.     end
  63.   end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement