本文整理汇总了C++中FByteBulkData::GetCopy方法的典型用法代码示例。如果您正苦于以下问题:C++ FByteBulkData::GetCopy方法的具体用法?C++ FByteBulkData::GetCopy怎么用?C++ FByteBulkData::GetCopy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FByteBulkData
的用法示例。
在下文中一共展示了FByteBulkData::GetCopy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitAudioResource
void USoundWave::InitAudioResource( FByteBulkData& CompressedData )
{
if( !ResourceSize )
{
// Grab the compressed vorbis data from the bulk data
ResourceSize = CompressedData.GetBulkDataSize();
if( ResourceSize > 0 )
{
check(!ResourceData);
CompressedData.GetCopy( ( void** )&ResourceData, true );
}
}
}
示例2: BuildStreamedAudio
/** Build the streamed audio. This function is safe to call from any thread. */
void BuildStreamedAudio()
{
GetStreamedAudioDerivedDataKeySuffix(SoundWave, AudioFormatName, KeySuffix);
DerivedData->Chunks.Empty();
ITargetPlatformManagerModule* TPM = GetTargetPlatformManager();
const IAudioFormat* AudioFormat = NULL;
if (TPM)
{
AudioFormat = TPM->FindAudioFormat(AudioFormatName);
}
if (AudioFormat)
{
DerivedData->AudioFormat = AudioFormatName;
FByteBulkData* CompressedData = SoundWave.GetCompressedData(AudioFormatName);
TArray<uint8> CompressedBuffer;
CompressedBuffer.Empty(CompressedData->GetBulkDataSize());
CompressedBuffer.AddUninitialized(CompressedData->GetBulkDataSize());
void* BufferData = CompressedBuffer.GetData();
CompressedData->GetCopy(&BufferData, false);
TArray<TArray<uint8>> ChunkBuffers;
if (AudioFormat->SplitDataForStreaming(CompressedBuffer, ChunkBuffers))
{
for (int32 ChunkIndex = 0; ChunkIndex < ChunkBuffers.Num(); ++ChunkIndex)
{
FStreamedAudioChunk* NewChunk = new(DerivedData->Chunks) FStreamedAudioChunk();
NewChunk->DataSize = ChunkBuffers[ChunkIndex].Num();
NewChunk->BulkData.Lock(LOCK_READ_WRITE);
void* NewChunkData = NewChunk->BulkData.Realloc(ChunkBuffers[ChunkIndex].Num());
FMemory::Memcpy(NewChunkData, ChunkBuffers[ChunkIndex].GetData(), ChunkBuffers[ChunkIndex].Num());
NewChunk->BulkData.Unlock();
}
}
else
{
// Could not split so copy compressed data into a single chunk
FStreamedAudioChunk* NewChunk = new(DerivedData->Chunks) FStreamedAudioChunk();
NewChunk->DataSize = CompressedBuffer.Num();
NewChunk->BulkData.Lock(LOCK_READ_WRITE);
void* NewChunkData = NewChunk->BulkData.Realloc(CompressedBuffer.Num());
FMemory::Memcpy(NewChunkData, CompressedBuffer.GetData(), CompressedBuffer.Num());
NewChunk->BulkData.Unlock();
}
DerivedData->NumChunks = DerivedData->Chunks.Num();
// Store it in the cache.
PutDerivedDataInCache(DerivedData, KeySuffix);
}
if (DerivedData->Chunks.Num())
{
bool bInlineChunks = (CacheFlags & EStreamedAudioCacheFlags::InlineChunks) != 0;
bSucceeded = !bInlineChunks || DerivedData->TryInlineChunkData();
}
else
{
UE_LOG(LogAudio, Warning, TEXT("Failed to build %s derived data for %s"),
*AudioFormatName.GetPlainNameString(),
*SoundWave.GetPathName()
);
}
}