int LoadSave::compareVersionStrings(String a, String b) { a.trim(); b.trim(); if (a.isEmpty() && b.isEmpty()) return 0; String major_version_a = a.upToFirstOccurrenceOf(".", false, true); String major_version_b = b.upToFirstOccurrenceOf(".", false, true); if (!major_version_a.containsOnly("0123456789")) major_version_a = "0"; if (!major_version_b.containsOnly("0123456789")) major_version_b = "0"; int major_value_a = major_version_a.getIntValue(); int major_value_b = major_version_b.getIntValue(); if (major_value_a > major_value_b) return 1; else if (major_value_a < major_value_b) return -1; return compareVersionStrings(a.fromFirstOccurrenceOf(".", false, true), b.fromFirstOccurrenceOf(".", false, true)); }
void EdoGaduLog::actionListenerCallback (const String& message) { const String command = message.upToFirstOccurrenceOf (T(":"), false, true); const String data = message.fromFirstOccurrenceOf (T(":"), false, true); EdoGaduMessage *m = new EdoGaduMessage(); if (command == T("MSG0")) { /* incoming message from GG to us */ uin_t uin = data.upToFirstOccurrenceOf (T(":"), false, true).getIntValue(); const String message = data.fromFirstOccurrenceOf (T(":"), false, true); m->body = message; m->uin = uin; m->type = EDO_GG_MESSAGE_INCOMING; } else if (command == T("MSG1")) { /* outgoing message we are sending to GG */ uin_t uin = data.upToFirstOccurrenceOf (T(":"), false, true).getIntValue(); const String message = data.fromFirstOccurrenceOf (T(":"), false, true); m->body = message; m->uin = uin; m->type = EDO_GG_MESSAGE_OUTGOING; } if (!writeMessage (m)) { Logger::writeToLog (T("EdoGaduLog::writeMessage failed")); } deleteAndZero (m); }
const Point<int> pointFromString(const String &pointState) { Point<int> p; p.setX(pointState.upToFirstOccurrenceOf (",", false,false).trim().getIntValue()); p.setY(pointState.fromFirstOccurrenceOf (",", false,false).trim().getIntValue()); return (p); }
void JucerDocument::setParentClasses (const String& classes) { if (classes != parentClasses) { StringArray parentClassLines (getCleanedStringArray (StringArray::fromTokens (classes, ",", StringRef()))); for (int i = parentClassLines.size(); --i >= 0;) { String s (parentClassLines[i]); String type; if (s.startsWith ("public ") || s.startsWith ("protected ") || s.startsWith ("private ")) { type = s.upToFirstOccurrenceOf (" ", true, false); s = s.fromFirstOccurrenceOf (" ", false, false); if (s.trim().isEmpty()) type = s = String::empty; } s = type + CodeHelpers::makeValidIdentifier (s.trim(), false, false, true); parentClassLines.set (i, s); } parentClasses = parentClassLines.joinIntoString (", "); changed(); } }
void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected) override { if (rowIsSelected) g.fillAll (Colours::deepskyblue); if (JuceDemoTypeBase* type = JuceDemoTypeBase::getDemoTypeList() [rowNumber]) { String name (type->name.trimCharactersAtStart ("0123456789").trimStart()); AttributedString a; a.setJustification (Justification::centredLeft); String category; if (name.containsChar (':')) { category = name.upToFirstOccurrenceOf (":", true, false); name = name.fromFirstOccurrenceOf (":", false, false).trim(); if (height > 20) category << "\n"; else category << " "; } if (category.isNotEmpty()) a.append (category, Font (10.0f), Colour::greyLevel (0.5f)); a.append (name, Font (13.0f), Colours::white.withAlpha (0.9f)); a.draw (g, Rectangle<int> (width + 10, height).reduced (6, 0).toFloat()); } }
void LR_IPC_IN::processLine(const String& line) { // process input into [parameter] [Value] line.trimEnd(); String command = line.upToFirstOccurrenceOf(" ", false, false); String valueString = line.replace(line.upToFirstOccurrenceOf(" ", true, true), "", true); auto value = valueString.getIntValue(); // store updates in map parameterMap[command] = value; // send associated CC messages to MIDI OUT devices if (CommandMap::getInstance().commandHasAssociatedMessage(command)) { const MIDI_Message& msg = CommandMap::getInstance().getMessageForCommand(command); MIDISender::getInstance().sendCC(msg.channel, msg.controller, value); } }
/** this will validate playlist message for server @param[in] message message string @param[out] dragPlayListInString dragPlayListInString string @param[out] dropPlayListInString dropPlayListInString string @return bool true if playList message is valid */ bool isdragDropPlayListMessage(const String & message, String & dragPlayListInString, String & dropPlayListInString) { if(message.contains(dragDropInPlayListID)) { dragPlayListInString = message.fromFirstOccurrenceOf (messageSeparator, false, false); dragPlayListInString = dragPlayListInString.upToFirstOccurrenceOf (messageSeparator, false, false); dropPlayListInString = message.fromLastOccurrenceOf (messageSeparator, false, false); return true; } else return false; }
RSAKey::RSAKey (const String& s) { if (s.containsChar (',')) { part1.parseString (s.upToFirstOccurrenceOf (",", false, false), 16); part2.parseString (s.fromFirstOccurrenceOf (",", false, false), 16); } else { // the string needs to be two hex numbers, comma-separated.. jassertfalse; } }
/** this will validate playAfterStop message @param[in] message message string @param[in] playList PlayList as xmlElement @return bool true if playAfterStop message */ bool isDropInPlayList(const String & message, String & playList, String & insertionIndex) { String tempString; if(message.contains(dropInPlayListID)) { tempString = message.fromFirstOccurrenceOf(messageSeparator, false, false); playList = tempString.upToFirstOccurrenceOf (messageSeparator, false, false); insertionIndex = tempString.fromLastOccurrenceOf (messageSeparator, false, false); return true; } else return false; }
static void copyAcrossUserSections (String& dest, const String& src) { StringArray srcLines, dstLines; srcLines.addLines (src); dstLines.addLines (dest); for (int i = 0; i < dstLines.size(); ++i) { if (dstLines[i].trimStart().startsWith (T("//["))) { String tag (dstLines[i].trimStart().substring (3)); tag = tag.upToFirstOccurrenceOf (T("]"), false, false); jassert (! tag.startsWithChar (T('/'))); if (! tag.startsWithChar (T('/'))) { const int endLine = indexOfLineStartingWith (dstLines, T("//[/") + tag + T("]"), i + 1); if (endLine > i) { StringArray sourceLines; if (getUserSection (srcLines, tag, sourceLines)) { int j; for (j = endLine - i; --j > 0;) dstLines.remove (i + 1); for (j = 0; j < sourceLines.size(); ++j) dstLines.insert (++i, sourceLines [j].trimEnd()); ++i; } else { i = endLine; } } } } dstLines.set (i, dstLines[i].trimEnd()); } dest = dstLines.joinIntoString (T("\n")) + T("\n"); }
//============================================================================== bool URL::isProbablyAWebsiteURL (const String& possibleURL) { static const char* validProtocols[] = { "http:", "ftp:", "https:" }; for (auto* protocol : validProtocols) if (possibleURL.startsWithIgnoreCase (protocol)) return true; if (possibleURL.containsChar ('@') || possibleURL.containsChar (' ')) return false; const String topLevelDomain (possibleURL.upToFirstOccurrenceOf ("/", false, false) .fromLastOccurrenceOf (".", false, false)); return topLevelDomain.isNotEmpty() && topLevelDomain.length() <= 3; }
/** this will validate playAfterStop message @param[in] message message string @param[in] indexList No of rows that are delete from mediaArray @return bool true if playAfterStop message */ bool isDeleteInPlayList(const String & message, Array<int> & indexList) { String tempMessage = message; if(tempMessage.contains(deleteInPlayListID)) { // SOme logic needed here to convert String to Array tempMessage = tempMessage.fromFirstOccurrenceOf(messageSeparator, false, false); String index; while(tempMessage != "") { index = tempMessage.upToFirstOccurrenceOf(messageSeparator, false, false); tempMessage = tempMessage.fromFirstOccurrenceOf(messageSeparator, false, false); indexList.add(index.getIntValue()); } return true; } else return false; }
//============================================================================== int main (int argc, char* argv[]) { bool error = false; bool usage = true; const String name (argv[0]); Amalgamator amalgamator (name); bool gotCheckSystem = false; bool gotWildcards = false; bool gotTemplate = false; bool gotTarget = false; for (int i = 1; i < argc; ++i) { String option (argv[i]); String value; if (i + 1 < argc) value = String (argv[i+1]).unquoted (); if (option.compareIgnoreCase ("-i") == 0) { ++i; if (i < argc) { amalgamator.addDirectoryToSearch (value); } else { std::cout << name << ": Missing parameter for -i\n"; error = true; break; } } else if (option.compareIgnoreCase ("-f") == 0) { ++i; if (i < argc) { amalgamator.addForceReinclude (value); } else { std::cout << name << ": Missing parameter for -f\n"; error = true; break; } } else if (option.compareIgnoreCase ("-p") == 0) { ++i; if (i < argc) { amalgamator.addPreventReinclude (value); } else { std::cout << name << ": Missing parameter for -p\n"; error = true; break; } } else if (option.compareIgnoreCase ("-d") == 0) { ++i; if (i < argc) { if (value.contains ("=")) { String name = value.upToFirstOccurrenceOf ("=", false, false); String define = value.fromFirstOccurrenceOf ("=", false, false); amalgamator.addDefine (name, define); } else { std::cout << name << ": Incorrect syntax for -d\n"; } } else { std::cout << name << ": Missing parameter for -d\n"; error = true; break; } } else if (option.compareIgnoreCase ("-w") == 0) { ++i; if (i < argc) { if (!gotWildcards) { amalgamator.setWildcards (value); } else { std::cout << name << ": Duplicate option -w\n"; error = true; break; } } else { std::cout << name << ": Missing parameter for -w\n"; error = true; break; } } else if (option.compareIgnoreCase ("-s") == 0) { if (!gotCheckSystem) { amalgamator.setCheckSystemIncludes (true); gotCheckSystem = true; } else { std::cout << name << ": Duplicate option -w\n"; error = true; break; } } else if (option.compareIgnoreCase ("-v") == 0) { amalgamator.setVerbose (); } else if (option.startsWith ("-")) { std::cout << name << ": Unknown option \"" << option << "\"\n"; error = true; break; } else { if (!gotTemplate) { amalgamator.setTemplate (option); gotTemplate = true; } else if (!gotTarget) { amalgamator.setTarget (option); gotTarget = true; } else { std::cout << name << ": Too many arguments\n"; error = true; break; } } } if (gotTemplate && gotTarget) { usage = false; //amalgamator.print (); error = amalgamator.process (); } else { if (argc > 1) std::cout << name << " Too few arguments\n"; error = true; } if (error && usage) { std::cout << "\n"; std::cout << " NAME" << "\n"; std::cout << " " << "\n"; std::cout << " " << name << " - produce an amalgamation of C/C++ source files." << "\n"; std::cout << " " << "\n"; std::cout << " SYNOPSIS" << "\n"; std::cout << " " << "\n"; std::cout << " " << name << " [-s]" << "\n"; std::cout << " [-w {wildcards}]" << "\n"; std::cout << " [-f {file|macro}]..." << "\n"; std::cout << " [-p {file|macro}]..." << "\n"; std::cout << " [-d {name}={file}]..." << "\n"; std::cout << " [-i {dir}]..." << "\n"; std::cout << " {inputFile} {outputFile}" << "\n"; std::cout << " " << "\n"; std::cout << " DESCRIPTION" << "\n"; std::cout << " " << "\n"; std::cout << " Produces an amalgamation of {inputFile} by replacing #include statements with" << "\n"; std::cout << " the contents of the file they refer to. This replacement will only occur if" << "\n"; std::cout << " the file was located in the same directory, or one of the additional include" << "\n"; std::cout << " paths added with the -i option." << "\n"; std::cout << " " << "\n"; std::cout << " Files included in angle brackets (system includes) are only inlined if the" << "\n"; std::cout << " -s option is specified." << "\n"; std::cout << " " << "\n"; std::cout << " If an #include line contains a macro instead of a string literal, the list" << "\n"; std::cout << " of definitions provided through the -d option is consulted to convert the" << "\n"; std::cout << " macro into a string." << "\n"; std::cout << " " << "\n"; std::cout << " A file will only be inlined once, with subsequent #include lines for the same" << "\n"; std::cout << " file silently ignored, unless the -f option is specified for the file." << "\n"; std::cout << " " << "\n"; std::cout << " OPTIONS" << "\n"; std::cout << " " << "\n"; std::cout << " -s Process #include lines containing angle brackets (i.e." << "\n"; std::cout << " system includes). Normally these are not inlined." << "\n"; std::cout << " " << "\n"; std::cout << " -w {wildcards} Specify a comma separated list of file name patterns to" << "\n"; std::cout << " match when deciding to inline (assuming the file can be" << "\n"; std::cout << " located). The default setting is \"*.cpp;*.c;*.h;*.mm;*.m\"." << "\n"; std::cout << " " << "\n"; std::cout << " -f {file|macro} Force reinclusion of the specified file or macro on" << "\n"; std::cout << " all appearances in #include lines." << "\n"; std::cout << " " << "\n"; std::cout << " -p {file|macro} Prevent reinclusion of the specified file or macro on" << "\n"; std::cout << " subsequent appearances in #include lines." << "\n"; std::cout << " " << "\n"; std::cout << " -d {name}={file} Use {file} for macro {name} if it appears in an #include" << "\n"; std::cout << " line." << "\n"; std::cout << " " << "\n"; std::cout << " -i {dir} Additionally look in the specified directory for files when" << "\n"; std::cout << " processing #include lines." << "\n"; std::cout << " " << "\n"; std::cout << " -v Verbose output mode" << "\n"; std::cout << "\n"; } return error ? 1 : 0; }
//============================================================================== static bool parseFile (const File& rootFolder, const File& newTargetFile, OutputStream& dest, const File& file, StringArray& alreadyIncludedFiles, const StringArray& includesToIgnore, const StringArray& wildcards, bool isOuterFile, bool stripCommentBlocks) { if (! file.exists()) { std::cout << "!! ERROR - file doesn't exist!"; return false; } StringArray lines; lines.addLines (file.loadFileAsString()); if (lines.size() == 0) { std::cout << "!! ERROR - input file was empty: " << file.getFullPathName(); return false; } bool lastLineWasBlank = true; for (int i = 0; i < lines.size(); ++i) { String line (lines[i]); String trimmed (line.trimStart()); if ((! isOuterFile) && trimmed.startsWith ("//================================================================")) line = String::empty; if (trimmed.startsWithChar ('#') && trimmed.removeCharacters (" \t").startsWithIgnoreCase ("#include\"")) { const int endOfInclude = line.indexOfChar (line.indexOfChar ('\"') + 1, '\"') + 1; const String lineUpToEndOfInclude (line.substring (0, endOfInclude)); const String lineAfterInclude (line.substring (endOfInclude)); const String filename (line.fromFirstOccurrenceOf ("\"", false, false) .upToLastOccurrenceOf ("\"", false, false)); const File targetFile (file.getSiblingFile (filename)); if (targetFile.exists() && targetFile.isAChildOf (rootFolder)) { if (matchesWildcard (filename.replaceCharacter ('\\', '/'), wildcards) && ! includesToIgnore.contains (targetFile.getFileName())) { if (line.containsIgnoreCase ("FORCE_AMALGAMATOR_INCLUDE") || ! alreadyIncludedFiles.contains (targetFile.getFullPathName())) { if (! canFileBeReincluded (targetFile)) alreadyIncludedFiles.add (targetFile.getFullPathName()); dest << newLine << "/*** Start of inlined file: " << targetFile.getFileName() << " ***/" << newLine; if (! parseFile (rootFolder, newTargetFile, dest, targetFile, alreadyIncludedFiles, includesToIgnore, wildcards, false, stripCommentBlocks)) { return false; } dest << "/*** End of inlined file: " << targetFile.getFileName() << " ***/" << newLine << newLine; line = lineAfterInclude; } else { line = String::empty; } } else { line = lineUpToEndOfInclude.upToFirstOccurrenceOf ("\"", true, false) + targetFile.getRelativePathFrom (newTargetFile.getParentDirectory()) .replaceCharacter ('\\', '/') + "\"" + lineAfterInclude; } } } if ((stripCommentBlocks || i == 0) && trimmed.startsWith ("/*") && (i > 10 || ! isOuterFile)) { int originalI = i; String originalLine = line; for (;;) { int end = line.indexOf ("*/"); if (end >= 0) { line = line.substring (end + 2); // If our comment appeared just before an assertion, leave it in, as it // might be useful.. if (lines [i + 1].contains ("assert") || lines [i + 2].contains ("assert")) { i = originalI; line = originalLine; } break; } line = lines [++i]; if (i >= lines.size()) break; } line = line.trimEnd(); if (line.isEmpty()) continue; } line = line.trimEnd(); { // Turn initial spaces into tabs.. int numIntialSpaces = 0; int len = line.length(); while (numIntialSpaces < len && line [numIntialSpaces] == ' ') ++numIntialSpaces; if (numIntialSpaces > 0) { int tabSize = 4; int numTabs = numIntialSpaces / tabSize; line = String::repeatedString ("\t", numTabs) + line.substring (numTabs * tabSize); } if (! line.containsChar ('"')) { // turn large areas of spaces into tabs - this will mess up alignment a bit, but // it's only the amalgamated file, so doesn't matter... line = line.replace (" ", "\t", false); line = line.replace (" ", "\t", false); } } if (line.isNotEmpty() || ! lastLineWasBlank) dest << line << newLine; lastLineWasBlank = line.isEmpty(); } return true; }
void scanForDevices() { hasScanned = true; inputNames.clear(); inputIds.clear(); outputNames.clear(); outputIds.clear(); if (juce_libjackHandle == nullptr) { juce_libjackHandle = dlopen ("libjack.so", RTLD_LAZY); if (juce_libjackHandle == nullptr) return; } jack_status_t status; // open a dummy client if (jack_client_t* const client = juce::jack_client_open ("JuceJackDummy", JackNoStartServer, &status)) { // scan for output devices if (const char** const ports = getJackPorts (client, false)) { for (int j = 0; ports[j] != nullptr; ++j) { String clientName (ports[j]); clientName = clientName.upToFirstOccurrenceOf (":", false, false); if (clientName != (JUCE_JACK_CLIENT_NAME) && ! inputNames.contains (clientName)) { inputNames.add (clientName); inputIds.add (ports [j]); } } free (ports); } // scan for input devices if (const char** const ports = getJackPorts (client, true)) { for (int j = 0; ports[j] != nullptr; ++j) { String clientName (ports[j]); clientName = clientName.upToFirstOccurrenceOf (":", false, false); if (clientName != (JUCE_JACK_CLIENT_NAME) && ! outputNames.contains (clientName)) { outputNames.add (clientName); outputIds.add (ports [j]); } } free (ports); } juce::jack_client_close (client); } else { dumpJackErrorMessage (status); } }
//============================================================================== void scanForDevices() { hasScanned = true; inputNames.clear(); inputIds.clear(); outputNames.clear(); outputIds.clear(); if (juce_libjack_handle == 0) { juce_libjack_handle = dlopen ("libjack.so", RTLD_LAZY); if (juce_libjack_handle == 0) return; } // open a dummy client jack_status_t status; jack_client_t* client = JUCE_NAMESPACE::jack_client_open ("JuceJackDummy", JackNoStartServer, &status); if (client == 0) { dumpJackErrorMessage (status); } else { // scan for output devices const char** ports = JUCE_NAMESPACE::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsOutput); if (ports != 0) { int j = 0; while (ports[j] != 0) { String clientName (ports[j]); clientName = clientName.upToFirstOccurrenceOf (":", false, false); if (clientName != String (JUCE_JACK_CLIENT_NAME) && ! inputNames.contains (clientName)) { inputNames.add (clientName); inputIds.add (ports [j]); } ++j; } free (ports); } // scan for input devices ports = JUCE_NAMESPACE::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsInput); if (ports != 0) { int j = 0; while (ports[j] != 0) { String clientName (ports[j]); clientName = clientName.upToFirstOccurrenceOf (":", false, false); if (clientName != String (JUCE_JACK_CLIENT_NAME) && ! outputNames.contains (clientName)) { outputNames.add (clientName); outputIds.add (ports [j]); } ++j; } free (ports); } JUCE_NAMESPACE::jack_client_close (client); } }
ParsedInclude parseInclude (String const& line, String const& trimmed) { ParsedInclude parsed; if (trimmed.startsWithChar ('#')) { const String removed = trimmed.removeCharacters (" \t"); if (removed.startsWithIgnoreCase ("#include\"")) { parsed.endOfInclude = line.indexOfChar (line.indexOfChar ('\"') + 1, '\"') + 1; parsed.filename = line.fromFirstOccurrenceOf ("\"", false, false) .upToLastOccurrenceOf ("\"", false, false); parsed.isIncludeLine = true; parsed.preventReinclude = m_preventReincludes.contains (parsed.filename); parsed.forceReinclude = m_forceReincludes.contains (parsed.filename); } else if (removed.startsWithIgnoreCase ("#include<")) { if (m_checkSystemIncludes) { parsed.endOfInclude = line.indexOfChar (line.indexOfChar ('<') + 1, '>') + 1; parsed.filename = line.fromFirstOccurrenceOf ("<", false, false) .upToLastOccurrenceOf (">", false, false); parsed.isIncludeLine = true; parsed.preventReinclude = m_preventReincludes.contains (parsed.filename); parsed.forceReinclude = m_forceReincludes.contains (parsed.filename); } } else if (removed.startsWithIgnoreCase ("#include")) { String name; #if 1 if (line.contains ("/*")) name = line.fromFirstOccurrenceOf ("#include", false, false) .upToFirstOccurrenceOf ("/*", false, false).trim (); else name = line.fromFirstOccurrenceOf ("#include", false, false).trim (); parsed.endOfInclude = line.upToFirstOccurrenceOf (name, true, false).length (); #else name = line.fromFirstOccurrenceOf ("#include", false, false).trim (); #endif String value = m_macrosDefined [name]; if (m_verbose) std::cout << "name = " << name << "\n"; if (value.startsWithIgnoreCase ("\"")) { parsed.endOfInclude = line.trimEnd().length () + 1; parsed.filename = value.fromFirstOccurrenceOf ("\"", false, false) .upToLastOccurrenceOf ("\"", false, false); parsed.isIncludeLine = true; } else if (value.startsWithIgnoreCase ("<") && m_checkSystemIncludes) { parsed.endOfInclude = line.trimEnd().length () + 1; parsed.filename = value.fromFirstOccurrenceOf ("<", false, false) .upToLastOccurrenceOf (">", false, false); parsed.isIncludeLine = true; } parsed.preventReinclude = parsed.isIncludeLine && m_preventReincludes.contains (name); parsed.forceReinclude = parsed.isIncludeLine && m_forceReincludes.contains (name); } } return parsed; }
void Blender::actionListenerCallback(const String &message) { int mixer_id = 0; int channel_id = 0; int mixer_id_index = message.indexOfChar(':') + 1; int channel_id_index = message.indexOfChar('+') + 1; String idStr(String::empty); String type(message.upToFirstOccurrenceOf(":", false, false)); String valStr(message.fromLastOccurrenceOf("=", false, false)); uint32 value = valStr.getIntValue(); bool bUpdateGui = false; if (mixer_id_index >= 0) { idStr = message.substring(mixer_id_index, mixer_id_index+2); mixer_id = idStr.getIntValue(); if (channel_id_index >= 0) { idStr = message.substring(channel_id_index, channel_id_index+2); channel_id = idStr.getIntValue(); if (0 == type.compare("gain")) { int gain = jmin<int>(130, (int)value); m_bl_desc.mixer[mixer_id].channel[channel_id].gain = gain; m_bl_desc.mixer[mixer_id].channel[channel_id].gain_dbv = m_dBvMap[gain]; } else if (0 == type.compare("master_gain")) { // master gain int gain = jmin<int>(130, (int)value); m_bl_desc.mixer[mixer_id].master.gain = gain; m_bl_desc.mixer[mixer_id].master.gain_dbv = m_dBvMap[gain]; } else if (0 == type.compare("pan")) { // channel strip pan m_bl_desc.mixer[mixer_id].channel[channel_id].pan = (int)value; } else if (0 == type.compare("master_mute")) { // master out mute m_bl_desc.mixer[mixer_id].master.muting = (value != 0); } else if (0 == type.compare("mute")) { uint32 muting = (uint32)value; uint32 channel_bit = 1<<channel_id; // channel strip mute if (muting) { // mute m_bl_desc.mixer[mixer_id].mutes |= channel_bit; m_bl_desc.mixer[mixer_id].was_muted |= channel_bit; // handle solos if (0 != m_bl_desc.mixer[mixer_id].solos) { if (m_bl_desc.mixer[mixer_id].solos == channel_bit) { // a solo was active only on that channel, unsolo all and restore mutes m_bl_desc.mixer[mixer_id].solos = 0; m_bl_desc.mixer[mixer_id].mutes = m_bl_desc.mixer[mixer_id].was_muted; bUpdateGui = true; } // other solos are active, unsolo only this one if soloed else if (m_bl_desc.mixer[mixer_id].solos & channel_bit) { m_bl_desc.mixer[mixer_id].solos ^= channel_bit; m_bl_desc.mixer[mixer_id].mutes |= (m_bl_desc.mixer[mixer_id].was_muted & channel_id); bUpdateGui = true; } } } else { // unmute m_bl_desc.mixer[mixer_id].mutes ^= channel_bit; m_bl_desc.mixer[mixer_id].was_muted ^= channel_bit; // handle solos if (0 != m_bl_desc.mixer[mixer_id].solos) { // a solo was active on another channel, solo this one too m_bl_desc.mixer[mixer_id].solos |= channel_bit; bUpdateGui = true; } } } else if (0 == type.compare("solo")) { uint32 soloing = (uint32)value; uint32 channel_bit = 1<<channel_id; if (soloing) { // is this the first soloed channel? if (0 == m_bl_desc.mixer[mixer_id].solos) { // solo m_bl_desc.mixer[mixer_id].solos |= channel_bit; // mute all others m_bl_desc.mixer[mixer_id].mutes = ~channel_bit; bUpdateGui = true; } else { // solo this one also m_bl_desc.mixer[mixer_id].solos |= channel_bit; m_bl_desc.mixer[mixer_id].mutes ^= channel_bit; bUpdateGui = true; } } else { // channel was soloed // was this the only soloed channel? if (m_bl_desc.mixer[mixer_id].solos == channel_bit) { // unsolo all m_bl_desc.mixer[mixer_id].solos = 0; // restore mute states m_bl_desc.mixer[mixer_id].mutes = m_bl_desc.mixer[mixer_id].was_muted; bUpdateGui = true; } else { // other channels are soloed, so unsolo this one only m_bl_desc.mixer[mixer_id].solos ^= channel_bit; // restore mute state if (m_bl_desc.mixer[mixer_id].was_muted & channel_bit) { m_bl_desc.mixer[mixer_id].mutes |= channel_bit; } bUpdateGui = true; } } } else if (0 == type.compare("dirout")) { m_bl_desc.mixer[mixer_id].direct_out = (0 != value); setDirectOut(mixer_id); sendDirout(mixer_id, m_bl_desc.mixer[mixer_id].direct_out); String msg(String::formatted("dirout: mixer id:%d, %d", mixer_id, m_bl_desc.mixer[mixer_id].direct_out)); EventLogger::getInstance()->logMessage(msg); } else if (0 == type.compare("reset")) { for (int i=0; i<m_bl_desc.mixer[mixer_id].num_channels; i++) { m_bl_desc.mixer[mixer_id].channel[i].gain = 101; m_bl_desc.mixer[mixer_id].channel[i].gain_dbv = m_dBvMap[101]; sendChGain(mixer_id, i, 101); m_bl_desc.mixer[mixer_id].channel[i].pan = 0; sendChPan(mixer_id, i, 0); } m_bl_desc.mixer[mixer_id].mutes = 0; m_bl_desc.mixer[mixer_id].was_muted = 0; sendChMutes(mixer_id, m_bl_desc.mixer[mixer_id].mutes); m_bl_desc.mixer[mixer_id].solos = 0; sendChSolos(mixer_id, m_bl_desc.mixer[mixer_id].solos); m_bl_desc.mixer[mixer_id].master.gain = 101; m_bl_desc.mixer[mixer_id].master.gain_dbv = m_dBvMap[101]; sendMasterGain(mixer_id, 101); m_bl_desc.mixer[mixer_id].master.muting = false; sendMasterMute(mixer_id, false); m_bl_desc.mixer[mixer_id].direct_out = 0; setDirectOut(mixer_id); sendDirout(mixer_id, 0); bUpdateGui = true; } // update mixer coeff's mixer_cfg(mixer_id); } if (bUpdateGui) { sendChMutes(mixer_id, m_bl_desc.mixer[mixer_id].mutes); sendChSolos(mixer_id, m_bl_desc.mixer[mixer_id].solos); } } }