22 #ifndef SCI_SOUND_MUSIC_H 23 #define SCI_SOUND_MUSIC_H 25 #include "common/serializer.h" 26 #include "common/mutex.h" 28 #include "audio/mixer.h" 31 #include "sci/resource/resource.h" 32 #include "sci/sound/drivers/mididriver.h" 34 #include "sci/sound/audio32.h" 38 class LoopingAudioStream;
39 class RewindableAudioStream;
46 kSoundInitialized = 1,
51 #define MUSIC_VOLUME_DEFAULT 127 52 #define MUSIC_VOLUME_MAX 127 53 #define MUSIC_MASTERVOLUME_DEFAULT 15 54 #define MUSIC_MASTERVOLUME_MAX 15 95 bool overridePriority;
98 uint sampleLoopCounter;
103 uint32 fadeTickerStep;
106 bool stopAfterFading;
112 int _usedChannels[16];
119 SignalQueue signalQueue;
134 void setSignal(
int signal);
142 bool operator==(
const DeviceChannelUsage& other)
const {
return _song == other._song && _channel == other._channel; }
154 void swap(
int i,
int j);
157 int lowestPrio()
const;
162 kTypeMidiMessage = 0,
166 MidiCommand(CmdType type, uint32 val) : _type(type), _dataPtr(0), _dataVal(val) {}
167 MidiCommand(CmdType type,
void *ptr) : _type(type), _dataPtr(ptr), _dataVal(0) {}
185 void putMidiCommandInQueue(byte status, byte firstOp, byte secondOp);
186 void putMidiCommandInQueue(uint32 midi);
187 void putTrackInitCommandInQueue(
MusicEntry *psnd);
188 void removeTrackInitCommandsFromQueue(
MusicEntry *psnd);
190 static void miditimerCallback(
void *p);
191 void sendMidiCommandsFromQueue();
194 void clearPlayList();
195 void pauseAll(
bool pause);
196 bool isAllPaused()
const {
return (_globalPause > 0); }
197 void resetGlobalPauseCounter();
199 void stopAllSamples();
203 void soundPlay(
MusicEntry *pSnd,
bool restoring =
false);
208 void soundToggle(
MusicEntry *pSnd,
bool pause);
209 void soundSetVolume(
MusicEntry *pSnd, byte volume);
210 void soundSetSampleVolume(
MusicEntry *pSnd, byte volume);
211 void soundSetPriority(
MusicEntry *pSnd, byte prio);
212 uint16 soundGetMasterVolume();
213 void soundSetMasterVolume(uint16 vol);
214 uint16 soundGetSoundOn()
const {
return _soundOn; }
215 void soundSetSoundOn(
bool soundOnFlag);
216 uint16 soundGetVoices();
217 uint32 soundGetTempo()
const {
return _dwTempo; }
218 MusicType soundGetMusicType()
const {
return _musicType; }
221 assert(pSnd->pStreamAud != 0);
222 return _pMixer->isSoundHandleActive(pSnd->hCurrentAud);
225 void updateAudioStreamTicker(
MusicEntry *pSnd) {
226 assert(pSnd->pStreamAud != 0);
227 pSnd->ticker = (uint16)(_pMixer->getSoundElapsedTime(pSnd->hCurrentAud) * 0.06);
231 MusicEntry *getFirstSlotWithStatus(SoundStatus status);
235 _playList.push_back(slotEntry);
236 if (_soundVersion <= SCI_VERSION_0_LATE)
240 void printPlayList(
Console *con);
248 void sendMidiCommand(uint32 cmd);
249 void sendMidiCommand(
MusicEntry *pSnd, uint32 cmd);
251 void setGlobalReverb(int8 reverb);
252 int8 getGlobalReverb() {
return _globalReverb; }
254 byte getCurrentReverb();
256 void needsRemap() { _needsRemap =
true; }
279 void remapChannels(
bool mainThread =
true);
281 void resetDeviceChannel(
int devChannel,
bool mainThread);
285 bool isDeviceChannelMapped(
int devChannel)
const;
287 bool isDigitalSamplePlaying()
const;
294 int8 _channelRemap[16];
302 MidiCommandQueue _queuedCommands;
305 int _driverFirstChannel;
306 int _driverLastChannel;
316 #endif // SCI_SOUND_MUSIC_H Definition: resource.h:670
SciVersion
Definition: detection.h:135
MusicType
Definition: mididrv.h:44
T * iterator
Definition: array.h:54
Definition: serializer.h:79
SoundType
Definition: mixer.h:62
Definition: midiparser_sci.h:50
Definition: audiostream.h:144
Definition: serializer.h:308
Definition: audiostream.h:109
Definition: mididriver.h:77
Definition: vm_types.h:39