Replace more NSDictionary use with literals

Use literals to initialize fixed NSDictionary objects in various places.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-02-08 19:42:03 -08:00
parent 838b31a6e8
commit b927f4c02b
38 changed files with 283 additions and 423 deletions

View File

@ -57,14 +57,12 @@ NSString *CogPlaybackDidStopNotficiation = @"CogPlaybackDidStopNotficiation";
} }
- (void)initDefaults { - (void)initDefaults {
NSDictionary *defaultsDictionary = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *defaultsDictionary = @{@"volume": [NSNumber numberWithDouble:100.0],
[NSNumber numberWithDouble:100.0], @"volume", @"GraphicEQenable": [NSNumber numberWithBool:NO],
[NSNumber numberWithBool:NO], @"GraphicEQenable", @"GraphicEQpreset": [NSNumber numberWithInt:-1],
[NSNumber numberWithInt:-1], @"GraphicEQpreset", @"GraphicEQtrackgenre": [NSNumber numberWithBool:NO],
[NSNumber numberWithBool:NO], @"GraphicEQtrackgenre", @"volumeLimit": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"volumeLimit", @"headphoneVirtualization": [NSNumber numberWithBool:NO]};
[NSNumber numberWithBool:NO], @"headphoneVirtualization",
nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDictionary]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDictionary];
} }

View File

@ -47,9 +47,7 @@
} }
- (void)initDefaults { - (void)initDefaults {
NSDictionary *defaultsDictionary = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *defaultsDictionary = @{@"readCueSheetsInFolders": [NSNumber numberWithBool:YES]};
[NSNumber numberWithBool:YES], @"readCueSheetsInFolders",
nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDictionary]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDictionary];
} }
@ -213,7 +211,7 @@ NSMutableDictionary *dictionaryWithPropertiesOfObject(id obj, NSArray *filterLis
[queueList addObject:[NSNumber numberWithInteger:pe.index]]; [queueList addObject:[NSNumber numberWithInteger:pe.index]];
} }
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:albumArtSet, @"albumArt", queueList, @"queue", topLevel, @"items", nil]; NSDictionary *dictionary = @{@"albumArt": albumArtSet, @"queue": queueList, @"items": topLevel};
NSError *err; NSError *err;

View File

@ -80,18 +80,16 @@ static CAdPlugDatabase *g_database = NULL;
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:44100],
[NSNumber numberWithFloat:44100], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:length],
[NSNumber numberWithDouble:length], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:16], // Samples are short
[NSNumber numberWithInt:16], @"bitsPerSample", // Samples are short @"floatingPoint": [NSNumber numberWithBool:NO],
[NSNumber numberWithBool:NO], @"floatingPoint", @"channels": [NSNumber numberWithInt:2], // output from gme_play is in stereo
[NSNumber numberWithInt:2], @"channels", // output from gme_play is in stereo @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"seekable", @"codec": [NSString stringWithUTF8String:m_player->gettype().c_str()],
[NSString stringWithUTF8String:m_player->gettype().c_str()], @"codec", @"encoding": @"synthesized",
@"synthesized", @"encoding", @"endian": @"host"};
@"host", @"endian",
nil];
} }
- (int)readAudio:(void *)buf frames:(UInt32)frames { - (int)readAudio:(void *)buf frames:(UInt32)frames {

View File

@ -67,7 +67,7 @@
delete p_player; delete p_player;
delete p_emu; delete p_emu;
return [NSDictionary dictionaryWithObjectsAndKeys:title, @"title", artist, @"artist", nil]; return @{@"title": title, @"artist": artist};
} }
@end @end

View File

@ -389,19 +389,17 @@ static SInt64 getSizeProc(void *clientData) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithInt:channels], @"channels", @"channelConfig": [NSNumber numberWithUnsignedInt:channelConfig],
[NSNumber numberWithUnsignedInt:channelConfig], @"channelConfig", @"bitsPerSample": [NSNumber numberWithInt:bitsPerSample],
[NSNumber numberWithInt:bitsPerSample], @"bitsPerSample", @"floatingPoint": [NSNumber numberWithBool:floatingPoint],
[NSNumber numberWithBool:floatingPoint], @"floatingPoint", @"bitrate": [NSNumber numberWithInt:bitrate],
[NSNumber numberWithInt:bitrate], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:frequency],
[NSNumber numberWithFloat:frequency], @"sampleRate", @"totalFrames": [NSNumber numberWithLong:totalFrames],
[NSNumber numberWithLong:totalFrames], @"totalFrames", @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"seekable", @"codec": codec,
codec, @"codec", @"endian": floatingPoint ? @"host" : @"big",
floatingPoint ? @"host" : @"big", @"endian", @"encoding": _audioFile_is_lossy ? @"lossy" : @"lossless"};
_audioFile_is_lossy ? @"lossy" : @"lossless", @"encoding",
nil];
} }
@end @end

View File

