ScummVM API documentation
sndres.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 // Sound resource class header
23 
24 #ifndef SAGA_SNDRES_H
25 #define SAGA_SNDRES_H
26 
27 #include "saga/itedata.h"
28 #include "saga/sound.h"
29 
30 namespace Saga {
31 
32 struct FxTable {
33  int16 res;
34  int16 vol;
35 };
36 
37 class SndRes {
38 public:
39 
40  SndRes(SagaEngine *vm);
41  ~SndRes();
42 
43  void playSound(uint32 resourceId, int volume, bool loop);
44  void playVoice(uint32 resourceId);
45  int getVoiceLength(uint32 resourceId);
46  void setVoiceBank(int serial);
47  int getVoiceBank() { return _voiceSerial; }
48 
49  Common::Array<FxTable> _fxTable;
50 
51  Common::Array<int16> _fxTableIDs;
52 
53  private:
54  bool load(ResourceContext *context, uint32 resourceId, SoundBuffer &buffer, bool onlyHeader);
55 
56  ResourceContext *_sfxContext;
57  ResourceContext *_voiceContext;
58 
59  int _voiceSerial; // voice bank number
60 
61  SagaEngine *_vm;
62 };
63 
64 } // End of namespace Saga
65 
66 #endif
Definition: resource.h:105
Definition: saga.h:497
Definition: sndres.h:37
Definition: sndres.h:32
Definition: array.h:52
Definition: actor.h:34
Definition: sound.h:43