Fix a crash when initializing a channel converter.

Public issue https://github.com/mackron/miniaudio/issues/482
This commit is contained in:
David Reid
2022-06-25 18:11:17 +10:00
parent 0788be818b
commit f6e5cf10ae
2 changed files with 5 additions and 4 deletions
+1
View File
@@ -1,6 +1,7 @@
v0.11.10 - TBD
=====================
* 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
+4 -4
View File
@@ -51185,12 +51185,12 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert
{
/* Unmapped input channels. */
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_channel_map_contains_channel_position(pConverter->channelsOut, pConverter->pChannelMapOut, channelPosIn)) {
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)) {
float weight = 0;
@@ -51216,12 +51216,12 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert
/* Unmapped output channels. */
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_channel_map_contains_channel_position(pConverter->channelsIn, pConverter->pChannelMapIn, channelPosOut)) {
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)) {
float weight = 0;