LMMS
Loading...
Searching...
No Matches
AutomationNode.h
Go to the documentation of this file.
1/*
2 * AutomationNode.h - Declaration of class AutomationNode, which contains
3 * all information about an automation node
4 *
5 * Copyright (c) 2020 Ian Caio <iancaio_dev/at/hotmail.com>
6 *
7 * This file is part of LMMS - https://lmms.io
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
23 *
24 */
25
26#ifndef LMMS_AUTOMATION_NODE_H
27#define LMMS_AUTOMATION_NODE_H
28
29namespace lmms
30{
31
32class AutomationClip;
33
34
35// Note: We use the default copy-assignment on the AutomationClip constructor. It's
36// fine for now as we don't have dynamic allocated members, but if any are added we should
37// have an user-defined one to perform a deep-copy.
39{
40public:
41 AutomationNode(); // Dummy constructor for the QMap
42 AutomationNode(AutomationClip* clip, float value, int pos);
43 AutomationNode(AutomationClip* clip, float inValue, float outValue, int pos);
44
46 {
47 m_inValue += f;
48 m_outValue += f;
49 return *this;
50 }
52 {
53 m_inValue -= f;
54 m_outValue -= f;
55 return *this;
56 }
58 {
59 m_inValue *= f;
60 m_outValue *= f;
61 return *this;
62 }
64 {
65 m_inValue /= f;
66 m_outValue /= f;
67 return *this;
68 }
69
70 inline const float getInValue() const
71 {
72 return m_inValue;
73 }
74 void setInValue(float value);
75
76 inline const float getOutValue() const
77 {
78 return m_outValue;
79 }
80 void setOutValue(float value);
81 void resetOutValue();
82
87 inline const float getValueOffset() const
88 {
89 return m_outValue - m_inValue;
90 }
91
96 inline const float getInTangent() const
97 {
98 return m_inTangent;
99 }
100
105 inline void setInTangent(float tangent)
106 {
107 m_inTangent = tangent;
108 }
109
114 inline const float getOutTangent() const
115 {
116 return m_outTangent;
117 }
118
123 inline void setOutTangent(float tangent)
124 {
125 m_outTangent = tangent;
126 }
127
131 inline const bool lockedTangents() const
132 {
133 return m_lockedTangents;
134 }
135
139 inline void setLockedTangents(bool b)
140 {
142 }
143
149 inline void setClip(AutomationClip* clip)
150 {
151 m_clip = clip;
152 }
153
154private:
155 // Clip that this node belongs to
157
158 // Time position of this node (matches the timeMap key)
159 int m_pos;
160
161 // Values of this node
164
165 // Slope at each point for calculating spline
166 // We might have discrete jumps between curves, so we possibly have
167 // two different tangents for each side of the curve. If inValue and
168 // outValue are equal, inTangent and outTangent are equal too.
171
172 // If the tangents were edited manually, this will be true. That way
173 // the tangents from this node will not be recalculated. It's set back
174 // to false if the tangents are reset.
176};
177
178} // namespace lmms
179
180#endif // LMMS_AUTOMATION_NODE_H
Definition AutomationClip.h:52
bool m_lockedTangents
Definition AutomationNode.h:175
AutomationNode & operator-=(float f)
Definition AutomationNode.h:51
void setOutValue(float value)
Sets the outValue of an automation node.
Definition AutomationNode.cpp:91
void resetOutValue()
Resets the outValue so it matches inValue.
Definition AutomationNode.cpp:110
void setClip(AutomationClip *clip)
Sets the clip this node belongs to.
Definition AutomationNode.h:149
const float getInTangent() const
Gets the tangent of the left side of the node.
Definition AutomationNode.h:96
const float getOutValue() const
Definition AutomationNode.h:76
AutomationNode & operator*=(float f)
Definition AutomationNode.h:57
const float getOutTangent() const
Gets the tangent of the right side of the node.
Definition AutomationNode.h:114
float m_inValue
Definition AutomationNode.h:162
const float getInValue() const
Definition AutomationNode.h:70
AutomationNode & operator+=(float f)
Definition AutomationNode.h:45
const float getValueOffset() const
Gets the offset between inValue and outValue.
Definition AutomationNode.h:87
void setInTangent(float tangent)
Sets the tangent of the left side of the node.
Definition AutomationNode.h:105
AutomationClip * m_clip
Definition AutomationNode.h:156
AutomationNode()
Definition AutomationNode.cpp:34
int m_pos
Definition AutomationNode.h:159
float m_inTangent
Definition AutomationNode.h:169
void setLockedTangents(bool b)
Locks or Unlocks the tangents from this node.
Definition AutomationNode.h:139
void setInValue(float value)
Sets the inValue of an automation node.
Definition AutomationNode.cpp:71
AutomationNode & operator/=(float f)
Definition AutomationNode.h:63
void setOutTangent(float tangent)
Sets the tangent of the right side of the node.
Definition AutomationNode.h:123
float m_outValue
Definition AutomationNode.h:163
float m_outTangent
Definition AutomationNode.h:170
const bool lockedTangents() const
Checks if the tangents from the node are locked.
Definition AutomationNode.h:131
unsigned f
Definition inflate.c:1572
static PuglViewHint int value
Definition pugl.h:1708
Definition AudioAlsa.cpp:35
b
Definition crypt.c:628