Example #1
0
const String CtrlrPanel::getUniqueModulatorName(const String &proposedName)
{
	if (getRestoreState())
		return (proposedName);

	uint32 marker=0;
	String basename=String::empty;
	String nameToLookFor;

	if (proposedName.fromLastOccurrenceOf("-", false, true) != String::empty)
	{
		basename		= proposedName.upToLastOccurrenceOf("-", false, true);
		marker			= proposedName.fromLastOccurrenceOf("-", false, true).getIntValue();
		nameToLookFor	= proposedName;
	}
	else
	{
		basename		= proposedName;
		marker			= ctrlrModulators.size();
		nameToLookFor	= basename + "-" + String(marker);
	}

	while (getModulator(nameToLookFor))
	{
		nameToLookFor = basename + "-" + String(++marker);
	}

	return (nameToLookFor);
}
Example #2
0
    void resultButtonClicked(const String &name) override
    {
        if(name == "Search in Finder")
        {
            String file = getTextEditor("fileNames")->getText();
            
            file.replace("\\", "/");
            
            String fileName = file.fromLastOccurrenceOf("/", false, false);
            String pathName = file.upToLastOccurrenceOf("/", true, false);
            
#if JUCE_WINDOWS
            String dialogName = "Explorer";
#else
            String dialogName = "Finder";
#endif
            
            PresetHandler::showMessageWindow("Search file", "Search for the sample:\n\n"+fileName +"\n\nPress OK to open the " + dialogName, PresetHandler::IconType::Info);
            
            FileChooser fc("Search sample location " + fileName);
            
            if(fc.browseForFileToOpen())
            {
                File f = fc.getResult();

				
                
                String newPath = f.getFullPathName().replaceCharacter('\\', '/').upToLastOccurrenceOf("/", true, false);;
                
                getTextEditor("search")->setText(pathName);
                getTextEditor("replace")->setText(newPath);
            }
        }
    };
void UnityProjectBuilder::updateBuildDirectories()
{
    if (buildDir.isEmpty())
        return;
    
    ValueTree exportsTree (project.getChildWithName (Ids::exportFormats));
    
    if (! exportsTree.isValid())
        return;
    
    const int numExports = exportsTree.getNumChildren();
    
    for (int i = 0; i < numExports; ++i)
    {
        ValueTree exporter (exportsTree.getChild (i));
        
        if (exporter.hasProperty (Ids::targetFolderProp))
        {
            logOutput ("Updating exporter " + exporter.getType().toString());
            const String oldTarget (exporter.getProperty (Ids::targetFolderProp).toString());
            String newTarget (buildDir);
            
            if (oldTarget.containsChar ('/'))
                 newTarget << oldTarget.fromLastOccurrenceOf ("/", true, false);
                
            exporter.setProperty (Ids::targetFolderProp, newTarget, nullptr);
        }
    }
}
Example #4
0
 /** 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;
 }
Example #5
0
 /** 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;
 }
Example #6
0
void LibraryModule::findWildcardMatches (const File& localModuleFolder, const String& wildcardPath, Array<File>& result) const
{
    String path (wildcardPath.upToLastOccurrenceOf ("/", false, false));
    String wildCard (wildcardPath.fromLastOccurrenceOf ("/", false, false));

    Array<File> tempList;
    FileSorter sorter;

    DirectoryIterator iter (localModuleFolder.getChildFile (path), false, wildCard);
    bool isHiddenFile;

    while (iter.next (nullptr, &isHiddenFile, nullptr, nullptr, nullptr, nullptr))
        if (! isHiddenFile)
            tempList.addSorted (sorter, iter.getFile());

    result.addArray (tempList);
}
Example #7
0
 static XmlElement getXmlFromKeyFile (String keyFileText, RSAKey rsaPublicKey)
 {
     return decryptXML (keyFileText.fromLastOccurrenceOf ("#", false, false).trim(), rsaPublicKey);
 }
Example #8
0
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);
        }
    }
}