2008-10-14 21:12: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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TOLTECS_SOUND_H
|
|
|
|
#define TOLTECS_SOUND_H
|
|
|
|
|
2011-02-09 03:03:46 +00:00
|
|
|
#include "audio/mixer.h" // for Audio::SoundHandle
|
2010-12-05 13:56:52 +00:00
|
|
|
|
2008-10-14 21:12:52 +00:00
|
|
|
#include "toltecs/toltecs.h"
|
|
|
|
|
|
|
|
namespace Toltecs {
|
|
|
|
|
|
|
|
// 0x1219
|
|
|
|
|
2009-05-13 12:17:53 +00:00
|
|
|
enum SoundChannelType {
|
|
|
|
kChannelTypeEmpty = 0,
|
|
|
|
kChannelTypeBackground = -1,
|
|
|
|
kChannelTypeSfx = -2,
|
|
|
|
kChannelTypeSpeech = -3
|
|
|
|
};
|
|
|
|
|
2008-10-14 21:12:52 +00:00
|
|
|
struct SoundChannel {
|
|
|
|
int16 resIndex;
|
|
|
|
int16 type;
|
2012-09-10 20:19:43 +00:00
|
|
|
int16 volume;
|
|
|
|
int16 panning;
|
2008-10-14 21:12:52 +00:00
|
|
|
Audio::SoundHandle handle;
|
|
|
|
};
|
|
|
|
|
2010-11-03 12:19:58 +00:00
|
|
|
const int kMaxChannels = 4;
|
|
|
|
|
2008-10-14 21:12:52 +00:00
|
|
|
class Sound {
|
|
|
|
public:
|
2009-05-13 12:17:53 +00:00
|
|
|
Sound(ToltecsEngine *vm);
|
|
|
|
~Sound();
|
2008-10-14 21:12:52 +00:00
|
|
|
|
2009-05-13 12:17:53 +00:00
|
|
|
void playSpeech(int16 resIndex);
|
|
|
|
void playSound(int16 resIndex, int16 type, int16 volume);
|
2008-10-14 21:12:52 +00:00
|
|
|
void playSoundAtPos(int16 resIndex, int16 x, int16 y);
|
|
|
|
void updateSpeech();
|
|
|
|
void stopSpeech();
|
2011-10-22 18:39:32 +00:00
|
|
|
void stopAll();
|
2008-10-14 21:12:52 +00:00
|
|
|
|
2011-11-21 21:47:47 +00:00
|
|
|
void saveState(Common::WriteStream *out);
|
2012-09-10 20:19:43 +00:00
|
|
|
void loadState(Common::ReadStream *in, int version);
|
2011-11-21 21:47:47 +00:00
|
|
|
|
2008-10-14 21:12:52 +00:00
|
|
|
protected:
|
2009-05-13 12:17:53 +00:00
|
|
|
ToltecsEngine *_vm;
|
|
|
|
|
2010-11-03 12:19:58 +00:00
|
|
|
SoundChannel channels[kMaxChannels];
|
2009-05-13 12:17:53 +00:00
|
|
|
|
2012-09-10 20:19:43 +00:00
|
|
|
void clearChannel(int channel);
|
2009-05-13 12:17:53 +00:00
|
|
|
void internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 panning);
|
2012-09-10 18:53:00 +00:00
|
|
|
Audio::Mixer::SoundType getScummVMSoundType(SoundChannelType type) const;
|
2008-10-14 21:12:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // End of namespace Toltecs
|
|
|
|
|
|
|
|
#endif /* TOLTECS_SOUND_H */
|