0

I am trying to use ScriptingBridge to write a small iTunes controller. The problem is to find an efficient way of getting notifyed whenever any changes occur. My first approch was to poll the input in a loop and just keep checking for differences. But I think there must be a more efficient way of getting notifyed about input!

Thanks in advance!

SIGKILL
  • 390
  • 1
  • 9

1 Answers1

1

iTunes sends out a notification when something changes so just register for it in your init method of AppDelegate. Here's an example...

[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(receivediTunesNotification:) name:@"com.apple.iTunes.playerInfo" object:nil];

The actual notifcation object in your method "receivediTunesNotification:" will contain information about the changes.

regulus6633
  • 18,848
  • 5
  • 41
  • 49
  • Thanks! This works well but it is only called when the song changes but not for iTunes internal volume changes. I am using the notification for song changes now and an scheduled NSTimer for the volume display which runs smooth enough. Thanks. – SIGKILL Dec 05 '12 at 01:55