Audaspace 1.10.0
A high level audio library.
Loading...
Searching...
No Matches
AnimateableProperty.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
24
25#include "util/Buffer.h"
26#include "util/ILockable.h"
27
28#include <mutex>
29#include <list>
30
32
35{
36 AP_VOLUME,
37 AP_PANNING,
38 AP_PITCH,
39 AP_LOCATION,
40 AP_ORIENTATION,
41 AP_TIME_STRETCH,
42 AP_PITCH_SCALE
43};
44
48class AUD_API AnimateableProperty : private Buffer
49{
50private:
51 struct Unknown {
52 int start;
53 int end;
54
55 Unknown(int start, int end) :
56 start(start), end(end) {}
57 };
58
60 const int m_count;
61
63 bool m_isAnimated;
64
66 std::recursive_mutex m_mutex;
67
69 std::list<Unknown> m_unknown;
70
71 // delete copy constructor and operator=
72 AnimateableProperty(const AnimateableProperty&) = delete;
73 AnimateableProperty& operator=(const AnimateableProperty&) = delete;
74
75 void AUD_LOCAL updateUnknownCache(int start, int end);
76 void AUD_LOCAL updateUnknownAfterWrite(int pos, int position, int count);
77
78public:
83 AnimateableProperty(int count = 1);
84
91 AnimateableProperty(int count, float value);
92
97
102 int getCount() const;
103
108 void write(const float* data);
109
116 void write(const float* data, int position, int count);
117
124 void writeConstantRange(const float* data, int position_start, int position_end);
125
131 void read(float position, float* out);
132
138 float readSingle(float position);
139
144 bool isAnimated() const;
145
149 const Buffer& getBuffer();
150};
151
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_LOCAL
Used for hiding symbols from export in the shared library.
Definition Audaspace.h:80
#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 Buffer class.
The ILockable interface.
AnimateableProperty(int count=1)
Creates a new animateable property.
void write(const float *data)
Writes the properties value and marks it non-animated.
void read(float position, float *out)
Reads the properties value.
~AnimateableProperty()
Destroys the animateable property.
void writeConstantRange(const float *data, int position_start, int position_end)
Fills the properties frame range with constant value and marks it animated.
bool isAnimated() const
Returns whether the property is animated.
float readSingle(float position)
Reads the property's value at the specified position, assuming there is exactly one value.
const Buffer & getBuffer()
Returns this object cast as a Buffer.
void write(const float *data, int position, int count)
Writes the properties value and marks it animated.
AnimateableProperty(int count, float value)
Creates a new animateable property.
int getCount() const
Returns the count of floats for a single property.