@ -61,18 +61,16 @@
// Class supplied by CogAudio, which is guaranteed to be present // Class supplied by CogAudio, which is guaranteed to be present
if(!embedded) if(!embedded)
fileMetadata = [audioMetadataReader metadataForURL:[track url] skipCue:YES]; fileMetadata = [audioMetadataReader metadataForURL:[track url] skipCue:YES];
NSDictionary *cuesheetMetadata = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *cuesheetMetadata = @{@"artist": [track artist],
[track artist], @"artist", @"album": [track album],
[track album], @"album", @"title": [track title],
[track title], @"title", @"track": [NSNumber numberWithInt:[[track track] intValue]],
[NSNumber numberWithInt:[[track track] intValue]], @"track", @"genre": [track genre],
[track genre], @"genre", @"year": [NSNumber numberWithInt:[[track year] intValue]],
[NSNumber numberWithInt:[[track year] intValue]], @"year", @"replayGainAlbumGain": [NSNumber numberWithFloat:[track albumGain]],
[NSNumber numberWithFloat:[track albumGain]], @"replayGainAlbumGain", @"replayGainAlbumPeak": [NSNumber numberWithFloat:[track albumPeak]],
[NSNumber numberWithFloat:[track albumPeak]], @"replayGainAlbumPeak", @"replayGainTrackGain": [NSNumber numberWithFloat:[track trackGain]],
[NSNumber numberWithFloat:[track trackGain]], @"replayGainTrackGain", @"replayGainTrackPeak": [NSNumber numberWithFloat:[track trackPeak]]};
[NSNumber numberWithFloat:[track trackPeak]], @"replayGainTrackPeak",
nil];
return [fileMetadata dictionaryByMergingWith:cuesheetMetadata]; return [fileMetadata dictionaryByMergingWith:cuesheetMetadata];
} }

View File

@ -633,20 +633,18 @@ int64_t ffmpeg_seek(void *opaque, int64_t offset, int whence) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithInt:channels], @"channels", @"channelConfig": [NSNumber numberWithUnsignedInt:channelConfig],
[NSNumber numberWithUnsignedInt:channelConfig], @"channelConfig", @"bitsPerSample": [NSNumber numberWithInt:bitsPerSample],
[NSNumber numberWithInt:bitsPerSample], @"bitsPerSample", @"Unsigned": [NSNumber numberWithBool:(bitsPerSample == 8)],
[NSNumber numberWithBool:(bitsPerSample == 8)], @"Unsigned", @"sampleRate": [NSNumber numberWithFloat:frequency],
[NSNumber numberWithFloat:frequency], @"sampleRate", @"floatingPoint": [NSNumber numberWithBool:floatingPoint],
[NSNumber numberWithBool:floatingPoint], @"floatingPoint", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"bitrate": [NSNumber numberWithInt:bitrate],
[NSNumber numberWithInt:bitrate], @"bitrate", @"seekable": [NSNumber numberWithBool:seekable],
[NSNumber numberWithBool:seekable], @"seekable", @"codec": [NSString stringWithUTF8String:avcodec_get_name(codecCtx->codec_id)],
[NSString stringWithUTF8String:avcodec_get_name(codecCtx->codec_id)], @"codec", @"endian": @"host",
@"host", @"endian", @"encoding": lossy ? @"lossy" : @"lossless"};
lossy ? @"lossy" : @"lossless", @"encoding",
nil];
} }
+ (NSArray *)fileTypes { + (NSArray *)fileTypes {

View File

@ -354,18 +354,16 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithInt:channels], @"channels", @"channelConfig": [NSNumber numberWithUnsignedInt:channelConfig],
[NSNumber numberWithUnsignedInt:channelConfig], @"channelConfig", @"bitsPerSample": [NSNumber numberWithInt:bitsPerSample],
[NSNumber numberWithInt:bitsPerSample], @"bitsPerSample", @"sampleRate": [NSNumber numberWithFloat:frequency],
[NSNumber numberWithFloat:frequency], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"seekable": [NSNumber numberWithBool:[source seekable]],
[NSNumber numberWithBool:[source seekable]], @"seekable", @"bitrate": [NSNumber numberWithInt:fileSize ? (fileSize * 8 / ((totalFrames + (frequency / 2)) / frequency)) / 1000 : 0],
[NSNumber numberWithInt:fileSize ? (fileSize * 8 / ((totalFrames + (frequency / 2)) / frequency)) / 1000 : 0], @"bitrate", @"codec": @"FLAC",
@"FLAC", @"codec", @"endian": @"big",
@"big", @"endian", @"encoding": @"lossless"};
@"lossless", @"encoding",
nil];
} }
+ (NSArray *)fileTypes { + (NSArray *)fileTypes {

View File

@ -141,16 +141,14 @@ gme_err_t readCallback(void *data, void *out, int count) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:(float)sampleRate],
[NSNumber numberWithFloat:(float)sampleRate], @"sampleRate", @"totalFrames": [NSNumber numberWithLong:length * ((float)sampleRate * 0.001)],
[NSNumber numberWithLong:length * ((float)sampleRate * 0.001)], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:sizeof(short) * 8], // Samples are short
[NSNumber numberWithInt:sizeof(short) * 8], @"bitsPerSample", // Samples are short @"channels": [NSNumber numberWithInt:2], // output from gme_play is in stereo
[NSNumber numberWithInt:2], @"channels", // output from gme_play is in stereo @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:[source seekable]], @"seekable", @"endian": @"host",
@"host", @"endian", @"encoding": @"synthesized"};
@"synthesized", @"encoding",
nil];
} }
- (int)readAudio:(void *)buf frames:(UInt32)frames { - (int)readAudio:(void *)buf frames:(UInt32)frames {

View File

@ -102,13 +102,11 @@
title = [[url lastPathComponent] stringByAppendingFormat:@" [%d]", track_num]; title = [[url lastPathComponent] stringByAppendingFormat:@" [%d]", track_num];
} }
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *dict = @{@"genre": [NSString stringWithUTF8String:info->system],
[NSString stringWithUTF8String:info->system], @"genre", @"album": [NSString stringWithUTF8String:info->game],
[NSString stringWithUTF8String:info->game], @"album", @"title": title,
title, @"title", @"artist": [NSString stringWithUTF8String:info->author],
[NSString stringWithUTF8String:info->author], @"artist", @"track": [NSNumber numberWithInt:track_num + 1]};
[NSNumber numberWithInt:track_num + 1], @"track",
nil];
gme_free_info(info); gme_free_info(info);

View File

@ -1539,22 +1539,20 @@ static int usf_info(void *context, const char *name, const char *value) {
break; break;
} }
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"channels": [NSNumber numberWithInt:2],
[NSNumber numberWithInt:2], @"channels", @"bitsPerSample": [NSNumber numberWithInt:16],
[NSNumber numberWithInt:16], @"bitsPerSample", @"sampleRate": [NSNumber numberWithFloat:sampleRate],
[NSNumber numberWithFloat:sampleRate], @"sampleRate", @"totalFrames": [NSNumber numberWithInteger:totalFrames],
[NSNumber numberWithInteger:totalFrames], @"totalFrames", @"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"seekable", @"replayGainAlbumGain": [NSNumber numberWithFloat:replayGainAlbumGain],
[NSNumber numberWithFloat:replayGainAlbumGain], @"replayGainAlbumGain", @"replayGainAlbumPeak": [NSNumber numberWithFloat:replayGainAlbumPeak],
[NSNumber numberWithFloat:replayGainAlbumPeak], @"replayGainAlbumPeak", @"replayGainTrackGain": [NSNumber numberWithFloat:replayGainTrackGain],
[NSNumber numberWithFloat:replayGainTrackGain], @"replayGainTrackGain", @"replayGainTrackPeak": [NSNumber numberWithFloat:replayGainTrackPeak],
[NSNumber numberWithFloat:replayGainTrackPeak], @"replayGainTrackPeak", @"volume": [NSNumber numberWithFloat:volume],
[NSNumber numberWithFloat:volume], @"volume", @"codec": codec,
codec, @"codec", @"endian": @"host",
@"host", @"endian", @"encoding": @"synthesized"};
@"synthesized", @"encoding",
nil];
} }
+ (NSDictionary *)metadataForURL:(NSURL *)url { + (NSDictionary *)metadataForURL:(NSURL *)url {
@ -1569,7 +1567,7 @@ static int usf_info(void *context, const char *name, const char *value) {
psf_load([decodedUrl UTF8String], &source_callbacks, 0, 0, 0, psf_info_meta, &info, 0); psf_load([decodedUrl UTF8String], &source_callbacks, 0, 0, 0, psf_info_meta, &info, 0);
return info.info; return [NSDictionary dictionaryWithDictionary:info.info];
} }
+ (NSArray *)fileTypes { + (NSArray *)fileTypes {

View File

@ -80,17 +80,15 @@ static void oneTimeInit(void) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:44100],
[NSNumber numberWithFloat:44100], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:32],
[NSNumber numberWithInt:32], @"bitsPerSample", @"floatingPoint": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"floatingPoint", @"channels": [NSNumber numberWithInt:2],
[NSNumber numberWithInt:2], @"channels", @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"seekable", @"endian": @"host",
@"host", @"endian", @"encoding": @"synthesized"};
@"synthesized", @"encoding",
nil];
} }
- (int)readAudio:(void *)buf frames:(UInt32)frames { - (int)readAudio:(void *)buf frames:(UInt32)frames {

View File

@ -56,7 +56,7 @@
title = @""; title = @"";
} }
return [NSDictionary dictionaryWithObject:title forKey:@"title"]; return @{@"title": title};
} }
@end @end

View File

