Audaspace  1.3.0
A high level audio library.
SequenceEntry.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright 2009-2016 Jörg Müller
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 
17 #pragma once
18 
26 #include "util/ILockable.h"
27 
28 #include <mutex>
29 #include <memory>
30 
32 
33 class ISound;
34 
39 {
40  friend class SequenceHandle;
41 private:
43  int m_status;
44 
46  int m_pos_status;
47 
49  int m_sound_status;
50 
52  int m_id;
53 
55  std::shared_ptr<ISound> m_sound;
56 
58  float m_begin;
59 
61  float m_end;
62 
64  float m_skip;
65 
67  bool m_muted;
68 
70  bool m_relative;
71 
73  float m_volume_max;
74 
76  float m_volume_min;
77 
79  float m_distance_max;
80 
82  float m_distance_reference;
83 
85  float m_attenuation;
86 
88  float m_cone_angle_outer;
89 
91  float m_cone_angle_inner;
92 
94  float m_cone_volume_outer;
95 
97  std::recursive_mutex m_mutex;
98 
100  AnimateableProperty m_volume;
101 
103  AnimateableProperty m_panning;
104 
106  AnimateableProperty m_pitch;
107 
109  AnimateableProperty m_location;
110 
112  AnimateableProperty m_orientation;
113 
114  // delete copy constructor and operator=
115  SequenceEntry(const SequenceEntry&) = delete;
116  SequenceEntry& operator=(const SequenceEntry&) = delete;
117 
118 public:
127  SequenceEntry(std::shared_ptr<ISound> sound, float begin, float end, float skip, int id);
128  virtual ~SequenceEntry();
129 
133  virtual void lock();
134 
138  virtual void unlock();
139 
144  std::shared_ptr<ISound> getSound();
145 
150  void setSound(std::shared_ptr<ISound> sound);
151 
158  void move(float begin, float end, float skip);
159 
164  bool isMuted();
165 
170  void mute(bool mute);
171 
176  int getID() const;
177 
185 
191  bool isRelative();
192 
199  void setRelative(bool relative);
200 
206 
212  void setVolumeMaximum(float volume);
213 
219 
225  void setVolumeMinimum(float volume);
226 
234 
242  void setDistanceMaximum(float distance);
243 
249 
255  void setDistanceReference(float distance);
256 
261  float getAttenuation();
262 
269  void setAttenuation(float factor);
270 
276 
282  void setConeAngleOuter(float angle);
283 
289 
295  void setConeAngleInner(float angle);
296 
304 
312  void setConeVolumeOuter(float volume);
313 };
314 
Defines the AnimateableProperty class as well as existing property types.
AnimateablePropertyType
Possible animatable properties for Sequencer Factories and Entries.
Definition: AnimateableProperty.h:35
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
#define AUD_API
Used for exporting symbols in the shared library.
Definition: Audaspace.h:93
The ILockable interface.
This class saves animation data for float properties.
Definition: AnimateableProperty.h:47
This class provides an interface for lockable objects.
Definition: ILockable.h:34
This class represents a type of sound source and saves the necessary values for it.
Definition: ISound.h:40
This class represents a sequenced entry in a sequencer sound.
Definition: SequenceEntry.h:39
AnimateableProperty * getAnimProperty(AnimateablePropertyType type)
Retrieves one of the animated properties of the entry.
float getDistanceMaximum()
Retrieves the maximum distance of a source.
void move(float begin, float end, float skip)
Moves the entry.
int getID() const
Retrieves the ID of the entry.
float getVolumeMaximum()
Retrieves the maximum volume of a source.
void setVolumeMinimum(float volume)
Sets the minimum volume of a source.
void setDistanceReference(float distance)
Sets the reference distance of a source.
float getConeAngleInner()
Retrieves the inner angle of the cone of a source.
std::shared_ptr< ISound > getSound()
Retrieves the sound of the entry.
float getConeVolumeOuter()
Retrieves the outer volume of the cone of a source.
bool isRelative()
Checks whether the source location, velocity and orientation are relative to the listener.
float getVolumeMinimum()
Retrieves the minimum volume of a source.
float getDistanceReference()
Retrieves the reference distance of a source.
void setSound(std::shared_ptr< ISound > sound)
Sets the sound of the entry.
virtual void lock()
Locks the entry.
float getConeAngleOuter()
Retrieves the outer angle of the cone of a source.
void setAttenuation(float factor)
Sets the attenuation of a source.
void setVolumeMaximum(float volume)
Sets the maximum volume of a source.
void setConeVolumeOuter(float volume)
Sets the outer volume of the cone of a source.
SequenceEntry(std::shared_ptr< ISound > sound, float begin, float end, float skip, int id)
Creates a new sequenced entry.
void setConeAngleInner(float angle)
Sets the inner angle of the cone of a source.
void mute(bool mute)
Sets the muting state of the entry.
float getAttenuation()
Retrieves the attenuation of a source.
bool isMuted()
Retrieves the muting state of the entry.
void setRelative(bool relative)
Sets whether the source location, velocity and orientation are relative to the listener.
void setDistanceMaximum(float distance)
Sets the maximum distance of a source.
void setConeAngleOuter(float angle)
Sets the outer angle of the cone of a source.
virtual void unlock()
Unlocks the previously locked entry.