78 :
Ramp(pScheduler, fValue), mChannel(nChannel) {
89 void Apply(
float fValue,
int nTick)
override;
92 unsigned char mChannel;
132 void Init(
int nTracks,
int nInstrument);
152 void SetVolumes(
int nChannel,
const std::vector<unsigned char> &volumes);
257 void SetVolume(
int nChannel,
unsigned char nVolume,
int nTicks);
299 ReadVolumes(
const DataArray *pConfig,
const char *pszKey, std::vector<unsigned char> &volumes);
310 static int ReadInt(
const char *pszKey,
const DataArray *pConfig);
321 static unsigned char ReadByte(
const char *pszKey,
const DataArray *pConfig);
335 void ApplyVolume(
int nChannel,
const std::vector<unsigned char> &volumes,
int nTicks);
345 void RefreshTrack(
int nChannel,
int nTicks);
348 std::vector<TrackData> mTracks;
349 unsigned char mHighVolume;
351 std::vector<unsigned char> mInstrumentVolumes;
352 unsigned char mVictoryLapVolume;
355 int mHasInstrumentTrack;
Reference-counted array of script data nodes.
Definition dataarray.h:20
~VolumeRamp() override=default
Destroy the object.
void Apply(float fValue, int nTick) override
Send a volume to the channel as MIDI controller 17.
VolumeRamp(Scheduler *pScheduler, float fValue, unsigned char nChannel)
Construct a ramp at full volume for a channel.
Definition mixer.h:77
Volume control of the song's tracks.
Definition mixer.h:23
void RefreshAll(int nTicks)
Move every channel to the volume its track's state selects.
static constexpr int kFxChannel
The channel of the effects.
Definition mixer.h:44
void Init(int nTracks, int nInstrument)
Set the mixer up for a song and read the "mixer" section of the configuration.
void FadeOut(int nTicks)
Fade every track but the effects to silence.
static constexpr int kChannelCount
The number of synthesiser channels the mixer controls.
Definition mixer.h:41
void Deactivate()
Stop following the players, unregister the cheat, and return every track to full volume.
void Activate()
Start following the players and register the track_solo cheat.
static void ToggleMuteUnoccupied(DataArray *pCommand, void *pUserData)
Toggle muting the tracks nobody is on, the track_solo script command.
Instrument
The instrument tracks Init() configures the mixer for.
Definition mixer.h:34
@ kInstrumentAxe
Definition mixer.h:36
@ kInstrumentNone
Definition mixer.h:35
@ kInstrumentScratch
Definition mixer.h:37
unsigned char GetVolume(int nChannel)
Report a channel's volume.
static Mixer * shared()
Report the single instance, constructing it on first use.
void SetVolumes(int nChannel, const std::vector< unsigned char > &volumes)
Replace a channel's volume list.
~Mixer()
Destroy the ramps.
void RemovePlayer(int nTrack)
Count one player fewer on a track and refresh the track's volume.
void HoldTrack(int nTrack, int nUntilTick)
Hold a track until the tick before a song tick, and refresh every other channel.
void SetVolume(int nChannel, unsigned char nVolume, int nTicks)
Move a channel to a volume.
void SetInstrumentVolumes(const std::vector< unsigned char > &volumes)
Replace the volume list the other tracks use while the instrument track is occupied.
bool IsInstrumentTrack(int nTrack) const
Report whether a track is the instrument track.
void PlayFullMix()
Play every track but the effects at mHighVolume.
void StartVictoryLap()
Move every channel to the victory lap volume, and an occupied instrument track to mHighVolume,...
Mode
What the mixer is doing, the values of mMode.
Definition mixer.h:26
@ kModePlaying
Definition mixer.h:28
@ kModeOff
Definition mixer.h:27
@ kModeVictoryLap
Definition mixer.h:30
@ kModeFullMix
Definition mixer.h:29
void ReleaseTrack(int nTrack)
End the hold on a track and refresh every channel.
Mixer()
Construct a mixer with no tracks and one ramp per channel.
void AddPlayer(int nTrack)
Count one more player on a track and refresh the track's volume.
Owner of one reference to an Attachment.
Definition ptr.h:16
Ramp(Scheduler *pScheduler, float fValue)
Construct a ramp that holds a value.
Queue of commands that run when the song clock reaches their tick.
Definition scheduler.h:20
Mixer * TheMixer
The track mixer, Mixer::shared() as the unit's static initialiser stored it.
The state of one of the song's tracks.
Definition mixer.h:47
int mHeld
Definition mixer.h:49
Ptr< Command > mReleaseCommand
Definition mixer.h:50
int mPlayers
Definition mixer.h:48