@ -97,18 +97,16 @@ static OSType getOSType(const char *in_) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:44100],
[NSNumber numberWithFloat:44100], @"sampleRate", @"totalFrames": [NSNumber numberWithLong:totalFrames],
[NSNumber numberWithLong:totalFrames], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:32],
[NSNumber numberWithInt:32], @"bitsPerSample", @"floatingPoint": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"floatingPoint", @"channels": [NSNumber numberWithInt:2],
[NSNumber numberWithInt:2], @"channels", // output from gme_play is in stereo @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"seekable", @"codec": @"MIDI",
@"MIDI", @"codec", @"endian": @"host",
@"host", @"endian", @"encoding": @"synthesized"};
@"synthesized", @"encoding",
nil];
} }
- (BOOL)initDecoder { - (BOOL)initDecoder {

View File

@ -179,18 +179,16 @@ mpc_bool_t CanSeekProc(mpc_reader *p_reader) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:bitrate],
[NSNumber numberWithInt:bitrate], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:frequency],
[NSNumber numberWithFloat:frequency], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:32],
[NSNumber numberWithInt:32], @"bitsPerSample", @"floatingPoint": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"floatingPoint", @"channels": [NSNumber numberWithInt:2],
[NSNumber numberWithInt:2], @"channels", @"seekable": [NSNumber numberWithBool:[source seekable]],
[NSNumber numberWithBool:[source seekable]], @"seekable", @"codec": @"Musepack",
@"Musepack", @"codec", @"endian": @"host",
@"host", @"endian", @"encoding": @"lossy"};
@"lossy", @"encoding",
nil];
} }
+ (NSArray *)fileTypes { + (NSArray *)fileTypes {

View File

@ -93,17 +93,15 @@ static void g_push_archive_extensions(std::vector<std::string> &list) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:44100],
[NSNumber numberWithFloat:44100], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:length],
[NSNumber numberWithDouble:length], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:32],
[NSNumber numberWithInt:32], @"bitsPerSample", // Samples are short @"floatingPoint": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"floatingPoint", @"channels": [NSNumber numberWithInt:2],
[NSNumber numberWithInt:2], @"channels", // output from gme_play is in stereo @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"seekable", @"endian": @"host",
@"host", @"endian", @"encoding": @"synthesized"};
@"synthesized", @"encoding",
nil];
} }
- (int)readAudio:(void *)buf frames:(UInt32)frames { - (int)readAudio:(void *)buf frames:(UInt32)frames {

View File

@ -89,7 +89,7 @@
if(type == nil) if(type == nil)
type = @""; type = @"";
return [NSDictionary dictionaryWithObjectsAndKeys:title, @"title", artist, @"artist", /*comment, @"comment",*/ date, @"year", type, @"codec", nil]; return @{@"title": title, @"artist": artist,/*@"comment": comment,*/ @"year": [NSNumber numberWithInt:[date intValue]], @"codec": type};
} catch(std::exception & /*e*/) { } catch(std::exception & /*e*/) {
return 0; return 0;
} }

View File

@ -90,17 +90,15 @@ static void g_push_archive_extensions(std::vector<std::string> &list) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:44100],
[NSNumber numberWithFloat:44100], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:length],
[NSNumber numberWithDouble:length], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:32],
[NSNumber numberWithInt:32], @"bitsPerSample", // Samples are short @"floatingPoint": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"floatingPoint", @"channels": [NSNumber numberWithInt:2],
[NSNumber numberWithInt:2], @"channels", // output from gme_play is in stereo @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"seekable", @"endian": @"host",
@"host", @"endian", @"encoding": @"synthesized"};
@"synthesized", @"encoding",
nil];
} }
- (int)readAudio:(void *)buf frames:(UInt32)frames { - (int)readAudio:(void *)buf frames:(UInt32)frames {

View File

@ -89,7 +89,7 @@
if(type == nil) if(type == nil)
type = @""; type = @"";
return [NSDictionary dictionaryWithObjectsAndKeys:title, @"title", artist, @"artist", /*comment, @"comment",*/ date, @"year", type, @"codec", nil]; return @{@"title": title, @"artist": artist, /*@"comment": comment,*/ @"year": [NSNumber numberWithInt:[date intValue]], @"codec": type};
} catch(std::exception & /*e*/) { } catch(std::exception & /*e*/) {
return 0; return 0;
} }

View File

