|
resonance 1.0.1
|
#include "ezmidi/ezmidi.h"
Go to the source code of this file.
Classes | |
| struct | sSynChannel |
| Per-channel MIDI state. More... | |
| struct | sSynNote |
| One sounding note and the voice that plays it. More... | |
| struct | sSynthRun |
| Run-time switches the EE sets. More... | |
| struct | TimerCtx |
| The tick timer. More... | |
| struct | sHdHeader |
| Bank header. More... | |
| struct | sHdChunk |
| A table chunk of a bank header. More... | |
| struct | sHdSplit |
| A key split of a program. More... | |
| struct | sHdProgram |
| A program record. More... | |
| struct | sHdSampleSet |
| A sample set record. More... | |
| struct | sHdSample |
| A sample record. More... | |
| struct | sHdVagInfo |
| A VAG information record. More... | |
Macros | |
| #define | HSYN_CHANNELS 16 |
| The hardware synthesiser of the EZMIDI IOP module, from midi_hsyn.c. | |
| #define | HSYN_BANKS 16 |
| Bank slots of gaHds and gaBds. | |
| #define | HSYN_NOTES 50 |
| Notes the synthesiser can have sounding at once. | |
| #define | HSYN_CORES 2 |
| SPU2 cores, each with its own voices. | |
| #define | HSYN_VOICES_PER_CORE 24 |
| Voices of one SPU2 core. | |
| #define | HSYN_SLAVE_VOICE 255 |
| sSynNote::slave value that marks the second voice of a chorus pair. | |
| #define | HD_VAG_LOOPED 1 |
| sHdVagInfo::attribute value of a looping VAG. | |
Enumerations | |
| enum | { HSYN_NOTE_ON = 0x01 , HSYN_NOTE_NEW = 0x02 , HSYN_NOTE_LOOPED = 0x04 , HSYN_NOTE_RELEASED = 0x08 } |
| Bits of sSynNote::flag. More... | |
| enum | { HSYN_FX_KEEP_PAN = 0x01 , HSYN_FX_CHORUS = 0x04 } |
| Bits of sSynNote::fx. More... | |
| enum | { HSYN_CHAN_FX_KEEP_PAN = 0x01 , HSYN_CHAN_FX_SMOOTH_VOL = 0x02 , HSYN_CHAN_FX_CHORUS = 0x04 , HSYN_CHAN_FX_CORE1_EFFECT = 0x10 , HSYN_CHAN_FX_CORE0_EFFECT = 0x20 } |
| Bits of sSynChannel::iFx, each switched by one MIDI controller. More... | |
Functions | |
| void | _build_chorus (int iDepth) |
| Fill the quarter-sine chorus curve. | |
| int | HandleTransIntr (int ch, void *common) |
| Count one completed SPU2 transfer. | |
| int | MemCpy_IOPtoSPU (void *pIOP, void *pSPU, int iBlockSize) |
| Copy IOP memory to SPU2 memory and wait for the transfer to end. | |
| int | StartAutoDMA (void *pIOP, void *pSPU, int iDirection) |
| Start an automatic DMA stream. | |
| int | StopAutoDMA (void *pIOP, void *pSPU, int iDirection) |
| Stop an automatic DMA stream. | |
| void | _init_channels (void) |
| Reset every channel to its default MIDI state. | |
| void | _init_banks (void) |
| Detach every bank slot. | |
| void | hs_prog_change (int iChan, int iProg) |
| Select a channel's program. | |
| int | get_free_slot (int which_core) |
| Find a free voice, starting after the one handed out last on each core. | |
| int | _note_2_pitch (int base_note, int new_note, int detune, int samp_rate) |
| Convert a note to a pitch register value for a sample. | |
| int | _apply_channel_to_note (sSynNote *pNote, int do_set) |
| Recompute a note's volume and pitch from its channel. | |
| int | _fire_off_sample (int iSamp, int iNote, int iChan, int iVol, sHdProgram *pProgOffs, sHdSplit *pSplitOffs, int xflags) |
| Key on one sample of a program on a new voice. | |
| int | hs_note_on (int iChan, int iNote, int iVol) |
| Start a note on a channel. | |
| int | hs_kill_idx (sSynNote *pNote, int iAlreadyOff) |
| Silence a note at once and release its voice. | |
| int | hs_idx_off (int noteidx) |
| Key off a note by index. | |
| int | hs_note_off (int iChan, int iNote) |
| Key off the note playing on a channel, with its chorus voice. | |
| int | hs_check_playing (sSynNote *pNote) |
| Release a note whose voice has fallen silent. | |
| unsigned short | _apply_chorus (unsigned short c_pitch, unsigned short rate, unsigned short depth, unsigned short *pos) |
| Advance a chorus position and apply it to a pitch. | |
| int | hs_update_note_and_fx (sSynNote *pNote) |
| Apply one tick of channel changes, chorus, and volume slides to a note. | |
| int | hs_reapply_channel (int iChan) |
| Recompute and write every note of a channel. | |
| int | ShowSynthState (int iFlags) |
| Print the synthesiser state. | |
| void | ResetSynthState (void) |
| Reset every program, voice, channel, and bank slot. | |
| void | _do_reg_out (void) |
| Write the key-on, key-off, and changed voice mix switches of both cores. | |
| void | HardSynthAllNotesOff (int iChan, int do_now) |
| Silence the notes of a channel. | |
| unsigned char * | HandleMidiMessage (unsigned char *pMidiMsg) |
| Act on one MIDI channel message. | |
| int | HardSynthLoadBD (int ipBd, int ipSpu, int iSize) |
| Copy a bank body to SPU2 memory. | |
| int | HardSynthAttachHDtoBD (int port, int ipHd, int ipSpu, int bank) |
| Attach a bank header and its body to a bank slot. | |
| int | HardSynthInvalidateBank (int bank) |
| Detach a bank slot and silence its notes. | |
| void | HardSynthInvalidateHd (unsigned char *pHd) |
| Detach the bank slot that uses a header. | |
| int | HardSynthClearHDBD (void) |
| Clear the flag an attached bank sets. | |
| void | MidiBufferSetup (void) |
| Empty the MIDI stream buffers. | |
| int | HardSynthKillOld (void) |
| Release every note whose voice has fallen silent. | |
| int | HardSynthUpdate (void) |
| Apply one tick of updates to every sounding note. | |
| int | HardSynthParseNew (unsigned char *pMidiBlock, int iBlockSize, int buf) |
| Act on a block of MIDI messages. | |
| int | HardSynthPause (void) |
| Stop the pitch of every note on the channels pausing affects. | |
| int | HardSynthResume (void) |
| Restore the pitch of every note HardSynthPause() stopped. | |
| int | HardSynthSetRemix (int parm) |
| Switch remix mode. | |
| int | HardSynthSetMono (int parm) |
| Switch mono output and recompute every channel. | |
| void | HardSynthConfig (sSynthConfig *pConfig) |
| Replace the settings and recompute the chorus rates. | |
| int | HardSynthInit (void) |
| Initialise the synthesiser, start its tick thread, and start the tick timer. | |
| int | HardSynthReset (void) |
| Reset the synthesiser state. | |
| int | HardSynthShutdown (void) |
| Stop and release the tick timer. | |
| void | HardSynthInfo (int what) |
| Handle a diagnostic request. | |
Variables | |
| unsigned char * | gpHd |
| Bank header of the note being started. | |
| unsigned char * | gpBd |
| SPU2 address of the bank body of the note being started. | |
| unsigned char * | gaHds [HSYN_BANKS] |
| Bank headers by bank slot. | |
| unsigned char * | gaBds [HSYN_BANKS] |
| SPU2 addresses of the bank bodies by bank slot. | |
| sSynChannel | gChan [HSYN_CHANNELS] |
| Channel state. | |
| int | voice_alloc [HSYN_CORES] |
| Voices in use, one bit per voice and one word per core. | |
| sSynNote | gCurrentNotes [HSYN_NOTES] |
| Sounding notes. | |
| int | gEndX [HSYN_CORES] |
| Voices whose sample has ended, one word per core, read each tick. | |
| int | gVMixL [HSYN_CORES] |
| Dry left mix switches read from the SPU2 each tick, one word per core. | |
| int | gVMixR [HSYN_CORES] |
| Dry right mix switches read from the SPU2 each tick, one word per core. | |
| int | gVMixEL [HSYN_CORES] |
| Effect left mix switches read from the SPU2 each tick, one word per core. | |
| int | gVMixER [HSYN_CORES] |
| Effect right mix switches read from the SPU2 each tick, one word per core. | |
| int | gReg_VMixL [HSYN_CORES] |
| Dry left mix switches to write at the end of the tick, one word per core. | |
| int | gReg_VMixR [HSYN_CORES] |
| Dry right mix switches to write at the end of the tick, one word per core. | |
| int | gReg_VMixEL [HSYN_CORES] |
| Effect left mix switches to write at the end of the tick, one word per core. | |
| int | gReg_VMixER [HSYN_CORES] |
| Effect right mix switches to write at the end of the tick, one word per core. | |
| int | rate_L |
| Left chorus rate. | |
| int | rate_R |
| Right chorus rate. | |
| #define HSYN_CHANNELS 16 |
The hardware synthesiser of the EZMIDI IOP module, from midi_hsyn.c.
The layouts and names follow the stabs the shipped EZMIDI.IRX records. Addresses in the comments below are offsets into EZMIDI.IRX. MIDI channels the synthesiser tracks.
| #define HSYN_BANKS 16 |
Bank slots of gaHds and gaBds.
| #define HSYN_NOTES 50 |
Notes the synthesiser can have sounding at once.
| #define HSYN_CORES 2 |
SPU2 cores, each with its own voices.
| #define HSYN_VOICES_PER_CORE 24 |
Voices of one SPU2 core.
| #define HSYN_SLAVE_VOICE 255 |
sSynNote::slave value that marks the second voice of a chorus pair.
| #define HD_VAG_LOOPED 1 |
sHdVagInfo::attribute value of a looping VAG.
| anonymous enum |
Bits of sSynNote::flag.
| anonymous enum |
Bits of sSynNote::fx.
| Enumerator | |
|---|---|
| HSYN_FX_KEEP_PAN | The note retains its pan in remix mode. |
| HSYN_FX_CHORUS | The note is one voice of a chorus pair. |
| anonymous enum |
Bits of sSynChannel::iFx, each switched by one MIDI controller.
| void _build_chorus | ( | int | iDepth | ) |
Fill the quarter-sine chorus curve.
| iDepth | Ignored. |
| int HandleTransIntr | ( | int | ch, |
| void * | common ) |
Count one completed SPU2 transfer.
| ch | Transfer channel. |
| common | Counter to increment. |
| int MemCpy_IOPtoSPU | ( | void * | pIOP, |
| void * | pSPU, | ||
| int | iBlockSize ) |
Copy IOP memory to SPU2 memory and wait for the transfer to end.
| pIOP | IOP source. |
| pSPU | SPU2 destination. |
| iBlockSize | Byte count. |
| int StartAutoDMA | ( | void * | pIOP, |
| void * | pSPU, | ||
| int | iDirection ) |
Start an automatic DMA stream.
Not implemented.
| pIOP | Ignored. |
| pSPU | Ignored. |
| iDirection | Ignored. |
| int StopAutoDMA | ( | void * | pIOP, |
| void * | pSPU, | ||
| int | iDirection ) |
Stop an automatic DMA stream.
Not implemented.
| pIOP | Ignored. |
| pSPU | Ignored. |
| iDirection | Ignored. |
| void _init_channels | ( | void | ) |
Reset every channel to its default MIDI state.
| void _init_banks | ( | void | ) |
Detach every bank slot.
| void hs_prog_change | ( | int | iChan, |
| int | iProg ) |
Select a channel's program.
| iChan | Channel. |
| iProg | Program. |
| int get_free_slot | ( | int | which_core | ) |
Find a free voice, starting after the one handed out last on each core.
| which_core | Core, or -1 for either. |
| int _note_2_pitch | ( | int | base_note, |
| int | new_note, | ||
| int | detune, | ||
| int | samp_rate ) |
Convert a note to a pitch register value for a sample.
| base_note | Note that plays at the recorded rate. |
| new_note | Note to play. |
| detune | Fine tuning. |
| samp_rate | Recorded rate in hertz. |
| int _apply_channel_to_note | ( | sSynNote * | pNote, |
| int | do_set ) |
Recompute a note's volume and pitch from its channel.
| pNote | Note. |
| do_set | Nonzero to write the registers now. |
| int _fire_off_sample | ( | int | iSamp, |
| int | iNote, | ||
| int | iChan, | ||
| int | iVol, | ||
| sHdProgram * | pProgOffs, | ||
| sHdSplit * | pSplitOffs, | ||
| int | xflags ) |
Key on one sample of a program on a new voice.
| iSamp | Sample index. |
| iNote | Note. |
| iChan | Channel. |
| iVol | Velocity. |
| pProgOffs | Program record. |
| pSplitOffs | Key split, or null. |
| xflags | One for the second voice of a chorus pair. |
| int hs_note_on | ( | int | iChan, |
| int | iNote, | ||
| int | iVol ) |
Start a note on a channel.
| iChan | Channel. |
| iNote | Note. |
| iVol | Velocity. |
| int hs_kill_idx | ( | sSynNote * | pNote, |
| int | iAlreadyOff ) |
Silence a note at once and release its voice.
| pNote | Note. |
| iAlreadyOff | Nonzero when the voice is already keyed off. |
| int hs_idx_off | ( | int | noteidx | ) |
Key off a note by index.
| noteidx | Note index. |
| int hs_note_off | ( | int | iChan, |
| int | iNote ) |
Key off the note playing on a channel, with its chorus voice.
| iChan | Channel. |
| iNote | Note. |
| int hs_check_playing | ( | sSynNote * | pNote | ) |
Release a note whose voice has fallen silent.
| pNote | Note. |
| unsigned short _apply_chorus | ( | unsigned short | c_pitch, |
| unsigned short | rate, | ||
| unsigned short | depth, | ||
| unsigned short * | pos ) |
Advance a chorus position and apply it to a pitch.
| c_pitch | Pitch register value. |
| rate | Curve step. |
| depth | Pitch range. |
| pos | Curve position to advance. |
| int hs_update_note_and_fx | ( | sSynNote * | pNote | ) |
Apply one tick of channel changes, chorus, and volume slides to a note.
| pNote | Note. |
| int hs_reapply_channel | ( | int | iChan | ) |
Recompute and write every note of a channel.
| iChan | Channel, or -1 for every channel. |
| int ShowSynthState | ( | int | iFlags | ) |
Print the synthesiser state.
Empty in the shipped module.
| iFlags | Sections to print. |
| void ResetSynthState | ( | void | ) |
Reset every program, voice, channel, and bank slot.
| void _do_reg_out | ( | void | ) |
Write the key-on, key-off, and changed voice mix switches of both cores.
| void HardSynthAllNotesOff | ( | int | iChan, |
| int | do_now ) |
Silence the notes of a channel.
| iChan | Channel, or -1 for every channel. |
| do_now | Nonzero to read and write the SPU2 switches around the change. |
| unsigned char * HandleMidiMessage | ( | unsigned char * | pMidiMsg | ) |
Act on one MIDI channel message.
| pMidiMsg | Message. |
| int HardSynthLoadBD | ( | int | ipBd, |
| int | ipSpu, | ||
| int | iSize ) |
Copy a bank body to SPU2 memory.
| ipBd | IOP address of the body. |
| ipSpu | SPU2 address. |
| iSize | Byte count. |
| int HardSynthAttachHDtoBD | ( | int | port, |
| int | ipHd, | ||
| int | ipSpu, | ||
| int | bank ) |
Attach a bank header and its body to a bank slot.
| port | Ignored. |
| ipHd | IOP address of the header. |
| ipSpu | SPU2 address of the body. |
| bank | Bank slot. |
| int HardSynthInvalidateBank | ( | int | bank | ) |
Detach a bank slot and silence its notes.
| bank | Bank slot. |
| void HardSynthInvalidateHd | ( | unsigned char * | pHd | ) |
Detach the bank slot that uses a header.
| pHd | IOP address of the header. |
| int HardSynthClearHDBD | ( | void | ) |
Clear the flag an attached bank sets.
| void MidiBufferSetup | ( | void | ) |
Empty the MIDI stream buffers.
| int HardSynthKillOld | ( | void | ) |
Release every note whose voice has fallen silent.
| int HardSynthUpdate | ( | void | ) |
Apply one tick of updates to every sounding note.
| int HardSynthParseNew | ( | unsigned char * | pMidiBlock, |
| int | iBlockSize, | ||
| int | buf ) |
Act on a block of MIDI messages.
| pMidiBlock | Messages. |
| iBlockSize | Byte count. |
| buf | Ignored. |
| int HardSynthPause | ( | void | ) |
Stop the pitch of every note on the channels pausing affects.
| int HardSynthResume | ( | void | ) |
Restore the pitch of every note HardSynthPause() stopped.
| int HardSynthSetRemix | ( | int | parm | ) |
Switch remix mode.
| parm | Nonzero to enable. |
| int HardSynthSetMono | ( | int | parm | ) |
Switch mono output and recompute every channel.
| parm | Nonzero to enable. |
| void HardSynthConfig | ( | sSynthConfig * | pConfig | ) |
Replace the settings and recompute the chorus rates.
| pConfig | New settings, or null to retain the current settings. |
| int HardSynthInit | ( | void | ) |
Initialise the synthesiser, start its tick thread, and start the tick timer.
| int HardSynthReset | ( | void | ) |
Reset the synthesiser state.
| int HardSynthShutdown | ( | void | ) |
Stop and release the tick timer.
| void HardSynthInfo | ( | int | what | ) |
Handle a diagnostic request.
| what | Zero or one to print the state, two to switch mono output. |
|
extern |
Bank header of the note being started.
|
extern |
SPU2 address of the bank body of the note being started.
|
extern |
Bank headers by bank slot.
|
extern |
SPU2 addresses of the bank bodies by bank slot.
|
extern |
Channel state.
|
extern |
Voices in use, one bit per voice and one word per core.
|
extern |
Sounding notes.
|
extern |
Voices whose sample has ended, one word per core, read each tick.
|
extern |
Dry left mix switches read from the SPU2 each tick, one word per core.
|
extern |
Dry right mix switches read from the SPU2 each tick, one word per core.
|
extern |
Effect left mix switches read from the SPU2 each tick, one word per core.
|
extern |
Effect right mix switches read from the SPU2 each tick, one word per core.
|
extern |
Dry left mix switches to write at the end of the tick, one word per core.
|
extern |
Dry right mix switches to write at the end of the tick, one word per core.
|
extern |
Effect left mix switches to write at the end of the tick, one word per core.
|
extern |
Effect right mix switches to write at the end of the tick, one word per core.
|
extern |
Left chorus rate.
The module never reads it.
|
extern |
Right chorus rate.
The module never reads it.