mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-09 04:30:09 +00:00
Removed some superfluous juce:: namespaces from the juce_blocks_basics module
This commit is contained in:
parent
174934bf85
commit
464b1f8eb2
32 changed files with 221 additions and 221 deletions
|
|
@ -38,7 +38,7 @@ static Block::UID getBlockUIDFromSerialNumber (const BlocksProtocol::BlockSerial
|
|||
return getBlockUIDFromSerialNumber (serial.data);
|
||||
}
|
||||
|
||||
static Block::UID getBlockUIDFromSerialNumber (const juce::String& serial) noexcept
|
||||
static Block::UID getBlockUIDFromSerialNumber (const String& serial) noexcept
|
||||
{
|
||||
if (serial.length() < int (BlocksProtocol::BlockSerialNumber::maxLength))
|
||||
{
|
||||
|
|
@ -49,12 +49,12 @@ static Block::UID getBlockUIDFromSerialNumber (const juce::String& serial) noexc
|
|||
return getBlockUIDFromSerialNumber ((const uint8*) serial.toRawUTF8());
|
||||
}
|
||||
|
||||
Block::Block (const juce::String& serial)
|
||||
Block::Block (const String& serial)
|
||||
: serialNumber (serial), uid (getBlockUIDFromSerialNumber (serial))
|
||||
{
|
||||
}
|
||||
|
||||
Block::Block (const juce::String& serial, const juce::String& version, const juce::String& blockName)
|
||||
Block::Block (const String& serial, const String& version, const String& blockName)
|
||||
: serialNumber (serial), versionNumber (version), name (blockName), uid (getBlockUIDFromSerialNumber (serial))
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace juce
|
|||
|
||||
@tags{Blocks}
|
||||
*/
|
||||
class Block : public juce::ReferenceCountedObject
|
||||
class Block : public ReferenceCountedObject
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
|
|
@ -52,21 +52,21 @@ public:
|
|||
/** The Block class is reference-counted, so always use a Block::Ptr when
|
||||
you are keeping references to them.
|
||||
*/
|
||||
using Ptr = juce::ReferenceCountedObjectPtr<Block>;
|
||||
using Ptr = ReferenceCountedObjectPtr<Block>;
|
||||
|
||||
/** The Block class is reference-counted, so Block::Array is useful when
|
||||
you are storing lists of them.
|
||||
*/
|
||||
using Array = juce::ReferenceCountedArray<Block>;
|
||||
using Array = ReferenceCountedArray<Block>;
|
||||
|
||||
/** The Block's serial number. */
|
||||
const juce::String serialNumber;
|
||||
const String serialNumber;
|
||||
|
||||
/** The Block's version number */
|
||||
juce::String versionNumber;
|
||||
String versionNumber;
|
||||
|
||||
/** The Block's name */
|
||||
juce::String name;
|
||||
String name;
|
||||
|
||||
/** This type is used for the unique block identifier. */
|
||||
using UID = uint64;
|
||||
|
|
@ -95,7 +95,7 @@ public:
|
|||
static bool isControlBlock (Block::Type);
|
||||
|
||||
/** Returns a human-readable description of this device type. */
|
||||
virtual juce::String getDeviceDescription() const = 0;
|
||||
virtual String getDeviceDescription() const = 0;
|
||||
|
||||
/** Returns the battery level in the range 0.0 to 1.0. */
|
||||
virtual float getBatteryLevel() const = 0;
|
||||
|
|
@ -229,10 +229,10 @@ public:
|
|||
virtual ~Program();
|
||||
|
||||
/** Returns the LittleFoot program to execute on the BLOCKS device. */
|
||||
virtual juce::String getLittleFootProgram() = 0;
|
||||
virtual String getLittleFootProgram() = 0;
|
||||
|
||||
/** Returns an array of search paths to use when resolving includes. **/
|
||||
virtual juce::Array<juce::File> getSearchPaths() { return {}; }
|
||||
virtual juce::Array<File> getSearchPaths() { return {}; }
|
||||
|
||||
Block& block;
|
||||
};
|
||||
|
|
@ -242,7 +242,7 @@ public:
|
|||
The supplied Program's lifetime will be managed by this class, so do not
|
||||
use the Program in other places in your code.
|
||||
*/
|
||||
virtual juce::Result setProgram (Program*) = 0;
|
||||
virtual Result setProgram (Program*) = 0;
|
||||
|
||||
/** Returns a pointer to the currently loaded program. */
|
||||
virtual Program* getProgram() const = 0;
|
||||
|
|
@ -324,7 +324,7 @@ public:
|
|||
// Constructor to work around VS2015 bugs...
|
||||
ConfigMetaData (uint32 itemIndex,
|
||||
int32 itemValue,
|
||||
juce::Range<int32> rangeToUse,
|
||||
Range<int32> rangeToUse,
|
||||
bool active,
|
||||
const char* itemName,
|
||||
ConfigType itemType,
|
||||
|
|
@ -387,12 +387,12 @@ public:
|
|||
|
||||
uint32 item = 0;
|
||||
int32 value = 0;
|
||||
juce::Range<int32> range;
|
||||
Range<int32> range;
|
||||
bool isActive = false;
|
||||
juce::String name;
|
||||
String name;
|
||||
ConfigType type = ConfigType::integer;
|
||||
juce::String optionNames[numOptionNames] = {};
|
||||
juce::String group;
|
||||
String optionNames[numOptionNames] = {};
|
||||
String group;
|
||||
};
|
||||
|
||||
/** Returns the maximum number of config items available */
|
||||
|
|
@ -432,7 +432,7 @@ public:
|
|||
virtual void blockReset() = 0;
|
||||
|
||||
/** Set Block name */
|
||||
virtual bool setName (const juce::String& name) = 0;
|
||||
virtual bool setName (const String& name) = 0;
|
||||
|
||||
//==============================================================================
|
||||
/** Allows the user to provide a function that will receive log messages from the block. */
|
||||
|
|
@ -475,11 +475,11 @@ public:
|
|||
|
||||
protected:
|
||||
//==============================================================================
|
||||
Block (const juce::String& serialNumberToUse);
|
||||
Block (const juce::String& serial, const juce::String& version, const juce::String& name);
|
||||
Block (const String& serialNumberToUse);
|
||||
Block (const String& serial, const String& version, const String& name);
|
||||
|
||||
juce::ListenerList<DataInputPortListener> dataInputPortListeners;
|
||||
juce::ListenerList<ProgramEventListener> programEventListeners;
|
||||
ListenerList<DataInputPortListener> dataInputPortListeners;
|
||||
ListenerList<ProgramEventListener> programEventListeners;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ struct BlockConfigManager
|
|||
// Send setConfigState message to Block
|
||||
}
|
||||
|
||||
juce::String getOptionName (ConfigItemId item, uint8 optionIndex)
|
||||
String getOptionName (ConfigItemId item, uint8 optionIndex)
|
||||
{
|
||||
uint32 itemIndex;
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ bool BlocksVersion::isGreaterThan (const BlocksVersion& other) const
|
|||
|
||||
bool BlocksVersion::releaseTypeGreaterThan (const BlocksVersion& other) const
|
||||
{
|
||||
auto getReleaseTypePriority = [](const juce::BlocksVersion& version)
|
||||
auto getReleaseTypePriority = [](const BlocksVersion& version)
|
||||
{
|
||||
String releaseTypes[4] = { "alpha", "beta", "rc", {} };
|
||||
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@ public:
|
|||
int patch = 0;
|
||||
|
||||
/** The release tag for this version, such as "beta", "alpha", "rc", etc */
|
||||
juce::String releaseType;
|
||||
String releaseType;
|
||||
|
||||
/** A numberical value assosiated with the release tag, such as "beta 4" */
|
||||
int releaseCount = 0;
|
||||
|
||||
/** The assosiated git commit that generated this firmware version */
|
||||
juce::String commit;
|
||||
String commit;
|
||||
|
||||
/** Identify "forced" firmware builds **/
|
||||
bool forced = false;
|
||||
|
||||
juce::String toString (bool extended = false) const;
|
||||
String toString (bool extended = false) const;
|
||||
|
||||
/** Constructs a version number from an formatted juce::String */
|
||||
BlocksVersion (const juce::String&);
|
||||
/** Constructs a version number from an formatted String */
|
||||
BlocksVersion (const String&);
|
||||
|
||||
/** Constructs a version number from another BlocksVersion */
|
||||
BlocksVersion (const BlocksVersion& other) = default;
|
||||
|
|
@ -61,7 +61,7 @@ public:
|
|||
BlocksVersion() = default;
|
||||
|
||||
/** Returns true if string format is valid */
|
||||
static bool isValidVersion (const juce::String& versionString);
|
||||
static bool isValidVersion (const String& versionString);
|
||||
|
||||
bool operator == (const BlocksVersion&) const;
|
||||
bool operator != (const BlocksVersion&) const;
|
||||
|
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
private:
|
||||
/** @internal */
|
||||
bool evaluate (const juce::String& versionString);
|
||||
bool evaluate (const String& versionString);
|
||||
bool releaseTypeGreaterThan (const BlocksVersion& otherReleaseType) const;
|
||||
|
||||
bool isGreaterThan (const BlocksVersion& other) const;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public:
|
|||
virtual ButtonFunction getType() const = 0;
|
||||
|
||||
/** Returns the button's description. */
|
||||
virtual juce::String getName() const = 0;
|
||||
virtual String getName() const = 0;
|
||||
|
||||
/** Returns the position of this button on the device, in device units.
|
||||
For buttons that are on the side of the device, this may want to return a value that
|
||||
|
|
@ -133,7 +133,7 @@ public:
|
|||
Block& block;
|
||||
|
||||
protected:
|
||||
juce::ListenerList<Listener> listeners;
|
||||
ListenerList<Listener> listeners;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ControlButton)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** An interface to use for LEDGrid rendering. */
|
||||
struct Renderer : public juce::ReferenceCountedObject
|
||||
struct Renderer : public ReferenceCountedObject
|
||||
{
|
||||
~Renderer() override;
|
||||
virtual void renderLEDGrid (LEDGrid&) = 0;
|
||||
|
|
@ -81,7 +81,7 @@ public:
|
|||
/** The Renderer class is reference-counted, so always use a Renderer::Ptr when
|
||||
you are keeping references to them.
|
||||
*/
|
||||
using Ptr = juce::ReferenceCountedObjectPtr<Renderer>;
|
||||
using Ptr = ReferenceCountedObjectPtr<Renderer>;
|
||||
};
|
||||
|
||||
/** Set the visualiser that will create visuals for this block (nullptr for none).
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns a name to describe this light. */
|
||||
virtual juce::String getName() const = 0;
|
||||
virtual String getName() const = 0;
|
||||
|
||||
/** Changes the light's colour. */
|
||||
virtual bool setColour (LEDColour newColour) = 0;
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ private:
|
|||
return t1.index == t2.index && t1.blockUID == t2.blockUID;
|
||||
}
|
||||
|
||||
juce::Array<TouchEntry> touches;
|
||||
Array<TouchEntry> touches;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TouchList)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public:
|
|||
|
||||
protected:
|
||||
//==============================================================================
|
||||
juce::ListenerList<Listener> listeners;
|
||||
ListenerList<Listener> listeners;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TouchSurface)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ private:
|
|||
return;
|
||||
}
|
||||
|
||||
juce::File fileToInclude = resolveIncludePath (currentValue.toString());
|
||||
File fileToInclude = resolveIncludePath (currentValue.toString());
|
||||
|
||||
if (fileToInclude == File())
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ private:
|
|||
|
||||
double proportionOK = ((int) blockSize - differences) / (double) blockSize;
|
||||
|
||||
juce::ignoreUnused (proportionOK);
|
||||
ignoreUnused (proportionOK);
|
||||
|
||||
DBG ("Heap: " << areas << " " << String (roundToInt (100 * proportionOK)) << "% "
|
||||
<< (isProgramLoaded() ? "Ready" : "Loading"));
|
||||
|
|
|
|||
|
|
@ -173,10 +173,10 @@ struct NativeFunction
|
|||
|
||||
jassert (slash > 0); // The slash can't be the first character in this string!
|
||||
jassert (nameAndArgTypes[slash + 1] != 0); // The slash must be followed by a return type character
|
||||
jassert (juce::String (nameAndArgTypes).substring (0, slash).containsOnly ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"));
|
||||
jassert (! juce::String ("0123456789").containsChar (nameAndArgTypes[0]));
|
||||
jassert (juce::String (nameAndArgTypes).substring (slash + 1).containsOnly ("vifb"));
|
||||
jassert (juce::String (nameAndArgTypes).substring (slash + 2).containsOnly ("ifb")); // arguments must only be of these types
|
||||
jassert (String (nameAndArgTypes).substring (0, slash).containsOnly ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"));
|
||||
jassert (! String ("0123456789").containsChar (nameAndArgTypes[0]));
|
||||
jassert (String (nameAndArgTypes).substring (slash + 1).containsOnly ("vifb"));
|
||||
jassert (String (nameAndArgTypes).substring (slash + 2).containsOnly ("ifb")); // arguments must only be of these types
|
||||
|
||||
uint32 hash = 0, i = 0;
|
||||
|
||||
|
|
@ -307,29 +307,29 @@ struct Program
|
|||
#if JUCE_DEBUG
|
||||
//==============================================================================
|
||||
/** Prints the assembly code for a given function. */
|
||||
void dumpFunctionDisassembly (juce::OutputStream& out, uint32 functionIndex) const
|
||||
void dumpFunctionDisassembly (OutputStream& out, uint32 functionIndex) const
|
||||
{
|
||||
out << juce::newLine << "Function #" << (int) functionIndex
|
||||
<< " (" << juce::String::toHexString (getFunctionID (functionIndex)) << ")" << juce::newLine;
|
||||
out << newLine << "Function #" << (int) functionIndex
|
||||
<< " (" << String::toHexString (getFunctionID (functionIndex)) << ")" << newLine;
|
||||
|
||||
if (auto codeStart = getFunctionStartAddress (functionIndex))
|
||||
if (auto codeEnd = getFunctionEndAddress (functionIndex))
|
||||
for (auto prog = codeStart; prog < codeEnd;)
|
||||
out << getOpDisassembly (prog) << juce::newLine;
|
||||
out << getOpDisassembly (prog) << newLine;
|
||||
}
|
||||
|
||||
juce::String getOpDisassembly (const uint8*& prog) const
|
||||
String getOpDisassembly (const uint8*& prog) const
|
||||
{
|
||||
juce::String s;
|
||||
s << juce::String::toHexString ((int) (prog - programStart)).paddedLeft ('0', 4) << ": ";
|
||||
String s;
|
||||
s << String::toHexString ((int) (prog - programStart)).paddedLeft ('0', 4) << ": ";
|
||||
auto op = (OpCode) *prog++;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
#define LITTLEFOOT_OP(name) case OpCode::name: s << #name; break;
|
||||
#define LITTLEFOOT_OP_INT8(name) case OpCode::name: s << #name << " " << juce::String::toHexString ((int) *prog++).paddedLeft ('0', 2); break;
|
||||
#define LITTLEFOOT_OP_INT16(name) case OpCode::name: s << #name << " " << juce::String::toHexString ((int) readInt16 (prog)).paddedLeft ('0', 4); prog += 2; break;
|
||||
#define LITTLEFOOT_OP_INT32(name) case OpCode::name: s << #name << " " << juce::String::toHexString ((int) readInt32 (prog)).paddedLeft ('0', 8); prog += 4; break;
|
||||
#define LITTLEFOOT_OP_INT8(name) case OpCode::name: s << #name << " " << String::toHexString ((int) *prog++).paddedLeft ('0', 2); break;
|
||||
#define LITTLEFOOT_OP_INT16(name) case OpCode::name: s << #name << " " << String::toHexString ((int) readInt16 (prog)).paddedLeft ('0', 4); prog += 2; break;
|
||||
#define LITTLEFOOT_OP_INT32(name) case OpCode::name: s << #name << " " << String::toHexString ((int) readInt32 (prog)).paddedLeft ('0', 8); prog += 4; break;
|
||||
LITTLEFOOT_OPCODES (LITTLEFOOT_OP, LITTLEFOOT_OP_INT8, LITTLEFOOT_OP_INT16, LITTLEFOOT_OP_INT32)
|
||||
#undef LITTLEFOOT_OP
|
||||
#undef LITTLEFOOT_OP_INT8
|
||||
|
|
@ -343,7 +343,7 @@ struct Program
|
|||
}
|
||||
|
||||
/** Calls dumpFunctionDisassembly() for all functions. */
|
||||
void dumpAllFunctions (juce::OutputStream& out) const
|
||||
void dumpAllFunctions (OutputStream& out) const
|
||||
{
|
||||
if (programStart != nullptr)
|
||||
{
|
||||
|
|
@ -813,13 +813,13 @@ struct Runner
|
|||
void dumpDebugTrace() const
|
||||
{
|
||||
#if LITTLEFOOT_DEBUG_TRACE // Dumps the program counter and stack, for debugging
|
||||
juce::MemoryOutputStream dump;
|
||||
MemoryOutputStream dump;
|
||||
auto progCopy = programCounter;
|
||||
dump << juce::String (runner->program.getOpDisassembly (progCopy)).paddedRight (' ', 26)
|
||||
<< juce::String::toHexString (tos) << ' ';
|
||||
dump << String (runner->program.getOpDisassembly (progCopy)).paddedRight (' ', 26)
|
||||
<< String::toHexString (tos) << ' ';
|
||||
|
||||
for (auto s = stack; s < stackEnd; ++s)
|
||||
dump << juce::String::toHexString (*s) << ' ';
|
||||
dump << String::toHexString (*s) << ' ';
|
||||
|
||||
DBG (dump.toString());
|
||||
#endif
|
||||
|
|
@ -859,7 +859,7 @@ private:
|
|||
globals[i] = 0; // clear globals
|
||||
|
||||
#if LITTLEFOOT_DUMP_PROGRAM
|
||||
juce::MemoryOutputStream m;
|
||||
MemoryOutputStream m;
|
||||
program.dumpAllFunctions (m);
|
||||
DBG (m.toString());
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -70,14 +70,14 @@ struct BlockDataSheet
|
|||
|
||||
struct StatusLEDInfo
|
||||
{
|
||||
juce::String name;
|
||||
String name;
|
||||
float x, y;
|
||||
};
|
||||
|
||||
juce::Array<ButtonInfo> buttons;
|
||||
juce::Array<StatusLEDInfo> statusLEDs;
|
||||
juce::Array<Block::ConnectionPort> ports;
|
||||
juce::Array<const char*> dials;
|
||||
Array<ButtonInfo> buttons;
|
||||
Array<StatusLEDInfo> statusLEDs;
|
||||
Array<Block::ConnectionPort> ports;
|
||||
Array<const char*> dials;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -141,9 +141,9 @@ struct BlockStringData
|
|||
return length > 0;
|
||||
}
|
||||
|
||||
juce::String asString() const
|
||||
String asString() const
|
||||
{
|
||||
return juce::String ((const char*) data, length);
|
||||
return String ((const char*) data, length);
|
||||
}
|
||||
|
||||
bool operator== (const BlockStringData& other) const
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ struct HostPacketBuilder
|
|||
return true;
|
||||
}
|
||||
|
||||
bool addSetBlockName (const juce::String& name)
|
||||
bool addSetBlockName (const String& name)
|
||||
{
|
||||
if (name.length() > 32 || ! data.hasCapacity (MessageType::bits + 7 + (7 * name.length())))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -42,17 +42,17 @@ namespace
|
|||
{
|
||||
bytesPerSec = (int) (byteCount / elapsedSec);
|
||||
byteCount = 0;
|
||||
juce::Logger::writeToLog (getString());
|
||||
Logger::writeToLog (getString());
|
||||
}
|
||||
}
|
||||
|
||||
juce::String getString() const
|
||||
String getString() const
|
||||
{
|
||||
return juce::String (name) + ": "
|
||||
+ "count=" + juce::String (messageCount).paddedRight (' ', 7)
|
||||
+ "rate=" + (juce::String (bytesPerSec / 1024.0f, 1) + " Kb/sec").paddedRight (' ', 11)
|
||||
+ "largest=" + (juce::String (largestMessageBytes) + " bytes").paddedRight (' ', 11)
|
||||
+ "last=" + (juce::String (lastMessageBytes) + " bytes").paddedRight (' ', 11);
|
||||
return String (name) + ": "
|
||||
+ "count=" + String (messageCount).paddedRight (' ', 7)
|
||||
+ "rate=" + (String (bytesPerSec / 1024.0f, 1) + " Kb/sec").paddedRight (' ', 11)
|
||||
+ "largest=" + (String (largestMessageBytes) + " bytes").paddedRight (' ', 11)
|
||||
+ "last=" + (String (lastMessageBytes) + " bytes").paddedRight (' ', 11);
|
||||
}
|
||||
|
||||
void registerMessage (int numBytes) noexcept
|
||||
|
|
@ -60,7 +60,7 @@ namespace
|
|||
byteCount += numBytes;
|
||||
++messageCount;
|
||||
lastMessageBytes = numBytes;
|
||||
largestMessageBytes = juce::jmax (largestMessageBytes, numBytes);
|
||||
largestMessageBytes = jmax (largestMessageBytes, numBytes);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ namespace
|
|||
|
||||
static inline void resetOnSecondBoundary()
|
||||
{
|
||||
auto now = juce::Time::getMillisecondCounter();
|
||||
auto now = Time::getMillisecondCounter();
|
||||
double elapsedSec = (now - startTime) / 1000.0;
|
||||
|
||||
if (elapsedSec >= 1.0)
|
||||
|
|
@ -93,7 +93,7 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
juce::String getMidiIOStats()
|
||||
String getMidiIOStats()
|
||||
{
|
||||
return inputStats.getString() + " " + outputStats.getString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,14 +122,14 @@ public:
|
|||
}
|
||||
|
||||
Type getType() const override { return modelData.apiType; }
|
||||
juce::String getDeviceDescription() const override { return modelData.description; }
|
||||
String getDeviceDescription() const override { return modelData.description; }
|
||||
int getWidth() const override { return modelData.widthUnits; }
|
||||
int getHeight() const override { return modelData.heightUnits; }
|
||||
float getMillimetersPerUnit() const override { return 47.0f; }
|
||||
bool isHardwareBlock() const override { return true; }
|
||||
juce::Array<Block::ConnectionPort> getPorts() const override { return modelData.ports; }
|
||||
bool isConnected() const override { return detector && detector->isConnected (uid); }
|
||||
juce::Time getConnectionTime() const override { return connectionTime; }
|
||||
Time getConnectionTime() const override { return connectionTime; }
|
||||
bool isMasterBlock() const override { return isMaster; }
|
||||
Block::UID getConnectedMasterUID() const override { return masterUID; }
|
||||
int getRotation() const override { return rotation; }
|
||||
|
|
@ -192,7 +192,7 @@ public:
|
|||
{
|
||||
if (detector != nullptr)
|
||||
{
|
||||
lastMessageSendTime = juce::Time::getCurrentTime();
|
||||
lastMessageSendTime = Time::getCurrentTime();
|
||||
return detector->sendMessageToDevice (uid, builder);
|
||||
}
|
||||
|
||||
|
|
@ -241,12 +241,12 @@ public:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
juce::Result setProgram (Program* newProgram) override
|
||||
Result setProgram (Program* newProgram) override
|
||||
{
|
||||
if (newProgram != nullptr && program.get() == newProgram)
|
||||
{
|
||||
jassertfalse;
|
||||
return juce::Result::ok();
|
||||
return Result::ok();
|
||||
}
|
||||
|
||||
stopTimer();
|
||||
|
|
@ -257,7 +257,7 @@ public:
|
|||
if (program != nullptr
|
||||
&& newProgram != nullptr
|
||||
&& program->getLittleFootProgram() == newProgram->getLittleFootProgram())
|
||||
return juce::Result::ok();
|
||||
return Result::ok();
|
||||
|
||||
std::swap (program, p);
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ public:
|
|||
if (program == nullptr)
|
||||
{
|
||||
remoteHeap.clear();
|
||||
return juce::Result::ok();
|
||||
return Result::ok();
|
||||
}
|
||||
|
||||
littlefoot::Compiler compiler;
|
||||
|
|
@ -303,10 +303,10 @@ public:
|
|||
|
||||
startTimer (20);
|
||||
|
||||
return juce::Result::ok();
|
||||
return Result::ok();
|
||||
}
|
||||
|
||||
Program* getProgram() const override { return program.get(); }
|
||||
Program* getProgram() const override { return program.get(); }
|
||||
|
||||
void sendProgramEvent (const ProgramEventMessage& message) override
|
||||
{
|
||||
|
|
@ -419,7 +419,7 @@ public:
|
|||
|
||||
void pingFromDevice()
|
||||
{
|
||||
lastMessageReceiveTime = juce::Time::getCurrentTime();
|
||||
lastMessageReceiveTime = Time::getCurrentTime();
|
||||
}
|
||||
|
||||
void addDataInputPortListener (DataInputPortListener* listener) override
|
||||
|
|
@ -444,7 +444,7 @@ public:
|
|||
|
||||
remoteHeap.sendChanges (*this, false);
|
||||
|
||||
if (lastMessageSendTime < juce::Time::getCurrentTime() - juce::RelativeTime::milliseconds (pingIntervalMs))
|
||||
if (lastMessageSendTime < Time::getCurrentTime() - RelativeTime::milliseconds (pingIntervalMs))
|
||||
sendCommandMessage (BlocksProtocol::ping);
|
||||
}
|
||||
|
||||
|
|
@ -518,7 +518,7 @@ public:
|
|||
programLoadedCallback = std::move (programLoaded);
|
||||
}
|
||||
|
||||
bool setName (const juce::String& newName) override
|
||||
bool setName (const String& newName) override
|
||||
{
|
||||
return buildAndSendPacket<128> ([&newName] (BlocksProtocol::HostPacketBuilder<128>& p)
|
||||
{ return p.addSetBlockName (newName); });
|
||||
|
|
@ -547,10 +547,10 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
std::unique_ptr<TouchSurface> touchSurface;
|
||||
juce::OwnedArray<ControlButton> controlButtons;
|
||||
OwnedArray<ControlButton> controlButtons;
|
||||
std::unique_ptr<LEDGridImplementation> ledGrid;
|
||||
std::unique_ptr<LEDRowImplementation> ledRow;
|
||||
juce::OwnedArray<StatusLight> statusLights;
|
||||
OwnedArray<StatusLight> statusLights;
|
||||
|
||||
BlocksProtocol::BlockDataSheet modelData;
|
||||
|
||||
|
|
@ -568,7 +568,7 @@ public:
|
|||
RemoteHeapType remoteHeap;
|
||||
|
||||
WeakReference<Detector> detector;
|
||||
juce::Time lastMessageSendTime, lastMessageReceiveTime;
|
||||
Time lastMessageSendTime, lastMessageReceiveTime;
|
||||
|
||||
BlockConfigManager config;
|
||||
std::function<void(Block&, const ConfigMetaData&, uint32)> configChangedCallback;
|
||||
|
|
@ -605,7 +605,7 @@ private:
|
|||
config.setDeviceComms (listenerToMidiConnection);
|
||||
}
|
||||
|
||||
const juce::MidiInput* getMidiInput() const
|
||||
const MidiInput* getMidiInput() const
|
||||
{
|
||||
if (detector != nullptr)
|
||||
if (auto c = dynamic_cast<const MIDIDeviceConnection*> (detector->getDeviceConnectionFor (*this)))
|
||||
|
|
@ -615,12 +615,12 @@ private:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
juce::MidiInput* getMidiInput()
|
||||
MidiInput* getMidiInput()
|
||||
{
|
||||
return const_cast<juce::MidiInput*> (static_cast<const BlockImplementation&>(*this).getMidiInput());
|
||||
return const_cast<MidiInput*> (static_cast<const BlockImplementation&>(*this).getMidiInput());
|
||||
}
|
||||
|
||||
const juce::MidiOutput* getMidiOutput() const
|
||||
const MidiOutput* getMidiOutput() const
|
||||
{
|
||||
if (detector != nullptr)
|
||||
if (auto c = dynamic_cast<const MIDIDeviceConnection*> (detector->getDeviceConnectionFor (*this)))
|
||||
|
|
@ -630,12 +630,12 @@ private:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
juce::MidiOutput* getMidiOutput()
|
||||
MidiOutput* getMidiOutput()
|
||||
{
|
||||
return const_cast<juce::MidiOutput*> (static_cast<const BlockImplementation&>(*this).getMidiOutput());
|
||||
return const_cast<MidiOutput*> (static_cast<const BlockImplementation&>(*this).getMidiOutput());
|
||||
}
|
||||
|
||||
void handleIncomingMidiMessage (const juce::MidiMessage& message) override
|
||||
void handleIncomingMidiMessage (const MidiMessage& message) override
|
||||
{
|
||||
dataInputPortListeners.call ([&] (DataInputPortListener& l) { l.handleIncomingDataPortMessage (*this, message.getRawData(),
|
||||
(size_t) message.getRawDataSize()); });
|
||||
|
|
@ -644,7 +644,7 @@ private:
|
|||
void connectionBeingDeleted (const MIDIDeviceConnection& c) override
|
||||
{
|
||||
jassert (listenerToMidiConnection == &c);
|
||||
juce::ignoreUnused (c);
|
||||
ignoreUnused (c);
|
||||
listenerToMidiConnection->removeListener (this);
|
||||
listenerToMidiConnection = nullptr;
|
||||
config.setDeviceComms (nullptr);
|
||||
|
|
@ -679,7 +679,7 @@ private:
|
|||
public:
|
||||
//==============================================================================
|
||||
struct TouchSurfaceImplementation : public TouchSurface,
|
||||
private juce::Timer
|
||||
private Timer
|
||||
{
|
||||
TouchSurfaceImplementation (BlockImplementation& b) : TouchSurface (b), blockImpl (b)
|
||||
{
|
||||
|
|
@ -712,7 +712,7 @@ public:
|
|||
|
||||
// Fake a touch end if we receive a duplicate touch-start with no preceding touch-end (ie: comms error)
|
||||
if (touchEvent.isTouchStart && status.isActive)
|
||||
killTouch (touchEvent, status, juce::Time::getMillisecondCounter());
|
||||
killTouch (touchEvent, status, Time::getMillisecondCounter());
|
||||
|
||||
// Fake a touch start if we receive an unexpected event with no matching start event. (ie: comms error)
|
||||
if (! touchEvent.isTouchStart && ! status.isActive)
|
||||
|
|
@ -729,7 +729,7 @@ public:
|
|||
}
|
||||
|
||||
// Normal handling:
|
||||
status.lastEventTime = juce::Time::getMillisecondCounter();
|
||||
status.lastEventTime = Time::getMillisecondCounter();
|
||||
status.isActive = ! touchEvent.isTouchEnd;
|
||||
|
||||
if (touchEvent.isTouchStart)
|
||||
|
|
@ -746,7 +746,7 @@ public:
|
|||
for (auto& t : touches)
|
||||
{
|
||||
auto& status = t.value;
|
||||
auto now = juce::Time::getMillisecondCounter();
|
||||
auto now = Time::getMillisecondCounter();
|
||||
|
||||
if (status.isActive && now > status.lastEventTime + touchTimeOutMs)
|
||||
killTouch (t.touch, status, now);
|
||||
|
|
@ -781,7 +781,7 @@ public:
|
|||
|
||||
void cancelAllActiveTouches() noexcept override
|
||||
{
|
||||
const auto now = juce::Time::getMillisecondCounter();
|
||||
const auto now = Time::getMillisecondCounter();
|
||||
|
||||
for (auto& t : touches)
|
||||
if (t.value.isActive)
|
||||
|
|
@ -808,12 +808,12 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
ButtonFunction getType() const override { return buttonInfo.type; }
|
||||
juce::String getName() const override { return BlocksProtocol::getButtonNameForFunction (buttonInfo.type); }
|
||||
float getPositionX() const override { return buttonInfo.x; }
|
||||
float getPositionY() const override { return buttonInfo.y; }
|
||||
ButtonFunction getType() const override { return buttonInfo.type; }
|
||||
String getName() const override { return BlocksProtocol::getButtonNameForFunction (buttonInfo.type); }
|
||||
float getPositionX() const override { return buttonInfo.x; }
|
||||
float getPositionY() const override { return buttonInfo.y; }
|
||||
|
||||
bool hasLight() const override { return blockImpl.isControlBlock(); }
|
||||
bool hasLight() const override { return blockImpl.isControlBlock(); }
|
||||
|
||||
bool setLightColour (LEDColour colour) override
|
||||
{
|
||||
|
|
@ -865,12 +865,12 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
juce::String getName() const override { return info.name; }
|
||||
String getName() const override { return info.name; }
|
||||
|
||||
bool setColour (LEDColour newColour) override
|
||||
{
|
||||
// XXX TODO!
|
||||
juce::ignoreUnused (newColour);
|
||||
ignoreUnused (newColour);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -979,7 +979,7 @@ public:
|
|||
{
|
||||
DefaultLEDGridProgram (Block& b) : Block::Program (b) {}
|
||||
|
||||
juce::String getLittleFootProgram() override
|
||||
String getLittleFootProgram() override
|
||||
{
|
||||
/* Data format:
|
||||
|
||||
|
|
|
|||
|
|
@ -32,18 +32,18 @@ namespace
|
|||
}
|
||||
|
||||
template <typename Detector>
|
||||
struct ConnectedDeviceGroup : private juce::AsyncUpdater,
|
||||
private juce::Timer
|
||||
struct ConnectedDeviceGroup : private AsyncUpdater,
|
||||
private Timer
|
||||
{
|
||||
//==============================================================================
|
||||
ConnectedDeviceGroup (Detector& d, const juce::String& name, PhysicalTopologySource::DeviceConnection* connection)
|
||||
ConnectedDeviceGroup (Detector& d, const String& name, PhysicalTopologySource::DeviceConnection* connection)
|
||||
: detector (d), deviceName (name), deviceConnection (connection)
|
||||
{
|
||||
if (auto midiDeviceConnection = static_cast<MIDIDeviceConnection*> (deviceConnection.get()))
|
||||
{
|
||||
depreciatedVersionReader = std::make_unique<DepreciatedVersionReader> (*midiDeviceConnection);
|
||||
|
||||
juce::ScopedLock lock (midiDeviceConnection->criticalSecton);
|
||||
ScopedLock lock (midiDeviceConnection->criticalSecton);
|
||||
setMidiMessageCallback();
|
||||
}
|
||||
else
|
||||
|
|
@ -61,7 +61,7 @@ struct ConnectedDeviceGroup : private juce::AsyncUpdater,
|
|||
detector.handleDeviceRemoved (device);
|
||||
}
|
||||
|
||||
bool isStillConnected (const juce::StringArray& detectedDevices) const noexcept
|
||||
bool isStillConnected (const StringArray& detectedDevices) const noexcept
|
||||
{
|
||||
return detectedDevices.contains (deviceName) && ! failedToGetTopology();
|
||||
}
|
||||
|
|
@ -104,7 +104,7 @@ struct ConnectedDeviceGroup : private juce::AsyncUpdater,
|
|||
|
||||
void endTopology()
|
||||
{
|
||||
lastTopologyReceiveTime = juce::Time::getCurrentTime();
|
||||
lastTopologyReceiveTime = Time::getCurrentTime();
|
||||
|
||||
if (incomingTopologyDevices.isEmpty()
|
||||
|| incomingTopologyConnections.size() < incomingTopologyDevices.size() - 1)
|
||||
|
|
@ -268,9 +268,9 @@ struct ConnectedDeviceGroup : private juce::AsyncUpdater,
|
|||
return deviceConnection.get();
|
||||
}
|
||||
|
||||
juce::Array<BlockDeviceConnection> getCurrentDeviceConnections()
|
||||
Array<BlockDeviceConnection> getCurrentDeviceConnections()
|
||||
{
|
||||
juce::Array<BlockDeviceConnection> connections;
|
||||
Array<BlockDeviceConnection> connections;
|
||||
|
||||
for (const auto& connection : currentDeviceConnections)
|
||||
if (isApiConnected (getDeviceIDFromIndex (connection.device1)) && isApiConnected (getDeviceIDFromIndex (connection.device2)))
|
||||
|
|
@ -280,20 +280,20 @@ struct ConnectedDeviceGroup : private juce::AsyncUpdater,
|
|||
}
|
||||
|
||||
Detector& detector;
|
||||
juce::String deviceName;
|
||||
String deviceName;
|
||||
|
||||
static constexpr double pingTimeoutSeconds = 6.0;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
juce::Array<DeviceInfo> currentDeviceInfo;
|
||||
juce::Array<BlocksProtocol::DeviceStatus> incomingTopologyDevices;
|
||||
juce::Array<BlocksProtocol::DeviceConnection> incomingTopologyConnections, currentDeviceConnections;
|
||||
Array<DeviceInfo> currentDeviceInfo;
|
||||
Array<BlocksProtocol::DeviceStatus> incomingTopologyDevices;
|
||||
Array<BlocksProtocol::DeviceConnection> incomingTopologyConnections, currentDeviceConnections;
|
||||
|
||||
std::unique_ptr<PhysicalTopologySource::DeviceConnection> deviceConnection;
|
||||
|
||||
juce::CriticalSection incomingPacketLock;
|
||||
juce::Array<juce::MemoryBlock> incomingPackets;
|
||||
CriticalSection incomingPacketLock;
|
||||
Array<MemoryBlock> incomingPackets;
|
||||
|
||||
std::unique_ptr<DepreciatedVersionReader> depreciatedVersionReader;
|
||||
|
||||
|
|
@ -305,10 +305,10 @@ private:
|
|||
//==============================================================================
|
||||
void timerCallback() override
|
||||
{
|
||||
const auto now = juce::Time::getCurrentTime();
|
||||
const auto now = Time::getCurrentTime();
|
||||
|
||||
if ((now > lastTopologyReceiveTime + juce::RelativeTime::seconds (30.0))
|
||||
&& now > lastTopologyRequestTime + juce::RelativeTime::seconds (1.0)
|
||||
if ((now > lastTopologyReceiveTime + RelativeTime::seconds (30.0))
|
||||
&& now > lastTopologyRequestTime + RelativeTime::seconds (1.0)
|
||||
&& numTopologyRequestsSent < 4)
|
||||
sendTopologyRequest();
|
||||
|
||||
|
|
@ -328,10 +328,10 @@ private:
|
|||
|
||||
void handleIncomingMessage (const void* data, size_t dataSize)
|
||||
{
|
||||
juce::MemoryBlock mb (data, dataSize);
|
||||
MemoryBlock mb (data, dataSize);
|
||||
|
||||
{
|
||||
const juce::ScopedLock sl (incomingPacketLock);
|
||||
const ScopedLock sl (incomingPacketLock);
|
||||
incomingPackets.add (std::move (mb));
|
||||
}
|
||||
|
||||
|
|
@ -344,11 +344,11 @@ private:
|
|||
|
||||
void handleAsyncUpdate() override
|
||||
{
|
||||
juce::Array<juce::MemoryBlock> packets;
|
||||
Array<MemoryBlock> packets;
|
||||
packets.ensureStorageAllocated (32);
|
||||
|
||||
{
|
||||
const juce::ScopedLock sl (incomingPacketLock);
|
||||
const ScopedLock sl (incomingPacketLock);
|
||||
incomingPackets.swapWith (packets);
|
||||
}
|
||||
|
||||
|
|
@ -371,27 +371,27 @@ private:
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
juce::Time lastTopologyRequestTime, lastTopologyReceiveTime;
|
||||
Time lastTopologyRequestTime, lastTopologyReceiveTime;
|
||||
int numTopologyRequestsSent = 0;
|
||||
|
||||
void scheduleNewTopologyRequest()
|
||||
{
|
||||
LOG_CONNECTIVITY ("Topology Request Scheduled");
|
||||
numTopologyRequestsSent = 0;
|
||||
lastTopologyReceiveTime = juce::Time();
|
||||
lastTopologyRequestTime = juce::Time::getCurrentTime();
|
||||
lastTopologyReceiveTime = Time();
|
||||
lastTopologyRequestTime = Time::getCurrentTime();
|
||||
}
|
||||
|
||||
void sendTopologyRequest()
|
||||
{
|
||||
++numTopologyRequestsSent;
|
||||
lastTopologyRequestTime = juce::Time::getCurrentTime();
|
||||
lastTopologyRequestTime = Time::getCurrentTime();
|
||||
sendCommandMessage (0, BlocksProtocol::requestTopologyMessage);
|
||||
}
|
||||
|
||||
bool failedToGetTopology() const noexcept
|
||||
{
|
||||
return numTopologyRequestsSent >= 4 && lastTopologyReceiveTime == juce::Time();
|
||||
return numTopologyRequestsSent >= 4 && lastTopologyReceiveTime == Time();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -435,11 +435,11 @@ private:
|
|||
struct BlockPingTime
|
||||
{
|
||||
Block::UID blockUID;
|
||||
juce::Time lastPing;
|
||||
juce::Time connected;
|
||||
Time lastPing;
|
||||
Time connected;
|
||||
};
|
||||
|
||||
juce::Array<BlockPingTime> blockPings;
|
||||
Array<BlockPingTime> blockPings;
|
||||
|
||||
BlockPingTime* getPing (Block::UID uid)
|
||||
{
|
||||
|
|
@ -468,7 +468,7 @@ private:
|
|||
|
||||
void updateApiPing (Block::UID uid)
|
||||
{
|
||||
const auto now = juce::Time::getCurrentTime();
|
||||
const auto now = Time::getCurrentTime();
|
||||
|
||||
if (auto* ping = getPing (uid))
|
||||
{
|
||||
|
|
@ -503,13 +503,13 @@ private:
|
|||
scheduleNewTopologyRequest();
|
||||
}
|
||||
|
||||
void checkApiTimeouts (juce::Time now)
|
||||
void checkApiTimeouts (Time now)
|
||||
{
|
||||
Array<Block::UID> toRemove;
|
||||
|
||||
for (const auto& ping : blockPings)
|
||||
{
|
||||
if (ping.lastPing < now - juce::RelativeTime::seconds (pingTimeoutSeconds))
|
||||
if (ping.lastPing < now - RelativeTime::seconds (pingTimeoutSeconds))
|
||||
{
|
||||
LOG_CONNECTIVITY ("Ping timeout: " << ping.blockUID);
|
||||
toRemove.add (ping.blockUID);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ private:
|
|||
static constexpr size_t numFirmwareApps = 3;
|
||||
BlocksProtocol::VersionNumber result[numFirmwareApps];
|
||||
MIDIDeviceConnection& deviceConnection;
|
||||
juce::Atomic<size_t> currentRequest = 0;
|
||||
Atomic<size_t> currentRequest = 0;
|
||||
|
||||
//==============================================================================
|
||||
bool allRequestsComplete() const { return currentRequest.get() >= numFirmwareApps; }
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ namespace juce
|
|||
|
||||
//==============================================================================
|
||||
/** This is the main singleton object that keeps track of connected blocks */
|
||||
struct Detector : public juce::ReferenceCountedObject,
|
||||
private juce::Timer,
|
||||
private juce::AsyncUpdater
|
||||
struct Detector : public ReferenceCountedObject,
|
||||
private Timer,
|
||||
private AsyncUpdater
|
||||
{
|
||||
using BlockImpl = BlockImplementation<Detector>;
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ struct Detector : public juce::ReferenceCountedObject,
|
|||
jassert (activeTopologySources.isEmpty());
|
||||
}
|
||||
|
||||
using Ptr = juce::ReferenceCountedObjectPtr<Detector>;
|
||||
using Ptr = ReferenceCountedObjectPtr<Detector>;
|
||||
|
||||
static Detector::Ptr getDefaultDetector()
|
||||
{
|
||||
|
|
@ -370,7 +370,7 @@ struct Detector : public juce::ReferenceCountedObject,
|
|||
std::unique_ptr<MIDIDeviceDetector> defaultDetector;
|
||||
PhysicalTopologySource::DeviceDetector& deviceDetector;
|
||||
|
||||
juce::Array<PhysicalTopologySource*> activeTopologySources;
|
||||
Array<PhysicalTopologySource*> activeTopologySources;
|
||||
|
||||
BlockTopology currentTopology;
|
||||
|
||||
|
|
@ -387,7 +387,7 @@ private:
|
|||
handleDevicesAdded (detectedDevices);
|
||||
}
|
||||
|
||||
bool containsBlockWithUID (const juce::Block::Array& blocks, juce::Block::UID uid)
|
||||
bool containsBlockWithUID (const Block::Array& blocks, Block::UID uid)
|
||||
{
|
||||
for (const auto block : blocks)
|
||||
if (block->uid == uid)
|
||||
|
|
@ -396,14 +396,14 @@ private:
|
|||
return false;
|
||||
}
|
||||
|
||||
void handleDevicesRemoved (const juce::StringArray& detectedDevices)
|
||||
void handleDevicesRemoved (const StringArray& detectedDevices)
|
||||
{
|
||||
for (int i = connectedDeviceGroups.size(); --i >= 0;)
|
||||
if (! connectedDeviceGroups.getUnchecked(i)->isStillConnected (detectedDevices))
|
||||
connectedDeviceGroups.remove (i);
|
||||
}
|
||||
|
||||
void handleDevicesAdded (const juce::StringArray& detectedDevices)
|
||||
void handleDevicesAdded (const StringArray& detectedDevices)
|
||||
{
|
||||
for (const auto& devName : detectedDevices)
|
||||
{
|
||||
|
|
@ -417,7 +417,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
bool hasDeviceFor (const juce::String& devName) const
|
||||
bool hasDeviceFor (const String& devName) const
|
||||
{
|
||||
for (auto d : connectedDeviceGroups)
|
||||
if (d->deviceName == devName)
|
||||
|
|
@ -434,7 +434,7 @@ private:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
juce::OwnedArray<ConnectedDeviceGroup<Detector>> connectedDeviceGroups;
|
||||
OwnedArray<ConnectedDeviceGroup<Detector>> connectedDeviceGroups;
|
||||
|
||||
//==============================================================================
|
||||
/** This is a friend of the BlocksImplementation that will scan and set the
|
||||
|
|
@ -447,7 +447,7 @@ private:
|
|||
static Block::Array updateBlocks (const BlockTopology& topology)
|
||||
{
|
||||
Block::Array updated;
|
||||
juce::Array<Block::UID> visited;
|
||||
Array<Block::UID> visited;
|
||||
|
||||
for (auto& block : topology.blocks)
|
||||
{
|
||||
|
|
@ -513,7 +513,7 @@ private:
|
|||
|
||||
static void layoutNeighbours (const Block::Ptr block,
|
||||
const BlockTopology& topology,
|
||||
juce::Array<Block::UID>& visited,
|
||||
Array<Block::UID>& visited,
|
||||
Block::Array& updated)
|
||||
{
|
||||
visited.add (block->uid);
|
||||
|
|
@ -588,7 +588,7 @@ private:
|
|||
|
||||
//==============================================================================
|
||||
#if DUMP_TOPOLOGY
|
||||
static juce::String idToSerialNum (const BlockTopology& topology, Block::UID uid)
|
||||
static String idToSerialNum (const BlockTopology& topology, Block::UID uid)
|
||||
{
|
||||
for (auto* b : topology.blocks)
|
||||
if (b->uid == uid)
|
||||
|
|
@ -597,7 +597,7 @@ private:
|
|||
return "???";
|
||||
}
|
||||
|
||||
static juce::String portEdgeToString (Block::ConnectionPort port)
|
||||
static String portEdgeToString (Block::ConnectionPort port)
|
||||
{
|
||||
switch (port.edge)
|
||||
{
|
||||
|
|
@ -610,9 +610,9 @@ private:
|
|||
return {};
|
||||
}
|
||||
|
||||
static juce::String portToString (Block::ConnectionPort port)
|
||||
static String portToString (Block::ConnectionPort port)
|
||||
{
|
||||
return portEdgeToString (port) + "_" + juce::String (port.index);
|
||||
return portEdgeToString (port) + "_" + String (port.index);
|
||||
}
|
||||
|
||||
static void dumpTopology (const BlockTopology& topology)
|
||||
|
|
@ -635,8 +635,8 @@ private:
|
|||
if (auto bi = BlockImplementation<Detector>::getFrom (*block))
|
||||
m << " Short address: " << (int) bi->getDeviceIndex() << newLine;
|
||||
|
||||
m << " Battery level: " + juce::String (juce::roundToInt (100.0f * block->getBatteryLevel())) + "%" << newLine
|
||||
<< " Battery charging: " + juce::String (block->isBatteryCharging() ? "y" : "n") << newLine
|
||||
m << " Battery level: " + String (roundToInt (100.0f * block->getBatteryLevel())) + "%" << newLine
|
||||
<< " Battery charging: " + String (block->isBatteryCharging() ? "y" : "n") << newLine
|
||||
<< " Width: " << block->getWidth() << newLine
|
||||
<< " Height: " << block->getHeight() << newLine
|
||||
<< " Millimeters per unit: " << block->getMillimetersPerUnit() << newLine
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
namespace juce
|
||||
{
|
||||
|
||||
struct PhysicalTopologySource::DetectorHolder : private juce::Timer
|
||||
struct PhysicalTopologySource::DetectorHolder : private Timer
|
||||
{
|
||||
DetectorHolder (PhysicalTopologySource& pts)
|
||||
: topologySource (pts),
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ struct MIDIDeviceDetector : public PhysicalTopologySource::DeviceDetector
|
|||
{
|
||||
MIDIDeviceDetector() {}
|
||||
|
||||
juce::StringArray scanForDevices() override
|
||||
StringArray scanForDevices() override
|
||||
{
|
||||
juce::StringArray result;
|
||||
StringArray result;
|
||||
|
||||
for (auto& pair : findDevices())
|
||||
result.add (pair.inputName + " & " + pair.outputName);
|
||||
|
|
@ -49,8 +49,8 @@ struct MIDIDeviceDetector : public PhysicalTopologySource::DeviceDetector
|
|||
{
|
||||
lockedFromOutside = false;
|
||||
|
||||
dev->midiInput.reset (juce::MidiInput::openDevice (pair.inputIndex, dev.get()));
|
||||
dev->midiOutput.reset (juce::MidiOutput::openDevice (pair.outputIndex));
|
||||
dev->midiInput.reset (MidiInput::openDevice (pair.inputIndex, dev.get()));
|
||||
dev->midiOutput.reset (MidiOutput::openDevice (pair.outputIndex));
|
||||
|
||||
if (dev->midiInput != nullptr)
|
||||
{
|
||||
|
|
@ -72,12 +72,12 @@ struct MIDIDeviceDetector : public PhysicalTopologySource::DeviceDetector
|
|||
return lockedFromOutside && ! findDevices().isEmpty();
|
||||
}
|
||||
|
||||
static bool isBlocksMidiDeviceName (const juce::String& name)
|
||||
static bool isBlocksMidiDeviceName (const String& name)
|
||||
{
|
||||
return name.indexOf (" BLOCK") > 0 || name.indexOf (" Block") > 0;
|
||||
}
|
||||
|
||||
static String cleanBlocksDeviceName (juce::String name)
|
||||
static String cleanBlocksDeviceName (String name)
|
||||
{
|
||||
name = name.trim();
|
||||
|
||||
|
|
@ -96,16 +96,16 @@ struct MIDIDeviceDetector : public PhysicalTopologySource::DeviceDetector
|
|||
|
||||
struct MidiInputOutputPair
|
||||
{
|
||||
juce::String outputName, inputName;
|
||||
String outputName, inputName;
|
||||
int outputIndex = -1, inputIndex = -1;
|
||||
};
|
||||
|
||||
static juce::Array<MidiInputOutputPair> findDevices()
|
||||
static Array<MidiInputOutputPair> findDevices()
|
||||
{
|
||||
juce::Array<MidiInputOutputPair> result;
|
||||
Array<MidiInputOutputPair> result;
|
||||
|
||||
auto midiInputs = juce::MidiInput::getDevices();
|
||||
auto midiOutputs = juce::MidiOutput::getDevices();
|
||||
auto midiInputs = MidiInput::getDevices();
|
||||
auto midiOutputs = MidiOutput::getDevices();
|
||||
|
||||
for (int j = 0; j < midiInputs.size(); ++j)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace juce
|
|||
{
|
||||
|
||||
struct MIDIDeviceConnection : public PhysicalTopologySource::DeviceConnection,
|
||||
public juce::MidiInputCallback
|
||||
public MidiInputCallback
|
||||
{
|
||||
MIDIDeviceConnection() {}
|
||||
|
||||
|
|
@ -43,9 +43,9 @@ struct MIDIDeviceConnection : public PhysicalTopologySource::DeviceConnection,
|
|||
|
||||
bool lockAgainstOtherProcesses (const String& midiInName, const String& midiOutName)
|
||||
{
|
||||
interprocessLock.reset (new juce::InterProcessLock ("blocks_sdk_"
|
||||
+ File::createLegalFileName (midiInName)
|
||||
+ "_" + File::createLegalFileName (midiOutName)));
|
||||
interprocessLock.reset (new InterProcessLock ("blocks_sdk_"
|
||||
+ File::createLegalFileName (midiInName)
|
||||
+ "_" + File::createLegalFileName (midiOutName)));
|
||||
if (interprocessLock->enter (500))
|
||||
return true;
|
||||
|
||||
|
|
@ -57,19 +57,19 @@ struct MIDIDeviceConnection : public PhysicalTopologySource::DeviceConnection,
|
|||
{
|
||||
virtual ~Listener() {}
|
||||
|
||||
virtual void handleIncomingMidiMessage (const juce::MidiMessage& message) = 0;
|
||||
virtual void handleIncomingMidiMessage (const MidiMessage& message) = 0;
|
||||
virtual void connectionBeingDeleted (const MIDIDeviceConnection&) = 0;
|
||||
};
|
||||
|
||||
void addListener (Listener* l)
|
||||
{
|
||||
juce::ScopedLock scopedLock (criticalSecton);
|
||||
ScopedLock scopedLock (criticalSecton);
|
||||
listeners.add (l);
|
||||
}
|
||||
|
||||
void removeListener (Listener* l)
|
||||
{
|
||||
juce::ScopedLock scopedLock (criticalSecton);
|
||||
ScopedLock scopedLock (criticalSecton);
|
||||
listeners.remove (l);
|
||||
}
|
||||
|
||||
|
|
@ -83,16 +83,16 @@ struct MIDIDeviceConnection : public PhysicalTopologySource::DeviceConnection,
|
|||
|
||||
if (midiOutput != nullptr)
|
||||
{
|
||||
midiOutput->sendMessageNow (juce::MidiMessage (data, (int) dataSize));
|
||||
midiOutput->sendMessageNow (MidiMessage (data, (int) dataSize));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void handleIncomingMidiMessage (juce::MidiInput*, const juce::MidiMessage& message) override
|
||||
void handleIncomingMidiMessage (MidiInput*, const MidiMessage& message) override
|
||||
{
|
||||
juce::ScopedTryLock lock (criticalSecton);
|
||||
ScopedTryLock lock (criticalSecton);
|
||||
|
||||
if (lock.isLocked())
|
||||
{
|
||||
|
|
@ -108,14 +108,14 @@ struct MIDIDeviceConnection : public PhysicalTopologySource::DeviceConnection,
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<juce::MidiInput> midiInput;
|
||||
std::unique_ptr<juce::MidiOutput> midiOutput;
|
||||
std::unique_ptr<MidiInput> midiInput;
|
||||
std::unique_ptr<MidiOutput> midiOutput;
|
||||
|
||||
juce::CriticalSection criticalSecton;
|
||||
CriticalSection criticalSecton;
|
||||
|
||||
private:
|
||||
juce::ListenerList<Listener> listeners;
|
||||
std::unique_ptr<juce::InterProcessLock> interprocessLock;
|
||||
ListenerList<Listener> listeners;
|
||||
std::unique_ptr<InterProcessLock> interprocessLock;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MIDIDeviceConnection)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public:
|
|||
DeviceDetector();
|
||||
virtual ~DeviceDetector();
|
||||
|
||||
virtual juce::StringArray scanForDevices() = 0;
|
||||
virtual StringArray scanForDevices() = 0;
|
||||
virtual DeviceConnection* openDevice (int index) = 0;
|
||||
virtual bool isLockedFromOutside() const { return false; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace juce
|
|||
{
|
||||
|
||||
struct RuleBasedTopologySource::Internal : public TopologySource::Listener,
|
||||
private juce::AsyncUpdater
|
||||
private AsyncUpdater
|
||||
{
|
||||
Internal (RuleBasedTopologySource& da, TopologySource& bd) : owner (da), detector (bd)
|
||||
{
|
||||
|
|
@ -93,7 +93,7 @@ struct RuleBasedTopologySource::Internal : public TopologySource::Listener,
|
|||
TopologySource& detector;
|
||||
|
||||
BlockTopology topology;
|
||||
juce::OwnedArray<Rule> rules;
|
||||
OwnedArray<Rule> rules;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Internal)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ struct BlockDeviceConnection
|
|||
struct BlockTopology
|
||||
{
|
||||
Block::Array blocks;
|
||||
juce::Array<BlockDeviceConnection> connections;
|
||||
Array<BlockDeviceConnection> connections;
|
||||
|
||||
bool operator== (const BlockTopology&) const noexcept;
|
||||
bool operator!= (const BlockTopology&) const noexcept;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
protected:
|
||||
//==========================================================================
|
||||
juce::ListenerList<Listener> listeners;
|
||||
ListenerList<Listener> listeners;
|
||||
};
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void BitmapLEDProgram::setLED (uint32 x, uint32 y, LEDColour colour)
|
|||
}
|
||||
}
|
||||
|
||||
juce::String BitmapLEDProgram::getLittleFootProgram()
|
||||
String BitmapLEDProgram::getLittleFootProgram()
|
||||
{
|
||||
String program (R"littlefoot(
|
||||
|
||||
|
|
@ -77,8 +77,8 @@ juce::String BitmapLEDProgram::getLittleFootProgram()
|
|||
)littlefoot");
|
||||
|
||||
if (auto ledGrid = block.getLEDGrid())
|
||||
return program.replace ("NUM_COLUMNS", juce::String (ledGrid->getNumColumns()))
|
||||
.replace ("NUM_ROWS", juce::String (ledGrid->getNumRows()));
|
||||
return program.replace ("NUM_COLUMNS", String (ledGrid->getNumColumns()))
|
||||
.replace ("NUM_ROWS", String (ledGrid->getNumRows()));
|
||||
|
||||
jassertfalse;
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ struct BitmapLEDProgram : public Block::Program
|
|||
void setLED (uint32 x, uint32 y, LEDColour);
|
||||
|
||||
private:
|
||||
juce::String getLittleFootProgram() override;
|
||||
String getLittleFootProgram() override;
|
||||
};
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ DrumPadGridProgram::DrumPadGridProgram (Block& b) : Program (b) {}
|
|||
|
||||
int DrumPadGridProgram::getPadIndex (float posX, float posY) const
|
||||
{
|
||||
posX = juce::jmin (0.99f, posX / block.getWidth());
|
||||
posY = juce::jmin (0.99f, posY / block.getHeight());
|
||||
posX = jmin (0.99f, posX / block.getWidth());
|
||||
posY = jmin (0.99f, posY / block.getHeight());
|
||||
|
||||
const uint32 offset = block.getDataByte (visiblePads_byte) ? numColumns1_byte : numColumns0_byte;
|
||||
const int numColumns = block.getDataByte (offset + numColumns0_byte);
|
||||
|
|
@ -65,9 +65,9 @@ void DrumPadGridProgram::sendTouch (float x, float y, float z, LEDColour colour)
|
|||
Block::ProgramEventMessage e;
|
||||
|
||||
e.values[0] = 0x20000000
|
||||
+ (juce::jlimit (0, 255, juce::roundToInt (x * (255.0f / block.getWidth()))) << 16)
|
||||
+ (juce::jlimit (0, 255, juce::roundToInt (y * (255.0f / block.getHeight()))) << 8)
|
||||
+ juce::jlimit (0, 255, juce::roundToInt (z * 255.0f));
|
||||
+ (jlimit (0, 255, roundToInt (x * (255.0f / block.getWidth()))) << 16)
|
||||
+ (jlimit (0, 255, roundToInt (y * (255.0f / block.getHeight()))) << 8)
|
||||
+ jlimit (0, 255, roundToInt (z * 255.0f));
|
||||
|
||||
e.values[1] = (int32) colour.getARGB();
|
||||
|
||||
|
|
@ -75,14 +75,14 @@ void DrumPadGridProgram::sendTouch (float x, float y, float z, LEDColour colour)
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
void DrumPadGridProgram::setGridFills (int numColumns, int numRows, const juce::Array<GridFill>& fills)
|
||||
void DrumPadGridProgram::setGridFills (int numColumns, int numRows, const Array<GridFill>& fills)
|
||||
{
|
||||
uint8 visiblePads = block.getDataByte (visiblePads_byte);
|
||||
|
||||
setGridFills (numColumns, numRows, fills, visiblePads * numColumns1_byte);
|
||||
}
|
||||
|
||||
void DrumPadGridProgram::setGridFills (int numColumns, int numRows, const juce::Array<GridFill>& fills, uint32 byteOffset)
|
||||
void DrumPadGridProgram::setGridFills (int numColumns, int numRows, const Array<GridFill>& fills, uint32 byteOffset)
|
||||
{
|
||||
jassert (numColumns * numRows == fills.size());
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ void DrumPadGridProgram::setGridFills (int numColumns, int numRows, const juce::
|
|||
}
|
||||
|
||||
void DrumPadGridProgram::triggerSlideTransition (int newNumColumns, int newNumRows,
|
||||
const juce::Array<GridFill>& newFills, SlideDirection direction)
|
||||
const Array<GridFill>& newFills, SlideDirection direction)
|
||||
{
|
||||
uint8 newVisible = block.getDataByte (visiblePads_byte) ? 0 : 1;
|
||||
|
||||
|
|
@ -132,8 +132,8 @@ void DrumPadGridProgram::setPadAnimationState (uint32 padIdx, double loopTimeSec
|
|||
// Compensate for bluetooth latency & led resolution, tweaked by eye for POS app.
|
||||
currentProgress = std::fmod (currentProgress + 0.1, 1.0);
|
||||
|
||||
uint16 aniValue = uint16 (juce::roundToInt ((255 << 8) * currentProgress));
|
||||
uint16 aniIncrement = loopTimeSecs > 0.0 ? uint16 (juce::roundToInt (((255 << 8) / 25.0) / loopTimeSecs)) : 0;
|
||||
uint16 aniValue = uint16 (roundToInt ((255 << 8) * currentProgress));
|
||||
uint16 aniIncrement = loopTimeSecs > 0.0 ? uint16 (roundToInt (((255 << 8) / 25.0) / loopTimeSecs)) : 0;
|
||||
|
||||
uint32 offset = 8 * animationTimers_byte + 32 * padIdx;
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ void DrumPadGridProgram::resumeAnimations()
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
juce::String DrumPadGridProgram::getLittleFootProgram()
|
||||
String DrumPadGridProgram::getLittleFootProgram()
|
||||
{
|
||||
if (block.versionNumber.isEmpty() || block.versionNumber.compare ("0.2.5") < 0)
|
||||
return getLittleFootProgramPre25();
|
||||
|
|
@ -168,7 +168,7 @@ juce::String DrumPadGridProgram::getLittleFootProgram()
|
|||
return getLittleFootProgramPost25();
|
||||
}
|
||||
|
||||
juce::String DrumPadGridProgram::getLittleFootProgramPre25() const
|
||||
String DrumPadGridProgram::getLittleFootProgramPre25() const
|
||||
{
|
||||
// Uses its own heatmap, not the one provided in newer firmware
|
||||
// Also can't use blocks config, introduced in 2.5.
|
||||
|
|
@ -553,7 +553,7 @@ juce::String DrumPadGridProgram::getLittleFootProgramPre25() const
|
|||
)littlefoot";
|
||||
}
|
||||
|
||||
juce::String DrumPadGridProgram::getLittleFootProgramPost25() const
|
||||
String DrumPadGridProgram::getLittleFootProgramPost25() const
|
||||
{
|
||||
// Uses heatmap provided in firmware (so the program's smaller)
|
||||
// Initialises config items introduced in firmware 2.5
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ struct DrumPadGridProgram : public Block::Program
|
|||
};
|
||||
|
||||
void setGridFills (int numColumns, int numRows,
|
||||
const juce::Array<GridFill>&);
|
||||
const Array<GridFill>&);
|
||||
|
||||
/** Set up a new pad layout, with a slide animation from the old to the new. */
|
||||
enum SlideDirection : uint8
|
||||
|
|
@ -89,7 +89,7 @@ struct DrumPadGridProgram : public Block::Program
|
|||
};
|
||||
|
||||
void triggerSlideTransition (int newNumColumns, int newNumRows,
|
||||
const juce::Array<GridFill>& newFills, SlideDirection);
|
||||
const Array<GridFill>& newFills, SlideDirection);
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
@ -116,11 +116,11 @@ private:
|
|||
static constexpr uint32 colourSizeBytes = 2;
|
||||
|
||||
int getPadIndex (float posX, float posY) const;
|
||||
void setGridFills (int numColumns, int numRows, const juce::Array<GridFill>& fills, uint32 byteOffset);
|
||||
void setGridFills (int numColumns, int numRows, const Array<GridFill>& fills, uint32 byteOffset);
|
||||
|
||||
juce::String getLittleFootProgram() override;
|
||||
juce::String getLittleFootProgramPre25() const;
|
||||
juce::String getLittleFootProgramPost25() const;
|
||||
String getLittleFootProgram() override;
|
||||
String getLittleFootProgramPre25() const;
|
||||
String getLittleFootProgramPost25() const;
|
||||
};
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue