i6engine  1.0
AudioConfig.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_AUDIOCONFIG_H__
26 #define __I6ENGINE_API_AUDIOCONFIG_H__
27 
30 
32 
33 namespace i6e {
34 namespace api {
35 namespace audio {
36 
37  typedef uint64_t SoundHandle;
38 
39 #define INVALID_SOUND UINT64_MAX
40 
51  };
52 
57  std::string file;
58  bool looping;
59  double maxDist;
62  bool cacheable;
63  std::string category;
64  Audio_Node_Create(int64_t c, const std::string & f, bool l, double m, const Vec3 & p, const Vec3 & d, bool ca, const std::string & cat) : GameMessageStruct(c, -1), file(f), looping(l), maxDist(m), position(p), direction(d), cacheable(ca), category(cat) {
65  }
67  return new Audio_Node_Create(*this);
68  }
70 
75  Audio_Node_Delete(int64_t c) : GameMessageStruct(c, -1) {
76  }
78  return new Audio_Node_Delete(*this);
79  }
81 
89  Audio_Listener_Update(const Vec3 & p, const Quaternion & r, const Vec3 & v) : GameMessageStruct(), position(p), rotation(r), velocity(v) {
90  }
92  return new Audio_Listener_Update(*this);
93  }
95 
101  Audio_Position_Update(int64_t c, const Vec3 & p) : GameMessageStruct(c, -1), position(p) {
102  }
104  return new Audio_Position_Update(*this);
105  }
107 
112  SoundHandle handle;
113  std::string file;
114  double maxDist;
117  bool cacheable;
118  std::string category;
119  Audio_PlaySound_Create(SoundHandle h, const std::string & f, double m, const Vec3 & p, const Vec3 & d, bool c, const std::string & cat) : GameMessageStruct(), handle(h), file(f), maxDist(m), position(p), direction(d), cacheable(c), category(cat) {
120  }
122  return new Audio_PlaySound_Create(*this);
123  }
125 
130  SoundHandle handle;
131  std::string file;
132  double maxDist;
135  bool cacheable;
136  std::string category;
137  std::function<void(bool)> callback;
138  Audio_PlaySoundWithCallback_Create(SoundHandle h, const std::string & f, double m, const Vec3 & p, const Vec3 & d, bool c, const std::string & cat, const std::function<void(bool)> & cb) : GameMessageStruct(), handle(h), file(f), maxDist(m), position(p), direction(d), cacheable(c), category(cat), callback(cb) {
139  }
141  return new Audio_PlaySoundWithCallback_Create(*this);
142  }
144 
149  SoundHandle handle;
150  Audio_StopSound_Delete(SoundHandle h) : GameMessageStruct(), handle(h) {
151  }
153  return new Audio_StopSound_Delete(*this);
154  }
156 
157 } /* namespace audio */
158 } /* namespace api */
159 } /* namespace i6e */
160 
161 #endif /* __I6ENGINE_API_AUDIOCONFIG_H__ */
162 
i6e::api::audio::Audio_Node_Create Audio_Node_Create
creates a new audio node
i6e::api::audio::Audio_Listener_Update Audio_Listener_Update
updates sound listener
Audio_StopSound_Delete * copy()
Copy method returning an exact copy of itself.
Definition: AudioConfig.h:152
uint64_t SoundHandle
Definition: AudioConfig.h:37
Class describing a 3d rotation.
Definition: i6eQuaternion.h:58
Audio_PlaySoundWithCallback_Create * copy()
Copy method returning an exact copy of itself.
Definition: AudioConfig.h:140
Audio_Position_Update * copy()
Copy method returning an exact copy of itself.
Definition: AudioConfig.h:103
Audio_PlaySound_Create(SoundHandle h, const std::string &f, double m, const Vec3 &p, const Vec3 &d, bool c, const std::string &cat)
Definition: AudioConfig.h:119
Audio_Node_Delete * copy()
Copy method returning an exact copy of itself.
Definition: AudioConfig.h:77
Implements 3-dimensional vectors.
Definition: i6eVector.h:48
Audio_PlaySoundWithCallback_Create(SoundHandle h, const std::string &f, double m, const Vec3 &p, const Vec3 &d, bool c, const std::string &cat, const std::function< void(bool)> &cb)
Definition: AudioConfig.h:138
i6e::api::audio::Audio_PlaySoundWithCallback_Create Audio_PlaySoundWithCallback_Create
plays given sound with callback
i6e::api::audio::Audio_Position_Update Audio_Position_Update
updates nodes position
Audio_Node_Create * copy()
Copy method returning an exact copy of itself.
Definition: AudioConfig.h:66
Audio_Listener_Update(const Vec3 &p, const Quaternion &r, const Vec3 &v)
Definition: AudioConfig.h:89
deletes an audio node
Definition: AudioConfig.h:74
creates a new audio node
Definition: AudioConfig.h:56
i6e::api::audio::Audio_Node_Delete Audio_Node_Delete
deletes an audio node
Audio_Listener_Update * copy()
Copy method returning an exact copy of itself.
Definition: AudioConfig.h:91
Audio_Node_Create(int64_t c, const std::string &f, bool l, double m, const Vec3 &p, const Vec3 &d, bool ca, const std::string &cat)
Definition: AudioConfig.h:64
Audio_PlaySound_Create * copy()
Copy method returning an exact copy of itself.
Definition: AudioConfig.h:121
Audio_Position_Update(int64_t c, const Vec3 &p)
Definition: AudioConfig.h:101
i6e::api::audio::Audio_StopSound_Delete Audio_StopSound_Delete
stops given sound
i6e::api::audio::Audio_PlaySound_Create Audio_PlaySound_Create
plays given sound once