3 Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "irrlichttypes.h"
28 class OnDemandSoundFetcher
31 virtual void getSoundFilenames(const std::string &name,
32 std::set<std::string> &dst);
38 virtual ~ISoundManager(){}
40 // Multiple sounds can be loaded per name; when played, the sound
41 // should be chosen randomly from alternatives
42 // Return value determines success/failure
43 virtual bool loadSound(const std::string &name,
44 const std::string &filepath) = 0;
45 virtual bool loadSound(const std::string &name,
46 const std::vector<char> &filedata) = 0;
48 virtual void updateListener(v3f pos, v3f vel, v3f at, v3f up) = 0;
49 // playSound functions return -1 on failure, otherwise a handle to the
51 virtual int playSound(const std::string &name, int loopcount,
53 virtual int playSoundAt(const std::string &name, int loopcount,
54 v3f pos, float volume) = 0;
55 virtual void stopSound(int sound) = 0;
58 class DummySoundManager: public ISoundManager
61 virtual bool loadSound(const std::string &name,
62 const std::string &filepath) {return true;}
63 virtual bool loadSound(const std::string &name,
64 const std::vector<char> &filedata) {return true;}
65 void updateListener(v3f pos, v3f vel, v3f at, v3f up) {}
66 int playSound(const std::string &name, int loopcount,
67 float volume) {return 0;}
68 int playSoundAt(const std::string &name, int loopcount,
69 v3f pos, float volume) {return 0;}
70 void stopSound(int sound) {}
73 // Global DummySoundManager singleton
74 extern DummySoundManager dummySoundManager;