generated from ZL-Audio/ZLTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
556 additions
and
54 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
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
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,66 @@ | ||
// Copyright (C) 2024 - zsliu98 | ||
// This file is part of ZLSplit | ||
// | ||
// ZLSplit is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
// | ||
// ZLSplit 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. | ||
// | ||
// You should have received a copy of the GNU General Public License along with ZLSplit. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
#include "controller.hpp" | ||
|
||
namespace zlDSP { | ||
Controller::Controller() { | ||
|
||
} | ||
|
||
void Controller::reset() { | ||
lrSplitter.reset(); | ||
msSplitter.reset(); | ||
} | ||
|
||
void Controller::prepare(const juce::dsp::ProcessSpec &spec) { | ||
lrSplitter.prepare(spec); | ||
msSplitter.prepare(spec); | ||
} | ||
|
||
void Controller::process(juce::AudioBuffer<double> &buffer) { | ||
switch (splitType.load()) { | ||
case splitType::lright: { | ||
processLR(buffer); | ||
break; | ||
} | ||
case splitType::mside: { | ||
processMS(buffer); | ||
break; | ||
} | ||
case splitType::lhigh: { | ||
break; | ||
} | ||
case splitType::ttone: { | ||
break; | ||
} | ||
} | ||
} | ||
|
||
void Controller::processLR(juce::AudioBuffer<double> &buffer) { | ||
lrSplitter.split(buffer); | ||
const auto currentMix = mix.load(); | ||
const auto lBlock = juce::dsp::AudioBlock<double>(lrSplitter.getLBuffer()); | ||
const auto rBlock = juce::dsp::AudioBlock<double>(lrSplitter.getRBuffer()); | ||
const auto block = juce::dsp::AudioBlock<double>(buffer); | ||
std::array<juce::dsp::AudioBlock<double>, 4> blocks; | ||
for (size_t i = 0; i < 4; ++i) { | ||
blocks[i] = block.getSingleChannelBlock(i); | ||
} | ||
blocks[0].replaceWithProductOf(lBlock, 1.0 - currentMix); | ||
blocks[1].replaceWithProductOf(rBlock, currentMix); | ||
blocks[2].replaceWithProductOf(lBlock, currentMix); | ||
blocks[3].replaceWithProductOf(rBlock, 1.0 - currentMix); | ||
} | ||
|
||
void Controller::processMS(juce::AudioBuffer<double> &buffer) { | ||
|
||
} | ||
|
||
} // zlDSP |
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,57 @@ | ||
// Copyright (C) 2024 - zsliu98 | ||
// This file is part of ZLSplit | ||
// | ||
// ZLSplit is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
// | ||
// ZLSplit 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. | ||
// | ||
// You should have received a copy of the GNU General Public License along with ZLSplit. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
#ifndef CONTROLLER_HPP | ||
#define CONTROLLER_HPP | ||
|
||
#include "splitter/splitter.hpp" | ||
#include "dsp_definitions.hpp" | ||
|
||
namespace zlDSP { | ||
|
||
class Controller { | ||
public: | ||
Controller(); | ||
|
||
void reset(); | ||
|
||
void prepare(const juce::dsp::ProcessSpec &spec); | ||
|
||
void process(juce::AudioBuffer<double> &buffer); | ||
|
||
void setType(splitType::stype x) { | ||
splitType.store(x); | ||
} | ||
|
||
void setMix(double x) { | ||
mix.store(x); | ||
} | ||
|
||
zlSplitter::LRSplitter<double>& getLRSplitter() { | ||
return lrSplitter; | ||
} | ||
|
||
zlSplitter::MSSplitter<double>& getMSSplitter() { | ||
return msSplitter; | ||
} | ||
|
||
private: | ||
std::atomic<splitType::stype> splitType; | ||
zlSplitter::LRSplitter<double> lrSplitter; | ||
zlSplitter::MSSplitter<double> msSplitter; | ||
std::atomic<double> mix{0.0}; | ||
|
||
void processLR(juce::AudioBuffer<double> &buffer); | ||
|
||
void processMS(juce::AudioBuffer<double> &buffer); | ||
}; | ||
|
||
} // zlDSP | ||
|
||
#endif //CONTROLLER_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,16 @@ | ||
// Copyright (C) 2024 - zsliu98 | ||
// This file is part of ZLSplit | ||
// | ||
// ZLSplit is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
// | ||
// ZLSplit 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. | ||
// | ||
// You should have received a copy of the GNU General Public License along with ZLSplit. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
#ifndef DSP_HPP | ||
#define DSP_HPP | ||
|
||
#include "controller.hpp" | ||
#include "dsp_definitions.hpp" | ||
|
||
#endif //DSP_HPP |
Oops, something went wrong.