2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2003-03-08 12:46:51 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-03-08 12:46:51 +00:00
|
|
|
*
|
2006-02-11 10:03:24 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2003-03-08 12:46:51 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-02-20 17:52:55 +00:00
|
|
|
#ifndef SKY_SOUND_H
|
|
|
|
#define SKY_SOUND_H
|
2003-05-30 11:07:30 +00:00
|
|
|
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2003-10-05 20:21:20 +00:00
|
|
|
#include "common/scummsys.h"
|
2003-03-08 12:46:51 +00:00
|
|
|
#include "sound/mixer.h"
|
2003-10-05 20:21:20 +00:00
|
|
|
|
2004-01-03 01:58:58 +00:00
|
|
|
namespace Sky {
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
class Disk;
|
2003-03-08 12:46:51 +00:00
|
|
|
|
2003-07-23 19:33:34 +00:00
|
|
|
enum {
|
|
|
|
SOUND_CH0 = 0,
|
|
|
|
SOUND_CH1 = 1,
|
|
|
|
SOUND_BG = 2,
|
|
|
|
SOUND_VOICE = 3,
|
|
|
|
SOUND_SPEECH = 4
|
|
|
|
};
|
|
|
|
|
2003-07-04 20:14:11 +00:00
|
|
|
struct SfxQueue {
|
|
|
|
uint8 count, fxNo, chan, vol;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_QUEUED_FX 4
|
|
|
|
|
2004-01-03 15:57:57 +00:00
|
|
|
class Sound {
|
2003-03-08 12:46:51 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2005-05-10 23:48:48 +00:00
|
|
|
Audio::Mixer *_mixer;
|
2005-05-11 00:01:44 +00:00
|
|
|
Audio::SoundHandle _voiceHandle;
|
|
|
|
Audio::SoundHandle _effectHandle;
|
|
|
|
Audio::SoundHandle _bgSoundHandle;
|
|
|
|
Audio::SoundHandle _ingameSound0, _ingameSound1, _ingameSpeech;
|
2003-07-04 20:14:11 +00:00
|
|
|
|
|
|
|
uint16 _saveSounds[2];
|
2003-03-08 12:46:51 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2005-05-11 00:01:44 +00:00
|
|
|
void playSound(uint32 id, byte *sound, uint32 size, Audio::SoundHandle *handle);
|
2003-03-08 12:46:51 +00:00
|
|
|
|
|
|
|
public:
|
2005-05-10 23:48:48 +00:00
|
|
|
Sound(Audio::Mixer *mixer, Disk *pDisk, uint8 pVolume);
|
2004-01-03 15:57:57 +00:00
|
|
|
~Sound(void);
|
2003-03-08 12:46:51 +00:00
|
|
|
|
2003-05-16 15:33:18 +00:00
|
|
|
void loadSection(uint8 pSection);
|
2003-07-04 20:14:11 +00:00
|
|
|
void playSound(uint16 sound, uint16 volume, uint8 channel);
|
|
|
|
void fnStartFx(uint32 sound, uint8 channel);
|
2003-06-09 23:37:51 +00:00
|
|
|
bool startSpeech(uint16 textNum);
|
2007-04-25 19:31:23 +00:00
|
|
|
bool speechFinished(void) { return !_mixer->isSoundHandleActive(_ingameSpeech); }
|
2003-10-25 14:25:24 +00:00
|
|
|
void fnPauseFx(void);
|
|
|
|
void fnUnPauseFx(void);
|
2003-07-04 20:14:11 +00:00
|
|
|
void fnStopFx(void);
|
2003-07-12 01:12:00 +00:00
|
|
|
void stopSpeech(void);
|
2003-07-04 20:14:11 +00:00
|
|
|
void checkFxQueue(void);
|
|
|
|
void restoreSfx(void);
|
|
|
|
uint8 _soundsTotal;
|
2003-05-16 15:33:18 +00:00
|
|
|
|
|
|
|
private:
|
2004-01-03 15:57:57 +00:00
|
|
|
Disk *_skyDisk;
|
2003-05-29 16:47:14 +00:00
|
|
|
uint16 _sfxBaseOfs;
|
2003-05-30 11:07:30 +00:00
|
|
|
uint8 *_soundData;
|
2006-06-21 11:33:40 +00:00
|
|
|
uint8 *_sampleRates, *_sfxInfo;
|
2003-08-20 12:12:11 +00:00
|
|
|
uint8 _mainSfxVolume;
|
2003-06-01 03:44:07 +00:00
|
|
|
|
|
|
|
static uint16 _speechConvertTable[8];
|
2003-07-04 20:14:11 +00:00
|
|
|
static SfxQueue _sfxQueue[MAX_QUEUED_FX];
|
2003-03-08 12:46:51 +00:00
|
|
|
};
|
|
|
|
|
2004-01-03 01:58:58 +00:00
|
|
|
} // End of namespace Sky
|
|
|
|
|
2003-05-30 11:07:30 +00:00
|
|
|
#endif
|