How to turn off audio inside game loop
How to turn off audio inside game loop
hi everyone , i am working on 2d endless running game for android . I only want to mute all sounds with button just like other games . I can do it by putting every sound play statements inside if statement but it is not a proper way . can anyone suggest me how can i do that ?
Re: How to turn off audio inside game loop
You can use love.audio.setVolume to keep playing them while muted, or love.audio.stop to stop everything that's playing and then, as you said, not play anything unless it's unmuted. What you choose is up to you - I guess the former will be a bit heavier on the processor and/or battery and/or might mess with volume controls since it might technically still be playing sounds, and the music progresses while not heard so when someone unmutes it will be as if it never stopped; the latter will require "if guards" or similar, but it'll truly stop any audio from being played and processed; the music will resume from the beginning when unmuting.
This might all bee moot if LÖVE, or OpenAL, handles no volume as a special case; in that case, I guess it's just the same.
This might all bee moot if LÖVE, or OpenAL, handles no volume as a special case; in that case, I guess it's just the same.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Who is online
Users browsing this forum: No registered users and 2 guests