@@ -1,114 +0,0 @@ | |||
diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp | |||
index 20dee10..ca6dd27 100644 | |||
--- a/modules/juce_audio_processors/juce_audio_processors.cpp | |||
+++ b/modules/juce_audio_processors/juce_audio_processors.cpp | |||
@@ -86,24 +86,9 @@ static inline bool arrayContainsPlugin (const OwnedArray<PluginDescription>& lis | |||
struct AutoResizingNSViewComponent : public ViewComponentBaseClass, | |||
private AsyncUpdater | |||
{ | |||
- AutoResizingNSViewComponent() : recursive (false) {} | |||
- | |||
- void childBoundsChanged (Component*) override | |||
- { | |||
- if (recursive) | |||
- { | |||
- triggerAsyncUpdate(); | |||
- } | |||
- else | |||
- { | |||
- recursive = true; | |||
- resizeToFitView(); | |||
- recursive = true; | |||
- } | |||
- } | |||
- | |||
- void handleAsyncUpdate() override { resizeToFitView(); } | |||
- | |||
+ AutoResizingNSViewComponent(); | |||
+ void childBoundsChanged (Component*) override; | |||
+ void handleAsyncUpdate() override; | |||
bool recursive; | |||
}; | |||
@@ -111,33 +96,61 @@ struct AutoResizingNSViewComponent : public ViewComponentBaseClass, | |||
struct AutoResizingNSViewComponentWithParent : public AutoResizingNSViewComponent, | |||
private Timer | |||
{ | |||
- AutoResizingNSViewComponentWithParent() | |||
- { | |||
- JUCE_IOS_MAC_VIEW* v = [[JUCE_IOS_MAC_VIEW alloc] init]; | |||
- setView (v); | |||
- [v release]; | |||
+ AutoResizingNSViewComponentWithParent(); | |||
+ JUCE_IOS_MAC_VIEW* getChildView() const; | |||
+ void timerCallback() override; | |||
+}; | |||
- startTimer (30); | |||
- } | |||
+//============================================================================== | |||
+AutoResizingNSViewComponent::AutoResizingNSViewComponent() | |||
+ : recursive (false) {} | |||
- JUCE_IOS_MAC_VIEW* getChildView() const | |||
+void AutoResizingNSViewComponent::childBoundsChanged (Component*) override | |||
+{ | |||
+ if (recursive) | |||
{ | |||
- if (JUCE_IOS_MAC_VIEW* parent = (JUCE_IOS_MAC_VIEW*) getView()) | |||
- if ([[parent subviews] count] > 0) | |||
- return [[parent subviews] objectAtIndex: 0]; | |||
- | |||
- return nil; | |||
+ triggerAsyncUpdate(); | |||
} | |||
+ else | |||
+ { | |||
+ recursive = true; | |||
+ resizeToFitView(); | |||
+ recursive = true; | |||
+ } | |||
+} | |||
- void timerCallback() override | |||
+void AutoResizingNSViewComponent::handleAsyncUpdate() override | |||
+{ | |||
+ resizeToFitView(); | |||
+} | |||
+ | |||
+//============================================================================== | |||
+AutoResizingNSViewComponentWithParent::AutoResizingNSViewComponentWithParent() | |||
+{ | |||
+ JUCE_IOS_MAC_VIEW* v = [[JUCE_IOS_MAC_VIEW alloc] init]; | |||
+ setView (v); | |||
+ [v release]; | |||
+ | |||
+ startTimer (30); | |||
+} | |||
+ | |||
+JUCE_IOS_MAC_VIEW* AutoResizingNSViewComponentWithParent::getChildView() const | |||
+{ | |||
+ if (JUCE_IOS_MAC_VIEW* parent = (JUCE_IOS_MAC_VIEW*) getView()) | |||
+ if ([[parent subviews] count] > 0) | |||
+ return [[parent subviews] objectAtIndex: 0]; | |||
+ | |||
+ return nil; | |||
+} | |||
+ | |||
+void AutoResizingNSViewComponentWithParent::timerCallback() override | |||
+{ | |||
+ if (JUCE_IOS_MAC_VIEW* child = getChildView()) | |||
{ | |||
- if (JUCE_IOS_MAC_VIEW* child = getChildView()) | |||
- { | |||
- stopTimer(); | |||
- setView (child); | |||
- } | |||
+ stopTimer(); | |||
+ setView (child); | |||
} | |||
-}; | |||
+} | |||
#endif | |||
#if JUCE_CLANG |
@@ -1,244 +0,0 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2013 - Raw Material Software Ltd. | |||
Permission is granted to use this software under the terms of either: | |||
a) the GPL v2 (or any later version) | |||
b) the Affero GPL v3 | |||
Details of these licenses can be found at: www.gnu.org/licenses | |||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
------------------------------------------------------------------------------ | |||
To release a closed-source product which uses JUCE, commercial licenses are | |||
available: visit www.juce.com for more information. | |||
============================================================================== | |||
*/ | |||
#if JUCE_INTEL | |||
#define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8 || n > 1.0e-8)) n = 0; | |||
#else | |||
#define JUCE_SNAP_TO_ZERO(n) | |||
#endif | |||
namespace juce | |||
{ | |||
//============================================================================== | |||
IIRFilterOld::IIRFilterOld() | |||
: active (false), v1 (0), v2 (0) | |||
{ | |||
zeromem (coefficients, sizeof (coefficients)); | |||
} | |||
IIRFilterOld::IIRFilterOld (const IIRFilterOld& other) | |||
: active (other.active), v1 (0), v2 (0) | |||
{ | |||
const SpinLock::ScopedLockType sl (other.processLock); | |||
memcpy (coefficients, other.coefficients, sizeof (coefficients)); | |||
} | |||
IIRFilterOld::~IIRFilterOld() | |||
{ | |||
} | |||
//============================================================================== | |||
void IIRFilterOld::reset() noexcept | |||
{ | |||
const SpinLock::ScopedLockType sl (processLock); | |||
v1 = v2 = 0; | |||
} | |||
float IIRFilterOld::processSingleSampleRaw (const float in) noexcept | |||
{ | |||
float out = coefficients[0] * in + v1; | |||
JUCE_SNAP_TO_ZERO (out); | |||
v1 = coefficients[1] * in - coefficients[3] * out + v2; | |||
v2 = coefficients[2] * in - coefficients[4] * out; | |||
return out; | |||
} | |||
void IIRFilterOld::processSamples (float* const samples, | |||
const int numSamples) noexcept | |||
{ | |||
const SpinLock::ScopedLockType sl (processLock); | |||
if (active) | |||
{ | |||
const float c0 = coefficients[0]; | |||
const float c1 = coefficients[1]; | |||
const float c2 = coefficients[2]; | |||
const float c3 = coefficients[3]; | |||
const float c4 = coefficients[4]; | |||
float lv1 = v1, lv2 = v2; | |||
for (int i = 0; i < numSamples; ++i) | |||
{ | |||
const float in = samples[i]; | |||
const float out = c0 * in + lv1; | |||
samples[i] = out; | |||
lv1 = c1 * in - c3 * out + lv2; | |||
lv2 = c2 * in - c4 * out; | |||
} | |||
JUCE_SNAP_TO_ZERO (lv1); v1 = lv1; | |||
JUCE_SNAP_TO_ZERO (lv2); v2 = lv2; | |||
} | |||
} | |||
//============================================================================== | |||
void IIRFilterOld::makeLowPass (const double sampleRate, | |||
const double frequency) noexcept | |||
{ | |||
jassert (sampleRate > 0); | |||
const double n = 1.0 / tan (double_Pi * frequency / sampleRate); | |||
const double nSquared = n * n; | |||
const double c1 = 1.0 / (1.0 + std::sqrt (2.0) * n + nSquared); | |||
setCoefficients (c1, | |||
c1 * 2.0f, | |||
c1, | |||
1.0, | |||
c1 * 2.0 * (1.0 - nSquared), | |||
c1 * (1.0 - std::sqrt (2.0) * n + nSquared)); | |||
} | |||
void IIRFilterOld::makeHighPass (const double sampleRate, | |||
const double frequency) noexcept | |||
{ | |||
const double n = tan (double_Pi * frequency / sampleRate); | |||
const double nSquared = n * n; | |||
const double c1 = 1.0 / (1.0 + std::sqrt (2.0) * n + nSquared); | |||
setCoefficients (c1, | |||
c1 * -2.0f, | |||
c1, | |||
1.0, | |||
c1 * 2.0 * (nSquared - 1.0), | |||
c1 * (1.0 - std::sqrt (2.0) * n + nSquared)); | |||
} | |||
void IIRFilterOld::makeLowShelf (const double sampleRate, | |||
const double cutOffFrequency, | |||
const double Q, | |||
const float gainFactor) noexcept | |||
{ | |||
jassert (sampleRate > 0); | |||
jassert (Q > 0); | |||
const double A = jmax (0.0f, gainFactor); | |||
const double aminus1 = A - 1.0; | |||
const double aplus1 = A + 1.0; | |||
const double omega = (double_Pi * 2.0 * jmax (cutOffFrequency, 2.0)) / sampleRate; | |||
const double coso = std::cos (omega); | |||
const double beta = std::sin (omega) * std::sqrt (A) / Q; | |||
const double aminus1TimesCoso = aminus1 * coso; | |||
setCoefficients (A * (aplus1 - aminus1TimesCoso + beta), | |||
A * 2.0 * (aminus1 - aplus1 * coso), | |||
A * (aplus1 - aminus1TimesCoso - beta), | |||
aplus1 + aminus1TimesCoso + beta, | |||
-2.0 * (aminus1 + aplus1 * coso), | |||
aplus1 + aminus1TimesCoso - beta); | |||
} | |||
void IIRFilterOld::makeHighShelf (const double sampleRate, | |||
const double cutOffFrequency, | |||
const double Q, | |||
const float gainFactor) noexcept | |||
{ | |||
jassert (sampleRate > 0); | |||
jassert (Q > 0); | |||
const double A = jmax (0.0f, gainFactor); | |||
const double aminus1 = A - 1.0; | |||
const double aplus1 = A + 1.0; | |||
const double omega = (double_Pi * 2.0 * jmax (cutOffFrequency, 2.0)) / sampleRate; | |||
const double coso = std::cos (omega); | |||
const double beta = std::sin (omega) * std::sqrt (A) / Q; | |||
const double aminus1TimesCoso = aminus1 * coso; | |||
setCoefficients (A * (aplus1 + aminus1TimesCoso + beta), | |||
A * -2.0 * (aminus1 + aplus1 * coso), | |||
A * (aplus1 + aminus1TimesCoso - beta), | |||
aplus1 - aminus1TimesCoso + beta, | |||
2.0 * (aminus1 - aplus1 * coso), | |||
aplus1 - aminus1TimesCoso - beta); | |||
} | |||
void IIRFilterOld::makeBandPass (const double sampleRate, | |||
const double centreFrequency, | |||
const double Q, | |||
const float gainFactor) noexcept | |||
{ | |||
jassert (sampleRate > 0); | |||
jassert (Q > 0); | |||
const double A = jmax (0.0f, gainFactor); | |||
const double omega = (double_Pi * 2.0 * jmax (centreFrequency, 2.0)) / sampleRate; | |||
const double alpha = 0.5 * std::sin (omega) / Q; | |||
const double c2 = -2.0 * std::cos (omega); | |||
const double alphaTimesA = alpha * A; | |||
const double alphaOverA = alpha / A; | |||
setCoefficients (1.0 + alphaTimesA, | |||
c2, | |||
1.0 - alphaTimesA, | |||
1.0 + alphaOverA, | |||
c2, | |||
1.0 - alphaOverA); | |||
} | |||
void IIRFilterOld::makeInactive() noexcept | |||
{ | |||
const SpinLock::ScopedLockType sl (processLock); | |||
active = false; | |||
} | |||
//============================================================================== | |||
void IIRFilterOld::copyCoefficientsFrom (const IIRFilterOld& other) noexcept | |||
{ | |||
const SpinLock::ScopedLockType sl (processLock); | |||
memcpy (coefficients, other.coefficients, sizeof (coefficients)); | |||
active = other.active; | |||
} | |||
//============================================================================== | |||
void IIRFilterOld::setCoefficients (double c1, double c2, double c3, | |||
double c4, double c5, double c6) noexcept | |||
{ | |||
const double a = 1.0 / c4; | |||
c1 *= a; | |||
c2 *= a; | |||
c3 *= a; | |||
c5 *= a; | |||
c6 *= a; | |||
const SpinLock::ScopedLockType sl (processLock); | |||
coefficients[0] = (float) c1; | |||
coefficients[1] = (float) c2; | |||
coefficients[2] = (float) c3; | |||
coefficients[3] = (float) c5; | |||
coefficients[4] = (float) c6; | |||
active = true; | |||
} | |||
#undef JUCE_SNAP_TO_ZERO | |||
} // namespace juce |
@@ -1,151 +0,0 @@ | |||
/* | |||
============================================================================== | |||
This file is part of the JUCE library. | |||
Copyright (c) 2013 - Raw Material Software Ltd. | |||
Permission is granted to use this software under the terms of either: | |||
a) the GPL v2 (or any later version) | |||
b) the Affero GPL v3 | |||
Details of these licenses can be found at: www.gnu.org/licenses | |||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||
A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||
------------------------------------------------------------------------------ | |||
To release a closed-source product which uses JUCE, commercial licenses are | |||
available: visit www.juce.com for more information. | |||
============================================================================== | |||
*/ | |||
#ifndef __JUCE_IIRFILTER_OLD_JUCEHEADER__ | |||
#define __JUCE_IIRFILTER_OLD_JUCEHEADER__ | |||
namespace juce | |||
{ | |||
//============================================================================== | |||
/** | |||
An IIR filter that can perform low, high, or band-pass filtering on an | |||
audio signal. | |||
@see IIRFilterAudioSource | |||
*/ | |||
class JUCE_API IIRFilterOld | |||
{ | |||
public: | |||
//============================================================================== | |||
/** Creates a filter. | |||
Initially the filter is inactive, so will have no effect on samples that | |||
you process with it. Use the appropriate method to turn it into the type | |||
of filter needed. | |||
*/ | |||
IIRFilterOld(); | |||
/** Creates a copy of another filter. */ | |||
IIRFilterOld (const IIRFilterOld& other); | |||
/** Destructor. */ | |||
~IIRFilterOld(); | |||
//============================================================================== | |||
/** Resets the filter's processing pipeline, ready to start a new stream of data. | |||
Note that this clears the processing state, but the type of filter and | |||
its coefficients aren't changed. To put a filter into an inactive state, use | |||
the makeInactive() method. | |||
*/ | |||
void reset() noexcept; | |||
/** Performs the filter operation on the given set of samples. | |||
*/ | |||
void processSamples (float* samples, | |||
int numSamples) noexcept; | |||
/** Processes a single sample, without any locking or checking. | |||
Use this if you need fast processing of a single value, but be aware that | |||
this isn't thread-safe in the way that processSamples() is. | |||
*/ | |||
float processSingleSampleRaw (float sample) noexcept; | |||
//============================================================================== | |||
/** Sets the filter up to act as a low-pass filter. | |||
*/ | |||
void makeLowPass (double sampleRate, | |||
double frequency) noexcept; | |||
/** Sets the filter up to act as a high-pass filter. | |||
*/ | |||
void makeHighPass (double sampleRate, | |||
double frequency) noexcept; | |||
//============================================================================== | |||
/** Sets the filter up to act as a low-pass shelf filter with variable Q and gain. | |||
The gain is a scale factor that the low frequencies are multiplied by, so values | |||
greater than 1.0 will boost the low frequencies, values less than 1.0 will | |||
attenuate them. | |||
*/ | |||
void makeLowShelf (double sampleRate, | |||
double cutOffFrequency, | |||
double Q, | |||
float gainFactor) noexcept; | |||
/** Sets the filter up to act as a high-pass shelf filter with variable Q and gain. | |||
The gain is a scale factor that the high frequencies are multiplied by, so values | |||
greater than 1.0 will boost the high frequencies, values less than 1.0 will | |||
attenuate them. | |||
*/ | |||
void makeHighShelf (double sampleRate, | |||
double cutOffFrequency, | |||
double Q, | |||
float gainFactor) noexcept; | |||
/** Sets the filter up to act as a band pass filter centred around a | |||
frequency, with a variable Q and gain. | |||
The gain is a scale factor that the centre frequencies are multiplied by, so | |||
values greater than 1.0 will boost the centre frequencies, values less than | |||
1.0 will attenuate them. | |||
*/ | |||
void makeBandPass (double sampleRate, | |||
double centreFrequency, | |||
double Q, | |||
float gainFactor) noexcept; | |||
/** Clears the filter's coefficients so that it becomes inactive. | |||
*/ | |||
void makeInactive() noexcept; | |||
//============================================================================== | |||
/** Makes this filter duplicate the set-up of another one. | |||
*/ | |||
void copyCoefficientsFrom (const IIRFilterOld& other) noexcept; | |||
protected: | |||
//============================================================================== | |||
SpinLock processLock; | |||
void setCoefficients (double c1, double c2, double c3, | |||
double c4, double c5, double c6) noexcept; | |||
bool active; | |||
float coefficients[5]; | |||
float v1, v2; | |||
// (use the copyCoefficientsFrom() method instead of this operator) | |||
IIRFilterOld& operator= (const IIRFilterOld&); | |||
JUCE_LEAK_DETECTOR (IIRFilterOld) | |||
}; | |||
} // namespace juce | |||
#endif // __JUCE_IIRFILTER_OLD_JUCEHEADER__ |
@@ -1,24 +0,0 @@ | |||
diff --git a/modules/juce_audio_basics/juce_audio_basics.cpp b/modules/juce_audio_basics/juce_audio_basics.cpp | |||
index 258de8f..c5a6bfa 100644 | |||
--- a/modules/juce_audio_basics/juce_audio_basics.cpp | |||
+++ b/modules/juce_audio_basics/juce_audio_basics.cpp | |||
@@ -83,6 +83,7 @@ namespace juce | |||
#include "buffers/juce_FloatVectorOperations.cpp" | |||
#include "buffers/juce_AudioChannelSet.cpp" | |||
#include "effects/juce_IIRFilter.cpp" | |||
+#include "effects/juce_IIRFilterOld.cpp" | |||
#include "effects/juce_LagrangeInterpolator.cpp" | |||
#include "effects/juce_CatmullRomInterpolator.cpp" | |||
#include "midi/juce_MidiBuffer.cpp" | |||
diff --git a/modules/juce_audio_basics/juce_audio_basics.h b/modules/juce_audio_basics/juce_audio_basics.h | |||
index feb2a6e..ce6c8f4 100644 | |||
--- a/modules/juce_audio_basics/juce_audio_basics.h | |||
+++ b/modules/juce_audio_basics/juce_audio_basics.h | |||
@@ -63,6 +63,7 @@ namespace juce | |||
#include "buffers/juce_AudioChannelSet.h" | |||
#include "effects/juce_Decibels.h" | |||
#include "effects/juce_IIRFilter.h" | |||
+#include "effects/juce_IIRFilterOld.h" | |||
#include "effects/juce_LagrangeInterpolator.h" | |||
#include "effects/juce_CatmullRomInterpolator.h" | |||
#include "effects/juce_LinearSmoothedValue.h" |