resonance 1.0.1
Loading...
Searching...
No Matches
noteplayer.h
Go to the documentation of this file.
1#pragma once
2
3#include "app/msgsink.h"
4#include "gs/museparent.h"
5#include "gs/museplayer.h"
6#include "sch/cmdid.h"
7#include "sch/tickclock.h"
8
25class NotePlayer : public MusePlayer {
26public:
39 NotePlayer(unsigned char nNote,
40 unsigned char nVelocity,
41 int nDuration,
42 unsigned char nChannel,
43 MuseParent *pParent,
44 Sch::TickClock *pClock);
45
52 virtual ~NotePlayer();
53
63 virtual void Start(MsgSink *pSink);
64
74 virtual void Stop();
75
81 virtual int DisplacesSiblings();
82
92 void OnCommand(int nTick);
93
94private:
102 void NoteOn(int nTick);
103
104 unsigned char mNote; // +0x08
105 unsigned char mVelocity; // +0x09
106 unsigned char mChannel; // +0x0a
107 int mDuration; // +0x0c
108 MsgSink *mSink; // +0x10, set by Start() and cleared when the note ends
109 MuseParent *mParent; // +0x14
110 Sch::TickClock *mClock; // +0x18
111 Sch::CmdID mCommand; // +0x1c
112};
Receiver of engine messages.
Definition msgsink.h:37
Owner a MusePlayer reports back to.
Definition museparent.h:18
MusePlayer()
Construct a player with the next serial number.
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.
void OnCommand(int nTick)
Send the note-off at a song position and report the player finished to mParent.
virtual int DisplacesSiblings()
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 ~NotePlayer()
Stop the note through this class's Stop().
Handle that identifies one batch of commands the scheduler has queued.
Definition cmdid.h:35
Pausable view of scheduler time, together with the tempo that maps it to a song position.
Definition tickclock.h:40