本文整理汇总了C++中FAudioDeviceManager::FreeBufferResource方法的典型用法代码示例。如果您正苦于以下问题:C++ FAudioDeviceManager::FreeBufferResource方法的具体用法?C++ FAudioDeviceManager::FreeBufferResource怎么用?C++ FAudioDeviceManager::FreeBufferResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FAudioDeviceManager
的用法示例。
在下文中一共展示了FAudioDeviceManager::FreeBufferResource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Static function used to create an OpenAL buffer and upload raw PCM data to.
*
* @param InWave USoundWave to use as template and wave source
* @param AudioDevice audio device to attach created buffer to
* @return FXAudio2SoundBuffer pointer if buffer creation succeeded, NULL otherwise
*/
FXAudio2SoundBuffer* FXAudio2SoundBuffer::CreatePreviewBuffer( FXAudio2Device* XAudio2Device, USoundWave* Wave, FXAudio2SoundBuffer* Buffer )
{
FAudioDeviceManager* AudioDeviceManager = GEngine->GetAudioDeviceManager();
check(AudioDeviceManager != nullptr);
if (Buffer)
{
AudioDeviceManager->FreeBufferResource(Buffer);
}
// Create new buffer.
Buffer = new FXAudio2SoundBuffer( XAudio2Device, SoundFormat_PCMPreview );
// Take ownership the PCM data
Buffer->PCM.PCMData = Wave->RawPCMData;
Buffer->PCM.PCMDataSize = Wave->RawPCMDataSize;
Wave->RawPCMData = NULL;
// Copy over whether this data should be freed on delete
Buffer->bDynamicResource = Wave->bDynamicResource;
Buffer->InitWaveFormatEx( WAVE_FORMAT_PCM, Wave, true );
AudioDeviceManager->TrackResource(Wave, Buffer);
return( Buffer );
}
示例2: CreatePreviewBuffer
/**
* Static function used to create an OpenAL buffer and upload raw PCM data to.
*
* @param InWave USoundWave to use as template and wave source
* @param AudioDevice audio device to attach created buffer to
* @return FCoreAudioSoundBuffer pointer if buffer creation succeeded, NULL otherwise
*/
FCoreAudioSoundBuffer* FCoreAudioSoundBuffer::CreatePreviewBuffer( FCoreAudioDevice* CoreAudioDevice, USoundWave* Wave, FCoreAudioSoundBuffer* Buffer )
{
FAudioDeviceManager* AudioDeviceManager = GEngine->GetAudioDeviceManager();
check(AudioDeviceManager != nullptr);
if (Buffer)
{
AudioDeviceManager->FreeBufferResource( Buffer );
}
// Create new buffer.
Buffer = new FCoreAudioSoundBuffer( CoreAudioDevice, SoundFormat_PCMPreview );
// Take ownership the PCM data
Buffer->PCMData = Wave->RawPCMData;
Buffer->PCMDataSize = Wave->RawPCMDataSize;
Wave->RawPCMData = NULL;
// Copy over whether this data should be freed on delete
Buffer->bDynamicResource = Wave->bDynamicResource;
Buffer->InitAudioStreamBasicDescription( kAudioFormatLinearPCM, Wave, true );
AudioDeviceManager->TrackResource( Wave, Buffer );
return( Buffer );
}