mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
support opusww > 8 channels when mapping type is 255
This commit is contained in:
parent
49af2cea7d
commit
4ec2704496
@ -638,7 +638,7 @@ typedef struct {
|
||||
/* multichannel-only */
|
||||
int coupled_count;
|
||||
int stream_count;
|
||||
int channel_mapping[8];
|
||||
int channel_mapping[255];
|
||||
/* frame table */
|
||||
off_t table_offset;
|
||||
int table_count;
|
||||
|
@ -538,7 +538,7 @@ VGMSTREAM* init_vgmstream_wwise_bnk(STREAMFILE* sf, int* p_prefetch) {
|
||||
|
||||
if (ww.block_size != 0 || ww.bits_per_sample != 0) goto fail;
|
||||
if (!ww.seek_offset) goto fail;
|
||||
if (ww.channels > 8) goto fail; /* mapping not defined */
|
||||
if (ww.channels > 255) goto fail; /* opus limit */
|
||||
|
||||
cfg.channels = ww.channels;
|
||||
cfg.table_offset = ww.seek_offset;
|
||||
@ -550,6 +550,7 @@ VGMSTREAM* init_vgmstream_wwise_bnk(STREAMFILE* sf, int* p_prefetch) {
|
||||
cfg.skip = read_u16(ww.fmt_offset + 0x20, sf);
|
||||
/* 0x22: codec version */
|
||||
mapping = read_u8(ww.fmt_offset + 0x23, sf);
|
||||
if (mapping == 1 && ww.channels > 8) goto fail; /* mapping not defined */
|
||||
|
||||
if (read_u8(ww.fmt_offset + 0x22, sf) != 1)
|
||||
goto fail;
|
||||
@ -562,7 +563,7 @@ VGMSTREAM* init_vgmstream_wwise_bnk(STREAMFILE* sf, int* p_prefetch) {
|
||||
}
|
||||
|
||||
/* AK does some wonky implicit config for multichannel */
|
||||
if (mapping == 1 && ww.channel_type == 1) { /* only allowed values ATM, set when >2ch */
|
||||
if (mapping > 0 && ww.channel_type == 1) { /* only allowed values ATM, set when >2ch */
|
||||
static const int8_t mapping_matrix[8][8] = {
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||
{ 0, 1, 0, 0, 0, 0, 0, 0, },
|
||||
@ -589,9 +590,15 @@ VGMSTREAM* init_vgmstream_wwise_bnk(STREAMFILE* sf, int* p_prefetch) {
|
||||
/* total number internal OPUS streams (should be >0) */
|
||||
cfg.stream_count = ww.channels - cfg.coupled_count;
|
||||
|
||||
/* channel assignments */
|
||||
for (i = 0; i < ww.channels; i++) {
|
||||
cfg.channel_mapping[i] = mapping_matrix[ww.channels - 1][i];
|
||||
if (mapping == 1) { // ak remapping
|
||||
/* channel assignments */
|
||||
for (i = 0; i < ww.channels; i++) {
|
||||
cfg.channel_mapping[i] = mapping_matrix[ww.channels - 1][i];
|
||||
}
|
||||
} else { // linear
|
||||
for (i = 0; i < ww.channels; i++) {
|
||||
cfg.channel_mapping[i] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user