2021-04-21 12:43:31 +02: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.
|
|
|
|
*
|
2021-12-26 18:47:58 +01: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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2021-04-21 12:43:31 +02: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.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2021-04-21 12:43:31 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TRECISION_SOUND_H
|
|
|
|
#define TRECISION_SOUND_H
|
|
|
|
|
2021-05-16 23:18:08 +01:00
|
|
|
#include "trecision/fastfile.h"
|
2021-05-31 05:05:49 +01:00
|
|
|
#include "common/stream.h"
|
2021-05-16 23:18:08 +01:00
|
|
|
#include "audio/mixer.h"
|
|
|
|
#include "audio/audiostream.h"
|
2021-04-21 12:43:31 +02:00
|
|
|
|
|
|
|
namespace Trecision {
|
|
|
|
|
|
|
|
#define SOUND_OFF 0
|
|
|
|
#define SOUND_ON 1
|
|
|
|
|
2021-05-19 23:21:47 +03:00
|
|
|
#define MAXSOUNDS 4
|
2021-04-21 12:43:31 +02:00
|
|
|
#define SAMPLEVOICES 6
|
2021-05-19 19:50:27 +03:00
|
|
|
#define NUMSAMPLES 145 // Maximum number of samples in the game
|
2021-04-21 12:43:31 +02:00
|
|
|
|
|
|
|
#define VOLUME(a) ( (a * 255) / 127 )
|
|
|
|
#define TIME(a) ( (a * 3) / 50 )
|
|
|
|
|
|
|
|
struct SSound {
|
2021-05-18 19:50:35 +03:00
|
|
|
Common::String _name;
|
2021-04-21 12:43:31 +02:00
|
|
|
uint8 _volume;
|
|
|
|
uint8 _flag;
|
|
|
|
int8 _panning;
|
|
|
|
};
|
|
|
|
|
2021-05-19 23:21:47 +03:00
|
|
|
enum SoundType {
|
|
|
|
kSoundTypeMusic = 0,
|
|
|
|
kSoundTypeSpeech = 1,
|
|
|
|
kSoundTypeSfx = 2,
|
|
|
|
kSoundTypeStep = 3
|
|
|
|
};
|
|
|
|
|
2021-05-16 23:18:08 +01:00
|
|
|
class TrecisionEngine;
|
|
|
|
|
2021-04-21 12:43:31 +02:00
|
|
|
class SoundManager {
|
|
|
|
public:
|
|
|
|
SoundManager(TrecisionEngine *vm);
|
|
|
|
~SoundManager();
|
|
|
|
|
|
|
|
private:
|
|
|
|
TrecisionEngine *_vm;
|
2021-05-07 16:44:04 +03:00
|
|
|
FastFile _speechFile; // nlspeech.cd0
|
|
|
|
|
2021-05-20 21:09:41 +03:00
|
|
|
Audio::SoundHandle _soundHandles[MAXSOUNDS];
|
2021-05-19 19:50:27 +03:00
|
|
|
SSound _gSample[NUMSAMPLES];
|
2021-05-20 09:27:36 +03:00
|
|
|
|
2021-05-19 23:21:47 +03:00
|
|
|
Audio::SeekableAudioStream *_stepLeftStream;
|
|
|
|
Audio::SeekableAudioStream *_stepRightStream;
|
2021-05-14 23:37:26 +01:00
|
|
|
|
2021-04-21 12:49:47 +02:00
|
|
|
public:
|
2021-05-31 05:20:29 +01:00
|
|
|
Audio::SeekableAudioStream *loadWAV(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
|
2021-05-19 23:21:47 +03:00
|
|
|
void play(int soundId);
|
|
|
|
void stopSoundType(SoundType type);
|
2021-04-21 13:04:46 +02:00
|
|
|
void stopAll();
|
2021-05-19 23:21:47 +03:00
|
|
|
void stopAllExceptMusic();
|
|
|
|
void soundStep(int midx, int midz, int act, int frame);
|
2021-05-14 17:23:17 +01:00
|
|
|
int32 talkStart(const Common::String &name);
|
2021-04-21 13:04:46 +02:00
|
|
|
void loadRoomSounds();
|
2021-04-21 12:43:31 +02:00
|
|
|
|
2021-05-31 05:05:49 +01:00
|
|
|
void loadSamples(Common::SeekableReadStreamEndian *stream);
|
2021-04-21 12:43:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // End of namespace Trecision
|
|
|
|
|
|
|
|
#endif
|