Audio restarts after love.load()

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
akopyl
Prole
Posts: 21
Joined: Fri Jun 27, 2014 1:20 pm

Audio restarts after love.load()

Post by akopyl »

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.
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Audio restarts after love.load()

Post by zorg »

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.
Me and my stuff :3True 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.
User avatar
akopyl
Prole
Posts: 21
Joined: Fri Jun 27, 2014 1:20 pm

Re: Audio restarts after love.load()

Post by akopyl »

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.
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.
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Audio restarts after love.load()

Post by zorg »

zorg wrote:if anything, some audio functionality has changed between 0.9 and 0.10, so i'd check love.audio on the wiki.
In more detail, playing/paused/stopped states have been messed with, so it can work differently.
Me asking you for your love.load function still stands though.
Me and my stuff :3True 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.
User avatar
akopyl
Prole
Posts: 21
Joined: Fri Jun 27, 2014 1:20 pm

Re: Audio restarts after love.load()

Post by akopyl »

zorg wrote:
zorg wrote:if anything, some audio functionality has changed between 0.9 and 0.10, so i'd check love.audio on the wiki.
In more detail, playing/paused/stopped states have been messed with, so it can work differently.
Me asking you for your love.load function still stands though.
This is a pretty messy pile of code, so prepare yourself.
Attachments
v1.4.0.love
(2.47 MiB) Downloaded 184 times
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Audio restarts after love.load()

Post by zorg »

Okay, so, the function i asked for:

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
Looking into music.lua brings me here:

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
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.
Me and my stuff :3True 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.
User avatar
akopyl
Prole
Posts: 21
Joined: Fri Jun 27, 2014 1:20 pm

Re: Audio restarts after love.load()

Post by akopyl »

zorg wrote:Neat gorilla.bas remake though.
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 out :D
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests