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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef NGI_SOUND_H 24 #define NGI_SOUND_H 25 26 #include "common/array.h" 27 #include "common/ptr.h" 28 29 namespace Audio { 30 class SoundHandle; 31 } 32 33 namespace NGI { 34 35 class Sound : public MemoryObject { 36 int _id; 37 byte *_soundData; 38 Audio::SoundHandle *_handle; 39 40 public: 41 int16 _objectId; 42 43 public: 44 Sound(); 45 ~Sound() override; 46 47 virtual bool load(MfcArchive &file, NGIArchive *archive); load(MfcArchive & file)48 bool load(MfcArchive &file) override { assert(0); return false; } // Disable base class 49 void updateVolume(); getId()50 int getId() const { return _id; } getHandle()51 Audio::SoundHandle *getHandle() const { return _handle; } 52 53 void play(int flag); 54 void freeSound(); 55 int getVolume(); 56 void stop(); 57 58 void setPanAndVolumeByStaticAni(); 59 void setPanAndVolume(int vol, int pan); 60 }; 61 62 class SoundList : public CObject { 63 Common::Array<Sound> _soundItems; 64 Common::ScopedPtr<NGIArchive> _libHandle; 65 66 public: 67 virtual bool load(MfcArchive &file, const Common::String &fname); load(MfcArchive & file)68 bool load(MfcArchive &file) override { assert(0); return false; } // Disable base class 69 bool loadFile(const Common::String &fname, const Common::String &libname); 70 getCount()71 int getCount() { return _soundItems.size(); } getSoundByIndex(int idx)72 Sound &getSoundByIndex(int idx) { return _soundItems[idx]; } 73 Sound *getSoundItemById(int id); 74 }; 75 76 } // End of namespace NGI 77 78 #endif /* NGI_SOUND_H */ 79