Commit 7f18932c authored by David Reid's avatar David Reid

audioio: Clean up.

parent bbdd3f47
...@@ -15210,23 +15210,14 @@ mal_result mal_device_init__audioio(mal_context* pContext, mal_device_type devic ...@@ -15210,23 +15210,14 @@ mal_result mal_device_init__audioio(mal_context* pContext, mal_device_type devic
AUDIO_INITINFO(&fdInfo); AUDIO_INITINFO(&fdInfo);
fdInfo.blocksize = fragmentSizeInBytes; fdInfo.blocksize = fragmentSizeInBytes;
fdInfo.hiwat = mal_max(pDevice->periods, 2); fdInfo.hiwat = mal_max(pDevice->periods, 5);
fdInfo.lowat = (unsigned int)(fdInfo.hiwat * 0.75); fdInfo.lowat = (unsigned int)(fdInfo.hiwat * 0.75);
if (ioctl(pDevice->audioio.fd, AUDIO_SETINFO, &fdInfo) < 0) { if (ioctl(pDevice->audioio.fd, AUDIO_SETINFO, &fdInfo) < 0) {
close(pDevice->audioio.fd); close(pDevice->audioio.fd);
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[audioio] Failed to set internal buffer size. AUDIO_SETINFO failed.", MAL_FORMAT_NOT_SUPPORTED); return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[audioio] Failed to set internal buffer size. AUDIO_SETINFO failed.", MAL_FORMAT_NOT_SUPPORTED);
} }
#if 1
printf("blocksize: %d -> %d\n", fragmentSizeInBytes, fdInfo.blocksize);
printf("hiwat: %d\n", fdInfo.hiwat);
printf("lowat: %d\n", fdInfo.lowat);
#endif
pDevice->periods = fdInfo.hiwat; pDevice->periods = fdInfo.hiwat;
pDevice->bufferSizeInFrames = (fdInfo.blocksize * fdInfo.hiwat) / mal_get_bytes_per_frame(pDevice->internalFormat, pDevice->internalChannels); pDevice->bufferSizeInFrames = (fdInfo.blocksize * fdInfo.hiwat) / mal_get_bytes_per_frame(pDevice->internalFormat, pDevice->internalChannels);
...@@ -15279,7 +15270,7 @@ mal_result mal_device__stop_backend__audioio(mal_device* pDevice) ...@@ -15279,7 +15270,7 @@ mal_result mal_device__stop_backend__audioio(mal_device* pDevice)
{ {
mal_assert(pDevice != NULL); mal_assert(pDevice != NULL);
if (ioctl(pDevice->audioio.fd, AUDIO_DRAIN, 0) < 0) { if (ioctl(pDevice->audioio.fd, AUDIO_FLUSH, 0) < 0) {
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[audioio] Failed to stop device. AUDIO_FLUSH failed.", MAL_FAILED_TO_STOP_BACKEND_DEVICE); return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[audioio] Failed to stop device. AUDIO_FLUSH failed.", MAL_FAILED_TO_STOP_BACKEND_DEVICE);
} }
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