Page 1 of 2

Source:play() fails

Posted: Wed Aug 14, 2019 2:47 am
by _DaCoolOne_
Hello all!

Made a post a week or so ago, and have another question. A new bug has appeared in my game where some sources are not playing. After some debugging, I've traced the error back to the Source:play() itself. When called, source:play() returns false and does not start the audio. The weird thing is that it only does this for some sources and not for others (even though all sources are created and played the same way). My question is, what are some common reasons that this function can fail, and what can I do to combat the issue?

For reference, I'm on love 11.1 and my current system uses Source:clone() and Source:play() to run sources.

(Also sorry for lack of links to the wiki. I'm on mobile).

Re: Source:play() fails

Posted: Wed Aug 14, 2019 6:50 am
by raidho36
There's a limit to how many sources can play at a time. See if you're hitting this limit.

Re: Source:play() fails

Posted: Wed Aug 14, 2019 11:10 am
by _DaCoolOne_
Hey, thanks for the reply!

Decided to go back and test, and I found that at the time of playing the source, using love.audio.getActiveSourceCount allowed a sound to be played with a source count as high as 61 active sources (for a "ui mouse over" sound). However, at the time of playing the source that was failing, this number was only at 1 - 2.

However, when I tested the source also played when I first opened the game after booting my computer, but hasn't played on any subsequent runs. So now I have no idea what's going on. :P

Re: Source:play() fails

Posted: Wed Aug 14, 2019 11:12 am
by _DaCoolOne_
Also, for reference, I have attached the main script for the game with the audio manager.

Re: Source:play() fails

Posted: Wed Aug 14, 2019 11:52 am
by _DaCoolOne_
Sorry about posting so much, but upon further testing I have noted something interesting with playing the source.

The first time I start my computer, the audio source will play just fine. However, it then won't play no matter how many times I restart the game. In other words, it looks like love2d has issues loading the source twice, even if I let it play the source all the way through. However, if I restart my computer then love2d will play the source exactly once, and then never again. Something weird is going on.

I also tried scanning and stopping any active sources in love.quit, but this doesn't appear to have fixed the issue. Not sure what's going on at this point.

Any thoughts are welcome! (Relevant code in above post)

Re: Source:play() fails

Posted: Wed Aug 14, 2019 2:52 pm
by _DaCoolOne_
So I fixed my problem by just not cloning streamed sources. Most of the streamed stuff was voiced lines anyways, so I didn't need to have multiple of the same source playing, but I still find this bug weird. Any further thoughts appreciated. My issue is solved for now.

Re: Source:play() fails

Posted: Wed Aug 14, 2019 4:47 pm
by raidho36
Please file a bug report at the issue tracker.

Re: Source:play() fails

Posted: Wed Aug 14, 2019 5:35 pm
by _DaCoolOne_
Done. Hope to see this fixed soon! :)

https://bitbucket.org/rude/love/issues/1508

Re: Source:play() fails

Posted: Sat Aug 24, 2019 12:14 pm
by Sasha264
Love 11.1 ? Hmm...
Here was some threads with audio problems, and slime recommended to try nightly build of Love 11.3, which contains some audio fixes.
I am not "authorized" to distribute nightly builds :o:, so here is the link to slime's post:
https://love2d.org/forums/viewtopic.php ... 02#p228502

Re: Source:play() fails

Posted: Sat Aug 24, 2019 6:13 pm
by raidho36
I don't think you need any authorization whatsoever to do whatever* you wish with LOVE.