From 5594f5068eba3f8a5b2b1425ebc1a012fa138dd9 Mon Sep 17 00:00:00 2001 From: bnnm Date: Thu, 27 Sep 2018 23:40:42 +0200 Subject: [PATCH] Fix .wem Opus encoder delay/gapless [Mario Rabbids (Switch)] --- src/meta/wwise.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/meta/wwise.c b/src/meta/wwise.c index f78b1242..9f96f87b 100644 --- a/src/meta/wwise.c +++ b/src/meta/wwise.c @@ -502,7 +502,7 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE *streamFile) { } case OPUS: { /* Switch */ - size_t skip = 0; /* Wwise doesn't seem to use it? (0x138 /0x3E8 ~default) */ + size_t skip; /* values up to 0x14 seem fixed and similar to HEVAG's (block_align 0x02/04, bits_per_sample 0x10) */ if (ww.fmt_size == 0x28) { @@ -519,6 +519,8 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE *streamFile) { goto fail; } + skip = switch_opus_get_encoder_delay(start_offset, streamFile); /* should be 120 */ + vgmstream->codec_data = init_ffmpeg_switch_opus(streamFile, start_offset,ww.data_size, vgmstream->channels, skip, vgmstream->sample_rate); if (!vgmstream->codec_data) goto fail; vgmstream->coding_type = coding_FFmpeg;