| 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 | { |
nothing calls this directly
no test coverage detected