Audio restarts after love.load()
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Audio restarts after love.load()
I had a game that was match based and after each match it used love.load() to reset itself. In 0.9.2 the music would go on after love.load() was called, but now with 0.10.0 and 0.10.1 the music starts playing from the beginning. Was that a bug that got fixed? I could not find anything about this in the changelogs, so Im not sure if this was intentional.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Audio restarts after love.load()
love.load is a function you write; if anything, some audio functionality has changed between 0.9 and 0.10, so i'd check love.audio on the wiki.
Then again, post your love.load function, and maybe we can tell what changed.
Then again, post your love.load function, and maybe we can tell what changed.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Audio restarts after love.load()
The thing is that if i launch my game with 0.9.2 then it goes on, but if i launch the same .love with 0.10.1 then it stops after love.load is called. I did not change anything on my end.zorg wrote:love.load is a function you write; if anything, some audio functionality has changed between 0.9 and 0.10, so i'd check love.audio on the wiki.
Then again, post your love.load function, and maybe we can tell what changed.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Audio restarts after love.load()
In more detail, playing/paused/stopped states have been messed with, so it can work differently.zorg wrote:if anything, some audio functionality has changed between 0.9 and 0.10, so i'd check love.audio on the wiki.
Me asking you for your love.load function still stands though.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Audio restarts after love.load()
This is a pretty messy pile of code, so prepare yourself.zorg wrote:In more detail, playing/paused/stopped states have been messed with, so it can work differently.zorg wrote:if anything, some audio functionality has changed between 0.9 and 0.10, so i'd check love.audio on the wiki.
Me asking you for your love.load function still stands though.
- Attachments
-
- v1.4.0.love
- (2.47 MiB) Downloaded 184 times
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Audio restarts after love.load()
Okay, so, the function i asked for:
Looking into music.lua brings me here:
You don't want to call play each update, since it's both wrong and pointless.
If you want it to loop, then do music.track[1].audio:setLooping(true) in music.load, and either start playing the track there as well, or call play somewhere else, but only once.
No idea why the behaviour changed though, then again, i didn't look into it that much.
Neat gorilla.bas remake though.
Code: Select all
function love.load()
opSys = love.system.getOS()
gamestate = 'startScreen'
ui.load()
monkey.load()
world.load()
grenade.load()
music.load() -- first guess
love.audio.setVolume(0.2)
end
Code: Select all
function music.update(dt)
music.track[1].audio:play() -- <---------------------------------------------
if ui.muteMusic then
music.track[1].audio:setVolume(0)
else
music.track[1].audio:setVolume(1.5)
end
end
If you want it to loop, then do music.track[1].audio:setLooping(true) in music.load, and either start playing the track there as well, or call play somewhere else, but only once.
No idea why the behaviour changed though, then again, i didn't look into it that much.
Neat gorilla.bas remake though.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: Audio restarts after love.load()
Oh my god! I didnt even know this game existed! This is awesome! Thanks for your help anyway, I still can do something stupid like that play call in update, so it definetly helps to have someone point that outzorg wrote:Neat gorilla.bas remake though.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 1 guest