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

Function QueueBuffer

Source/Engine/Audio/XAudio2/AudioBackendXAudio2.cpp:174–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172 }
173
174 void QueueBuffer(Source* aSource, const int32 bufferID, XAUDIO2_BUFFER& buffer)
175 {
176 Buffer* aBuffer = Buffers[bufferID - 1];
177 buffer.pAudioData = aBuffer->Data.Get();
178 buffer.AudioBytes = aBuffer->Data.Count();
179
180 if (aSource->StartTimeForQueueBuffer > ZeroTolerance)
181 {
182 // Offset start position when playing buffer with a custom time offset
183 const uint32 bytesPerSample = aBuffer->Info.BitDepth / 8 * aBuffer->Info.NumChannels;
184 buffer.PlayBegin = (UINT32)(aSource->StartTimeForQueueBuffer * aBuffer->Info.SampleRate);
185 buffer.PlayLength = (buffer.AudioBytes / bytesPerSample) - buffer.PlayBegin;
186 aSource->LastBufferStartTime = aSource->StartTimeForQueueBuffer;
187 aSource->StartTimeForQueueBuffer = 0;
188 }
189
190 const HRESULT hr = aSource->Voice->SubmitSourceBuffer(&buffer);
191 XAUDIO2_CHECK_ERROR(SubmitSourceBuffer);
192 }
193
194 void VoiceCallback::OnBufferEnd(void* pBufferContext)
195 {

Callers 5

UpdateAudioBufferMethod · 0.85
UpdateMethod · 0.85
Source_QueueBufferMethod · 0.85

Calls 2

GetMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected