Commit f6e5cf10 authored by David Reid's avatar David Reid

Fix a crash when initializing a channel converter.

Public issue https://github.com/mackron/miniaudio/issues/482
parent 0788be81
v0.11.10 - TBD v0.11.10 - TBD
===================== =====================
* Add support for setting the device notification callback when initializing an engine object. * Add support for setting the device notification callback when initializing an engine object.
* Fix a crash when initializing a channel converter.
v0.11.9 - 2022-04-20 v0.11.9 - 2022-04-20
......
...@@ -51185,12 +51185,12 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert ...@@ -51185,12 +51185,12 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert
{ {
/* Unmapped input channels. */ /* Unmapped input channels. */
for (iChannelIn = 0; iChannelIn < pConverter->channelsIn; ++iChannelIn) { for (iChannelIn = 0; iChannelIn < pConverter->channelsIn; ++iChannelIn) {
ma_channel channelPosIn = pConverter->pChannelMapIn[iChannelIn]; ma_channel channelPosIn = ma_channel_map_get_channel(pConverter->pChannelMapIn, pConverter->channelsIn, iChannelIn);
if (ma_is_spatial_channel_position(channelPosIn)) { if (ma_is_spatial_channel_position(channelPosIn)) {
if (!ma_channel_map_contains_channel_position(pConverter->channelsOut, pConverter->pChannelMapOut, channelPosIn)) { if (!ma_channel_map_contains_channel_position(pConverter->channelsOut, pConverter->pChannelMapOut, channelPosIn)) {
for (iChannelOut = 0; iChannelOut < pConverter->channelsOut; ++iChannelOut) { for (iChannelOut = 0; iChannelOut < pConverter->channelsOut; ++iChannelOut) {
ma_channel channelPosOut = pConverter->pChannelMapOut[iChannelOut]; ma_channel channelPosOut = ma_channel_map_get_channel(pConverter->pChannelMapOut, pConverter->channelsOut, iChannelOut);
if (ma_is_spatial_channel_position(channelPosOut)) { if (ma_is_spatial_channel_position(channelPosOut)) {
float weight = 0; float weight = 0;
...@@ -51216,12 +51216,12 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert ...@@ -51216,12 +51216,12 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert
/* Unmapped output channels. */ /* Unmapped output channels. */
for (iChannelOut = 0; iChannelOut < pConverter->channelsOut; ++iChannelOut) { for (iChannelOut = 0; iChannelOut < pConverter->channelsOut; ++iChannelOut) {
ma_channel channelPosOut = pConverter->pChannelMapOut[iChannelOut]; ma_channel channelPosOut = ma_channel_map_get_channel(pConverter->pChannelMapOut, pConverter->channelsOut, iChannelOut);
if (ma_is_spatial_channel_position(channelPosOut)) { if (ma_is_spatial_channel_position(channelPosOut)) {
if (!ma_channel_map_contains_channel_position(pConverter->channelsIn, pConverter->pChannelMapIn, channelPosOut)) { if (!ma_channel_map_contains_channel_position(pConverter->channelsIn, pConverter->pChannelMapIn, channelPosOut)) {
for (iChannelIn = 0; iChannelIn < pConverter->channelsIn; ++iChannelIn) { for (iChannelIn = 0; iChannelIn < pConverter->channelsIn; ++iChannelIn) {
ma_channel channelPosIn = pConverter->pChannelMapIn[iChannelIn]; ma_channel channelPosIn = ma_channel_map_get_channel(pConverter->pChannelMapIn, pConverter->channelsIn, iChannelIn);
if (ma_is_spatial_channel_position(channelPosIn)) { if (ma_is_spatial_channel_position(channelPosIn)) {
float weight = 0; float weight = 0;
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