Commit 28d7086c authored by David Reid's avatar David Reid

Try fixing a few issues with sndio.

parent 15c6e48b
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
// - ALSA // - ALSA
// - PulseAudio // - PulseAudio
// - JACK // - JACK
// - sndio (BSD) // - sndio (OpenBSD)
// - audioio (NetBSD) // - audioio (NetBSD)
// - OSS (FreeBSD) // - OSS (FreeBSD)
// - OpenSL|ES (Android only) // - OpenSL|ES (Android only)
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
// //
// Building for BSD // Building for BSD
// ---------------- // ----------------
// The BSD build only requires linking to -ldl, -lpthread and -lm. // The BSD build only requires linking to -ldl, -lpthread and -lm. NetBSD uses audio(4), OpenBSD uses sndio and
// FreeBSD uses OSS.
// //
// Building for Android // Building for Android
// -------------------- // --------------------
...@@ -119,6 +120,7 @@ ...@@ -119,6 +120,7 @@
// is that it depends on members of mal_device being correctly aligned for atomic assignments. // is that it depends on members of mal_device being correctly aligned for atomic assignments.
// - Sample data is always little-endian and interleaved. For example, mal_format_s16 means signed 16-bit // - Sample data is always little-endian and interleaved. For example, mal_format_s16 means signed 16-bit
// integer samples, interleaved. Let me know if you need non-interleaved and I'll look into it. // integer samples, interleaved. Let me know if you need non-interleaved and I'll look into it.
// - The sndio backend is currently only enabled on OpenBSD builds.
// //
// //
// //
...@@ -15634,14 +15636,14 @@ mal_result mal_device_init__sndio(mal_context* pContext, mal_device_type deviceT ...@@ -15634,14 +15636,14 @@ mal_result mal_device_init__sndio(mal_context* pContext, mal_device_type deviceT
par.rate = desiredSampleRate; par.rate = desiredSampleRate;
if (((mal_sio_setpar_proc)pContext->sndio.sio_setpar)((struct mal_sio_hdl*)pDevice->sndio.handle, &par) == 0) { /*if (((mal_sio_setpar_proc)pContext->sndio.sio_setpar)((struct mal_sio_hdl*)pDevice->sndio.handle, &par) == 0) {
((mal_sio_close_proc)pContext->sndio.sio_close)((struct mal_sio_hdl*)pDevice->sndio.handle); ((mal_sio_close_proc)pContext->sndio.sio_close)((struct mal_sio_hdl*)pDevice->sndio.handle);
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[sndio] Failed to set device parameters.", MAL_FORMAT_NOT_SUPPORTED); return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[sndio] Failed to set device parameters.", MAL_FORMAT_NOT_SUPPORTED);
} }
if (((mal_sio_getpar_proc)pDevice->pContext->sndio.sio_getpar)((struct mal_sio_hdl*)pDevice->sndio.handle, &par) == 0) { if (((mal_sio_getpar_proc)pDevice->pContext->sndio.sio_getpar)((struct mal_sio_hdl*)pDevice->sndio.handle, &par) == 0) {
((mal_sio_close_proc)pDevice->pContext->sndio.sio_close)((struct mal_sio_hdl*)pDevice->sndio.handle); ((mal_sio_close_proc)pDevice->pContext->sndio.sio_close)((struct mal_sio_hdl*)pDevice->sndio.handle);
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[sndio] Failed to retrieve device parameters.", MAL_FORMAT_NOT_SUPPORTED); return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[sndio] Failed to retrieve device parameters.", MAL_FORMAT_NOT_SUPPORTED);
} }*/
// Try calculating an appropriate default buffer size after we have the sample rate. // Try calculating an appropriate default buffer size after we have the sample rate.
...@@ -15659,7 +15661,7 @@ mal_result mal_device_init__sndio(mal_context* pContext, mal_device_type deviceT ...@@ -15659,7 +15661,7 @@ mal_result mal_device_init__sndio(mal_context* pContext, mal_device_type deviceT
desiredBufferSizeInFrames = mal_calculate_default_buffer_size_in_frames(pConfig->performanceProfile, par.rate, fCPUSpeed*fDeviceType*fBackend); desiredBufferSizeInFrames = mal_calculate_default_buffer_size_in_frames(pConfig->performanceProfile, par.rate, fCPUSpeed*fDeviceType*fBackend);
} }
((mal_sio_initpar_proc)pContext->sndio.sio_initpar)(&par); //((mal_sio_initpar_proc)pContext->sndio.sio_initpar)(&par);
par.round = desiredBufferSizeInFrames / pDevice->periods; par.round = desiredBufferSizeInFrames / pDevice->periods;
par.appbufsz = par.round * pDevice->periods; par.appbufsz = par.round * pDevice->periods;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment