wavelength 1.0.0
Loading...
Searching...
No Matches
mix.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <memory>
5#include <vector>
6
7#include "gs/muse.h"
8#include "met/mixtrack.h"
9#include "os/command.h"
10#include "os/ptr.h"
11#include "os/string.h"
12
22class Mix {
23public:
25 static constexpr int kNumMixes = 10;
26
28 static constexpr int kNoMix = -1;
29
39 Mix();
40
48
58 void AddTrack(Muse *pMuse, unsigned char nChannel, const String &name);
59
68 void SetMixTracks(int nMix, const std::vector<String> &names);
69
77 void ChangeMix(int nMix);
78
87 void SwitchMix(int nMix, int nFadeTicks);
88
95 void EnterTube();
96
105 void ExitTube(bool bSpeedingUp);
106
114 void Start(int nMix);
115
123
132 void FadeOutMix(int nMix, int nFadeTicks);
133
142 void FadeInMix(int nMix, int nFadeTicks);
143
150 void Stop();
151
152private:
153 int mLoopTicks;
154 int mFadeTicks;
155 int mStartTick;
156 std::vector<std::vector<String> > mMixes;
157 std::map<String, std::unique_ptr<MixTrack> > mTracks;
158 int mMix;
159 Ptr<Command> mStopCmd;
160};
Mix()
Build the music with no tracks and no mix.
void SwitchMix(int nMix, int nFadeTicks)
Switch to a mix unless it already plays, fading out the tracks of the current mix.
void EnterTube()
Start the sound effect of the tube the camera flies through.
void ChangeMix(int nMix)
Switch to a mix with a fade of music_fade_ticks.
void AddTrack(Muse *pMuse, unsigned char nChannel, const String &name)
Add a track under a name.
void Start(int nMix)
Start the music at the last bar of the front-end clock with a mix, at full volume.
static constexpr int kNoMix
The value of mMix before any mix plays.
Definition mix.h:28
void SetMixTracks(int nMix, const std::vector< String > &names)
Set the names of the tracks of a mix.
void ExitTube(bool bSpeedingUp)
Stop the sound effect of the tube.
void StopTracks()
Withdraw the scheduled stop and stop every track at once.
void FadeOutMix(int nMix, int nFadeTicks)
Fade out the tracks of a mix.
static constexpr int kNumMixes
The number of mixes of a menu song.
Definition mix.h:25
~Mix()
Stop the tracks and release them.
void Stop()
Fade every track out over one bar and stop the music after it.
void FadeInMix(int nMix, int nFadeTicks)
Fade in the tracks of a mix at the current position of the loop.
Piece of MIDI performance that a Scheduler plays.
Definition muse.h:12
Owner of one reference to an Attachment.
Definition ptr.h:16
Growable text buffer that is also a PrnStream.
Definition string.h:19