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.
|
2002-11-29 22:09:52 +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.
|
2006-05-05 00:42:37 +00:00
|
|
|
|
2002-11-29 22:09:52 +00:00
|
|
|
* 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.
|
2006-05-05 00:42:37 +00:00
|
|
|
|
2002-11-29 22:09:52 +00:00
|
|
|
* 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.
|
2002-11-29 22:09:52 +00:00
|
|
|
*
|
2006-05-05 00:42:37 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
2002-11-29 22:09:52 +00:00
|
|
|
*/
|
|
|
|
|
2006-09-29 08:14:27 +00:00
|
|
|
#ifndef AGOS_SOUND_H
|
|
|
|
#define AGOS_SOUND_H
|
2003-10-03 19:42:27 +00:00
|
|
|
|
2009-03-08 08:45:21 +00:00
|
|
|
#include "sound/audiostream.h"
|
2002-11-29 22:09:52 +00:00
|
|
|
#include "sound/mixer.h"
|
2006-09-29 08:14:27 +00:00
|
|
|
#include "agos/intern.h"
|
2003-10-10 13:55:08 +00:00
|
|
|
#include "common/str.h"
|
2002-11-29 22:09:52 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
namespace AGOS {
|
2003-10-03 19:42:27 +00:00
|
|
|
|
2003-06-15 12:22:19 +00:00
|
|
|
class BaseSound;
|
2003-06-15 11:48:04 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
class AGOSEngine;
|
2005-11-12 06:01:24 +00:00
|
|
|
|
2004-01-03 01:28:00 +00:00
|
|
|
class Sound {
|
2002-11-29 22:09:52 +00:00
|
|
|
private:
|
2006-09-29 09:44:30 +00:00
|
|
|
AGOSEngine *_vm;
|
2003-01-11 16:00:55 +00:00
|
|
|
|
2005-05-10 23:48:48 +00:00
|
|
|
Audio::Mixer *_mixer;
|
2003-05-20 15:17:21 +00:00
|
|
|
|
2003-06-15 12:22:19 +00:00
|
|
|
BaseSound *_voice;
|
|
|
|
BaseSound *_effects;
|
2002-11-29 22:09:52 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
bool _effectsPaused;
|
|
|
|
bool _ambientPaused;
|
2006-04-17 12:05:45 +00:00
|
|
|
bool _sfx5Paused;
|
2002-11-29 22:09:52 +00:00
|
|
|
|
2003-01-11 16:00:55 +00:00
|
|
|
uint16 *_filenums;
|
|
|
|
uint32 *_offsets;
|
2005-05-08 12:33:25 +00:00
|
|
|
uint16 _lastVoiceFile;
|
2003-01-11 16:00:55 +00:00
|
|
|
|
2005-05-11 00:01:44 +00:00
|
|
|
Audio::SoundHandle _voiceHandle;
|
|
|
|
Audio::SoundHandle _effectsHandle;
|
|
|
|
Audio::SoundHandle _ambientHandle;
|
2006-04-17 12:05:45 +00:00
|
|
|
Audio::SoundHandle _sfx5Handle;
|
2002-11-29 22:09:52 +00:00
|
|
|
|
2005-05-08 12:33:25 +00:00
|
|
|
bool _hasEffectsFile;
|
|
|
|
bool _hasVoiceFile;
|
2009-03-08 08:45:21 +00:00
|
|
|
uint16 _ambientPlaying;
|
2002-11-29 22:09:52 +00:00
|
|
|
|
2009-03-08 08:45:21 +00:00
|
|
|
// Personal Nightmare specfic
|
|
|
|
byte *_soundQueuePtr;
|
|
|
|
uint16 _soundQueueNum;
|
|
|
|
uint32 _soundQueueSize;
|
|
|
|
uint16 _soundQueueFreq;
|
2005-05-08 12:33:25 +00:00
|
|
|
public:
|
2006-09-29 09:44:30 +00:00
|
|
|
Sound(AGOSEngine *vm, const GameSpecificSettings *gss, Audio::Mixer *mixer);
|
2004-01-03 01:28:00 +00:00
|
|
|
~Sound();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2009-03-08 08:45:21 +00:00
|
|
|
enum TypeFlags {
|
|
|
|
TYPE_AMBIENT = 1 << 0,
|
|
|
|
TYPE_SFX = 1 << 1,
|
|
|
|
TYPE_SFX5 = 1 << 2
|
|
|
|
};
|
|
|
|
|
2010-01-22 23:58:24 +00:00
|
|
|
protected:
|
2006-04-15 05:24:44 +00:00
|
|
|
void loadVoiceFile(const GameSpecificSettings *gss);
|
|
|
|
void loadSfxFile(const GameSpecificSettings *gss);
|
|
|
|
|
2010-01-22 23:58:24 +00:00
|
|
|
public:
|
|
|
|
void readSfxFile(const Common::String &filename);
|
2005-05-10 22:56:25 +00:00
|
|
|
void loadSfxTable(Common::File *gameFile, uint32 base);
|
2010-01-22 23:58:24 +00:00
|
|
|
void readVoiceFile(const Common::String &filename);
|
2002-11-29 22:09:52 +00:00
|
|
|
|
|
|
|
void playVoice(uint sound);
|
|
|
|
void playEffects(uint sound);
|
|
|
|
void playAmbient(uint sound);
|
2006-04-14 05:13:59 +00:00
|
|
|
|
2009-03-08 08:45:21 +00:00
|
|
|
// Personal Nightmare specfic
|
2009-05-04 09:17:31 +00:00
|
|
|
void handleSoundQueue();
|
2009-03-08 08:45:21 +00:00
|
|
|
void queueSound(byte *ptr, uint16 sound, uint32 size, uint16 freq);
|
|
|
|
|
2006-10-14 01:15:28 +00:00
|
|
|
// Elvira 1/2 and Waxworks specific
|
2009-03-08 08:45:21 +00:00
|
|
|
void playRawData(byte *soundData, uint sound, uint size, uint freq);
|
2006-10-14 01:15:28 +00:00
|
|
|
|
2006-04-14 05:13:59 +00:00
|
|
|
// Feeble Files specific
|
2006-04-17 12:05:45 +00:00
|
|
|
void playAmbientData(byte *soundData, uint sound, uint pan, uint vol);
|
|
|
|
void playSfxData(byte *soundData, uint sound, uint pan, uint vol);
|
|
|
|
void playSfx5Data(byte *soundData, uint sound, uint pan, uint vol);
|
2006-04-23 15:42:02 +00:00
|
|
|
void playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan = 0, int vol = 0, bool loop = false);
|
2006-04-14 05:13:59 +00:00
|
|
|
void playVoiceData(byte *soundData, uint sound);
|
2006-04-20 02:23:17 +00:00
|
|
|
void switchVoiceFile(const GameSpecificSettings *gss, uint disc);
|
2002-11-29 22:09:52 +00:00
|
|
|
|
2005-05-08 12:33:25 +00:00
|
|
|
bool hasVoice() const;
|
2009-03-08 08:45:21 +00:00
|
|
|
bool isSfxActive() const;
|
2005-05-08 12:33:25 +00:00
|
|
|
bool isVoiceActive() const;
|
2006-09-29 06:58:59 +00:00
|
|
|
void stopAllSfx();
|
2009-03-08 08:45:21 +00:00
|
|
|
void stopSfx();
|
2006-04-18 13:28:42 +00:00
|
|
|
void stopSfx5();
|
2002-12-07 17:35:34 +00:00
|
|
|
void stopVoice();
|
2002-11-29 22:09:52 +00:00
|
|
|
void stopAll();
|
|
|
|
void effectsPause(bool b);
|
|
|
|
void ambientPause(bool b);
|
|
|
|
};
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
} // End of namespace AGOS
|
2003-10-03 19:42:27 +00:00
|
|
|
|
|
|
|
#endif
|