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 NGI_SOUND_H
23 #define NGI_SOUND_H
24 
25 #include "common/array.h"
26 #include "common/ptr.h"
27 
28 namespace Audio {
29 class SoundHandle;
30 }
31 
32 namespace NGI {
33 
34 class Sound : public MemoryObject {
35  int _id;
36  byte *_soundData;
37  Audio::SoundHandle *_handle;
38 
39 public:
40  int16 _objectId;
41 
42 public:
43  Sound();
44  ~Sound() override;
45 
46  virtual bool load(MfcArchive &file, NGIArchive *archive);
47  bool load(MfcArchive &file) override { assert(0); return false; } // Disable base class
48  void updateVolume();
49  int getId() const { return _id; }
50  Audio::SoundHandle *getHandle() const { return _handle; }
51 
52  void play(int flag);
53  void freeSound();
54  int getVolume();
55  void stop();
56 
57  void setPanAndVolumeByStaticAni();
58  void setPanAndVolume(int vol, int pan);
59 };
60 
61 class SoundList : public CObject {
62  Common::Array<Sound> _soundItems;
64 
65  public:
66  virtual bool load(MfcArchive &file, const Common::Path &fname);
67  bool load(MfcArchive &file) override { assert(0); return false; } // Disable base class
68  bool loadFile(const Common::Path &fname, const Common::Path &libname);
69 
70  int getCount() { return _soundItems.size(); }
71  Sound &getSoundByIndex(int idx) { return _soundItems[idx]; }
72  Sound *getSoundItemById(int id);
73 };
74 
75 } // End of namespace NGI
76 
77 #endif /* NGI_SOUND_H */
Definition: utils.h:39
Definition: array.h:52
Definition: path.h:52
Definition: ngiarchive.h:44
Definition: sound.h:61
Definition: ptr.h:572
Definition: mixer.h:49
size_type size() const
Definition: array.h:275
Definition: sound.h:34
Definition: anihandler.h:25
Definition: utils.h:139
Definition: system.h:37
Definition: utils.h:106