| 362 | } |
| 363 | |
| 364 | void DeviceOpenSLClose(dmSound::HDevice device) |
| 365 | { |
| 366 | assert(device); |
| 367 | OpenSLDevice* opensl = (OpenSLDevice*) device; |
| 368 | dmMutex::Lock(opensl->m_Mutex); |
| 369 | |
| 370 | SLresult res = (*opensl->m_Play)->SetPlayState(opensl->m_Play, SL_PLAYSTATE_STOPPED); |
| 371 | CheckAndPrintError(res); |
| 372 | |
| 373 | (*opensl->m_BufferQueue)->Clear(opensl->m_BufferQueue); |
| 374 | (*opensl->m_Player)->Destroy(opensl->m_Player); |
| 375 | (*opensl->m_OutputMix)->Destroy(opensl->m_OutputMix); |
| 376 | (*opensl->m_SL)->Destroy(opensl->m_SL); |
| 377 | |
| 378 | while (opensl->m_Free.Size() > 0) { |
| 379 | Buffer b = opensl->m_Free.Pop(); |
| 380 | free(b.m_Buffer); |
| 381 | } |
| 382 | |
| 383 | dmMutex::Unlock(opensl->m_Mutex); |
| 384 | dmMutex::Delete(opensl->m_Mutex); |
| 385 | |
| 386 | delete opensl; |
| 387 | } |
| 388 | |
| 389 | dmSound::Result DeviceOpenSLQueue(dmSound::HDevice device, const void* samples, uint32_t sample_count) |
| 390 | { |