AggrorJorn Posted September 12, 2010 Posted September 12, 2010 I have this sound menu in my project and you can set the volume for 3 different sound sliders. The sound volume is nicely stored in a variabele but now I need to get this variable to work with ingame sound emitters. I copied the sound emitter entity and added a menu for choosing the sound group. The problem is how to efficiently get the variables that contain the sound volume for each group to the sound emitter (gameVolume, musicVolume, speechVolume). I came up with the following but that, in the first place, doesn't work and it seems a bit redundant to let the emitter update itself constantly. Any ideas? function object:Update() local soundgroup = self.model:GetKey("soundgroup") if gameVolume ~= nil then if soundgroup == "Game sound" then object.model:SetKey("volume",gameVolume:ToNumber()) end end if musicVolume ~= nil then if soundgroup == "Music and ambient" then object.model:SetKey("volume",musicVolume:ToNumber()) end end if speechVolume ~= nil then if soundgroup == "Speech" then object.model:SetKey("volume",speechVolume:ToNumber()) end end end Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.