resonance 1.0.1
Loading...
Searching...
No Matches
notemsg.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4
5#include "mid/tick.h"
6#include "msg/musemsg.h"
7
8class IBStream;
9class OBStream;
10
28class NoteMsg : public MuseMsg {
29public:
36 static unsigned int sID;
37
45 }
46
59 NoteMsg(int nTick,
60 unsigned char nChannel,
61 unsigned char nNote,
62 unsigned char nVelocity,
63 Sch::Tick length)
64 : MuseMsg(nTick), mChannel(nChannel), mNote(nNote), mVelocity(nVelocity), mLength(length) {
65 }
66
76 static Message *New();
77
85 virtual Message *Clone();
86
94 virtual int Type();
95
103 virtual const char *GetName() const;
104
115 virtual void PrintExtra(std::ostream &stream) const;
116
127 virtual void saveGuts(OBStream &stream) const;
128
138 virtual void restoreGuts(IBStream &stream);
139
145 unsigned char mChannel;
146
153 unsigned char mNote;
154
160 unsigned char mVelocity;
161
169};
Input half of the byte stream interface.
Definition ibstream.h:36
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
MuseMsg()
Start the song position at kTickInfinity.
Definition musemsg.h:38
virtual Message * Clone()
Produce a heap copy of this message.
NoteMsg()
Construct a message with the position and the length at kTickInfinity.
Definition notemsg.h:44
virtual int Type()
Report this message's registered identity.
unsigned char mChannel
The MIDI channel.
Definition notemsg.h:145
virtual void restoreGuts(IBStream &stream)
Read the three bytes and the second position back from a stream.
static Message * New()
Produce a default-constructed message on the heap.
NoteMsg(int nTick, unsigned char nChannel, unsigned char nNote, unsigned char nVelocity, Sch::Tick length)
Report one note.
Definition notemsg.h:59
virtual void saveGuts(OBStream &stream) const
Write the three bytes and the low sixteen bits of the second position to a stream.
static unsigned int sID
Identity that Type() reports.
Definition notemsg.h:36
virtual const char * GetName() const
Report this message's class name.
virtual void PrintExtra(std::ostream &stream) const
Write the message to a diagnostic stream.
unsigned char mNote
The note number.
Definition notemsg.h:153
Sch::Tick mLength
The length of the note, in MIDI ticks.
Definition notemsg.h:168
unsigned char mVelocity
The note-on velocity.
Definition notemsg.h:160
Output half of the byte stream interface.
Definition obstream.h:25
Song position in MIDI ticks, printed as measure, beat, and tick.
Definition tick.h:70