132 CombinePan(
unsigned char channelPan,
unsigned char programPan,
unsigned char samplePan);
153 static void NoteOn(
unsigned char note,
unsigned char velocity,
unsigned char channel);
163 static void NoteOff(
unsigned char note,
unsigned char channel);
193 static void BankSelect(
unsigned char channel,
unsigned short bank);
212 static void SetPan(
unsigned char channel,
unsigned char pan);
222 static void SetVolume(
unsigned char channel,
unsigned char volume);
243 static void SetPitchBend(
unsigned char channel,
signed char semitones,
signed char cents);
266 static int LoadPrograms(
const unsigned char *data,
short size,
unsigned short bank);
279 static int LoadSampleDescs(
const unsigned char *data,
short size,
unsigned short bank);
291 static int LoadSamples(
const unsigned char *data,
short size,
unsigned short bank);
366 static void SetPriority(
unsigned char channel,
unsigned char priority);
376 static void SetDetune(
unsigned char channel,
unsigned char detune);
386 static void SetStereo(
unsigned char channel,
unsigned char stereo);
418 static void SetTranspose(
unsigned char channel,
signed char semitones);
428 static void SetBusMode(
unsigned char channel,
unsigned char busMode);
438 static void SetBus(
unsigned char channel,
unsigned char bus);
468 static void SetEffectParam(
unsigned char channel,
unsigned char value,
unsigned char param);
506 static void RetireVoice(
const Voice *voice);
514 static void UpdateVibrato();
522 static void UpdateVoiceStates();
534 static Voice *AllocVoice(
int *core,
int *voice,
signed char bus);
544 static void KeyOn(
unsigned int core0Mask,
unsigned int core1Mask);
554 static void KeyOff(
unsigned int core0Mask,
unsigned int core1Mask);
566 static void SetVoiceMix(
int core,
int voice,
int mode);
574 static void CommitVoiceMix();
582 static void CommitEffects();
590 static void ApplyEffects();
605 static int sTickCount;
607 static int sRetiredVoiceCount;
610 static unsigned char sVoiceMixDirty;
611 static unsigned char sEffectsDirty;
612 static unsigned char sMono;
613 static unsigned char sSurroundDisabled;
614 static unsigned char sEffectsApplying;
615 static int sVibratoTick;
616 static unsigned int sNoteSerial;
617 static int sTransferBusy;
618 static int sTransferCancel;
620 static unsigned int sKeyOnMask[
kNumCores];
621 static unsigned int sKeyOffMask[
kNumCores];
622 static unsigned int sVoiceMixDryLeft[
kNumCores];
623 static unsigned int sVoiceMixDryRight[
kNumCores];
624 static unsigned int sVoiceMixWetLeft[
kNumCores];
625 static unsigned int sVoiceMixWetRight[
kNumCores];
626 static sceSdEffectAttr sEffectAttr[
kNumCores];
A sample descriptor loaded into a bank, linked to the sample it plays.
Definition banksampledesc.h:12
The state of one MIDI channel.
Definition channel.h:20
The MIDI synthesiser that drives the SPU2 voices.
Definition synth.h:19
static void SetStereo(unsigned char channel, unsigned char stereo)
Set a channel's stereo switch.
static void NoteOn(unsigned char note, unsigned char velocity, unsigned char channel)
Start a note on every descriptor of the channel's program whose key range covers it.
static constexpr int kNumCores
Definition synth.h:22
static void SetVolume(unsigned char channel, unsigned char volume)
Set a channel's volume.
static constexpr int kNumChannels
Definition synth.h:21
static void SetPitchBend(unsigned char channel, signed char semitones, signed char cents)
Set a channel's pitch bend.
static int sNotifyPending
Definition synth.h:489
static void * sEffectNotifyAddress
Definition synth.h:490
static void SetTranspose(unsigned char channel, signed char semitones)
Set a channel's transposition.
static void Init()
Reset the banks, channels, and voices, then the SPU2.
static constexpr int kVoicesPerCore
Definition synth.h:23
static void SetPriority(unsigned char channel, unsigned char priority)
Set a channel's voice priority.
static void SetMonophonic(unsigned char channel, unsigned char monophonic)
Set a channel's monophonic switch.
static unsigned char sInitFlag
Definition synth.h:493
static void SetBusMode(unsigned char channel, unsigned char busMode)
Set a channel's dry and reverb mix for later notes.
static Channel sChannels[kNumChannels]
Definition synth.h:495
static int TransferSampleData(unsigned char *data, int size, unsigned int offset, unsigned short bank)
Start a waveform transfer into a bank's SPU2 area.
static void SetControllerEnable(unsigned char channel, unsigned char controller, unsigned char value)
Switch the live update of one controller on or off for a channel.
static void CommitKeys()
Key off and then key on every voice the current batch collected.
static int UnloadBank(unsigned short bank)
Silence a bank's voices, detach its channels, and empty it.
static int LoadBankHeader(const unsigned char *data, unsigned short bank)
Load a bank's header.
static void ResetSpu()
Initialise the SPU2: the mixer, the reverb areas and settings, and the voice mix.
static void SetDetune(unsigned char channel, unsigned char detune)
Set a channel's detune switch.
static int sEffectThreadId
Definition synth.h:492
static void TickThread()
The tick thread.
static void ProgramChange(unsigned char channel, unsigned short program)
Act on a program change unless the channel already plays that program number.
static void SelectProgram(unsigned short channel, unsigned short program)
Point a channel at the program of its bank with a program number.
static int EffectsApplied()
Notify the EE at the next tick that a reverb update ended, when the EE requested it.
static int TransferDone(int channel, void *data)
Notify the EE at the next tick that a waveform transfer ended.
static void SetExpression(unsigned char channel, unsigned char expression)
Set a channel's expression.
static void SetBus(unsigned char channel, unsigned char bus)
Set a channel's preferred core for later notes.
static void SetSurround(bool enabled)
Allow or forbid the surround inversion of the descriptors that request it.
static void SetEffectParam(unsigned char channel, unsigned char value, unsigned char param)
Set one reverb setting of a core from a controller.
static constexpr int kMaxRetiredVoices
Definition synth.h:24
static int SetBankLoaded(unsigned short bank)
Mark a bank loaded.
static void SetPan(unsigned char channel, unsigned char pan)
Set a channel's pan.
static bool ChannelHasProgram(unsigned char channel)
Report whether a channel has a program it can play.
static void ProcessDueEvents()
Act on every queued MIDI message that is due, as one batch of key changes.
static void AllNotesOff(unsigned char channel)
Release a channel's notes and forget every retired voice.
static int QueueTimedEvents(const MidiEvent *events, unsigned int count)
Queue MIDI messages stamped with delays from now.
static int LoadSampleDescs(const unsigned char *data, short size, unsigned short bank)
Load a bank's sample descriptors, each record preceded by a size word.
static void NoteOff(unsigned char note, unsigned char channel)
Stop the oldest sounding instance of a note.
static int sEffectNotifyPending
Definition synth.h:491
static void BankSelect(unsigned char channel, unsigned short bank)
Point a channel at a loaded bank, retaining its program number.
static int LoadPrograms(const unsigned char *data, short size, unsigned short bank)
Load a bank's programs, each record preceded by a size word.
static void UpdateChannelVolume(unsigned char channel)
Rewrite the volume registers of a channel's sounding voices.
static int ProcessMidiStream(const unsigned char *data, unsigned int size)
Act on a MIDI byte stream with running status.
static void SetMono(bool mono)
Select mono output.
static int LoadSamples(const unsigned char *data, short size, unsigned short bank)
Load a bank's samples, each record preceded by a size word.
static void ClearKeyMasks()
Start a batch of key changes.
static int ProcessMidiMessage(unsigned char status, unsigned char data1, unsigned char data2)
Act on one MIDI channel message.
static void * sNotifyAddress
Definition synth.h:488
static int CombinePan(unsigned char channelPan, unsigned char programPan, unsigned char samplePan)
Combine three pan offsets around the centre, clamped to zero to 127.
static int SetBankSpuLayout(const unsigned char *data)
Place the banks' SPU2 areas one after another.
static void EffectThread()
The reverb thread.
static void ResetAllControllers(unsigned char channel)
Restore a channel's controllers to their defaults, except its monophonic switch.
One SPU2 voice and the note it plays.
Definition voice.h:20
One MIDI channel message as the EE sends it in a timed batch.
Definition midievent.h:9