The old main loop is getting replaced with an improved implementation that's based on the blocking read/write API.
With the blocking API, the device is started automatically in read()/write(). All we need to do is enter the loop and just keep reading
or writing based on the period size.
*/
if (pDevice->pContext->onDeviceRead || pDevice->pContext->onDeviceWrite) { /* <-- TODO: Get rid of this check once the old implementation has been entirely replaced. */
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "mal_device_init() called with an invalid config. Device type is invalid. Make sure the device type has been set in the config.", MAL_INVALID_DEVICE_CONFIG);
}
if (config.channels > MAL_MAX_CHANNELS) {
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "mal_device_init() called with an invalid config. Channel count cannot exceed 32.", MAL_INVALID_DEVICE_CONFIG);