audio.gain readwrite


Get or set the master gain, the global loudness of sounds in decibels. This property provides global amplification of sounds.

Example

--! luart-extensions import audio local console = require "console" print("Playing some music") print("Press UP and DOWN arrow keys to change gain") print("Press SPACE to exit") -- Play some music audio.play("music.mp3") while true do local c, special = console.readchar() if special == true then if c == "H" then -- UP key have been pressed audio.gain = audio.gain + 1 print("Audio gain set to "..audio.gain) elseif c == "J" then -- DOWN key have been pressed audio.gain = audio.gain - 1 print("Audio gain set to "..audio.gain) end elseif c == " " then -- SPACE key have been pressed print("Stop playing...") break end end