Version: 1.0

Posted: 2003-01-14

Build Requirements: Project Builder 2.0 or higher

Runtime Requirements: Mac OS X, mpg123 for playing mp3 files

View Source Code:

Download Sample (“MP3_Player.zip”, 40.9K)
Download Sample (“MP3_Player.dmg”, 93.3K)



Description

This sample shows how to wrap a command-line UNIX/Linux application in a Cocoa GUI, calling out to the command-line app through NSTask. MP3 Player is just what its name suggests - an MP3 player, and it calls through to the open-source mpg123 command-line mp3 player to do the real work of playing music. What the Cocoa code provides is a nice window with a tableview for holding MP3s which you can drag-and-drop onto the table from the Finder. The tableview handles double-clicking a song to play it, or you can press the play or stop buttons in the window to play the currently selected song. The custom tableview provided also now shows how to highlight every other row in blue, a la iTunes. See the ReadMe file for information on downloading and building mpg123.

Document Revision History

Date Notes
2003-01-14How to wrap a command-line UNIX/Linux application in a Cocoa GUI, calling a the command-line app through NSTask.

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.