Skip to content

Commit

Permalink
Move the base class from Airwin2RackBase to AirwinConsolidatedBase (#55)
Browse files Browse the repository at this point in the history
change the namespace etc... also

This is all ahead of doing 'partial subset' builds of the static
library for, say, shortcircuit getting a few but not all of the
airwindi
  • Loading branch information
baconpaul authored Apr 30, 2024
1 parent dd5a596 commit 0500fc4
Show file tree
Hide file tree
Showing 1,209 changed files with 2,113 additions and 2,107 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cmrc_add_resource_library(awdoc_resources ${AWDOC_RESOURCES_GLOB})

add_library(airwin-registry STATIC
src/AirwinRegistry.cpp
src/airwin2rackbase.cpp
src/airwin_consolidated_base.cpp

${AIRWIN_SOURCES})

Expand Down
2 changes: 1 addition & 1 deletion scripts/configure.pl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
system("perl scripts/import.pl $fx");

print OFH "#include \"autogen_airwin/${fx}.h\"\n";
print OFH "int ${fx}_unused = AirwinRegistry::registerAirwindow({\"${fx}\", \"${cat}\", $catO, \"${what}\", airwin2rack::${fx}::kNumParameters, []() { return std::make_unique<airwin2rack::${fx}::${fx}>(0); }, -1, $coll});";
print OFH "int ${fx}_unused = AirwinRegistry::registerAirwindow({\"${fx}\", \"${cat}\", $catO, \"${what}\", airwinconsolidated::${fx}::kNumParameters, []() { return std::make_unique<airwinconsolidated::${fx}::${fx}>(0); }, -1, $coll});";
print OFH "\n";
}

Expand Down
14 changes: 7 additions & 7 deletions scripts/import.pl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

# Header File
#
# 1. replace "audioeffectx.h" with "../airwin2rackbase.h"
# 2. add a `namespace airwin2rack::(name)` at the first enum
# 1. replace "audioeffectx.h" with "../airwin_consolidated_base.h"
# 2. add a `namespace airwinconsolidated::(name)` at the first enum
# 3. Make sure the define guards are unique

my $inh = "libs/airwindows/plugins/MacVST/$f/source/$f.h";
Expand All @@ -27,12 +27,12 @@
if (m/enum/ && ! $namespaced)
{
$namespaced = 1;
print OFH "namespace airwin2rack::$f {\n";
print OFH "namespace airwinconsolidated::$f {\n";
}

s/^\#ifndef\s+__(.*)_H/#ifndef __$1_${f}_H/;
s/^\#define\s+__(.*)_H/#define __$1_${f}_H/;
s/audioeffectx.h/..\/airwin2rackbase.h/;
s/audioeffectx.h/..\/airwin_consolidated_base.h/;

next if m/getChunk/;
next if m/setChunk/;
Expand All @@ -56,7 +56,7 @@

# .cpp file
#
# 1. add a `namespace airwin2rack::(name)` after the endif
# 1. add a `namespace airwinconsolidated::(name)` after the endif


$inh = "libs/airwindows/plugins/MacVST/$f/source/$f.cpp";
Expand Down Expand Up @@ -90,7 +90,7 @@

