Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Audio Settings
#1
Audio Settings
Version: 1.1.0

Introduction

Always wanted a volume option? With this script you can let the player change the volume. You only have to script / event a GUI for it.

Features
  • Change the Music volume
  • Change the SE volume
Screenshots

Just turn your speakers on.

Demo

None, it's just copy-paste. And if you don't know how to copy-paste, learn it! You are the copy-paste generation after all.

Script

Code:
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of
#  this class.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :music_volume
  attr_reader   :sound_volume
  #------------------------------------------------------------------------
  # * Alias Listings
  #------------------------------------------------------------------------
  unless self.method_defined?(:ejlol_as_gsystem_initialize)
    alias_method :ejlol_as_gsystem_initialize, :initialize
  end
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    ejlol_as_gsystem_initialize
    @music_volume = 100
    @sound_volume = 100
  end
  #--------------------------------------------------------------------------
  # * Change backgroundmusic volume
  #     volume : the volume
  #--------------------------------------------------------------------------
  def music_volume=(volume)
    @music_volume = [[volume, 100].min, 0].max
    bgm_play(@playing_bgm)
  end
  #--------------------------------------------------------------------------
  # * Change soundeffect volume
  #     volume : the volume
  #--------------------------------------------------------------------------
  def sound_volume=(volume)
    @sound_volume = [[volume, 100].min, 0].max
    bgs_play(@playing_bgs)
  end
end

#==============================================================================
# ** Audio
#==============================================================================

module Audio
  class << self
    #------------------------------------------------------------------------
    # * Alias Listings
    #------------------------------------------------------------------------
    unless self.method_defined?(:ejlol_as_audio_bgmplay)
      alias_method :ejlol_as_audio_bgmplay, :bgm_play
      alias_method :ejlol_as_audio_bgsplay, :bgs_play
      alias_method :ejlol_as_audio_meplay,  :me_play
      alias_method :ejlol_as_audio_seplay,  :se_play
    end
    #------------------------------------------------------------------------
    # * BGM Play
    #------------------------------------------------------------------------
    def bgm_play(filename, volume = 100, pitch = 100)
      volume = Integer(volume * $game_system.music_volume / 100.0)
      # Original BGM Play Method
      ejlol_as_audio_bgmplay(filename, volume, pitch)
    end
    #------------------------------------------------------------------------
    # * BGS Play
    #------------------------------------------------------------------------
    def bgs_play(filename, volume = 80, pitch = 100)
      volume = Integer(volume * $game_system.sound_volume / 100.0)
      # Original BGS Play Method
      ejlol_as_audio_bgsplay(filename, volume, pitch)
    end
    #------------------------------------------------------------------------
    # * ME Play
    #------------------------------------------------------------------------
    def me_play(filename, volume = 100, pitch = 100)
      volume = Integer(volume * $game_system.music_volume / 100.0)
      # Original ME Play Method
      ejlol_as_audio_meplay(filename, volume, pitch)
    end
    #------------------------------------------------------------------------
    # * SE Play
    #------------------------------------------------------------------------
    def se_play(filename, volume = 80, pitch = 100)
      volume = Integer(volume * $game_system.sound_volume / 100.0)
      # Original SE Play Method
      ejlol_as_audio_seplay(filename, volume, pitch)
    end
  end
end


Instructions


Copy-paste the script. You can change the volume settings with:
Code:
$game_system.music_volume = 100
Code:
$game_system.sound_volume = 100
Volume should be a range between 0 and 100. (The script corrects the input though.)

FAQ

None

Compatibility

Should be compatible.

Credits and Thanks

Credit: EJlol

Thanks:
Many thanks to SephirothSpawn, for helping me.

Author's Notes

I was bored.

Terms and Conditions

Give credit, no commercial use without permission from EJlol.
Reply }
#2
EXCELENT! It was a pain in the ass the music volume
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Kichi's Kached Audio DerVVulfman 2 7,130 08-21-2023, 11:01 PM
Last Post: DerVVulfman
   Audio Module Kain Nobel 2 1,831 01-25-2022, 11:39 AM
Last Post: Kain Nobel
   Audio Module Rewrite mcisendstring DerVVulfman 25 34,574 05-03-2020, 08:08 PM
Last Post: MikiIsAway
   Missing Audio Replacer LiTTleDRAgo 1 5,027 06-11-2017, 12:25 AM
Last Post: Whisper
   DoubleX RMMV Dynamic Settings Compatibility DoubleX 0 3,890 08-28-2016, 03:13 PM
Last Post: DoubleX
   DoubleX RMMV Dynamic Settings DoubleX 0 4,623 08-15-2016, 03:36 PM
Last Post: DoubleX
   KA-terpillar + Settings kyonides 2 5,611 06-08-2014, 12:52 AM
Last Post: kyonides
   Victor Engine - Animations Settings Victor Sant 0 4,061 03-16-2012, 05:43 AM
Last Post: Victor Sant
   Audio File Encryption Dark-Yen 0 4,662 03-08-2008, 06:35 AM
Last Post: Dark-Yen
   Window_PlayTime + Day & Night Settings kyonides 0 4,353 03-08-2008, 04:09 AM
Last Post: kyonides



Users browsing this thread: