As time to the deadline winds down, the pressure is building up. Since my focus has been on programming and dealing with the outstanding issues, I have neglected updating this blog as frequently as I would like.
As it stands, with the latest update, I believe the issues with the update cycle and timing system should be resolved. The previous revision had several problems due to the patterns or macros terminating prematurely or not stepping properly. With the revised system, song playback is handled as follows:
- The TFMX files are loaded with a separate functions to load the data and samples. Once loaded, you call playSong() to start playback of a particular track. This loads the track data, starts PAULA and the interrupt cycle.
- On the first interrupt, the trackstep data is read. If the trackstep line specifies a command, it is processed and the trackstep proceeds to the next line on the next interrupt. If the trackstep specifies patterns in one of the eight tracks, a flag specifying that a pattern is on is set to the specific track. The trackstep then cannot advance until all of the patterns have finished playing.
- For the patterns that are on, one pattern command is processed per interrupt. In the case that the pattern specifies a note/macro, the pattern controller goes into a loop to process the macro until the macro specifies a wait which will cause it to hold until the next interrupt.
With the new system, pattern loading and macro loading is handled by separate functions. With this it is possible to independently load patterns or macros for testing purposes. I’m using this to my advantage and have designed a function to individually test macros for playback as is done in the original TFMX editor itself. Since I have been focusing on resolving the issues with the update cycles and timing system which have resulted in a total overhaul, I have not been able to successfully implement all the effects since they are inseparably tied to the timing system. With the test macro functionality in place, I will be able to finish implementing the effects and easily test them by playing back each of the Monkey Island macros.
As for the external interface to interact with; as stated, you simply make calls to individual load the data and sample files (these functions will be changed to accept parameters). You then simply call playSong to play one of the individual tracks. The track will automatically stop when complete or you can call a stop function at anytime to terminate the song prematurely. With these simple functions in place, it will be easy to add code to Monkey Island engine to playback TFMX audio. Hopefully, once the remaining effects are in place, TFMX audio will be ready for prime time. I hope to have them all in place over the next week and then proceed with the final step to linking to the Monkey Island engine.