Specifications

It reads this play list file counting the number of character returns. When the number of
character returns is one less than the song number, it reads the next line in the play list
as the song and its respective path. In this process, the string is also converted to the
UNC. When it sees a ‘\’ the program adds another one in the next string position. This
string is then passed to the create file function which opens the required file. The file
handler that was created to read the file into the buffer now points to the new file. When
the file being read reaches the end, the program increments the song counter and calls
the openMP3 function which opens the new song. The main loop continues as normal,
reading the file into a buffer and then sending to the player. When it gets to the end of
the MP3 file the next time the main loop comes around to read the data into the buffer
again it is actually the new file. As far as the MP3 player is concerned, this is presented
as a constant data stream.
The tests of this implementation went very smoothly. A play list was created by simply
typing it into the text file and the player successfully played file after file. The only
problem was that after the player played the last song the server crashed. This was
because it was stuck in a loop looking for a file on the last line of the play list, which
was just a character return. The solution to this was to put in a catch for a line with
nothing on it, which is considered to be the end of the play list. At this point it was
determined that two modes could be used, either stop playing at this point or loop back
to the beginning of the play list. If it is set in loop mode it re-calls the openMP3
function with song number set back to 1. If not it just returns to a loop waiting for
commands from the MP3 player.
5.3.7 Adding user controls.
The user is provided with four buttons to use: ‘play/pause’, ‘stop’, ‘next’ and
‘previous’. These buttons all trigger separate interrupts in the player software. To stop
the buttons triggering many interrupts with each button press, another tread was created
to handle de-bounce. This was done by turning off the respective button interrupt in the
interrupt routine and setting a global variable to indicate that a button had been pressed.
The de-bounce thread then sees this variable and turns the button interrupt back on after
200ms. The de-bounce was tested by simply having the interrupt service routine for
each button do as described plus send an indicator to HyperTerminal showing when the
44