Commit b401f7d4 authored by David Reid's avatar David Reid

Return a valid channel map when channel count is 0 for device configs.

parent 40141191
...@@ -16547,15 +16547,19 @@ mal_device_config mal_device_config_init_ex(mal_format format, mal_uint32 channe ...@@ -16547,15 +16547,19 @@ mal_device_config mal_device_config_init_ex(mal_format format, mal_uint32 channe
config.onRecvCallback = onRecvCallback; config.onRecvCallback = onRecvCallback;
config.onSendCallback = onSendCallback; config.onSendCallback = onSendCallback;
if (channels > 0) {
if (channelMap == NULL) { if (channelMap == NULL) {
if (channels > 8) { if (channels > 8) {
mal_zero_memory(channelMap, sizeof(mal_channel)*MAL_MAX_CHANNELS); mal_zero_memory(config.channelMap, sizeof(mal_channel)*MAL_MAX_CHANNELS);
} else { } else {
mal_get_standard_channel_map(mal_standard_channel_map_default, channels, config.channelMap); mal_get_standard_channel_map(mal_standard_channel_map_default, channels, config.channelMap);
} }
} else { } else {
mal_copy_memory(config.channelMap, channelMap, sizeof(config.channelMap)); mal_copy_memory(config.channelMap, channelMap, sizeof(config.channelMap));
} }
} else {
mal_zero_memory(config.channelMap, sizeof(mal_channel)*MAL_MAX_CHANNELS);
}
return config; return config;
} }
......
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