Maxmod
|
Macros | |
#define | MM_SIZEOF_ACTCH 28 |
Size of act channel (bytes) | |
#define | MM_SIZEOF_MIXCH 24 |
Size of mix channel (bytes) | |
#define | MM_SIZEOF_MODCH 40 |
Size of mod channel (bytes) | |
Enumerations | |
enum | mm_mixlen_enum { MM_MIXLEN_8KHZ } |
Precalculated mix buffer lengths (in bytes) More... | |
Functions | |
void | mmFrame (void) __attribute((long_call)) |
This is the main routine-function that processes music and updates the sound output. | |
void | mmInit (mm_gba_system *setup) |
Initializes Maxmod with the settings specified. | |
void | mmInitDefault (mm_addr soundbank, mm_word number_of_channels) |
Initialize Maxmod with default settings. | |
void | mmSetEventHandler (mm_callback handler) |
Install handler to receive song events. | |
void | mmSetVBlankHandler (void *function) |
Installs a custom handler to be processed after the sound DMA is reset. | |
void | mmVBlank (void) |
This function must be linked directly to the VBlank IRQ. | |
enum mm_mixlen_enum |
void mmFrame | ( | void | ) |
This is the main routine-function that processes music and updates the sound output.
For GBA, this function must be called every frame. If a call is missed, garbage will be heard in the output and module processing will be delayed.
void mmInit | ( | mm_gba_system * | setup | ) |
Initializes Maxmod with the settings specified.
Initialize system. Call once at startup.
For GBA projects, irqInit() should be called before this function.
setup | Maxmod setup configuration. |
Example:
Initialize Maxmod with default settings.
For GBA, this function uses these default settings (and allocates memory): 16KHz mixing rate, channel buffers in EWRAM, wave buffer in EWRAM, and mixing buffer in IWRAM. It also links the VBlank interrupt to mmVBlank with the libgba interrupt handler.
soundbank | Memory address of soundbank (in ROM). A soundbank file can be created with the Maxmod Utility. |
number_of_channels | Number of module/mixing channels to allocate. Must be greater or equal to the channel count in your modules. |
void mmSetEventHandler | ( | mm_callback | handler | ) |
Install handler to receive song events.
Use this function to receive song events. Song events occur in two situations. One is by special pattern data in a module (which is triggered by SFx/EFx commands). The other occurs when a module finishes playback (in MM_PLAY_ONCE mode).
Note for GBA projects: During the song event, Maxmod is in the middle of module processing. Avoid using any Maxmod related functions during your song event handler since they may cause problems in this situation.
handler | Function pointer to event handler. |
void mmSetVBlankHandler | ( | void * | function | ) |
Installs a custom handler to be processed after the sound DMA is reset.
If you need to have a function linked to the VBlank interrupt, use this function (the actual VBlank interrupt must be linked directly to mmVBlank).
function | Pointer to your VBlank handler. |
void mmVBlank | ( | void | ) |
This function must be linked directly to the VBlank IRQ.
During this function, the sound DMA is reset. The timing is extremely critical, so make sure that it is not interrupted, otherwise garbage may be heard in the output.
If you need another function to execute after this process is finished, use mmVBlankReturn() to install your handler.
Example setup with libgba system: