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

Function DeviceOpenSLQueue

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

Source from the content-addressed store, hash-verified

387 }
388
389 dmSound::Result DeviceOpenSLQueue(dmSound::HDevice device, const void* samples, uint32_t sample_count)
390 {
391 assert(device);
392 OpenSLDevice* opensl = (OpenSLDevice*) device;
393 if (!opensl->m_IsPlaying)
394 {
395 return dmSound::RESULT_INIT_ERROR;
396 }
397 DM_MUTEX_SCOPED_LOCK(opensl->m_Mutex);
398
399 assert(opensl->m_Free.Size() > 0);
400 Buffer b = opensl->m_Free.Pop();
401
402 memcpy(b.m_Buffer, (const int16_t*)samples, sample_count * sizeof(uint16_t) * 2);
403 b.m_FrameCount = sample_count;
404 opensl->m_Ready.Push(b);
405
406 if (opensl->m_Underflow) {
407 opensl->m_Underflow = false;
408 BufferQueueCallback(opensl->m_BufferQueue, opensl);
409 }
410
411 return dmSound::RESULT_OK;
412 }
413
414 uint32_t DeviceOpenSLFreeBufferSlots(dmSound::HDevice device)
415 {

Callers

nothing calls this directly

Calls 5

BufferQueueCallbackFunction · 0.85
assertFunction · 0.50
SizeMethod · 0.45
PopMethod · 0.45
PushMethod · 0.45

Tested by

no test coverage detected