ritrackerlib
This library plays Protracker modules: files in the usual “M.K.” format with 31 samples and four voices. Its play routine is the Protracker 2.3A routine by Peter “Crayon” Hanning of Mushroom Studios, which was released as public domain, with commands by Reflective Images around it. It is not the module player of Blitz Basic 2 itself (trackerlib): the two have no commands in common, and this one has no module objects.
The module is a Protracker file that the program has in chip memory,
for example loaded into a bank with chip memory as the memory type.
TrackInit takes its address. The library does not play by itself:
the program calls TrackPlay once per tick, 50 times a second,
usually from a vertical blank interrupt handler. The speed commands of
a module (F01 to F1F) work, but tempo commands (F20 to FFF)
do not change the speed: the program sets it by how often it calls
TrackPlay.
LoadBank 0,"mod.tune",2
TrackInit Bank(0)
SetInt 5
TrackPlay
End SetInt
MouseWait
TrackStopTrackerChannels keeps voices free for sound effects, TrackerPause
pauses and continues the module, and Tracker switches the player off
and on. The known faults of the play routine and of these commands are
fixed
(Fixes in the Protracker play routine,
Other fixes in ritrackerlib).
Library number 58.
Commands
TrackDMA
Sets how long the play routine waits for the sound hardware after starting a sample, as a loop count; the default is 4000.
Statement. Help text: dmawait.w
Arguments: .w
The wait is a busy loop, so how long it takes depends on the processor.
Tracker
Switches the player off with 0 and on with any other value. Switching it off stops the module and silences the voices; switching it on again continues it.
Statement. Help text: on+off
Arguments: .b
The player starts switched on. A module that was stopped or paused
before Tracker Off stays stopped or paused after Tracker On.
TrackerChannels
Chooses the voices the module plays on, bit 3 for voice 1 down to bit 0 for voice 4; the default is 15, all four. A voice left out is silenced at once.
Statement. Help text: mask
Arguments: .b
The module does not write to a voice left out, so the program can
play its own sounds on it; the other voices play their own notes.
TrackerChannels %0111, for example, leaves voice 1 free.
TrackerPause
Pauses the module with any value other than 0, which silences the voices; with 0 it continues the module and plays one tick at once.
Statement. Help text: On|Off
Arguments: .b
TrackInit
Prepares the Protracker module at address in chip memory, from the first song position, and enables playing. The module plays as the program calls TrackPlay.
Statement. Help text: address
Arguments: .l
The module is not checked; it must be a module with 31 samples in the
“M.K.” format. TrackInit corrects two kinds of invalid data in the
module in memory: sample numbers above 31 in the patterns become 0,
and a sample’s finetune above 15 keeps only its low four bits.
TrackInit also works while the player is switched off with
Tracker Off; Tracker On then plays this module.
TrackPlay
Plays one tick of the module. Call it 50 times a second, for example from a vertical blank interrupt handler (SetInt 5).
Statement. No help text.
No arguments.
Nothing happens unless a module was started with TrackInit and the
player is not paused, stopped or switched off.
The speed commands of a module (F01 to F1F) set the number of
ticks per row. A tempo command (F20 to FFF) does not change the
speed: the speed is how often the program calls TrackPlay.
TrackStop
Stops the module and silences the four voices.
Statement. No help text.
No arguments.
TrackerPause 0 continues it, and TrackInit starts it from the
beginning.