resonance 1.0.1
Loading...
Searching...
No Matches
BGTrackGraph Class Reference

Audio graph of one background track. More...

#include <bgtrackgraph.h>

Public Member Functions

void * operator new (size_t nSize)
 Allocate a graph from the tagged heap under the tag "BGTrackGraph".
void operator delete (void *pBlock)
 Release a graph to the tagged heap.
 BGTrackGraph (int nTrack, int nUnmapped)
 Build the synthesiser and the MIDI filter, and connect the filter to the synthesiser.
 ~BGTrackGraph ()
 Delete the sequencer, the filter, the synthesiser, and the mixer.
void BuildSequencer ()
 Build the track's sequencer and start it.
void CreateMixer (TrackData *pTrack)
 Record the track and build its mixer on the track's MIDI channel.
void AttachMixerToSource (MsgSource *pSource)
 Register the mixer as a sink of a source.
void AttachMixerToSynth (MsgSink *pSynth)
 Feed the synthesiser's output to the mixer and the mixer's output to a synthesiser sink.
void AddSynthSink (MsgSink *pSink)
 Register a sink with the synthesiser.
void Stop ()
 Delete the sequencer, if any.
void EnableMidi ()
 Let the track's notes reach the synthesiser.
void DisableMidi ()
 Stop the track's notes reaching the synthesiser.
int CallBuildSequencer ()
 Run BuildSequencer() and report zero.
int CallDeleteSequencer ()
 Run Stop() and report zero.

Static Public Member Functions

static void Delete (BGTrackGraph *pGraph)
 Delete a graph, which may be null.

Detailed Description

Audio graph of one background track.

The class is not polymorphic and has no RTTI. The title comes from the literal BGTrackGraph that RndWorld's draw pass allocates the object under at 0x0018cf5c and that the destructor frees it under. Its unit spans 0x0013fb10 through 0x00140578, and RndWorld's draw pass constructs one per background track.

The track's MIDI runs from the sequencer through a MidiDisabler into a MuseSynth, whose players feed a Mixer. Gamer switches the MidiDisabler bar by bar.

Constructor & Destructor Documentation

◆ BGTrackGraph()

BGTrackGraph::BGTrackGraph ( int nTrack,
int nUnmapped )

Build the synthesiser and the MIDI filter, and connect the filter to the synthesiser.

The filter starts passing notes. The sequencer and the mixer are created later.

Parameters
nTrackThe track's index.
nUnmappedThe value the sequencer receives as BarSequencer's nUnmapped.
Ghidra address:
NTSC-U/C: 0x0013fb10
Ghidra address:
PAL: 0x001404f0

◆ ~BGTrackGraph()

BGTrackGraph::~BGTrackGraph ( )

Delete the sequencer, the filter, the synthesiser, and the mixer.

Ghidra address:
NTSC-U/C: 0x00140338
Ghidra address:
PAL: 0x00140d18

Member Function Documentation

◆ operator new()

void * BGTrackGraph::operator new ( size_t nSize)

Allocate a graph from the tagged heap under the tag "BGTrackGraph".

No out-of-line body exists. GrooveWorld::BuildGraphs() at 0x0018cce8 inlines the call.

Parameters
nSizeThe object size the compiler supplies.
Returns
The block.

◆ operator delete()

void BGTrackGraph::operator delete ( void * pBlock)

Release a graph to the tagged heap.

No out-of-line body exists. The destructor's release branch inlines the call.

Parameters
pBlockThe block.

◆ BuildSequencer()

void BGTrackGraph::BuildSequencer ( )

Build the track's sequencer and start it.

Replays the controller state every bar of the track's MIDI leaves behind into the synthesiser through a MidiChase, then creates a BarSequencer on the song clock that sends through the filter and starts it. The title is inferred.

Ghidra address:
NTSC-U/C: 0x0013fc48
Ghidra address:
PAL: 0x00140628

◆ CreateMixer()

void BGTrackGraph::CreateMixer ( TrackData * pTrack)

Record the track and build its mixer on the track's MIDI channel.

Parameters
pTrackThe track.
Ghidra address:
NTSC-U/C: 0x001403e0
Ghidra address:
PAL: 0x00140dc0

◆ AttachMixerToSource()

void BGTrackGraph::AttachMixerToSource ( MsgSource * pSource)

Register the mixer as a sink of a source.

Parameters
pSourceThe source.
Ghidra address:
NTSC-U/C: 0x00140468
Ghidra address:
PAL: 0x00140e48

◆ AttachMixerToSynth()

void BGTrackGraph::AttachMixerToSynth ( MsgSink * pSynth)

Feed the synthesiser's output to the mixer and the mixer's output to a synthesiser sink.

Parameters
pSynthThe sink the mixer emits to.
Ghidra address:
NTSC-U/C: 0x00140498
Ghidra address:
PAL: 0x00140e78

◆ AddSynthSink()

void BGTrackGraph::AddSynthSink ( MsgSink * pSink)

Register a sink with the synthesiser.

Parameters
pSinkThe sink.
Ghidra address:
NTSC-U/C: 0x001404d8
Ghidra address:
PAL: 0x00140eb8

◆ Stop()

void BGTrackGraph::Stop ( )

Delete the sequencer, if any.

Ghidra address:
NTSC-U/C: 0x001404f8
Ghidra address:
PAL: 0x00140ed8

◆ EnableMidi()

void BGTrackGraph::EnableMidi ( )

Let the track's notes reach the synthesiser.

Calls MidiDisabler::Enable(). Gamer's per-bar update calls it when its background enable manager reports the bar for the track, and DisableMidi() otherwise.

Ghidra address:
NTSC-U/C: 0x00140540
Ghidra address:
PAL: 0x00140f20

◆ DisableMidi()

void BGTrackGraph::DisableMidi ( )

Stop the track's notes reaching the synthesiser.

Calls MidiDisabler::Disable(), which also silences the notes already sounding.

Ghidra address:
NTSC-U/C: 0x00140560
Ghidra address:
PAL: 0x00140f40

◆ CallBuildSequencer()

int BGTrackGraph::CallBuildSequencer ( )
inline

Run BuildSequencer() and report zero.

Inline. GrooveWorld::StartSequencers() reaches it through a pointer to member, and the address is its uncalled out-of-line copy in the GrooveWorld unit.

Returns
Always 0.
Ghidra address:
NTSC-U/C: 0x00193ff8
Ghidra address:
PAL: 0x00199c30

◆ CallDeleteSequencer()

int BGTrackGraph::CallDeleteSequencer ( )
inline

Run Stop() and report zero.

Inline. GrooveWorld::StartSequencers() and FinishSong() reach it through a pointer to member, and the address is its uncalled out-of-line copy in the GrooveWorld unit.

Returns
Always 0.
Ghidra address:
NTSC-U/C: 0x00194018
Ghidra address:
PAL: 0x00199c50

◆ Delete()

void BGTrackGraph::Delete ( BGTrackGraph * pGraph)
inlinestatic

Delete a graph, which may be null.

Inline. GrooveWorld::DestroyGraphs() passes it to std::for_each, and the out-of-line copy sits in the GrooveWorld unit.

Parameters
pGraphThe graph.
Ghidra address:
NTSC-U/C: 0x00194038
Ghidra address:
PAL: 0x00199c70

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