lmms
Cross-platform music production software
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:
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
77 void setInValue(float value);
78
79 inline const float getOutValue() const { return m_outValue; }
80
83 void setOutValue(float value);
84
86 void resetOutValue();
87
90 inline const float getValueOffset() const { return m_outValue - m_inValue; }
91
94 inline const float getInTangent() const { return m_inTangent; }
95
98 inline void setInTangent(float tangent) { m_inTangent = tangent; }
99
102 inline const float getOutTangent() const { return m_outTangent; }
103
106 inline void setOutTangent(float tangent) { m_outTangent = tangent; }
107
109 inline const bool lockedTangents() const { return m_lockedTangents; }
110
113 inline void setLockedTangents(bool b) { m_lockedTangents = b; }
114
117 inline void setClip(AutomationClip* clip) { m_clip = clip; }
118
119private:
121 int m_pos;
122
123 // Values of this node
126
133
137};
138
139} // namespace lmms
140
141#endif // LMMS_AUTOMATION_NODE_H
Definition AutomationClip.h:52
bool m_lockedTangents
Definition AutomationNode.h:136
AutomationNode & operator-=(float f)
Definition AutomationNode.h:51
void setOutValue(float value)
Sets the outValue of an automation node.
Definition AutomationNode.cpp:83
void resetOutValue()
Resets the outValue so it matches inValue.
Definition AutomationNode.cpp:99
void setClip(AutomationClip *clip)
Sets the clip this node belongs to.
Definition AutomationNode.h:117
const float getInTangent() const
Gets the tangent of the left side of the node.
Definition AutomationNode.h:94
const float getOutValue() const
Definition AutomationNode.h:79
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:102
float m_inValue
Definition AutomationNode.h:124
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:90
void setInTangent(float tangent)
Sets the tangent of the left side of the node.
Definition AutomationNode.h:98
AutomationClip * m_clip
Clip that this node belongs to.
Definition AutomationNode.h:120
AutomationNode()
Dummy constructor for the QMap.
Definition AutomationNode.cpp:34
int m_pos
Time position of this node (matches the timeMap key).
Definition AutomationNode.h:121
float m_inTangent
Slope at each point for calculating spline.
Definition AutomationNode.h:131
void setLockedTangents(bool b)
Locks or Unlocks the tangents from this node.
Definition AutomationNode.h:113
void setInValue(float value)
Sets the inValue of an automation node.
Definition AutomationNode.cpp:67
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:106
float m_outValue
Definition AutomationNode.h:125
float m_outTangent
Slope at each point for calculating spline.
Definition AutomationNode.h:132
const bool lockedTangents() const
Checks if the tangents from the node are locked.
Definition AutomationNode.h:109
Definition RemotePluginBase.cpp:34