mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-11 16:43:11 +01:00
Fix layered layout with layers of varying channels
This commit is contained in:
parent
b438b5fa01
commit
36db25e876
@ -17,7 +17,7 @@ void render_vgmstream_layered(sample * buffer, int32_t sample_count, VGMSTREAM *
|
|||||||
|
|
||||||
while (samples_done < sample_count) {
|
while (samples_done < sample_count) {
|
||||||
int32_t samples_to_do = LAYER_BUF_SIZE;
|
int32_t samples_to_do = LAYER_BUF_SIZE;
|
||||||
int layer;
|
int layer, ch = 0;
|
||||||
|
|
||||||
if (samples_to_do > sample_count - samples_done)
|
if (samples_to_do > sample_count - samples_done)
|
||||||
samples_to_do = sample_count - samples_done;
|
samples_to_do = sample_count - samples_done;
|
||||||
@ -31,14 +31,15 @@ void render_vgmstream_layered(sample * buffer, int32_t sample_count, VGMSTREAM *
|
|||||||
for (l_ch = 0; l_ch < layer_channels; l_ch++) {
|
for (l_ch = 0; l_ch < layer_channels; l_ch++) {
|
||||||
for (s = 0; s < samples_to_do; s++) {
|
for (s = 0; s < samples_to_do; s++) {
|
||||||
size_t layer_sample = s*layer_channels + l_ch;
|
size_t layer_sample = s*layer_channels + l_ch;
|
||||||
size_t buffer_sample = (samples_done+s)*vgmstream->channels + (layer*layer_channels+l_ch);
|
size_t buffer_sample = (samples_done+s)*vgmstream->channels + ch;
|
||||||
|
|
||||||
buffer[buffer_sample] = interleave_buf[layer_sample];
|
buffer[buffer_sample] = interleave_buf[layer_sample];
|
||||||
}
|
}
|
||||||
|
ch++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
samples_done += samples_to_do;
|
samples_done += samples_to_do;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user