Thursday, February 3, 2011
RDS Progress
The code for the Windows RDS Sender program has been posted in the Solutions section of this website. Progress has been made on the new Linux friendly version of the program. I originally started writing the program in the language I had been most formally taught, C. After looking into controlling the serial port with C, I decided it would be difficult but not impossible to do, so I began coding. I got as far as retrieving the artist and song names from a text file when the drawbacks of C began to occur to me. I started re-learning the uses of malloc and calloc, but before I continued work on the C version of the program I spoke with my friend Yates Monteith, a doctoral student in computer science here at Clemson University. He suggested that I write the program as a Bash script. Further research into his suggestion revealed that this would be a great solution for what I intended the program to do. I began work on the bash script and made a good bit of progress despite the learning curve. Before completing the script I had an epiphany which revealed that I may be going about the process in completely the wrong manner. The way the current system works is this: Zach Musgrave's logbook software (written in PHP) writes the name of the artist and the name of the song to text files every time the DJ updates the currently playing song.. My RDS Sending program checks those text files every 1.5 seconds to see if they've been modified and if they have it reads them, formats the output for the RDS encoder, sends them out, and then goes back to checking if the files have been modified. While this method isn't particularly processor intensive, it occurred to me that this wasn't the best solution to the problem. Rather than checking to see if the file has been modified over and over, a better solution would be, in simpler terms, to have the logbook software output the artist and song name data to the serial port every time the DJ updates now playing. While I could have finished the program in bash and just had the PHP script call it and pass the artist and song names into it, I decided to take advantage of some of the niceties of PHP and start writing again from scratch in PHP. (My only previous experience with PHP was rewriting WSBF's former Computer Engineer, Ross Squire's label maker. The label maker would make a PDF with information and reviews of CDs that we could print onto stickers and put on the front of CDs, however they stopped making the stickers we used for these labels, and the labels didn't fit properly on the new type of stickers we purchased. I rewrote the PDF generating part of the label maker almost completely with a new, more robust solution, just in case we ever have to buy different sized stickers for labels again.) Before starting the program in PHP, I checked to see if there was a way to control the serial port with PHP and I found exactly what I was looking for at http://code.google.com/p/php-serial/. With what could have been one of the most difficult parts of the bash version wrapped up in an easy to use package I began work on the PHP version of the RDS sender. After a good bit of progress, I realized that I wasn't sure how I would get the PHP script out of the while loops that I used for resending certain things over and over (to keep the RDS encoder from timing out to the default text after five minutes, say during a Live Session). Ordinarily it would just stop the while loop once the text file had been modified again, but now there was no text file to modify. Zach Musgrave and David Bowman both suggested the use of a semaphore, and researching this in PHP is where my most recent work on the program has ended. Next week I'll continue with my progress and hopefully the PHP version of the RDS Sender will be very close to completion.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment