FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
actionaudio.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2017 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 // Standard C++ library includes
23 
24 // Platform specific includes
25 
26 // 3rd party library includes
27 
28 // FIFE includes
29 // These includes are split up in two parts, separated by one empty line
30 // First block: files included from the FIFE root src directory
31 // Second block: files included from the same folder
32 #include "util/log/logger.h"
33 #include "util/base/exception.h"
34 
35 #include "actionaudio.h"
36 
37 namespace FIFE {
38  static Logger _log(LM_AUDIO);
39 
41  m_name(""),
42  m_group(""),
43  m_volume(1.0),
44  m_maxVolume(1.0),
45  m_minVolume(0.0),
46  m_refDistance(1.0),
47  m_maxDistance(1000000.0),
48  m_rolloff(1.0),
49  m_pitch(1.0),
50  m_coneInnerAngle(360.0),
51  m_coneOuterAngle(360.0),
52  m_coneOuterGain(0.0),
53  m_looping(false),
54  m_positioning(false),
55  m_direction(false) {
56 
57  m_velocity = AudioSpaceCoordinate(0.0, 0.0, 0.0);
58 
59  }
60 
62  }
63 
64  void ActionAudio::setSoundFileName(const std::string& name) {
65  m_name = name;
66  }
67 
68  const std::string& ActionAudio::getSoundFileName() const {
69  return m_name;
70  }
71 
72  void ActionAudio::setGroupName(const std::string& name) {
73  m_group = name;
74  }
75 
76  const std::string& ActionAudio::getGroupName() const {
77  return m_group;
78  }
79 
80  void ActionAudio::setGain(float gain) {
81  m_volume = gain;
82  }
83 
84  float ActionAudio::getGain() const {
85  return m_volume;
86  }
87 
88  void ActionAudio::setMaxGain(float gain) {
89  m_maxVolume = gain;
90  }
91 
92  float ActionAudio::getMaxGain() const {
93  return m_maxVolume;
94  }
95 
96  void ActionAudio::setMinGain(float gain) {
97  m_minVolume = gain;
98  }
99 
100  float ActionAudio::getMinGain() const {
101  return m_minVolume;
102  }
103 
106  }
107 
109  return m_refDistance;
110  }
111 
114  }
115 
117  return m_maxDistance;
118  }
119 
120  void ActionAudio::setRolloff(float rolloff) {
121  m_rolloff = rolloff;
122  }
123 
124  float ActionAudio::getRolloff() const {
125  return m_rolloff;
126  }
127 
128  void ActionAudio::setPitch(float pitch) {
129  m_pitch = pitch;
130  }
131 
132  float ActionAudio::getPitch() const {
133  return m_pitch;
134  }
135 
136  void ActionAudio::setConeInnerAngle(float inner) {
137  m_coneInnerAngle = inner;
138  }
139 
141  return m_coneInnerAngle;
142  }
143 
144  void ActionAudio::setConeOuterAngle(float outer) {
145  m_coneOuterAngle = outer;
146  }
147 
149  return m_coneOuterAngle;
150  }
151 
152  void ActionAudio::setConeOuterGain(float gain) {
153  m_coneOuterGain = gain;
154  }
155 
157  return m_coneOuterGain;
158  }
159 
161  m_velocity = velocity;
162  }
163 
165  return m_velocity;
166  }
167 
168  void ActionAudio::setLooping(bool loop) {
169  m_looping = loop;
170  }
171 
172  bool ActionAudio::isLooping() const {
173  return m_looping;
174  }
175 
177  m_positioning = relative;
178  }
179 
181  return m_positioning;
182  }
183 
184  void ActionAudio::setDirection(bool direction) {
185  m_direction = direction;
186  }
187 
189  return m_direction;
190  }
191 }
void setRolloff(float rolloff)
Sets the AL_ROLEOFF_FACTOR.
void setGroupName(const std::string &name)
Sets the name of the group to which the emitter is added.
Definition: actionaudio.cpp:72
float getGain() const
Returns the gain of the emitter.
Definition: actionaudio.cpp:84
void setDirection(bool direction)
Sets if the sound should use the instance direction.
const std::string & getGroupName() const
Return the name of the group to which the emitter is added.
Definition: actionaudio.cpp:76
void setMaxGain(float gain)
Sets the max.
Definition: actionaudio.cpp:88
void setReferenceDistance(float distance)
Sets the distance under which the volume for the SoundEmitter would normally drop by half (before bei...
std::string m_name
Definition: actionaudio.h:196
float getRolloff() const
Return the AL_ROLEOFF_FACTOR.
void setRelativePositioning(bool relative)
Sets Positioning-Type Default is false.
void setPitch(float pitch)
Sets pitch multiplier.
DoublePoint3D AudioSpaceCoordinate
Definition: modelcoords.h:36
static Logger _log(LM_AUDIO)
bool isLooping() const
Return playing mode.
bool isRelativePositioning() const
Return Positioning-Type.
float getConeOuterAngle() const
Return outer angle of the sound cone, in degrees.
void setConeOuterGain(float gain)
Sets the gain when outside the oriented cone.
void setMinGain(float gain)
Sets the min.
Definition: actionaudio.cpp:96
void setGain(float gain)
Sets the gain of the emitter.
Definition: actionaudio.cpp:80
float getReferenceDistance() const
Return the reference distance.
float getMinGain() const
Returns the min.
float getMaxGain() const
Returns the max.
Definition: actionaudio.cpp:92
void setSoundFileName(const std::string &name)
Sets the name of the sound file.
Definition: actionaudio.cpp:64
void setVelocity(const AudioSpaceCoordinate &velocity)
Sets the velocity of the SoundEmitter in the virtual audio space.
std::iterator_traits< octet_iterator >::difference_type distance(octet_iterator first, octet_iterator last)
Definition: checked.h:198
float getMaxDistance() const
Return the max distance.
std::string m_group
Definition: actionaudio.h:197
void setConeInnerAngle(float inner)
Sets inner angle of the sound cone, in degrees.
const std::string & getSoundFileName() const
Return the name of the sound file.
Definition: actionaudio.cpp:68
void setMaxDistance(float distance)
Sets the max distance used with the Inverse Clamped Distance Model to set the distance where there wi...
void setConeOuterAngle(float outer)
Sets outer angle of the sound cone, in degrees.
float getConeInnerAngle() const
Return inner angle of the sound cone, in degrees.
float getConeOuterGain() const
Return the gain when outside the oriented cone.
const AudioSpaceCoordinate & getVelocity() const
Return the velocity of the SoundEmitter in the virtual audio space.
float getPitch() const
Return pitch multiplier.
Create a Logger instance to communicate with LogManager Logger stores information about the current m...
Definition: logger.h:211
bool isDirection() const
Return true if the Instance direction is used, false for undirected.
AudioSpaceCoordinate m_velocity
Definition: actionaudio.h:208
void setLooping(bool loop)
Sets the playing mode.