CriWare Unreal Engine
Plug-ins for CriWare solutions.
Loading...
Searching...
No Matches
ADX Tutorial No.6: Play a sound at the player's desired timing

In this article, we will introduce how to start playing audio at the player's arbitrary timing.

Get AtomComponent

Gets the AtomComponent that controls audio playback processing.
There are roughly two ways to obtain it.

  1. Get the AtomComponent attached to the Actor.
  2. Create a new AtomComponent.


Play audio

Set the audio to play

Before starting playback, you need to set the sound Cue (UAtomSoundCue) to be played.
There is also a method for setting from the editor's outer screen (./Tutorials/ADX/PlaySounds/PlaySounds.INT.udn), but
This time I will introduce how to set it on BP.

The sound Cue passed to the UAtomComponent::SetSound() function argument is set for playback.

To obtain a sound Cue, you can obtain it from the following API of sound Cue Sheet (UAtomCueSheet) .

  • UAtomCueSheet::GetSoundCue()
  • UAtomCueSheet::GetSoundCueByName()


Additionally, the currently set sound Cue can be obtained by referencing the UAtomComponent::Sound variable.
Make sure that the obtained sound Cue is valid (non-NULL) before starting playback.

Start playing

Playback is started by calling the UAtomComponent::Play() function.


You can check whether it is being played using the following method.

  • Check with the return value of the UAtomComponent::IsPlaying() function.
  • Check whether the playback status obtained from the UAtomComponent::GetStatus() function is Playing .


Play audio when Key is pressed

We have described a Sample implementation that starts playback if the audio is Stop at the timing you press the space Key , and starts Stop if the audio is playing.

  • Checking the validity status is omitted.




THIS SERVICE MAY CONTAIN TRANSLATIONS POWERED BY GOOGLE. GOOGLE DISCLAIMS ALL WARRANTIES RELATED TO THE TRANSLATIONS, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OF ACCURACY, RELIABILITY, AND ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.