MCPcopy Create free account
hub / github.com/defold/defold / BufferQueueCallback

Function BufferQueueCallback

engine/sound/src/devices/device_opensl.cpp:173–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171 }
172
173 static void BufferQueueCallback(SLBufferQueueItf queueItf, void *context)
174 {
175 OpenSLDevice* opensl = (OpenSLDevice*) context;
176 DM_MUTEX_SCOPED_LOCK(opensl->m_Mutex);
177
178 if (opensl->m_Playing.Size() > 0) {
179 Buffer b = opensl->m_Playing.Pop();
180 opensl->m_Free.Push(b);
181 }
182 if (opensl->m_Ready.Size() > 0) {
183 Buffer b = opensl->m_Ready.Pop();
184 SLresult res = (*queueItf)->Enqueue(queueItf, b.m_Buffer, b.m_FrameCount * sizeof(uint16_t) * 2);
185 CheckAndPrintError(res);
186 opensl->m_Playing.Push(b);
187 } else {
188 opensl->m_Underflow = true;
189 }
190 }
191
192 static int GetSampleRate()
193 {

Callers 1

DeviceOpenSLQueueFunction · 0.85

Calls 4

CheckAndPrintErrorFunction · 0.70
SizeMethod · 0.45
PopMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected