Testing Error with clearing buffer from source: Invalid OperationWarning: audio error: Failed to clear buffer from source: Invalid Operation

Just to be clear, this is not a new issue. It has actually been occurring since 2014.

It depends on the minigame I am creating. In some cases, I don’t need channels and I don’t need to deal with this issue. But there are some cases where I do need to use channels where this happens. For example, if I have multiple characters in a game. Each individual character should only have one voice at a time. At the same time, all characters can talk simultaneously. In this case, we could assign a channel to a character. So if characterA is talking but I tap on him and want him to immediately react, then I’d stop channelA and play a reaction sound on that same channel. I never play all my sounds and music on a single channel. I only use channels when they are necessary for things like the example above. And those are the times when I encounter these issues.

I just wanted to confirm that this bug still exists. I’m using Build: 2016.2913.

 

I’m happy to hear it can’t be produced on iPad. Did anyone test Android? Does this happen only in the simulator?

Hello, I’d like to bring this discussion back to life. Here’s a summary of the issue…

Background : This Corona project is used to demonstrate an issue that sometimes occur when trying to stop and play audio on a single channel.

Expected Behavior : When stopping a channel and then immediately playing audio on that same channel, the previous sound effect should stop and the new one should start.

Issue Description : Sometimes this expected behavior does not happen.

  • First, the audio playing will not stop.
  • Second, unable to play new audio on that particular channel until current audio is complete.
  • On the Corona Mac Simulator, comes with the following errors:
    • “17dTesting Error with clearing buffer from source: Invalid OperationWarning: audio error: Failed to clear buffer from source: Invalid Operation”
    • “Warning: audio error: Could not bind data to source: Invalid Operation”

Why is this important to fix?

  • People have been bringing this issue up for at least two years now.
  • Channels should work correctly. If a channel is stopped, it should stop. If we try to play a sound effect on that channel, that sound effect should work.
  • Hacking “work arounds” like using timers requires a lot of work. Not only do we now have to start and stop channels, but we also need to start and cancel timers to do something that should be extremely simple. Having all that timer maintenance is frustrating when this should literally be a two line behavior. (Assuming you have multiple characters and each character has it’s own channel… now each character also needs a timer just so that the audio/channel can work correctly)

Tested with   Corona 2016.2970 on :
Corona Mac Simulator :

  • Easily reproducible. Can reproduce in a matter of seconds
  • Errors/Warnings discussed above show in Console log

iPad Mini :

  • Harder to reproduce than Mac Simulator. But still reproducible.
  • Errors/Warnings discussed above do NOT show in Console log

Samsung Tab3 :

  • Unable to reproduce.
  • No Errors/Warnings discussed above
  • Sometimes the current audio will not stop and will have to wait a tiny bit. But, it is not the case that I need to wait until the current audio is 100% complete. The difference between this and the Mac and iPad tests is that if I keep pressing the button, eventually it will register and play the new sound effect. Whereas on the Mac and iPad, even if I keep pressing the button, it will not work until the current SFX is over.

Code to reproduce can be found here.

Bug report submitted (#6175112) .

I agree this is important. I don’t know if this helps but I’m pretty sure this issue did not happen in December 2015. I’m not sure which build I was using but probably it was recent at the time. I don’t remember experiencing this last year. Due to time constraints I had to put my project on hold. Now when I continue it almost a year later, I get the error all the time. Code-wise nothing has changed in my project.

Hi guys,

The engineers report that we haven’t changed our audio code in a long time, so I’m not sure why this issue seems to be happening “now but not before” for some users.

@jhow, thanks for filing the bug report. This is looking like a very complex multi-thread race condition only on some devices/platforms, so it could be very difficult to diagnose and solve.

Out of curiosity, may I ask whether you’re dedicating one sole channel for sound effects or for music? In all of my previous projects, I have dedicated (reserved) perhaps 1-3 channels for music tracks (background music, etc.), but I have left the audio engine open to choose its own open channels for sound effects because, simply put, it’s a lot easier for me to just let it handle that aspect itself. I’m not entirely sure what your own personal approach is, but that’s how I’ve always handled my audio setup.

Brent

Any news on this? I get exactly the same issue in the simulator, sporadically occurring when trying to start a sound playing whilst another is already playing. I am letting the audio engine choose the channel itself.

Corona Build = 2016.2948

OS = 10.11.3 El Capitan

17dTesting Error with clearing buffer from source: Invalid OperationWarning: audio error: Failed to clear buffer from source: Invalid Operation

 

Warning: audio error: Could not bind data to source: Invalid Operation

Just to be clear, this is not a new issue. It has actually been occurring since 2014.

It depends on the minigame I am creating. In some cases, I don’t need channels and I don’t need to deal with this issue. But there are some cases where I do need to use channels where this happens. For example, if I have multiple characters in a game. Each individual character should only have one voice at a time. At the same time, all characters can talk simultaneously. In this case, we could assign a channel to a character. So if characterA is talking but I tap on him and want him to immediately react, then I’d stop channelA and play a reaction sound on that same channel. I never play all my sounds and music on a single channel. I only use channels when they are necessary for things like the example above. And those are the times when I encounter these issues.