This section describes all functions available for MIDAS module playback.
MIDASmodule MIDASloadModule(char *fileName)
Loads a module file into memory.
This function loads a module file into memory. It checks the module format based on the module file header, and invokes the correct loader to load the module into memory in GMPlayer internal format. The module can then be played using MIDASplayModule, and deallocated from memory with MIDASfreeModule.
Module handle if successful, NULL if not.
All
MIDASplayModule, MIDASfreeModule
BOOL MIDASplayModule(MIDASmodule module, int numEffectChannels)
Starts playing a module.
This functions starts playing a module that has been previously loaded with MIDASloadModule. If channels have not been previously opened using MIDASopenChannels, this function opens the channels necessary to play the module, and if numEffectChannels is nonzero, it opens additional channels for sound effects. The module is always played on the last possible channels, so the first numEffectChannels are available for effects and streams.
Note! Currently only one module can be played at a time.
TRUE if successful, FALSE if not.
All
MIDASloadModule, MIDASstopModule, MIDASopenChannels
BOOL MIDASstopModule(MIDASmodule module)
Stops playing a module.
This function stops playing a module that has been played with MIDASplayModyle. If the channels were opened automatically by MIDASplayModule, this function will close them, but if they were opened manually with MIDASopenChannels, they will be left open.
TRUE if successful, FALSE if not.
All
MIDASplayModule, MIDASopenChannels
BOOL MIDASfreeModule(MIDASmodule module)
Deallocates a module.
This function deallocates a module loaded with MIDASloadModule. It should be called to free unused modules from memory, after they are no longer being played, to avoid memory leaks.
TRUE if successful, FALSE if not.
All
BOOL MIDASgetPlayStatus(MIDASplayStatus *status)
Gets module playback status.
This function reads the current module playback status, and writes it to *status. The user needs to pass it a valid pointer to a MIDASplayStatus structure, which will be updated.
TRUE if successful, FALSE if not. The current playback status is written to *status.
All
MIDASplayModule, MIDASplayStatus
BOOL MIDASsetPosition(int newPosition)
Changes module playback position.
This function changes the current module playback position. The song starts at position 0, and the length is available in the MIDASmoduleInfo structure. You should make sure that position lies inside those limits. To skip backward or forward a single position, first read the current position with MIDASgetPlayStatus, and substract or add one to the current position.
TRUE if successful, FALSE if not.
All
MIDASplayModule, MIDASgetPlayStatus, MIDASgetModuleInfo
BOOL MIDASsetMusicVolume(unsigned volume)
Changes music playback volume.
This function changes the music playback master volume. It can be used, for example, for fading music in or out smoothly, or for adjusting the music volume relative to sound effects. The volume change only affects the song that is currently being played -- if a new song is started, the volume is reset. The default music volume is 64 (the maximum).
TRUE if successful, FALSE if not.
All
BOOL MIDASgetModuleInfo(MIDASmodule module, MIDASmoduleInfo *info)
Gets information about a module.
This function returns information about a module, including the module name and the number of channels used. The user needs to pass it a valid pointer to a MIDASmoduleInfo structure (*info), where the information will be written.
TRUE if successful, FALSE if not. The module information is written to *info.
All
MIDASplayModule, MIDASmoduleInfo
BOOL MIDASgetInstrumentInfo(MIDASmodule module, int instNum, MIDASinstrumentInfo *info)
Gets information about an instrument in a module.
This function returns information about an instrument in a module, including the instrument name. The user needs to pass it a valid pointer to a MIDASinstrumentInfo structure (*info), where the information will be written. You should ensure that instNum is a valid instrument number. Instrument numbers start from 0, although trackers traditionally number them from 1, and you can useMIDASgetModuleInfo to get the number of instruments available in a module.
TRUE if successful, FALSE if not. The instrument information is written to *info.
All
MIDASplayModule, MIDASgetModuleInfo, MIDASmoduleInfo