void HoaToolsAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    char name[256];
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));

    if (xmlState != nullptr)
    {
        if (xmlState->hasTagName("HoaToolsSettings"))
        {
            setNumberOfSources(xmlState->getIntAttribute("NumberOfSources"));

            for (int i = 0; i < getNumberOfSources(); i++)
            {
                sprintf(name, "Abscissa%i", i);
                m_sources->sourceSetAbscissa(i, xmlState->getDoubleAttribute(name));
                sprintf(name, "Ordinate%i", i);
                m_sources->sourceSetOrdinate(i, xmlState->getDoubleAttribute(name));
            }
        }
    }

    AudioProcessorEditor* Editor = NULL;
    Editor = getActiveEditor();
    if(Editor)
    {
        Editor->repaint();
    }
}
Beispiel #2
0
void Mcfx_convolverAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.
    
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
    
    if (xmlState != nullptr)
    {
        String newPresetDir;
        
        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("MYPLUGINSETTINGS"))
        {
            // ok, now pull out our parameters..
            activePreset  = xmlState->getStringAttribute("activePreset", "");
            
            newPresetDir = xmlState->getStringAttribute("presetDir", presetDir.getFullPathName());
            
            _ConvBufferSize = xmlState->getIntAttribute("ConvBufferSize", _ConvBufferSize);
        }
        
        if (activePreset.isNotEmpty()) {
            LoadPresetByName(activePreset);
        }
        
        File tempDir(newPresetDir);
        if (tempDir.exists()) {
            presetDir = tempDir;
            SearchPresets(presetDir);
        }
    }
}
Beispiel #3
0
//==============================================================================
Drawable* Drawable::createFromImageData (const void* data, const size_t numBytes)
{
    Drawable* result = 0;

    Image image (ImageFileFormat::loadFrom (data, (int) numBytes));

    if (image.isValid())
    {
        DrawableImage* const di = new DrawableImage();
        di->setImage (image);
        result = di;
    }
    else
    {
        const String asString (String::createStringFromData (data, (int) numBytes));

        XmlDocument doc (asString);
        ScopedPointer <XmlElement> outer (doc.getDocumentElement (true));

        if (outer != 0 && outer->hasTagName ("svg"))
        {
            ScopedPointer <XmlElement> svg (doc.getDocumentElement());

            if (svg != 0)
                result = Drawable::createFromSVG (*svg);
        }
    }

    return result;
}
void TheFunctionAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.

	timeSinceChunkCalled = Time::getMillisecondCounter();
	 ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));

    if (xmlState != 0)
    {
        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("MYPLUGINSETTINGS"))
        {
            // ok, now pull out our parameters..
           // gain  = xmlState->getIntAttribute ("gain", gain);
            //lastUIHeight = xmlState->getIntAttribute ("uiHeight", lastUIHeight);

            gain  = (float) xmlState->getDoubleAttribute ("gain", gain);

			gainL  = (float) xmlState->getDoubleAttribute ("gainL", gainL);
			gainR  = (float) xmlState->getDoubleAttribute ("gainR", gainR);

			panL  = (float) xmlState->getDoubleAttribute ("panL", panL);
			panR  = (float) xmlState->getDoubleAttribute ("panR", panR);

			phaseL  = (float) xmlState->getDoubleAttribute ("phaseL", phaseL);
			phaseR  = (float) xmlState->getDoubleAttribute ("phaseR", phaseR);

           // delay = (float) xmlState->getDoubleAttribute ("delay", delay);
        }
    }
}
Beispiel #5
0
void Ambix_converterAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.
    
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
    
    if (xmlState != nullptr)
    {
        
        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("MYPLUGINSETTINGS"))
        {
            // ok, now pull out our parameters..
            
            box_presets_text = xmlState->getStringAttribute("box_presets", "");
            setParameterNotifyingHost(FlipCsParam, (float) xmlState->getDoubleAttribute("flip_cs_phase"));
            setParameterNotifyingHost(FlipParam, (float) xmlState->getDoubleAttribute("flip_param"));
            setParameterNotifyingHost(FlopParam, (float) xmlState->getDoubleAttribute("flop_param"));
            setParameterNotifyingHost(FlapParam, (float) xmlState->getDoubleAttribute("flap_param"));
            setParameterNotifyingHost(InSeqParam, (float) xmlState->getDoubleAttribute("in_seq_param"));
            setParameterNotifyingHost(OutSeqParam, (float) xmlState->getDoubleAttribute("out_seq_param"));
            setParameterNotifyingHost(InNormParam, (float) xmlState->getDoubleAttribute("in_norm_param"));
            setParameterNotifyingHost(OutNormParam, (float) xmlState->getDoubleAttribute("out_norm_param"));
            setParameterNotifyingHost(In2DParam, (float) xmlState->getDoubleAttribute("in_2d_param"));
            setParameterNotifyingHost(Out2DParam, (float) xmlState->getDoubleAttribute("out_2d_param"));
        }
        
        
    }
    
    // reset arrays...
    //setNormalizationScheme();
    //setChannelSequence();
}
Beispiel #6
0
void StocSynthAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));

    if (xmlState != nullptr)
    {
        if (xmlState->hasTagName ("STOCSETTINGS"))
        {
            toneAmp = (float) xmlState->getDoubleAttribute("toneAmp", toneAmp);
            a135 = (float) xmlState->getDoubleAttribute("a135", a135);
            a246 = (float) xmlState->getDoubleAttribute("a246", a246);
            a789 = (float) xmlState->getDoubleAttribute("a789", a789);
            sub = (float) xmlState->getDoubleAttribute("sub", sub);
            var135 = (float) xmlState->getDoubleAttribute("var135", var135);
            var246 = (float) xmlState->getDoubleAttribute("var246", var246);
            var789 = (float) xmlState->getDoubleAttribute("var789", var789);
            pitch135 = (float) xmlState->getDoubleAttribute("pitch135", pitch135);
            pitch246 = (float) xmlState->getDoubleAttribute("pitch246", pitch246);
            pitch789 = (float) xmlState->getDoubleAttribute("pitch789", pitch789);
            cutoff = (float) xmlState->getDoubleAttribute("cutoff", cutoff);
            res = (float) xmlState->getDoubleAttribute("res", res);
            ampA = (float) xmlState->getDoubleAttribute("ampA", ampA);
            ampD = (float) xmlState->getDoubleAttribute("ampD", ampD);
            ampS = (float) xmlState->getDoubleAttribute("ampS", ampS);
            ampR = (float) xmlState->getDoubleAttribute("ampR", ampR);
            gain  = (float) xmlState->getDoubleAttribute ("gain", gain);
        }
    }
}
Beispiel #7
0
void RingmodAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.

    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
    
    if (xmlState != nullptr)
    {

        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("ringmodsettnigs"))
        {
            // ok, now pull out our parameters..
            setParameterNotifyingHost(MasterBypass,(float) xmlState->getDoubleAttribute ("Bypass", UserParams[MasterBypass]));
            setParameterNotifyingHost(Frequency,(float) xmlState->getDoubleAttribute ("Frequency", UserParams[Frequency]));
            setParameterNotifyingHost(ModSetting,(float)xmlState->getDoubleAttribute("ModSetting",UserParams[ModSetting]));
            setParameterNotifyingHost(Drive, (float)xmlState->getDoubleAttribute("Drive",UserParams[Drive]));
            setParameterNotifyingHost(LFOAmount, (float)xmlState->getDoubleAttribute("LFOAmount",UserParams[LFOAmount]));
            setParameterNotifyingHost(LFORate, (float)xmlState->getDoubleAttribute("LFORate",UserParams[LFORate]));
            setParameterNotifyingHost(LFOWaveType, (float)xmlState->getDoubleAttribute("LFOWaveType",UserParams[LFOWaveType]));
        }
    }

}
void Pfm2AudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.

    // This getXmlFromBinary() helper function retrieves our XML from the binary blob..
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));

    if (xmlState != nullptr)
    {
        String name = xmlState->getStringAttribute("presetName");
        for (int k=0; k<13; k++) {
            presetName[k] = 0;
        }
        for (int k=0; k<13 && name.toRawUTF8()[k] != 0; k++) {
            presetName[k] = name.toRawUTF8()[k];
        }
        if (pfm2Editor) {
            pfm2Editor->setPresetName(presetName);
        }
        printf(">>> PresetName : %s\n", presetName);
        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("PreenFM2AppStatus")) {
            
            for (int k=0; k<NUMBER_OF_PROGRAM; k++) {
                if (xmlState->getStringAttribute("Preset" + String(k)) != String::empty){
                    programName[k] = xmlState->getStringAttribute("Preset" + String(k));
                }
            }
            
            double value;
            for (int p=0; p< parameterSet.size(); p++) {
                if (p == nrpmIndex[2047]) continue;

                if (xmlState->getStringAttribute(teragon::Parameter::makeSafeName(parameterSet[p]->getName()).c_str()) != String::empty) {
                    value  = (float) xmlState->getDoubleAttribute (teragon::Parameter::makeSafeName(parameterSet[p]->getName()).c_str(), value);
                    parameterSet.setScaled(p, value, this);
                } else {
                    printf("Cannot set %d : %s\n", p, parameterSet[p]->getName().c_str());
                }
            }
            parameterSet.processRealtimeEvents();
			// If no UI we must set current
			currentMidiChannel = parameterSet[nrpmIndex[2045]]->getValue();
			
            // REDRAW UI
            for (int p=0; p< parameterSet.size(); p++) {
                const MidifiedFloatParameter* midifiedFP = dynamic_cast<const MidifiedFloatParameter*>(parameterSet[p]);
                if (midifiedFP != nullptr) {
					parametersToUpdateMutex.lock();
                    parametersToUpdate.insert(midifiedFP->getName().c_str());
					parametersToUpdateMutex.unlock();
                }
            }

            // Flush NRPN
            flushAllParametrsToNrpn();
        }
    }
}
void SignalProcessorAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
        
    // Restore the parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.
    // This getXmlFromBinary() helper function retrieves our XML from the binary blob..
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
    
    if (xmlState != nullptr)
    {
        // make sure that it's actually our type of XML object
        if (xmlState->hasTagName ("MYPLUGINSETTINGS"))
        {
            // now pull out our parameters..
            averagingBufferSize     = xmlState->getIntAttribute  ("averagingBufferSize", averagingBufferSize);
            fftAveragingWindow      = (float) xmlState->getDoubleAttribute ("fftAveragingWindow", fftAveragingWindow);
            inputSensitivity        = (float) xmlState->getDoubleAttribute ("inputSensitivity", inputSensitivity);
            sendTimeInfo            = xmlState->getBoolAttribute ("sendTimeInfo", sendTimeInfo);
            sendSignalLevel         = xmlState->getBoolAttribute ("sendSignalLevel", sendSignalLevel);
            sendImpulse             = xmlState->getBoolAttribute ("sendImpulse", sendImpulse);
            sendFFT                 = xmlState->getBoolAttribute ("sendFFT", sendFFT);
            channel                 = xmlState->getIntAttribute  ("channel", channel);
            monoStereo              = xmlState->getBoolAttribute ("monoStereo", monoStereo);
            logarithmicFFT          = xmlState->getBoolAttribute ("logarithmicFFT", logarithmicFFT);
            averageEnergyBufferSize = xmlState->getIntAttribute  ("averageEnergyBufferSize", averageEnergyBufferSize);
            sendOSC                 = xmlState->getBoolAttribute ("sendOSC", sendOSC);
            sendBinaryUDP           = xmlState->getBoolAttribute ("sendBinaryUDP", sendBinaryUDP);
            instantSigValGain       = (float) xmlState->getDoubleAttribute ("instantSigValGain", instantSigValGain);
            instantSigValNbOfSamplesSkipped = (float) xmlState->getDoubleAttribute ("instantSigValNbOfSamplesSkipped", instantSigValNbOfSamplesSkipped);
        }
    }
    
    //Build the default Signal Messages, and preallocate the char* which will receive their serialized data
    defineDefaultSignalMessages();
}
//==============================================================================
Result Project::loadDocument (const File& file)
{
    ScopedPointer<XmlElement> xml (XmlDocument::parse (file));

    if (xml == nullptr || ! xml->hasTagName (Ids::JUCERPROJECT.toString()))
        return Result::fail ("Not a valid Jucer project!");

    ValueTree newTree (ValueTree::fromXml (*xml));

    if (! newTree.hasType (Ids::JUCERPROJECT))
        return Result::fail ("The document contains errors and couldn't be parsed!");

    registerRecentFile (file);
    enabledModulesList = nullptr;
    projectRoot = newTree;

    removeDefunctExporters();
    setMissingDefaultValues();
    updateOldModulePaths();
    setChangedFlag (false);

    if (! ProjucerApplication::getApp().isRunningCommandLine)
        warnAboutOldProjucerVersion();

    return Result::ok();
}
Beispiel #11
0
void BiasedDelay::setStateInformation(ScopedPointer<XmlElement> state){
  if (state->hasTagName("BiasedDelayState"))
  {
    for (int i=0; i<getNumParameters(); i++)
      setParameterValue(i, (float)state->getDoubleAttribute(String::formatted("parameter%d", i), getParameterValue(i)));
    //      setParameterValue(i, (float)state->getDoubleAttribute(getParameterName(i), getParameterValue(i)));
  }
}
void EQPluginProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
    if (xmlState != nullptr)
        if (xmlState->hasTagName (mState->state.getType ())) mState->state = ValueTree::fromXml (*xmlState);
}
Beispiel #13
0
bool JucerDocument::isValidJucerCppFile (const File& f)
{
    if (f.hasFileExtension (".cpp"))
    {
        const ScopedPointer<XmlElement> xml (pullMetaDataFromCppFile (f.loadFileAsString()));
        return xml != nullptr && xml->hasTagName (jucerCompXmlTag);
    }

    return false;
}
Beispiel #14
0
Result PMixDocument::loadDocument (const File& file)
{
  XmlDocument doc (file);
  ScopedPointer<XmlElement> xml (doc.getDocumentElement());

  if (xml == nullptr || ! xml->hasTagName ("PMIXDOC"))
    return Result::fail ("Not a valid pMix file");

  restoreFromXml (*xml);
  return Result::ok();
}
Beispiel #15
0
const String FilterGraph::loadDocument (const File& file)
{
    XmlDocument doc (file);
    ScopedPointer<XmlElement> xml (doc.getDocumentElement());

    if (xml == nullptr || ! xml->hasTagName ("FILTERGRAPH"))
        return "Not a valid filter graph file";

    restoreFromXml (*xml);
    return String::empty;
}
Beispiel #16
0
Result FilterGraph::loadDocument (const File& file)
{
    XmlDocument doc (file);
    ScopedPointer<XmlElement> xml (doc.getDocumentElement());

    if (xml == nullptr || ! xml->hasTagName ("FILTERGRAPH"))
        return Result::fail ("Not a valid filter graph file");

    restoreFromXml (*xml);
    return Result::ok();
}
Beispiel #17
0
void Tunefish4AudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));

    if (xmlState != nullptr)
    {
        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("TF4SETTINGS"))
        {
            for (eU32 i=0; i<TF_PARAM_COUNT; i++)
            {
                tf->params[i] = (float) xmlState->getDoubleAttribute (TF_NAMES[i], tf->params[i]);
            }
        }
    }
}
void ComponentLayout::paste()
{
    XmlDocument clip (SystemClipboard::getTextFromClipboard());
    ScopedPointer<XmlElement> doc (clip.getDocumentElement());

    if (doc != nullptr && doc->hasTagName (clipboardXmlTag))
    {
        selected.deselectAll();

        forEachXmlChildElement (*doc, e)
            if (Component* newComp = addComponentFromXml (*e, true))
                selected.addToSelection (newComp);

        startDragging();
        dragSelectedComps (Random::getSystemRandom().nextInt (40),
                           Random::getSystemRandom().nextInt (40));
        endDragging();
    }
void FilterGuiDemoAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.
    // This getXmlFromBinary() helper function retrieves our XML from the binary blob..
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
    
    if (xmlState != nullptr)
    {
        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("MYPLUGINSETTINGS"))
        {
            // Now reload our parameters..
            for (int i = 0; i < getNumParameters(); ++i)
                if (AudioProcessorParameterWithID* p = dynamic_cast<AudioProcessorParameterWithID*> (getParameters().getUnchecked(i)))
                    p->setValueNotifyingHost ((float) xmlState->getDoubleAttribute (p->paramID, p->getValue()));
        }
    }
}
void OriginalRecording::writeXml()
{
	String name = recordPath + "Continuous_Data";
	if (experimentNumber > 1)
	{
		name += "_";
		name += String(experimentNumber);
	}
	name += ".openephys";

	File file(name);
	XmlDocument doc(file);
	ScopedPointer<XmlElement> xml = doc.getDocumentElement();
	if ( !xml || ! xml->hasTagName("EXPERIMENT"))
	{
		xml = new XmlElement("EXPERIMENT");
		xml->setAttribute("version",VERSION);
		xml->setAttribute("number",experimentNumber);
		xml->setAttribute("separatefiles",separateFiles);
	}
	XmlElement* rec = new XmlElement("RECORDING");
	rec->setAttribute("number",recordingNumber);
	rec->setAttribute("length",(double)(timestamp-startTimestamp));
	for (int i = 0; i < processorArray.size(); i++)
	{
		XmlElement* proc = new XmlElement("PROCESSOR");
		proc->setAttribute("id",processorArray[i]->id);
		rec->setAttribute("samplerate",processorArray[i]->sampleRate);
		for (int j = 0; j < processorArray[i]->channels.size(); j++)
		{
			ChannelInfo* c = processorArray[i]->channels[j];
			XmlElement* chan = new XmlElement("CHANNEL");
			chan->setAttribute("name",c->name);
			chan->setAttribute("bitVolts",c->bitVolts);
			chan->setAttribute("filename",c->filename);
			chan->setAttribute("position",(double)(c->startPos)); //As long as the file doesnt exceed 2^53 bytes, this will have integer precission. Better than limiting to 32bits.
			proc->addChildElement(chan);
		}
		rec->addChildElement(proc);
	}
	xml->addChildElement(rec);
	xml->writeToFile(file,String::empty);
}
Beispiel #21
0
bool JucerDocument::reloadFromDocument()
{
    const String cppContent (cpp->getCodeDocument().getAllContent());

    ScopedPointer<XmlElement> newXML (pullMetaDataFromCppFile (cppContent));

    if (newXML == nullptr || ! newXML->hasTagName (jucerCompXmlTag))
        return false;

    if (currentXML != nullptr && currentXML->isEquivalentTo (newXML, true))
        return true;

    currentXML = newXML;
    stopTimer();

    resources.loadFromCpp (getCppFile(), cppContent);

    return loadFromXml (*currentXML);
}
Beispiel #22
0
void SamplerProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.

    // This getXmlFromBinary() helper function retrieves our XML from the binary blob..
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));

    if (xmlState != nullptr)
    {
        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("MYPLUGINSETTINGS"))
        {
            // ok, now pull out our parameters..
            lastUIWidth  = xmlState->getIntAttribute ("uiWidth", lastUIWidth);
            lastUIHeight = xmlState->getIntAttribute ("uiHeight", lastUIHeight);
        }
    }
}
Beispiel #23
0
void Ambix_directional_loudnessAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.
    
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
    
    if (xmlState != nullptr)
    {
        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("MYPLUGINSETTINGS"))
        {
            for (int i=0; i < getNumParameters(); i++) {
                setParameter(i, xmlState->getDoubleAttribute(String(i)));
            }
        }
        
    }
}
Beispiel #24
0
//==============================================================================
const String Project::loadDocument (const File& file)
{
    ScopedPointer <XmlElement> xml (XmlDocument::parse (file));

    if (xml == nullptr || ! xml->hasTagName (Tags::projectRoot.toString()))
        return "Not a valid Jucer project!";

    ValueTree newTree (ValueTree::fromXml (*xml));

    if (! newTree.hasType (Tags::projectRoot))
        return "The document contains errors and couldn't be parsed!";

    StoredSettings::getInstance()->recentFiles.addFile (file);
    StoredSettings::getInstance()->flush();
    projectRoot = newTree;

    setMissingDefaultValues();

    return String::empty;
}
Beispiel #25
0
Result Project::loadDocument (const File& file)
{
    ScopedPointer <XmlElement> xml (XmlDocument::parse (file));

    if (xml == nullptr || ! xml->hasTagName (Tags::projectRoot.toString()))
        return Result::fail ("Not a valid Jucer project!");

    ValueTree newTree (ValueTree::fromXml (*xml));

    if (! newTree.hasType (Tags::projectRoot))
        return Result::fail ("The document contains errors and couldn't be parsed!");

    registerRecentFile (file);
    projectRoot = newTree;

    removeDefunctExporters();
    setMissingDefaultValues();
    setChangedFlag (false);

    return Result::ok();
}
Beispiel #26
0
void AutomizerAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.
    // This getXmlFromBinary() helper function retrieves our XML from the binary blob..
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
    
    if(xmlState != 0)
    {
        // make sure that it's actually our type of XML object..
        if(xmlState->hasTagName("AYOPLUGINSETTINGS"))
        {
            // ok, now pull out our parameters..
            lastUIWidth  = xmlState->getIntAttribute("uiWidth", lastUIWidth);
            lastUIHeight = xmlState->getIntAttribute("uiHeight", lastUIHeight);
            
            engine->outputGainPar   = (float)xmlState->getDoubleAttribute("OutputGain", engine->outputGainPar);
			engine->voice1GainPar   = (float)xmlState->getDoubleAttribute("Voice1Gain", engine->voice1GainPar);
			engine->voice2GainPar   = (float)xmlState->getDoubleAttribute("Voice2Gain", engine->voice2GainPar);
            engine->shiftTypePar    = (float)xmlState->getDoubleAttribute("PitchShiftType", engine->shiftTypePar);
            engine->transposePar    = (float)xmlState->getDoubleAttribute("Transpose", engine->transposePar);
			engine->panLPar         = (float)xmlState->getDoubleAttribute("PanVoice1",engine->panLPar);
			engine->panRPar         = (float)xmlState->getDoubleAttribute("PanVoice2", engine->panRPar);
			engine->keyPar          = (float)xmlState->getDoubleAttribute("Key", engine->keyPar);
			engine->scalePar        = (float)xmlState->getDoubleAttribute("Scale", engine->scalePar);
			engine->autotunePar     = (float)xmlState->getDoubleAttribute("Autotune", engine->autotunePar);
			engine->attackPar       = (float)xmlState->getDoubleAttribute("Attack", engine->attackPar);
			engine->referenceHzPar  = (float)xmlState->getDoubleAttribute("Reference", engine->referenceHzPar);	
			engine->shiftPar	    = (float)xmlState->getDoubleAttribute("TransposeOnOff", engine->shiftPar);	
			engine->rollOnPar		= (float)xmlState->getDoubleAttribute("RollOnOff", engine->rollOnPar);	
			engine->whiteningPar	= (float)xmlState->getDoubleAttribute("SpectralWhitening", engine->whiteningPar);	
			engine->harmonyPar		= (float)xmlState->getDoubleAttribute("SpectralShape", engine->harmonyPar);	
			engine->harm1AttackPar  = (float)xmlState->getDoubleAttribute("Harm1Attack", engine->harm1AttackPar);	
			engine->harm2AttackPar  = (float)xmlState->getDoubleAttribute("Harm2Attack", engine->harm2AttackPar);	
			engine->vDepth  = (float)xmlState->getDoubleAttribute("VibratoDepth", engine->vDepth);	
			engine->vRate  = (float)xmlState->getDoubleAttribute("Harm2Attack", engine->vRate);	
			engine->tunePar =  (float)xmlState->getDoubleAttribute("Tuning", engine->tunePar);	
		}
    }
}
void JuceDemoPluginAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.

    // This getXmlFromBinary() helper function retrieves our XML from the binary blob..
    ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));

    if (xmlState != nullptr)
    {
        // make sure that it's actually our type of XML object..
        if (xmlState->hasTagName ("MYPLUGINSETTINGS"))
        {
            // ok, now pull out our parameters..
            lastUIWidth  = xmlState->getIntAttribute ("uiWidth", lastUIWidth);
            lastUIHeight = xmlState->getIntAttribute ("uiHeight", lastUIHeight);

            offset->setValue ((float) xmlState->getDoubleAttribute ("gain", offset->getValue()));
            springConstant->setValue ((float) xmlState->getDoubleAttribute ("delay", springConstant->getValue()));
            velocityFactor->setValue ((float) xmlState->getDoubleAttribute ("velocity", velocityFactor->getValue()));
        }
    }
}
void PluginAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.
	ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));
	if (xmlState != 0) {
		if (xmlState->hasTagName ("SyzygrydSettings")) {
			panelIndex = (int) xmlState->getIntAttribute ("panelIndex", panelIndex);

			float tmpFloat;
			tmpFloat = (float) xmlState->getDoubleAttribute ("noteLength", sequencer->getNoteLength());
			sequencer->setNoteLength (tmpFloat);

			tmpFloat = (float) xmlState->getDoubleAttribute ("swingTicks", sequencer->getSwingTicks());
			sequencer->setSwingTicks (tmpFloat);

         // XXX why do we get and then immediately set back to the same value?
			String state = SharedState::getInstance()->getStringPanelState (panelIndex);
			state = xmlState->getStringAttribute ("panelState", state);
			SharedState::getInstance()->setStringPanelState (panelIndex, state);
		}
	}
}
Beispiel #29
0
static JucerDocument* createDocument (SourceCodeDocument* cpp)
{
    CodeDocument& codeDoc = cpp->getCodeDocument();

    ScopedPointer<XmlElement> xml (JucerDocument::pullMetaDataFromCppFile (codeDoc.getAllContent()));

    if (xml == nullptr || ! xml->hasTagName (JucerDocument::jucerCompXmlTag))
        return nullptr;

    const String docType (xml->getStringAttribute ("documentType"));

    ScopedPointer<JucerDocument> newDoc;

    if (docType.equalsIgnoreCase ("Button"))
        newDoc = new ButtonDocument (cpp);

    if (docType.equalsIgnoreCase ("Component") || docType.isEmpty())
        newDoc = new ComponentDocument (cpp);

    if (newDoc != nullptr && newDoc->reloadFromDocument())
        return newDoc.release();

    return nullptr;
}
bool JucerDocumentEditor::perform (const InvocationInfo& info)
{
    ComponentLayout* const currentLayout = getCurrentLayout();
    PaintRoutine* const currentPaintRoutine = getCurrentPaintRoutine();

    document->beginTransaction();

    if (info.commandID >= JucerCommandIDs::newComponentBase
         && info.commandID < JucerCommandIDs::newComponentBase + ObjectTypes::numComponentTypes)
    {
        addComponent (info.commandID - JucerCommandIDs::newComponentBase);
        return true;
    }

    if (info.commandID >= JucerCommandIDs::newElementBase
         && info.commandID < JucerCommandIDs::newElementBase + ObjectTypes::numElementTypes)
    {
        addElement (info.commandID - JucerCommandIDs::newElementBase);
        return true;
    }

    switch (info.commandID)
    {
        case StandardApplicationCommandIDs::undo:
            document->getUndoManager().undo();
            document->dispatchPendingMessages();
            break;

        case StandardApplicationCommandIDs::redo:
            document->getUndoManager().redo();
            document->dispatchPendingMessages();
            break;

        case JucerCommandIDs::test:
            TestComponent::showInDialogBox (*document);
            break;

        case JucerCommandIDs::enableSnapToGrid:
            document->setSnappingGrid (document->getSnappingGridSize(),
                                       ! document->isSnapActive (false),
                                       document->isSnapShown());
            break;

        case JucerCommandIDs::showGrid:
            document->setSnappingGrid (document->getSnappingGridSize(),
                                       document->isSnapActive (false),
                                       ! document->isSnapShown());
            break;

        case JucerCommandIDs::editCompLayout:
            showLayout();
            break;

        case JucerCommandIDs::editCompGraphics:
            showGraphics (0);
            break;

        case JucerCommandIDs::zoomIn:      setZoom (snapToIntegerZoom (getZoom() * 2.0)); break;
        case JucerCommandIDs::zoomOut:     setZoom (snapToIntegerZoom (getZoom() / 2.0)); break;
        case JucerCommandIDs::zoomNormal:  setZoom (1.0); break;

        case JucerCommandIDs::spaceBarDrag:
            if (EditingPanelBase* panel = dynamic_cast <EditingPanelBase*> (tabbedComponent.getCurrentContentComponent()))
                panel->dragKeyHeldDown (info.isKeyDown);

            break;

        case JucerCommandIDs::compOverlay0:
        case JucerCommandIDs::compOverlay33:
        case JucerCommandIDs::compOverlay66:
        case JucerCommandIDs::compOverlay100:
            {
                int amount = 0;

                if (info.commandID == JucerCommandIDs::compOverlay33)
                    amount = 33;
                else if (info.commandID == JucerCommandIDs::compOverlay66)
                    amount = 66;
                else if (info.commandID == JucerCommandIDs::compOverlay100)
                    amount = 100;

                document->setComponentOverlayOpacity (amount * 0.01f);
            }
            break;

        case JucerCommandIDs::bringBackLostItems:
            if (EditingPanelBase* panel = dynamic_cast <EditingPanelBase*> (tabbedComponent.getCurrentContentComponent()))
            {
                int w = panel->getComponentArea().getWidth();
                int h = panel->getComponentArea().getHeight();

                if (currentPaintRoutine != nullptr)
                    currentPaintRoutine->bringLostItemsBackOnScreen (panel->getComponentArea());
                else if (currentLayout != nullptr)
                    currentLayout->bringLostItemsBackOnScreen (w, h);
            }

            break;

        case JucerCommandIDs::toFront:
            if (currentLayout != nullptr)
                currentLayout->selectedToFront();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->selectedToFront();

            break;

        case JucerCommandIDs::toBack:
            if (currentLayout != nullptr)
                currentLayout->selectedToBack();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->selectedToBack();

            break;

        case JucerCommandIDs::group:
            if (currentPaintRoutine != nullptr)
                currentPaintRoutine->groupSelected();
            break;

        case JucerCommandIDs::ungroup:
            if (currentPaintRoutine != nullptr)
                currentPaintRoutine->ungroupSelected();
            break;

        case StandardApplicationCommandIDs::cut:
            if (currentLayout != nullptr)
            {
                currentLayout->copySelectedToClipboard();
                currentLayout->deleteSelected();
            }
            else if (currentPaintRoutine != nullptr)
            {
                currentPaintRoutine->copySelectedToClipboard();
                currentPaintRoutine->deleteSelected();
            }

            break;

        case StandardApplicationCommandIDs::copy:
            if (currentLayout != nullptr)
                currentLayout->copySelectedToClipboard();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->copySelectedToClipboard();

            break;

        case StandardApplicationCommandIDs::paste:
            {
                ScopedPointer<XmlElement> doc (XmlDocument::parse (SystemClipboard::getTextFromClipboard()));

                if (doc != nullptr)
                {
                    if (doc->hasTagName (ComponentLayout::clipboardXmlTag))
                    {
                        if (currentLayout != nullptr)
                            currentLayout->paste();
                    }
                    else if (doc->hasTagName (PaintRoutine::clipboardXmlTag))
                    {
                        if (currentPaintRoutine != nullptr)
                            currentPaintRoutine->paste();
                    }
                }
            }
            break;

        case StandardApplicationCommandIDs::del:
            if (currentLayout != nullptr)
                currentLayout->deleteSelected();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->deleteSelected();
            break;

        case StandardApplicationCommandIDs::selectAll:
            if (currentLayout != nullptr)
                currentLayout->selectAll();
            else if (currentPaintRoutine != nullptr)
                currentPaintRoutine->selectAll();
            break;

        case StandardApplicationCommandIDs::deselectAll:
            if (currentLayout != nullptr)
            {
                currentLayout->getSelectedSet().deselectAll();
            }
            else if (currentPaintRoutine != nullptr)
            {
                currentPaintRoutine->getSelectedElements().deselectAll();
                currentPaintRoutine->getSelectedPoints().deselectAll();
            }

            break;

        default:
            return false;
    }

    document->beginTransaction();
    return true;
}