Skip to content

Commit

Permalink
- fixed #575
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-hart committed Sep 30, 2024
1 parent 6c1c41e commit 56f5d95
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 31 deletions.
2 changes: 1 addition & 1 deletion currentGitHash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c74fc713e4260b74c04f3f193c5fb032075ce143
6c1c41e7f06b4a4ddcbb87ce5cf1647525e309f1
2 changes: 1 addition & 1 deletion hi_backend/backend/currentGit.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define PREVIOUS_HISE_COMMIT "c74fc713e4260b74c04f3f193c5fb032075ce143"
#define PREVIOUS_HISE_COMMIT "6c1c41e7f06b4a4ddcbb87ce5cf1647525e309f1"
1 change: 1 addition & 0 deletions hi_core/hi_dsp/ProcessorInterfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ ComplexDataUIBase* ProcessorWithExternalData::createAndInit(ExternalData::DataTy

void ProcessorWithExternalData::referenceShared(ExternalData::DataType type, int index)
{
// if this hits, you need to overwrite the method and assign the table to the class member
jassertfalse;
}

Expand Down
5 changes: 5 additions & 0 deletions hi_core/hi_modules/modulators/mods/KeyModulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ class KeyModulator: public VoiceStartModulator,
return 0.0f;
};

void referenceShared(ExternalData::DataType, int) override
{
// no need to do anything...
}

/** Calculates a new random value. If the table is used, it is converted to 7bit.*/
float calculateVoiceStartValue(const HiseEvent &m) override
{
Expand Down
5 changes: 5 additions & 0 deletions hi_core/hi_modules/modulators/mods/MacroControlModulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ class MacroModulator: public TimeVariantModulator,

NormalisableRange<double> getRange() const final override { return NormalisableRange<double>(0.0, 1.0); };

void referenceShared(ExternalData::DataType, int) override
{
// no need to do anything...
}

private:

// Do nothing, since the data is updated anyway...
Expand Down
5 changes: 5 additions & 0 deletions hi_core/hi_modules/modulators/mods/PitchWheelModulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ class PitchwheelModulator: public TimeVariantModulator,
if(sampleRate != -1.0) setInternalAttribute(SmoothTime, smoothTime);
};

void referenceShared(ExternalData::DataType, int) override
{
// no need to do anything...
}

private:

bool mpeEnabled = false;
Expand Down
63 changes: 34 additions & 29 deletions hi_core/hi_modules/modulators/mods/TableEnvelope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,7 @@ TableEnvelope::TableEnvelope(MainController *mc, const String &id, int voiceAmou

monophonicState = createSubclassedState(-1);

WeakReference<Processor> t = this;

auto attackConverter = [t](float input)
{
if (t != nullptr)
{
auto time = t->getAttribute(TableEnvelope::SpecialParameters::Attack);
return String(roundToInt(input * time)) + " ms";
}

return String();
};

auto releaseConverter = [t](float input)
{
if (t != nullptr)
{
auto time = t->getAttribute(TableEnvelope::SpecialParameters::Release);
return String(roundToInt(input * time)) + " ms";
}

return String();
};

attackChain->setTableValueConverter(attackConverter);
releaseChain->setTableValueConverter(releaseConverter);

attackTable->setXTextConverter(attackConverter);
releaseTable->setXTextConverter(releaseConverter);
updateTables();

attackChain->setIsVoiceStartChain(true);
releaseChain->setIsVoiceStartChain(true);
Expand Down Expand Up @@ -295,6 +267,39 @@ void TableEnvelope::handleHiseEvent(const HiseEvent& m)
releaseChain->handleHiseEvent(m);
};

void TableEnvelope::updateTables()
{
WeakReference<Processor> t = this;

auto attackConverter = [t](float input)
{
if (t != nullptr)
{
auto time = t->getAttribute(TableEnvelope::SpecialParameters::Attack);
return String(roundToInt(input * time)) + " ms";
}

return String();
};

auto releaseConverter = [t](float input)
{
if (t != nullptr)
{
auto time = t->getAttribute(TableEnvelope::SpecialParameters::Release);
return String(roundToInt(input * time)) + " ms";
}

return String();
};

attackChain->setTableValueConverter(attackConverter);
releaseChain->setTableValueConverter(releaseConverter);

attackTable->setXTextConverter(attackConverter);
releaseTable->setXTextConverter(releaseConverter);
}

float TableEnvelope::calculateNewValue(int voiceIndex)
{
jassert(voiceIndex < states.size());
Expand Down
16 changes: 16 additions & 0 deletions hi_core/hi_modules/modulators/mods/TableEnvelope.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,24 @@ class TableEnvelope: public EnvelopeModulator,

ModulatorState *createSubclassedState(int voiceIndex) const override {return new TableEnvelopeState(voiceIndex); };

void referenceShared(ExternalData::DataType dt, int index) override
{
if(index == 0)
{
attackTable = getTableUnchecked(index);
}
if(index == 1)
{
releaseTable = getTableUnchecked(index);
}

updateTables();
}

private:

void updateTables();

hise::ExecutionLimiter<DummyCriticalSection> uiUpdater;

double attackUptimeDelta = 1.0;
Expand Down

0 comments on commit 56f5d95

Please sign in to comment.