if(pDevice==NULL)returnmal_post_error(pDevice,"mal_device_init() called with invalid arguments.",MAL_INVALID_ARGS);
if(pDevice==NULL)returnmal_post_error(pDevice,"mal_device_init() called with invalid arguments.",MAL_INVALID_ARGS);
mal_zero_object(pDevice);
mal_zero_object(pDevice);
pDevice->onLog=onLog;// <-- Set this ASAP to ensure as many log messages are captured as possible during initialization.
if(((mal_uint64)pDevice%sizeof(pDevice))!=0){
if(((mal_uint64)pDevice%sizeof(pDevice))!=0){
// TODO: Emit a warning that the device is not thread safe.
if(pDevice->onLog){
pDevice->onLog(pDevice,"WARNING: mal_device_init() called for a device that is not properly aligned. Thread safety is not supported.");
}
}
}
if(channels==0||sampleRate==0||fragmentSizeInFrames==0||fragmentCount==0)returnmal_post_error(pDevice,"mal_device_init() called with invalid arguments.",MAL_INVALID_ARGS);
if(channels==0||sampleRate==0||fragmentSizeInFrames==0||fragmentCount==0)returnmal_post_error(pDevice,"mal_device_init() called with invalid arguments.",MAL_INVALID_ARGS);