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 fetchSounds(const std::string &name,
32 std::set<std::string> &dst_paths,
33 std::set<std::vector<char> > &dst_datas) = 0;
39 virtual ~ISoundManager(){}
41 // Multiple sounds can be loaded per name; when played, the sound
42 // should be chosen randomly from alternatives
43 // Return value determines success/failure
44 virtual bool loadSound(const std::string &name,
45 const std::string &filepath) = 0;
46 virtual bool loadSound(const std::string &name,
47 const std::vector<char> &filedata) = 0;
49 virtual void updateListener(v3f pos, v3f vel, v3f at, v3f up) = 0;
50 // playSound functions return -1 on failure, otherwise a handle to the
52 virtual int playSound(const std::string &name, bool loop,
54 virtual int playSoundAt(const std::string &name, bool loop,
55 float volume, v3f pos) = 0;
56 virtual void stopSound(int sound) = 0;
59 class DummySoundManager: public ISoundManager
62 virtual bool loadSound(const std::string &name,
63 const std::string &filepath) {return true;}
64 virtual bool loadSound(const std::string &name,
65 const std::vector<char> &filedata) {return true;}
66 void updateListener(v3f pos, v3f vel, v3f at, v3f up) {}
67 int playSound(const std::string &name, bool loop,
68 float volume) {return 0;}
69 int playSoundAt(const std::string &name, bool loop,
70 float volume, v3f pos) {return 0;}
71 void stopSound(int sound) {}
74 // Global DummySoundManager singleton
75 extern DummySoundManager dummySoundManager;