Use NSNumber Literals as much as possible

Replaced a bunch of [NSNumber numberWith...] with NSNumber Literals.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-17 06:39:02 -07:00
parent 67f6c931bb
commit 39f4d09c1a
46 changed files with 322 additions and 322 deletions

View File

@ -187,7 +187,7 @@ void *kAppControllerContext = &kAppControllerContext;
int lastIndex = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"lastTrackPlaying"];
if(lastStatus != CogStatusStopped && lastIndex >= 0) {
[playbackController playEntryAtIndex:lastIndex startPaused:(lastStatus == CogStatusPaused) andSeekTo:[NSNumber numberWithDouble:[[NSUserDefaults standardUserDefaults] floatForKey:@"lastTrackPosition"]]];
[playbackController playEntryAtIndex:lastIndex startPaused:(lastStatus == CogStatusPaused) andSeekTo:@([[NSUserDefaults standardUserDefaults] doubleForKey:@"lastTrackPosition"])];
}
}
@ -495,7 +495,7 @@ void *kAppControllerContext = &kAppControllerContext;
// Font defaults
float fFontSize = [NSFont systemFontSizeForControlSize:NSControlSizeSmall];
NSNumber *fontSize = [NSNumber numberWithFloat:fFontSize];
NSNumber *fontSize = @(fFontSize);
[userDefaultsValuesDict setObject:fontSize forKey:@"fontSize"];
NSString *feedURLdefault = @"https://cogcdn.cog.losno.co/mercury.xml";
@ -508,20 +508,20 @@ void *kAppControllerContext = &kAppControllerContext;
[userDefaultsValuesDict setObject:@"cubic" forKey:@"resampling"];
[userDefaultsValuesDict setObject:[NSNumber numberWithInteger:CogStatusStopped] forKey:@"lastPlaybackStatus"];
[userDefaultsValuesDict setObject:[NSNumber numberWithInteger:-1] forKey:@"lastTrackPlaying"];
[userDefaultsValuesDict setObject:[NSNumber numberWithDouble:0] forKey:@"lastTrackPosition"];
[userDefaultsValuesDict setObject:@(CogStatusStopped) forKey:@"lastPlaybackStatus"];
[userDefaultsValuesDict setObject:@(-1) forKey:@"lastTrackPlaying"];
[userDefaultsValuesDict setObject:@(0.0) forKey:@"lastTrackPosition"];
[userDefaultsValuesDict setObject:@"dls appl" forKey:@"midiPlugin"];
[userDefaultsValuesDict setObject:@"default" forKey:@"midi.flavor"];
[userDefaultsValuesDict setObject:[NSNumber numberWithBool:NO] forKey:@"resumePlaybackOnStartup"];
[userDefaultsValuesDict setObject:@(NO) forKey:@"resumePlaybackOnStartup"];
[userDefaultsValuesDict setObject:[NSNumber numberWithBool:NO] forKey:@"quitOnNaturalStop"];
[userDefaultsValuesDict setObject:@(NO) forKey:@"quitOnNaturalStop"];
[userDefaultsValuesDict setObject:[NSNumber numberWithBool:NO] forKey:@"spectrumFreqMode"];
[userDefaultsValuesDict setObject:[NSNumber numberWithBool:YES] forKey:@"spectrumProjectionMode"];
[userDefaultsValuesDict setObject:@(NO) forKey:@"spectrumFreqMode"];
[userDefaultsValuesDict setObject:@(YES) forKey:@"spectrumProjectionMode"];
NSValueTransformer *colorToValueTransformer = [NSValueTransformer valueTransformerForName:@"ColorToValueTransformer"];
@ -616,7 +616,7 @@ void *kAppControllerContext = &kAppControllerContext;
- (void)changeFontSize:(float)size {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
float fCurrentSize = [defaults floatForKey:@"fontSize"];
NSNumber *newSize = [NSNumber numberWithFloat:(fCurrentSize + size)];
NSNumber *newSize = @(fCurrentSize + size);
[defaults setObject:newSize forKey:@"fontSize"];
}

View File

@ -59,7 +59,7 @@ static NSString *getBadgeName(NSString *baseName, BOOL colorfulIcons) {
else {
if(progressStatus < 0 && [lastProgressStatus doubleValue] >= 0)
removeProgress = YES;
lastProgressStatus = [NSNumber numberWithDouble:progressStatus];
lastProgressStatus = @(progressStatus);
}
BOOL displayProgress = (progressStatus >= 0.0);
@ -197,7 +197,7 @@ static NSString *getBadgeName(NSString *baseName, BOOL colorfulIcons) {
- (void)awakeFromNib {
dockImage = [[NSImage imageNamed:@"Plaque"] copy];
lastColorfulStatus = -1;
lastProgressStatus = [NSNumber numberWithDouble:-1];
lastProgressStatus = @(-1.0);
imageView = nil;
progressIndicator = nil;
[self startObserving];

View File

@ -57,12 +57,12 @@ NSString *CogPlaybackDidStopNotficiation = @"CogPlaybackDidStopNotficiation";
}
- (void)initDefaults {
NSDictionary *defaultsDictionary = @{ @"volume": [NSNumber numberWithDouble:75.0],
@"GraphicEQenable": [NSNumber numberWithBool:NO],
@"GraphicEQpreset": [NSNumber numberWithInt:-1],
@"GraphicEQtrackgenre": [NSNumber numberWithBool:NO],
@"volumeLimit": [NSNumber numberWithBool:YES],
@"headphoneVirtualization": [NSNumber numberWithBool:NO] };
NSDictionary *defaultsDictionary = @{ @"volume": @(75.0),
@"GraphicEQenable": @(NO),
@"GraphicEQpreset": @(-1),
@"GraphicEQtrackgenre": @(NO),
@"volumeLimit": @(YES),
@"headphoneVirtualization": @(NO) };
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDictionary];
}
@ -125,13 +125,13 @@ NSString *CogPlaybackDidStopNotficiation = @"CogPlaybackDidStopNotficiation";
// called by double-clicking on table
- (void)playEntryAtIndex:(NSInteger)i {
[self playEntryAtIndex:i startPaused:NO andSeekTo:[NSNumber numberWithDouble:0.0]];
[self playEntryAtIndex:i startPaused:NO andSeekTo:@(0.0)];
}
- (void)playEntryAtIndex:(NSInteger)i startPaused:(BOOL)paused {
PlaylistEntry *pe = [playlistController entryAtIndex:i];
[self playEntry:pe startPaused:paused andSeekTo:[NSNumber numberWithDouble:0.0]];
[self playEntry:pe startPaused:paused andSeekTo:@(0.0)];
}
- (void)playEntryAtIndex:(NSInteger)i startPaused:(BOOL)paused andSeekTo:(id)offset {
@ -161,24 +161,24 @@ NSString *CogPlaybackDidStopNotficiation = @"CogPlaybackDidStopNotficiation";
NSDictionary *makeRGInfo(PlaylistEntry *pe) {
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
if(pe.replayGainAlbumGain != 0)
[dictionary setObject:[NSNumber numberWithFloat:pe.replayGainAlbumGain] forKey:@"replayGainAlbumGain"];
[dictionary setObject:@(pe.replayGainAlbumGain) forKey:@"replayGainAlbumGain"];
if(pe.replayGainAlbumPeak != 0)
[dictionary setObject:[NSNumber numberWithFloat:pe.replayGainAlbumPeak] forKey:@"replayGainAlbumPeak"];
[dictionary setObject:@(pe.replayGainAlbumPeak) forKey:@"replayGainAlbumPeak"];
if(pe.replayGainTrackGain != 0)
[dictionary setObject:[NSNumber numberWithFloat:pe.replayGainTrackGain] forKey:@"replayGainTrackGain"];
[dictionary setObject:@(pe.replayGainTrackGain) forKey:@"replayGainTrackGain"];
if(pe.replayGainTrackPeak != 0)
[dictionary setObject:[NSNumber numberWithFloat:pe.replayGainTrackPeak] forKey:@"replayGainTrackPeak"];
[dictionary setObject:@(pe.replayGainTrackPeak) forKey:@"replayGainTrackPeak"];
if(pe.volume != 1)
[dictionary setObject:[NSNumber numberWithFloat:pe.volume] forKey:@"volume"];
[dictionary setObject:@(pe.volume) forKey:@"volume"];
return dictionary;
}
- (void)playEntry:(PlaylistEntry *)pe {
[self playEntry:pe startPaused:NO andSeekTo:[NSNumber numberWithDouble:0.0]];
[self playEntry:pe startPaused:NO andSeekTo:@(0.0)];
}
- (void)playEntry:(PlaylistEntry *)pe startPaused:(BOOL)paused {
[self playEntry:pe startPaused:paused andSeekTo:[NSNumber numberWithDouble:0.0]];
[self playEntry:pe startPaused:paused andSeekTo:@(0.0)];
}
- (void)playEntry:(PlaylistEntry *)pe startPaused:(BOOL)paused andSeekTo:(id)offset {
@ -398,7 +398,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
return;
fading = YES;
NSNumber *originalVolume = [NSNumber numberWithDouble:[audioPlayer volume]];
NSNumber *originalVolume = @([audioPlayer volume]);
NSTimer *fadeTimer;
if(playbackStatus == CogStatusPlaying) {
@ -771,9 +771,9 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
NSDate *releaseYear = [calendar dateWithEra:1 year:entry.year month:0 day:0 hour:0 minute:0 second:0 nanosecond:0];
[songInfo setObject:releaseYear forKey:MPMediaItemPropertyReleaseDate];
}
[songInfo setObject:[NSNumber numberWithFloat:[entry currentPosition]] forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
[songInfo setObject:@([entry currentPosition]) forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
[songInfo setObject:[entry length] forKey:MPMediaItemPropertyPlaybackDuration];
[songInfo setObject:[NSNumber numberWithFloat:[entry index]] forKey:MPMediaItemPropertyPersistentID];
[songInfo setObject:@([entry index]) forKey:MPMediaItemPropertyPersistentID];
}
switch(playbackStatus) {

View File

@ -124,7 +124,7 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
if(pe.track)
[dict setObject:pe.trackText forKey:TrackNumber];
if(pe.length)
[dict setObject:[NSNumber numberWithInteger:(NSInteger)([pe.length doubleValue] * 1000.0)]
[dict setObject:@((NSInteger)([pe.length doubleValue] * 1000.0))
forKey:TrackLength];
NSString *state = nil;

View File

@ -12,22 +12,22 @@
@implementation NSApplication (APLApplicationExtensions)
- (id)playbackStart:(NSScriptCommand *)command {
[(AppController *)[NSApp delegate] clickPlay];
return [NSNumber numberWithBool:YES];
return @(YES);
}
- (id)playbackPause:(NSScriptCommand *)command {
[(AppController *)[NSApp delegate] clickPause];
return [NSNumber numberWithBool:YES];
return @(YES);
}
- (id)playbackStop:(NSScriptCommand *)command {
[(AppController *)[NSApp delegate] clickStop];
return [NSNumber numberWithBool:YES];
return @(YES);
}
- (id)playbackPrevious:(NSScriptCommand *)command {
[(AppController *)[NSApp delegate] clickPrev];
return [NSNumber numberWithBool:YES];
return @(YES);
}
- (id)playbackNext:(NSScriptCommand *)command {
[(AppController *)[NSApp delegate] clickNext];
return [NSNumber numberWithBool:YES];
return @(YES);
}
@end

View File

@ -486,7 +486,7 @@
- (void)setPlaybackStatus:(int)status waitUntilDone:(BOOL)wait {
currentPlaybackStatus = status;
[self sendDelegateMethod:@selector(audioPlayer:didChangeStatus:userInfo:) withObject:[NSNumber numberWithInt:status] withObject:[bufferChain userInfo] waitUntilDone:wait];
[self sendDelegateMethod:@selector(audioPlayer:didChangeStatus:userInfo:) withObject:@(status) withObject:[bufferChain userInfo] waitUntilDone:wait];
}
- (void)sustainHDCD {
@ -494,7 +494,7 @@
}
- (void)setError:(BOOL)status {
[self sendDelegateMethod:@selector(audioPlayer:setError:toTrack:) withObject:[NSNumber numberWithBool:status] withObject:[bufferChain userInfo] waitUntilDone:NO];
[self sendDelegateMethod:@selector(audioPlayer:setError:toTrack:) withObject:@(status) withObject:[bufferChain userInfo] waitUntilDone:NO];
}
- (void)setPlaybackStatus:(int)status {

View File

@ -344,7 +344,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
stopNext = YES;
break;
}
[delayedEvents addObject:[NSNumber numberWithDouble:secondsBuffered]];
[delayedEvents addObject:@(secondsBuffered)];
delayedEventsPopped = NO;
if(!started) {
started = YES;

View File

@ -183,7 +183,7 @@ static void loadPresets() {
} else if(object_entry[j].value->type == json_integer) {
int64_t value = object_entry[j].value->u.integer;
float floatValue = ((value <= 401 && value >= 1) ? ((float)(value - 201) / 10.0) : 0.0);
[equalizerItem setObject:[NSNumber numberWithFloat:floatValue] forKey:key];
[equalizerItem setObject:@(floatValue) forKey:key];
++requiredItemsPresent;
}
} else if([key isEqualToString:cog_equalizer_extra_genres]) {

View File

@ -83,7 +83,7 @@
}
if(result && NULL != object) {
*object = [NSNumber numberWithUnsignedInt:seconds];
*object = @(seconds);
} else if(NULL != error) {
*error = @"Couldn't convert value to seconds";
}

View File

@ -213,7 +213,7 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *__artworkDictionary;
SecondsFormatter *secondsFormatter = [[SecondsFormatter alloc] init];
[elements addObject:@" ("];
if(hasCurrentPosition) {
[elements addObject:[secondsFormatter stringForObjectValue:[NSNumber numberWithDouble:self.currentPosition]]];
[elements addObject:[secondsFormatter stringForObjectValue:@(self.currentPosition)]];
}
if(hasLength) {
if(hasCurrentPosition) {
@ -301,7 +301,7 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *__artworkDictionary;
@dynamic positionText;
- (NSString *)positionText {
SecondsFormatter *secondsFormatter = [[SecondsFormatter alloc] init];
NSString *time = [secondsFormatter stringForObjectValue:[NSNumber numberWithDouble:self.currentPosition]];
NSString *time = [secondsFormatter stringForObjectValue:@(self.currentPosition)];
return time;
}
@ -365,7 +365,7 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *__artworkDictionary;
@dynamic length;
- (NSNumber *)length {
return [NSNumber numberWithDouble:(self.metadataLoaded) ? ((double)self.totalFrames / self.sampleRate) : 0.0];
return (self.metadataLoaded) ? @(((double)self.totalFrames / self.sampleRate)) : @(0.0);
}
NSURL *_Nullable urlForPath(NSString *_Nullable path) {

View File

@ -56,7 +56,7 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *__artworkDictionary;
}
- (void)initDefaults {
NSDictionary *defaultsDictionary = @{@"readCueSheetsInFolders": [NSNumber numberWithBool:YES]};
NSDictionary *defaultsDictionary = @{ @"readCueSheetsInFolders": @(YES) };
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDictionary];
}
@ -217,7 +217,7 @@ NSMutableDictionary *dictionaryWithPropertiesOfObject(id obj, NSArray *filterLis
NSMutableArray *queueList = [[NSMutableArray alloc] init];
for(PlaylistEntry *pe in [playlistController queueList]) {
[queueList addObject:[NSNumber numberWithInteger:pe.index]];
[queueList addObject:@(pe.index)];
}
NSDictionary *dictionary = @{@"albumArt": albumArtSet, @"queue": queueList, @"items": topLevel};

View File

@ -27,7 +27,7 @@
NSMutableDictionary *properties = [[decoder properties] mutableCopy];
// Need to alter length
[properties setObject:[NSNumber numberWithLong:trackLength] forKey:@"totalFrames"];
[properties setObject:@(trackLength) forKey:@"totalFrames"];
return [NSDictionary dictionaryWithDictionary:properties];
}

View File

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

View File

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

View File

@ -43,7 +43,7 @@ static void *kCueSheetDecoderContext = &kCueSheetDecoderContext;
// Need to alter length
if(!noFragment)
[properties setObject:[NSNumber numberWithLong:(trackEnd - trackStart)] forKey:@"totalFrames"];
[properties setObject:@(trackEnd - trackStart) forKey:@"totalFrames"];
return [NSDictionary dictionaryWithDictionary:properties];
}

View File

@ -82,13 +82,13 @@
if([track artist]) [cuesheetMetadata setValue:[track artist] forKey:@"artist"];
if([track album]) [cuesheetMetadata setValue:[track album] forKey:@"album"];
if([track title]) [cuesheetMetadata setValue:[track title] forKey:@"title"];
if([[track track] intValue]) [cuesheetMetadata setValue:[NSNumber numberWithInt:[[track track] intValue]] forKey:@"track"];
if([[track track] intValue]) [cuesheetMetadata setValue:@([[track track] intValue]) forKey:@"track"];
if([track genre]) [cuesheetMetadata setValue:[track genre] forKey:@"genre"];
if([[track year] intValue]) [cuesheetMetadata setValue:[NSNumber numberWithInt:[[track year] intValue]] forKey:@"year"];
if([track albumGain]) [cuesheetMetadata setValue:[NSNumber numberWithFloat:[track albumGain]] forKey:@"replayGainAlbumGain"];
if([track albumPeak]) [cuesheetMetadata setValue:[NSNumber numberWithFloat:[track albumPeak]] forKey:@"replayGainAlbumPeak"];
if([track trackGain]) [cuesheetMetadata setValue:[NSNumber numberWithFloat:[track trackGain]] forKey:@"replayGainTrackGain"];
if([track trackPeak]) [cuesheetMetadata setValue:[NSNumber numberWithFloat:[track trackPeak]] forKey:@"replayGainTrackPeak"];
if([[track year] intValue]) [cuesheetMetadata setValue:@([[track year] intValue]) forKey:@"year"];
if([track albumGain]) [cuesheetMetadata setValue:@([track albumGain]) forKey:@"replayGainAlbumGain"];
if([track albumPeak]) [cuesheetMetadata setValue:@([track albumPeak]) forKey:@"replayGainAlbumPeak"];
if([track trackGain]) [cuesheetMetadata setValue:@([track trackGain]) forKey:@"replayGainTrackGain"];
if([track trackPeak]) [cuesheetMetadata setValue:@([track trackPeak]) forKey:@"replayGainTrackPeak"];
return [NSDictionary dictionaryWithDictionary:cuesheetMetadata];
}

View File

@ -922,15 +922,15 @@ static uint8_t reverse_bits[0x100];
}
- (NSDictionary *)properties {
return @{ @"channels": [NSNumber numberWithInt:channels],
@"channelConfig": [NSNumber numberWithUnsignedInt:channelConfig],
@"bitsPerSample": [NSNumber numberWithInt:bitsPerSample],
@"unSigned": [NSNumber numberWithBool:(bitsPerSample == 8)],
@"sampleRate": [NSNumber numberWithFloat:frequency],
@"floatingPoint": [NSNumber numberWithBool:floatingPoint],
@"totalFrames": [NSNumber numberWithDouble:totalFrames],
@"bitrate": [NSNumber numberWithInt:bitrate],
@"seekable": [NSNumber numberWithBool:seekable],
return @{ @"channels": @(channels),
@"channelConfig": @(channelConfig),
@"bitsPerSample": @(bitsPerSample),
@"unSigned": @(bitsPerSample == 8),
@"sampleRate": @(frequency),
@"floatingPoint": @(floatingPoint),
@"totalFrames": @(totalFrames),
@"bitrate": @(bitrate),
@"seekable": @(seekable),
@"codec": guess_encoding_of_string(avcodec_get_name(codecCtx->codec_id)),
@"endian": @"host",
@"encoding": lossy ? @"lossy" : @"lossless" };

View File

@ -261,15 +261,15 @@ void MetadataCallback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMeta
flacDecoder->cuesheetFound = YES;
} else if([name isEqualToString:@"date"] ||
[name isEqualToString:@"year"]) {
_year = [NSNumber numberWithInt:[value intValue]];
_year = @([value intValue]);
} else if([name isEqualToString:@"tracknumber"] ||
[name isEqualToString:@"tracknum"] ||
[name isEqualToString:@"track"]) {
_track = [NSNumber numberWithInt:[value intValue]];
_track = @([value intValue]);
} else if([name isEqualToString:@"discnumber"] ||
[name isEqualToString:@"discnum"] ||
[name isEqualToString:@"disc"]) {
_disc = [NSNumber numberWithInt:[value intValue]];
_disc = @([value intValue]);
} else if([name isEqualToString:@"replaygain_album_gain"]) {
_replayGainAlbumGain = [value floatValue];
} else if([name isEqualToString:@"replaygain_album_peak"]) {
@ -544,16 +544,16 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
}
- (NSDictionary *)properties {
return @{@"channels": [NSNumber numberWithInt:channels],
@"channelConfig": [NSNumber numberWithUnsignedInt:channelConfig],
@"bitsPerSample": [NSNumber numberWithInt:bitsPerSample],
@"sampleRate": [NSNumber numberWithFloat:frequency],
@"totalFrames": [NSNumber numberWithDouble:totalFrames],
@"seekable": [NSNumber numberWithBool:[source seekable]],
@"bitrate": [NSNumber numberWithInt:fileSize ? (fileSize * 8 / ((totalFrames + (frequency / 2)) / frequency)) / 1000 : 0],
@"codec": @"FLAC",
@"endian": @"big",
@"encoding": @"lossless"};
return @{ @"channels": @(channels),
@"channelConfig": @(channelConfig),
@"bitsPerSample": @(bitsPerSample),
@"sampleRate": @(frequency),
@"totalFrames": @(totalFrames),
@"seekable": @([source seekable]),
@"bitrate": @(fileSize ? (fileSize * 8 / ((totalFrames + (frequency / 2)) / frequency)) / 1000 : 0),
@"codec": @"FLAC",
@"endian": @"big",
@"encoding": @"lossless" };
}
- (NSDictionary *)metadata {

View File

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

View File

@ -106,7 +106,7 @@
@"album": guess_encoding_of_string(info->game),
@"title": title,
@"artist": guess_encoding_of_string(info->author),
@"track": [NSNumber numberWithInt:track_num + 1] };
@"track": @(track_num + 1) };
gme_free_info(info);

View File

@ -271,7 +271,7 @@ static int psf_info_meta(void *context, const char *name, const char *value) {
} else if([taglc isEqualToString:@"year"] ||
[taglc isEqualToString:@"track"] ||
[taglc isEqualToString:@"disc"]) {
[state->info setObject:[NSNumber numberWithInt:[svalue intValue]] forKey:taglc];
[state->info setObject:@([svalue intValue]) forKey:taglc];
}
return 0;
@ -1511,7 +1511,7 @@ static int usf_info(void *context, const char *name, const char *value) {
}
- (NSDictionary *)properties {
NSString *codec = nil;
NSString *codec = @"";
switch(type) {
case 1:
codec = @"PSF";
@ -1542,20 +1542,20 @@ static int usf_info(void *context, const char *name, const char *value) {
break;
}
return @{@"channels": [NSNumber numberWithInt:2],
@"bitsPerSample": [NSNumber numberWithInt:16],
@"sampleRate": [NSNumber numberWithFloat:sampleRate],
@"totalFrames": [NSNumber numberWithInteger:totalFrames],
@"bitrate": [NSNumber numberWithInt:0],
@"seekable": [NSNumber numberWithBool:YES],
@"replayGainAlbumGain": [NSNumber numberWithFloat:replayGainAlbumGain],
@"replayGainAlbumPeak": [NSNumber numberWithFloat:replayGainAlbumPeak],
@"replayGainTrackGain": [NSNumber numberWithFloat:replayGainTrackGain],
@"replayGainTrackPeak": [NSNumber numberWithFloat:replayGainTrackPeak],
@"volume": [NSNumber numberWithFloat:volume],
@"codec": codec,
@"endian": @"host",
@"encoding": @"synthesized"};
return @{ @"channels": @(2),
@"bitsPerSample": @(16),
@"sampleRate": @(sampleRate),
@"totalFrames": @(totalFrames),
@"bitrate": @(0),
@"seekable": @(YES),
@"replayGainAlbumGain": @(replayGainAlbumGain),
@"replayGainAlbumPeak": @(replayGainAlbumPeak),
@"replayGainTrackGain": @(replayGainTrackGain),
@"replayGainTrackPeak": @(replayGainTrackPeak),
@"volume": @(volume),
@"codec": codec,
@"endian": @"host",
@"encoding": @"synthesized" };
}
+ (NSDictionary *)metadataForURL:(NSURL *)url {

View File

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

View File

@ -763,13 +763,13 @@
- (NSDictionary *)properties {
if(layer < 1 || layer > 3) return nil;
const NSString *layers[3] = { @"MP1", @"MP2", @"MP3" };
return @{ @"channels": [NSNumber numberWithInt:channels],
@"bitsPerSample": [NSNumber numberWithInt:32],
@"sampleRate": [NSNumber numberWithFloat:sampleRate],
@"floatingPoint": [NSNumber numberWithBool:YES],
@"bitrate": [NSNumber numberWithInt:bitrate],
@"totalFrames": [NSNumber numberWithLong:totalFrames - (_startPadding + _endPadding)],
@"seekable": [NSNumber numberWithBool:[_source seekable]],
return @{ @"channels": @(channels),
@"bitsPerSample": @(32),
@"sampleRate": @(sampleRate),
@"floatingPoint": @(YES),
@"bitrate": @(bitrate),
@"totalFrames": @(totalFrames - (_startPadding + _endPadding)),
@"seekable": @([_source seekable]),
@"codec": layers[layer - 1],
@"endian": @"host",
@"encoding": @"lossy" };

View File

@ -97,16 +97,16 @@ static OSType getOSType(const char *in_) {
}
- (NSDictionary *)properties {
return @{@"bitrate": [NSNumber numberWithInt:0],
@"sampleRate": [NSNumber numberWithFloat:44100],
@"totalFrames": [NSNumber numberWithLong:totalFrames],
@"bitsPerSample": [NSNumber numberWithInt:32],
@"floatingPoint": [NSNumber numberWithBool:YES],
@"channels": [NSNumber numberWithInt:2],
@"seekable": [NSNumber numberWithBool:YES],
@"codec": @"MIDI",
@"endian": @"host",
@"encoding": @"synthesized"};
return @{ @"bitrate": @(0),
@"sampleRate": @(44100),
@"totalFrames": @(totalFrames),
@"bitsPerSample": @(32),
@"floatingPoint": @(YES),
@"channels": @(2),
@"seekable": @(YES),
@"codec": @"MIDI",
@"endian": @"host",
@"encoding": @"synthesized" };
}
- (NSDictionary *)metadata {

View File

@ -75,7 +75,7 @@
if([allowedKeys containsObject:name]) {
[dict setObject:guess_encoding_of_string(item.m_value.c_str()) forKey:name];
} else if([name isEqualToString:@"year"]) {
[dict setObject:[NSNumber numberWithInt:[guess_encoding_of_string(item.m_value.c_str()) intValue]] forKey:name];
[dict setObject:@([guess_encoding_of_string(item.m_value.c_str()) intValue]) forKey:name];
}
}
}

View File

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

View File

@ -93,15 +93,15 @@ static void g_push_archive_extensions(std::vector<std::string> &list) {
}
- (NSDictionary *)properties {
return @{@"bitrate": [NSNumber numberWithInt:0],
@"sampleRate": [NSNumber numberWithFloat:44100],
@"totalFrames": [NSNumber numberWithDouble:length],
@"bitsPerSample": [NSNumber numberWithInt:32],
@"floatingPoint": [NSNumber numberWithBool:YES],
@"channels": [NSNumber numberWithInt:2],
@"seekable": [NSNumber numberWithBool:YES],
@"endian": @"host",
@"encoding": @"synthesized"};
return @{ @"bitrate": @(0),
@"sampleRate": @(44100),
@"totalFrames": @(length),
@"bitsPerSample": @(32),
@"floatingPoint": @(YES),
@"channels": @(2),
@"seekable": @(YES),
@"endian": @"host",
@"encoding": @"synthesized" };
}
- (NSDictionary *)metadata {

View File

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

View File

@ -90,15 +90,15 @@ static void g_push_archive_extensions(std::vector<std::string> &list) {
}
- (NSDictionary *)properties {
return @{@"bitrate": [NSNumber numberWithInt:0],
@"sampleRate": [NSNumber numberWithFloat:44100],
@"totalFrames": [NSNumber numberWithDouble:length],
@"bitsPerSample": [NSNumber numberWithInt:32],
@"floatingPoint": [NSNumber numberWithBool:YES],
@"channels": [NSNumber numberWithInt:2],
@"seekable": [NSNumber numberWithBool:YES],
@"endian": @"host",
@"encoding": @"synthesized"};
return @{ @"bitrate": @(0),
@"sampleRate": @(44100),
@"totalFrames": @(length),
@"bitsPerSample": @(32),
@"floatingPoint": @(YES),
@"channels": @(2),
@"seekable": @(YES),
@"endian": @"host",
@"encoding": @"synthesized" };
}
- (NSDictionary *)metadata {

View File

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

View File

@ -325,13 +325,13 @@ opus_int64 sourceTell(void *_stream) {
}
- (NSDictionary *)properties {
return @{ @"channels": [NSNumber numberWithInt:channels],
@"bitsPerSample": [NSNumber numberWithInt:32],
@"floatingPoint": [NSNumber numberWithBool:YES],
@"sampleRate": [NSNumber numberWithFloat:48000],
@"totalFrames": [NSNumber numberWithDouble:totalFrames],
@"bitrate": [NSNumber numberWithInt:bitrate],
@"seekable": [NSNumber numberWithBool:([source seekable] && seekable)],
return @{ @"channels": @(channels),
@"bitsPerSample": @(32),
@"floatingPoint": @(YES),
@"sampleRate": @(48000),
@"totalFrames": @(totalFrames),
@"bitrate": @(bitrate),
@"seekable": @([source seekable] && seekable),
@"replayGainAlbumGain": @(replayGainAlbumGain),
@"replayGainTrackGain": @(replayGainTrackGain),
@"codec": @"Opus",

View File

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

View File

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

View File

@ -75,22 +75,22 @@
cuesheet = tag->cuesheet();
year = tag->year();
[dict setObject:[NSNumber numberWithInt:year] forKey:@"year"];
[dict setObject:@(year) forKey:@"year"];
track = tag->track();
[dict setObject:[NSNumber numberWithInt:track] forKey:@"track"];
[dict setObject:@(track) forKey:@"track"];
disc = tag->disc();
[dict setObject:[NSNumber numberWithInt:disc] forKey:@"disc"];
[dict setObject:@(disc) forKey:@"disc"];
rgAlbumGain = tag->rgAlbumGain();
rgAlbumPeak = tag->rgAlbumPeak();
rgTrackGain = tag->rgTrackGain();
rgTrackPeak = tag->rgTrackPeak();
[dict setObject:[NSNumber numberWithFloat:rgAlbumGain] forKey:@"replayGainAlbumGain"];
[dict setObject:[NSNumber numberWithFloat:rgAlbumPeak] forKey:@"replayGainAlbumPeak"];
[dict setObject:[NSNumber numberWithFloat:rgTrackGain] forKey:@"replayGainTrackGain"];
[dict setObject:[NSNumber numberWithFloat:rgTrackPeak] forKey:@"replayGainTrackPeak"];
[dict setObject:@(rgAlbumGain) forKey:@"replayGainAlbumGain"];
[dict setObject:@(rgAlbumPeak) forKey:@"replayGainAlbumPeak"];
[dict setObject:@(rgTrackGain) forKey:@"replayGainTrackGain"];
[dict setObject:@(rgTrackPeak) forKey:@"replayGainTrackPeak"];
soundcheck = tag->soundcheck();
if(!soundcheck.isEmpty()) {
@ -106,7 +106,7 @@
float volume2 = -log10((double)((uint32_t)wantedTag[1].toInt(16)) / 1000) * 10;
float volumeToUse = MIN(volume1, volume2);
float volumeScale = pow(10, volumeToUse / 20);
[dict setObject:[NSNumber numberWithFloat:volumeScale] forKey:@"volume"];
[dict setObject:@(volumeScale) forKey:@"volume"];
}
}

View File

@ -83,22 +83,22 @@
cuesheet = tag->cuesheet();
year = tag->year();
[dict setObject:[NSNumber numberWithInt:year] forKey:@"year"];
[dict setObject:@(year) forKey:@"year"];
track = tag->track();
[dict setObject:[NSNumber numberWithInt:track] forKey:@"track"];
[dict setObject:@(track) forKey:@"track"];
disc = tag->disc();
[dict setObject:[NSNumber numberWithInt:disc] forKey:@"disc"];
[dict setObject:@(disc) forKey:@"disc"];
rgAlbumGain = tag->rgAlbumGain();
rgAlbumPeak = tag->rgAlbumPeak();
rgTrackGain = tag->rgTrackGain();
rgTrackPeak = tag->rgTrackPeak();
[dict setObject:[NSNumber numberWithFloat:rgAlbumGain] forKey:@"replayGainAlbumGain"];
[dict setObject:[NSNumber numberWithFloat:rgAlbumPeak] forKey:@"replayGainAlbumPeak"];
[dict setObject:[NSNumber numberWithFloat:rgTrackGain] forKey:@"replayGainTrackGain"];
[dict setObject:[NSNumber numberWithFloat:rgTrackPeak] forKey:@"replayGainTrackPeak"];
[dict setObject:@(rgAlbumGain) forKey:@"replayGainAlbumGain"];
[dict setObject:@(rgAlbumPeak) forKey:@"replayGainAlbumPeak"];
[dict setObject:@(rgTrackGain) forKey:@"replayGainTrackGain"];
[dict setObject:@(rgTrackPeak) forKey:@"replayGainTrackPeak"];
soundcheck = tag->soundcheck();
if(!soundcheck.isEmpty()) {
@ -114,7 +114,7 @@
float volume2 = -log10((double)((uint32_t)wantedTag[1].toInt(16)) / 1000) * 10;
float volumeToUse = MIN(volume1, volume2);
float volumeScale = pow(10, volumeToUse / 20);
[dict setObject:[NSNumber numberWithFloat:volumeScale] forKey:@"volume"];
[dict setObject:@(volumeScale) forKey:@"volume"];
}
}

View File

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

View File

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

View File

@ -179,14 +179,14 @@ const int masterVol = 0x10000; // Fixed point 16.16
}
- (NSDictionary*)properties {
return @{@"bitrate": [NSNumber numberWithInt:0],
@"sampleRate": [NSNumber numberWithFloat:sampleRate],
@"totalFrames": [NSNumber numberWithLong:length],
@"bitsPerSample": [NSNumber numberWithInt:numBitsPerSample],
@"channels": [NSNumber numberWithInt:numChannels],
@"seekable": [NSNumber numberWithBool:YES],
@"endian": @"host",
@"encoding": @"synthesized"};
return @{ @"bitrate": @(0),
@"sampleRate": @(sampleRate),
@"totalFrames": @(length),
@"bitsPerSample": @(numBitsPerSample),
@"channels": @(numChannels),
@"seekable": @(YES),
@"endian": @"host",
@"encoding": @"synthesized" };
}
- (NSDictionary *)metadata {

View File

@ -132,7 +132,7 @@ static std::string FCC2Str(UINT32 fcc) {
NSString* title = @"";
NSString* artist = @"";
NSString* album = @"";
NSNumber* year = [NSNumber numberWithInt:0];
NSNumber* year = @(0);
PlayerBase* player = mainPlr.GetPlayer();
@ -147,7 +147,7 @@ static std::string FCC2Str(UINT32 fcc) {
else if(!strcmp(t[0], "DATE")) {
char* end;
unsigned long theYear = strtoul(t[1], &end, 10);
year = [NSNumber numberWithLong:theYear];
year = @(theYear);
}
}
@ -160,11 +160,11 @@ static std::string FCC2Str(UINT32 fcc) {
DataLoader_Deinit(dLoad);
free(fileData);
NSDictionary* dict = @{@"codec": system,
@"album": album,
@"title": title,
@"artist": artist,
@"year": [NSNumber numberWithInt:[year intValue]]};
NSDictionary* dict = @{ @"codec": system,
@"album": album,
@"title": title,
@"artist": artist,
@"year": year };
return dict;
}

View File

@ -246,15 +246,15 @@ static void sidTuneLoader(const char *fileName, std::vector<uint8_t> &bufferRef)
}
- (NSDictionary *)properties {
return @{@"bitrate": [NSNumber numberWithInt:0],
@"sampleRate": [NSNumber numberWithFloat:44100],
@"totalFrames": [NSNumber numberWithDouble:length],
@"bitsPerSample": [NSNumber numberWithInt:16],
@"floatingPoint": [NSNumber numberWithBool:NO],
@"channels": [NSNumber numberWithInt:n_channels],
@"seekable": [NSNumber numberWithBool:YES],
@"endian": @"host",
@"encoding": @"synthesized"};
return @{ @"bitrate": @(0),
@"sampleRate": @(44100),
@"totalFrames": @(length),
@"bitsPerSample": @(16),
@"floatingPoint": @(NO),
@"channels": @(n_channels),
@"seekable": @(YES),
@"endian": @"host",
@"encoding": @"synthesized" };
}
- (NSDictionary *)metadata {

View File

@ -93,17 +93,17 @@ static NSString *get_description_tag(const char *description, const char *tag, c
NSString *album = @"";
NSString *artist = @"";
NSNumber *year = [NSNumber numberWithInt:0];
NSNumber *track = [NSNumber numberWithInt:0];
NSNumber *disc = [NSNumber numberWithInt:0];
NSNumber *year = @(0);
NSNumber *track = @(0);
NSNumber *disc = @(0);
NSString *title = @"";
NSString *codec;
NSNumber *rgTrackGain = [NSNumber numberWithInt:0];
NSNumber *rgTrackPeak = [NSNumber numberWithInt:0];
NSNumber *rgAlbumGain = [NSNumber numberWithInt:0];
NSNumber *rgAlbumPeak = [NSNumber numberWithInt:0];
NSNumber *rgTrackGain = @(0);
NSNumber *rgTrackPeak = @(0);
NSNumber *rgAlbumGain = @(0);
NSNumber *rgAlbumPeak = @(0);
codec = get_description_tag(description, "encoding: ", 0);
@ -119,15 +119,15 @@ static NSString *get_description_tag(const char *description, const char *tag, c
if(!strncasecmp(tag_key, "REPLAYGAIN_", strlen("REPLAYGAIN_"))) {
if(!strncasecmp(tag_key + strlen("REPLAYGAIN_"), "TRACK_", strlen("TRACK_"))) {
if(!strcasecmp(tag_key + strlen("REPLAYGAIN_TRACK_"), "GAIN")) {
rgTrackGain = [NSNumber numberWithFloat:[value floatValue]];
rgTrackGain = @([value floatValue]);
} else if(!strcasecmp(tag_key + strlen("REPLAYGAIN_TRACK_"), "PEAK")) {
rgTrackPeak = [NSNumber numberWithFloat:[value floatValue]];
rgTrackPeak = @([value floatValue]);
}
} else if(!strncasecmp(tag_key + strlen("REPLAYGAIN_"), "ALBUM_", strlen("ALBUM_"))) {
if(!strcasecmp(tag_key + strlen("REPLAYGAIN_ALBUM_"), "GAIN")) {
rgAlbumGain = [NSNumber numberWithFloat:[value floatValue]];
rgAlbumGain = @([value floatValue]);
} else if(!strcasecmp(tag_key + strlen("REPLAYGAIN_ALBUM_"), "PEAK")) {
rgAlbumPeak = [NSNumber numberWithFloat:[value floatValue]];
rgAlbumPeak = @([value floatValue]);
}
}
} else if(!strcasecmp(tag_key, "ALBUM")) {
@ -135,13 +135,13 @@ static NSString *get_description_tag(const char *description, const char *tag, c
} else if(!strcasecmp(tag_key, "ARTIST")) {
artist = value;
} else if(!strcasecmp(tag_key, "DATE")) {
year = [NSNumber numberWithInt:[value intValue]];
year = @([value intValue]);
} else if(!strcasecmp(tag_key, "TRACK") ||
!strcasecmp(tag_key, "TRACKNUMBER")) {
track = [NSNumber numberWithInt:[value intValue]];
track = @([value intValue]);
} else if(!strcasecmp(tag_key, "DISC") ||
!strcasecmp(tag_key, "DISCNUMBER")) {
disc = [NSNumber numberWithInt:[value intValue]];
disc = @([value intValue]);
} else if(!strcasecmp(tag_key, "TITLE")) {
title = value;
}
@ -150,20 +150,20 @@ 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": @(bitrate / 1000),
@"sampleRate": @(sampleRate),
@"totalFrames": @(totalFrames),
@"bitsPerSample": @(16),
@"floatingPoint": @(NO),
@"channels": @(channels),
@"seekable": @(YES),
@"replayGainAlbumGain": rgAlbumGain,
@"replayGainAlbumPeak": rgAlbumPeak,
@"replayGainTrackGain": rgTrackGain,
@"replayGainTrackPeak": rgTrackPeak,
@"codec": codec,
@"endian": @"host",
@"encoding": @"lossy/lossless" };
if([title isEqualToString:@""]) {
if(stream->num_streams > 1) {
@ -173,8 +173,8 @@ static NSString *get_description_tag(const char *description, const char *tag, c
}
}
if([track isEqualToNumber:[NSNumber numberWithInt:0]])
track = [NSNumber numberWithInt:track_num];
if([track isEqualToNumber:@(0)])
track = @(track_num);
NSMutableDictionary *mutableMetadata = [@{ @"title": title,
@"track": track,
@ -184,7 +184,7 @@ static NSString *get_description_tag(const char *description, const char *tag, c
[mutableMetadata setValue:album forKey:@"album"];
if(![artist isEqualToString:@""])
[mutableMetadata setValue:artist forKey:@"artist"];
if(![year isEqualToNumber:[NSNumber numberWithInt:0]])
if(![year isEqualToNumber:@(0)])
[mutableMetadata setValue:year forKey:@"year"];
NSDictionary *metadata = [NSDictionary dictionaryWithDictionary:mutableMetadata];
@ -284,15 +284,15 @@ static NSString *get_description_tag(const char *description, const char *tag, c
}
- (NSDictionary *)properties {
return @{@"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],
@"endian": @"host",
@"encoding": @"lossy/lossless"};
return @{ @"bitrate": @(bitrate / 1000),
@"sampleRate": @(sampleRate),
@"totalFrames": @(totalFrames),
@"bitsPerSample": @(16),
@"floatingPoint": @(NO),
@"channels": @(channels),
@"seekable": @(YES),
@"endian": @"host",
@"encoding": @"lossy/lossless" };
}
- (NSDictionary *)metadata {

View File

@ -22,7 +22,7 @@
NSFont *font = [NSFont systemFontOfSize:[(NSNumber *)value floatValue]];
NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
float fRowSize = [layoutManager defaultLineHeightForFont:font];
return [NSNumber numberWithFloat:fRowSize];
return @(fRowSize);
}
@end

View File

@ -19,7 +19,7 @@
NSMutableArray* randomLongs = [NSMutableArray arrayWithCapacity:count];
NSUInteger i;
for(i = 0; i < count; ++i) {
[randomLongs addObject:[NSNumber numberWithLong:random()]];
[randomLongs addObject:@(random())];
}
return randomLongs;

View File

@ -813,7 +813,7 @@ static SQLiteStore *g_sharedStore = nil;
returnId = sqlite3_last_insert_rowid(g_database);
/*refcount = 1;*/
[stringTable setObject:string forKey:[[NSNumber numberWithInteger:returnId] stringValue]];
[stringTable setObject:string forKey:[@(returnId) stringValue]];
} else {
st = stmt[stmt_bump_string];
@ -824,7 +824,7 @@ static SQLiteStore *g_sharedStore = nil;
return string;
}
string = [stringTable objectForKey:[[NSNumber numberWithInteger:returnId] stringValue]];
string = [stringTable objectForKey:[@(returnId) stringValue]];
}
*stringId = returnId;
@ -835,7 +835,7 @@ static SQLiteStore *g_sharedStore = nil;
if(stringId < 0)
return @"";
NSString *ret = [stringTable objectForKey:[[NSNumber numberWithInteger:stringId] stringValue]];
NSString *ret = [stringTable objectForKey:[@(stringId) stringValue]];
if(ret) return ret;
sqlite3_stmt *st = stmt[stmt_select_string_value];
@ -864,7 +864,7 @@ static SQLiteStore *g_sharedStore = nil;
sqlite3_reset(st);
[stringTable setObject:ret forKey:[[NSNumber numberWithInteger:stringId] stringValue]];
[stringTable setObject:ret forKey:[@(stringId) stringValue]];
return ret;
}
@ -908,7 +908,7 @@ static SQLiteStore *g_sharedStore = nil;
return;
}
[stringTable removeObjectForKey:[[NSNumber numberWithInteger:stringId] stringValue]];
[stringTable removeObjectForKey:[@(stringId) stringValue]];
} else {
st = stmt[stmt_pop_string];
@ -976,7 +976,7 @@ static SQLiteStore *g_sharedStore = nil;
returnId = sqlite3_last_insert_rowid(g_database);
/*refcount = 1;*/
[artTable setObject:art forKey:[[NSNumber numberWithInteger:returnId] stringValue]];
[artTable setObject:art forKey:[@(returnId) stringValue]];
} else {
st = stmt[stmt_bump_art];
@ -987,7 +987,7 @@ static SQLiteStore *g_sharedStore = nil;
return art;
}
art = [artTable objectForKey:[[NSNumber numberWithInteger:returnId] stringValue]];
art = [artTable objectForKey:[@(returnId) stringValue]];
}
*artId = returnId;
@ -998,7 +998,7 @@ static SQLiteStore *g_sharedStore = nil;
if(artId < 0)
return [NSData data];
NSData *ret = [artTable valueForKey:[[NSNumber numberWithInteger:artId] stringValue]];
NSData *ret = [artTable valueForKey:[@(artId) stringValue]];
if(ret) return ret;
sqlite3_stmt *st = stmt[stmt_select_art_value];
@ -1027,7 +1027,7 @@ static SQLiteStore *g_sharedStore = nil;
sqlite3_reset(st);
[artTable setValue:ret forKey:[[NSNumber numberWithInteger:artId] stringValue]];
[artTable setValue:ret forKey:[@(artId) stringValue]];
return ret;
}
@ -1062,7 +1062,7 @@ static SQLiteStore *g_sharedStore = nil;
}
if(refcount <= 1) {
[artTable removeObjectForKey:[[NSNumber numberWithInteger:artId] stringValue]];
[artTable removeObjectForKey:[@(artId) stringValue]];
st = stmt[stmt_remove_art];
@ -1773,7 +1773,7 @@ static SQLiteStore *g_sharedStore = nil;
NSMutableArray *items = [[NSMutableArray alloc] init];
for(int64_t i = index, j = index + count; i < j; ++i) {
[items addObject:[NSNumber numberWithInteger:i]];
[items addObject:@(i)];
}
[self queueRemovePlaylistItems:items];

View File

@ -27,9 +27,9 @@
- (void)registerDefaults {
NSMutableDictionary *userDefaultsValuesDict = [NSMutableDictionary dictionary];
[userDefaultsValuesDict setObject:[NSNumber numberWithBool:YES] forKey:[self sideViewVerticalDefaultsKey]];
[userDefaultsValuesDict setObject:[NSNumber numberWithBool:NO] forKey:[self showSideViewDefaultsKey]];
[userDefaultsValuesDict setObject:[NSNumber numberWithFloat:100.0] forKey:[self sideViewDividerPositionDefaultsKey]];
[userDefaultsValuesDict setObject:@(YES) forKey:[self sideViewVerticalDefaultsKey]];
[userDefaultsValuesDict setObject:@(NO) forKey:[self showSideViewDefaultsKey]];
[userDefaultsValuesDict setObject:@(100.0) forKey:[self sideViewDividerPositionDefaultsKey]];
[[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict];
}

View File

@ -67,10 +67,10 @@
ShuffleMode mode = (ShuffleMode)[value integerValue];
if(shuffleMode == mode) {
return [NSNumber numberWithBool:YES];
return @(YES);
}
return [NSNumber numberWithBool:NO];
return @(NO);
}
- (id)reverseTransformedValue:(id)value {
@ -78,11 +78,11 @@
BOOL enabled = [value boolValue];
if(enabled) {
return [NSNumber numberWithInt:shuffleMode];
return @(shuffleMode);
} else if(shuffleMode == ShuffleOff) {
return [NSNumber numberWithInt:ShuffleAll];
return @(ShuffleAll);
} else {
return [NSNumber numberWithInt:ShuffleOff];
return @(ShuffleOff);
}
}