Line data Source code
1 : /* Copyright (C) 2020 Wildfire Games.
2 : * This file is part of 0 A.D.
3 : *
4 : * 0 A.D. is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 2 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * 0 A.D. is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 : */
17 :
18 : #ifndef INCLUDED_ICMPSOUNDMANAGER
19 : #define INCLUDED_ICMPSOUNDMANAGER
20 :
21 : #include "simulation2/system/Interface.h"
22 :
23 : #include "lib/file/vfs/vfs_path.h"
24 : #include "maths/FixedVector3D.h"
25 : #include "simulation2/helpers/Player.h"
26 :
27 : /**
28 : * Interface to the engine's sound system.
29 : */
30 6 : class ICmpSoundManager : public IComponent
31 : {
32 : public:
33 : /**
34 : * Start playing audio defined by a sound group file.
35 : * @param name VFS path of sound group .xml, relative to audio/.
36 : * @param source entity emitting the sound (used for positioning).
37 : */
38 : virtual void PlaySoundGroup(const std::wstring& name, entity_id_t source) = 0;
39 :
40 : /**
41 : * Start playing audio defined by a sound group file.
42 : * @param name VFS path of sound group .xml, relative to audio/.
43 : * @param sourcePos 3d position of the sound emitter.
44 : */
45 : virtual void PlaySoundGroupAtPosition(const std::wstring& name, const CFixedVector3D& sourcePos) = 0;
46 :
47 : /**
48 : * Start playing audio defined by a sound group file for a player.
49 : * @param name VFS path of sound group .xml, relative to audio/.
50 : * @param player the player entity.
51 : */
52 : virtual void PlaySoundGroupForPlayer(const VfsPath& groupPath, const player_id_t playerId) const = 0;
53 :
54 : virtual void StopMusic() = 0;
55 :
56 116 : DECLARE_INTERFACE_TYPE(SoundManager)
57 : };
58 :
59 : #endif // INCLUDED_ICMPSOUNDMANAGER
|