resonance 1.0.1
Loading...
Searching...
No Matches
mixer.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "app/msgsink.h"
6#include "msg/message.h"
7#include "msg/stdmidimsg.h"
8
9class MsgSource;
10class Player;
11class TrackSelectMsg;
12class TracksOnMsg;
13
32class Mixer : public MsgSink {
33public:
47 Mixer(int nTrack, unsigned char nChannel);
48
53 virtual ~Mixer();
54
70 void SetGainFactor(int nIndex, unsigned char nFactor);
71
82 void SetMuted(int bMuted);
83
101
112 void SendPan();
113
121
122protected:
135
147
161
171 virtual void DispatchPriv(Message *pMsg);
172
173private:
174 unsigned char mChannel; // +0x08
175 int mTrack; // +0x0c the constructor's first argument
176 // Read from configuration code 0x399 (the script template `level_boost_volume`) as one byte.
177 // No recovered routine reads it back.
178 unsigned char mBoostVolume; // +0x10
179 // Whether the mixer generates the pan itself, read from configuration code 0x398. Two readers
180 // agree on the sense. OnTrackSelect() sends the pan only when it is set, and an incoming pan
181 // controller is discarded only when it is set.
182 int mOwnsPan; // +0x14
183 // Section the pan index is measured against.
184 int mLastSection; // +0x18
185 // The player of the selected track, NullPlayer::sInstance until OnTrackSelect() installs one.
186 Player *mSelection; // +0x1c
187 // Combined gain most recently sent as controller 11. The constructor sets it to 127.
188 unsigned char mLevel; // +0x20
189 // Sixteen bytes the constructor zeroes twice over, once before the configuration reads and
190 // once after. No recovered routine reads any of them.
191 unsigned char mZeroedBytes[16]; // +0x28
192 // Whether the channel is muted. SetGainFactor() computes the level but does not send it while
193 // this is set, and SetMuted() sends zero on the way in and mLevel on the way out.
194 int mMuted; // +0x38
195 // The four gain factors, each 0 through 127 and each set to 127 by the constructor.
196 // SetGainFactor() multiplies all four and divides by 127 cubed to produce mLevel.
197 unsigned char mGainFactors[4]; // +0x3c
198 int mLevelIndex; // +0x40 index into mTrackLevels, taken from a TracksOnMsg
199 // Per-track levels, read from configuration code 0x39f by the constructor.
200 std::vector<int> mTrackLevels; // +0x44
201 int mTracksOnBar; // +0x50 set to -1 by the constructor, then a TracksOnMsg's bar
202 // PlayMap::GetEndBar() of the play map, the bar count the game measures progress against, read
203 // once by the constructor. No recovered routine reads it back.
204 int mEndBar; // +0x54
205};
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
void SendPan()
Send the pan for the current section.
virtual void DispatchPriv(Message *pMsg)
Act on a message.
void OnTracksOn(TracksOnMsg *pMsg)
React to a TracksOnMsg.
void SetMuted(int bMuted)
Mute or unmute the channel.
MsgSink * mOutput
The sink every message this mixer emits is sent to.
Definition mixer.h:120
Mixer(int nTrack, unsigned char nChannel)
Construct a mixer on one channel.
void SetGainFactor(int nIndex, unsigned char nFactor)
Set one of the four gain factors and send the combined level.
void OnTrackSelect(TrackSelectMsg *pMsg)
React to a TrackSelectMsg.
void RecomputeGain()
Recompute the gain from the game state and send it as gain factor 3.
virtual ~Mixer()
void ApplyControlChange(StdMidiMsg *pMsg)
Act on one control-change message.
Receiver of engine messages.
Definition msgsink.h:37
Sender of engine messages, which stores the list of sinks that receive them.
Definition msgsource.h:26
One participant in a session, local or remote.
Definition player.h:39
Event the game passes between a MsgSource and a MsgSink.
Definition stdmidimsg.h:27
Event the game passes between a MsgSource and a MsgSink.
Definition trackselectmsg.h:24
Event the game passes between a MsgSource and a MsgSink.
Definition tracksonmsg.h:18