Audaspace  1.9.0
A high level audio library.
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 
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 
49 {
50 private:
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=
73  AnimateableProperty& operator=(const AnimateableProperty&) = delete;
74 
75  void AUD_LOCAL updateUnknownCache(int start, int end);
76 
77 public:
82  AnimateableProperty(int count = 1);
83 
90  AnimateableProperty(int count, float value);
91 
96 
101  int getCount() const;
102 
107  void write(const float* data);
108 
115  void write(const float* data, int position, int count);
116 
123  void writeConstantRange(const float* data, int position_start, int position_end);
124 
130  void read(float position, float* out);
131 
137  float readSingle(float position);
138 
143  bool isAnimated() const;
144 
148  const Buffer& getBuffer();
149 };
150 
#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
This class saves animation data for float properties.
Definition: AnimateableProperty.h:48
This class is a simple buffer in RAM which is 32 Byte aligned and provides resize functionality...
Definition: Buffer.h:33
The ILockable interface.
const sample_t * getBuffer() const
Returns the pointer to the buffer in memory.
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
AnimateablePropertyType
Possible animatable properties for Sequencer Factories and Entries.
Definition: AnimateableProperty.h:34
#define AUD_LOCAL
Used for hiding symbols from export in the shared library.
Definition: Audaspace.h:80
The Buffer class.