💾 Archived View for mirrors.apple2.org.za › archive › apple.cabi.net › Music.and.Sound › MTLIB100.SH… captured on 2024-06-16 at 14:07:31.
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
------------------------------------------------------------------------------ MegaTracker Library v1.0 For Orca compatible languages By Ian Schmidt Copyright (c) 1991-1994 Cygnix Development, Ltd. ------------------------------------------------------------------------------ Installation: Copy LibMT to your libraries directory. It does not rely on any other libs, so order doesn't matter. The Examples [assembly and C]. mttest.asm - plays the Intro song until the song is over or you hit a key. mttest.cc - plays the Intro song until you press Return, but has better error checking than the assembly version (oh well, heh). Call Reference: NOTE: The following calls are shown in C format. From assembly, simply push the parameters from right to left and call the routine with a JSL. (You need to set case on if you aren't already doing so, and then case off again after each JSL. See mttest.asm for an example). Return values are in A for functions which return an int, and A and X (A is lo word, X is hi) for functions returning a long or char *. int MTStartUp(int flags); Starts up MegaTracker and the Sound Tools (do NOT start the sound tools yourself, or MT will barf). MTStartUp will return 0 (MT_SUCCESS) if successful, or 4 (MT_FAILED) if not. The lowest bit of flags indicates whether you will be using ASIF instrument files with songs (if so, MT must allocate an additional 192k of RAM it doesn't otherwise need). This is #defined in libmt.h as USE_ASIFS and DONT_USE_ASIFS. If you attempt to make any other MTLib calls without making this one first, the system is pretty much guaranteed to fail, so don't do it! void MTShutDown(void); Shuts down MegaTracker and the Sound Tools and releases all RAM allocated by MegaTracker. int MTLoadSong(char *path); Loads the song specified by path, which is a normal C-string. Path should be a full path, unless prefixes 8 and 0 are set to the location of the song previous to calling this function. You MUST set the prefixes properly if you will be using ASIF instruments instead of wavebank files. Returns 0 (MT_SUCESS) if sucessful, or one o the codes in the table below otherwise. Error What ------------------------------ 1 Ran out of DOCRAM trying to load ASIF instruments. 2 One of the ASIFs is damaged and cannot be processed. 3 One of the instrument files is not a valid ASIF. 5 No wavebank file (.W, .D, .DOC, or DOC.DATA) found, and MTStartUp was called with DONT_USE_ASIFs. 6 An ASIF file needed by this song cannot be found. 7 MT was unable to NewHandle enough memory to load this song and its instuments. void MTPlaySong(void); Plays the currently loaded song. Will do unpredictable things if you have not first loaded a song. void MTStopSong(void); Stops the currently playing song, if any. void MTPauseSong(int pause); Pass 0 (MT_PAUSE) to pause the currently playing song (if any), and anything else (MT_UNPAUSE) to unpause the song and resume playing. void MTSetSongLoop(int loop); Pass 0 (MT_NOLOOP) for MTLib to play the song only once, and 1 (MT_LOOP) for MTLib to play the song over and over again. int MTIsEndOfSong(void); Returns 0 (MT_PLAYING) if the song is not over, and 1 (MT_OVER) if the song is over. int *MTGetVUData(void); Returns a pointer to an array of 14 integers representing the volume of each track on a scale from 1-32, and 0 is a flag byte meaning no change in that track's volume. This is for writing VU meter routines. void MTPlayNote(int inst, int track, int note, int volume, int stereo); Plays the specified instrument on the specified track at the specifed volume using the specified note and stereo setting. This for instance allows you to have sound f/x in games [hi DOTW!]. Here's a rundown of the parms: inst: from 0 to the number of instruments in the current song minus 1. track: from 0 to 14 (14 is a 'spare' track that is guaranteed not to be used by a song). note: from 0 to 127, where C3 = 36, C#3 = 37, etc. volume: from 0 to 255. stereo: 0 for right, 1 or 2 for both sides, and 3 for left. (MT_RIGHT, MT_CENTER, MT_LEFT). void MTStopNote(int track); Stops any note on the specified track.