@ -176,18 +176,16 @@ opus_int64 sourceTell(void *_stream) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithInt:channels], @"channels", @"bitsPerSample": [NSNumber numberWithInt:32],
[NSNumber numberWithInt:32], @"bitsPerSample", @"floatingPoint": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"floatingPoint", @"sampleRate": [NSNumber numberWithFloat:48000],
[NSNumber numberWithFloat:48000], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"bitrate": [NSNumber numberWithInt:bitrate],
[NSNumber numberWithInt:bitrate], @"bitrate", @"seekable": [NSNumber numberWithBool:([source seekable] && seekable)],
[NSNumber numberWithBool:([source seekable] && seekable)], @"seekable", @"codec": @"Opus",
@"Opus", @"codec", @"endian": @"host",
@"host", @"endian", @"encoding": @"lossy"};
@"lossy", @"encoding",
nil];
} }
+ (NSArray *)fileTypes { + (NSArray *)fileTypes {

View File

@ -77,16 +77,14 @@
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithInt:channels], @"channels", @"bitsPerSample": [NSNumber numberWithInt:bitsPerSample],
[NSNumber numberWithInt:bitsPerSample], @"bitsPerSample", @"sampleRate": [NSNumber numberWithFloat:frequency],
[NSNumber numberWithFloat:frequency], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"seekable": [NSNumber numberWithBool:seekable],
[NSNumber numberWithBool:seekable], @"seekable", @"codec": @"Shorten",
@"Shorten", @"codec", @"endian": @"little",
@"little", @"endian", @"encoding": @"lossless"};
@"lossless", @"encoding",
nil];
} }
+ (NSArray *)fileTypes { + (NSArray *)fileTypes {

View File

@ -35,17 +35,15 @@ enum { channels = 2 };
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:sample_rate],
[NSNumber numberWithFloat:sample_rate], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:length],
[NSNumber numberWithDouble:length], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:32],
[NSNumber numberWithInt:32], @"bitsPerSample", @"floatingPoint": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"floatingPoint", @"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithInt:channels], @"channels", @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"seekable", @"endian": @"host",
@"host", @"endian", @"encoding": @"synthesized"};
@"synthesized", @"encoding",
nil];
} }
- (int)readAudio:(void *)buf frames:(UInt32)frames { - (int)readAudio:(void *)buf frames:(UInt32)frames {

View File

@ -159,18 +159,16 @@ long sourceTell(void *datasource) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithInt:channels], @"channels", @"bitsPerSample": [NSNumber numberWithInt:32],
[NSNumber numberWithInt:32], @"bitsPerSample", @"floatingPoint": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"floatingPoint", @"sampleRate": [NSNumber numberWithFloat:frequency],
[NSNumber numberWithFloat:frequency], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"bitrate": [NSNumber numberWithInt:bitrate],
[NSNumber numberWithInt:bitrate], @"bitrate", @"seekable": [NSNumber numberWithBool:([source seekable] && seekable)],
[NSNumber numberWithBool:([source seekable] && seekable)], @"seekable", @"codec": @"Ogg Vorbis",
@"Vorbis", @"codec", @"endian": @"host",
@"host", @"endian", @"encoding": @"lossy"};
@"lossy", @"encoding",
nil];
} }
+ (NSArray *)fileTypes { + (NSArray *)fileTypes {

View File

@ -281,19 +281,17 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount) {
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithInt:channels], @"channels", @"channelConfig": [NSNumber numberWithUnsignedInt:channelConfig],
[NSNumber numberWithUnsignedInt:channelConfig], @"channelConfig", @"bitsPerSample": [NSNumber numberWithInt:bitsPerSample],
[NSNumber numberWithInt:bitsPerSample], @"bitsPerSample", @"bitrate": [NSNumber numberWithInt:bitrate],
[NSNumber numberWithInt:bitrate], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:frequency],
[NSNumber numberWithFloat:frequency], @"sampleRate", @"floatingPoint": [NSNumber numberWithBool:floatingPoint],
[NSNumber numberWithBool:floatingPoint], @"floatingPoint", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"seekable": [NSNumber numberWithBool:[[wv source] seekable]],
[NSNumber numberWithBool:[[wv source] seekable]], @"seekable", @"codec": @"Wavpack",
@"Wavpack", @"codec", @"endian": @"little",
@"little", @"endian", @"encoding": isLossy ? @"lossy" : @"lossless"};
isLossy ? @"lossy" : @"lossless", @"encoding",
nil];
} }
+ (NSArray *)fileTypes { + (NSArray *)fileTypes {

View File

@ -179,16 +179,14 @@ const int masterVol = 0x10000; // Fixed point 16.16
} }
- (NSDictionary*)properties { - (NSDictionary*)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:sampleRate],
[NSNumber numberWithFloat:sampleRate], @"sampleRate", @"totalFrames": [NSNumber numberWithLong:length],
[NSNumber numberWithLong:length], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:numBitsPerSample],
[NSNumber numberWithInt:numBitsPerSample], @"bitsPerSample", // Samples are short @"channels": [NSNumber numberWithInt:numChannels],
[NSNumber numberWithInt:numChannels], @"channels", // output from gme_play is in stereo @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:[source seekable]], @"seekable", @"endian": @"host",
@"host", @"endian", @"encoding": @"synthesized"};
@"synthesized", @"encoding",
nil];
} }
- (int)readAudio:(void*)buf frames:(UInt32)frames { - (int)readAudio:(void*)buf frames:(UInt32)frames {

View File

@ -160,13 +160,11 @@ static std::string FCC2Str(UINT32 fcc) {
DataLoader_Deinit(dLoad); DataLoader_Deinit(dLoad);
free(fileData); free(fileData);
NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary* dict = @{@"codec": system,
system, @"codec", @"album": album,
album, @"album", @"title": title,
title, @"title", @"artist": artist,
artist, @"artist", @"year": [NSNumber numberWithInt:[year intValue]]};
year, @"year",
nil];
return dict; return dict;
} }

View File

@ -188,17 +188,15 @@ static void sidTuneLoader(const char *fileName, std::vector<uint8_t> &bufferRef)
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:0],
[NSNumber numberWithInt:0], @"bitrate", @"sampleRate": [NSNumber numberWithFloat:44100],
[NSNumber numberWithFloat:44100], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:length],
[NSNumber numberWithDouble:length], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:16],
[NSNumber numberWithInt:16], @"bitsPerSample", // Samples are short @"floatingPoint": [NSNumber numberWithBool:NO],
[NSNumber numberWithBool:NO], @"floatingPoint", @"channels": [NSNumber numberWithInt:n_channels],
[NSNumber numberWithInt:n_channels], @"channels", // output from gme_play is in stereo @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:[source seekable]], @"seekable", @"endian": @"host",
@"host", @"endian", @"encoding": @"synthesized"};
@"synthesized", @"encoding",
nil];
} }
- (int)readAudio:(void *)buf frames:(UInt32)frames { - (int)readAudio:(void *)buf frames:(UInt32)frames {

View File

@ -54,7 +54,7 @@
NSString *titletag = info->songs() > 1 ? @"album" : @"title"; NSString *titletag = info->songs() > 1 ? @"album" : @"title";
NSString *artist = count >= 2 ? [[NSString stringWithUTF8String:info->infoString(1)] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] : @""; NSString *artist = count >= 2 ? [[NSString stringWithUTF8String:info->infoString(1)] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] : @"";
return [NSDictionary dictionaryWithObjectsAndKeys:title, titletag, artist, @"artist", nil]; return @{titletag: title, @"artist": artist};
} }
@end @end

