32 #ifndef DGDS_SOUND_MUSIC_H 33 #define DGDS_SOUND_MUSIC_H 35 #include "common/serializer.h" 36 #include "common/mutex.h" 38 #include "audio/mixer.h" 40 #include "dgds/sound/drivers/mididriver.h" 41 #include "dgds/sound/resource/sci_resource.h" 44 class LoopingAudioStream;
45 class RewindableAudioStream;
52 kSoundInitialized = 1,
57 #define MUSIC_VOLUME_DEFAULT 127 58 #define MUSIC_VOLUME_MAX 127 59 #define MUSIC_MASTERVOLUME_DEFAULT 15 60 #define MUSIC_MASTERVOLUME_MAX 15 99 bool overridePriority;
102 uint sampleLoopCounter;
107 uint32 fadeTickerStep;
110 bool stopAfterFading;
116 int _usedChannels[16];
123 SignalQueue signalQueue;
138 void setSignal(
int signal);
144 bool operator==(
const DeviceChannelUsage& other)
const {
return _song == other._song && _channel == other._channel; }
156 void swap(
int i,
int j);
159 int lowestPrio()
const;
164 kTypeMidiMessage = 0,
168 MidiCommand(CmdType type, uint32 val) : _type(type), _dataPtr(0), _dataVal(val) {}
169 MidiCommand(CmdType type,
void *ptr) : _type(type), _dataPtr(ptr), _dataVal(0) {}
187 void putMidiCommandInQueue(byte status, byte firstOp, byte secondOp);
188 void putMidiCommandInQueue(uint32 midi);
189 void putTrackInitCommandInQueue(
MusicEntry *psnd);
190 void removeTrackInitCommandsFromQueue(
MusicEntry *psnd);
192 static void miditimerCallback(
void *p);
193 void sendMidiCommandsFromQueue();
196 void clearPlayList();
197 void pauseAll(
bool pause);
198 bool isAllPaused()
const {
return (_globalPause > 0); }
199 void resetGlobalPauseCounter();
201 void stopAllSamples();
207 void soundPlay(
MusicEntry *pSnd,
bool restoring =
false);
212 void soundToggle(
MusicEntry *pSnd,
bool pause);
213 void soundSetVolume(
MusicEntry *pSnd, byte volume);
214 void soundSetSampleVolume(
MusicEntry *pSnd, byte volume);
215 void soundSetPriority(
MusicEntry *pSnd, byte prio);
216 uint16 soundGetMasterVolume();
217 void soundSetMasterVolume(uint16 vol);
218 uint16 soundGetSoundOn()
const {
return _soundOn; }
219 void soundSetSoundOn(
bool soundOnFlag);
220 uint16 soundGetVoices();
221 uint32 soundGetTempo()
const {
return _dwTempo; }
222 MusicType soundGetMusicType()
const {
return _musicType; }
225 assert(pSnd->pStreamAud != 0);
226 return _pMixer->isSoundHandleActive(pSnd->hCurrentAud);
229 void updateAudioStreamTicker(
MusicEntry *pSnd) {
230 assert(pSnd->pStreamAud != 0);
231 pSnd->ticker = (uint16)(_pMixer->getSoundElapsedTime(pSnd->hCurrentAud) * 0.06);
235 MusicEntry *getFirstSlotWithStatus(SoundStatus status);
239 _playList.push_back(slotEntry);
242 void printPlayList(
Console *con);
243 void printSongInfo(uint32 obj,
Console *con);
253 void setGlobalReverb(int8 reverb);
254 int8 getGlobalReverb() {
return _globalReverb; }
256 byte getCurrentReverb();
258 void needsRemap() { _needsRemap =
true; }
277 void remapChannels(
bool mainThread =
true);
279 void resetDeviceChannel(
int devChannel,
bool mainThread);
283 bool isDeviceChannelMapped(
int devChannel)
const;
285 bool isDigitalSamplePlaying()
const;
292 int8 _channelRemap[16];
300 MidiCommandQueue _queuedCommands;
303 int _driverFirstChannel;
304 int _driverLastChannel;
314 #endif // DGDS_SOUND_MUSIC_H
MusicType
Definition: mididrv.h:44
Definition: sci_resource.h:50
Definition: midiparser_sci.h:49
T * iterator
Definition: array.h:54
Definition: mididriver.h:77
SoundType
Definition: mixer.h:62
Definition: audiostream.h:144
Definition: audiostream.h:109