Maxmod
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations
Maxmod Definitions and Types

Data Structures

struct  mmreverbcfg
 Reverb configuration settings. More...
 
struct  t_mmdssample
 Sample structure. More...
 
struct  t_mmdssystem
 DS setup information. More...
 
struct  t_mmgbasystem
 GBA setup information, passed to mmInit(). More...
 
struct  t_mmsoundeffect
 Information for playing a sound effect. More...
 
struct  t_mmstream
 Information about a stream to be opened. More...
 

Typedefs

typedef void * mm_addr
 Memory address (pointer)
 
typedef unsigned char mm_bool
 Boolean. Non-zero = true, zero = false.
 
typedef unsigned char mm_byte
 Generic 8-bit value.
 
typedef mm_word(* mm_callback) (mm_word msg, mm_word param)
 Function pointer definition for handling song events.
 
typedef struct t_mmdssample mm_ds_sample
 Sample structure.
 
typedef struct t_mmdssystem mm_ds_system
 DS setup information.
 
typedef struct t_mmgbasystem mm_gba_system
 GBA setup information, passed to mmInit().
 
typedef unsigned short mm_hword
 Generic 16-bit value.
 
typedef void * mm_reg
 Hardware register (pointer)
 
typedef struct mmreverbcfg mm_reverb_cfg
 Reverb configuration settings.
 
typedef unsigned short mm_sfxhand
 Sound effect handle.
 
typedef struct t_mmsoundeffect mm_sound_effect
 Information for playing a sound effect.
 
typedef struct t_mmstream mm_stream
 Information about a stream to be opened.
 
typedef mm_word(* mm_stream_func) (mm_word length, mm_addr dest, mm_stream_formats format)
 Function pointer definition for handling stream fill requests (DS mode).
 
typedef unsigned int mm_word
 Generic 32-bit value.
 

Enumerations

enum  mm_mixmode {
  MM_MIX_8KHZ ,
  MM_MIX_10KHZ ,
  MM_MIX_13KHZ ,
  MM_MIX_16KHZ ,
  MM_MIX_18KHZ ,
  MM_MIX_21KHZ ,
  MM_MIX_27KHZ ,
  MM_MIX_31KHZ
}
 Software mixing rates for GBA system. More...
 
enum  mm_mode_enum {
  MM_MODE_A ,
  MM_MODE_B ,
  MM_MODE_C
}
 Audio modes for the DS system. Pass to mmSelectMode(). More...
 
enum  mm_pmode {
  MM_PLAY_LOOP ,
  MM_PLAY_ONCE
}
 Module looping modes for mmStart(). More...
 
enum  mm_reverbch {
  MMRC_LEFT = 1 ,
  MMRC_RIGHT = 2 ,
  MMRC_BOTH = 3
}
 Selection of reverb channels to start/stop. More...
 
enum  mm_reverbflags {
  MMRF_MEMORY =0x01 ,
  MMRF_DELAY =0x02 ,
  MMRF_RATE =0x04 ,
  MMRF_FEEDBACK =0x08 ,
  MMRF_PANNING =0x10 ,
  MMRF_LEFT =0x20 ,
  MMRF_RIGHT =0x40 ,
  MMRF_BOTH =0x60 ,
  MMRF_INVERSEPAN =0x80 ,
  MMRF_NODRYLEFT =0x100 ,
  MMRF_NODRYRIGHT =0x200 ,
  MMRF_8BITLEFT =0x400 ,
  MMRF_16BITLEFT =0x800 ,
  MMRF_8BITRIGHT =0x1000 ,
  MMRF_16BITRIGHT =0x2000 ,
  MMRF_DRYLEFT =0x4000 ,
  MMRF_DRYRIGHT =0x8000
}
 Reverb configuration flags. More...
 
enum  mm_stream_formats {
  MM_STREAM_8BIT_MONO = 0x0 ,
  MM_STREAM_8BIT_STEREO = 0x1 ,
  MM_STREAM_16BIT_MONO = 0x2 ,
  MM_STREAM_16BIT_STEREO = 0x3
}
 Formats for software streaming. More...
 
enum  mm_stream_timer
 Timer selection for counting samples during streaming.
 

Detailed Description

Typedef Documentation

◆ mm_callback

typedef mm_word(* mm_callback) (mm_word msg, mm_word param)

Function pointer definition for handling song events.

Parameters
msgMessage type.
paramAdditional data about the message.

◆ mm_ds_sample

typedef struct t_mmdssample mm_ds_sample

Sample structure.

If the sample loops, then loop_start should be set to the position of the loop starting point, and loop_length should be set to the length of the loop. Otherwise, loop_start should be set to zero, and length should be set to the length of the sample.

The length and position values are measured in words. That is, samples/4 for 8-bit, and samples/2 for 16-bit (and samples/8 for 4-bit compressed). The sample data must be aligned and maybe resampled or padded to fit along the boundaries.

◆ mm_ds_system

typedef struct t_mmdssystem mm_ds_system

DS setup information.

More about mem_bank: Maxmod needs some memory to manage samples and modules that are loaded/unloaded into/from memory. This pointer should reference an area of memory that is mod_count+samp_count WORDS in size:

#include "my_soundbank.h"
u32 my_mem_bank[ MSL_BANKSIZE ];

MSL_BANKSIZE is defined as the sum of the module and sample count in the soundbank.

The mmInitDefault()/mmInitDefaultMem() functions may be used to quickly initialize maxmod default settings. Using these functions, mod_count and samp_count will be automatically filled using data from the soundbank, and mem_bank will be allocated with malloc().

