Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioOut stop() & enqueue AudioOut.Flush both lockup Sim and device #263

Closed
zgramana opened this issue Sep 14, 2019 · 7 comments
Closed

Comments

@zgramana
Copy link
Contributor

Trying to cancel enqueued samples, and calling either stop or enqueue(stream, AudioOut.Flush) results in a hung device (moddable 2) or simulator (macOS).

@phoddie
Copy link
Collaborator

phoddie commented Sep 14, 2019

@zgramana, if you would provide an example, that would ensure we are looking into the same issue and help us to isolate the problem. Thanks.

@zgramana
Copy link
Contributor Author

zgramana commented Sep 16, 2019

@phoddie I've sent your PR #265, which both reproduces the problem and provides a needed example for the use of AudioOut (which is woefully under-documented given its rather impressive capabilities--especially as a mixer and for sound+event/effect synchronization).

It appears there are a couple of issues which this example can reproduce. I will file separate issues for them in case they are not the same root cause.

@zgramana
Copy link
Contributor Author

zgramana commented Sep 16, 2019

Steps to reproduce this issue

  1. Launch Adds AudioOut version of the piu/Sound example #265 in a debug session targeting the simulator
  2. Establish expected behavior:
    1. Press play
    2. Wait for melody to finish playing
    3. Observe the following trace log message: => Playing sound...done
  3. Observe the defect
    1. Press play
    2. Immediately press play again
    3. Observe the following trace log message: => Playing sound=> Stopping sound playback!
    4. Notice that no further interaction with the simulator is possible
    5. Notice that the debugger is unresponsive to the 'Kill' command in xsbug

Note: You must force-quit the simulator to tear down the test setup

@phoddie
Copy link
Collaborator

phoddie commented Sep 23, 2019

@zgramana - nice example. And, yes, it hangs. :(

The fix seems straightforward. I tested on macOS. It should work everywhere. Would you give it a try? In audioOut.c in the function xs_audioout_enqueue move lines 648 to 652 to directly after the unlock in lines 654 - 662. Please let me know how that goes.

We'd be happy to accept the PR. You'll just need to complete the CLA.

@zgramana
Copy link
Contributor Author

@phoddie The fix works when tested on a Moddable Two and a Mac via the Simulator. Cheers!

  • Do you want the change to audioOut.c added to the PR?
  • Where does the CLA PDF go once signed?

@phoddie
Copy link
Collaborator

phoddie commented Oct 21, 2019

Thanks for confirming. I committed the change already so it is in the current tree.

You can email the executed CLA PDF to [email protected]. Thank you!

@zgramana
Copy link
Contributor Author

  • Email signed CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants