|
resonance 1.0.1
|
Player that sounds one note for a fixed length and then releases it. More...
#include <noteplayer.h>


Public Member Functions | |
| NotePlayer (unsigned char nNote, unsigned char nVelocity, int nDuration, unsigned char nChannel, MuseParent *pParent, Sch::TickClock *pClock) | |
| Retain the note and shorten its length by two ticks, keeping at least one. | |
| virtual | ~NotePlayer () |
| Stop the note through this class's Stop(). | |
| virtual void | Start (MsgSink *pSink) |
| Send the note-on to a sink and schedule the note-off. | |
| virtual void | Stop () |
| Send the note-off now and withdraw the scheduled command, when the note is sounding. | |
| virtual int | DisplacesSiblings () |
| void | OnCommand (int nTick) |
| Send the note-off at a song position and report the player finished to mParent. | |
| Public Member Functions inherited from MusePlayer | |
| void * | operator new (size_t nSize) |
| Allocate a player from the untagged heap. | |
| void | operator delete (void *pBlock) |
| Release a player to the untagged heap. | |
| MusePlayer () | |
| Construct a player with the next serial number. | |
| virtual | ~MusePlayer () |
| Inline. | |
Player that sounds one note for a fixed length and then releases it.
It has MusePlayer as its one base. Its table at 0x007e17b8 runs the type function, the destructor, and the three MusePlayer verbs. MuseSynth::StartNotePlayer() measures the object at 0x20 bytes. That routine passes a NoteMsg's bytes at +0x09, +0x0a, and +0x08, its word at +0x0c, the MuseParent half of the synth, and the synth's clock.
Start() sends the note-on and schedules the file-local command Cmd of GsNotePlayer.cpp (Q233_GLOBAL_$N$GsNotePlayer.cppdKuhgb3Cmd in the RTTI) at the end of the note. That command runs OnCommand(), which sends the note-off and reports the player finished to its parent. Stop() sends the note-off early and withdraws the command.
The note-on and note-off are StdMidiMsg objects built on the stack and delivered through MsgSink::Dispatch() on mSink.
| NotePlayer::NotePlayer | ( | unsigned char | nNote, |
| unsigned char | nVelocity, | ||
| int | nDuration, | ||
| unsigned char | nChannel, | ||
| MuseParent * | pParent, | ||
| Sch::TickClock * | pClock ) |
Retain the note and shorten its length by two ticks, keeping at least one.
| nNote | The MIDI note number. |
| nVelocity | The note-on velocity. |
| nDuration | The length of the note, in MIDI ticks. |
| nChannel | The MIDI channel. Only the low four bits are kept. |
| pParent | The owner the player reports to. |
| pClock | The clock the note-off is scheduled against. |
|
virtual |
Stop the note through this class's Stop().
|
virtual |
Send the note-on to a sink and schedule the note-off.
mParent is told to retain this player alone before the note-on is sent.
| pSink | The sink both messages go to. |
Implements MusePlayer.
|
virtual |
Send the note-off now and withdraw the scheduled command, when the note is sounding.
The note-off is a StdMidiMsg with status 0x80 ORed with mChannel, mNote, and velocity 0 at the current song position. mSink is cleared whether or not the note was sounding.
Implements MusePlayer.
|
virtual |
Implements MusePlayer.
| void NotePlayer::OnCommand | ( | int | nTick | ) |
Send the note-off at a song position and report the player finished to mParent.
The file-local Cmd runs it. mSink is cleared between the two steps.
| nTick | The song position the command was scheduled for. |