generated from ZL-Audio/ZLTemplate
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(filter attach): use async updater to update side freq/Q
- Loading branch information
Showing
5 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2024 - zsliu98 | ||
// This file is part of ZLEqualizer | ||
// | ||
// ZLEqualizer is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 as published by the Free Software Foundation. | ||
// | ||
// ZLEqualizer 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 Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License along with ZLEqualizer. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
#ifndef ZLCHORE_HPP | ||
#define ZLCHORE_HPP | ||
|
||
#include "para_updater.hpp" | ||
|
||
#endif //ZLCHORE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (C) 2024 - zsliu98 | ||
// This file is part of ZLEqualizer | ||
// | ||
// ZLEqualizer is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 as published by the Free Software Foundation. | ||
// | ||
// ZLEqualizer 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 Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License along with ZLEqualizer. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
#ifndef ZLCHORE_PARA_UPDATER_HPP | ||
#define ZLCHORE_PARA_UPDATER_HPP | ||
|
||
#include <juce_audio_processors/juce_audio_processors.h> | ||
|
||
namespace zlChore { | ||
class ParaUpdater final : private juce::AsyncUpdater { | ||
public: | ||
explicit ParaUpdater(const juce::AudioProcessorValueTreeState ¶meter, | ||
const std::string ¶meterIdx) { | ||
para = parameter.getParameter(parameterIdx); | ||
} | ||
|
||
void update(const float paraValue) { | ||
value.store(paraValue); | ||
triggerAsyncUpdate(); | ||
} | ||
|
||
private: | ||
juce::RangedAudioParameter *para; | ||
std::atomic<float> value; | ||
|
||
void handleAsyncUpdate() override { | ||
para->beginChangeGesture(); | ||
para->setValueNotifyingHost(value.load()); | ||
para->endChangeGesture(); | ||
} | ||
}; | ||
} | ||
|
||
#endif //ZLCHORE_PARA_UPDATER_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters