MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ExtractData

Method ExtractData

Source/Engine/Audio/AudioClip.cpp:162–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162bool AudioClip::ExtractData(Array<byte>& resultData, AudioDataInfo& resultDataInfo)
163{
164 ASSERT(!IsVirtual());
165 if (WaitForLoaded())
166 return true;
167 ScopeLock lock(Locker);
168 auto storageLock = Storage->LockSafe();
169
170 // Allocate memory
171 ASSERT(_totalChunksSize > 0);
172 resultData.Resize(_totalChunksSize);
173
174 // Load and copy data
175 if (LoadChunks(ALL_ASSET_CHUNKS))
176 return true;
177 int32 pos = 0;
178 Storage->LockChunks();
179 for (int32 i = 0; i < _totalChunks; i++)
180 {
181 const auto chunk = GetChunk(i);
182 const uint32 size = chunk->Size();
183 Platform::MemoryCopy(resultData.Get() + pos, chunk->Get(), size);
184 pos += size;
185 }
186 Storage->UnlockChunks();
187 ASSERT(pos == _totalChunksSize);
188
189 // Copy header
190 resultDataInfo = AudioHeader.Info;
191
192 return false;
193}
194
195bool AudioClip::ExtractDataFloat(Array<float>& resultData, AudioDataInfo& resultDataInfo)
196{

Callers

nothing calls this directly

Calls 7

IsVirtualFunction · 0.85
GetChunkFunction · 0.85
LockSafeMethod · 0.80
LockChunksMethod · 0.80
ResizeMethod · 0.45
SizeMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected