wavelength 1.0.0
Loading...
Searching...
No Matches
Synth Class Referenceabstract

The MIDI synthesiser that drives the SPU2 voices. More...

#include <synth.h>

Inheritance diagram for Synth:
Collaboration diagram for Synth:

Public Types

typedef void(* Callback) (int nArg)
 Routine a queued callback job calls with its argument.

Public Member Functions

virtual int Init ()=0
 Vtable slot 1.
virtual int Terminate ()=0
 Vtable slot 2.
virtual void ResetSpu ()
 Vtable slot 3.
virtual ~Synth ()
 Vtable slot 4.
virtual int SendPackedMessage (unsigned int nPacked)=0
 Vtable slot 5.
virtual int SendMessage (unsigned char nByte0, unsigned char nByte1, unsigned char nByte2, int nByte3)=0
 Vtable slot 6.
virtual int Unsupported ()
 Vtable slot 7.
virtual void UpdateTime ()=0
 Vtable slot 8.
virtual int Poll ()=0
 Vtable slot 9.
virtual StreamPlayer * GetStream ()
 Vtable slot 10.
virtual void SetStream (StreamPlayer *pStream)
 Vtable slot 11.
virtual void SendStreamData (const void *pData, int nSize)
 Vtable slot 12.
virtual int GetStreamStatus ()
 Vtable slot 13.
virtual int GetStreamFormat (int *pnRate, int *pnBlock)=0
 Vtable slot 14, pure in this class.
virtual int Partition (const std::vector< int > &blocks)=0
 Vtable slot 15.
virtual int GetBankBlockCount (const String &file)=0
 Vtable slot 16.
virtual bool IsBankLoaded (unsigned short nSlot)=0
 Vtable slot 17.
virtual int IsBankPresent (unsigned short nSlot)
 Vtable slot 18.
virtual int LoadBank (unsigned short nSlot, const String &file, bool bSkipPending)=0
 Vtable slot 19.
virtual int UnloadBank (unsigned short nSlot)=0
 Vtable slot 20.
virtual void SetSurround (bool bSurround)
 Vtable slot 21.
virtual void SetMono (bool bMono)
 Vtable slot 22.
virtual void SetLag (float fLag)
 Vtable slot 23.
virtual float GetLag ()
 Vtable slot 24.
virtual void SetSoftFxSweep (float fPosition)
 Vtable slot 25.
virtual void SetSoftFxModulation (float fValue)
 Vtable slot 26.
virtual void SetSoftFxFilter (const SoftFxFilter &filter)
 Vtable slot 27.
virtual int EnableSoftFx ()=0
 Vtable slot 28.
virtual int DisableSoftFx ()=0
 Vtable slot 29.
virtual void SetOutputLevel (float fLevel)
 Vtable slot 30.
virtual float GetOutputLevel ()
 Vtable slot 31.
virtual void SetSoftFxInput (int nInput)
 Vtable slot 32.
virtual void SetBusToCoreFx (int nOn)
 Vtable slot 33.
virtual void SetBusToSoftFx (int nOn)
 Vtable slot 34.
virtual void VirtualSlot35 ()
 Vtable slot 35.
virtual void SendMessages (const std::vector< unsigned int > &messages)
 Vtable slot 36.
virtual void QueueCallback (Callback pfnCallback, int nArg)
 Vtable slot 37.

Static Public Member Functions

static void TickThread ()
 The tick thread.
static int ProcessMidiMessage (unsigned char status, unsigned char data1, unsigned char data2)
 Act on one MIDI channel message.
static void ProcessDueEvents ()
 Act on every queued MIDI message that is due, as one batch of key changes.
static int QueueTimedEvents (const MidiEvent *events, unsigned int count)
 Queue MIDI messages stamped with delays from now.
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 void SetSurround (bool enabled)
 Allow or forbid the surround inversion of the descriptors that request it.
static void ResetAllControllers (unsigned char channel)
 Restore a channel's controllers to their defaults, except its monophonic switch.
static void Init ()
 Reset the banks, channels, and voices, then the SPU2.
static void ResetSpu ()
 Initialise the SPU2: the mixer, the reverb areas and settings, and the voice mix.
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 bool ChannelHasProgram (unsigned char channel)
 Report whether a channel has a program it can play.
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 void NoteOff (unsigned char note, unsigned char channel)
 Stop the oldest sounding instance of a note.
static void SelectProgram (unsigned short channel, unsigned short program)
 Point a channel at the program of its bank with a program number.
static void ProgramChange (unsigned char channel, unsigned short program)
 Act on a program change unless the channel already plays that program number.
static void BankSelect (unsigned char channel, unsigned short bank)
 Point a channel at a loaded bank, retaining its program number.
static void UpdateChannelVolume (unsigned char channel)
 Rewrite the volume registers of a channel's sounding voices.
static void SetPan (unsigned char channel, unsigned char pan)
 Set a channel's pan.
static void SetVolume (unsigned char channel, unsigned char volume)
 Set a channel's volume.
static void SetExpression (unsigned char channel, unsigned char expression)
 Set a channel's expression.
static void SetPitchBend (unsigned char channel, signed char semitones, signed char cents)
 Set a channel's pitch bend.
static int LoadBankHeader (const unsigned char *data, unsigned short bank)
 Load a bank's header.
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 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 int LoadSamples (const unsigned char *data, short size, unsigned short bank)
 Load a bank's samples, each record preceded by a size word.
static int TransferDone (int channel, void *data)
 Notify the EE at the next tick that a waveform transfer ended.
static int EffectsApplied ()
 Notify the EE at the next tick that a reverb update ended, when the EE requested it.
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 int SetBankSpuLayout (const unsigned char *data)
 Place the banks' SPU2 areas one after another.
static int SetBankLoaded (unsigned short bank)
 Mark a bank loaded.
static int UnloadBank (unsigned short bank)
 Silence a bank's voices, detach its channels, and empty it.
static void SetPriority (unsigned char channel, unsigned char priority)
 Set a channel's voice priority.
static void SetDetune (unsigned char channel, unsigned char detune)
 Set a channel's detune switch.
static void SetStereo (unsigned char channel, unsigned char stereo)
 Set a channel's stereo switch.
static void SetMonophonic (unsigned char channel, unsigned char monophonic)
 Set a channel's monophonic switch.
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 SetTranspose (unsigned char channel, signed char semitones)
 Set a channel's transposition.
static void SetBusMode (unsigned char channel, unsigned char busMode)
 Set a channel's dry and reverb mix for later notes.
static void SetBus (unsigned char channel, unsigned char bus)
 Set a channel's preferred core for later notes.
static void AllNotesOff (unsigned char channel)
 Release a channel's notes and forget every retired voice.
static void EffectThread ()
 The reverb thread.
static void SetEffectParam (unsigned char channel, unsigned char value, unsigned char param)
 Set one reverb setting of a core from a controller.
static void CommitKeys ()
 Key off and then key on every voice the current batch collected.
static void ClearKeyMasks ()
 Start a batch of key changes.
static void Create ()
 Build TheSynth and initialise it.
static void Destroy ()
 Terminate TheSynth, destroy it, and clear the pointer.

Static Public Attributes

static constexpr int kNumChannels = 16
static constexpr int kNumCores = 2
static constexpr int kVoicesPerCore = 24
static constexpr int kMaxRetiredVoices = 50
static void * sNotifyAddress
static int sNotifyPending
static void * sEffectNotifyAddress
static int sEffectNotifyPending
static int sEffectThreadId
static unsigned char sInitFlag
static Channel sChannels [kNumChannels]

Detailed Description

The MIDI synthesiser that drives the SPU2 voices.

Abstract base of the game's sound output.

The class has no RTTI, and its name is inferred from the module's name. Every member is static, and the module has one synthesiser. The EE sends MIDI over RPC to play at once or stamped with a delay. The tick thread runs every six milliseconds and plays delayed MIDI when it falls due. Notes key on and off in batches. A pass over incoming MIDI collects the key masks, and CommitKeys() writes them together.

The RTTI includes the class name and records no base. The vptr sits at offset 0. Two classes implement it. SynthPS2 drives the sound hardware through the synth and softfx IOP modules, and SynthNull supplies empty bodies. Create() builds one of the two as TheSynth.

The vtable has 38 slots, declared in order.

Member Typedef Documentation

◆ Callback

typedef void(* Synth::Callback) (int nArg)

Routine a queued callback job calls with its argument.

Constructor & Destructor Documentation

◆ ~Synth()

virtual Synth::~Synth ( )
virtual

Vtable slot 4.

Release the sound output.

Ghidra address:
NTSC-U/C: 0x00395f60
Ghidra address:
PAL: 0x004047f0

Member Function Documentation

◆ TickThread()

void Synth::TickThread ( )
static

The tick thread.

It sleeps until the timer wakes it, then advances the voices and the queued MIDI and posts pending notifications to the EE.

Ghidra address:
NTSC-U/C: 0x00000704
Ghidra address:
PAL: 0x00000704

◆ ProcessMidiMessage()

int Synth::ProcessMidiMessage ( unsigned char status,
unsigned char data1,
unsigned char data2 )
static

Act on one MIDI channel message.

System messages are ignored.

Parameters
statusStatus byte.
data1First data byte.
data2Second data byte.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00000a10
Ghidra address:
PAL: 0x00000a10

◆ ProcessDueEvents()

void Synth::ProcessDueEvents ( )
static

Act on every queued MIDI message that is due, as one batch of key changes.

Ghidra address:
NTSC-U/C: 0x00000fd8
Ghidra address:
PAL: 0x00000fd8

◆ QueueTimedEvents()

int Synth::QueueTimedEvents ( const MidiEvent * events,
unsigned int count )
static

Queue MIDI messages stamped with delays from now.

Parameters
eventsThe messages, whose fourth byte is the delay in milliseconds.
countNumber of messages.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x000010dc
Ghidra address:
PAL: 0x000010dc

◆ ProcessMidiStream()

int Synth::ProcessMidiStream ( const unsigned char * data,
unsigned int size )
static

Act on a MIDI byte stream with running status.

The stream ends at its size or at a system message. A note-on of velocity zero is treated as a note-off.

Parameters
dataThe stream.
sizeIts size in bytes.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00001268
Ghidra address:
PAL: 0x00001268

◆ SetMono() [1/2]

void Synth::SetMono ( bool mono)
static

Select mono output.

Mono output centres every later note.

Parameters
monoTrue for mono.
Ghidra address:
NTSC-U/C: 0x00002514
Ghidra address:
PAL: 0x00002514

◆ SetSurround() [1/2]

void Synth::SetSurround ( bool enabled)
static

Allow or forbid the surround inversion of the descriptors that request it.

Parameters
enabledTrue to allow it.
Ghidra address:
NTSC-U/C: 0x00002520
Ghidra address:
PAL: 0x00002520

◆ ResetAllControllers()

void Synth::ResetAllControllers ( unsigned char channel)
static

Restore a channel's controllers to their defaults, except its monophonic switch.

Parameters
channelThe channel.
Ghidra address:
NTSC-U/C: 0x00002808
Ghidra address:
PAL: 0x00002808

◆ Init() [1/2]

void Synth::Init ( )
static

Reset the banks, channels, and voices, then the SPU2.

Ghidra address:
NTSC-U/C: 0x000028dc
Ghidra address:
PAL: 0x000028dc

◆ ResetSpu() [1/2]

void Synth::ResetSpu ( )
static

Initialise the SPU2: the mixer, the reverb areas and settings, and the voice mix.

Ghidra address:
NTSC-U/C: 0x00002a3c
Ghidra address:
PAL: 0x00002a3c

◆ CombinePan()

int Synth::CombinePan ( unsigned char channelPan,
unsigned char programPan,
unsigned char samplePan )
static

Combine three pan offsets around the centre, clamped to zero to 127.

Parameters
channelPanChannel pan.
programPanProgram pan.
samplePanDescriptor pan.
Returns
The combined pan.
Ghidra address:
NTSC-U/C: 0x00003070
Ghidra address:
PAL: 0x00003070

◆ ChannelHasProgram()

bool Synth::ChannelHasProgram ( unsigned char channel)
static

Report whether a channel has a program it can play.

Parameters
channelThe channel.
Returns
True when the channel's program slot has a program.
Ghidra address:
NTSC-U/C: 0x000034c4
Ghidra address:
PAL: 0x000034c4

◆ NoteOn()

void Synth::NoteOn ( unsigned char note,
unsigned char velocity,
unsigned char channel )
static

Start a note on every descriptor of the channel's program whose key range covers it.

Parameters
noteNote number.
velocityVelocity; zero stops the note instead.
channelThe channel.
Ghidra address:
NTSC-U/C: 0x00003574
Ghidra address:
PAL: 0x00003574

◆ NoteOff()

void Synth::NoteOff ( unsigned char note,
unsigned char channel )
static

Stop the oldest sounding instance of a note.

Parameters
noteNote number.
channelThe channel.
Ghidra address:
NTSC-U/C: 0x00003d38
Ghidra address:
PAL: 0x00003d38

◆ SelectProgram()

void Synth::SelectProgram ( unsigned short channel,
unsigned short program )
static

Point a channel at the program of its bank with a program number.

Parameters
channelThe channel.
programProgram number; no match clears the channel's program.
Ghidra address:
NTSC-U/C: 0x00004050
Ghidra address:
PAL: 0x00004050

◆ ProgramChange()

void Synth::ProgramChange ( unsigned char channel,
unsigned short program )
static

Act on a program change unless the channel already plays that program number.

Parameters
channelThe channel.
programProgram number.
Ghidra address:
NTSC-U/C: 0x00004148
Ghidra address:
PAL: 0x00004148

◆ BankSelect()

void Synth::BankSelect ( unsigned char channel,
unsigned short bank )
static

Point a channel at a loaded bank, retaining its program number.

Parameters
channelThe channel.
bankBank identifier.
Ghidra address:
NTSC-U/C: 0x000041ec
Ghidra address:
PAL: 0x000041ec

◆ UpdateChannelVolume()

void Synth::UpdateChannelVolume ( unsigned char channel)
static

Rewrite the volume registers of a channel's sounding voices.

Parameters
channelThe channel.
Ghidra address:
NTSC-U/C: 0x00004418
Ghidra address:
PAL: 0x00004418

◆ SetPan()

void Synth::SetPan ( unsigned char channel,
unsigned char pan )
static

Set a channel's pan.

Parameters
channelThe channel.
panPan, where 64 is the centre.
Ghidra address:
NTSC-U/C: 0x00004554
Ghidra address:
PAL: 0x00004554

◆ SetVolume()

void Synth::SetVolume ( unsigned char channel,
unsigned char volume )
static

Set a channel's volume.

Parameters
channelThe channel.
volumeVolume.
Ghidra address:
NTSC-U/C: 0x000045c0
Ghidra address:
PAL: 0x000045c0

◆ SetExpression()

void Synth::SetExpression ( unsigned char channel,
unsigned char expression )
static

Set a channel's expression.

Parameters
channelThe channel.
expressionExpression.
Ghidra address:
NTSC-U/C: 0x0000462c
Ghidra address:
PAL: 0x0000462c

◆ SetPitchBend()

void Synth::SetPitchBend ( unsigned char channel,
signed char semitones,
signed char cents )
static

Set a channel's pitch bend.

Parameters
channelThe channel.
semitonesWhole semitones.
centsRemaining cents.
Ghidra address:
NTSC-U/C: 0x00004798
Ghidra address:
PAL: 0x00004798

◆ LoadBankHeader()

int Synth::LoadBankHeader ( const unsigned char * data,
unsigned short bank )
static

Load a bank's header.

Parameters
dataThe record's size word followed by the record.
bankBank slot.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x000048f8
Ghidra address:
PAL: 0x000048f8

◆ LoadPrograms()

int Synth::LoadPrograms ( const unsigned char * data,
short size,
unsigned short bank )
static

Load a bank's programs, each record preceded by a size word.

Parameters
dataThe records.
sizeBytes of records.
bankBank slot.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00004954
Ghidra address:
PAL: 0x00004954

◆ LoadSampleDescs()

int Synth::LoadSampleDescs ( const unsigned char * data,
short size,
unsigned short bank )
static

Load a bank's sample descriptors, each record preceded by a size word.

The samples must be loaded first.

Parameters
dataThe records.
sizeBytes of records.
bankBank slot.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00004a18
Ghidra address:
PAL: 0x00004a18

◆ LoadSamples()

int Synth::LoadSamples ( const unsigned char * data,
short size,
unsigned short bank )
static

Load a bank's samples, each record preceded by a size word.

Parameters
dataThe records.
sizeBytes of records.
bankBank slot.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00004adc
Ghidra address:
PAL: 0x00004adc

◆ TransferDone()

int Synth::TransferDone ( int channel,
void * data )
static

Notify the EE at the next tick that a waveform transfer ended.

Parameters
channelTransfer channel.
dataUnused.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00004ba8
Ghidra address:
PAL: 0x00004ba8

◆ EffectsApplied()

int Synth::EffectsApplied ( )
static

Notify the EE at the next tick that a reverb update ended, when the EE requested it.

Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00004be8
Ghidra address:
PAL: 0x00004be8

◆ TransferSampleData()

int Synth::TransferSampleData ( unsigned char * data,
int size,
unsigned int offset,
unsigned short bank )
static

Start a waveform transfer into a bank's SPU2 area.

Parameters
dataThe waveform data.
sizeBytes to transfer.
offsetDestination offset in the bank's area.
bankBank slot.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00004c18
Ghidra address:
PAL: 0x00004c18

◆ SetBankSpuLayout()

int Synth::SetBankSpuLayout ( const unsigned char * data)
static

Place the banks' SPU2 areas one after another.

Parameters
dataOne size word per bank slot, in 64-byte units, or negative to retain the slot's size.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00004d4c
Ghidra address:
PAL: 0x00004d4c

◆ SetBankLoaded()

int Synth::SetBankLoaded ( unsigned short bank)
static

Mark a bank loaded.

Bank selects find only loaded banks.

Parameters
bankBank slot.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00004e98
Ghidra address:
PAL: 0x00004e98

◆ UnloadBank() [1/2]

int Synth::UnloadBank ( unsigned short bank)
static

Silence a bank's voices, detach its channels, and empty it.

Parameters
bankBank slot.
Returns
Zero.
Ghidra address:
NTSC-U/C: 0x00004ecc
Ghidra address:
PAL: 0x00004ecc

◆ SetPriority()

void Synth::SetPriority ( unsigned char channel,
unsigned char priority )
static

Set a channel's voice priority.

Parameters
channelThe channel.
priorityPriority.
Ghidra address:
NTSC-U/C: 0x000050a0
Ghidra address:
PAL: 0x000050a0

◆ SetDetune()

void Synth::SetDetune ( unsigned char channel,
unsigned char detune )
static

Set a channel's detune switch.

Parameters
channelThe channel.
detuneNonzero to detune later notes with vibrato.
Ghidra address:
NTSC-U/C: 0x000050c4
Ghidra address:
PAL: 0x000050c4

◆ SetStereo()

void Synth::SetStereo ( unsigned char channel,
unsigned char stereo )
static

Set a channel's stereo switch.

Parameters
channelThe channel.
stereoNonzero to play later notes as hard-panned pairs.
Ghidra address:
NTSC-U/C: 0x000050ec
Ghidra address:
PAL: 0x000050ec

◆ SetMonophonic()

void Synth::SetMonophonic ( unsigned char channel,
unsigned char monophonic )
static

Set a channel's monophonic switch.

Parameters
channelThe channel.
monophonicNonzero to silence the channel before each later note.
Ghidra address:
NTSC-U/C: 0x00005114
Ghidra address:
PAL: 0x00005114

◆ SetControllerEnable()

void Synth::SetControllerEnable ( unsigned char channel,
unsigned char controller,
unsigned char value )
static

Switch the live update of one controller on or off for a channel.

Parameters
channelThe channel.
controller10, 224 (pitch bend), 7, 17, or 91 (transposition).
valueAt least 64 to switch the update on.
Ghidra address:
NTSC-U/C: 0x0000513c
Ghidra address:
PAL: 0x0000513c

◆ SetTranspose()

void Synth::SetTranspose ( unsigned char channel,
signed char semitones )
static

Set a channel's transposition.

Parameters
channelThe channel.
semitonesTransposition in semitones.
Ghidra address:
NTSC-U/C: 0x0000521c
Ghidra address:
PAL: 0x0000521c

◆ SetBusMode()

void Synth::SetBusMode ( unsigned char channel,
unsigned char busMode )
static

Set a channel's dry and reverb mix for later notes.

Parameters
channelThe channel.
busModeA mix mode, or Channel::kBusModeFromSampleDesc.
Ghidra address:
NTSC-U/C: 0x0000533c
Ghidra address:
PAL: 0x0000533c

◆ SetBus()

void Synth::SetBus ( unsigned char channel,
unsigned char bus )
static

Set a channel's preferred core for later notes.

Parameters
channelThe channel.
busZero for either core, one for core 0, two for core 1.
Ghidra address:
NTSC-U/C: 0x00005360
Ghidra address:
PAL: 0x00005360

◆ AllNotesOff()

void Synth::AllNotesOff ( unsigned char channel)
static

Release a channel's notes and forget every retired voice.

Parameters
channelThe channel.
Ghidra address:
NTSC-U/C: 0x00005388
Ghidra address:
PAL: 0x00005388

◆ EffectThread()

void Synth::EffectThread ( )
static

The reverb thread.

It sleeps until CommitEffects() wakes it, then applies the reverb settings.

Ghidra address:
NTSC-U/C: 0x000059b8
Ghidra address:
PAL: 0x000059b8

◆ SetEffectParam()

void Synth::SetEffectParam ( unsigned char channel,
unsigned char value,
unsigned char param )
static

Set one reverb setting of a core from a controller.

Parameters
channel1 for core 0 or 2 for core 1; other channels are ignored.
valueController value.
param0 for the mode, 1 and 2 for the left and right depth, 3 for the delay, and 4 for the feedback.
Ghidra address:
NTSC-U/C: 0x00005a10
Ghidra address:
PAL: 0x00005a10

◆ CommitKeys()

void Synth::CommitKeys ( )
static

Key off and then key on every voice the current batch collected.

A core whose key-on and key-off masks overlap drops its whole key-off mask.

Ghidra address:
NTSC-U/C: 0x00003420
Ghidra address:
PAL: 0x00003420

◆ ClearKeyMasks()

void Synth::ClearKeyMasks ( )
static

Start a batch of key changes.

Ghidra address:
NTSC-U/C: 0x00003314
Ghidra address:
PAL: 0x00003314

◆ Create()

void Synth::Create ( )
static

Build TheSynth and initialise it.

A true "use_null_synth" key in the "synth" section of the configuration selects SynthNull. Otherwise SynthPS2 is built under the allocation tag "SynthPs2".

Ghidra address:
NTSC-U/C: 0x0024bc10
Ghidra address:
PAL: 0x00254678

◆ Destroy()

void Synth::Destroy ( )
static

Terminate TheSynth, destroy it, and clear the pointer.

Ghidra address:
NTSC-U/C: 0x0024bcc8
Ghidra address:
PAL: 0x00254730

◆ Init() [2/2]

virtual int Synth::Init ( )
pure virtual

Vtable slot 1.

Bring up the sound output.

Returns
The status of the start-up, 0 when it succeeded.

Implemented in SynthNull, and SynthPS2.

◆ Terminate()

virtual int Synth::Terminate ( )
pure virtual

Vtable slot 2.

Shut down the sound output.

Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ ResetSpu() [2/2]

virtual void Synth::ResetSpu ( )
virtual

Vtable slot 3.

Initialise the sound processor again.

The base body is empty.

Ghidra address:
NTSC-U/C: 0x00395f58
Ghidra address:
PAL: 0x00404600

Reimplemented in SynthPS2.

◆ SendPackedMessage()

virtual int Synth::SendPackedMessage ( unsigned int nPacked)
pure virtual

Vtable slot 5.

Send one packed message.

SynthPS2 splits the word into its four bytes, lowest first, and passes them to SendMessage().

Parameters
nPackedThe four message bytes.
Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ SendMessage()

virtual int Synth::SendMessage ( unsigned char nByte0,
unsigned char nByte1,
unsigned char nByte2,
int nByte3 )
pure virtual

Vtable slot 6.

Send one message.

Parameters
nByte0The first message byte.
nByte1The second message byte.
nByte2The third message byte.
nByte3The fourth message value, the delay of the message in milliseconds.
Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ Unsupported()

virtual int Synth::Unsupported ( )
virtual

Vtable slot 7.

Report an unsupported request.

The base body passes "talk to denny" to the empty diagnostic routine at 0x00333d50. The PAL body only returns.

Returns
0.
Ghidra address:
NTSC-U/C: 0x0024bd28
Ghidra address:
PAL: 0x00404608

◆ UpdateTime()

virtual void Synth::UpdateTime ( )
pure virtual

Vtable slot 8.

Sample the system clock for the frame about to run.

The main loop calls it at the start of each frame. The name is inferred.

Implemented in SynthNull, and SynthPS2.

◆ Poll()

virtual int Synth::Poll ( )
pure virtual

Vtable slot 9.

Service the sound output once per frame.

The main loop calls it after the game database has been serviced. The name is inferred.

Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ GetStream()

virtual StreamPlayer * Synth::GetStream ( )
virtual

Vtable slot 10.

Report the stream SetStream() set.

The base body returns null. The name is inferred.

Returns
The stream, or null.
Ghidra address:
NTSC-U/C: 0x00395f90
Ghidra address:
PAL: 0x00404610

Reimplemented in SynthPS2.

◆ SetStream()

virtual void Synth::SetStream ( StreamPlayer * pStream)
virtual

Vtable slot 11.

Set the stream the output plays, or none.

The base body is empty. The name is inferred.

Parameters
pStreamThe stream, or null.
Ghidra address:
NTSC-U/C: 0x00395f98
Ghidra address:
PAL: 0x00404618

Reimplemented in SynthPS2.

◆ SendStreamData()

virtual void Synth::SendStreamData ( const void * pData,
int nSize )
virtual

Vtable slot 12.

Append a run of stream data to the stream the software effect plays.

The base body is empty. An empty run ends the stream. The name is inferred.

Parameters
pDataThe data.
nSizeThe size of the data in bytes.
Ghidra address:
NTSC-U/C: 0x00395fa0
Ghidra address:
PAL: 0x00404620

Reimplemented in SynthPS2.

◆ GetStreamStatus()

virtual int Synth::GetStreamStatus ( )
virtual

Vtable slot 13.

Report the room the software effect has for stream data.

The base body returns 0. The name is inferred.

Returns
The room in bytes.
Ghidra address:
NTSC-U/C: 0x00395fa8
Ghidra address:
PAL: 0x00404628

Reimplemented in SynthPS2.

◆ GetStreamFormat()

virtual int Synth::GetStreamFormat ( int * pnRate,
int * pnBlock )
pure virtual

Vtable slot 14, pure in this class.

Report the format of the stream data.

SynthPS2 reports 28351 and 64. The name is inferred.

Parameters
pnRateReceives the first value.
pnBlockReceives the second value.
Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ Partition()

virtual int Synth::Partition ( const std::vector< int > & blocks)
pure virtual

Vtable slot 15.

Queue the division of the sound memory among the bank slots.

The member is pure in this class. SynthPS2 copies the sizes into a queued job and returns 0. The name is inferred.

Parameters
blocksThe size of each bank slot in 64-byte blocks, indexed by slot. A negative size leaves the slot as it is.
Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ GetBankBlockCount()

virtual int Synth::GetBankBlockCount ( const String & file)
pure virtual

Vtable slot 16.

Report the size of a bank file in 64-byte blocks, rounded up.

The member is pure in this class. The name is inferred.

Parameters
fileThe bank file.
Returns
The number of blocks.

Implemented in SynthNull, and SynthPS2.

◆ IsBankLoaded()

virtual bool Synth::IsBankLoaded ( unsigned short nSlot)
pure virtual

Vtable slot 17.

Report whether a sample bank finished loading into a slot.

The member is pure in this class. The name is inferred.

Parameters
nSlotThe bank slot.
Returns
Whether the bank is loaded.

Implemented in SynthNull, and SynthPS2.

◆ IsBankPresent()

virtual int Synth::IsBankPresent ( unsigned short nSlot)
virtual

Vtable slot 18.

Report whether a slot has a bank or a bank waiting to load.

The base body returns 1. The name is inferred.

Parameters
nSlotThe bank slot.
Returns
1 when the slot has a bank or a pending load, otherwise 0.
Ghidra address:
NTSC-U/C: 0x00395fb0
Ghidra address:
PAL: 0x00404630

Reimplemented in SynthPS2.

◆ LoadBank()

virtual int Synth::LoadBank ( unsigned short nSlot,
const String & file,
bool bSkipPending )
pure virtual

Vtable slot 19.

Start loading a sample bank file into a slot.

The member is pure in this class. The name is inferred.

Parameters
nSlotThe bank slot.
fileThe bank file.
bSkipPendingDo nothing when a load into the slot is already waiting.
Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ UnloadBank() [2/2]

virtual int Synth::UnloadBank ( unsigned short nSlot)
pure virtual

Vtable slot 20.

Empty a sample bank slot.

The member is pure in this class. The name is inferred.

Parameters
nSlotThe bank slot.
Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ SetSurround() [2/2]

virtual void Synth::SetSurround ( bool bSurround)
virtual

Vtable slot 21.

Choose whether the output may invert a channel for surround decoders.

The base body is empty. The name is inferred.

Parameters
bSurroundWhether the inversion is allowed.
Ghidra address:
NTSC-U/C: 0x00395fb8
Ghidra address:
PAL: 0x00404638

Reimplemented in SynthPS2.

◆ SetMono() [2/2]

virtual void Synth::SetMono ( bool bMono)
virtual

Vtable slot 22.

Choose mono output.

The base body is empty. The name is inferred.

Parameters
bMonoWhether the output is mono.
Ghidra address:
NTSC-U/C: 0x00395fc0
Ghidra address:
PAL: 0x00404640

Reimplemented in SynthPS2.

◆ SetLag()

virtual void Synth::SetLag ( float fLag)
virtual

Vtable slot 23.

Set the lag of the output, the value of the lag_ms entry of the synth section.

The base body is empty. The name is inferred.

Parameters
fLagThe lag in milliseconds.
Ghidra address:
NTSC-U/C: 0x00395fc8
Ghidra address:
PAL: 0x00404648

Reimplemented in SynthPS2.

◆ GetLag()

virtual float Synth::GetLag ( )
virtual

Vtable slot 24.

Report the lag slot 23 set.

The base body returns 0. The name is inferred.

Returns
The lag in milliseconds.
Ghidra address:
NTSC-U/C: 0x00395fd0
Ghidra address:
PAL: 0x00404650

Reimplemented in SynthPS2.

◆ SetSoftFxSweep()

virtual void Synth::SetSoftFxSweep ( float fPosition)
virtual

Vtable slot 25.

Set the position of the sweep of a sweeping software filter.

The base body is empty. SynthPS2 records the position for the filter types that sweep and reports any other type. The name is inferred.

Parameters
fPositionThe position, 1 for the top of the sweep.
Ghidra address:
NTSC-U/C: 0x00395fe0
Ghidra address:
PAL: 0x00404660

Reimplemented in SynthPS2.

◆ SetSoftFxModulation()

virtual void Synth::SetSoftFxModulation ( float fValue)
virtual

Vtable slot 26.

Set the second control of the software effect.

The base body is empty. AxeVoice passes the vertical position of the stick. The name is inferred.

Parameters
fValueThe value, from -1 to 1.
Ghidra address:
NTSC-U/C: 0x00395fe8
Ghidra address:
PAL: 0x00404668

Reimplemented in SynthPS2.

◆ SetSoftFxFilter()

virtual void Synth::SetSoftFxFilter ( const SoftFxFilter & filter)
virtual

Vtable slot 27.

Send the settings of the software effect.

The base body is empty. The name is inferred.

Parameters
filterThe settings.
Ghidra address:
NTSC-U/C: 0x00395ff0
Ghidra address:
PAL: 0x00404670

Reimplemented in SynthPS2.

◆ EnableSoftFx()

virtual int Synth::EnableSoftFx ( )
pure virtual

Vtable slot 28.

Queue a job that turns the software effects on.

The member is pure in this class. SynthPS2 returns 0. The name is inferred.

Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ DisableSoftFx()

virtual int Synth::DisableSoftFx ( )
pure virtual

Vtable slot 29.

Queue a job that turns the software effects off.

The member is pure in this class. SynthPS2 returns 0. The name is inferred.

Returns
0.

Implemented in SynthNull, and SynthPS2.

◆ SetOutputLevel()

virtual void Synth::SetOutputLevel ( float fLevel)
virtual

Vtable slot 30.

Set the output level that slot 31 reports.

The base body is empty. SynthPS2 scales the level by 16383 and sends it to the software effect. The name is inferred.

Parameters
fLevelThe level, 1 for full.
Ghidra address:
NTSC-U/C: 0x00395ff8
Ghidra address:
PAL: 0x00404678

Reimplemented in SynthPS2.

◆ GetOutputLevel()

virtual float Synth::GetOutputLevel ( )
virtual

Vtable slot 31.

Report the output level.

The base body returns 1. The name is inferred.

Returns
The level, 1 for full.
Ghidra address:
NTSC-U/C: 0x00396000
Ghidra address:
PAL: 0x00404680

Reimplemented in SynthPS2.

◆ SetSoftFxInput()

virtual void Synth::SetSoftFxInput ( int nInput)
virtual

Vtable slot 32.

Choose the mixer input of the sound processor that the software effect captures.

The base body is empty. The metagame passes 1 before it plays the intro movie. The name is inferred.

Parameters
nInputThe input pair, 0 to 2.
Ghidra address:
NTSC-U/C: 0x00396010
Ghidra address:
PAL: 0x00404690

Reimplemented in SynthPS2.

◆ SetBusToCoreFx()

virtual void Synth::SetBusToCoreFx ( int nOn)
virtual

Vtable slot 33.

Set whether the effect buses feed the hardware effects.

The base body is empty. The name is inferred.

Parameters
nOnWhether the buses feed the hardware effects.
Ghidra address:
NTSC-U/C: 0x00396018
Ghidra address:
PAL: 0x00404698

Reimplemented in SynthPS2.

◆ SetBusToSoftFx()

virtual void Synth::SetBusToSoftFx ( int nOn)
virtual

Vtable slot 34.

Set whether the effect buses feed the software effect.

The base body is empty, and SynthPS2 overrides it with an empty body. The name is inferred.

Parameters
nOnWhether the buses feed the software effect.
Ghidra address:
NTSC-U/C: 0x00396020
Ghidra address:
PAL: 0x004046a0

Reimplemented in SynthPS2.

◆ VirtualSlot35()

virtual void Synth::VirtualSlot35 ( )
virtual

Vtable slot 35.

The base body is empty, and the purpose is not yet recovered.

Ghidra address:
NTSC-U/C: 0x00396028
Ghidra address:
PAL: 0x004046a8

◆ SendMessages()

virtual void Synth::SendMessages ( const std::vector< unsigned int > & messages)
virtual

Vtable slot 36.

Queue a job that sends packed messages.

The base body is empty. The name is inferred.

Parameters
messagesThe messages, each packed as SendPackedMessage() takes it.
Ghidra address:
NTSC-U/C: 0x00396030
Ghidra address:
PAL: 0x004046b0

Reimplemented in SynthPS2.

◆ QueueCallback()

virtual void Synth::QueueCallback ( Callback pfnCallback,
int nArg )
virtual

Vtable slot 37.

Queue a job that calls a routine once the jobs before it have run.

The base body is empty. The name is inferred.

Parameters
pfnCallbackThe routine.
nArgThe argument passed to the routine.
Ghidra address:
NTSC-U/C: 0x00396038
Ghidra address:
PAL: 0x004046b8

Reimplemented in SynthPS2.

Member Data Documentation

◆ kNumChannels

int Synth::kNumChannels = 16
staticconstexpr

MIDI channels.

◆ kNumCores

int Synth::kNumCores = 2
staticconstexpr

SPU2 cores.

◆ kVoicesPerCore

int Synth::kVoicesPerCore = 24
staticconstexpr

Voices of each core.

◆ kMaxRetiredVoices

int Synth::kMaxRetiredVoices = 50
staticconstexpr

Retired voice records.

◆ sNotifyAddress

void* Synth::sNotifyAddress
static

EE address a transfer notification goes to.

◆ sNotifyPending

int Synth::sNotifyPending
static

Nonzero while a transfer notification waits.

◆ sEffectNotifyAddress

void* Synth::sEffectNotifyAddress
static

EE address a reverb notification goes to.

◆ sEffectNotifyPending

int Synth::sEffectNotifyPending
static

Nonzero while a reverb notification waits.

◆ sEffectThreadId

int Synth::sEffectThreadId
static

The reverb thread.

◆ sInitFlag

unsigned char Synth::sInitFlag
static

Flag the EE sends at initialisation; unused.

◆ sChannels

Channel Synth::sChannels[kNumChannels]
static

The MIDI channels.


The documentation for this class was generated from the following files: