Share via

How to stop AudioGraph when using QuantumStarted?

vansa 41 Reputation points
2022-03-23T11:11:59.517+00:00

Based on the docs of AudioGraph.QuantumStarted :

The QuantumStarted event is synchronous, which means that you can't update the properties or state of the AudioGraph or the individual audio nodes in the handler for this event. Attempting perform an operation such as stopping the audio graph or adding, removing, or starting an individual audio node will result in an exception being thrown.

If I try to stop my AudioGraph when it still processes the audio quantum, my whole app freezes as expected.
I want to stop the AudioGraph in the middle of playback and I don't want to wait until the end. So, how do I stop the AudioGraph properly?
I don't want to use AudioGraph.QuantumProcessed , because it can't be used for synchronized processing of audio data as mentioned from the docs.

Developer technologies | Universal Windows Platform (UWP)

Answer accepted by question author

Anonymous
2022-03-24T03:07:04.4+00:00

Hello,

Welcome to Microsoft Q&A!

How do I stop the AudioGraph properly?

No, as you've already seen in the document, there is no other way to change the AudioGraph status if you are handling the AudioGraph.QuantumStarted event. I know that you don't want to use the AudioGraph.QuantumProcessed event, but this is the event where you could change the AudioGraph status as you want.

Thank you.


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.