1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef SKY_SOUND_H 24 #define SKY_SOUND_H 25 26 27 #include "common/scummsys.h" 28 #include "audio/mixer.h" 29 30 namespace Sky { 31 32 class Disk; 33 34 enum { 35 SOUND_CH0 = 0, 36 SOUND_CH1 = 1, 37 SOUND_BG = 2, 38 SOUND_VOICE = 3, 39 SOUND_SPEECH = 4 40 }; 41 42 struct SfxQueue { 43 uint8 count, fxNo, chan, vol; 44 }; 45 46 #define MAX_QUEUED_FX 4 47 48 class Sound { 49 protected: 50 51 public: 52 53 Audio::Mixer *_mixer; 54 Audio::SoundHandle _voiceHandle; 55 Audio::SoundHandle _effectHandle; 56 Audio::SoundHandle _bgSoundHandle; 57 Audio::SoundHandle _ingameSound0, _ingameSound1, _ingameSpeech; 58 59 uint16 _saveSounds[2]; 60 61 protected: 62 63 void playSound(uint32 id, byte *sound, uint32 size, Audio::SoundHandle *handle); 64 65 public: 66 Sound(Audio::Mixer *mixer, Disk *pDisk, uint8 pVolume); 67 ~Sound(); 68 69 void loadSection(uint8 pSection); 70 void playSound(uint16 sound, uint16 volume, uint8 channel); 71 void fnStartFx(uint32 sound, uint8 channel); 72 bool startSpeech(uint16 textNum); speechFinished()73 bool speechFinished() { return !_mixer->isSoundHandleActive(_ingameSpeech); } 74 void fnPauseFx(); 75 void fnUnPauseFx(); 76 void fnStopFx(); 77 void stopSpeech(); 78 void checkFxQueue(); 79 void restoreSfx(); 80 uint8 _soundsTotal; 81 82 private: 83 Disk *_skyDisk; 84 uint16 _sfxBaseOfs; 85 uint8 *_soundData; 86 uint8 *_sampleRates, *_sfxInfo; 87 uint8 _mainSfxVolume; 88 89 bool _isPaused; 90 91 static uint16 _speechConvertTable[8]; 92 static SfxQueue _sfxQueue[MAX_QUEUED_FX]; 93 }; 94 95 } // End of namespace Sky 96 97 #endif 98