音波プロパティ
オーディオデータへのアクセス
PCMバッファの取得
サウンドウェーブから直接PCMバッファ全体を取得できます。
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object
TArray<float> PCMBuffer = ImportedSoundWave->GetPCMBufferCopy();
ヒント
取得したPCMデータをバイトに変換する必要がある場合は、Float Array to Bytesを参照してください。
再生プロパティ
ループ再生
シームレスなオーディオループを作成するには、ループ設定を有効にすることで、再生終了後に自動的にサウンドウェーブの再生位置をゼロに巻き戻して再生できます。
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object
ImportedSoundWave->SetLooping(false);
音量制御
再生中のサウンドの音量を、必要に応じて調整できます。
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object
ImportedSoundWave->SetVolume(1.0f);
ピッチ調整
再生中のサウンドのピッチを好みに応じて調整できます。
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object
ImportedSoundWave->SetPitch(1.0f);
追加機能
字幕
字幕を設定することが可能です。具体的には、表示するテキストと表示タイミングを定義できます。
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object
TArray<FEditableSubtitleCue> Subtitles;
FEditableSubtitleCue Subtitle;
Subtitle.Text = FText::FromString("Example");
Subtitle.Time = 2.0f;
Subtitles.Add(Subtitle);
ImportedSoundWave->SetSubtitles(Subtitles);
仮想化モード
Play When Silent などの仮想化モードを設定できます。これに より、無音時にもサウンドウェーブの再生を継続できます。
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object
ImportedSoundWave->SetVirtualizationMode(EVirtualizationMode::PlayWhenSilent);