Added title reading for multi-song VGMStream files.

CQTexperiment
Christopher Snowhill 2017-09-17 18:41:04 -07:00
parent 1ef9455f9d
commit 29e548d583
2 changed files with 10 additions and 1 deletions

View File

@ -17,6 +17,8 @@
@interface VGMDecoder : NSObject <CogDecoder> { @interface VGMDecoder : NSObject <CogDecoder> {
VGMSTREAM *stream; VGMSTREAM *stream;
NSString *title;
int sampleRate; int sampleRate;
int channels; int channels;
int bitrate; int bitrate;

View File

@ -30,9 +30,15 @@
framesRead = 0; framesRead = 0;
bitrate = get_vgmstream_average_bitrate(stream); bitrate = get_vgmstream_average_bitrate(stream);
if (stream->num_streams > 1) {
title = [NSString stringWithFormat:@"%@ - %@", [[[s url] URLByDeletingPathExtension] lastPathComponent], stream->stream_name];
} else {
title = [[[s url] URLByDeletingPathExtension] lastPathComponent];
}
[self willChangeValueForKey:@"properties"]; [self willChangeValueForKey:@"properties"];
[self didChangeValueForKey:@"properties"]; [self didChangeValueForKey:@"properties"];
return YES; return YES;
} }
@ -47,6 +53,7 @@
[NSNumber numberWithBool:NO], @"floatingPoint", [NSNumber numberWithBool:NO], @"floatingPoint",
[NSNumber numberWithInt:channels], @"channels", [NSNumber numberWithInt:channels], @"channels",
[NSNumber numberWithBool:YES], @"seekable", [NSNumber numberWithBool:YES], @"seekable",
title, @"title",
@"host", @"endian", @"host", @"endian",
nil]; nil];
} }