The audio playback controller can be used to play sound continuously on a loop in your AR effect or add one-shot triggered audio in response to boolean signals.
It must be connected to a speaker, which will render the sound in the scene.
Create an audio playback controller in the Assets panel:
An asset called audioPlaybackController0 will be listed in the Assets panel.
To connect an audio file to the audio playback controller:
Then connect the audio playback controller to a speaker in your scene, again through the speaker's Audio property
You can then edit the audio playback controller's properties to add looping and one shot audio.
When the audio playback controller is selected in the Scene panel, you'll see its properties in the Inspector:
Apply an audio clip to the playback controller.
Checking the box next to Play will play the audio clip once when the effect is opened.
Clicking the arrow next to Play will create a patch in the Patch Editor. The patch can be used to play an audio clip when a boolean signal is ‘true’.
The patch graph below will cause the audio clip to switch between playing and stopping each time a tap is detected on the device screen. The clip will play from the position it stopped at:
Checking the checkbox next to Loop will play the audio clip continuously as soon as the effect is opened.
Clicking the arrow next to Loop will create a patch in the Patch Editor. Your audio clip will loop continuously while a boolean input is ‘true’.
Clicking the arrow next to Reset will create a patch in the Patch Editor.
The patch can be used to stop your audio clip in response to a boolean signal. The clip will always be reset to the beginning. If the clip is already playing or looping it will reset to the beginning and continue playing. If not, it will play from the beginning next time the Play value is set to true.
The patch graph below will cause the audio clip to switch between playing and stopping each time a tap is detected on the device screen. The clip will reset from the beginning each time: