From e4312ed85745f9c20c8362c3b36111420a164144 Mon Sep 17 00:00:00 2001 From: Kent Sutherland Date: Thu, 13 Mar 2003 00:39:48 +0000 Subject: [PATCH] Changed the player state names to the new ones. Increased refresh rate fire. --- MenuTunes.m | 17 ++++++++--------- iTunesRemote.m | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/MenuTunes.m b/MenuTunes.m index 9115c10..77c59ba 100755 --- a/MenuTunes.m +++ b/MenuTunes.m @@ -44,7 +44,7 @@ menu = [[NSMenu alloc] initWithTitle:@""]; - if ( ( [currentRemote remotePlayerStatus] == ITMTRemotePlayerRunning ) ) { + if ( ( [currentRemote playerRunningStatus] == ITMTRemotePlayerRunning ) ) { [self remotePlayerLaunched:nil]; } else { [self remotePlayerTerminated:nil]; @@ -322,7 +322,7 @@ NSMenuItem *menuItem; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - if ( ( isAppRunning = ITMTRemotePlayerNotRunning ) ) { + if ( ( isAppRunning == ITMTRemotePlayerNotRunning ) ) { return; } @@ -337,7 +337,6 @@ if (eqItem) { [self rebuildEQPresetsMenu]; } - if (trackInfoIndex > -1) { NSString *curSongName, *curAlbumName = @"", *curArtistName = @""; curSongName = [currentRemote currentSongTitle]; @@ -593,7 +592,7 @@ int playlist = [currentRemote currentPlaylistIndex]; ITMTRemotePlayerState playerState = [currentRemote playerState]; - if ((playlist > 0) || playerState != stopped) { + if ((playlist > 0) || playerState != ITMTRemotePlayerStopped) { int trackPlayingIndex = [currentRemote currentSongIndex]; if (trackPlayingIndex != lastSongIndex) { @@ -652,7 +651,7 @@ } //Update Play/Pause menu item if (playPauseMenuItem){ - if (playerState == playing) { + if (playerState == ITMTRemotePlayerPlaying) { [playPauseMenuItem setTitle:@"Pause"]; } else { [playPauseMenuItem setTitle:@"Play"]; @@ -701,7 +700,7 @@ isAppRunning = ITMTRemotePlayerRunning; //Restart the timer - refreshTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(timerUpdate) userInfo:nil repeats:YES]; + refreshTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timerUpdate) userInfo:nil repeats:YES]; [self rebuildMenu]; //Rebuild the menu since no songs will be playing if (playlistItem) { @@ -772,10 +771,10 @@ { ITMTRemotePlayerState state = [currentRemote playerState]; - if (state == playing) { + if (state == ITMTRemotePlayerPlaying) { [currentRemote pause]; [playPauseMenuItem setTitle:@"Play"]; - } else if ((state == forwarding) || (state == rewinding)) { + } else if ((state == ITMTRemotePlayerForwarding) || (state == ITMTRemotePlayerRewinding)) { [currentRemote pause]; [currentRemote play]; } else { @@ -796,7 +795,7 @@ - (void)fastForward:(id)sender { - [currentRemote fastForward]; + [currentRemote forward]; [playPauseMenuItem setTitle:@"Play"]; } diff --git a/iTunesRemote.m b/iTunesRemote.m index bf2d9d3..0683fca 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -77,7 +77,7 @@ return ITMTRemotePlayerForwarding; } - return stopped; + return ITMTRemotePlayerStopped; } - (NSArray *)playlists @@ -91,7 +91,7 @@ const long j = i; NSString *sendStr = [NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pnam'), from:obj { form:'indx', want:type('cPly'), seld:long(%lu), from:'null'() } }",(unsigned long)j]; NSString *theObj = [[ITAppleEventCenter sharedCenter] sendAEWithSendString:sendStr eventClass:@"core" eventID:@"getd" appPSN:iTunesPSN]; - NSLog(@"sent event cur %d max %d",i,numPlaylists); + //NSLog(@"sent event cur %d max %d",i,numPlaylists); [playlists addObject:theObj]; } return [playlists autorelease]; -- 2.20.1