| 200 | } |
| 201 | |
| 202 | float 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 | |
| 222 | void AudioSource::SetTime(float time) |
| 223 | { |
no test coverage detected