+- (BOOL)shuffle
+{
+ int result = [[ITAppleEventCenter sharedCenter]
+ sendTwoTierAEWithRequestedKeyForNumber:@"pShf" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
+ return result;
+}
+
+- (BOOL)supportsRepeatMode:(ITMTRemoteRepeatMode)repeatMode
+{
+ switch (repeatMode)
+ {
+ case ITMTRemoteRepeatNone:
+ case ITMTRemoteRepeatAll:
+ case ITMTRemoteRepeatOne:
+ return YES;
+ break;
+ default:
+ return NO;
+ break;
+ }
+}
+
+- (BOOL)setRepeatMode:(ITMTRemoteRepeatMode)repeatMode
+{
+ char *m00f = NULL;
+ switch (repeatMode)
+ {
+ case ITMTRemoteRepeatNone:
+ m00f = "kRp0";
+ break;
+ case ITMTRemoteRepeatOne:
+ m00f = "kRp1";
+ break;
+ case ITMTRemoteRepeatAll:
+ m00f = "kRpA";
+ break;
+ }
+ [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:type('%s') ----:obj { form:'prop', want:type('pRpt'), seld:type('pShf'), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } }",m00f] eventClass:@"core" eventID:@"setd" appPSN:savedPSN];
+ return YES;
+}
+
+- (BOOL)repeatMode
+{
+ FourCharCode m00f = 0;
+ int result = 0;
+ m00f = [[ITAppleEventCenter sharedCenter]
+ sendTwoTierAEWithRequestedKeyForNumber:@"pRpt" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
+
+ switch (m00f)
+ {
+ case 'kRp0':
+ result = ITMTRemoteRepeatNone;
+ break;
+ case 'kRp1':
+ result = ITMTRemoteRepeatOne;
+ break;
+ case 'kRpA':
+ result = ITMTRemoteRepeatAll;
+ break;
+ }
+ return result;
+}
+
+- (BOOL)supportsVolume
+{
+ return YES;
+}
+
+- (BOOL)setVolume:(float)volume
+{
+ [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"data:long(%lu), '----':obj { form:'prop', want:type('prop'), seld:type('pVol'), from:'null'() }",(long)(volume*100)] eventClass:@"core" eventID:@"setd" appPSN:savedPSN];
+ return NO;
+}
+
+- (float)volume
+{
+ return (float)[[ITAppleEventCenter sharedCenter] sendAEWithRequestedKeyForNumber:@"pVol" eventClass:@"core" eventID:@"getd" appPSN:savedPSN] / 100;
+}
+
+- (BOOL)supportsCustomEqualizer
+{
+ return YES;
+}
+
+- (BOOL)showEqualizerWindow
+{
+ //Do this Alex, please :D
+ return YES;
+}
+
+- (BOOL)supportsEqualizerPresets
+{
+ return YES;
+}
+
+- (NSArray *)equalizerPresetNames
+{
+ int i;
+ long numPresets = [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:@"kocl:type('cEQP'), '----':(), &subj:()" eventClass:@"core" eventID:@"cnte" appPSN:savedPSN];
+ NSMutableArray *presets = [[NSMutableArray alloc] initWithCapacity:numPresets];
+
+ for (i = 1; i <= numPresets; i++) {
+ NSString *theObj = [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pnam'), from:obj { form:'indx', want:type('cEQP'), seld:long(%lu), from:'null'() } }",i] eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
+ if (theObj) {
+ [presets addObject:theObj];
+ }
+ }
+ return [presets autorelease];
+}
+
+- (BOOL)switchToEqualizerPreset:(int)index
+{
+ [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pEQP'), from:'null'() }, data:obj { form:'indx', want:type('cEQP'), seld:long(%lu), from:'null'() }",(index+1)] eventClass:@"core" eventID:@"setd" appPSN:savedPSN];
+ return YES;
+}
+
+- (BOOL)supportsExternalWindow
+{
+ return YES;
+}
+
+- (NSString *)externalWindowName
+{
+ return @"iTunes";
+}
+
+- (BOOL)showExternalWindow
+{
+ //Do this Alex
+ return YES;
+}
+
+- (ProcessSerialNumber)iTunesPSN
+{
+ ProcessSerialNumber number;
+ number.highLongOfPSN = kNoProcess;
+ number.lowLongOfPSN = 0;
+
+ while ( (GetNextProcess(&number) == noErr) )
+ {
+ CFStringRef name;
+ if ( (CopyProcessName(&number, &name) == noErr) )
+ {
+ if ([(NSString *)name isEqualToString:@"iTunes"])
+ {
+ return number;
+ }
+ [(NSString *)name release];
+ }
+ }
+ return number;
+}
+
+//Below is old
+/*
++ (id)remote
+{
+ return [[[iTunesRemote alloc] init] autorelease];
+}
+
+- (NSString *)remoteTitle
+{
+ return @"iTunes Remote";
+}
+
+- (NSString *)remoteInformation
+{
+ return @"Default MenuTunes plugin to control iTunes, by iThink Software.";
+}
+
+- (NSImage *)remoteIcon