diff --git a/src/sfizz/Defaults.h b/src/sfizz/Defaults.h index b12d1b8a..e6cc47f5 100644 --- a/src/sfizz/Defaults.h +++ b/src/sfizz/Defaults.h @@ -156,11 +156,11 @@ namespace Default constexpr uint8_t filterKeycenter { 60 }; constexpr int filterRandom { 0 }; constexpr int filterVeltrack { 0 }; - constexpr int filterCutoffCC { 0 }; + constexpr float filterCutoffCC { 0 }; constexpr float filterResonanceCC { 0 }; constexpr float filterGainCC { 0 }; constexpr Range filterCutoffRange { 0.0f, 20000.0f }; - constexpr Range filterCutoffModRange { -9600, 9600 }; + constexpr Range filterCutoffModRange { -9600, 9600 }; constexpr Range filterGainRange { -96.0f, 96.0f }; constexpr Range filterGainModRange { -96.0f, 96.0f }; constexpr Range filterKeytrackRange { 0, 1200 }; diff --git a/src/sfizz/EQDescription.h b/src/sfizz/EQDescription.h index 161207df..c109a4a0 100644 --- a/src/sfizz/EQDescription.h +++ b/src/sfizz/EQDescription.h @@ -20,8 +20,5 @@ struct EQDescription float vel2frequency { Default::eqVel2frequency }; float vel2gain { Default::eqVel2gain }; EqType type { EqType::kEqPeak }; - CCMap bandwidthCC { Default::eqBandwidthCC }; - CCMap frequencyCC { Default::eqFrequencyCC }; - CCMap gainCC { Default::eqGainCC }; }; } diff --git a/src/sfizz/EQPool.cpp b/src/sfizz/EQPool.cpp index cc608a12..bca8c711 100644 --- a/src/sfizz/EQPool.cpp +++ b/src/sfizz/EQPool.cpp @@ -4,147 +4,85 @@ #include "SIMDHelpers.h" #include "SwapAndPop.h" -sfz::EQHolder::EQHolder(const MidiState& state) -:midiState(state) +sfz::EQHolder::EQHolder(Resources& resources) +: resources(resources) { - + eq = absl::make_unique(); + eq->init(config::defaultSampleRate); } void sfz::EQHolder::reset() { - eq.clear(); + eq->clear(); + prepared = false; } -void sfz::EQHolder::setup(const EQDescription& description, unsigned numChannels, float velocity) +void sfz::EQHolder::setup(const Region& region, unsigned eqId, float velocity) { ASSERT(velocity >= 0.0f && velocity <= 1.0f); - eq.setType(description.type); - eq.setChannels(numChannels); - this->description = &description; + ASSERT(eqId < region.equalizers.size()); + + this->description = ®ion.equalizers[eqId]; + eq->setType(description->type); + eq->setChannels(region.isStereo() ? 2 : 1); // Setup the base values - baseFrequency = description.frequency + velocity * description.vel2frequency; - baseBandwidth = description.bandwidth; - baseGain = description.gain + velocity * description.vel2gain; + baseFrequency = description->frequency + velocity * description->vel2frequency; + baseBandwidth = description->bandwidth; + baseGain = description->gain + velocity * description->vel2gain; - // Setup the modulated values - lastFrequency = baseFrequency; - for (const auto& mod : description.frequencyCC) - lastFrequency += midiState.getCCValue(mod.cc) * mod.data; - lastFrequency = Default::eqFrequencyRange.clamp(lastFrequency); + gainTarget = resources.modMatrix.findTarget(ModKey::createNXYZ(ModId::EqGain, region.id, eqId)); + bandwidthTarget = resources.modMatrix.findTarget(ModKey::createNXYZ(ModId::EqBandwidth, region.id, eqId)); + frequencyTarget = resources.modMatrix.findTarget(ModKey::createNXYZ(ModId::EqFrequency, region.id, eqId)); - lastBandwidth = baseBandwidth; - for (const auto& mod : description.bandwidthCC) - lastBandwidth += midiState.getCCValue(mod.cc) * mod.data; - lastBandwidth = Default::eqBandwidthRange.clamp(lastBandwidth); - - lastGain = baseGain; - for (const auto& mod : description.gainCC) - lastGain += midiState.getCCValue(mod.cc) * mod.data; - lastGain = Default::filterGainRange.clamp(lastGain); - - // Initialize the EQ - eq.prepare(lastFrequency, lastBandwidth, lastGain); + // Disables smoothing of the parameters on the first call + prepared = false; } void sfz::EQHolder::process(const float** inputs, float** outputs, unsigned numFrames) { - auto justCopy = [&]() { - for (unsigned channelIdx = 0; channelIdx < eq.channels(); channelIdx++) - copy({ inputs[channelIdx], numFrames }, { outputs[channelIdx], numFrames }); - }; - if (description == nullptr) { - justCopy(); + for (unsigned channelIdx = 0; channelIdx < eq->channels(); channelIdx++) + copy({ inputs[channelIdx], numFrames }, { outputs[channelIdx], numFrames }); return; } - // TODO: Once the midistate envelopes are done, add modulation in there! - // For now we take the last value - lastFrequency = baseFrequency; - for (const auto& mod : description->frequencyCC) - lastFrequency += midiState.getCCValue(mod.cc) * mod.data; - lastFrequency = Default::eqFrequencyRange.clamp(lastFrequency); + ModMatrix& mm = resources.modMatrix; + auto frequencySpan = resources.bufferPool.getBuffer(numFrames); + auto bandwidthSpan = resources.bufferPool.getBuffer(numFrames); + auto gainSpan = resources.bufferPool.getBuffer(numFrames); - lastBandwidth = baseBandwidth; - for (const auto& mod : description->bandwidthCC) - lastBandwidth += midiState.getCCValue(mod.cc) * mod.data; - lastBandwidth = Default::eqBandwidthRange.clamp(lastBandwidth); - - lastGain = baseGain; - for (const auto& mod : description->gainCC) - lastGain += midiState.getCCValue(mod.cc) * mod.data; - lastGain = Default::filterGainRange.clamp(lastGain); - - if (lastGain == 0.0f) { - justCopy(); + if (!frequencySpan || !bandwidthSpan || !gainSpan) return; + + fill(*frequencySpan, baseFrequency); + if (float* mod = mm.getModulation(frequencyTarget)) + add(absl::Span(mod, numFrames), *frequencySpan); + + fill(*bandwidthSpan, baseBandwidth); + if (float* mod = mm.getModulation(bandwidthTarget)) + add(absl::Span(mod, numFrames), *bandwidthSpan); + + fill(*gainSpan, baseGain); + if (float* mod = mm.getModulation(gainTarget)) + add(absl::Span(mod, numFrames), *gainSpan); + + if (!prepared) { + eq->prepare(frequencySpan->front(), bandwidthSpan->front(), gainSpan->front()); + prepared = true; } - eq.process(inputs, outputs, lastFrequency, lastBandwidth, lastGain, numFrames); -} -float sfz::EQHolder::getLastFrequency() const -{ - return lastFrequency; -} -float sfz::EQHolder::getLastBandwidth() const -{ - return lastBandwidth; -} -float sfz::EQHolder::getLastGain() const -{ - return lastGain; + eq->processModulated( + inputs, + outputs, + frequencySpan->data(), + bandwidthSpan->data(), + gainSpan->data(), + numFrames + ); } + void sfz::EQHolder::setSampleRate(float sampleRate) { - eq.init(static_cast(sampleRate)); -} - -sfz::EQPool::EQPool(const MidiState& state, int numEQs) -: midiState(state) -{ - setnumEQs(numEQs); -} - -sfz::EQHolderPtr sfz::EQPool::getEQ(const EQDescription& description, unsigned numChannels, float velocity) -{ - const std::unique_lock lock { eqGuard, std::try_to_lock }; - if (!lock.owns_lock()) - return {}; - - auto eq = absl::c_find_if(eqs, [](const EQHolderPtr& holder) { - return holder.use_count() == 1; - }); - - if (eq == eqs.end()) - return {}; - - (**eq).setup(description, numChannels, velocity); - return *eq; -} - -size_t sfz::EQPool::getActiveEQs() const -{ - return absl::c_count_if(eqs, [](const EQHolderPtr& holder) { - return holder.use_count() > 1; - }); -} - -size_t sfz::EQPool::setnumEQs(size_t numEQs) -{ - const std::lock_guard eqLock { eqGuard }; - - swapAndPopAll(eqs, [](sfz::EQHolderPtr& eq) { return eq.use_count() == 1; }); - - for (size_t i = eqs.size(); i < numEQs; ++i) { - eqs.emplace_back(std::make_shared(midiState)); - eqs.back()->setSampleRate(sampleRate); - } - - return eqs.size(); -} -void sfz::EQPool::setSampleRate(float sampleRate) -{ - for (auto& eq: eqs) - eq->setSampleRate(sampleRate); + eq->init(static_cast(sampleRate)); } diff --git a/src/sfizz/EQPool.h b/src/sfizz/EQPool.h index d1f7cebb..30ce889a 100644 --- a/src/sfizz/EQPool.h +++ b/src/sfizz/EQPool.h @@ -1,7 +1,7 @@ #pragma once #include "SfzFilter.h" -#include "EQDescription.h" -#include "MidiState.h" +#include "Region.h" +#include "Resources.h" #include "utility/SpinMutex.h" #include #include @@ -14,15 +14,15 @@ class EQHolder { public: EQHolder() = delete; - EQHolder(const MidiState& state); + EQHolder(Resources& resources); /** - * @brief Setup a new EQ based on an EQ description. + * @brief Setup a new EQ from a region and an index * - * @param description the EQ description - * @param numChannels the number of channels for the EQ - * @param description the triggering velocity/value + * @param description the region from which we take the EQ + * @param eqId the EQ index in the region + * @param description the triggering velocity/value */ - void setup(const EQDescription& description, unsigned numChannels, float velocity); + void setup(const Region& region, unsigned eqId, float velocity); /** * @brief Process a block of stereo inputs * @@ -31,94 +31,27 @@ public: * @param numFrames */ void process(const float** inputs, float** outputs, unsigned numFrames); - /** - * @brief Returns the last value of the frequency for the EQ - * - * @return float - */ - float getLastFrequency() const; - /** - * @brief Returns the last value of the bandwitdh for the EQ - * - * @return float - */ - float getLastBandwidth() const; - /** - * @brief Returns the last value of the gain for the EQ - * - * @return float - */ - float getLastGain() const; /** * @brief Set the sample rate for the EQ * * @param sampleRate */ void setSampleRate(float sampleRate); -private: /** - * Reset the filter. Is called internally when using setup(). + * Reset the filter. */ void reset(); - const MidiState& midiState; +private: + Resources& resources; const EQDescription* description; - FilterEq eq; + std::unique_ptr eq; float baseBandwidth { Default::eqBandwidth }; float baseFrequency { Default::eqFrequency1 }; float baseGain { Default::eqGain }; - float lastBandwidth { Default::eqBandwidth }; - float lastFrequency { Default::eqFrequency1 }; - float lastGain { Default::eqGain }; + bool prepared { false }; + ModMatrix::TargetId gainTarget; + ModMatrix::TargetId frequencyTarget; + ModMatrix::TargetId bandwidthTarget; }; -using EQHolderPtr = std::shared_ptr; - -class EQPool -{ -public: - EQPool() = delete; - /** - * @brief Construct a new EQPool object - * - * @param state the associated midi state - * @param numEQs the number of inactive EQs to hold in the pool - */ - EQPool(const MidiState& state, int numEQs = config::filtersInPool); - /** - * @brief Get an EQ object to use in Voices - * - * @param description the filter description to bind to the EQ - * @param numChannels the number of channels for the EQ - * @param velocity the triggering note velocity/value - * @return EQHolderPtr release this when done with the filter; no deallocation will be done - */ - EQHolderPtr getEQ(const EQDescription& description, unsigned numChannels, float velocity); - /** - * @brief Get the number of active EQs - * - * @return size_t - */ - size_t getActiveEQs() const; - /** - * @brief Set the number of EQs in the pool. This function may sleep and should be called from a background thread. - * No EQs will be distributed during the reallocation of EQs. Existing running EQs are kept. If the target - * number of EQs is less that the number of active EQs, the function will not remove them and you may need - * to call it again after existing EQs have run out. - * - * @param numEQs - * @return size_t the actual number of EQs in the pool - */ - size_t setnumEQs(size_t numEQs); - /** - * @brief Set the sample rate for all EQs - * - * @param sampleRate - */ - void setSampleRate(float sampleRate); -private: - SpinMutex eqGuard; - float sampleRate { config::defaultSampleRate }; - const MidiState& midiState; - std::vector eqs; -}; } diff --git a/src/sfizz/FilterDescription.h b/src/sfizz/FilterDescription.h index b31e81e9..f78b80d3 100644 --- a/src/sfizz/FilterDescription.h +++ b/src/sfizz/FilterDescription.h @@ -22,8 +22,5 @@ struct FilterDescription int veltrack { Default::filterVeltrack }; int random { Default::filterRandom }; FilterType type { FilterType::kFilterLpf2p }; - CCMap cutoffCC { Default::filterCutoffCC }; - CCMap resonanceCC { Default::filterResonanceCC }; - CCMap gainCC { Default::filterGainCC }; }; } diff --git a/src/sfizz/FilterPool.cpp b/src/sfizz/FilterPool.cpp index 70811320..c5eadcef 100644 --- a/src/sfizz/FilterPool.cpp +++ b/src/sfizz/FilterPool.cpp @@ -5,153 +5,102 @@ #include #include -sfz::FilterHolder::FilterHolder(const MidiState& midiState) -: midiState(midiState) +sfz::FilterHolder::FilterHolder(Resources& resources) +: resources(resources) { - + filter = absl::make_unique(); + filter->init(config::defaultSampleRate); } void sfz::FilterHolder::reset() { - filter.clear(); + filter->clear(); + prepared = false; } -void sfz::FilterHolder::setup(const FilterDescription& description, unsigned numChannels, int noteNumber, float velocity) +void sfz::FilterHolder::setup(const Region& region, unsigned filterId, int noteNumber, float velocity) { ASSERT(velocity >= 0.0f && velocity <= 1.0f); + ASSERT(filterId < region.filters.size()); - this->description = &description; - filter.setType(description.type); - filter.setChannels(numChannels); + this->description = ®ion.filters[filterId]; + filter->setType(description->type); + filter->setChannels(region.isStereo() ? 2 : 1); // Setup the base values - baseCutoff = description.cutoff; - if (description.random != 0) { - dist.param(filterRandomDist::param_type(0, description.random)); + baseCutoff = description->cutoff; + if (description->random != 0) { + dist.param(filterRandomDist::param_type(0, description->random)); baseCutoff *= centsFactor(dist(Random::randomGenerator)); } - const auto keytrack = description.keytrack * (noteNumber - description.keycenter); + const auto keytrack = description->keytrack * (noteNumber - description->keycenter); baseCutoff *= centsFactor(keytrack); - const auto veltrack = static_cast(description.veltrack) * velocity; + const auto veltrack = static_cast(description->veltrack) * velocity; baseCutoff *= centsFactor(veltrack); baseCutoff = Default::filterCutoffRange.clamp(baseCutoff); - baseGain = description.gain; - baseResonance = description.resonance; + baseGain = description->gain; + baseResonance = description->resonance; - // Setup the modulated values - lastCutoff = baseCutoff; - for (const auto& mod : description.cutoffCC) - lastCutoff *= centsFactor(midiState.getCCValue(mod.cc) * mod.data); - lastCutoff = Default::filterCutoffRange.clamp(lastCutoff); + ModMatrix& mm = resources.modMatrix; + gainTarget = mm.findTarget(ModKey::createNXYZ(ModId::FilGain, region.id, filterId)); + cutoffTarget = mm.findTarget(ModKey::createNXYZ(ModId::FilCutoff, region.id, filterId)); + resonanceTarget = mm.findTarget(ModKey::createNXYZ(ModId::FilResonance, region.id, filterId)); - lastResonance = baseResonance; - for (const auto& mod : description.resonanceCC) - lastResonance += midiState.getCCValue(mod.cc) * mod.data; - lastResonance = Default::filterResonanceRange.clamp(lastResonance); - - lastGain = baseGain; - for (const auto& mod : description.gainCC) - lastGain += midiState.getCCValue(mod.cc) * mod.data; - lastGain = Default::filterGainRange.clamp(lastGain); - - // Initialize the filter - filter.prepare(lastCutoff, lastResonance, lastGain); + // Disable smoothing of the parameters on the first call + prepared = false; } void sfz::FilterHolder::process(const float** inputs, float** outputs, unsigned numFrames) { + if (numFrames == 0) + return; + if (description == nullptr) { - for (unsigned channelIdx = 0; channelIdx < filter.channels(); channelIdx++) + for (unsigned channelIdx = 0; channelIdx < filter->channels(); channelIdx++) copy({ inputs[channelIdx], numFrames }, { outputs[channelIdx], numFrames }); return; } - // TODO: Once the midistate envelopes are done, add modulation in there! - // For now we take the last value - // TODO: the template deduction could be automatic here? - lastCutoff = baseCutoff; - for (const auto& mod : description->cutoffCC) - lastCutoff *= centsFactor(midiState.getCCValue(mod.cc) * mod.data); - lastCutoff = Default::filterCutoffRange.clamp(lastCutoff); + ModMatrix& mm = resources.modMatrix; + auto cutoffSpan = resources.bufferPool.getBuffer(numFrames); + auto resonanceSpan = resources.bufferPool.getBuffer(numFrames); + auto gainSpan = resources.bufferPool.getBuffer(numFrames); - lastResonance = baseResonance; - for (const auto& mod : description->resonanceCC) - lastResonance += midiState.getCCValue(mod.cc) * mod.data; - lastResonance = Default::filterResonanceRange.clamp(lastResonance); + if (!cutoffSpan || !resonanceSpan || !gainSpan) + return; - lastGain = baseGain; - for (const auto& mod : description->gainCC) - lastGain += midiState.getCCValue(mod.cc) * mod.data; - lastGain = Default::filterGainRange.clamp(lastGain); - - filter.process(inputs, outputs, lastCutoff, lastResonance, lastGain, numFrames); -} - -float sfz::FilterHolder::getLastCutoff() const -{ - return lastCutoff; -} -float sfz::FilterHolder::getLastResonance() const -{ - return lastResonance; -} -float sfz::FilterHolder::getLastGain() const -{ - return lastGain; -} - -sfz::FilterPool::FilterPool(const MidiState& state, int numFilters) -: midiState(state) -{ - setNumFilters(numFilters); -} - -sfz::FilterHolderPtr sfz::FilterPool::getFilter(const FilterDescription& description, unsigned numChannels, int noteNumber, float velocity) -{ - const std::unique_lock lock { filterGuard, std::try_to_lock }; - if (!lock.owns_lock()) - return {}; - - auto filter = absl::c_find_if(filters, [](const FilterHolderPtr& holder) { - return holder.use_count() == 1; - }); - - if (filter == filters.end()) - return {}; - - (**filter).setup(description, numChannels, noteNumber, velocity); - return *filter; -} - -size_t sfz::FilterPool::getActiveFilters() const -{ - return absl::c_count_if(filters, [](const FilterHolderPtr& holder) { - return holder.use_count() > 1; - }); -} - -size_t sfz::FilterPool::setNumFilters(size_t numFilters) -{ - const std::lock_guard filterLock { filterGuard }; - - swapAndPopAll(filters, [](sfz::FilterHolderPtr& filter) { return filter.use_count() == 1; }); - - for (size_t i = filters.size(); i < numFilters; ++i) { - filters.emplace_back(std::make_shared(midiState)); - filters.back()->setSampleRate(sampleRate); + fill(*cutoffSpan, baseCutoff); + if (float* mod = mm.getModulation(cutoffTarget)) { + for (size_t i = 0; i < numFrames; ++i) + (*cutoffSpan)[i] *= centsFactor(mod[i]); } - return filters.size(); + fill(*resonanceSpan, baseResonance); + if (float* mod = mm.getModulation(resonanceTarget)) + add(absl::Span(mod, numFrames), *resonanceSpan); + + fill(*gainSpan, baseGain); + if (float* mod = mm.getModulation(gainTarget)) + add(absl::Span(mod, numFrames), *gainSpan); + + if (!prepared) { + filter->prepare(cutoffSpan->front(), resonanceSpan->front(), gainSpan->front()); + prepared = true; + } + + filter->processModulated( + inputs, + outputs, + cutoffSpan->data(), + resonanceSpan->data(), + gainSpan->data(), + numFrames + ); } -void sfz::FilterPool::setSampleRate(float sampleRate) -{ - for (auto& filter: filters) - filter->setSampleRate(sampleRate); -} void sfz::FilterHolder::setSampleRate(float sampleRate) { - filter.init(static_cast(sampleRate)); + filter->init(static_cast(sampleRate)); } diff --git a/src/sfizz/FilterPool.h b/src/sfizz/FilterPool.h index 197eb8ad..f11ede24 100644 --- a/src/sfizz/FilterPool.h +++ b/src/sfizz/FilterPool.h @@ -1,7 +1,7 @@ #pragma once #include "SfzFilter.h" -#include "FilterDescription.h" -#include "MidiState.h" +#include "Region.h" +#include "Resources.h" #include "Defaults.h" #include "utility/SpinMutex.h" #include @@ -15,16 +15,16 @@ class FilterHolder { public: FilterHolder() = delete; - FilterHolder(const MidiState& state); + FilterHolder(Resources& resources); /** * @brief Setup a new filter based on a filter description, and a triggering note parameters. * - * @param description the filter description - * @param numChannels the number of channels - * @param noteNumber the triggering note number - * @param velocity the triggering note velocity/value + * @param description the region from which we take the filter + * @param filterId the filter index in the region + * @param noteNumber the triggering note number + * @param velocity the triggering note velocity/value */ - void setup(const FilterDescription& description, unsigned numChannels, int noteNumber = static_cast(Default::filterKeycenter), float velocity = 0); + void setup(const Region& region, unsigned filterId, int noteNumber = static_cast(Default::filterKeycenter), float velocity = 0); /** * @brief Process a block of stereo inputs * @@ -33,97 +33,29 @@ public: * @param numFrames */ void process(const float** inputs, float** outputs, unsigned numFrames); - /** - * @brief Returns the last value of the cutoff for the filter - * - * @return float - */ - float getLastCutoff() const; - /** - * @brief Returns the last value of the resonance for the filter - * - * @return float - */ - float getLastResonance() const; - /** - * @brief Returns the last value of the gain for the filter - * - * @return float - */ - float getLastGain() const; /** * @brief Set the sample rate for a filter * * @param sampleRate */ void setSampleRate(float sampleRate); -private: /** - * Reset the filter. Is called internally when using setup(). + * Reset the filter. */ void reset(); - const MidiState& midiState; +private: + Resources& resources; const FilterDescription* description; - Filter filter; + std::unique_ptr filter; float baseCutoff { Default::filterCutoff }; float baseResonance { Default::filterResonance }; float baseGain { Default::filterGain }; - float lastCutoff { Default::filterCutoff }; - float lastResonance { Default::filterResonance }; - float lastGain { Default::filterGain }; + ModMatrix::TargetId gainTarget; + ModMatrix::TargetId cutoffTarget; + ModMatrix::TargetId resonanceTarget; + bool prepared { false }; using filterRandomDist = std::uniform_int_distribution; filterRandomDist dist { 0, sfz::Default::filterRandom }; }; -using FilterHolderPtr = std::shared_ptr; - -class FilterPool -{ -public: - FilterPool() = delete; - /** - * @brief Construct a new Filter Pool object - * - * @param state the associated midi state - * @param numFilters the number of inactive filters to hold in the pool - */ - FilterPool(const MidiState& state, int numFilters = config::filtersInPool); - /** - * @brief Get a filter object to use in Voices - * - * @param description the filter description to bind to the filter - * @param numChannels the number of channels in the underlying filter - * @param noteNumber the triggering note number - * @param velocity the triggering note velocity - * @return FilterHolderPtr release this when done with the filter; no deallocation will be done - */ - FilterHolderPtr getFilter(const FilterDescription& description, unsigned numChannels, int noteNumber = static_cast(Default::filterKeycenter), float velocity = 0); - /** - * @brief Get the number of active filters - * - * @return size_t - */ - size_t getActiveFilters() const; - /** - * @brief Set the number of filters in the pool. This function may sleep and should be called from a background thread. - * No filters will be distributed during the reallocation of filters. Existing running filters are kept. If the target - * number of filters is less that the number of active filters, the function will not remove them and you may need - * to call it again after existing filters have run out. - * - * @param numFilters - * @return size_t the actual number of filters in the pool - */ - size_t setNumFilters(size_t numFilters); - /** - * @brief Set the sample rate for all filters - * - * @param sampleRate - */ - void setSampleRate(float sampleRate); -private: - SpinMutex filterGuard; - float sampleRate { config::defaultSampleRate }; - const MidiState& midiState; - std::vector filters; -}; } diff --git a/src/sfizz/OpcodeCleanup.cpp b/src/sfizz/OpcodeCleanup.cpp index 863a6eb0..ce293269 100644 --- a/src/sfizz/OpcodeCleanup.cpp +++ b/src/sfizz/OpcodeCleanup.cpp @@ -1,4 +1,4 @@ -/* Generated by re2c 1.3 on Mon Jun 22 16:43:52 2020 */ +/* Generated by re2c 1.3 on Fri Sep 18 00:52:43 2020 */ #line 1 "src/sfizz/OpcodeCleanup.re" /* -*- mode: c++; -*- */ // SPDX-License-Identifier: BSD-2-Clause @@ -34,7 +34,7 @@ static std::string cleanUpOpcodeName(absl::string_view rawOpcode, OpcodeScope sc size_t yynmatch; UNUSED(yynmatch); - const char* yyt1; const char* yyt2; const char* yyt3; + const char* yyt1; const char* yyt2; const char* yyt3; const char* yyt4; const char* yyt5; auto group = [&yypmatch](size_t i) -> absl::string_view { const char *beg = yypmatch[2 * i]; @@ -218,7 +218,7 @@ end_region_oncc: yy19: ++YYCURSOR; yy20: -#line 168 "src/sfizz/OpcodeCleanup.re" +#line 176 "src/sfizz/OpcodeCleanup.re" { goto end_region; } @@ -244,64 +244,65 @@ yy23: yy24: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'q': goto yy37; + case 'g': goto yy37; + case 'q': goto yy38; default: goto yy20; } yy25: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'i': goto yy38; + case 'i': goto yy39; default: goto yy20; } yy26: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'a': goto yy39; + case 'a': goto yy40; default: goto yy20; } yy27: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'i': goto yy40; + case 'i': goto yy41; default: goto yy20; } yy28: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'f': goto yy41; - case 'o': goto yy42; + case 'f': goto yy42; + case 'o': goto yy43; default: goto yy20; } yy29: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'f': goto yy43; - case 'n': goto yy44; + case 'f': goto yy44; + case 'n': goto yy45; default: goto yy20; } yy30: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'i': goto yy45; - case 'o': goto yy46; + case 'i': goto yy46; + case 'o': goto yy47; default: goto yy20; } yy31: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'e': goto yy47; + case 'e': goto yy48; default: goto yy20; } yy32: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'u': goto yy48; + case 'u': goto yy49; default: goto yy20; } yy33: yych = *++YYCURSOR; switch (yych) { - case 'p': goto yy49; + case 'p': goto yy50; default: goto yy34; } yy34: @@ -310,13 +311,13 @@ yy34: yy35: yych = *++YYCURSOR; switch (yych) { - case 'n': goto yy50; + case 'n': goto yy51; default: goto yy34; } yy36: yych = *++YYCURSOR; switch (yych) { - case 't': goto yy51; + case 't': goto yy52; default: goto yy34; } yy37: @@ -331,112 +332,111 @@ yy37: case '6': case '7': case '8': - case '9': goto yy52; + case '9': goto yy53; default: goto yy34; } yy38: yych = *++YYCURSOR; switch (yych) { - case 'l': goto yy54; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy55; default: goto yy34; } yy39: yych = *++YYCURSOR; switch (yych) { - case 'i': goto yy55; + case 'l': goto yy57; default: goto yy34; } yy40: yych = *++YYCURSOR; switch (yych) { - case 'r': goto yy56; + case 'i': goto yy58; default: goto yy34; } yy41: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy57; + case 'r': goto yy59; default: goto yy34; } yy42: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy58; - case 'r': goto yy56; + case 'o': goto yy60; default: goto yy34; } yy43: yych = *++YYCURSOR; switch (yych) { - case 'f': goto yy59; + case 'o': goto yy61; + case 'r': goto yy59; default: goto yy34; } yy44: yych = *++YYCURSOR; switch (yych) { - case '_': goto yy60; + case 'f': goto yy62; default: goto yy34; } yy45: yych = *++YYCURSOR; switch (yych) { - case 't': goto yy61; + case '_': goto yy63; default: goto yy34; } yy46: yych = *++YYCURSOR; switch (yych) { - case 'l': goto yy62; + case 't': goto yy64; default: goto yy34; } yy47: yych = *++YYCURSOR; switch (yych) { - case 's': goto yy63; + case 'l': goto yy65; default: goto yy34; } yy48: yych = *++YYCURSOR; switch (yych) { - case 'n': goto yy64; + case 's': goto yy66; default: goto yy34; } yy49: yych = *++YYCURSOR; switch (yych) { - case 'e': goto yy65; - case 'l': goto yy66; + case 'n': goto yy67; default: goto yy34; } yy50: yych = *++YYCURSOR; switch (yych) { - case 'd': goto yy67; + case 'e': goto yy68; + case 'l': goto yy69; default: goto yy34; } yy51: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy68; + case 'd': goto yy70; default: goto yy34; } yy52: yych = *++YYCURSOR; switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy52; - case '_': goto yy69; + case 'o': goto yy71; default: goto yy34; } -yy54: +yy53: yych = *++YYCURSOR; switch (yych) { case '0': @@ -448,25 +448,24 @@ yy54: case '6': case '7': case '8': - case '9': - yyt1 = YYCURSOR; - goto yy70; + case '9': goto yy53; case '_': goto yy72; - case 'e': goto yy65; - case 'l': goto yy66; - case 't': goto yy73; default: goto yy34; } yy55: yych = *++YYCURSOR; switch (yych) { - case 'n': goto yy74; - default: goto yy34; - } -yy56: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy75; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy55; + case '_': goto yy73; default: goto yy34; } yy57: @@ -481,144 +480,145 @@ yy57: case '6': case '7': case '8': - case '9': goto yy76; + case '9': + yyt1 = YYCURSOR; + goto yy74; + case '_': goto yy76; + case 'e': goto yy68; + case 'l': goto yy69; + case 't': goto yy77; default: goto yy34; } yy58: yych = *++YYCURSOR; switch (yych) { - case 'p': goto yy78; + case 'n': goto yy78; default: goto yy34; } yy59: yych = *++YYCURSOR; switch (yych) { - case 'b': - yyt1 = YYCURSOR; - goto yy79; - case 'm': - yyt1 = YYCURSOR; - goto yy80; + case 'e': goto yy79; default: goto yy34; } yy60: yych = *++YYCURSOR; switch (yych) { - case 'h': goto yy81; - case 'l': goto yy82; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy80; default: goto yy34; } yy61: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy83; + case 'p': goto yy82; default: goto yy34; } yy62: yych = *++YYCURSOR; switch (yych) { - case 'y': goto yy84; + case 'b': + yyt1 = YYCURSOR; + goto yy83; + case 'm': + yyt1 = YYCURSOR; + goto yy84; default: goto yy34; } yy63: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy85; + case 'h': goto yy85; + case 'l': goto yy86; default: goto yy34; } yy64: yych = *++YYCURSOR; switch (yych) { - case 'e': goto yy86; + case 'c': goto yy87; default: goto yy34; } yy65: yych = *++YYCURSOR; switch (yych) { - case 'g': goto yy87; + case 'y': goto yy88; default: goto yy34; } yy66: yych = *++YYCURSOR; switch (yych) { - case 'f': goto yy88; + case 'o': goto yy89; default: goto yy34; } yy67: yych = *++YYCURSOR; switch (yych) { - case 'd': - yyt1 = YYCURSOR; - goto yy89; - case 'u': - yyt1 = YYCURSOR; - goto yy90; + case 'e': goto yy90; default: goto yy34; } yy68: yych = *++YYCURSOR; switch (yych) { - case 'f': goto yy91; + case 'g': goto yy91; default: goto yy34; } yy69: yych = *++YYCURSOR; switch (yych) { - case 'b': - yyt2 = YYCURSOR; - goto yy92; - case 'f': - yyt2 = YYCURSOR; - goto yy93; - case 'g': - yyt2 = YYCURSOR; - goto yy94; + case 'f': goto yy92; default: goto yy34; } yy70: yych = *++YYCURSOR; switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy70; - case 't': goto yy95; + case 'd': + yyt1 = YYCURSOR; + goto yy93; + case 'u': + yyt1 = YYCURSOR; + goto yy94; + default: goto yy34; + } +yy71: + yych = *++YYCURSOR; + switch (yych) { + case 'f': goto yy95; default: goto yy34; } yy72: yych = *++YYCURSOR; - yyt1 = YYCURSOR; - goto yy99; + switch (yych) { + case 'c': + yyt2 = YYCURSOR; + goto yy96; + case 'r': + yyt2 = YYCURSOR; + goto yy97; + default: goto yy34; + } yy73: yych = *++YYCURSOR; switch (yych) { - case 'y': goto yy100; + case 'b': + yyt2 = YYCURSOR; + goto yy98; + case 'f': + yyt2 = YYCURSOR; + goto yy99; + case 'g': + yyt2 = YYCURSOR; + goto yy100; default: goto yy34; } yy74: - yych = *++YYCURSOR; - switch (yych) { - case 0x00: - yyt2 = yyt3 = NULL; - goto yy101; - case '_': - yyt3 = YYCURSOR; - goto yy103; - default: goto yy34; - } -yy75: - yych = *++YYCURSOR; - switch (yych) { - case 'a': goto yy105; - default: goto yy34; - } -yy76: yych = *++YYCURSOR; switch (yych) { case '0': @@ -630,482 +630,872 @@ yy76: case '6': case '7': case '8': - case '9': goto yy76; - case '_': goto yy106; + case '9': goto yy74; + case 't': goto yy101; + default: goto yy34; + } +yy76: + yych = *++YYCURSOR; + yyt1 = YYCURSOR; + goto yy105; +yy77: + yych = *++YYCURSOR; + switch (yych) { + case 'y': goto yy106; default: goto yy34; } yy78: yych = *++YYCURSOR; switch (yych) { - case 'e': - yyt1 = YYCURSOR; + case 0x00: + yyt2 = yyt3 = NULL; goto yy107; - case 'm': - yyt1 = YYCURSOR; - goto yy108; - case 's': - yyt1 = YYCURSOR; + case '_': + yyt3 = YYCURSOR; goto yy109; default: goto yy34; } yy79: yych = *++YYCURSOR; switch (yych) { - case 'y': goto yy110; + case 'a': goto yy111; default: goto yy34; } yy80: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy111; - default: goto yy34; - } -yy81: - yych = *++YYCURSOR; - switch (yych) { - case 'i': goto yy112; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy80; + case '_': goto yy112; default: goto yy34; } yy82: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy112; + case 'e': + yyt1 = YYCURSOR; + goto yy113; + case 'm': + yyt1 = YYCURSOR; + goto yy114; + case 's': + yyt1 = YYCURSOR; + goto yy115; default: goto yy34; } yy83: yych = *++YYCURSOR; switch (yych) { - case 'h': goto yy49; + case 'y': goto yy116; default: goto yy34; } yy84: yych = *++YYCURSOR; switch (yych) { - case 'p': goto yy113; + case 'o': goto yy117; default: goto yy34; } yy85: yych = *++YYCURSOR; switch (yych) { - case 'n': goto yy114; + case 'i': goto yy118; default: goto yy34; } yy86: yych = *++YYCURSOR; switch (yych) { - case 0x00: - yyt2 = yyt3 = NULL; - goto yy115; - case '_': - yyt3 = YYCURSOR; - goto yy117; + case 'o': goto yy118; default: goto yy34; } yy87: yych = *++YYCURSOR; switch (yych) { - case '_': goto yy119; + case 'h': goto yy50; default: goto yy34; } yy88: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy120; + case 'p': goto yy119; default: goto yy34; } yy89: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy121; + case 'n': goto yy120; default: goto yy34; } yy90: yych = *++YYCURSOR; switch (yych) { - case 'p': goto yy122; + case 0x00: + yyt2 = yyt3 = NULL; + goto yy121; + case '_': + yyt3 = YYCURSOR; + goto yy123; default: goto yy34; } yy91: yych = *++YYCURSOR; switch (yych) { - case 'f': goto yy123; + case '_': goto yy125; default: goto yy34; } yy92: yych = *++YYCURSOR; switch (yych) { - case 'w': goto yy124; + case 'o': goto yy126; default: goto yy34; } yy93: yych = *++YYCURSOR; switch (yych) { - case 'r': goto yy125; + case 'o': goto yy127; default: goto yy34; } yy94: yych = *++YYCURSOR; switch (yych) { - case 'a': goto yy126; + case 'p': goto yy128; default: goto yy34; } yy95: yych = *++YYCURSOR; switch (yych) { - case 'y': goto yy127; + case 'f': goto yy129; default: goto yy34; } yy96: + yych = *++YYCURSOR; + switch (yych) { + case 'u': goto yy130; + default: goto yy34; + } +yy97: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy131; + default: goto yy34; + } +yy98: + yych = *++YYCURSOR; + switch (yych) { + case 'w': goto yy132; + default: goto yy34; + } +yy99: + yych = *++YYCURSOR; + switch (yych) { + case 'r': goto yy133; + default: goto yy34; + } +yy100: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy134; + default: goto yy34; + } +yy101: + yych = *++YYCURSOR; + switch (yych) { + case 'y': goto yy135; + default: goto yy34; + } +yy102: ++YYCURSOR; yynmatch = 2; yypmatch[2] = yyt1; yypmatch[0] = yyt1 - 4; yypmatch[1] = YYCURSOR; yypmatch[3] = YYCURSOR - 1; -#line 150 "src/sfizz/OpcodeCleanup.re" +#line 158 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("fil1_", group(1)); goto end_region; } -#line 771 "src/sfizz/OpcodeCleanup.cpp" -yy98: +#line 826 "src/sfizz/OpcodeCleanup.cpp" +yy104: yych = *++YYCURSOR; -yy99: - if (yych <= 0x00) goto yy96; - goto yy98; -yy100: +yy105: + if (yych <= 0x00) goto yy102; + goto yy104; +yy106: yych = *++YYCURSOR; switch (yych) { - case 'p': goto yy128; + case 'p': goto yy136; default: goto yy34; } -yy101: +yy107: ++YYCURSOR; yynmatch = 2; yypmatch[0] = yyt1; yypmatch[2] = yyt3; yypmatch[3] = yyt2; yypmatch[1] = YYCURSOR; -#line 132 "src/sfizz/OpcodeCleanup.re" +#line 140 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("volume", group(1)); goto end_region; } -#line 795 "src/sfizz/OpcodeCleanup.cpp" -yy103: +#line 850 "src/sfizz/OpcodeCleanup.cpp" +yy109: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = YYCURSOR; - goto yy101; + goto yy107; } - goto yy103; -yy105: - yych = *++YYCURSOR; - switch (yych) { - case 'l': goto yy129; - default: goto yy34; - } -yy106: - yych = *++YYCURSOR; - switch (yych) { - case 'o': - yyt2 = YYCURSOR; - goto yy130; - case 'r': - yyt2 = YYCURSOR; - goto yy131; - case 's': - yyt2 = YYCURSOR; - goto yy132; - case 'w': - yyt2 = YYCURSOR; - goto yy133; - default: goto yy34; - } -yy107: - yych = *++YYCURSOR; - switch (yych) { - case 'n': goto yy134; - default: goto yy34; - } -yy108: - yych = *++YYCURSOR; - switch (yych) { - case 'o': goto yy135; - default: goto yy34; - } -yy109: - yych = *++YYCURSOR; - switch (yych) { - case 't': goto yy136; - default: goto yy34; - } -yy110: - yych = *++YYCURSOR; - if (yych <= 0x00) goto yy137; - goto yy34; + goto yy109; yy111: yych = *++YYCURSOR; switch (yych) { - case 'd': goto yy139; + case 'l': goto yy137; default: goto yy34; } yy112: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy140; - case 'h': goto yy141; + case 'c': + yyt2 = YYCURSOR; + goto yy138; + case 'o': + yyt2 = YYCURSOR; + goto yy139; + case 'r': + yyt2 = YYCURSOR; + goto yy140; + case 's': + yyt2 = YYCURSOR; + goto yy141; + case 'w': + yyt2 = YYCURSOR; + goto yy142; default: goto yy34; } yy113: yych = *++YYCURSOR; switch (yych) { - case 'h': goto yy142; + case 'n': goto yy143; default: goto yy34; } yy114: yych = *++YYCURSOR; switch (yych) { - case 'a': goto yy143; + case 'o': goto yy144; default: goto yy34; } yy115: + yych = *++YYCURSOR; + switch (yych) { + case 't': goto yy145; + default: goto yy34; + } +yy116: + yych = *++YYCURSOR; + if (yych <= 0x00) goto yy146; + goto yy34; +yy117: + yych = *++YYCURSOR; + switch (yych) { + case 'd': goto yy148; + default: goto yy34; + } +yy118: + yych = *++YYCURSOR; + switch (yych) { + case 'c': goto yy149; + case 'h': goto yy150; + default: goto yy34; + } +yy119: + yych = *++YYCURSOR; + switch (yych) { + case 'h': goto yy151; + default: goto yy34; + } +yy120: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy152; + default: goto yy34; + } +yy121: ++YYCURSOR; yynmatch = 2; yypmatch[0] = yyt1; yypmatch[2] = yyt3; yypmatch[3] = yyt2; yypmatch[1] = YYCURSOR; -#line 136 "src/sfizz/OpcodeCleanup.re" +#line 144 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("pitch", group(1)); goto end_region; } -#line 885 "src/sfizz/OpcodeCleanup.cpp" -yy117: +#line 943 "src/sfizz/OpcodeCleanup.cpp" +yy123: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = YYCURSOR; - goto yy115; + goto yy121; } - goto yy117; -yy119: + goto yy123; +yy125: yych = *++YYCURSOR; switch (yych) { case 'a': yyt2 = YYCURSOR; - goto yy144; + goto yy153; case 'd': yyt2 = YYCURSOR; - goto yy145; + goto yy154; case 'h': yyt2 = YYCURSOR; - goto yy146; + goto yy155; case 'r': yyt2 = YYCURSOR; - goto yy147; + goto yy156; case 's': yyt2 = YYCURSOR; - goto yy148; - default: goto yy34; - } -yy120: - yych = *++YYCURSOR; - switch (yych) { - case '_': goto yy149; - default: goto yy34; - } -yy121: - yych = *++YYCURSOR; - switch (yych) { - case 'w': goto yy150; - default: goto yy34; - } -yy122: - yych = *++YYCURSOR; - if (yych <= 0x00) goto yy151; - goto yy34; -yy123: - yych = *++YYCURSOR; - switch (yych) { - case 0x00: - yyt2 = yyt3 = NULL; - goto yy153; - case '_': - yyt3 = YYCURSOR; - goto yy155; - default: goto yy34; - } -yy124: - yych = *++YYCURSOR; - switch (yych) { - case 'c': goto yy157; - default: goto yy34; - } -yy125: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy158; + goto yy157; default: goto yy34; } yy126: yych = *++YYCURSOR; switch (yych) { - case 'i': goto yy159; + case '_': goto yy158; default: goto yy34; } yy127: yych = *++YYCURSOR; switch (yych) { - case 'p': goto yy160; + case 'w': goto yy159; default: goto yy34; } yy128: yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy161; - default: goto yy34; - } + if (yych <= 0x00) goto yy160; + goto yy34; yy129: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy162; + case 0x00: + yyt2 = yyt3 = NULL; + goto yy162; + case '_': + yyt3 = YYCURSOR; + goto yy164; default: goto yy34; } yy130: yych = *++YYCURSOR; switch (yych) { - case 'f': goto yy163; + case 't': goto yy166; default: goto yy34; } yy131: yych = *++YYCURSOR; switch (yych) { - case 'a': goto yy164; + case 's': goto yy167; default: goto yy34; } yy132: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy165; + case 'c': goto yy168; default: goto yy34; } yy133: yych = *++YYCURSOR; switch (yych) { - case 'a': goto yy166; + case 'e': goto yy169; default: goto yy34; } yy134: yych = *++YYCURSOR; switch (yych) { - case 'd': goto yy167; + case 'i': goto yy170; default: goto yy34; } yy135: yych = *++YYCURSOR; switch (yych) { - case 'd': goto yy168; + case 'p': goto yy171; default: goto yy34; } yy136: yych = *++YYCURSOR; switch (yych) { - case 'a': goto yy169; + case 'e': goto yy172; default: goto yy34; } yy137: + yych = *++YYCURSOR; + switch (yych) { + case 'c': goto yy173; + default: goto yy34; + } +yy138: + yych = *++YYCURSOR; + switch (yych) { + case 'u': goto yy174; + default: goto yy34; + } +yy139: + yych = *++YYCURSOR; + switch (yych) { + case 'f': goto yy175; + default: goto yy34; + } +yy140: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy176; + case 'e': goto yy177; + default: goto yy34; + } +yy141: + yych = *++YYCURSOR; + switch (yych) { + case 'c': goto yy178; + default: goto yy34; + } +yy142: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy179; + default: goto yy34; + } +yy143: + yych = *++YYCURSOR; + switch (yych) { + case 'd': goto yy180; + default: goto yy34; + } +yy144: + yych = *++YYCURSOR; + switch (yych) { + case 'd': goto yy181; + default: goto yy34; + } +yy145: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy182; + default: goto yy34; + } +yy146: ++YYCURSOR; yynmatch = 2; yypmatch[2] = yyt1; yypmatch[0] = yyt1 - 3; yypmatch[1] = YYCURSOR; yypmatch[3] = YYCURSOR - 1; -#line 110 "src/sfizz/OpcodeCleanup.re" +#line 118 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("off_", group(1)); goto end_region; } -#line 1030 "src/sfizz/OpcodeCleanup.cpp" -yy139: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy110; - default: goto yy34; - } -yy140: - yych = *++YYCURSOR; - switch (yych) { - case 'c': goto yy170; - default: goto yy34; - } -yy141: - yych = *++YYCURSOR; - switch (yych) { - case 'd': goto yy171; - default: goto yy34; - } -yy142: - yych = *++YYCURSOR; - switch (yych) { - case 'o': goto yy172; - default: goto yy34; - } -yy143: - yych = *++YYCURSOR; - switch (yych) { - case 'n': goto yy173; - default: goto yy34; - } -yy144: - yych = *++YYCURSOR; - switch (yych) { - case 't': goto yy174; - default: goto yy34; - } -yy145: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy175; - default: goto yy34; - } -yy146: - yych = *++YYCURSOR; - switch (yych) { - case 'o': goto yy176; - default: goto yy34; - } -yy147: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy177; - default: goto yy34; - } +#line 1107 "src/sfizz/OpcodeCleanup.cpp" yy148: yych = *++YYCURSOR; switch (yych) { - case 't': goto yy178; - case 'u': goto yy179; + case 'e': goto yy116; default: goto yy34; } yy149: yych = *++YYCURSOR; switch (yych) { - case 'd': - yyt2 = YYCURSOR; - goto yy180; - case 'f': - yyt2 = YYCURSOR; - goto yy181; + case 'c': goto yy183; default: goto yy34; } yy150: yych = *++YYCURSOR; switch (yych) { - case 'n': goto yy122; + case 'd': goto yy184; default: goto yy34; } yy151: + yych = *++YYCURSOR; + switch (yych) { + case 'o': goto yy185; + default: goto yy34; + } +yy152: + yych = *++YYCURSOR; + switch (yych) { + case 'n': goto yy186; + default: goto yy34; + } +yy153: + yych = *++YYCURSOR; + switch (yych) { + case 't': goto yy187; + default: goto yy34; + } +yy154: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy188; + default: goto yy34; + } +yy155: + yych = *++YYCURSOR; + switch (yych) { + case 'o': goto yy189; + default: goto yy34; + } +yy156: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy190; + default: goto yy34; + } +yy157: + yych = *++YYCURSOR; + switch (yych) { + case 't': goto yy191; + case 'u': goto yy192; + default: goto yy34; + } +yy158: + yych = *++YYCURSOR; + switch (yych) { + case 'd': + yyt2 = YYCURSOR; + goto yy193; + case 'f': + yyt2 = YYCURSOR; + goto yy194; + default: goto yy34; + } +yy159: + yych = *++YYCURSOR; + switch (yych) { + case 'n': goto yy128; + default: goto yy34; + } +yy160: + ++YYCURSOR; + yynmatch = 2; + yypmatch[2] = yyt1; + yypmatch[0] = yyt1 - 4; + yypmatch[1] = YYCURSOR; + yypmatch[3] = YYCURSOR - 1; +#line 122 "src/sfizz/OpcodeCleanup.re" + { + opcode = absl::StrCat("bend_", group(1)); + goto end_region; + } +#line 1198 "src/sfizz/OpcodeCleanup.cpp" +yy162: + ++YYCURSOR; + yynmatch = 2; + yypmatch[0] = yyt1; + yypmatch[2] = yyt3; + yypmatch[3] = yyt2; + yypmatch[1] = YYCURSOR; +#line 162 "src/sfizz/OpcodeCleanup.re" + { + opcode = absl::StrCat("cutoff1", group(1)); + goto end_region; + } +#line 1211 "src/sfizz/OpcodeCleanup.cpp" +yy164: + yych = *++YYCURSOR; + if (yych <= 0x00) { + yyt2 = YYCURSOR; + goto yy162; + } + goto yy164; +yy166: + yych = *++YYCURSOR; + switch (yych) { + case 'o': goto yy195; + default: goto yy34; + } +yy167: + yych = *++YYCURSOR; + switch (yych) { + case 'o': goto yy196; + default: goto yy34; + } +yy168: + yych = *++YYCURSOR; + switch (yych) { + case 'c': goto yy197; + default: goto yy34; + } +yy169: + yych = *++YYCURSOR; + switch (yych) { + case 'q': goto yy132; + default: goto yy34; + } +yy170: + yych = *++YYCURSOR; + switch (yych) { + case 'n': goto yy132; + default: goto yy34; + } +yy171: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy198; + default: goto yy34; + } +yy172: + yych = *++YYCURSOR; + if (yych <= 0x00) goto yy199; + goto yy34; +yy173: + yych = *++YYCURSOR; + switch (yych) { + case 'c': goto yy201; + default: goto yy34; + } +yy174: + yych = *++YYCURSOR; + switch (yych) { + case 't': goto yy202; + default: goto yy34; + } +yy175: + yych = *++YYCURSOR; + switch (yych) { + case 'f': goto yy203; + default: goto yy34; + } +yy176: + yych = *++YYCURSOR; + switch (yych) { + case 't': goto yy204; + default: goto yy34; + } +yy177: + yych = *++YYCURSOR; + switch (yych) { + case 's': goto yy205; + default: goto yy34; + } +yy178: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy206; + default: goto yy34; + } +yy179: + yych = *++YYCURSOR; + switch (yych) { + case 'v': goto yy207; + default: goto yy34; + } +yy180: + yych = *++YYCURSOR; + if (yych <= 0x00) goto yy208; + goto yy34; +yy181: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy180; + default: goto yy34; + } +yy182: + yych = *++YYCURSOR; + switch (yych) { + case 'r': goto yy210; + default: goto yy34; + } +yy183: + yych = *++YYCURSOR; + switch (yych) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + yyt1 = YYCURSOR; + goto yy211; + default: goto yy34; + } +yy184: + yych = *++YYCURSOR; + switch (yych) { + case 'c': goto yy213; + default: goto yy34; + } +yy185: + yych = *++YYCURSOR; + switch (yych) { + case 'n': goto yy214; + default: goto yy34; + } +yy186: + yych = *++YYCURSOR; + switch (yych) { + case 'c': goto yy215; + default: goto yy34; + } +yy187: + yych = *++YYCURSOR; + switch (yych) { + case 't': goto yy216; + default: goto yy34; + } +yy188: + yych = *++YYCURSOR; + switch (yych) { + case 'c': + case 'l': goto yy217; + default: goto yy34; + } +yy189: + yych = *++YYCURSOR; + switch (yych) { + case 'l': goto yy218; + default: goto yy34; + } +yy190: + yych = *++YYCURSOR; + switch (yych) { + case 'l': goto yy219; + default: goto yy34; + } +yy191: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy220; + default: goto yy34; + } +yy192: + yych = *++YYCURSOR; + switch (yych) { + case 's': goto yy221; + default: goto yy34; + } +yy193: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy222; + default: goto yy34; + } +yy194: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy223; + case 'r': goto yy224; + default: goto yy34; + } +yy195: + yych = *++YYCURSOR; + switch (yych) { + case 'f': goto yy225; + default: goto yy34; + } +yy196: + yych = *++YYCURSOR; + switch (yych) { + case 'n': goto yy226; + default: goto yy34; + } +yy197: + yych = *++YYCURSOR; + switch (yych) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + yyt3 = YYCURSOR; + goto yy227; + default: goto yy34; + } +yy198: + yych = *++YYCURSOR; + if (yych <= 0x00) goto yy229; + goto yy34; +yy199: + ++YYCURSOR; + yynmatch = 1; + yypmatch[0] = YYCURSOR - 8; + yypmatch[1] = YYCURSOR; +#line 126 "src/sfizz/OpcodeCleanup.re" + { + opcode = absl::StrCat("fil1_type"); + goto end_region; + } +#line 1445 "src/sfizz/OpcodeCleanup.cpp" +yy201: + yych = *++YYCURSOR; + switch (yych) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + yyt1 = YYCURSOR; + goto yy231; + default: goto yy34; + } +yy202: + yych = *++YYCURSOR; + switch (yych) { + case 'o': goto yy233; + default: goto yy34; + } +yy203: + yych = *++YYCURSOR; + switch (yych) { + case 's': goto yy234; + default: goto yy34; + } +yy204: + yych = *++YYCURSOR; + switch (yych) { + case 'i': goto yy235; + default: goto yy34; + } +yy205: + yych = *++YYCURSOR; + switch (yych) { + case 'o': goto yy236; + default: goto yy34; + } +yy206: + yych = *++YYCURSOR; + switch (yych) { + case 'l': goto yy207; + default: goto yy34; + } +yy207: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy237; + default: goto yy34; + } +yy208: ++YYCURSOR; yynmatch = 2; yypmatch[2] = yyt1; @@ -1113,403 +1503,150 @@ yy151: yypmatch[1] = YYCURSOR; yypmatch[3] = YYCURSOR - 1; #line 114 "src/sfizz/OpcodeCleanup.re" - { - opcode = absl::StrCat("bend_", group(1)); - goto end_region; - } -#line 1121 "src/sfizz/OpcodeCleanup.cpp" -yy153: - ++YYCURSOR; - yynmatch = 2; - yypmatch[0] = yyt1; - yypmatch[2] = yyt3; - yypmatch[3] = yyt2; - yypmatch[1] = YYCURSOR; -#line 154 "src/sfizz/OpcodeCleanup.re" - { - opcode = absl::StrCat("cutoff1", group(1)); - goto end_region; - } -#line 1134 "src/sfizz/OpcodeCleanup.cpp" -yy155: - yych = *++YYCURSOR; - if (yych <= 0x00) { - yyt2 = YYCURSOR; - goto yy153; - } - goto yy155; -yy157: - yych = *++YYCURSOR; - switch (yych) { - case 'c': goto yy182; - default: goto yy34; - } -yy158: - yych = *++YYCURSOR; - switch (yych) { - case 'q': goto yy124; - default: goto yy34; - } -yy159: - yych = *++YYCURSOR; - switch (yych) { - case 'n': goto yy124; - default: goto yy34; - } -yy160: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy183; - default: goto yy34; - } -yy161: - yych = *++YYCURSOR; - if (yych <= 0x00) goto yy184; - goto yy34; -yy162: - yych = *++YYCURSOR; - switch (yych) { - case 'c': goto yy186; - default: goto yy34; - } -yy163: - yych = *++YYCURSOR; - switch (yych) { - case 'f': goto yy187; - default: goto yy34; - } -yy164: - yych = *++YYCURSOR; - switch (yych) { - case 't': goto yy188; - default: goto yy34; - } -yy165: - yych = *++YYCURSOR; - switch (yych) { - case 'a': goto yy189; - default: goto yy34; - } -yy166: - yych = *++YYCURSOR; - switch (yych) { - case 'v': goto yy190; - default: goto yy34; - } -yy167: - yych = *++YYCURSOR; - if (yych <= 0x00) goto yy191; - goto yy34; -yy168: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy167; - default: goto yy34; - } -yy169: - yych = *++YYCURSOR; - switch (yych) { - case 'r': goto yy193; - default: goto yy34; - } -yy170: - yych = *++YYCURSOR; - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - yyt1 = YYCURSOR; - goto yy194; - default: goto yy34; - } -yy171: - yych = *++YYCURSOR; - switch (yych) { - case 'c': goto yy196; - default: goto yy34; - } -yy172: - yych = *++YYCURSOR; - switch (yych) { - case 'n': goto yy197; - default: goto yy34; - } -yy173: - yych = *++YYCURSOR; - switch (yych) { - case 'c': goto yy198; - default: goto yy34; - } -yy174: - yych = *++YYCURSOR; - switch (yych) { - case 't': goto yy199; - default: goto yy34; - } -yy175: - yych = *++YYCURSOR; - switch (yych) { - case 'c': - case 'l': goto yy200; - default: goto yy34; - } -yy176: - yych = *++YYCURSOR; - switch (yych) { - case 'l': goto yy201; - default: goto yy34; - } -yy177: - yych = *++YYCURSOR; - switch (yych) { - case 'l': goto yy202; - default: goto yy34; - } -yy178: - yych = *++YYCURSOR; - switch (yych) { - case 'a': goto yy203; - default: goto yy34; - } -yy179: - yych = *++YYCURSOR; - switch (yych) { - case 's': goto yy204; - default: goto yy34; - } -yy180: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy205; - default: goto yy34; - } -yy181: - yych = *++YYCURSOR; - switch (yych) { - case 'a': goto yy206; - case 'r': goto yy207; - default: goto yy34; - } -yy182: - yych = *++YYCURSOR; - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - yyt3 = YYCURSOR; - goto yy208; - default: goto yy34; - } -yy183: - yych = *++YYCURSOR; - if (yych <= 0x00) goto yy210; - goto yy34; -yy184: - ++YYCURSOR; - yynmatch = 1; - yypmatch[0] = YYCURSOR - 8; - yypmatch[1] = YYCURSOR; -#line 118 "src/sfizz/OpcodeCleanup.re" - { - opcode = absl::StrCat("fil1_type"); - goto end_region; - } -#line 1332 "src/sfizz/OpcodeCleanup.cpp" -yy186: - yych = *++YYCURSOR; - switch (yych) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - yyt1 = YYCURSOR; - goto yy212; - default: goto yy34; - } -yy187: - yych = *++YYCURSOR; - switch (yych) { - case 's': goto yy214; - default: goto yy34; - } -yy188: - yych = *++YYCURSOR; - switch (yych) { - case 'i': goto yy215; - default: goto yy34; - } -yy189: - yych = *++YYCURSOR; - switch (yych) { - case 'l': goto yy190; - default: goto yy34; - } -yy190: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy216; - default: goto yy34; - } -yy191: - ++YYCURSOR; - yynmatch = 2; - yypmatch[2] = yyt1; - yypmatch[0] = yyt1 - 4; - yypmatch[1] = YYCURSOR; - yypmatch[3] = YYCURSOR - 1; -#line 106 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("loop_", group(1)); goto end_region; } -#line 1386 "src/sfizz/OpcodeCleanup.cpp" -yy193: - yych = *++YYCURSOR; - switch (yych) { - case 't': goto yy167; - default: goto yy34; - } -yy194: - yych = *++YYCURSOR; - switch (yych) { - case 0x00: goto yy217; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy194; - default: goto yy34; - } -yy196: - yych = *++YYCURSOR; - switch (yych) { - case 'c': goto yy219; - default: goto yy34; - } -yy197: - yych = *++YYCURSOR; - switch (yych) { - case 'y': goto yy220; - default: goto yy34; - } -yy198: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy221; - default: goto yy34; - } -yy199: - yych = *++YYCURSOR; - switch (yych) { - case 'a': goto yy222; - default: goto yy34; - } -yy200: - yych = *++YYCURSOR; - switch (yych) { - case 'a': goto yy223; - default: goto yy34; - } -yy201: - yych = *++YYCURSOR; - switch (yych) { - case 'd': goto yy224; - default: goto yy34; - } -yy202: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy225; - default: goto yy34; - } -yy203: - yych = *++YYCURSOR; - switch (yych) { - case 'r': goto yy226; - default: goto yy34; - } -yy204: - yych = *++YYCURSOR; - switch (yych) { - case 't': goto yy227; - default: goto yy34; - } -yy205: - yych = *++YYCURSOR; - switch (yych) { - case 'p': goto yy228; - default: goto yy34; - } -yy206: - yych = *++YYCURSOR; - switch (yych) { - case 'd': goto yy229; - default: goto yy34; - } -yy207: - yych = *++YYCURSOR; - switch (yych) { - case 'e': goto yy230; - default: goto yy34; - } -yy208: - yych = *++YYCURSOR; - switch (yych) { - case 0x00: goto yy231; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy208; - default: goto yy34; - } +#line 1511 "src/sfizz/OpcodeCleanup.cpp" yy210: + yych = *++YYCURSOR; + switch (yych) { + case 't': goto yy180; + default: goto yy34; + } +yy211: + yych = *++YYCURSOR; + switch (yych) { + case 0x00: goto yy238; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy211; + default: goto yy34; + } +yy213: + yych = *++YYCURSOR; + switch (yych) { + case 'c': goto yy240; + default: goto yy34; + } +yy214: + yych = *++YYCURSOR; + switch (yych) { + case 'y': goto yy241; + default: goto yy34; + } +yy215: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy242; + default: goto yy34; + } +yy216: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy243; + default: goto yy34; + } +yy217: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy244; + default: goto yy34; + } +yy218: + yych = *++YYCURSOR; + switch (yych) { + case 'd': goto yy245; + default: goto yy34; + } +yy219: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy246; + default: goto yy34; + } +yy220: + yych = *++YYCURSOR; + switch (yych) { + case 'r': goto yy247; + default: goto yy34; + } +yy221: + yych = *++YYCURSOR; + switch (yych) { + case 't': goto yy248; + default: goto yy34; + } +yy222: + yych = *++YYCURSOR; + switch (yych) { + case 'p': goto yy249; + default: goto yy34; + } +yy223: + yych = *++YYCURSOR; + switch (yych) { + case 'd': goto yy250; + default: goto yy34; + } +yy224: + yych = *++YYCURSOR; + switch (yych) { + case 'e': goto yy251; + default: goto yy34; + } +yy225: + yych = *++YYCURSOR; + switch (yych) { + case 'f': goto yy252; + default: goto yy34; + } +yy226: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy253; + default: goto yy34; + } +yy227: + yych = *++YYCURSOR; + switch (yych) { + case 0x00: goto yy254; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy227; + default: goto yy34; + } +yy229: ++YYCURSOR; yynmatch = 2; yypmatch[2] = yyt1; yypmatch[0] = yyt1 - 3; yypmatch[1] = YYCURSOR; yypmatch[3] = YYCURSOR - 5; -#line 122 "src/sfizz/OpcodeCleanup.re" +#line 130 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("fil", group(1), "_type"); goto end_region; } -#line 1509 "src/sfizz/OpcodeCleanup.cpp" -yy212: +#line 1646 "src/sfizz/OpcodeCleanup.cpp" +yy231: yych = *++YYCURSOR; switch (yych) { - case 0x00: goto yy233; + case 0x00: goto yy256; case '0': case '1': case '2': @@ -1519,26 +1656,38 @@ yy212: case '6': case '7': case '8': - case '9': goto yy212; + case '9': goto yy231; default: goto yy34; } -yy214: +yy233: yych = *++YYCURSOR; switch (yych) { - case 'e': goto yy235; + case 'f': goto yy258; default: goto yy34; } -yy215: +yy234: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy216; + case 'e': goto yy259; default: goto yy34; } -yy216: +yy235: yych = *++YYCURSOR; - if (yych <= 0x00) goto yy236; + switch (yych) { + case 'o': goto yy237; + default: goto yy34; + } +yy236: + yych = *++YYCURSOR; + switch (yych) { + case 'n': goto yy260; + default: goto yy34; + } +yy237: + yych = *++YYCURSOR; + if (yych <= 0x00) goto yy261; goto yy34; -yy217: +yy238: ++YYCURSOR; yynmatch = 3; yypmatch[4] = yyt1; @@ -1547,13 +1696,13 @@ yy217: yypmatch[2] = yyt1 - 4; yypmatch[3] = yyt1 - 2; yypmatch[5] = YYCURSOR - 1; -#line 141 "src/sfizz/OpcodeCleanup.re" +#line 149 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("start_", group(1), "cc", group(2)); goto end_region; } -#line 1556 "src/sfizz/OpcodeCleanup.cpp" -yy219: +#line 1705 "src/sfizz/OpcodeCleanup.cpp" +yy240: yych = *++YYCURSOR; switch (yych) { case '0': @@ -1567,81 +1716,99 @@ yy219: case '8': case '9': yyt1 = YYCURSOR; - goto yy238; + goto yy263; default: goto yy34; } -yy220: +yy241: yych = *++YYCURSOR; switch (yych) { - case '_': goto yy240; + case '_': goto yy265; default: goto yy34; } -yy221: +yy242: yych = *++YYCURSOR; switch (yych) { case 0x00: yyt2 = yyt3 = NULL; - goto yy241; + goto yy266; case '_': yyt3 = YYCURSOR; - goto yy243; + goto yy268; default: goto yy34; } -yy222: +yy243: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy245; + case 'c': goto yy270; default: goto yy34; } -yy223: +yy244: yych = *++YYCURSOR; switch (yych) { - case 'y': goto yy224; + case 'y': goto yy245; default: goto yy34; } -yy224: +yy245: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy246; + case 'c': goto yy271; default: goto yy34; } -yy225: +yy246: yych = *++YYCURSOR; switch (yych) { - case 'a': goto yy247; + case 'a': goto yy272; default: goto yy34; } -yy226: +yy247: yych = *++YYCURSOR; switch (yych) { - case 't': goto yy224; + case 't': goto yy245; default: goto yy34; } -yy227: +yy248: yych = *++YYCURSOR; switch (yych) { - case 'a': goto yy248; + case 'a': goto yy273; default: goto yy34; } -yy228: +yy249: yych = *++YYCURSOR; switch (yych) { - case 't': goto yy249; + case 't': goto yy274; default: goto yy34; } -yy229: +yy250: yych = *++YYCURSOR; switch (yych) { - case 'e': goto yy250; + case 'e': goto yy275; default: goto yy34; } -yy230: +yy251: yych = *++YYCURSOR; switch (yych) { - case 'q': goto yy250; + case 'q': goto yy275; default: goto yy34; } -yy231: +yy252: + yych = *++YYCURSOR; + switch (yych) { + case 0x00: + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; + goto yy276; + case '_': + yyt3 = yyt5 = YYCURSOR; + goto yy278; + default: goto yy34; + } +yy253: + yych = *++YYCURSOR; + switch (yych) { + case 'n': goto yy280; + default: goto yy34; + } +yy254: ++YYCURSOR; yynmatch = 4; yypmatch[2] = yyt1; @@ -1652,13 +1819,13 @@ yy231: yypmatch[3] = yyt2 - 1; yypmatch[5] = yyt3 - 2; yypmatch[7] = YYCURSOR - 1; -#line 97 "src/sfizz/OpcodeCleanup.re" +#line 98 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat(group(1), "_", group(2), "_oncc", group(3)); goto end_region; } -#line 1661 "src/sfizz/OpcodeCleanup.cpp" -yy233: +#line 1828 "src/sfizz/OpcodeCleanup.cpp" +yy256: ++YYCURSOR; yynmatch = 3; yypmatch[4] = yyt1; @@ -1667,19 +1834,31 @@ yy233: yypmatch[2] = yyt1 - 8; yypmatch[3] = yyt1 - 6; yypmatch[5] = YYCURSOR - 1; -#line 163 "src/sfizz/OpcodeCleanup.re" +#line 171 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat(group(1), "hdcc", group(2)); goto end_region; } -#line 1676 "src/sfizz/OpcodeCleanup.cpp" -yy235: +#line 1843 "src/sfizz/OpcodeCleanup.cpp" +yy258: yych = *++YYCURSOR; switch (yych) { - case 't': goto yy216; + case 'f': goto yy281; default: goto yy34; } -yy236: +yy259: + yych = *++YYCURSOR; + switch (yych) { + case 't': goto yy237; + default: goto yy34; + } +yy260: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy282; + default: goto yy34; + } +yy261: ++YYCURSOR; yynmatch = 3; yypmatch[2] = yyt1; @@ -1688,16 +1867,16 @@ yy236: yypmatch[1] = YYCURSOR; yypmatch[3] = yyt2 - 1; yypmatch[5] = YYCURSOR - 1; -#line 101 "src/sfizz/OpcodeCleanup.re" +#line 102 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat(group(1), "_", group(2), "1"); goto end_region; } -#line 1697 "src/sfizz/OpcodeCleanup.cpp" -yy238: +#line 1876 "src/sfizz/OpcodeCleanup.cpp" +yy263: yych = *++YYCURSOR; switch (yych) { - case 0x00: goto yy251; + case 0x00: goto yy283; case '0': case '1': case '2': @@ -1707,72 +1886,120 @@ yy238: case '6': case '7': case '8': - case '9': goto yy238; + case '9': goto yy263; default: goto yy34; } -yy240: +yy265: yych = *++YYCURSOR; switch (yych) { - case 'g': goto yy253; + case 'g': goto yy285; default: goto yy34; } -yy241: +yy266: ++YYCURSOR; yynmatch = 2; yypmatch[0] = yyt1; yypmatch[2] = yyt3; yypmatch[3] = yyt2; yypmatch[1] = YYCURSOR; -#line 158 "src/sfizz/OpcodeCleanup.re" +#line 166 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("resonance1", group(1)); goto end_region; } -#line 1732 "src/sfizz/OpcodeCleanup.cpp" -yy243: +#line 1911 "src/sfizz/OpcodeCleanup.cpp" +yy268: yych = *++YYCURSOR; if (yych <= 0x00) { yyt2 = YYCURSOR; - goto yy241; + goto yy266; } - goto yy243; -yy245: + goto yy268; +yy270: yych = *++YYCURSOR; switch (yych) { - case 'k': goto yy224; + case 'k': goto yy245; default: goto yy34; } -yy246: +yy271: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy254; + case 'c': goto yy286; default: goto yy34; } -yy247: +yy272: yych = *++YYCURSOR; switch (yych) { - case 's': goto yy255; + case 's': goto yy287; default: goto yy34; } -yy248: +yy273: yych = *++YYCURSOR; switch (yych) { - case 'i': goto yy256; + case 'i': goto yy288; default: goto yy34; } -yy249: +yy274: yych = *++YYCURSOR; switch (yych) { - case 'h': goto yy250; + case 'h': goto yy275; default: goto yy34; } -yy250: +yy275: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy257; + case 'c': goto yy289; default: goto yy34; } -yy251: +yy276: + ++YYCURSOR; + yynmatch = 4; + yypmatch[2] = yyt1; + yypmatch[4] = yyt2; + yypmatch[5] = yyt3; + yypmatch[6] = yyt5; + yypmatch[7] = yyt4; + yypmatch[0] = yyt1; + yypmatch[1] = YYCURSOR; + yypmatch[3] = yyt2 - 1; +#line 110 "src/sfizz/OpcodeCleanup.re" + { + opcode = absl::StrCat(group(1), "_", group(2), "1", group(3)); + goto end_region; + } +#line 1971 "src/sfizz/OpcodeCleanup.cpp" +yy278: + yych = *++YYCURSOR; + if (yych <= 0x00) { + yyt4 = YYCURSOR; + goto yy276; + } + goto yy278; +yy280: + yych = *++YYCURSOR; + switch (yych) { + case 'c': goto yy290; + default: goto yy34; + } +yy281: + yych = *++YYCURSOR; + switch (yych) { + case 0x00: + yyt4 = yyt5 = NULL; + yyt3 = YYCURSOR; + goto yy291; + case '_': + yyt3 = yyt5 = YYCURSOR; + goto yy293; + default: goto yy34; + } +yy282: + yych = *++YYCURSOR; + switch (yych) { + case 'n': goto yy295; + default: goto yy34; + } +yy283: ++YYCURSOR; yynmatch = 3; yypmatch[4] = yyt1; @@ -1781,19 +2008,19 @@ yy251: yypmatch[2] = yyt1 - 6; yypmatch[3] = yyt1 - 4; yypmatch[5] = YYCURSOR - 1; -#line 145 "src/sfizz/OpcodeCleanup.re" +#line 153 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("start_", group(1), "hdcc", group(2)); goto end_region; } -#line 1790 "src/sfizz/OpcodeCleanup.cpp" -yy253: +#line 2017 "src/sfizz/OpcodeCleanup.cpp" +yy285: yych = *++YYCURSOR; switch (yych) { - case 'r': goto yy258; + case 'r': goto yy296; default: goto yy34; } -yy254: +yy286: yych = *++YYCURSOR; switch (yych) { case '0': @@ -1807,37 +2034,73 @@ yy254: case '8': case '9': yyt3 = YYCURSOR; - goto yy259; + goto yy297; default: goto yy34; } -yy255: +yy287: yych = *++YYCURSOR; switch (yych) { - case 'e': goto yy224; + case 'e': goto yy245; default: goto yy34; } -yy256: +yy288: yych = *++YYCURSOR; switch (yych) { - case 'n': goto yy224; + case 'n': goto yy245; default: goto yy34; } -yy257: +yy289: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy261; + case 'c': goto yy299; default: goto yy34; } -yy258: +yy290: yych = *++YYCURSOR; switch (yych) { - case 'o': goto yy262; + case 'e': goto yy252; default: goto yy34; } -yy259: +yy291: + ++YYCURSOR; + yynmatch = 4; + yypmatch[2] = yyt1; + yypmatch[4] = yyt2; + yypmatch[5] = yyt3; + yypmatch[6] = yyt5; + yypmatch[7] = yyt4; + yypmatch[0] = yyt1; + yypmatch[1] = YYCURSOR; + yypmatch[3] = yyt2 - 1; +#line 106 "src/sfizz/OpcodeCleanup.re" + { + opcode = absl::StrCat(group(1), "_", group(2), "1", group(3)); + goto end_region; + } +#line 2081 "src/sfizz/OpcodeCleanup.cpp" +yy293: + yych = *++YYCURSOR; + if (yych <= 0x00) { + yyt4 = YYCURSOR; + goto yy291; + } + goto yy293; +yy295: yych = *++YYCURSOR; switch (yych) { - case 0x00: goto yy263; + case 'c': goto yy300; + default: goto yy34; + } +yy296: + yych = *++YYCURSOR; + switch (yych) { + case 'o': goto yy301; + default: goto yy34; + } +yy297: + yych = *++YYCURSOR; + switch (yych) { + case 0x00: goto yy302; case '0': case '1': case '2': @@ -1847,10 +2110,10 @@ yy259: case '6': case '7': case '8': - case '9': goto yy259; + case '9': goto yy297; default: goto yy34; } -yy261: +yy299: yych = *++YYCURSOR; switch (yych) { case '0': @@ -1864,16 +2127,22 @@ yy261: case '8': case '9': yyt3 = YYCURSOR; - goto yy265; + goto yy304; default: goto yy34; } -yy262: +yy300: yych = *++YYCURSOR; switch (yych) { - case 'u': goto yy267; + case 'e': goto yy281; default: goto yy34; } -yy263: +yy301: + yych = *++YYCURSOR; + switch (yych) { + case 'u': goto yy306; + default: goto yy34; + } +yy302: ++YYCURSOR; yynmatch = 4; yypmatch[2] = yyt1; @@ -1884,16 +2153,16 @@ yy263: yypmatch[3] = yyt2 - 1; yypmatch[5] = yyt3 - 2; yypmatch[7] = YYCURSOR - 1; -#line 93 "src/sfizz/OpcodeCleanup.re" +#line 94 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat(group(1), "_", group(2), "_oncc", group(3)); goto end_region; } -#line 1893 "src/sfizz/OpcodeCleanup.cpp" -yy265: +#line 2162 "src/sfizz/OpcodeCleanup.cpp" +yy304: yych = *++YYCURSOR; switch (yych) { - case 0x00: goto yy268; + case 0x00: goto yy307; case '0': case '1': case '2': @@ -1903,16 +2172,16 @@ yy265: case '6': case '7': case '8': - case '9': goto yy265; + case '9': goto yy304; default: goto yy34; } -yy267: +yy306: yych = *++YYCURSOR; switch (yych) { - case 'p': goto yy270; + case 'p': goto yy309; default: goto yy34; } -yy268: +yy307: ++YYCURSOR; yynmatch = 4; yypmatch[2] = yyt1; @@ -1923,27 +2192,27 @@ yy268: yypmatch[3] = yyt2 - 1; yypmatch[5] = yyt3 - 2; yypmatch[7] = YYCURSOR - 1; -#line 89 "src/sfizz/OpcodeCleanup.re" +#line 90 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat(group(1), "_", group(2), "_oncc", group(3)); goto end_region; } -#line 1932 "src/sfizz/OpcodeCleanup.cpp" -yy270: +#line 2201 "src/sfizz/OpcodeCleanup.cpp" +yy309: yych = *++YYCURSOR; if (yych >= 0x01) goto yy34; ++YYCURSOR; yynmatch = 1; yypmatch[0] = YYCURSOR - 16; yypmatch[1] = YYCURSOR; -#line 127 "src/sfizz/OpcodeCleanup.re" +#line 135 "src/sfizz/OpcodeCleanup.re" { opcode = "group"; goto end_region; } -#line 1945 "src/sfizz/OpcodeCleanup.cpp" +#line 2214 "src/sfizz/OpcodeCleanup.cpp" } -#line 172 "src/sfizz/OpcodeCleanup.re" +#line 180 "src/sfizz/OpcodeCleanup.re" end_region: @@ -1958,80 +2227,80 @@ end_region: YYCURSOR = opcode.c_str(); -#line 1962 "src/sfizz/OpcodeCleanup.cpp" +#line 2231 "src/sfizz/OpcodeCleanup.cpp" { char yych; yych = *YYCURSOR; switch (yych) { - case 's': goto yy277; - default: goto yy275; + case 's': goto yy316; + default: goto yy314; } -yy275: +yy314: ++YYCURSOR; -yy276: -#line 192 "src/sfizz/OpcodeCleanup.re" +yy315: +#line 200 "src/sfizz/OpcodeCleanup.re" { goto end_control; } -#line 1977 "src/sfizz/OpcodeCleanup.cpp" -yy277: +#line 2246 "src/sfizz/OpcodeCleanup.cpp" +yy316: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { - case 'e': goto yy278; - default: goto yy276; + case 'e': goto yy317; + default: goto yy315; } -yy278: +yy317: yych = *++YYCURSOR; switch (yych) { - case 't': goto yy280; - default: goto yy279; + case 't': goto yy319; + default: goto yy318; } -yy279: +yy318: YYCURSOR = YYMARKER; - goto yy276; -yy280: + goto yy315; +yy319: yych = *++YYCURSOR; switch (yych) { - case '_': goto yy281; - default: goto yy279; + case '_': goto yy320; + default: goto yy318; } -yy281: +yy320: yych = *++YYCURSOR; switch (yych) { - case 'r': goto yy282; - default: goto yy279; + case 'r': goto yy321; + default: goto yy318; } -yy282: +yy321: yych = *++YYCURSOR; switch (yych) { - case 'e': goto yy283; - default: goto yy279; + case 'e': goto yy322; + default: goto yy318; } -yy283: +yy322: yych = *++YYCURSOR; switch (yych) { - case 'a': goto yy284; - default: goto yy279; + case 'a': goto yy323; + default: goto yy318; } -yy284: +yy323: yych = *++YYCURSOR; switch (yych) { - case 'l': goto yy285; - default: goto yy279; + case 'l': goto yy324; + default: goto yy318; } -yy285: +yy324: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy286; - default: goto yy279; + case 'c': goto yy325; + default: goto yy318; } -yy286: +yy325: yych = *++YYCURSOR; switch (yych) { - case 'c': goto yy287; - default: goto yy279; + case 'c': goto yy326; + default: goto yy318; } -yy287: +yy326: yych = *++YYCURSOR; switch (yych) { case '0': @@ -2045,13 +2314,13 @@ yy287: case '8': case '9': yyt1 = YYCURSOR; - goto yy288; - default: goto yy279; + goto yy327; + default: goto yy318; } -yy288: +yy327: yych = *++YYCURSOR; switch (yych) { - case 0x00: goto yy290; + case 0x00: goto yy329; case '0': case '1': case '2': @@ -2061,24 +2330,24 @@ yy288: case '6': case '7': case '8': - case '9': goto yy288; - default: goto yy279; + case '9': goto yy327; + default: goto yy318; } -yy290: +yy329: ++YYCURSOR; yynmatch = 2; yypmatch[2] = yyt1; yypmatch[0] = yyt1 - 10; yypmatch[1] = YYCURSOR; yypmatch[3] = YYCURSOR - 1; -#line 187 "src/sfizz/OpcodeCleanup.re" +#line 195 "src/sfizz/OpcodeCleanup.re" { opcode = absl::StrCat("set_hdcc", group(1)); goto end_control; } -#line 2080 "src/sfizz/OpcodeCleanup.cpp" +#line 2349 "src/sfizz/OpcodeCleanup.cpp" } -#line 196 "src/sfizz/OpcodeCleanup.re" +#line 204 "src/sfizz/OpcodeCleanup.re" end_control: diff --git a/src/sfizz/OpcodeCleanup.re b/src/sfizz/OpcodeCleanup.re index 3b0774e2..c744d4ed 100644 --- a/src/sfizz/OpcodeCleanup.re +++ b/src/sfizz/OpcodeCleanup.re @@ -85,6 +85,7 @@ end_region_oncc: egV1 = "ampeg"|"fileg"|"pitcheg"; eqV1 = "eq" number; lfoV2 = "lfo" number; + egV2 = "eg" number; (lfoV1) "_" ("depth"|"freq"|"fade") "cc" (number) END { opcode = absl::StrCat(group(1), "_", group(2), "_oncc", group(3)); @@ -102,7 +103,14 @@ end_region_oncc: opcode = absl::StrCat(group(1), "_", group(2), "1"); goto end_region; } - + (lfoV2) "_" ("cutoff"|"resonance") ("_" any)? END { + opcode = absl::StrCat(group(1), "_", group(2), "1", group(3)); + goto end_region; + } + (egV2) "_" ("cutoff"|"resonance") ("_" any)? END { + opcode = absl::StrCat(group(1), "_", group(2), "1", group(3)); + goto end_region; + } "loop" ("mode"|"start"|"end") END { opcode = absl::StrCat("loop_", group(1)); goto end_region; diff --git a/src/sfizz/Region.cpp b/src/sfizz/Region.cpp index a6cea577..f2097395 100644 --- a/src/sfizz/Region.cpp +++ b/src/sfizz/Region.cpp @@ -45,6 +45,23 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) case hash(x "_stepcc&"): \ case hash(x "_smoothcc&") + #define LFO_EG_filter_EQ_target(sourceKey, targetKey, range) \ + { \ + const auto number = opcode.parameters.front(); \ + if (number == 0) \ + return false; \ + \ + const auto index = opcode.parameters.size() == 2 ? opcode.parameters.back() - 1 : 0; \ + if (!extendIfNecessary(filters, index + 1, Default::numFilters)) \ + return false; \ + \ + if (auto value = readOpcode(opcode.value, range)) { \ + const ModKey source = ModKey::createNXYZ(sourceKey, id, number - 1); \ + const ModKey target = ModKey::createNXYZ(targetKey, id, index); \ + getOrCreateConnection(source, target).sourceDepth = *value; \ + } \ + } + // Sound source: sample playback case hash("sample"): { @@ -579,30 +596,22 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) setValueFromOpcode(opcode, filters[filterIndex].resonance, Default::filterResonanceRange); } break; - case hash("cutoff&_oncc&"): // also cutoff_oncc&, cutoff_cc&, cutoff&_cc& + case_any_ccN("cutoff&"): // also cutoff_oncc&, cutoff_cc&, cutoff&_cc& { const auto filterIndex = opcode.parameters.front() - 1; if (!extendIfNecessary(filters, filterIndex + 1, Default::numFilters)) return false; - setValueFromOpcode( - opcode, - filters[filterIndex].cutoffCC[opcode.parameters.back()], - Default::filterCutoffModRange - ); + processGenericCc(opcode, Default::filterCutoffModRange, ModKey::createNXYZ(ModId::FilCutoff, id, filterIndex)); } break; - case hash("resonance&_oncc&"): // also resonance_oncc&, resonance_cc&, resonance&_cc& + case_any_ccN("resonance&"): // also resonance_oncc&, resonance_cc&, resonance&_cc& { const auto filterIndex = opcode.parameters.front() - 1; if (!extendIfNecessary(filters, filterIndex + 1, Default::numFilters)) return false; - setValueFromOpcode( - opcode, - filters[filterIndex].resonanceCC[opcode.parameters.back()], - Default::filterResonanceModRange - ); + processGenericCc(opcode, Default::filterResonanceModRange, ModKey::createNXYZ(ModId::FilResonance, id, filterIndex)); } break; case hash("fil&_keytrack"): // also fil_keytrack @@ -650,17 +659,13 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) setValueFromOpcode(opcode, filters[filterIndex].gain, Default::filterGainRange); } break; - case hash("fil&_gain_oncc&"): // also fil_gain_oncc& + case_any_ccN("fil&_gain"): // also fil_gain_oncc& { const auto filterIndex = opcode.parameters.front() - 1; if (!extendIfNecessary(filters, filterIndex + 1, Default::numFilters)) return false; - setValueFromOpcode( - opcode, - filters[filterIndex].gainCC[opcode.parameters.back()], - Default::filterGainModRange - ); + processGenericCc(opcode, Default::filterGainModRange, ModKey::createNXYZ(ModId::FilGain, id, filterIndex)); } break; case hash("fil&_type"): // also fil_type, filtype @@ -683,107 +688,90 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) // Performance parameters: EQ case hash("eq&_bw"): { - const auto eqNumber = opcode.parameters.front(); - if (eqNumber == 0) - return false; - if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs)) - return false; - setValueFromOpcode(opcode, equalizers[eqNumber - 1].bandwidth, Default::eqBandwidthRange); - } - break; - case hash("eq&_bw_oncc&"): // also eq&_bwcc& - { - const auto eqNumber = opcode.parameters.front(); - if (eqNumber == 0) - return false; - if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs)) + const auto eqIndex = opcode.parameters.front() - 1; + if (!extendIfNecessary(equalizers, eqIndex + 1, Default::numEQs)) return false; - setValueFromOpcode(opcode, equalizers[eqNumber - 1].bandwidthCC[opcode.parameters.back()], Default::eqBandwidthModRange); + setValueFromOpcode(opcode, equalizers[eqIndex].bandwidth, Default::eqBandwidthRange); + } + break; + case_any_ccN("eq&_bw"): // also eq&_bwcc& + { + const auto eqIndex = opcode.parameters.front() - 1; + if (!extendIfNecessary(equalizers, eqIndex + 1, Default::numEQs)) + return false; + + processGenericCc(opcode, Default::eqBandwidthModRange, ModKey::createNXYZ(ModId::EqBandwidth, id, eqIndex)); } break; case hash("eq&_freq"): { - const auto eqNumber = opcode.parameters.front(); - if (eqNumber == 0) + const auto eqIndex = opcode.parameters.front() - 1; + if (!extendIfNecessary(equalizers, eqIndex + 1, Default::numEQs)) return false; - if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs)) - return false; - setValueFromOpcode(opcode, equalizers[eqNumber - 1].frequency, Default::eqFrequencyRange); + setValueFromOpcode(opcode, equalizers[eqIndex].frequency, Default::eqFrequencyRange); } break; - case hash("eq&_freq_oncc&"): // also eq&_freqcc& + case_any_ccN("eq&_freq"): // also eq&_freqcc& { - const auto eqNumber = opcode.parameters.front(); - if (eqNumber == 0) - return false; - if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs)) + const auto eqIndex = opcode.parameters.front() - 1; + if (!extendIfNecessary(equalizers, eqIndex + 1, Default::numEQs)) return false; - setValueFromOpcode(opcode, equalizers[eqNumber - 1].frequencyCC[opcode.parameters.back()], Default::eqFrequencyModRange); + processGenericCc(opcode, Default::eqFrequencyModRange, ModKey::createNXYZ(ModId::EqFrequency, id, eqIndex)); } break; case hash("eq&_vel&freq"): { - const auto eqNumber = opcode.parameters.front(); - if (eqNumber == 0) - return false; + const auto eqIndex = opcode.parameters.front() - 1; if (opcode.parameters[1] != 2) return false; // was eqN_vel3freq or something else than eqN_vel2freq - if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs)) + if (!extendIfNecessary(equalizers, eqIndex + 1, Default::numEQs)) return false; - setValueFromOpcode(opcode, equalizers[eqNumber - 1].vel2frequency, Default::eqFrequencyModRange); + setValueFromOpcode(opcode, equalizers[eqIndex].vel2frequency, Default::eqFrequencyModRange); } break; case hash("eq&_gain"): { - const auto eqNumber = opcode.parameters.front(); - if (eqNumber == 0) + const auto eqIndex = opcode.parameters.front() - 1; + if (!extendIfNecessary(equalizers, eqIndex + 1, Default::numEQs)) return false; - if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs)) - return false; - setValueFromOpcode(opcode, equalizers[eqNumber - 1].gain, Default::eqGainRange); + setValueFromOpcode(opcode, equalizers[eqIndex].gain, Default::eqGainRange); } break; - case hash("eq&_gain_oncc&"): // also eq&_gaincc& + case_any_ccN("eq&_gain"): // also eq&_gaincc& { - const auto eqNumber = opcode.parameters.front(); - if (eqNumber == 0) - return false; - if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs)) + const auto eqIndex = opcode.parameters.front() - 1; + if (!extendIfNecessary(equalizers, eqIndex + 1, Default::numEQs)) return false; - setValueFromOpcode(opcode, equalizers[eqNumber - 1].gainCC[opcode.parameters.back()], Default::eqGainModRange); + processGenericCc(opcode, Default::eqGainModRange, ModKey::createNXYZ(ModId::EqGain, id, eqIndex)); } break; case hash("eq&_vel&gain"): { - const auto eqNumber = opcode.parameters.front(); - if (eqNumber == 0) - return false; + const auto eqIndex = opcode.parameters.front() - 1; if (opcode.parameters[1] != 2) return false; // was eqN_vel3gain or something else than eqN_vel2gain - if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs)) + if (!extendIfNecessary(equalizers, eqIndex + 1, Default::numEQs)) return false; - setValueFromOpcode(opcode, equalizers[eqNumber - 1].vel2gain, Default::eqGainModRange); + setValueFromOpcode(opcode, equalizers[eqIndex].vel2gain, Default::eqGainModRange); } break; case hash("eq&_type"): { - const auto eqNumber = opcode.parameters.front(); - if (eqNumber == 0) - return false; - if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs)) + const auto eqIndex = opcode.parameters.front() - 1; + if (!extendIfNecessary(equalizers, eqIndex + 1, Default::numEQs)) return false; absl::optional ftype = FilterEq::typeFromName(opcode.value); if (ftype) - equalizers[eqNumber - 1].type = *ftype; + equalizers[eqIndex].type = *ftype; else { - equalizers[eqNumber - 1].type = EqType::kEqNone; + equalizers[eqIndex].type = EqType::kEqNone; DBG("Unknown EQ type: " << opcode.value); } } @@ -1045,6 +1033,24 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) } } break; + case hash("lfo&_cutoff&"): + LFO_EG_filter_EQ_target(ModId::LFO, ModId::FilCutoff, Default::filterCutoffModRange); + break; + case hash("lfo&_resonance&"): + LFO_EG_filter_EQ_target(ModId::LFO, ModId::FilResonance, Default::filterResonanceModRange); + break; + case hash("lfo&_fil&_gain"): + LFO_EG_filter_EQ_target(ModId::LFO, ModId::FilGain, Default::filterGainModRange); + break; + case hash("lfo&_eq&gain"): + LFO_EG_filter_EQ_target(ModId::LFO, ModId::EqGain, Default::eqGainModRange); + break; + case hash("lfo&_eq&freq"): + LFO_EG_filter_EQ_target(ModId::LFO, ModId::EqFrequency, Default::eqFrequencyModRange); + break; + case hash("lfo&_eq&bw"): + LFO_EG_filter_EQ_target(ModId::LFO, ModId::EqBandwidth, Default::eqBandwidthModRange); + break; // Modulation: Flex EG (targets) case hash("eg&_amplitude"): @@ -1119,6 +1125,24 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) } } break; + case hash("eg&_cutoff&"): + LFO_EG_filter_EQ_target(ModId::Envelope, ModId::FilCutoff, Default::filterCutoffModRange); + break; + case hash("eg&_resonance&"): + LFO_EG_filter_EQ_target(ModId::Envelope, ModId::FilResonance, Default::filterResonanceModRange); + break; + case hash("eg&_fil&_gain"): + LFO_EG_filter_EQ_target(ModId::Envelope, ModId::FilGain, Default::filterGainModRange); + break; + case hash("eg&_eq&gain"): + LFO_EG_filter_EQ_target(ModId::Envelope, ModId::EqGain, Default::eqGainModRange); + break; + case hash("eg&_eq&freq"): + LFO_EG_filter_EQ_target(ModId::Envelope, ModId::EqFrequency, Default::eqFrequencyModRange); + break; + case hash("eg&_eq&bw"): + LFO_EG_filter_EQ_target(ModId::Envelope, ModId::EqBandwidth, Default::eqBandwidthModRange); + break; // Amplitude Envelope case hash("ampeg_attack"): @@ -1321,6 +1345,7 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode) return false; #undef case_any_ccN + #undef LFO_EG_filter_EQ_target } return true; diff --git a/src/sfizz/Resources.h b/src/sfizz/Resources.h index 645482cd..577ff756 100644 --- a/src/sfizz/Resources.h +++ b/src/sfizz/Resources.h @@ -6,10 +6,9 @@ #pragma once #include "SynthConfig.h" +#include "MidiState.h" #include "FilePool.h" #include "BufferPool.h" -#include "FilterPool.h" -#include "EQPool.h" #include "Logger.h" #include "Wavetables.h" #include "Curve.h" @@ -29,8 +28,6 @@ struct Resources Logger logger; CurveSet curves; FilePool filePool { logger }; - FilterPool filterPool { midiState }; - EQPool eqPool { midiState }; WavetablePool wavePool; Tuning tuning; absl::optional stretch; @@ -39,8 +36,6 @@ struct Resources void setSampleRate(float samplerate) { midiState.setSampleRate(samplerate); - filterPool.setSampleRate(samplerate); - eqPool.setSampleRate(samplerate); modMatrix.setSampleRate(samplerate); } diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index cb604633..d080db37 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -23,8 +23,11 @@ sfz::Voice::Voice(int voiceNumber, sfz::Resources& resources) : id{voiceNumber}, stateListener(nullptr), resources(resources) { - filters.reserve(config::filtersPerVoice); - equalizers.reserve(config::eqsPerVoice); + for (unsigned i = 0; i < config::filtersPerVoice; ++i) + filters.emplace_back(resources); + + for (unsigned i = 0; i < config::eqsPerVoice; ++i) + equalizers.emplace_back(resources); for (WavetableOscillator& osc : waveOscillators) osc.init(sampleRate); @@ -118,21 +121,12 @@ void sfz::Voice::startVoice(Region* region, int delay, const TriggerEvent& event gainSmoother.reset(); resetCrossfades(); - // Check that we can handle the number of filters; filters should be cleared here - ASSERT((filters.capacity() - filters.size()) >= region->filters.size()); - ASSERT((equalizers.capacity() - equalizers.size()) >= region->equalizers.size()); - - const unsigned numChannels = region->isStereo() ? 2 : 1; - for (auto& filter: region->filters) { - auto newFilter = resources.filterPool.getFilter(filter, numChannels, triggerEvent.number, triggerEvent.value); - if (newFilter) - filters.push_back(newFilter); + for (unsigned i = 0; i < region->filters.size(); ++i) { + filters[i].setup(*region, i, triggerEvent.number, triggerEvent.value); } - for (auto& eq: region->equalizers) { - auto newEQ = resources.eqPool.getEQ(eq, numChannels, triggerEvent.value); - if (newEQ) - equalizers.push_back(newEQ); + for (unsigned i = 0; i < region->equalizers.size(); ++i) { + equalizers[i].setup(*region, i, triggerEvent.value); } sourcePosition = region->getOffset(); @@ -253,6 +247,12 @@ void sfz::Voice::setSampleRate(float sampleRate) noexcept for (auto& lfo : lfos) lfo->setSampleRate(sampleRate); + for (auto& filter : filters) + filter.setSampleRate(sampleRate); + + for (auto& eq : equalizers) + eq.setSampleRate(sampleRate); + powerFollower.setSampleRate(sampleRate); } @@ -498,12 +498,12 @@ void sfz::Voice::filterStageMono(AudioSpan buffer) noexcept const auto leftBuffer = buffer.getSpan(0); const float* inputChannel[1] { leftBuffer.data() }; float* outputChannel[1] { leftBuffer.data() }; - for (auto& filter : filters) { - filter->process(inputChannel, outputChannel, numSamples); + for (unsigned i = 0; i < region->filters.size(); ++i) { + filters[i].process(inputChannel, outputChannel, numSamples); } - for (auto& eq : equalizers) { - eq->process(inputChannel, outputChannel, numSamples); + for (unsigned i = 0; i < region->equalizers.size(); ++i) { + equalizers[i].process(inputChannel, outputChannel, numSamples); } } @@ -517,12 +517,12 @@ void sfz::Voice::filterStageStereo(AudioSpan buffer) noexcept const float* inputChannels[2] { leftBuffer.data(), rightBuffer.data() }; float* outputChannels[2] { leftBuffer.data(), rightBuffer.data() }; - for (auto& filter : filters) { - filter->process(inputChannels, outputChannels, numSamples); + for (unsigned i = 0; i < region->filters.size(); ++i) { + filters[i].process(inputChannels, outputChannels, numSamples); } - for (auto& eq : equalizers) { - eq->process(inputChannels, outputChannels, numSamples); + for (unsigned i = 0; i < region->equalizers.size(); ++i) { + equalizers[i].process(inputChannels, outputChannels, numSamples); } } @@ -611,7 +611,7 @@ void sfz::Voice::fillWithData(AudioSpan buffer) noexcept sourcePosition = indices->back(); floatPositionOffset = coeffs->back(); -#if 0 +#if 1 ASSERT(!hasNanInf(buffer.getConstSpan(0))); ASSERT(!hasNanInf(buffer.getConstSpan(1))); SFIZZ_CHECK(isReasonableAudio(buffer.getConstSpan(0))); @@ -731,8 +731,11 @@ void sfz::Voice::reset() noexcept powerFollower.clear(); - filters.clear(); - equalizers.clear(); + for (auto& filter : filters) + filter.reset(); + + for (auto& eq : equalizers) + eq.reset(); removeVoiceFromRing(); } @@ -776,16 +779,22 @@ uint32_t sfz::Voice::getSourcePosition() const noexcept void sfz::Voice::setMaxFiltersPerVoice(size_t numFilters) { - // There are filters in there, this call is unexpected - ASSERT(filters.size() == 0); - filters.reserve(numFilters); + if (numFilters == filters.size()) + return; + + filters.clear(); + for (unsigned i = 0; i < numFilters; ++i) + filters.emplace_back(resources); } void sfz::Voice::setMaxEQsPerVoice(size_t numFilters) { - // There are filters in there, this call is unexpected - ASSERT(equalizers.size() == 0); - equalizers.reserve(numFilters); + if (numFilters == equalizers.size()) + return; + + equalizers.clear(); + for (unsigned i = 0; i < numFilters; ++i) + equalizers.emplace_back(resources); } void sfz::Voice::setMaxLFOsPerVoice(size_t numLFOs) diff --git a/src/sfizz/Voice.h b/src/sfizz/Voice.h index 8833271a..8afe3a06 100644 --- a/src/sfizz/Voice.h +++ b/src/sfizz/Voice.h @@ -12,6 +12,8 @@ #include "Region.h" #include "AudioBuffer.h" #include "Resources.h" +#include "FilterPool.h" +#include "EQPool.h" #include "Smoothers.h" #include "AudioSpan.h" #include "LeakDetector.h" @@ -454,8 +456,8 @@ private: Resources& resources; - std::vector filters; - std::vector equalizers; + std::vector filters; + std::vector equalizers; std::vector> lfos; std::vector> flexEGs; diff --git a/src/sfizz/modulations/ModId.cpp b/src/sfizz/modulations/ModId.cpp index a75c648c..9d19e10e 100644 --- a/src/sfizz/modulations/ModId.cpp +++ b/src/sfizz/modulations/ModId.cpp @@ -44,6 +44,18 @@ int ModIds::flags(ModId id) noexcept return kModIsPerVoice|kModIsAdditive; case ModId::Volume: return kModIsPerVoice|kModIsAdditive; + case ModId::FilGain: + return kModIsPerVoice|kModIsAdditive; + case ModId::FilCutoff: + return kModIsPerVoice|kModIsAdditive; + case ModId::FilResonance: + return kModIsPerVoice|kModIsAdditive; + case ModId::EqGain: + return kModIsPerVoice|kModIsAdditive; + case ModId::EqFrequency: + return kModIsPerVoice|kModIsAdditive; + case ModId::EqBandwidth: + return kModIsPerVoice|kModIsAdditive; // unknown default: diff --git a/src/sfizz/modulations/ModId.h b/src/sfizz/modulations/ModId.h index 8f18679a..7ab96ee9 100644 --- a/src/sfizz/modulations/ModId.h +++ b/src/sfizz/modulations/ModId.h @@ -37,6 +37,12 @@ enum class ModId : int { Position, Pitch, Volume, + FilGain, + FilCutoff, + FilResonance, + EqGain, + EqFrequency, + EqBandwidth, _TargetsEnd, // [/targets] -------------------------------------------------------------- diff --git a/src/sfizz/modulations/ModKey.cpp b/src/sfizz/modulations/ModKey.cpp index aa4dd1cd..3615c976 100644 --- a/src/sfizz/modulations/ModKey.cpp +++ b/src/sfizz/modulations/ModKey.cpp @@ -87,6 +87,18 @@ std::string ModKey::toString() const return absl::StrCat("Pitch {", region_.number(), "}"); case ModId::Volume: return absl::StrCat("Volume {", region_.number(), "}"); + case ModId::FilGain: + return absl::StrCat("FilterGain {", region_.number(), ", N=", 1 + params_.N, "}"); + case ModId::FilCutoff: + return absl::StrCat("FilterCutoff {", region_.number(), ", N=", 1 + params_.N, "}"); + case ModId::FilResonance: + return absl::StrCat("FilterResonance {", region_.number(), ", N=", 1 + params_.N, "}"); + case ModId::EqGain: + return absl::StrCat("EqGain {", region_.number(), ", N=", 1 + params_.N, "}"); + case ModId::EqFrequency: + return absl::StrCat("EqFrequency {", region_.number(), ", N=", 1 + params_.N, "}"); + case ModId::EqBandwidth: + return absl::StrCat("EqBandwidth {", region_.number(), ", N=", 1 + params_.N, "}"); default: return {}; diff --git a/src/sfizz/modulations/ModMatrix.cpp b/src/sfizz/modulations/ModMatrix.cpp index 4533d156..d7ddc444 100644 --- a/src/sfizz/modulations/ModMatrix.cpp +++ b/src/sfizz/modulations/ModMatrix.cpp @@ -168,7 +168,7 @@ ModMatrix::TargetId ModMatrix::registerTarget(const ModKey& key) return id; } -ModMatrix::SourceId ModMatrix::findSource(const ModKey& key) +ModMatrix::SourceId ModMatrix::findSource(const ModKey& key) const { Impl& impl = *impl_; @@ -179,7 +179,7 @@ ModMatrix::SourceId ModMatrix::findSource(const ModKey& key) return SourceId(it->second); } -ModMatrix::TargetId ModMatrix::findTarget(const ModKey& key) +ModMatrix::TargetId ModMatrix::findTarget(const ModKey& key) const { Impl& impl = *impl_; diff --git a/src/sfizz/modulations/ModMatrix.h b/src/sfizz/modulations/ModMatrix.h index b0f9f58f..0f0fb471 100644 --- a/src/sfizz/modulations/ModMatrix.h +++ b/src/sfizz/modulations/ModMatrix.h @@ -77,14 +77,14 @@ public: * * @param key source key */ - SourceId findSource(const ModKey& key); + SourceId findSource(const ModKey& key) const; /** * @brief Look up a target by key. * * @param key target key */ - TargetId findTarget(const ModKey& key); + TargetId findTarget(const ModKey& key) const; /** * @brief Connect a source and a destination inside the matrix. diff --git a/tests/ModulationsT.cpp b/tests/ModulationsT.cpp index 2b14e191..45db5737 100644 --- a/tests/ModulationsT.cpp +++ b/tests/ModulationsT.cpp @@ -99,3 +99,135 @@ width_oncc425=29 R"("Controller 425 {curve=0, smooth=0, value=29, step=0}" -> "Width {0}")", })); } + +TEST_CASE("[Modulations] Filter CC connections") +{ + sfz::Synth synth; + synth.loadSfzString("/modulation.sfz", R"( + sample=*sine + cutoff=100 fil1_gain_oncc3=5 fil1_gain_stepcc3=0.5 + cutoff2=300 cutoff2_cc2=100 cutoff2_curvecc2=2 + resonance3=-1 resonance3_oncc1=2 resonance3_smoothcc1=10 + )"); + + const std::string graph = synth.getResources().modMatrix.toDotGraph(); + REQUIRE(graph == createReferenceGraph({ + R"("Controller 1 {curve=0, smooth=10, value=2, step=0}" -> "FilterResonance {0, N=3}")", + R"("Controller 2 {curve=2, smooth=0, value=100, step=0}" -> "FilterCutoff {0, N=2}")", + R"("Controller 3 {curve=0, smooth=0, value=5, step=0.5}" -> "FilterGain {0, N=1}")", + })); +} + +TEST_CASE("[Modulations] EQ CC connections") +{ + sfz::Synth synth; + synth.loadSfzString("/modulation.sfz", R"( + sample=*sine + eq1_gain_oncc2=5 eq1_gain_stepcc2=0.5 + eq2_freq_oncc3=300 eq2_freq_curvecc3=3 + eq3_bw_oncc1=2 eq3_bw_smoothcc1=10 + )"); + + const std::string graph = synth.getResources().modMatrix.toDotGraph(); + REQUIRE(graph == createReferenceGraph({ + R"("Controller 1 {curve=0, smooth=10, value=2, step=0}" -> "EqBandwidth {0, N=3}")", + R"("Controller 2 {curve=0, smooth=0, value=5, step=0.5}" -> "EqGain {0, N=1}")", + R"("Controller 3 {curve=3, smooth=0, value=300, step=0}" -> "EqFrequency {0, N=2}")", + })); +} + +TEST_CASE("[Modulations] LFO Filter connections") +{ + sfz::Synth synth; + synth.loadSfzString("/modulation.sfz", R"( + sample=*sine + lfo1_freq=0.1 lfo1_cutoff1=1 + lfo2_freq=1 lfo2_cutoff=2 + lfo3_freq=2 lfo3_resonance=3 + lfo4_freq=0.5 lfo4_resonance1=4 + lfo5_freq=0.5 lfo5_resonance2=5 + lfo6_freq=3 lfo6_fil1_gain=-1 + )"); + + const std::string graph = synth.getResources().modMatrix.toDotGraph(); + REQUIRE(graph == createReferenceGraph({ + R"("LFO 1 {0}" -> "FilterCutoff {0, N=1}")", + R"("LFO 2 {0}" -> "FilterCutoff {0, N=1}")", + R"("LFO 3 {0}" -> "FilterResonance {0, N=1}")", + R"("LFO 4 {0}" -> "FilterResonance {0, N=1}")", + R"("LFO 5 {0}" -> "FilterResonance {0, N=2}")", + R"("LFO 6 {0}" -> "FilterGain {0, N=1}")", + })); +} + +TEST_CASE("[Modulations] EG Filter connections") +{ + sfz::Synth synth; + synth.loadSfzString("/modulation.sfz", R"( + sample=*sine + eg1_time1=0.1 eg1_cutoff1=1 + eg2_time1=1 eg2_cutoff=2 + eg3_time1=2 eg3_resonance=3 + eg4_time1=0.5 eg4_resonance1=4 + eg5_time1=0.5 eg5_resonance2=5 + eg6_time1=3 eg6_fil1_gain=-1 + )"); + + const std::string graph = synth.getResources().modMatrix.toDotGraph(); + REQUIRE(graph == createReferenceGraph({ + R"("EG 1 {0}" -> "FilterCutoff {0, N=1}")", + R"("EG 2 {0}" -> "FilterCutoff {0, N=1}")", + R"("EG 3 {0}" -> "FilterResonance {0, N=1}")", + R"("EG 4 {0}" -> "FilterResonance {0, N=1}")", + R"("EG 5 {0}" -> "FilterResonance {0, N=2}")", + R"("EG 6 {0}" -> "FilterGain {0, N=1}")", + })); +} + +TEST_CASE("[Modulations] LFO EQ connections") +{ + sfz::Synth synth; + synth.loadSfzString("/modulation.sfz", R"( + sample=*sine + lfo1_freq=0.1 lfo1_eq1bw=1 + lfo2_freq=1 lfo2_eq2freq=2 + lfo3_freq=2 lfo3_eq3gain=3 + lfo4_freq=0.5 lfo4_eq3bw=4 + lfo5_freq=0.5 lfo5_eq2gain=5 + lfo6_freq=3 lfo6_eq1freq=-1 + )"); + + const std::string graph = synth.getResources().modMatrix.toDotGraph(); + REQUIRE(graph == createReferenceGraph({ + R"("LFO 1 {0}" -> "EqBandwidth {0, N=1}")", + R"("LFO 2 {0}" -> "EqFrequency {0, N=2}")", + R"("LFO 3 {0}" -> "EqGain {0, N=3}")", + R"("LFO 4 {0}" -> "EqBandwidth {0, N=3}")", + R"("LFO 5 {0}" -> "EqGain {0, N=2}")", + R"("LFO 6 {0}" -> "EqFrequency {0, N=1}")", + })); +} + +TEST_CASE("[Modulations] EG EQ connections") +{ + sfz::Synth synth; + synth.loadSfzString("/modulation.sfz", R"( + sample=*sine + eg1_freq=0.1 eg1_eq1bw=1 + eg2_freq=1 eg2_eq2freq=2 + eg3_freq=2 eg3_eq3gain=3 + eg4_freq=0.5 eg4_eq3bw=4 + eg5_freq=0.5 eg5_eq2gain=5 + eg6_freq=3 eg6_eq1freq=-1 + )"); + + const std::string graph = synth.getResources().modMatrix.toDotGraph(); + REQUIRE(graph == createReferenceGraph({ + R"("EG 1 {0}" -> "EqBandwidth {0, N=1}")", + R"("EG 2 {0}" -> "EqFrequency {0, N=2}")", + R"("EG 3 {0}" -> "EqGain {0, N=3}")", + R"("EG 4 {0}" -> "EqBandwidth {0, N=3}")", + R"("EG 5 {0}" -> "EqGain {0, N=2}")", + R"("EG 6 {0}" -> "EqFrequency {0, N=1}")", + })); +} diff --git a/tests/RegionT.cpp b/tests/RegionT.cpp index 78b5ce97..c7896667 100644 --- a/tests/RegionT.cpp +++ b/tests/RegionT.cpp @@ -1313,9 +1313,6 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.filters[0].gain == 0); REQUIRE(region.filters[0].veltrack == 0); REQUIRE(region.filters[0].resonance == 0.0f); - REQUIRE(region.filters[0].cutoffCC.empty()); - REQUIRE(region.filters[0].gainCC.empty()); - REQUIRE(region.filters[0].resonanceCC.empty()); region.parseOpcode({ "cutoff2", "5000" }); REQUIRE(region.filters.size() == 2); @@ -1327,9 +1324,6 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.filters[1].gain == 0); REQUIRE(region.filters[1].veltrack == 0); REQUIRE(region.filters[1].resonance == 0.0f); - REQUIRE(region.filters[1].cutoffCC.empty()); - REQUIRE(region.filters[1].gainCC.empty()); - REQUIRE(region.filters[1].resonanceCC.empty()); region.parseOpcode({ "cutoff4", "50" }); REQUIRE(region.filters.size() == 4); @@ -1342,18 +1336,12 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.filters[2].gain == 0); REQUIRE(region.filters[2].veltrack == 0); REQUIRE(region.filters[2].resonance == 0.0f); - REQUIRE(region.filters[2].cutoffCC.empty()); - REQUIRE(region.filters[2].gainCC.empty()); - REQUIRE(region.filters[2].resonanceCC.empty()); REQUIRE(region.filters[3].keycenter == 60); REQUIRE(region.filters[3].type == FilterType::kFilterLpf2p); REQUIRE(region.filters[3].keytrack == 0); REQUIRE(region.filters[3].gain == 0); REQUIRE(region.filters[3].veltrack == 0); REQUIRE(region.filters[3].resonance == 0.0f); - REQUIRE(region.filters[3].cutoffCC.empty()); - REQUIRE(region.filters[3].gainCC.empty()); - REQUIRE(region.filters[3].resonanceCC.empty()); } SECTION("Filter parameter dispatch") @@ -1373,16 +1361,6 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.filters[1].veltrack == -100); region.parseOpcode({ "fil3_keytrack", "100" }); REQUIRE(region.filters[2].keytrack == 100); - REQUIRE(region.filters[0].cutoffCC.empty()); - region.parseOpcode({ "cutoff1_cc15", "210" }); - REQUIRE(region.filters[0].cutoffCC.contains(15)); - REQUIRE(region.filters[0].cutoffCC[15] == 210); - region.parseOpcode({ "resonance3_cc24", "10" }); - REQUIRE(region.filters[2].resonanceCC.contains(24)); - REQUIRE(region.filters[2].resonanceCC[24] == 10); - region.parseOpcode({ "fil2_gain_oncc12", "-50" }); - REQUIRE(region.filters[1].gainCC.contains(12)); - REQUIRE(region.filters[1].gainCC[12] == -50.0f); } @@ -1430,16 +1408,6 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.filters[0].gain == 96.0f); region.parseOpcode({ "fil_gain", "-200" }); REQUIRE(region.filters[0].gain == -96.0f); - - region.parseOpcode({ "cutoff_cc43", "10000" }); - REQUIRE(region.filters[0].cutoffCC[43] == 9600); - region.parseOpcode({ "cutoff_cc43", "-10000" }); - REQUIRE(region.filters[0].cutoffCC[43] == -9600); - - region.parseOpcode({ "resonance_cc43", "100" }); - REQUIRE(region.filters[0].resonanceCC[43] == 96.0f); - region.parseOpcode({ "resonance_cc43", "-5" }); - REQUIRE(region.filters[0].resonanceCC[43] == 0.0f); } SECTION("Filter types") @@ -1512,9 +1480,6 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.equalizers[0].frequency == 0.0f); REQUIRE(region.equalizers[0].vel2frequency == 0); REQUIRE(region.equalizers[0].vel2gain == 0); - REQUIRE(region.equalizers[0].frequencyCC.empty()); - REQUIRE(region.equalizers[0].bandwidthCC.empty()); - REQUIRE(region.equalizers[0].gainCC.empty()); region.parseOpcode({ "eq2_gain", "-400" }); REQUIRE(region.equalizers.size() == 2); @@ -1525,9 +1490,6 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.equalizers[1].frequency == 0.0f); REQUIRE(region.equalizers[1].vel2frequency == 0); REQUIRE(region.equalizers[1].vel2gain == 0); - REQUIRE(region.equalizers[1].frequencyCC.empty()); - REQUIRE(region.equalizers[1].bandwidthCC.empty()); - REQUIRE(region.equalizers[1].gainCC.empty()); region.parseOpcode({ "eq4_gain", "500" }); REQUIRE(region.equalizers.size() == 4); @@ -1539,16 +1501,10 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.equalizers[2].frequency == 0.0f); REQUIRE(region.equalizers[2].vel2frequency == 0); REQUIRE(region.equalizers[2].vel2gain == 0); - REQUIRE(region.equalizers[2].frequencyCC.empty()); - REQUIRE(region.equalizers[2].bandwidthCC.empty()); - REQUIRE(region.equalizers[2].gainCC.empty()); REQUIRE(region.equalizers[3].bandwidth == 1.0f); REQUIRE(region.equalizers[3].frequency == 0.0f); REQUIRE(region.equalizers[3].vel2frequency == 0); REQUIRE(region.equalizers[3].vel2gain == 0); - REQUIRE(region.equalizers[3].frequencyCC.empty()); - REQUIRE(region.equalizers[3].bandwidthCC.empty()); - REQUIRE(region.equalizers[3].gainCC.empty()); } SECTION("EQ types") @@ -1578,24 +1534,8 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.equalizers[2].vel2gain == 10.0f); region.parseOpcode({ "eq1_vel2freq", "100" }); REQUIRE(region.equalizers[0].vel2frequency == 100.0f); - REQUIRE(region.equalizers[0].bandwidthCC.empty()); - region.parseOpcode({ "eq1_bwcc24", "0.5" }); - REQUIRE(region.equalizers[0].bandwidthCC.contains(24)); - REQUIRE(region.equalizers[0].bandwidthCC[24] == 0.5f); - region.parseOpcode({ "eq1_bw_oncc24", "1.5" }); - REQUIRE(region.equalizers[0].bandwidthCC[24] == 1.5f); - region.parseOpcode({ "eq3_freqcc15", "10" }); - REQUIRE(region.equalizers[2].frequencyCC.contains(15)); - REQUIRE(region.equalizers[2].frequencyCC[15] == 10.0f); - region.parseOpcode({ "eq3_freq_oncc15", "20" }); - REQUIRE(region.equalizers[2].frequencyCC[15] == 20.0f); region.parseOpcode({ "eq1_type", "hshelf" }); REQUIRE(region.equalizers[0].type == EqType::kEqHighShelf); - region.parseOpcode({ "eq2_gaincc123", "2" }); - REQUIRE(region.equalizers[1].gainCC.contains(123)); - REQUIRE(region.equalizers[1].gainCC[123] == 2.0f); - region.parseOpcode({ "eq2_gain_oncc123", "-2" }); - REQUIRE(region.equalizers[1].gainCC[123] == -2.0f); } SECTION("EQ parameter values") @@ -1625,24 +1565,6 @@ TEST_CASE("[Region] Parsing opcodes") REQUIRE(region.equalizers[0].vel2frequency == 30000.0f); region.parseOpcode({ "eq1_vel2freq", "-35000" }); REQUIRE(region.equalizers[0].vel2frequency == -30000.0f); - region.parseOpcode({ "eq1_bwcc15", "2" }); - REQUIRE(region.equalizers[0].bandwidthCC[15] == 2.0f); - region.parseOpcode({ "eq1_bwcc15", "-5" }); - REQUIRE(region.equalizers[0].bandwidthCC[15] == -4.0f); - region.parseOpcode({ "eq1_bwcc15", "5" }); - REQUIRE(region.equalizers[0].bandwidthCC[15] == 4.0f); - region.parseOpcode({ "eq1_gaincc15", "2" }); - REQUIRE(region.equalizers[0].gainCC[15] == 2.0f); - region.parseOpcode({ "eq1_gaincc15", "-500" }); - REQUIRE(region.equalizers[0].gainCC[15] == -96.0f); - region.parseOpcode({ "eq1_gaincc15", "500" }); - REQUIRE(region.equalizers[0].gainCC[15] == 96.0f); - region.parseOpcode({ "eq1_freqcc15", "200" }); - REQUIRE(region.equalizers[0].frequencyCC[15] == 200.0f); - region.parseOpcode({ "eq1_freqcc15", "-50000" }); - REQUIRE(region.equalizers[0].frequencyCC[15] == -30000.0f); - region.parseOpcode({ "eq1_freqcc15", "50000" }); - REQUIRE(region.equalizers[0].frequencyCC[15] == 30000.0f); } SECTION("Effects send")