diff --git a/Packages/Package.swift b/Packages/Package.swift index eb9172c..c1613e1 100644 --- a/Packages/Package.swift +++ b/Packages/Package.swift @@ -14,7 +14,7 @@ let package = Package( .library(name: "UI", targets: ["UI"]) ], dependencies: [ - .package(url: "https://github.com/bradhowes/AUv3Support", exact: "14.0.4"), + .package(url: "https://github.com/bradhowes/AUv3Support", exact: "15.0.2"), // .package(path: "/Users/howes/src/Mine/AUv3Support") ], targets: [ diff --git a/Packages/Sources/Kernel/C++/Kernel.hpp b/Packages/Sources/Kernel/C++/Kernel.hpp index 210a051..213a48d 100644 --- a/Packages/Sources/Kernel/C++/Kernel.hpp +++ b/Packages/Sources/Kernel/C++/Kernel.hpp @@ -13,6 +13,8 @@ #import "DSPHeaders/EventProcessor.hpp" #import "DSPHeaders/Parameters/Float.hpp" +@import ParameterAddress; + /** The audio processing kernel that performs low-pass filtering of an audio signal. */ @@ -44,10 +46,13 @@ struct Kernel : public DSPHeaders::EventProcessor { initialize(format.channelCount, format.sampleRate); } + /// @return the Nyquist period value defined as 1 / (sampleRate / 2) AUValue nyquistPeriod() const noexcept { return nyquistPeriod_; } + /// @return the current filter cutoff setting AUValue cutoff() const noexcept { return cutoff_.getPending(); } + /// @return the current filter resonance setting AUValue resonance() const noexcept { return resonance_.getPending(); } os_log_t log() const noexcept { return log_; } @@ -61,48 +66,6 @@ struct Kernel : public DSPHeaders::EventProcessor { filter_.calculateParams(cutoff_.getImmediate(), resonance_.getImmediate(), nyquistPeriod_, channelCount); } - /** - Set a paramete value from within the render loop. - - @param address the parameter to change - @param value the new value to use - @param duration the ramping duration to transition to the new value - */ - bool doSetImmediateParameterValue(AUParameterAddress address, AUValue value, AUAudioFrameCount duration) noexcept; - - /** - Set a paramete value from the UI via the parameter tree. Will be recognized and handled in the next render pass. - - @param address the parameter to change - @param value the new value to use - */ - bool doSetPendingParameterValue(AUParameterAddress address, AUValue value) noexcept; - - /** - Get the paramete value last set in the render thread. NOTE: this does not account for any ramping that might be in - effect. - - @param address the parameter to access - @returns parameter value - */ - AUValue doGetImmediateParameterValue(AUParameterAddress address) const noexcept; - - /** - Get the paramete value last set by the UI / parameter tree. NOTE: this does not account for any ramping that might - be in effect. - - @param address the parameter to access - @returns parameter value - */ - AUValue doGetPendingParameterValue(AUParameterAddress address) const noexcept; - - /** - Notification that the rendering state has changed (stopped/started). - - @param rendering `true` if rendering has started - */ - void doRenderingStateChanged(bool rendering) {} - /** Perform rendering activity on input samples. @@ -121,17 +84,12 @@ struct Kernel : public DSPHeaders::EventProcessor { filter_.apply(ins, outs, frameCount); } - /** - Process a MIDI (v1) event. - - @param midiEvent the event that was received - */ - void doMIDIEvent(const AUMIDIEvent& midiEvent) noexcept {} - AcceleratedBiquadFilter filter_; AUValue nyquistPeriod_; - DSPHeaders::Parameters::Float cutoff_{0.0, false}; - DSPHeaders::Parameters::Float resonance_{0.0, false}; + + // NOTE: we do not use ramping in our parameters here because it is done in the biquad filter. + DSPHeaders::Parameters::Float cutoff_{ParameterAddressCutoff, 0.0, false}; + DSPHeaders::Parameters::Float resonance_{ParameterAddressResonance, 0.0, false}; std::string name_; os_log_t log_; }; diff --git a/Packages/Sources/Kernel/Kernel.mm b/Packages/Sources/Kernel/Kernel.mm deleted file mode 100644 index 93b68b3..0000000 --- a/Packages/Sources/Kernel/Kernel.mm +++ /dev/null @@ -1,37 +0,0 @@ -#import "C++/Kernel.hpp" - -// This must be done in a source file -- include files cannot see the Swift bridging file. - -@import ParameterAddress; - -bool Kernel::doSetImmediateParameterValue(AUParameterAddress address, AUValue value, AUAudioFrameCount duration) noexcept { - switch (address) { - case ParameterAddressCutoff: cutoff_.setImmediate(value, duration); return true; - case ParameterAddressResonance: resonance_.setImmediate(value, duration); return true; - } - return false; -} - -bool Kernel::doSetPendingParameterValue(AUParameterAddress address, AUValue value) noexcept { - switch (address) { - case ParameterAddressCutoff: cutoff_.setPending(value); return true; - case ParameterAddressResonance: resonance_.setPending(value); return true; - } - return false; -} - -AUValue Kernel::doGetImmediateParameterValue(AUParameterAddress address) const noexcept { - switch (address) { - case ParameterAddressCutoff: return cutoff_.getImmediate(); - case ParameterAddressResonance: return resonance_.getImmediate(); - } - return 0.0; -} - -AUValue Kernel::doGetPendingParameterValue(AUParameterAddress address) const noexcept { - switch (address) { - case ParameterAddressCutoff: return cutoff_.getPending(); - case ParameterAddressResonance: return resonance_.getPending(); - } - return 0.0; -} diff --git a/SimplyLowPass.xcodeproj/project.pbxproj b/SimplyLowPass.xcodeproj/project.pbxproj index 28247b3..40cf41e 100644 --- a/SimplyLowPass.xcodeproj/project.pbxproj +++ b/SimplyLowPass.xcodeproj/project.pbxproj @@ -1554,7 +1554,7 @@ repositoryURL = "https://github.com/bradhowes/AUv3Support"; requirement = { kind = exactVersion; - version = 14.0.4; + version = 15.0.2; }; }; /* End XCRemoteSwiftPackageReference section */