Airfoil And Sofa Control
Posted By Quentin Carnicelli on June 25th, 2006
We occasionally receive requests for our applications to work with the Apple Remote Control. Currently, there is no real public API from Apple for doing this. You can get access to raw IOKit Remote Control events with a fair amount of work, but it has never been something I looked forward to doing. So we’ve been holding off, hoping that perhaps 10.5 would introduce a real Remote Control API.
However, today I discovered Sofa Control (via Michael Tsai), which lets you control any application with the Apple Remote Control. For a given application, you can assign little AppleScripts to fire for each key on the remote. It also supports a “Big Menu” display system, so you can do Front Row-style menus for choosing items.
Because that Airfoil has a complete scripting dictionary, it wasn’t that hard for me to put together a complete Sofa Control script for it:

The script maps the remote control keys as follows:
Left/Right: Select a given Remote Speaker (if you have multiple Airport Expresses)
Minus/Plus: Adjusts the volume of the selected speaker
Play/Pause: Starts or Stops transmitting to the selected speaker
Menu: Presents a menu to select the current audio source
There are a couple changes left to be made to the script. There is a bug where if you have two identically named Sources, it will always pick the first one. As well, adding an “Other Application Source” menu item for picking un-listed applications would be nice. Implementing these, as well as the Sofa script for Audio Hijack Pro, are left as an exercise to the reader.