Update VGMStream plugin with new API changes a bit, and now force auto downmixing to 6ch

CQTexperiment
Christopher Snowhill 2020-09-21 22:33:18 -07:00
parent bb38853ee9
commit 4eb7a3eebf
2 changed files with 21 additions and 0 deletions

View File

@ -28,6 +28,7 @@
@interface VGMDecoder : NSObject <CogDecoder> {
VGMSTREAM *stream;
BOOL playForever;
int sampleRate;
int channels;
int bitrate;

View File

@ -198,12 +198,27 @@
if ( !stream )
return NO;
vgmstream_mixing_autodownmix(stream, 6);
playForever = IsRepeatOneSet();
sampleRate = stream->sample_rate;
channels = stream->channels;
totalFrames = get_vgmstream_play_samples( 2.0, 10.0, 10.0, stream );
framesFade = stream->loop_flag ? sampleRate * 10 : 0;
framesLength = totalFrames - framesFade;
vgmstream_cfg_t vcfg = {0};
vcfg.allow_play_forever = 1;
vcfg.play_forever = playForever;
vcfg.loop_count = 2;
vcfg.fade_time = 10;
vcfg.fade_delay = 0;
vcfg.ignore_loop = 0;
vgmstream_apply_config(stream, &vcfg);
framesRead = 0;
bitrate = get_vgmstream_average_bitrate(stream);
@ -232,6 +247,11 @@
{
BOOL repeatone = IsRepeatOneSet();
if (repeatone != playForever) {
playForever = repeatone;
vgmstream_set_play_forever(stream, repeatone);
}
BOOL loopokay = repeatone && stream->loop_flag;
if (!loopokay) {