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

Method GetTime

Source/Engine/Audio/AudioSource.cpp:202–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202float AudioSource::GetTime() const
203{
204 if (_state == States::Stopped || SourceID == 0 || !Clip->IsLoaded())
205 return 0.0f;
206
207 float time = AudioBackend::Source::GetCurrentBufferTime(SourceID);
208
209 if (UseStreaming())
210 {
211 // Apply time offset to the first streaming buffer binded to the source including the already queued buffers
212 int32 numProcessedBuffers = 0;
213 AudioBackend::Source::GetProcessedBuffersCount(SourceID, numProcessedBuffers);
214 time += Clip->GetBufferStartTime(_streamingFirstChunk + numProcessedBuffers);
215 }
216
217 time = Math::Clamp(time, 0.0f, Clip->GetLength());
218
219 return time;
220}
221
222void AudioSource::SetTime(float time)
223{

Callers 2

RebuildContextFunction · 0.45

Calls 4

ClampFunction · 0.85
GetBufferStartTimeMethod · 0.80
IsLoadedMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected