wavelength 1.0.0
Loading...
Searching...
No Matches
backmusic.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <vector>
5
6#include "game/playmap.h"
7#include "gs/muse.h"
8#include "os/command.h"
9#include "os/mem.h"
10#include "os/ptr.h"
11#include "os/string.h"
12
20class BackMusic {
21public:
28 static void *operator new(size_t nSize) {
29 return PoolMemAlloc(static_cast<int>(nSize), "BackMusic", 0);
30 }
31
37 static void operator delete(void *pBlock) {
38 PoolMemFree(pBlock);
39 }
40
51 BackMusic(const char *pszName, int nIntroBars, int nNumBars, int nTicksPerBar);
52
60
68 const char *GetName() const;
69
78 void SetBar(int nBar, Muse *pMuse);
79
87 void Start(PlayMap *pPlayMap);
88
95 void Stop();
96
97private:
104 void PlayBar();
105
106 String mName;
107 std::vector<Ptr<Muse> > mBars;
108 Ptr<Command> mBarCommand;
109 Muse *mPlaying;
110 int mIntroBars;
111 int mNumBars;
112 int mTicksPerBar;
113 PlayMap *mPlayMap;
114};
void Start(PlayMap *pPlayMap)
Start the music by itself, unless it plays.
BackMusic(const char *pszName, int nIntroBars, int nNumBars, int nTicksPerBar)
Construct music with no muse for any bar.
const char * GetName() const
Report the name of the track.
void Stop()
Stop the music, if it plays.
void SetBar(int nBar, Muse *pMuse)
Set the muse of a bar.
~BackMusic()
Stop the music and release it.
Piece of MIDI performance that a Scheduler plays.
Definition muse.h:12
Map from the bars a song plays to the bars of the song as written, with the loops that repeat stretch...
Definition playmap.h:11
Owner of one reference to an Attachment.
Definition ptr.h:16
Growable text buffer that is also a PrnStream.
Definition string.h:19
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.