오디오 재생
기본 재생
가져온 사운드 웨이브를 재생하려면 일반 사운드와 동일한 함수를 사용하세요. 예를 들어, Sound Cue와 같은 오디오 컴포넌트에서 PlaySound2D
또는 Play
함수를 사용할 수 있습니다.
재생 제어
재생 시간 되감기
사운드 웨이브의 재생 시간을 되감으려면 RewindPlaybackTime
함수를 사용하세요.
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object
// Rewind playback time of the sound wave for 12.5 seconds
ImportedSoundWave->RewindPlaybackTime(12.5f);
노트
UE 4.27 버전까지는 0보다 큰 특정 시간부터 재생을 시작하려면, 먼저 RewindPlaybackTime
함수를 사용해야 할 수 있습니다. 그렇지 않으면 프로시저럴 웨이브 처리에 대한 엔진 내부 문제로 인해 사운드가 올바르게 재생되지 않을 수 있습니다. 이 문제는 5.0 버전부터 엔진에서 해결되었습니다.
재생 정보 가져오기
사운드 웨이브의 현재 재생 시간을 얻으려면 GetPlaybackTime
또는 GetPlaybackPercentage
함수를 사용하세요. 또한 GetDuration
함수를 사용하여 사운드 웨이브의 지속 시간을 얻을 수 있습니다.
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object
// Get the current playback time of the sound wave
float PlaybackTime = ImportedSoundWave->GetPlaybackTime();
// Get the current playback percentage of the sound wave
float PlaybackPercentage = ImportedSoundWave->GetPlaybackPercentage();
// Get the duration of the sound wave
float Duration = ImportedSoundWave->GetDuration();
재생 상태 확인하기
현재 재생 중인지 확인
사운드 웨이브가 현재 재생 중인지 확인하려면 IsPlaying
함수를 사용할 수 있습니다.
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object
// Check if the sound wave is currently playing
bool bIsPlaying = ImportedSoundWave->IsPlaying();