Skip to content
Snippets Groups Projects
Commit 90a5b24e authored by dg's avatar dg
Browse files

plop

git-svn-id: http://svn.net-core.org/repos/t-engine4@3718 51575b47-30f0-44d4-a5cc-537603b46e54
parent fef19454
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,8 @@ fs.setWritePath(fs.getHomePath())
fs.mount(engine.homepath, "/")
config.loadString[[
sound.enabled = true
music.volume = 60
audio.music_volume = 60
audio.effects_volume = 100
aa_text = true
fbo_active = true
shaders_active = true
......
......@@ -51,6 +51,7 @@ function _M:playMusic(name)
m = m:use() -- Get the source
m:loop(true)
m:play()
m:volume(config.settings.audio.music_volume / 100)
self.playing_musics[name] = {source=m}
end
......@@ -74,9 +75,13 @@ function _M:playAndStopMusic(...)
end
function _M:volumeMusic(vol)
do return end
vol = util.bound(vol, 0, 100)
if vol then
self:saveSettings("music", ("music.volume = %q\n"):format(vol))
self:saveSettings("audio", ("audio.music_volume = %q\n"):format(vol))
config.settings.audio = config.settings.audio or {}
config.settings.audio.music_volume = vol
end
for name, m in pairs(self.playing_musics) do
m.source:volume(vol / 100)
end
return core.sound.musicVolume(vol) or 0
end
......@@ -61,7 +61,8 @@ function _M:playSound(name)
end
if not s or not s.sample then return end
local source = s.sample:use()
if s.volume then source:volume(s.volume / 100) end
if s.volume then source:volume((s.volume / 100) * (config.settings.audio.effects_volume / 100))
else source:volume(config.settings.audio.effects_volume / 100) end
source:play()
self.playing_sounds[source] = true
return source
......@@ -76,3 +77,15 @@ function _M:cleanSounds()
end
for i = 1, #todel do self.playing_sounds[todel[i]] = nil end
end
function _M:volumeSoundEffects(vol)
vol = util.bound(vol, 0, 100)
if vol then
self:saveSettings("audio", ("audio.effects_volume = %q\n"):format(vol))
config.settings.audio = config.settings.audio or {}
config.settings.audio.effects_volume = vol
end
for source, _ in pairs(self.playing_sounds) do
source:volume(vol / 100)
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment