Convert a Source to a string? (Or some other solution)
Posted: Wed Mar 18, 2015 9:20 pm
So currently my dilemma is being able to change the volume to my game.
As it stands all my audio file are added in as sources, and their volumes have been set to a specific amount that makes all the sources sound great comparatively, but doesn't allow me to change the volume easily, or mute the volume.
So my current solution is this: currently almost all of my audio is run through a function whenever it is called to be played, so I'm thinking that whenever that function is called, it will run through a simple check:
and if the player ever needs to change the volume mid game, sounds will be set to an empty list.
However, I'm having trouble toStringifying the source, does anyone know of how to do this?
Or, if there's some obvious solution I'm missing, what is a better way to keep track of my audio?
As it stands all my audio file are added in as sources, and their volumes have been set to a specific amount that makes all the sources sound great comparatively, but doesn't allow me to change the volume easily, or mute the volume.
So my current solution is this: currently almost all of my audio is run through a function whenever it is called to be played, so I'm thinking that whenever that function is called, it will run through a simple check:
Code: Select all
masterVolume = 0
sounds = {}
if sounds.toString(source) == nil then
source:setVolume(source:getVolume() * masterVolume)
sounds.toString(source) = true
end
However, I'm having trouble toStringifying the source, does anyone know of how to do this?
Or, if there's some obvious solution I'm missing, what is a better way to keep track of my audio?