Skip to content

Commit

Permalink
- added panic button symbol to patch browser items with voice reset f…
Browse files Browse the repository at this point in the history
…unctionality
  • Loading branch information
christoph-hart committed Sep 16, 2024
1 parent 5dde56a commit 9949058
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 5 deletions.
2 changes: 1 addition & 1 deletion currentGitHash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
75d7a529e59d044daef839c655c6d9e6f1421cb2
5dde56a05d1aa211d7989a78b44093c6f45b921d
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 "75d7a529e59d044daef839c655c6d9e6f1421cb2"
#define PREVIOUS_HISE_COMMIT "5dde56a05d1aa211d7989a78b44093c6f45b921d"
18 changes: 16 additions & 2 deletions hi_backend/backend/debug_components/PatchBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ PatchBrowser::PatchCollection::PatchCollection(int index, ModulatorSynth *synth,

foldButton->setVisible(true);

setTooltip("Show " + synth->getId() + " editor");
setTooltip(synth->getId() + ", Type: " + synth->getType().toString());

idLabel.setFont(GLOBAL_BOLD_FONT().withHeight(JUCE_LIVE_CONSTANT_OFF(16.0f)));

Expand Down Expand Up @@ -1554,7 +1554,7 @@ lastId(String()),
hierarchy(hierarchy_),
lastMouseDown(0)
{
setTooltip("Show " + p->getId() + " editor");
setTooltip(p->getId() + ", Type: " + p->getType());

addAndMakeVisible(closeButton);
addAndMakeVisible(createButton);
Expand Down Expand Up @@ -1855,10 +1855,24 @@ void PatchBrowser::PatchItem::paint(Graphics& g)

g.setColour(Colour(0xFF222222));

if(auto rv = dynamic_cast<snex::Types::VoiceResetter*>(p.get()))
{
if(!rv->isVoiceResetActive())
g.setColour(Colour(0x44222222));

g.setFont(GLOBAL_BOLD_FONT());
g.drawText("!", iconSpace.translated(0.0f, -1.0f), Justification::centred);
g.drawEllipse(iconSpace.reduced(JUCE_LIVE_CONSTANT_OFF(3.0f)), 1.5f);

g.setColour(Colour(0xFF222222));
}

g.drawRoundedRectangle(iconSpace, 2.0f, 2.0f);

g.setColour(ProcessorHelpers::is<Chain>(p.get()) ? Colours::black.withAlpha(0.6f) : Colours::black);



auto ds = getDragState();

if(ds != DragState::Inactive)
Expand Down
13 changes: 12 additions & 1 deletion hi_backend/backend/doc_generators/ModuleDocGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ juce::String HiseModuleDatabase::Resolver::getContent(const MarkdownLink& url)
interfaces.add("TableProcessor");
if (dynamic_cast<RoutableProcessor*>(p) != nullptr)
interfaces.add("RoutingMatrix");
if(dynamic_cast<snex::Types::VoiceResetter*>(p) != nullptr)
interfaces.add("VoiceResetter");

if (interfaces.size() > 0)
{
Expand All @@ -322,7 +324,16 @@ juce::String HiseModuleDatabase::Resolver::getContent(const MarkdownLink& url)
{
//s << iLink.getChildUrl(i).toString(MarkdownLink::FormattedLinkMarkdown);

s << "[`" << i << "`](/scripting/scripting-api/" << MarkdownLink::Helpers::getSanitizedFilename(i) << ") ";
if(i == "VoiceResetter")
{
s << "[`" << i << "`](/scriptnode/manual/glossary#voiceresetter)";
}
else
{
s << "[`" << i << "`](/scripting/scripting-api/" << MarkdownLink::Helpers::getSanitizedFilename(i) << ") ";
}


}

s << " \n";
Expand Down
5 changes: 5 additions & 0 deletions hi_core/hi_modules/effects/fx/SlotFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ class HardcodedPolyphonicFX : public VoiceEffectProcessor,
return voiceStack.voiceNoteOns.size();
}

bool isVoiceResetActive() const override
{
return hasHardcodedTail();
}

void onVoiceReset(bool allVoices, int voiceIndex) override
{
if (allVoices)
Expand Down
2 changes: 2 additions & 0 deletions hi_dsp_library/snex_basics/snex_Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ struct VoiceResetter
virtual void onVoiceReset(bool allVoices, int voiceIndex) = 0;
virtual int getNumActiveVoices() const = 0;

virtual bool isVoiceResetActive() const = 0;

int skipResetIndex = -1;

JUCE_DECLARE_WEAK_REFERENCEABLE(VoiceResetter);
Expand Down
15 changes: 15 additions & 0 deletions hi_scripting/scripting/ScriptProcessorModules.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ class ScriptnodeVoiceKiller : public EnvelopeModulator,

void onVoiceReset(bool allVoices, int voiceIndex) final override;

bool isVoiceResetActive() const override
{
return true;
}

ProcessorEditorBody *createEditor(ProcessorEditor *parentEditor) override;

State* getState(int i);
Expand Down Expand Up @@ -459,6 +464,11 @@ class JavascriptEnvelopeModulator : public JavascriptProcessor,

void onVoiceReset(bool allVoices, int voiceIndex) final override;

bool isVoiceResetActive() const override
{
return true;
}

int getNumParameters() const override;

void setInternalAttribute(int index, float newValue) override;
Expand Down Expand Up @@ -761,6 +771,11 @@ class JavascriptPolyphonicEffect : public JavascriptProcessor,
return voiceData.voiceNoteOns.size();
}

bool isVoiceResetActive() const override
{
return hasTail();
}

void onVoiceReset(bool allVoices, int voiceIndex) override
{
if (allVoices)
Expand Down

0 comments on commit 9949058

Please sign in to comment.