当前位置: 首页>>代码示例>>C++>>正文


C++ FAudioDeviceManager::FreeBufferResource方法代码示例

本文整理汇总了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 );
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:35,代码来源:XAudio2Buffer.cpp

示例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 );
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:35,代码来源:CoreAudioBuffer.cpp


注:本文中的FAudioDeviceManager::FreeBufferResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。