17#define HSYN_CHANNELS 16
29#define HSYN_VOICES_PER_CORE 24
32#define HSYN_SLAVE_VOICE 255
183#define HD_VAG_LOOPED 1
186extern unsigned char *
gpHd;
189extern unsigned char *
gpBd;
444 unsigned short depth,
445 unsigned short *pos);
int HardSynthShutdown(void)
Stop and release the tick timer.
int gVMixR[HSYN_CORES]
Dry right mix switches read from the SPU2 each tick, one word per core.
int HardSynthUpdate(void)
Apply one tick of updates to every sounding note.
void HardSynthInvalidateHd(unsigned char *pHd)
Detach the bank slot that uses a header.
int get_free_slot(int which_core)
Find a free voice, starting after the one handed out last on each core.
void hs_prog_change(int iChan, int iProg)
Select a channel's program.
unsigned char * gaBds[HSYN_BANKS]
SPU2 addresses of the bank bodies by bank slot.
sSynChannel gChan[HSYN_CHANNELS]
Channel state.
int rate_R
Right chorus rate.
int HardSynthClearHDBD(void)
Clear the flag an attached bank sets.
int HardSynthInvalidateBank(int bank)
Detach a bank slot and silence its notes.
int HardSynthKillOld(void)
Release every note whose voice has fallen silent.
void MidiBufferSetup(void)
Empty the MIDI stream buffers.
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.
sSynNote gCurrentNotes[HSYN_NOTES]
Sounding notes.
@ HSYN_NOTE_RELEASED
Definition hsyn.h:39
@ HSYN_NOTE_ON
Definition hsyn.h:36
@ HSYN_NOTE_NEW
Definition hsyn.h:37
@ HSYN_NOTE_LOOPED
Definition hsyn.h:38
int gVMixL[HSYN_CORES]
Dry left mix switches read from the SPU2 each tick, one word per core.
unsigned char * gpBd
SPU2 address of the bank body of the note being started.
int gReg_VMixL[HSYN_CORES]
Dry left mix switches to write at the end of the tick, one word per core.
int gVMixER[HSYN_CORES]
Effect right mix switches read from the SPU2 each tick, one word per core.
int HardSynthInit(void)
Initialise the synthesiser, start its tick thread, and start the tick timer.
int gVMixEL[HSYN_CORES]
Effect left mix switches read from the SPU2 each 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 hs_reapply_channel(int iChan)
Recompute and write every note of a channel.
int voice_alloc[HSYN_CORES]
Voices in use, one bit per voice and one word per core.
int HardSynthParseNew(unsigned char *pMidiBlock, int iBlockSize, int buf)
Act on a block of MIDI messages.
int hs_check_playing(sSynNote *pNote)
Release a note whose voice has fallen silent.
unsigned char * HandleMidiMessage(unsigned char *pMidiMsg)
Act on one MIDI channel message.
int gReg_VMixR[HSYN_CORES]
Dry right mix switches to write at the end of the tick, one word per core.
void HardSynthConfig(sSynthConfig *pConfig)
Replace the settings and recompute the chorus rates.
void _do_reg_out(void)
Write the key-on, key-off, and changed voice mix switches of both cores.
void HardSynthInfo(int what)
Handle a diagnostic request.
int HandleTransIntr(int ch, void *common)
Count one completed SPU2 transfer.
int HardSynthResume(void)
Restore the pitch of every note HardSynthPause() stopped.
void _init_banks(void)
Detach every bank slot.
int hs_kill_idx(sSynNote *pNote, int iAlreadyOff)
Silence a note at once and release its voice.
int gEndX[HSYN_CORES]
Voices whose sample has ended, one word per core, read each tick.
#define HSYN_NOTES
Notes the synthesiser can have sounding at once.
Definition hsyn.h:23
int ShowSynthState(int iFlags)
Print the synthesiser state.
int HardSynthAttachHDtoBD(int port, int ipHd, int ipSpu, int bank)
Attach a bank header and its body to a bank slot.
int HardSynthLoadBD(int ipBd, int ipSpu, int iSize)
Copy a bank body to SPU2 memory.
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 hs_note_on(int iChan, int iNote, int iVol)
Start a note on a channel.
@ HSYN_FX_KEEP_PAN
Definition hsyn.h:44
@ HSYN_FX_CHORUS
Definition hsyn.h:45
int HardSynthPause(void)
Stop the pitch of every note on the channels pausing affects.
int MemCpy_IOPtoSPU(void *pIOP, void *pSPU, int iBlockSize)
Copy IOP memory to SPU2 memory and wait for the transfer to end.
int gReg_VMixER[HSYN_CORES]
Effect right mix switches to write at the end of the tick, one word per core.
int _apply_channel_to_note(sSynNote *pNote, int do_set)
Recompute a note's volume and pitch from its channel.
@ HSYN_CHAN_FX_CHORUS
Definition hsyn.h:52
@ HSYN_CHAN_FX_CORE0_EFFECT
Definition hsyn.h:54
@ HSYN_CHAN_FX_CORE1_EFFECT
Definition hsyn.h:53
@ HSYN_CHAN_FX_SMOOTH_VOL
Definition hsyn.h:51
@ HSYN_CHAN_FX_KEEP_PAN
Definition hsyn.h:50
void ResetSynthState(void)
Reset every program, voice, channel, and bank slot.
int hs_idx_off(int noteidx)
Key off a note by index.
int rate_L
Left chorus rate.
int hs_note_off(int iChan, int iNote)
Key off the note playing on a channel, with its chorus voice.
int HardSynthReset(void)
Reset the synthesiser state.
void _build_chorus(int iDepth)
Fill the quarter-sine chorus curve.
unsigned char * gaHds[HSYN_BANKS]
Bank headers by bank slot.
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 StopAutoDMA(void *pIOP, void *pSPU, int iDirection)
Stop an automatic DMA stream.
#define HSYN_CORES
SPU2 cores, each with its own voices.
Definition hsyn.h:26
#define HSYN_CHANNELS
The hardware synthesiser of the EZMIDI IOP module, from midi_hsyn.c.
Definition hsyn.h:17
#define HSYN_BANKS
Bank slots of gaHds and gaBds.
Definition hsyn.h:20
int HardSynthSetRemix(int parm)
Switch remix mode.
int StartAutoDMA(void *pIOP, void *pSPU, int iDirection)
Start an automatic DMA stream.
unsigned char * gpHd
Bank header of the note being started.
int HardSynthSetMono(int parm)
Switch mono output and recompute every channel.
void HardSynthAllNotesOff(int iChan, int do_now)
Silence the notes of a channel.
int hs_update_note_and_fx(sSynNote *pNote)
Apply one tick of channel changes, chorus, and volume slides to a note.
void _init_channels(void)
Reset every channel to its default MIDI state.
The tick timer.
Definition hsyn.h:105
int thread_id
Definition hsyn.h:106
int count
Definition hsyn.h:108
int timer_id
Definition hsyn.h:107
A table chunk of a bank header.
Definition hsyn.h:121
int offsets[]
Definition hsyn.h:124
unsigned char reserved[12]
Definition hsyn.h:122
int maxIndex
Definition hsyn.h:123
A program record.
Definition hsyn.h:141
unsigned char splitCount
Definition hsyn.h:143
sHdSplit split[]
Definition hsyn.h:150
unsigned char reserved[26]
Definition hsyn.h:149
unsigned char volume
Definition hsyn.h:145
signed char detune
Definition hsyn.h:148
unsigned char pan
Definition hsyn.h:146
signed char transpose
Definition hsyn.h:147
unsigned char reserved5
Definition hsyn.h:144
unsigned char reserved0[4]
Definition hsyn.h:142
A sample set record.
Definition hsyn.h:154
unsigned char reserved[4]
Definition hsyn.h:155
unsigned short sampleIndex[]
Definition hsyn.h:156
A sample record.
Definition hsyn.h:160
unsigned char volume
Definition hsyn.h:167
unsigned char reserved12
Definition hsyn.h:164
unsigned char baseNote
Definition hsyn.h:163
unsigned short adsr1
Definition hsyn.h:169
unsigned char reserved2[9]
Definition hsyn.h:162
unsigned char reserved22[19]
Definition hsyn.h:171
short vagIndex
Definition hsyn.h:161
unsigned char spuAttr
Definition hsyn.h:172
unsigned char reserved17
Definition hsyn.h:168
unsigned char pan
Definition hsyn.h:165
unsigned short adsr2
Definition hsyn.h:170
unsigned char reserved14[2]
Definition hsyn.h:166
A key split of a program.
Definition hsyn.h:128
unsigned char reserved5[11]
Definition hsyn.h:133
unsigned char rangeLow
Definition hsyn.h:130
unsigned char reserved3
Definition hsyn.h:131
signed char detune
Definition hsyn.h:137
unsigned char rangeHigh
Definition hsyn.h:132
unsigned char pan
Definition hsyn.h:135
signed char transpose
Definition hsyn.h:136
unsigned char volume
Definition hsyn.h:134
unsigned short sampleSetIndex
Definition hsyn.h:129
A VAG information record.
Definition hsyn.h:176
unsigned int offset
Definition hsyn.h:177
unsigned short sampleRate
Definition hsyn.h:178
unsigned char attribute
Definition hsyn.h:179
Per-channel MIDI state.
Definition hsyn.h:58
unsigned char iFx
Definition hsyn.h:67
unsigned short iPitch
Definition hsyn.h:65
unsigned char iPadc
Definition hsyn.h:69
unsigned short iMod
Definition hsyn.h:64
unsigned short iPads
Definition hsyn.h:70
unsigned char iPan
Definition hsyn.h:61
unsigned char iVol
Definition hsyn.h:60
unsigned char iBankHi
Definition hsyn.h:66
unsigned char iPri
Definition hsyn.h:68
unsigned char iProg
Definition hsyn.h:59
unsigned short iBank
Definition hsyn.h:63
unsigned char iExp
Definition hsyn.h:62
One sounding note and the voice that plays it.
Definition hsyn.h:74
unsigned char i_pad
Definition hsyn.h:84
unsigned short chr_idx
Definition hsyn.h:88
unsigned short t_vol[2]
Definition hsyn.h:87
unsigned char bank
Definition hsyn.h:93
unsigned short i_pitch
Definition hsyn.h:82
unsigned char fx
Definition hsyn.h:80
unsigned char i_pan
Definition hsyn.h:83
unsigned short c_pitch
Definition hsyn.h:85
unsigned short c_vol[2]
Definition hsyn.h:86
unsigned char slot
Definition hsyn.h:77
unsigned char pri
Definition hsyn.h:92
unsigned short i_vol
Definition hsyn.h:81
unsigned char slave
Definition hsyn.h:78
unsigned char pada[6]
Definition hsyn.h:94
unsigned char chan
Definition hsyn.h:75
unsigned short stt_targ[2]
Definition hsyn.h:90
unsigned char flag
Definition hsyn.h:79
unsigned char note
Definition hsyn.h:76
unsigned char stt_frame[2]
Definition hsyn.h:91
unsigned short chr_rng
Definition hsyn.h:89
Synthesiser settings the EE sends with HardSynthConfig().
Definition ezmidi.h:57
Run-time switches the EE sets.
Definition hsyn.h:98
unsigned char remix_mode
Definition hsyn.h:100
unsigned char mono_mode
Definition hsyn.h:101
unsigned short run_chr_rate[2]
Definition hsyn.h:99