Source:play() fails
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- _DaCoolOne_
- Prole
- Posts: 16
- Joined: Sat Mar 09, 2019 3:46 am
Source:play() fails
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).
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).
Code: Select all
function not(val)
if val == true then
return false
else
return true
end
end
Re: Source:play() fails
There's a limit to how many sources can play at a time. See if you're hitting this limit.
- _DaCoolOne_
- Prole
- Posts: 16
- Joined: Sat Mar 09, 2019 3:46 am
Re: Source:play() fails
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.
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.
Last edited by _DaCoolOne_ on Wed Aug 14, 2019 11:12 am, edited 1 time in total.
Code: Select all
function not(val)
if val == true then
return false
else
return true
end
end
- _DaCoolOne_
- Prole
- Posts: 16
- Joined: Sat Mar 09, 2019 3:46 am
Re: Source:play() fails
Also, for reference, I have attached the main script for the game with the audio manager.
- Attachments
-
- main.lua
- (8.79 KiB) Downloaded 222 times
Code: Select all
function not(val)
if val == true then
return false
else
return true
end
end
- _DaCoolOne_
- Prole
- Posts: 16
- Joined: Sat Mar 09, 2019 3:46 am
Re: Source:play() fails
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)
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)
Code: Select all
function not(val)
if val == true then
return false
else
return true
end
end
- _DaCoolOne_
- Prole
- Posts: 16
- Joined: Sat Mar 09, 2019 3:46 am
Re: Source:play() fails
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.
Code: Select all
function not(val)
if val == true then
return false
else
return true
end
end
Re: Source:play() fails
Please file a bug report at the issue tracker.
- _DaCoolOne_
- Prole
- Posts: 16
- Joined: Sat Mar 09, 2019 3:46 am
Re: Source:play() fails
Code: Select all
function not(val)
if val == true then
return false
else
return true
end
end
Re: Source:play() fails
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 , so here is the link to slime's post:
https://love2d.org/forums/viewtopic.php ... 02#p228502
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 , so here is the link to slime's post:
https://love2d.org/forums/viewtopic.php ... 02#p228502
Re: Source:play() fails
I don't think you need any authorization whatsoever to do whatever* you wish with LOVE.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 11 guests