# File lib/rubygame/sound.rb, line 401 def volume=( new_vol ) # Clamp it to valid range new_vol = if new_vol < 0.0; 0.0 elsif new_vol > 1.0; 1.0 else; new_vol end if channel_active? if fading? raise Rubygame::SDLError, "cannot set Sound volume while fading" else SDL::Mixer.Volume( @channel, (SDL::Mixer::MAX_VOLUME * new_vol).to_i ) end end @volume = new_vol end