mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-12-01 01:27:20 +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 */
|
/* multichannel-only */
|
||||||
int coupled_count;
|
int coupled_count;
|
||||||
int stream_count;
|
int stream_count;
|
||||||
int channel_mapping[8];
|
int channel_mapping[255];
|
||||||
/* frame table */
|
/* frame table */
|
||||||
off_t table_offset;
|
off_t table_offset;
|
||||||
int table_count;
|
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.block_size != 0 || ww.bits_per_sample != 0) goto fail;
|
||||||
if (!ww.seek_offset) 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.channels = ww.channels;
|
||||||
cfg.table_offset = ww.seek_offset;
|
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);
|
cfg.skip = read_u16(ww.fmt_offset + 0x20, sf);
|
||||||
/* 0x22: codec version */
|
/* 0x22: codec version */
|
||||||
mapping = read_u8(ww.fmt_offset + 0x23, sf);
|
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)
|
if (read_u8(ww.fmt_offset + 0x22, sf) != 1)
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -562,7 +563,7 @@ VGMSTREAM* init_vgmstream_wwise_bnk(STREAMFILE* sf, int* p_prefetch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* AK does some wonky implicit config for multichannel */
|
/* 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] = {
|
static const int8_t mapping_matrix[8][8] = {
|
||||||
{ 0, 0, 0, 0, 0, 0, 0, 0, },
|
{ 0, 0, 0, 0, 0, 0, 0, 0, },
|
||||||
{ 0, 1, 0, 0, 0, 0, 0, 0, },
|
{ 0, 1, 0, 0, 0, 0, 0, 0, },
|
||||||
@ -589,10 +590,16 @@ VGMSTREAM* init_vgmstream_wwise_bnk(STREAMFILE* sf, int* p_prefetch) {
|
|||||||
/* total number internal OPUS streams (should be >0) */
|
/* total number internal OPUS streams (should be >0) */
|
||||||
cfg.stream_count = ww.channels - cfg.coupled_count;
|
cfg.stream_count = ww.channels - cfg.coupled_count;
|
||||||
|
|
||||||
|
if (mapping == 1) { // ak remapping
|
||||||
/* channel assignments */
|
/* channel assignments */
|
||||||
for (i = 0; i < ww.channels; i++) {
|
for (i = 0; i < ww.channels; i++) {
|
||||||
cfg.channel_mapping[i] = mapping_matrix[ww.channels - 1][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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wwise Opus saves all frame sizes in the seek table */
|
/* Wwise Opus saves all frame sizes in the seek table */
|
||||||
|
Loading…
Reference in New Issue
Block a user