Skip to content

Commit 723b328

Browse files
committed
Include definitions of LinearSmoothedValueAtomic's template methods in its header file (required because the explicit instantiations built in to the OE application are not visible to plugins on OS X)
1 parent 04033ec commit 723b328

2 files changed

Lines changed: 68 additions & 69 deletions

File tree

Source/Processors/Dsp/LinearSmoothedValueAtomic.cpp

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -28,72 +28,3 @@
2828
// Explicit instantiations
2929
template class LinearSmoothedValueAtomic<float>;
3030
template class LinearSmoothedValueAtomic<double>;
31-
32-
33-
template <typename FloatType>
34-
LinearSmoothedValueAtomic<FloatType>::LinearSmoothedValueAtomic() noexcept
35-
: currentValue (0)
36-
, target (0)
37-
, step (0)
38-
, countdown (0)
39-
, stepsToTarget (0)
40-
{
41-
}
42-
43-
44-
template <typename FloatType>
45-
LinearSmoothedValueAtomic<FloatType>::LinearSmoothedValueAtomic (FloatType initialValue) noexcept
46-
47-
: currentValue (initialValue)
48-
, target (initialValue)
49-
, step (0)
50-
, countdown (0)
51-
, stepsToTarget (0)
52-
{
53-
}
54-
55-
56-
template<typename FloatType>
57-
void LinearSmoothedValueAtomic<FloatType>::reset (double sampleRate, double rampLengthInSeconds) noexcept
58-
{
59-
jassert (sampleRate > 0 && rampLengthInSeconds >= 0);
60-
stepsToTarget = (int) std::floor (rampLengthInSeconds * sampleRate);
61-
currentValue = target;
62-
countdown = 0;
63-
}
64-
65-
66-
template<typename FloatType>
67-
void LinearSmoothedValueAtomic<FloatType>::setValue (FloatType newValue) noexcept
68-
{
69-
target.store (newValue);
70-
}
71-
72-
73-
template<typename FloatType>
74-
void LinearSmoothedValueAtomic<FloatType>::updateTarget() noexcept
75-
{
76-
FloatType newTarget = target.load();
77-
if (newTarget != currentTarget)
78-
{
79-
currentTarget = newTarget;
80-
countdown = stepsToTarget;
81-
82-
if (countdown <= 0)
83-
currentValue = currentTarget;
84-
else
85-
step = (currentTarget - currentValue) / (FloatType) countdown;
86-
}
87-
}
88-
89-
90-
template<typename FloatType>
91-
FloatType LinearSmoothedValueAtomic<FloatType>::getNextValue() noexcept
92-
{
93-
if (countdown <= 0)
94-
return currentTarget;
95-
96-
--countdown;
97-
currentValue += step;
98-
return currentValue;
99-
}

Source/Processors/Dsp/LinearSmoothedValueAtomic.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,72 @@ class PLUGIN_API LinearSmoothedValueAtomic
8686
};
8787

8888

89+
template <typename FloatType>
90+
LinearSmoothedValueAtomic<FloatType>::LinearSmoothedValueAtomic() noexcept
91+
: target (0)
92+
, currentValue (0)
93+
, step (0)
94+
, countdown (0)
95+
, stepsToTarget (0)
96+
{
97+
}
98+
99+
100+
template <typename FloatType>
101+
LinearSmoothedValueAtomic<FloatType>::LinearSmoothedValueAtomic (FloatType initialValue) noexcept
102+
: target (initialValue)
103+
, currentValue (initialValue)
104+
, step (0)
105+
, countdown (0)
106+
, stepsToTarget (0)
107+
{
108+
}
109+
110+
111+
template<typename FloatType>
112+
void LinearSmoothedValueAtomic<FloatType>::reset (double sampleRate, double rampLengthInSeconds) noexcept
113+
{
114+
jassert (sampleRate > 0 && rampLengthInSeconds >= 0);
115+
stepsToTarget = (int) std::floor (rampLengthInSeconds * sampleRate);
116+
currentValue = target;
117+
countdown = 0;
118+
}
119+
120+
121+
template<typename FloatType>
122+
void LinearSmoothedValueAtomic<FloatType>::setValue (FloatType newValue) noexcept
123+
{
124+
target.store (newValue);
125+
}
126+
127+
128+
template<typename FloatType>
129+
void LinearSmoothedValueAtomic<FloatType>::updateTarget() noexcept
130+
{
131+
FloatType newTarget = target.load();
132+
if (newTarget != currentTarget)
133+
{
134+
currentTarget = newTarget;
135+
countdown = stepsToTarget;
136+
137+
if (countdown <= 0)
138+
currentValue = currentTarget;
139+
else
140+
step = (currentTarget - currentValue) / (FloatType) countdown;
141+
}
142+
}
143+
144+
145+
template<typename FloatType>
146+
FloatType LinearSmoothedValueAtomic<FloatType>::getNextValue() noexcept
147+
{
148+
if (countdown <= 0)
149+
return currentTarget;
150+
151+
--countdown;
152+
currentValue += step;
153+
return currentValue;
154+
}
155+
156+
89157
#endif // JUCE_LINEARSMOOTHEDVALUE_H_INCLUDED

0 commit comments

Comments
 (0)