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 8,581 08-21-2023, 11:01 PM
Last Post: DerVVulfman
   Audio Module Rewrite mcisendstring DerVVulfman 25 41,473 05-03-2020, 08:08 PM
Last Post: MikiIsAway
   Missing Audio Replacer LiTTleDRAgo 1 5,884 06-11-2017, 12:25 AM
Last Post: Whisper
   KA-terpillar + Settings kyonides 2 6,737 06-08-2014, 12:52 AM
Last Post: kyonides
   Audio File Encryption Dark-Yen 0 5,382 03-08-2008, 06:35 AM
Last Post: Dark-Yen
   Window_PlayTime + Day & Night Settings kyonides 0 4,951 03-08-2008, 04:09 AM
Last Post: kyonides
   AUDIO FIX - Battle Animations DerVVulfman 0 5,382 03-05-2008, 06:44 AM
Last Post: DerVVulfman



Users browsing this thread: 1 Guest(s)