24 #ifndef TINSEL_MUSIC_H 25 #define TINSEL_MUSIC_H 27 #include "audio/midiplayer.h" 28 #include "audio/audiostream.h" 29 #include "audio/mixer.h" 30 #include "common/mutex.h" 38 Music() : _currentMidi(0), _currentLoop(
false) {
39 _midiBuffer.pDat =
nullptr;
43 bool PlayMidiSequence(
57 void DeleteMidiBuffer();
59 void CurrentMidiFacts(
SCNHANDLE *pMidi,
bool *pLoop);
63 SCNHANDLE GetTrackOffset(
int trackNumber);
65 uint8 *GetMidiBuffer() {
return _midiBuffer.pDat; }
67 uint8* ResizeMidiBuffer(uint32 newSize) {
68 if (_midiBuffer.size < newSize) {
69 _midiBuffer.pDat = (byte*)realloc(_midiBuffer.pDat, newSize);
70 assert(_midiBuffer.pDat);
73 return _midiBuffer.pDat;
86 SOUND_BUFFER _midiBuffer;
99 void setVolume(
int volume)
override;
101 void playMIDI(uint32 size,
bool loop);
104 void pause()
override;
105 void resume()
override;
108 void send(uint32 b)
override;
112 uint32 getBaseTempo() {
return _driver ? (109 * _driver->getBaseTempo()) / 120 : 0; }
114 bool _milesAudioMode;
117 void playXMIDI(uint32 size,
bool loop);
118 void playSEQ(uint32 size,
bool loop);
126 bool isPlaying()
const;
128 bool isDimmed()
const;
130 void getTunePlaying(
void *voidPtr,
int length);
131 void restoreThatTune(
void *voidPtr);
133 void setMusicSceneDetails(
SCNHANDLE hScript,
SCNHANDLE hSegment,
const char *fileName);
135 void setVolume(
int volume);
137 void startPlay(
int id);
140 bool getMusicTinselDimmed()
const;
141 void dim(
bool bTinselDim);
142 void unDim(
bool bTinselUnDim);
145 void startFadeOut(
int ticks);
146 void fadeOutIteration();
148 int readBuffer(int16 *buffer,
const int numSamples)
override;
149 bool isStereo()
const override;
152 int getRate()
const override;
174 State _state, _mState;
191 uint8 _fadeOutVolume;
192 int _fadeOutIteration;
196 void setVol(uint8 volume);
200 void loadMusicFromSegment(
int segmentNum);
201 void loadADPCMMusicFromSegment(
int segmentNum);
202 void loadMP3MusicFromSegment(
int segmentNum);
Definition: midiplayer.h:63
uint32 SCNHANDLE
Definition: dw.h:31
bool endOfStream() const override
Definition: music.h:151
Definition: audiostream.h:50
bool endOfData() const override
Definition: music.h:150
Definition: midiparser.h:289