22 #ifndef KYRA_SOUND_INTERN_H 23 #define KYRA_SOUND_INTERN_H 26 #include "kyra/sound/sound.h" 27 #include "kyra/sound/sound_pc_v1.h" 29 #include "audio/midiparser.h" 30 #include "audio/miles.h" 31 #include "audio/softsynth/emumidi.h" 32 #include "audio/softsynth/fmtowns_pc98/towns_audio.h" 34 #include "common/mutex.h" 63 kType getMusicType()
const override {
return _type; }
67 void updateVolumeSettings()
override;
69 void initAudioResourceInfo(
int set,
void *info)
override;
70 void selectAudioResourceSet(
int set)
override;
71 bool hasSoundFile(uint file)
const override;
72 void loadSoundFile(uint file)
override;
76 void playTrack(uint8 track)
override;
77 void haltTrack()
override;
78 bool isPlaying()
const override;
80 void playSoundEffect(uint16 track, uint8 volume = 0xFF)
override;
81 void stopAllSoundEffects()
override;
83 void beginFadeOut()
override;
85 void pause(
bool paused)
override;
87 static void onTimer(
void *data);
90 int _musicVolume, _sfxVolume;
92 uint32 _fadeStartTime;
97 byte *_musicFile, *_sfxFile;
104 int _currentResourceSet;
122 kType getMusicType()
const override {
return kTowns; }
124 bool init()
override;
125 void process()
override;
127 void initAudioResourceInfo(
int set,
void *info)
override;
128 void selectAudioResourceSet(
int set)
override;
129 bool hasSoundFile(uint file)
const override;
130 void loadSoundFile(uint file)
override;
133 void playTrack(uint8 track)
override;
134 void haltTrack()
override;
136 void playSoundEffect(uint16 track, uint8 volume = 0xFF)
override;
137 void stopAllSoundEffects()
override;
139 void beginFadeOut()
override;
141 void updateVolumeSettings()
override;
142 void enableMusic(
int enable)
override;
145 bool loadInstruments();
146 void playEuphonyTrack(uint32 offset,
int loop);
148 void fadeOutSoundEffects();
153 uint8 *_musicTrackData;
165 int _currentResourceSet;
167 const uint8 *_musicFadeTable;
168 const uint8 *_sfxBTTable;
169 const uint8 *_sfxWDTable;
177 kType getMusicType()
const override {
return kPC98; }
179 bool init()
override;
181 void initAudioResourceInfo(
int set,
void *info)
override;
182 void selectAudioResourceSet(
int set)
override;
183 bool hasSoundFile(uint file)
const override;
184 void loadSoundFile(uint file)
override;
187 void playTrack(uint8 track)
override;
188 void haltTrack()
override;
189 void beginFadeOut()
override;
192 void playSoundEffect(uint16 track, uint8 volume = 0xFF)
override;
194 void updateVolumeSettings()
override;
198 uint8 *_musicTrackData;
199 uint8 *_sfxTrackData;
202 const char *resPattern() {
return _resInfo[_currentResourceSet]->c_str(); }
204 int _currentResourceSet;
212 kType getMusicType()
const override {
return _vm->gameFlags().platform == Common::kPlatformFMTowns ? kTowns : kPC98; }
214 bool init()
override;
215 void process()
override;
217 void initAudioResourceInfo(
int set,
void *info)
override;
218 void selectAudioResourceSet(
int set)
override;
219 bool hasSoundFile(uint file)
const override;
223 void playTrack(uint8 track)
override;
224 void haltTrack()
override;
225 void beginFadeOut()
override;
227 int32 voicePlay(
const char *file,
Audio::SoundHandle *handle, uint8 volume = 255, uint8 priority = 255,
bool isSfx =
true)
override;
228 void playSoundEffect(uint16 track, uint8 volume = 0xFF)
override;
230 void updateVolumeSettings()
override;
237 uint8 *_musicTrackData;
238 uint8 *_sfxTrackData;
243 int _currentResourceSet;
255 void send(uint32 data)
override;
257 MidiChannel *allocateChannel()
override {
return 0; }
258 MidiChannel *getPercussionChannel()
override {
return 0; }
261 void generateSamples(int16 *buffer,
int numSamples)
override;
265 int getRate()
const override {
return _rate; }
272 uint8 pitchBendLow, pitchBendHigh;
279 void resetController(
int channel);
283 uint8 hardwareChannel;
294 void noteOn(
int channel,
int note);
295 void noteOff(
int channel,
int note);
297 void turnNoteOn(
int note);
298 void overwriteNote(
int note);
299 void turnNoteOff(
int note);
301 void setupTone(
int note);
304 uint8 _hardwareChannel[1];
305 bool _modulationFlag;
308 void onTimer()
override;
310 static const uint8 _noteTable1[];
311 static const uint8 _noteTable2[];
328 kType getMusicType()
const override {
return kAmiga; }
330 bool init()
override;
332 void initAudioResourceInfo(
int set,
void *info)
override;
333 void selectAudioResourceSet(
int set)
override;
334 bool hasSoundFile(uint file)
const override;
335 void loadSoundFile(uint file)
override;
338 void playTrack(uint8 track)
override;
339 void haltTrack()
override;
340 void beginFadeOut()
override;
343 void playSoundEffect(uint16 track, uint8 volume = 0xFF)
override;
346 Audio::MaxTrax *_driver;
348 enum FileType { kFileNone = -1, kFileIntro = 0, kFileGame = 1, kFileFinal = 2 } _fileLoaded;
351 int _tableSfxIntro_Size;
354 int _tableSfxGame_Size;
364 kType getMusicType()
const override;
366 bool init()
override {
return init(musicEnabled() == 1); }
367 bool init(
bool hiQuality);
369 void selectAudioResourceSet(
int set)
override;
373 void playTrack(uint8 track)
override;
374 void haltTrack()
override;
375 void playSoundEffect(uint16 track, uint8)
override;
376 bool isPlaying()
const override;
377 void beginFadeOut()
override;
378 void updateVolumeSettings()
override;
379 void enableMusic(
int enable)
override;
382 void setQuality(
bool hi);
386 const int _talkieFlag;
389 const uint16 *_resIDMusic;
390 int _currentResourceSet;
392 static const uint16 _resIDMusicIntro[4];
393 static const uint16 _resIDMusicIngame[35];
394 static const uint8 _musicLoopTable[35];
395 static const uint16 _resIDSfxIntro[2][39];
396 static const uint16 _resIDSfxIngame[2][39];
398 struct SoundEffectDef {
405 static const SoundEffectDef _soundEffectDefsIntro[16];
406 static const SoundEffectDef _soundEffectDefsIngame[120];
414 ~SoundTowns_Darkmoon()
override;
416 kType getMusicType()
const override {
return kTowns; }
418 bool init()
override;
420 void timerCallback(
int timerId)
override;
422 void initAudioResourceInfo(
int set,
void *info)
override;
423 void selectAudioResourceSet(
int set)
override;
424 bool hasSoundFile(uint file)
const override;
425 void loadSoundFile(uint file)
override;
428 void playTrack(uint8 track)
override;
429 void haltTrack()
override;
430 bool isPlaying()
const override;
432 void playSoundEffect(uint16 track, uint8 volume = 0xFF)
override;
433 void stopAllSoundEffects()
override;
435 void beginFadeOut()
override;
437 void updateVolumeSettings()
override;
439 int checkTrigger()
override;
441 void resetTrigger()
override;
444 struct SoundTableEntry {
450 const char *
const *_fileList;
468 class SoundAmiga_EoB:
public Sound {
471 ~SoundAmiga_EoB()
override;
473 kType getMusicType()
const override;
475 bool init()
override;
476 void initAudioResourceInfo(
int set,
void *info)
override;
477 void selectAudioResourceSet(
int set)
override;
478 bool hasSoundFile(uint file)
const override {
return false; }
479 void loadSoundFile(uint)
override {}
482 void playTrack(uint8 track)
override;
483 void haltTrack()
override;
484 void playSoundEffect(uint16 track, uint8 volume = 0xFF)
override;
485 void beginFadeOut()
override { beginFadeOut(160); }
486 void beginFadeOut(
int delay)
override;
487 void updateVolumeSettings()
override;
488 int checkTrigger()
override;
494 AudioMaster2 *_driver;
498 int _currentResourceSet;
504 class SoundPC98_EoB :
public Sound {
507 ~SoundPC98_EoB()
override;
509 kType getMusicType()
const override;
511 bool init()
override;
512 void initAudioResourceInfo(
int set,
void *info)
override;
513 void selectAudioResourceSet(
int set)
override;
514 bool hasSoundFile(uint file)
const override {
return false; }
515 void loadSoundFile(uint file)
override;
516 void loadSoundFile(
const Common::Path &file)
override {}
518 void playTrack(uint8 track)
override;
519 void haltTrack()
override;
520 void playSoundEffect(uint16 track, uint8)
override;
521 void beginFadeOut()
override {}
522 void updateVolumeSettings()
override;
529 int _currentResourceSet;
536 class CapcomPC98AudioDriver;
537 class SoundPC98_Darkmoon :
public Sound {
540 ~SoundPC98_Darkmoon()
override;
542 kType getMusicType()
const override;
543 kType getSfxType()
const override;
545 bool init()
override;
547 void initAudioResourceInfo(
int set,
void *info)
override;
548 void selectAudioResourceSet(
int set)
override;
549 bool hasSoundFile(uint file)
const override {
return true; }
550 void loadSoundFile(uint file)
override;
553 void playTrack(uint8 track)
override;
554 void haltTrack()
override;
555 bool isPlaying()
const override;
557 void playSoundEffect(uint16 track, uint8 volume = 0xFF)
override;
558 void stopAllSoundEffects()
override;
560 void beginFadeOut()
override;
562 void pause(
bool paused)
override;
564 void updateVolumeSettings()
override;
566 int checkTrigger()
override;
567 void resetTrigger()
override {}
570 void restartBackgroundMusic();
571 const uint8 *getData(uint16 track)
const;
574 CapcomPC98AudioDriver *_driver;
575 uint8 *_soundData, *_fileBuffer;
581 int _currentResourceSet;
590 class SegaAudioDriver;
591 class SoundSegaCD_EoB :
public Sound {
594 ~SoundSegaCD_EoB()
override;
596 kType getMusicType()
const override;
598 bool init()
override;
599 void initAudioResourceInfo(
int,
void*)
override {}
600 void selectAudioResourceSet(
int)
override {}
601 bool hasSoundFile(uint file)
const override {
return false; }
602 void loadSoundFile(uint file)
override {}
603 void loadSoundFile(
const Common::Path &file)
override {}
604 void playTrack(uint8 track)
override;
605 void haltTrack()
override;
606 void playSoundEffect(uint16 track, uint8 volume)
override;
607 bool isPlaying()
const override;
608 void beginFadeOut()
override {}
609 void updateVolumeSettings()
override;
616 SegaAudioDriver *_driver;
618 uint8 _pcmOffsets[8];
619 uint16 _fmOffsets[140];
620 const uint8 *_fmData;
621 int _lastSoundEffect;
624 static const uint8 _fmTrackMap[140];
Definition: sound_intern.h:207
void loadSoundFile(const Common::Path &) override
Definition: sound_intern.h:131
uint32 DeviceHandle
Definition: mididrv.h:318
void loadSoundFile(const Common::Path &) override
Definition: sound_intern.h:336
void loadSoundFile(uint) override
Definition: sound_intern.h:371
Definition: kyra_v1.h:126
bool init() override
Definition: sound_intern.h:366
Definition: sound_intern.h:323
Definition: mididrv.h:309
bool hasSoundFile(uint) const override
Definition: sound_intern.h:370
bool isStereo() const override
Definition: sound_intern.h:264
Definition: towns_audio.h:37
Definition: sound_intern.h:247
Definition: towns_euphony.h:115
Definition: halestorm.h:46
Definition: algorithm.h:29
int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, uint8 priority, bool isSfx) override
Definition: sound_intern.h:342
Definition: audiostream.h:50
void close() override
Definition: sound_intern.h:253
Definition: sound_intern.h:172
Definition: mididrv.h:537
Definition: detection.h:27
Definition: towns_pc98_driver.h:34
void loadSoundFile(uint file) override
Definition: sound_intern.h:220
int getRate() const override
Definition: sound_intern.h:265
Definition: sound_intern.h:359
Definition: sound_intern.h:117
Definition: sound_mac_res.h:41
int32 voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, uint8 priority, bool isSfx) override
Definition: sound_intern.h:191
void initAudioResourceInfo(int, void *) override
Definition: sound_intern.h:368
Definition: sound_intern.h:315
Definition: sound_intern.h:58
void loadSoundFile(const Common::Path &) override
Definition: sound_intern.h:372
Definition: midiparser.h:289
Definition: towns_audio.h:31