Playing a sound file in Quartz composer.

I recently created a quartz composer patch which will play a sound file in a Quartz Composer composition. It is very useful for playing a short sound file for a sound cue to an event or a basically any sound you want to include in a composition.

I created this patch for a toddler’s game in which the screen contains a bunch of objects which the toddler removes by moving the mouse over the objects.  As each object is removed a very short sound file is played to give a audio cue that the object has been saved. It is also used in another animation to play a bubbles sound when fish are swimming by. I do offer it for sale along with support for a very reasonable $2.99.  I made a short YouTube video to give some idea of what is does.  It can be found here available here. It can be purchased here


Adding Controls to HUD Windows


Although not intended by apple to have controls, HUD windows can have controls added to them. This is accomplished by any one of the 3 frameworks listed below

  • BWToolkit – http://www.brandonwalkin.com/bwtoolkit/
  • BGHUDAppKit – http://www.binarymethod.com/bghudappkit/
  • HMBlkAppKit – http://shiira.jp/hmblkappkit/en.html
  • Objective-C Proper Class init

    Proper Objective-C init for classes.

    - (id)init;
    {
    if ((self = [super init]) == nil)
    return nil;

    [***initialize any necessary code];
    return self;
    }

    Cocoa Recipes updated


    Recently I noticed that one of my favorite books for learning cocoa was updated to it’s second version.  Cocoa Recipes for Mac OS X (2nd Edition) is a hands on approach to teaching cocoa. The orginal Cocoa Receipes was conceived from a web site  from the same author called Vermont Recipes.  This book is one of the best books for driving home some real world learning after finishing Aaron Hillegass book Cocoa(R) Programming for Mac(R) OS X (3rd Edition).  There is nothing better to learning cocoa concepts than actually writing code especially as part of an actual application.

    The entire book takes the reader through development of one complete project. The reader follows along as the author adds new features to the application one chapter at a time.  The author takes the time in each chapter to explain what is happening.   I referenced the Vermont Recipes extensively (before the book came out) when I first picked up cocoa and still find it useful today. The new version is updated to reflect the changes in the recent Snow Leopard OS X release.
    As a side note I should mention that I do not know the author personally or compensated in anyway for writing this post.  Bill Cheeseman is a very active member of the Cocoa community and can be seen on the Apple mailing list.  Also, as of this writing, Amazon’s look inside the index is from the old version.




    SerialChannel channel changing software updated

    Recently I updated my SerialChannel and SerialChannelIR applications for EyeTV and Directv.  These new versions provide several new features as well as bug fixes and performance improvements.  SerialChannel now supports cable boxes in addition to Directv.  It also overs a new ethernet connection options which allows a user to change the channel through an ethernet connection.  The latter option allows the Mac to be located in another room away from the directv box without running wires. To get more info go to www.cooldvr.com

    Learning C programming with Cocoa

    After almost 12 years of C  programming under my belt I often find myself answering questions from people asking me how to get started.  Most will ask what I think is the one single book to read when learning how to program in C or do I need to know C before I learn other C languages such as Objective C and C++.  There are many avenues to learning how to write in C which can often leave a new comer feeling overwhelmed. However, I think there is one approach that works well and provides a step wise approach to learning C.  Oddly enough, it does not envolve learning traditional C directly.  Learn to program in Apple’s Cocoa language and ease into traditional C.

    For the most part, there is not one book.  Usually it takes 3 or 4 really good books to get a handle on C programming. Each book provides its own unique aspects to teaching, skipping some topics while covering other in depth.  One of the things that I like about using Cocoa as a starting point is instant gradification.  Using Cocoa(R) Programming for Mac(R) OS X (3rd Edition) as a learning tool can provide the new comer with a good sense of how programming works.

    Cocoa is apple’s native way to program for the Mac.  Cocoa utilizes Objective-C as its underlying language.  Objective C is a Object oriented sub set of C much like C++.

    While Cocoa is a great language it is almost impossible to be really good at it or any C dialect without knowing C.  So Why learn Cocoa First?  In short Arron Hillagas’s Cocoa Programming on Mac OS X

    One of the things you will notice is that there are not a lot of books on Cocoa. However, the completeness of Cocoa(R) Programming for Mac(R) OS X (3rd Edition) and the style of Cocoa makes it easy to learn and deduce.  The Cocoa language is so well done syntactically it is very conducive to teaching and Aaron’s book is it’s perfect complement. In my opinion there is not one single book on any language that is as complete from beginner to intermediate as this book.  When you read the text and follow the examples to the end it will leave you comfortable with the language and wanting to learn more into the intermediate level.  With all that said, there are a few must have books that build on the knowledge learned from Aaron’s book.

    If you are interested in learning C through Cocoa here is a list of books I would recommend (In order of learning level). Go here for an easy link to each.

  • Cocoa(R) Programming for Mac(R) OS X (3rd Edition)
  • Learn Cocoa on the Mac (Learn Series)
  • Programming in Objective-C 2.0 (2nd Edition) (Developer’s Library)
  • Learn C on the Mac (Learn Series)
  • Cocoa Programming
  • Connecting EyeTV to DirectTV, Dish Network, Sky and Other Set Top Boxes

    If you are looking to connect your Mac’s EyeTV application to a set top box such as Directv, Dish Network, Sky Boxes or virtually any other box there are several low cost options that make it easy.

    If you have Directv you have two options

    1.  SerialChannel.  SerialChannel provides a reliable and clean installation. It works through a serial or ethernet connection that connects to the usb or data port of your Directv box.

    2.  SerialChannelIR. SerialChannelIR is an Universal IR blaster solution for the mac.  It uses USB-UIRT and an IR blaster cable connected to the front of your box to mimic your box’s remote to change channels.

    Which ever one you choose will provide a seamless channel change from EyeTV to your box.

    If you have Dish Network or virtually any other box use SerialChannelIR.

    If you have a standard Sky digibox, Sky+, Sky HD, Foxtel iQ (but not Foxtel iQ2) or Foxtel Pace 420 you also have two options.

    1.  SerialChannelSky.  SerialChannelSky provides a reliable and clean installation.  It works with Dusky-control hardware to change the channels on your box.

    2.  SerialChannelIR.

    See www.coolDVR.com to get more info.

    Mythv and Pretty File Names For Recordings

    When you record something on mythtv it creates a entry in the database and names the resulting recorded file.  However, if you were to look in the recordings directory you would see that the given name is a bit hard to figure out.  In this post I will show you how to create a directory that holds links to these files with user friendly names.  In Mythbuntu there is a script which does most of the work for us. We’ll then share that directory on a network via SAMBA and NFS

    1.  On your myth box open a terminal window (or ssh into the myth box).

    2.  Change directory to /home/mythtv and create a directory called readable-recordings.

    prompt$ cd /home/mythtv

    prompt$ sudo mkdir readable-recordings

    3.  Change directory to /usr/share/doc/mythtv-backend/contrib and locate the file named mythrename.pl.gz.

    prompt$ cd /usr/share/doc/mythtv-backend/contrib

    Unzip the file:

    prompt$ sudo gunzip /usr/local/bin/mythrename.pl.gz

    Make the file executable:

    prompt$ sudo chmod a+x /usr/local/bin/mythrename.pl

    Move the file decompressed file to /usr/local/bin:

    prompt$ sudo mv /usr/share/doc/mythtv-backend/contrib/mythrename.pl /usr/local/bin



    4.  Run the script with the –link option:

    prompt$ /usr/local/bin/mythrename.pl --link /home/mythtv/readable-recordings

    The files in the readable-recordings directory should be easy to read with the proper episode name and title of the recording.

    5.  Setup the script to run automatically.   This script works great but does not run automatically so we need to schedule it with cron to do this hourly.

    prompt$ sudo nano /etc/crontab

    Create the following entry to run the script every hour:
    0 * * * * /usr/local/bin/mythrename.pl --link /home/mythtv/readable-recordings

    5.  Sharing the readable-recordings. From the MythUbuntu Control Center select services from the right side menu.  You should see options to enable NFS and SAMBA sharing directory.   Then go to the desktop Applications –>System–>Shared Folders.   The shared folders application will appear with functions locked.  Click on the unlock button to allow editing.  Create an entry for the readable-recordings directory for SAMBA and one for NFS.  **Note if you are going to NFS share with a OS X box you will need to edit the /etc/exports file to include the insecure option.

    Restart Samba:

    prompt$ sudo /etc/init.d/samba restart

    Restart NFS

    prompt$ sudo /etc/init.d/nfs-kernel-server restart

    You should now be able to mount the shared file system from the network

    SerialChannelSky Eyetv solution for Sky boxes ready to go.

    For many of you who have emailed me to have SerialChannel support the Sky boxes, SerialChannelSky is complete and can be found on www.cooldvr.com soon. SerialChannelSky uses a usb dusky-control box to control the Sky box.  SerialChannelSky is snow leopard compatible. I would like to thank the developer of dusky-control (dusky-control.com) for his support in making this software possible.  It is his hardware that SerialChannelSky relies on to make the magic happen.  If you have any questions feel free to email me at tomhoh@mac.com

    LibUSB on Mac OS X 10.5.x

    Lately I have been working on two projects to integrate USB hardware with my SerialChannel software. Both of these pieces of hardware have drivers written against libusb. Libusb was born into Linux and provides a portable usb api accross multiple platforms including Windows. On OS X however, it has been a moving target over the years with no central project to keep it going. This has been true until I recently discovered that the folks that maintain the SANE port for various platforms including OS X have also maintained a libusb port as part of their software. The best part is they provide it in a nice and neat SDK package for the various versions of OS X to include Leopard. It takes very little effort to get it going and working in an OS X project.  If you are developing software for a usb device that is recognized by the system as an HID device it will be necessary to create a dummy kext file to prevent OS X HID driver from capturing the device.  When creating the info.plist file do not use IOProbeScore in USB …. EVER or you will get error 2c7. The libusb download link is here. Remember to set environment variable

    prompt$ export DYLD_LIBRARY_PATH=”usr/include/lib:$DYLD_LIBRARY_PATH”