Commit c9d7b4a3 authored by David Reid's avatar David Reid

Fix a bug in the channel converter.

parent 297061d3
...@@ -48750,12 +48750,12 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert ...@@ -48750,12 +48750,12 @@ MA_API ma_result ma_channel_converter_init_preallocated(const ma_channel_convert
if (pConverter->format == ma_format_f32) { if (pConverter->format == ma_format_f32) {
pConverter->weights.f32 = (float** )ma_offset_ptr(pHeap, heapLayout.weightsOffset); pConverter->weights.f32 = (float** )ma_offset_ptr(pHeap, heapLayout.weightsOffset);
for (iChannelIn = 0; iChannelIn < pConverter->channelsIn; iChannelIn += 1) { for (iChannelIn = 0; iChannelIn < pConverter->channelsIn; iChannelIn += 1) {
pConverter->weights.f32[iChannelIn] = (float*)ma_offset_ptr(pHeap, heapLayout.weightsOffset + ((sizeof(float*) * pConverter->channelsIn) + (sizeof(float) * pConverter->channelsIn * iChannelIn))); pConverter->weights.f32[iChannelIn] = (float*)ma_offset_ptr(pHeap, heapLayout.weightsOffset + ((sizeof(float*) * pConverter->channelsIn) + (sizeof(float) * pConverter->channelsOut * iChannelIn)));
} }
} else { } else {
pConverter->weights.s16 = (ma_int32**)ma_offset_ptr(pHeap, heapLayout.weightsOffset); pConverter->weights.s16 = (ma_int32**)ma_offset_ptr(pHeap, heapLayout.weightsOffset);
for (iChannelIn = 0; iChannelIn < pConverter->channelsIn; iChannelIn += 1) { for (iChannelIn = 0; iChannelIn < pConverter->channelsIn; iChannelIn += 1) {
pConverter->weights.s16[iChannelIn] = (ma_int32*)ma_offset_ptr(pHeap, heapLayout.weightsOffset + ((sizeof(ma_int32*) * pConverter->channelsIn) + (sizeof(ma_int32) * pConverter->channelsIn * iChannelIn))); pConverter->weights.s16[iChannelIn] = (ma_int32*)ma_offset_ptr(pHeap, heapLayout.weightsOffset + ((sizeof(ma_int32*) * pConverter->channelsIn) + (sizeof(ma_int32) * pConverter->channelsOut * iChannelIn)));
} }
} }
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