if (m/#endif/ && !$namespaced)
{
print OFH "namespace airwin2rack::$f {\n";
print OFH "namespace airwinconsolidated::$f {\n";
}


Expand Down Expand Up @@ -226,7 +226,7 @@
print OFH;
if (m/#endif/ && !$namespaced)
{
print OFH "namespace airwin2rack::$f {\n";
print OFH "namespace airwinconsolidated::$f {\n";
}
}

Expand Down
4 changes: 2 additions & 2 deletions src-juce/AWConsolidatedProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ AWConsolidatedAudioProcessor::AWConsolidatedAudioProcessor()
.withInput("Input", juce::AudioChannelSet::stereo(), true)
.withOutput("Output", juce::AudioChannelSet::stereo(), true))
{
Airwin2RackBase::defaultSampleRate = 48000;
AirwinConsolidatedBase::defaultSampleRate = 48000;

// Multiple calls to addParameter here
for (int i = 0; i < nAWParams; ++i)
Expand Down Expand Up @@ -127,7 +127,7 @@ void AWConsolidatedAudioProcessor::changeProgramName(int index, const juce::Stri
//==============================================================================
void AWConsolidatedAudioProcessor::prepareToPlay(double sr, int samplesPerBlock)
{
Airwin2RackBase::defaultSampleRate = sr;
AirwinConsolidatedBase::defaultSampleRate = sr;
if (awProcessor)
awProcessor->setSampleRate(sr);
isPlaying = true;
Expand Down
2 changes: 1 addition & 1 deletion src-juce/AWConsolidatedProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class AWConsolidatedAudioProcessor : public juce::AudioProcessor,

void setAWProcessorTo(int registryIndex, bool initDisplay);

std::unique_ptr<Airwin2RackBase> awProcessor, awDisplayProcessor;
std::unique_ptr<AirwinConsolidatedBase> awProcessor, awDisplayProcessor;
std::mutex displayProcessorMutex;
int nProcessorParams{0};
std::atomic<int> curentProcessorIndex{0};
Expand Down
12 changes: 6 additions & 6 deletions src-rack/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#include "Airwin2Rack.hpp"
#include "airwin2rackbase.h"
#include "airwin_consolidated_base.h"
#include <iostream>
#include <array>
#include <vector>
Expand All @@ -29,8 +29,8 @@ struct AW2RModule : virtual rack::Module, sst::rackhelpers::module_connector::Ne
{
static constexpr int maxParams{10};

std::unique_ptr<Airwin2RackBase> airwin{}, airwin_display{};
std::array<std::unique_ptr<Airwin2RackBase>, MAX_POLY> poly_airwin;
std::unique_ptr<AirwinConsolidatedBase> airwin{}, airwin_display{};
std::array<std::unique_ptr<AirwinConsolidatedBase>, MAX_POLY> poly_airwin;
std::atomic<int32_t> forceSelect{-1}, resetCount{0}, selectedIdx{-1};
std::atomic<bool> panicReset;
std::string selectedFX{}, selectedWhat{}, selectedCat{};
Expand Down Expand Up @@ -127,7 +127,7 @@ struct AW2RModule : virtual rack::Module, sst::rackhelpers::module_connector::Ne
std::atomic<bool> lockedType{false}, randomizeFX{false};
AW2RModule()
{
Airwin2RackBase::defaultSampleRate = APP->engine->getSampleRate();
AirwinConsolidatedBase::defaultSampleRate = APP->engine->getSampleRate();

assert(!AirwinRegistry::registry.empty());
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
Expand Down Expand Up @@ -189,7 +189,7 @@ struct AW2RModule : virtual rack::Module, sst::rackhelpers::module_connector::Ne
selectedCat = AirwinRegistry::registry[registryIdx].category;
selectedWhat = AirwinRegistry::registry[registryIdx].whatText;

Airwin2RackBase::defaultSampleRate = APP->engine->getSampleRate();
AirwinConsolidatedBase::defaultSampleRate = APP->engine->getSampleRate();

airwin_display = AirwinRegistry::registry[registryIdx].generator();
airwin_display->setSampleRate(APP->engine->getSampleRate());
Expand Down Expand Up @@ -242,7 +242,7 @@ struct AW2RModule : virtual rack::Module, sst::rackhelpers::module_connector::Ne
void updateSampleRates()
{
auto sr = APP->engine->getSampleRate();
Airwin2RackBase::defaultSampleRate = sr;
AirwinConsolidatedBase::defaultSampleRate = sr;
airwin_display->setSampleRate(sr);
if (airwin)
airwin->setSampleRate(sr);
Expand Down
3 changes: 2 additions & 1 deletion src/AirwinRegistry.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Airwin2Rack - an adaptation of the airwindows effect suite for VCVRack
* AirwinConsolidated - an adaptation of the airwindows effect suite
* for various open source clients
*
* This source released under the MIT License, found in ~/LICENSE.md.
*
Expand Down
13 changes: 7 additions & 6 deletions src/AirwinRegistry.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*
* Airwin2Rack - an adaptation of the airwindows effect suite for VCVRack
* AirwinConsolidated - an adaptation of the airwindows effect suite
* for various open source clients
*
* This source released under the MIT License, found in ~/LICENSE.md.
*
* Copyright 2023 by the authors as described in the github transaction log
*/

#ifndef AIRWIN2RACK_AIRWINREGISTRY_H
#define AIRWIN2RACK_AIRWINREGISTRY_H
#ifndef AIRWINCONSOLIDATED_AIRWINREGISTRY_H
#define AIRWINCONSOLIDATED_AIRWINREGISTRY_H

#include <string>
#include <memory>
Expand All @@ -21,7 +22,7 @@
#include <functional>
#include <algorithm>

#include "airwin2rackbase.h"
#include "airwin_consolidated_base.h"

struct AirwinRegistry
{
Expand All @@ -32,7 +33,7 @@ struct AirwinRegistry
int catChrisOrdering;
std::string whatText;
int nParams{0};
std::function<std::unique_ptr<Airwin2RackBase>()> generator{[]() { return nullptr; }};
std::function<std::unique_ptr<AirwinConsolidatedBase>()> generator{[]() { return nullptr; }};
int ordering{-1};
std::vector<std::string> collections{};
};
Expand Down Expand Up @@ -140,4 +141,4 @@ struct AirwinRegistry

static void dumpStatsToStdout();
};
#endif // AIRWIN2RACK_AIRWINREGISTRY_H
#endif // AIRWINCONSOLIDATED_AIRWINREGISTRY_H
Loading

0 comments on commit 0500fc4

Please sign in to comment.