*POST BROUGHT OUT OF BACKUPS*
So after quite some time i have finally managed to write my own front-end for my CarPC. The problem with the existing system was that there was no way to alter the playlist. The existing system consisted of an old Compaq laptop in the boot coupled with a MatrixOrbital LCD display (from Kustom PCs) and a Car2PC interface for a Pioneer Headunit (purchased direct from the US at InDashPC but they are now also stocked in the UK by KustomPCs) These two things allowed me to control play/pause/skip etc as well as have a display for the current playing song and date/time.
The problem with this is that i simply had one large playlist set to random and this wasn’t always to everyone’s taste – including my own. The software driving the LCD (LCDC) also had issues when the display was unplugged or not correctly initialised (it’s a USB display which emulates a COM port and things tend to go wrong when COM ports just disappear). Since the laptop is in the boot under a false floor it’s not very easy to get to it if things go wrong (usually requires a crossover cable and VNC from my other laptop)
So this led me to design a new system – a system which would allow someone to browse the music library, adjust winamp controls (such as shuffle) and be resilient against device removal. The hardware will be as before but plus a Griffin PowerMate – a DIY iDrive if you will.
Implementing my idea was trickier than i thought – i ended up writing my own directory navigation system so that all directory names are stepped through on the screen (when the control is turned) and selected on a ‘click’ the traditional ‘dot’ and ‘double dot’ directories are represented to allow selection of current directory as well as navigate ‘up’.
The top level directory contains winamp controls, i didn’t want to write my own media player so i opted for spawning the winamp process from within my application and sending window messages to it for control. Since the winamp SDK is a bit vague on how this is done it required some guesswork on my part.
The controls available are fairly basic but include play/pause, next, previous, shuffle, LCD brightness, LCD contrast, winamp volume.
In order to make the system resilient, all of the code for setting up and tearing down the LCD is contained within their own functions and if an error occurs on communication it repeatedly attempts to restart the connection until it works again – if i unplug the LCD and plug it back in again it merely takes a few seconds for it to spring back into life, the same goes for the PowerMate, although i had help there, i used a component from the JCL/JVCL library called TjvHidDeviceController, this is based on the windows HID API which was specially ported into delphi. My application simply keeps tags on HID events and is notified if the PowerMate is plugged in or out.
In all it works rather well – it is very reliable so far, unfortunatly i don’t have any pictures of the car yet – maybe later and the screenshot of the app isn’t really very interesting, it is however here) It’s mostly just debug information to allow me to test various parts of the application – many of which are no longer valid as everything is setup automatically when the application starts up.
In the future i expect to re-structure much of the app into seperate classes/threads so i can then reuse the code later in other projects, i’d also like to write some more text processing algorithms for on-screen effects (it currently scrolls and centres but i’d like wipes/fades etc between screens).
The software was written in C++ using Borland/Codegear RAD Studio 2007.
PS Pictures of the car now available on my Flickr account here