Stopping All Audio that is Playing
November 17, 2014 12:00 AM
I want to know what the best way is to have an audio off button that stops any audio that is playing. Currently, I have all the course audio at the title level so that I can turn them off individually all at once. Does that cause performance problems because they all have to load in the memory?
Can you mute audio and then play an audio, or does the mute audio command prevent the next audio from playing? (In this case, I'm trying to cut off narration to play a feedback sound effect).
Discussion (2)
Not clear how you have this designed. Putting audio at top should not degrade once it is loaded but you should try in the worst environment.
To stop audio, you need an action to Stop it, one for each audio that could be playing.
Call me if you want to discuss. I am in Atlanta, Ga.
There is a way you can do this that can improve performance. It's something we teach in our Extreme/Games class.
The short version:
1. At the title level, add a "placeholder" audio file that is no more than a few seconds of blank (no sound) audio. (Leave Auto-start off.) Inherit this audio file to all pages within the title. This is all that will get loaded with each page.
(Note: all of your other audio files can just be in the resource manager. They don't have to actually exist/be inherited to each page.)
2. On each page with audio, add an action to:
Trigger: On Show
Action: Change Contents
Target: Placeholder Audio file
Resource: the actual audio file that needs to be loaded for that page
3. Place your play/pause/stop/mute buttons at the title level as well. The target of these actions is the Placeholder Audio file.
As a page loads it loads the inherited placeholder. Then the change contents action swaps in the real file to be heard. But your buttons still control it because they target the placeholder.
Since the placeholder is all that gets loaded, your performance should improve. You can also still have play/pause/stop actions on your page to allow you to shut off the narration audio (the placeholder audio) to play your feedback sound.
Hope this helps.
Daryl Fleary
Product Manager
Trivantis
Discussions have been disabled for this post