View File

@ -150,23 +150,20 @@ static NSString *get_description_tag(const char *description, const char *tag, c
close_streamfile(tagFile); close_streamfile(tagFile);
} }
NSDictionary *properties = NSDictionary *properties = @{@"bitrate": [NSNumber numberWithInt:bitrate / 1000],
[NSDictionary dictionaryWithObjectsAndKeys: @"sampleRate": [NSNumber numberWithInt:sampleRate],
[NSNumber numberWithInt:bitrate / 1000], @"bitrate", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithInt:sampleRate], @"sampleRate", @"bitsPerSample": [NSNumber numberWithInt:16],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"floatingPoint": [NSNumber numberWithBool:NO],
[NSNumber numberWithInt:16], @"bitsPerSample", @"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithBool:NO], @"floatingPoint", @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithInt:channels], @"channels", @"replayGainAlbumGain": rgAlbumGain,
[NSNumber numberWithBool:YES], @"seekable", @"replayGainAlbumPeak": rgAlbumPeak,
rgAlbumGain, @"replayGainAlbumGain", @"replayGainTrackGain": rgTrackGain,
rgAlbumPeak, @"replayGainAlbumPeak", @"replayGainTrackPeak": rgTrackPeak,
rgTrackGain, @"replayGainTrackGain", @"codec": codec,
rgTrackPeak, @"replayGainTrackPeak", @"endian": @"host",
codec, @"codec", @"encoding": @"lossy/lossless"};
@"host", @"endian",
@"lossy/lossless", @"encoding",
nil];
if([title isEqualToString:@""]) { if([title isEqualToString:@""]) {
if(stream->num_streams > 1) { if(stream->num_streams > 1) {
@ -179,12 +176,9 @@ static NSString *get_description_tag(const char *description, const char *tag, c
if([track isEqualToNumber:[NSNumber numberWithInt:0]]) if([track isEqualToNumber:[NSNumber numberWithInt:0]])
track = [NSNumber numberWithInt:track_num]; track = [NSNumber numberWithInt:track_num];
NSMutableDictionary *mutableMetadata = NSMutableDictionary *mutableMetadata = @{@"title": title,
[NSMutableDictionary dictionaryWithObjectsAndKeys: @"track": track,
title, @"title", @"disc": disc};
track, @"track",
disc, @"disc",
nil];
if(![album isEqualToString:@""]) if(![album isEqualToString:@""])
[mutableMetadata setValue:album forKey:@"album"]; [mutableMetadata setValue:album forKey:@"album"];
@ -195,11 +189,8 @@ static NSString *get_description_tag(const char *description, const char *tag, c
NSDictionary *metadata = mutableMetadata; NSDictionary *metadata = mutableMetadata;
NSDictionary *package = NSDictionary *package = @{@"properties": properties,
[NSDictionary dictionaryWithObjectsAndKeys: @"metadata": metadata};
properties, @"properties",
metadata, @"metadata",
nil];
@synchronized(self) { @synchronized(self) {
[storage setValue:package forKey:[url absoluteString]]; [storage setValue:package forKey:[url absoluteString]];
@ -293,17 +284,15 @@ static NSString *get_description_tag(const char *description, const char *tag, c
} }
- (NSDictionary *)properties { - (NSDictionary *)properties {
return [NSDictionary dictionaryWithObjectsAndKeys: return @{@"bitrate": [NSNumber numberWithInt:bitrate / 1000],
[NSNumber numberWithInt:bitrate / 1000], @"bitrate", @"sampleRate": [NSNumber numberWithInt:sampleRate],
[NSNumber numberWithInt:sampleRate], @"sampleRate", @"totalFrames": [NSNumber numberWithDouble:totalFrames],
[NSNumber numberWithDouble:totalFrames], @"totalFrames", @"bitsPerSample": [NSNumber numberWithInt:16],
[NSNumber numberWithInt:16], @"bitsPerSample", @"floatingPoint": [NSNumber numberWithBool:NO],
[NSNumber numberWithBool:NO], @"floatingPoint", @"channels": [NSNumber numberWithInt:channels],
[NSNumber numberWithInt:channels], @"channels", @"seekable": [NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES], @"seekable", @"endian": @"host",
@"host", @"endian", @"encoding": @"lossy/lossless"};
@"lossy/lossless", @"encoding",
nil];
} }
- (int)readAudio:(void *)buf frames:(UInt32)frames { - (int)readAudio:(void *)buf frames:(UInt32)frames {

View File

@ -26,8 +26,7 @@
// NSLocalizedStringFromTableInBundle(@"Nightly", nil, [NSBundle bundleForClass:[self class]], @"") , @"name", @"http://mamburu.net/cog/nightly.xml", @"url",nil]]; // NSLocalizedStringFromTableInBundle(@"Nightly", nil, [NSBundle bundleForClass:[self class]], @"") , @"name", @"http://mamburu.net/cog/nightly.xml", @"url",nil]];
[self addObject: [self addObject:
[NSDictionary dictionaryWithObjectsAndKeys: @{@"name": NSLocalizedStringFromTableInBundle(@"cog.losno.co wheneverly", nil, [NSBundle bundleForClass:[self class]], @""), @"url": @"https://cogcdn.cog.losno.co/mercury.xml"}];
NSLocalizedStringFromTableInBundle(@"cog.losno.co wheneverly", nil, [NSBundle bundleForClass:[self class]], @""), @"name", @"https://cogcdn.cog.losno.co/mercury.xml", @"url", nil]];
} }
@end @end

View File

@ -12,37 +12,21 @@
- (void)awakeFromNib { - (void)awakeFromNib {
[self removeObjects:[self arrangedObjects]]; [self removeObjects:[self arrangedObjects]];
[self addObject: [self addObject:@{@"name": @"Default (auto)", @"preference": @"default"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"Default (auto)", @"name", @"default", @"preference", nil]];
[self addObject: [self addObject:@{@"name": @"General MIDI", @"preference": @"gm"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"General MIDI", @"name", @"gm", @"preference", nil]];
[self addObject: [self addObject:@{@"name": @"General MIDI 2", @"preference": @"gm2"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"General MIDI 2", @"name", @"gm2", @"preference", nil]];
[self addObject: [self addObject:@{@"name": @"Roland SC-55", @"preference": @"sc55"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"Roland SC-55", @"name", @"sc55", @"preference", nil]];
[self addObject: [self addObject:@{@"name": @"Roland SC-88", @"preference": @"sc88"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"Roland SC-88", @"name", @"sc88", @"preference", nil]];
[self addObject: [self addObject:@{@"name": @"Roland SC-88 Pro", @"preference": @"sc88pro"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"Roland SC-88 Pro", @"name", @"sc88pro", @"preference", nil]];
[self addObject: [self addObject:@{@"name": @"Roland SC-8850", @"preference": @"sc8850"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"Roland SC-8850", @"name", @"sc8850", @"preference", nil]];
[self addObject: [self addObject:@{@"name": @"Yamaha XG", @"preference": @"xg"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"Yamaha XG", @"name", @"xg", @"preference", nil]];
} }
@end @end

View File

@ -66,32 +66,16 @@ static void enumCallback(void *context, OSType uSubType, OSType uManufacturer, c
- (void)awakeFromNib { - (void)awakeFromNib {
[self removeObjects:[self arrangedObjects]]; [self removeObjects:[self arrangedObjects]];
[self addObject: [self addObject:@{@"name": @"BASSMIDI", @"preference": @"BASSMIDI"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"BASSMIDI", @"name", @"BASSMIDI", @"preference", nil]];
[self addObject: [self addObject:@{@"name": @"DMX Generic", @"preference": @"DOOM0000"}];
[NSDictionary dictionaryWithObjectsAndKeys: [self addObject:@{@"name": @"DMX Doom 1", @"preference": @"DOOM0001"}];
@"DMX Generic", @"name", @"DOOM0000", @"preference", nil]]; [self addObject:@{@"name": @"DMX Doom 2", @"preference": @"DOOM0002"}];
[self addObject: [self addObject:@{@"name": @"DMX Raptor", @"preference": @"DOOM0003"}];
[NSDictionary dictionaryWithObjectsAndKeys: [self addObject:@{@"name": @"DMX Strife", @"preference": @"DOOM0004"}];
@"DMX Doom 1", @"name", @"DOOM0001", @"preference", nil]]; [self addObject:@{@"name": @"DMXOPL", @"preference": @"DOOM0005"}];
[self addObject:
[NSDictionary dictionaryWithObjectsAndKeys:
@"DMX Doom 2", @"name", @"DOOM0002", @"preference", nil]];
[self addObject:
[NSDictionary dictionaryWithObjectsAndKeys:
@"DMX Raptor", @"name", @"DOOM0003", @"preference", nil]];
[self addObject:
[NSDictionary dictionaryWithObjectsAndKeys:
@"DMX Strife", @"name", @"DOOM0004", @"preference", nil]];
[self addObject:
[NSDictionary dictionaryWithObjectsAndKeys:
@"DMXOPL", @"name", @"DOOM0005", @"preference", nil]];
[self addObject: [self addObject:@{@"name": @"OPL3Windows", @"preference": @"OPL3W000"}];
[NSDictionary dictionaryWithObjectsAndKeys:
@"OPL3Windows", @"name", @"OPL3W000", @"preference", nil]];
enumComponents(enumCallback, (__bridge void *)(self)); enumComponents(enumCallback, (__bridge void *)(self));
} }

View File

@ -12,18 +12,9 @@
- (void)awakeFromNib { - (void)awakeFromNib {
[self removeObjects:[self arrangedObjects]]; [self removeObjects:[self arrangedObjects]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Clear playlist and play", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"clearAndPlay"}];
[NSDictionary dictionaryWithObjectsAndKeys: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Enqueue", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"enqueue"}];
NSLocalizedStringFromTableInBundle(@"Clear playlist and play", nil, [NSBundle bundleForClass:[self class]], @""), @"name", [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Enqueue and play", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"enqueueAndPlay"}];
@"clearAndPlay", @"preference", nil]];
[self addObject:
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"Enqueue", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"enqueue", @"preference", nil]];
[self addObject:
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"Enqueue and play", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"enqueueAndPlay", @"preference", nil]];
} }
@end @end

View File

@ -12,35 +12,17 @@
- (void)awakeFromNib { - (void)awakeFromNib {
[self removeObjects:[self arrangedObjects]]; [self removeObjects:[self arrangedObjects]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Zero Order Hold", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"zoh"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"Zero Order Hold", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"zoh", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Blep Synthesis", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"blep"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"Blep Synthesis", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"blep", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Linear Interpolation", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"linear"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"Linear Interpolation", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"linear", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Blam Synthesis", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"blam"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"Blam Synthesis", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"blam", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Cubic Interpolation", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"cubic"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"Cubic Interpolation", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"cubic", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Sinc Interpolation", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"sinc"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"Sinc Interpolation", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"sinc", @"preference", nil]];
} }
@end @end

View File

@ -12,35 +12,17 @@
- (void)awakeFromNib { - (void)awakeFromNib {
[self removeObjects:[self arrangedObjects]]; [self removeObjects:[self arrangedObjects]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"ReplayGain Album Gain with peak", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"albumGainWithPeak"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"ReplayGain Album Gain with peak", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"albumGainWithPeak", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"ReplayGain Album Gain", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"albumGain"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"ReplayGain Album Gain", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"albumGain", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"ReplayGain Track Gain with peak", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"trackGainWithPeak"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"ReplayGain Track Gain with peak", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"trackGainWithPeak", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"ReplayGain Track Gain", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"trackGain"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"ReplayGain Track Gain", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"trackGain", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"Volume scale tag only", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"volumeScale"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"Volume scale tag only", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"volumeScale", @"preference", nil]];
[self addObject: [self addObject:@{@"name": NSLocalizedStringFromTableInBundle(@"No volume scaling", nil, [NSBundle bundleForClass:[self class]], @""), @"preference": @"none"}];
[NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedStringFromTableInBundle(@"No volume scaling", nil, [NSBundle bundleForClass:[self class]], @""), @"name",
@"none", @"preference", nil]];
} }
@end @end

View File

@ -28,16 +28,14 @@ static NSDictionary *importKeys;
NSArray *trackTransform = NSArray *trackTransform =
@[@"spotlightTrack", @"NumberToStringTransformer"]; @[@"spotlightTrack", @"NumberToStringTransformer"];
importKeys = [NSDictionary dictionaryWithObjectsAndKeys: importKeys = @{@"kMDItemTitle": @"title",
@"title", @"kMDItemTitle", @"kMDItemAlbum": @"album",
@"album", @"kMDItemAlbum", @"kMDItemAudioTrackNumber": trackTransform,
trackTransform, @"kMDItemAudioTrackNumber", @"kMDItemRecordingYear": @"year",
@"year", @"kMDItemRecordingYear", @"kMDItemMusicalGenre": @"genre",
@"genre", @"kMDItemMusicalGenre", @"kMDItemDurationSeconds": @"length",
@"length", @"kMDItemDurationSeconds", @"kMDItemPath": URLTransform,
URLTransform, @"kMDItemPath", @"kMDItemAuthors": artistTransform};
artistTransform, @"kMDItemAuthors",
nil];
} }
+ (SpotlightPlaylistEntry *)playlistEntryWithMetadataItem:(NSMetadataItem *)metadataItem { + (SpotlightPlaylistEntry *)playlistEntryWithMetadataItem:(NSMetadataItem *)metadataItem {

View File

@ -49,9 +49,7 @@ static NSPredicate *musicOnlyPredicate = nil;
NSString *homeDir = @"~"; NSString *homeDir = @"~";
homeDir = [homeDir stringByExpandingTildeInPath]; homeDir = [homeDir stringByExpandingTildeInPath];
homeDir = [[NSURL fileURLWithPath:homeDir isDirectory:YES] absoluteString]; homeDir = [[NSURL fileURLWithPath:homeDir isDirectory:YES] absoluteString];
NSDictionary *searchDefault = NSDictionary *searchDefault = @{@"spotlightSearchPath": homeDir};
[NSDictionary dictionaryWithObject:homeDir
forKey:@"spotlightSearchPath"];
[defaults registerDefaults:searchDefault]; [defaults registerDefaults:searchDefault];
} }

View File

@ -38,10 +38,9 @@ static NSString *TrackingSliderValueObservationContext = @"TrackingSliderValueOb
if([binding isEqualToString:@"value"]) { if([binding isEqualToString:@"value"]) {
[observableController addObserver:self forKeyPath:keyPath options:(NSKeyValueObservingOptionNew)context:(__bridge void *_Nullable)(TrackingSliderValueObservationContext)]; [observableController addObserver:self forKeyPath:keyPath options:(NSKeyValueObservingOptionNew)context:(__bridge void *_Nullable)(TrackingSliderValueObservationContext)];
NSDictionary *bindingsData = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *bindingsData = @{NSObservedObjectKey: observableController,
observableController, NSObservedObjectKey, NSObservedKeyPathKey: [keyPath copy],
[keyPath copy], NSObservedKeyPathKey, NSOptionsKey: options ? [options copy] : @{}};
[options copy], NSOptionsKey, nil];
[bindingInfo setObject:bindingsData forKey:binding]; [bindingInfo setObject:bindingsData forKey:binding];
} else { } else {