Browse Source

BLOCKS: Added a method to reset to the default program

tags/2021-05-28
dimitri Tom Poole 6 years ago
parent
commit
bdfbcff62d
2 changed files with 12 additions and 0 deletions
  1. +3
    -0
      modules/juce_blocks_basics/blocks/juce_Block.h
  2. +9
    -0
      modules/juce_blocks_basics/topology/internal/juce_BlockImplementation.cpp

+ 3
- 0
modules/juce_blocks_basics/blocks/juce_Block.h View File

@@ -304,6 +304,9 @@ public:
/** Sets the current program as the block's default state. */
virtual void saveProgramAsDefault() = 0;
/** Resets the loaded program to the block's default state. */
virtual void resetProgramToDefault() = 0;
//==============================================================================
/** Metadata for a given config item */
struct ConfigMetaData


+ 9
- 0
modules/juce_blocks_basics/topology/internal/juce_BlockImplementation.cpp View File

@@ -347,6 +347,15 @@ public:
doSaveProgramAsDefault();
}
void resetProgramToDefault() override
{
if (! shouldSaveProgramAsDefault)
setProgram (nullptr);
sendCommandMessage (BlocksProtocol::endAPIMode);
sendCommandMessage (BlocksProtocol::beginAPIMode);
}
uint32 getMemorySize() override
{
return modelData.programAndHeapSize;


Loading…
Cancel
Save