ScummVM API documentation
sound.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TRECISION_SOUND_H
23 #define TRECISION_SOUND_H
24 
25 #include "trecision/fastfile.h"
26 #include "common/stream.h"
27 #include "audio/mixer.h"
28 #include "audio/audiostream.h"
29 
30 namespace Trecision {
31 
32 #define SOUND_OFF 0
33 #define SOUND_ON 1
34 
35 #define MAXSOUNDS 4
36 #define SAMPLEVOICES 6
37 #define NUMSAMPLES 145 // Maximum number of samples in the game
38 
39 #define VOLUME(a) ( (a * 255) / 127 )
40 #define TIME(a) ( (a * 3) / 50 )
41 
42 struct SSound {
43  Common::String _name;
44  uint8 _volume;
45  uint8 _flag;
46  int8 _panning;
47 };
48 
49 enum SoundType {
50  kSoundTypeMusic = 0,
51  kSoundTypeSpeech = 1,
52  kSoundTypeSfx = 2,
53  kSoundTypeStep = 3
54 };
55 
56 class TrecisionEngine;
57 
58 class SoundManager {
59 public:
61  ~SoundManager();
62 
63 private:
64  TrecisionEngine *_vm;
65  FastFile _speechFile; // nlspeech.cd0
66 
67  Audio::SoundHandle _soundHandles[MAXSOUNDS];
68  SSound _gSample[NUMSAMPLES];
69 
70  Audio::SeekableAudioStream *_stepLeftStream;
71  Audio::SeekableAudioStream *_stepRightStream;
72 
73 public:
74  Audio::SeekableAudioStream *loadWAV(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
75  void play(int soundId);
76  void stopSoundType(SoundType type);
77  void stopAll();
78  void stopAllExceptMusic();
79  void soundStep(int midx, int midz, int act, int frame);
80  int32 talkStart(const Common::Path &name);
81  void loadRoomSounds();
82 
83  void loadSamples(Common::SeekableReadStreamEndian *stream);
84 };
85 
86 
87 } // End of namespace Trecision
88 
89 #endif
Definition: str.h:59
Definition: fastfile.h:38
Definition: trecision.h:112
Definition: sound.h:42
Definition: path.h:52
Definition: stream.h:745
Definition: audiostream.h:212
Definition: sound.h:58
Definition: mixer.h:49
Definition: actor.h:29
Definition: stream.h:944