virtual String getText(float inValue, int maxStringLength) const override { jassert(maxStringLength >= 0); std::stringstream numberFormatter; numberFormatter.precision(getDisplayPrecision()); numberFormatter << std::fixed << inValue; String result = numberFormatter.str(); result.append( " "+getLabel(), 20); String dbText = (String(getValueInDecibels()) + " " + String(unitLabel)); // DBGM("In DecibelParameter::getText() with text: " + dbText); return dbText; }
static const String nameToSymbol(const String& name, const uint32_t portIndex) { String symbol, trimmedName = name.trim().toLowerCase(); if (trimmedName.isEmpty()) { symbol += "lv2_port_"; symbol += String(portIndex+1); } else { for (int i=0; i < trimmedName.length(); ++i) { const juce_wchar c = trimmedName[i]; if (i == 0 && std::isdigit(c)) symbol += "_"; else if (std::isalpha(c) || std::isdigit(c)) symbol += c; else symbol += "_"; } } // Do not allow identical symbols if (gUsedSymbols.contains(symbol)) { int offset = 2; String offsetStr = "_2"; symbol += offsetStr; while (gUsedSymbols.contains(symbol)) { offset += 1; String newOffsetStr = "_" + String(offset); symbol = symbol.replace(offsetStr, newOffsetStr); offsetStr = newOffsetStr; } } gUsedSymbols.add(symbol); return symbol; }