VGMStream Input: Remove downmixing, add layout

Downmixing should no longer be necessary, unless someone actually tries
to emit up to 64 channels, while we support only 32 channels, but really
only 18 channels. Also read the channel layout field from the decoder,
so that the speaker layout will propagate from the files to the player.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-02-15 22:55:34 -08:00
parent 8372ed4eea
commit 0d4ee4c901
2 changed files with 18 additions and 20 deletions

View File

@ -32,6 +32,7 @@
BOOL canPlayForever;
int sampleRate;
int channels;
uint32_t channelConfig;
int bitrate;
long totalFrames;
long framesRead;

View File

@ -63,9 +63,7 @@ static NSString *get_description_tag(const char *description, const char *tag, c
vgmstream_apply_config(stream, &vcfg);
int output_channels = stream->channels;
vgmstream_mixing_autodownmix(stream, 6);
vgmstream_mixing_enable(stream, MAX_BUFFER_SAMPLES, NULL, &output_channels);
uint32_t channelConfig = stream->channel_layout;
int track_num = [[url fragment] intValue];
@ -150,20 +148,21 @@ static NSString *get_description_tag(const char *description, const char *tag, c
close_streamfile(tagFile);
}
NSDictionary *properties = @{@"bitrate": [NSNumber numberWithInt:bitrate / 1000],
@"sampleRate": [NSNumber numberWithInt:sampleRate],
@"totalFrames": [NSNumber numberWithDouble:totalFrames],
@"bitsPerSample": [NSNumber numberWithInt:16],
@"floatingPoint": [NSNumber numberWithBool:NO],
@"channels": [NSNumber numberWithInt:channels],
@"seekable": [NSNumber numberWithBool:YES],
@"replayGainAlbumGain": rgAlbumGain,
@"replayGainAlbumPeak": rgAlbumPeak,
@"replayGainTrackGain": rgTrackGain,
@"replayGainTrackPeak": rgTrackPeak,
@"codec": codec,
@"endian": @"host",
@"encoding": @"lossy/lossless"};
NSDictionary *properties = @{ @"bitrate": [NSNumber numberWithInt:bitrate / 1000],
@"sampleRate": [NSNumber numberWithInt:sampleRate],
@"totalFrames": [NSNumber numberWithDouble:totalFrames],
@"bitsPerSample": [NSNumber numberWithInt:16],
@"floatingPoint": [NSNumber numberWithBool:NO],
@"channels": [NSNumber numberWithInt:channels],
@"channelConfig": [NSNumber numberWithUnsignedInt:channelConfig],
@"seekable": [NSNumber numberWithBool:YES],
@"replayGainAlbumGain": rgAlbumGain,
@"replayGainAlbumPeak": rgAlbumPeak,
@"replayGainTrackGain": rgTrackGain,
@"replayGainTrackPeak": rgTrackPeak,
@"codec": codec,
@"endian": @"host",
@"encoding": @"lossy/lossless" };
if([title isEqualToString:@""]) {
if(stream->num_streams > 1) {
@ -247,9 +246,7 @@ static NSString *get_description_tag(const char *description, const char *tag, c
return NO;
int output_channels = stream->channels;
vgmstream_mixing_autodownmix(stream, 6);
vgmstream_mixing_enable(stream, MAX_BUFFER_SAMPLES, NULL, &output_channels);
channelConfig = stream->channel_layout;
canPlayForever = stream->loop_flag;
if(canPlayForever) {