Browse Source

Blocks: Moved isControlBlock() from BlockImplementation to Block

tags/2021-05-28
Rachel Susser jules 6 years ago
parent
commit
f43e8bd61b
3 changed files with 19 additions and 10 deletions
  1. +13
    -0
      modules/juce_blocks_basics/blocks/juce_Block.cpp
  2. +6
    -0
      modules/juce_blocks_basics/blocks/juce_Block.h
  3. +0
    -10
      modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp

+ 13
- 0
modules/juce_blocks_basics/blocks/juce_Block.cpp View File

@@ -61,6 +61,19 @@ Block::Block (const juce::String& serial, const juce::String& version, const juc
Block::~Block() {}
bool Block::isControlBlock() const
{
return isControlBlock (getType());
}
constexpr bool Block::isControlBlock (Block::Type type)
{
return type == Block::Type::liveBlock
|| type == Block::Type::loopBlock
|| type == Block::Type::touchBlock
|| type == Block::Type::developerControlBlock;
}
void Block::addDataInputPortListener (DataInputPortListener* listener) { dataInputPortListeners.add (listener); }
void Block::removeDataInputPortListener (DataInputPortListener* listener) { dataInputPortListeners.remove (listener); }


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

@@ -88,6 +88,12 @@ public:
*/
virtual Type getType() const = 0;
/** Returns true if this a control block. **/
bool isControlBlock() const;
/** Returns true if Block::Type is a control block. */
constexpr static bool isControlBlock (Block::Type);
/** Returns a human-readable description of this device type. */
virtual juce::String getDeviceDescription() const = 0;


+ 0
- 10
modules/juce_blocks_basics/topology/juce_PhysicalTopologySource.cpp View File

@@ -1643,16 +1643,6 @@ struct PhysicalTopologySource::Internal
return nullptr;
}
bool isControlBlock() const
{
auto type = getType();
return type == Block::Type::liveBlock
|| type == Block::Type::loopBlock
|| type == Block::Type::touchBlock
|| type == Block::Type::developerControlBlock;
}
//==============================================================================
std::function<void(const String&)> logger;


Loading…
Cancel
Save