◆ mm_gba_system

typedef struct t_mmgbasystem mm_gba_system

GBA setup information, passed to mmInit().

About mixing_memory: The mixing memory is a heavily used area of memory and should most definitely be located in the fast IWRAM. By default, devkitARM will place any global variables in IWRAM. The size of this buffer depeds on the mixing rate selected.

Check the mm_mixlen_enum values. These values contain the size of the mixing buffer in bytes. If you're using 16KHz mixing rate, your mixing buffer should be defined like this (as a global array):

u8 my_mixing_buffer[ MM_MIXEN_16KHZ ] __attribute__((aligned(4)));

Notice also that the mixing buffer should be aligned by 4 bytes.

About the wave buffer: The wave buffer is a not-so-heavily used area of memory and can be placed in EWRAM. The wave buffer contains the final waveform data that is DMA copied to the sound FIFO. The size of the waveform buffer must be equal to the size of the mixing buffer. By default (devkitARM), the malloc function can be used to allocate the wave buffer in EWRAM. The wave buffer must be aligned by 4 bytes too.

◆ mm_reverb_cfg

typedef struct mmreverbcfg mm_reverb_cfg

Reverb configuration settings.

The flags entry selects which data in the struct is valid. It also selects which reverb channels to apply the settings to, and also some other commands.

◆ mm_sfxhand

typedef unsigned short mm_sfxhand

Sound effect handle.

Returned by mmEffect() and mmEffectEx(). May be used to modify a sound effect while it is playing.

◆ mm_sound_effect

Information for playing a sound effect.

The sample entry is only supported on DS and may be used to play an external sample source.

◆ mm_stream

typedef struct t_mmstream mm_stream

Information about a stream to be opened.

More about manual mode: If this is set, then you must call mmStreamUpdate() periodically to push data into the stream buffer (mmStreamUpdate makes requests to your callback function to fill the stream). Manual mode can be used to have control over when the stream is filled.

◆ mm_stream_func

typedef mm_word(* mm_stream_func) (mm_word length, mm_addr dest, mm_stream_formats format)

Function pointer definition for handling stream fill requests (DS mode).

Parameters
lengthNumber of samples to write to the output.
destOutput address.
formatStream format.

Enumeration Type Documentation

◆ mm_mixmode

enum mm_mixmode

Software mixing rates for GBA system.

Enumerator
MM_MIX_8KHZ 

8 KHz, provides poor quality.

MM_MIX_10KHZ 

10 Khz, provides low quality.

MM_MIX_13KHZ 

13 Khz, provides almost OK quality.

MM_MIX_16KHZ 

16 Khz, provides OK quality, standard setting.

MM_MIX_18KHZ 

18 Khz, provies good quality, higher CPU load.

MM_MIX_21KHZ 

21 Khz, provies better quality, high CPU load.

MM_MIX_27KHZ 

27 KHz, provides even better quality, very high CPU load.

MM_MIX_31KHZ 

31 KHz, provides maximum quality, highest CPU load.

◆ mm_mode_enum

Audio modes for the DS system. Pass to mmSelectMode().

Enumerator
MM_MODE_A 

Selects the full-hardware audio mode.

MM_MODE_B 

Selects the interpolated audio mode.

MM_MODE_C 

Selects the extended mixing audio mode.

◆ mm_pmode

enum mm_pmode

Module looping modes for mmStart().

Enumerator
MM_PLAY_LOOP 

Loop module forever (until stopped).

MM_PLAY_ONCE 

Stop module after playing the last pattern.

◆ mm_reverbch

Selection of reverb channels to start/stop.

Enumerator
MMRC_LEFT 

Select left reverb channel.

MMRC_RIGHT 

Select right reverb channel.

MMRC_BOTH 

Select both reverb channels.

◆ mm_reverbflags

Reverb configuration flags.

The first few flags enable the values in the mm_reverb_cfg struct (to be applied to the channels select with MMRF_LEFT/RIGHT). The rest of the flags are actually commands.

Enumerator
MMRF_MEMORY 

Set memory setting.

MMRF_DELAY 

Set delay setting.

MMRF_RATE 

Set rate setting.

MMRF_FEEDBACK 

Set feedback setting.

MMRF_PANNING 

Set panning setting.

MMRF_LEFT 

Affect left output.

MMRF_RIGHT 

Affect right output.

MMRF_BOTH 

Affect both outputs.

MMRF_INVERSEPAN 

Inverse panning level for right output.

MMRF_NODRYLEFT 

Disable dry output for the left channel.

MMRF_NODRYRIGHT 

Disable dry output for the right channel.

MMRF_8BITLEFT 

Set 8-bit format for the left channel.

MMRF_16BITLEFT 

Set 16-bit format for the left channel.

MMRF_8BITRIGHT 

Set 8-bit format for the right channel.

MMRF_16BITRIGHT 

Set 16-bit format for the right channel.

MMRF_DRYLEFT 

Enable dry output for the left channel.

MMRF_DRYRIGHT 

Enable dry output for the right channel.

◆ mm_stream_formats

Formats for software streaming.

ADPCM streaming is not supported by the DS hardware. The loop point data gets recorded so ring buffers are not possible.

Enumerator
MM_STREAM_8BIT_MONO 

8-bit single channel output.

MM_STREAM_8BIT_STEREO 

8-bit dual channel output (interleaved data).

MM_STREAM_16BIT_MONO 

16-bit single channel output.

MM_STREAM_16BIT_STEREO 

16-bit dual channel output (interleaved data).