90 lines
2.3 KiB
C
Raw Normal View History

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.
*
* 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
* 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
#include "trecision/fastfile.h"
2021-05-31 05:05:49 +01:00
#include "common/stream.h"
#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
#define MAXSOUNDS 4
2021-04-21 12:43:31 +02:00
#define SAMPLEVOICES 6
#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;
};
enum SoundType {
kSoundTypeMusic = 0,
kSoundTypeSpeech = 1,
kSoundTypeSfx = 2,
kSoundTypeStep = 3
};
class TrecisionEngine;
2021-04-21 12:43:31 +02:00
class SoundManager {
public:
SoundManager(TrecisionEngine *vm);
~SoundManager();
private:
TrecisionEngine *_vm;
FastFile _speechFile; // nlspeech.cd0
Audio::SoundHandle _soundHandles[MAXSOUNDS];
SSound _gSample[NUMSAMPLES];
2021-05-20 09:27:36 +03:00
Audio::SeekableAudioStream *_stepLeftStream;
Audio::SeekableAudioStream *_stepRightStream;
public:
2021-05-31 05:20:29 +01:00
Audio::SeekableAudioStream *loadWAV(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
void play(int soundId);
void stopSoundType(SoundType type);
void stopAll();
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);
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