Exemplo n.º 1
0
// this is called if an OSC message is received
void Ambix_encoderAudioProcessor::oscMessageReceived (const OSCMessage& message)
{
    // /ambi_enc_set <id> <distance> <azimuth> <elevation> <size>
    
    // parse the message for int and float
    float val[5];
    
    for (int i=0; i < jmin(5,message.size()); i++) {
        
        val[i] = 0.5f;
        
        // get the value wheter it is a int or float value
        if (message[i].getType() == OSCTypes::float32)
        {
            val[i] = (float)message[i].getFloat32();
        }
        else if (message[i].getType() == OSCTypes::int32)
        {
            val[i] = (float)message[i].getInt32();
        }
        
    }
    
    setParameterNotifyingHost(Ambix_encoderAudioProcessor::AzimuthParam, jlimit(0.f, 1.f, (val[2]+180.f)/360.f) );
    setParameterNotifyingHost(Ambix_encoderAudioProcessor::ElevationParam, jlimit(0.f, 1.f, (val[3]+180.f)/360.f) );
	setParameterNotifyingHost(Ambix_encoderAudioProcessor::SizeParam, jlimit(0.f, 1.f, val[4]));
    
}
Exemplo n.º 2
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();
}
Exemplo n.º 3
0
//==============================================================================
StereoChorusAudioProcessor::StereoChorusAudioProcessor()
{
    setParameterNotifyingHost(delayParam, 0.5);
    setParameterNotifyingHost(feedbackParam, 0.5);
    setParameterNotifyingHost(modParam, 0.5);
    setParameterNotifyingHost(mixParam, 0.5);
    
}
Exemplo n.º 4
0
void PitchedDelayAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
	ScopedPointer<XmlElement> xml(getXmlFromBinary(data, sizeInBytes));

	if (xml != 0 && xml->getTagName() == "PitchedDelay")
	{
		const bool extendedsync = xml->hasAttribute("extended");

		for (int i=0; i<getNumParameters(); ++i)
		{
			const String paramName(getParameterName(i));

			float val = (float) xml->getDoubleAttribute(paramName, -1000);

			if (! extendedsync && paramName.contains("Sync"))
				val = val*7/9;

			if (! extendedsync && paramName.contains("PitchType"))
				val = val*5/8;			

			if (val > -1000)
				setParameterNotifyingHost(i, val);
		}

		const int curTab = xml->getIntAttribute("currentTab", -1000);
		showTooltips = xml->getIntAttribute("showtooltips") == 1;
		currentTab = curTab > -1000 ? curTab : 0;
	}


}
Exemplo n.º 5
0
void DRowAudioFilter::setScaledParameterNotifyingHost(int index, float newValue)
{
	for (int i = 0; i < noParams; i++)
		if (index == i)
			if (params[i].getValue() != newValue)
				setParameterNotifyingHost(index, params[i].normaliseValue(newValue));
}
Exemplo n.º 6
0
void Processor::clearConvolvers()
{
  {
    juce::ScopedLock convolverLock(_convolverMutex);
    _reverse = false;
    _predelayMs = 0.0;
    _stretch = 1.0;
    _irBegin = 0.0;
    _irEnd = 1.0;
    _attackLength = 0.0;
    _attackShape = 0.0;
    _decayShape = 0.0;
  }

  setParameterNotifyingHost(Parameters::EqLowCutFreq, Parameters::EqLowCutFreq.getDefaultValue());
  setParameterNotifyingHost(Parameters::EqLowShelfFreq, Parameters::EqLowShelfFreq.getDefaultValue());
  setParameterNotifyingHost(Parameters::EqLowShelfDecibels, Parameters::EqLowShelfDecibels.getDefaultValue());
  setParameterNotifyingHost(Parameters::EqHighCutFreq, Parameters::EqHighCutFreq.getDefaultValue());
  setParameterNotifyingHost(Parameters::EqHighShelfFreq, Parameters::EqHighShelfFreq.getDefaultValue());
  setParameterNotifyingHost(Parameters::EqHighShelfDecibels, Parameters::EqHighShelfDecibels.getDefaultValue());
  setParameterNotifyingHost(Parameters::StereoWidth, Parameters::StereoWidth.getDefaultValue());

  for (size_t i=0; i<_agents.size(); ++i)
  {
    _agents[i]->clear();
  }

  notifyAboutChange();
  updateConvolvers();
}
Exemplo n.º 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]));
        }
    }

}
Exemplo n.º 8
0
void SuperSpreadAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    ScopedPointer<XmlElement> xml(getXmlFromBinary(data, sizeInBytes));

    if (xml != nullptr)
    {
        for (int i=0; i<getNumParameters(); ++i)
            setParameterNotifyingHost(i, static_cast<float> (xml->getDoubleAttribute(getParameterName(i), getParameter(i))));
    }
}
void LuftikusAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
	ScopedPointer<XmlElement> xml(getXmlFromBinary(data, sizeInBytes));

	if (xml != nullptr)
	{
		for (int i=0; i<getNumParameters(); ++i)
			setParameterNotifyingHost(i, (float) xml->getDoubleAttribute(getParameterName(i).replace(" ", "_", false).replace(".", "-", false)));

		showTooltips = xml->getBoolAttribute("tooltips", true);
	}
}
Exemplo n.º 10
0
void InstanceProcessor::parametersChanged()
{
    size_t index = 0;
    lock();
    for(size_t i = 0; i < m_parameters.size(); i++)
    {
        m_parameters[i] = pd::Parameter();
    }
    unlock();
    pd::Patch patch(getPatch());
    if(patch.isValid())
    {
        std::vector<pd::Gui> guis(patch.getGuis());
        for(auto const& gui : guis)
        {
            if(gui.isParameter())
            {
                bool ok = true;
                for(size_t i = 0; i < m_parameters.size() && m_parameters[i].isValid(); i++)
                {
                    if(gui.getName() == m_parameters[i].getName())
                    {
                        sendConsoleError("Warning in patch " + patch.getName() + ": "  + gui.getName() + " parameter is duplicated !");
                        ok = false;
                        break;
                    }
                    else if(gui.getReceiveTie() == m_parameters[i].getTie())
                    {
                        sendConsoleError("Warning in patch " + patch.getName() + ": "  + gui.getName() + " parameter shares the same receive symbol with another parameter !");
                        ok = false;
                        break;
                    }
                }
                if(ok)
                {
                    m_parameters[index] = pd::Parameter(gui);
                    index++;
                }
            }
        }
    }
    updateHostDisplay();
    for(size_t i = 0; i < m_parameters.size(); i++)
    {
        if(m_parameters[i].isValid())
        {
            setParameterNotifyingHost(i, m_parameters[i].getValueNormalized());
        }
    }
}
Exemplo n.º 11
0
void InstanceProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    ScopedPointer<XmlElement> xml(getXmlFromBinary(data, sizeInBytes));
    if(xml != nullptr)
    {
        if(xml->hasTagName("CamomileSettings"))
        {
            String name = xml->getStringAttribute("name");
            String path = xml->getStringAttribute("path");
            if(File::isAbsolutePath(path))
            {
                File file(path + File::separatorString + name);
                if(!file.exists())
                {
                    file = File(m_path + File::separatorString + name);
                    if(!file.exists())
                    {
                        file = File(File::getCurrentWorkingDirectory().getFullPathName() + File::separatorString + name);
                        if(!file.exists())
                        {
                            file = File(File::getSpecialLocation(juce::File::SpecialLocationType::userDocumentsDirectory).getFullPathName() + File::separatorString + name);
                            if(!file.exists())
                            {
                                file = File(path + File::separatorString + name);
                            }
                        }
                    }
                }
                loadPatch(name.toStdString(), path.toStdString());
            }
            
            XmlElement* params = xml->getChildByName(juce::StringRef("params"));
            if(params)
            {
                for(int i = 0; i < params->getNumAttributes(); i++)
                {
                    int index = getParameterIndex(params->getAttributeName(i));
                    if(index >= 0)
                    {
                        setParameterNotifyingHost(index, params->getAttributeValue(i).getDoubleValue());
                    }
                }
            }
        }
    }
}
Exemplo n.º 12
0
void CtrlrModulatorProcessor::setValueFromMIDI(CtrlrMidiMessage &m)
{
	/* called from the Panel's MIDI thread */
	{
		const ScopedWriteLock sl (processorLock);
		
		/* merge the icomming midi data with our message */
		mergeMidiData (m, *ctrlrMidiMessage);

		/* fetch the value from the midi message and pass it to the host */
		const int possibleValue = getValueFromMidiMessage();
		
		if (currentValue != possibleValue)
		{
			if (isInValidMappedRange (possibleValue))
			{
				currentValue = possibleValue;

				/* notify the pluginHost about the change */
				setParameterNotifyingHost();
			}
		}
	}
} 
Exemplo n.º 13
0
void Ambix_rotatorAudioProcessor::oscMessageReceived (const OSCMessage& message)
{
    
    if (message.getAddressPattern() == OSCAddressPattern("/rotation")) {
        // /rotation [pitch] [yaw] [roll]
        
        float val[3];
        
        for (int i=0; i < jmin(3,message.size()); i++) {
            
            val[i] = 0.5f;
            
            // get the value wheter it is a int or float value
            if (message[i].getType() == OSCTypes::float32)
            {
                val[i] = (float)message[i].getFloat32();
            }
            else if (message[i].getType() == OSCTypes::int32)
            {
                val[i] = (float)message[i].getInt32();
            }
            
        }
        
        setParameterNotifyingHost(Ambix_rotatorAudioProcessor::PitchParam, jlimit(0.f, 1.f, val[0]/360.f+0.5f));
        setParameterNotifyingHost(Ambix_rotatorAudioProcessor::YawParam, jlimit(0.f, 1.f, val[1]/360.f+0.5f));
        setParameterNotifyingHost(Ambix_rotatorAudioProcessor::RollParam, jlimit(0.f, 1.f, val[2]/360.f+0.5f));
        
    } else if (message.getAddressPattern() == OSCAddressPattern("/head_pose")) {
        // /head_pose [User_ID] [x] [y] [z] [pitch] [yaw] [roll]
        
        float val[7];
        
        for (int i=4; i < jmin(7,message.size()); i++) {
            
            val[i] = 0.5f;
            
            // get the value wheter it is a int or float value
            if (message[i].getType() == OSCTypes::float32)
            {
                val[i] = (float)message[i].getFloat32();
            }
            else if (message[i].getType() == OSCTypes::int32)
            {
                val[i] = (float)message[i].getInt32();
            }
            
        }
        
        setParameterNotifyingHost(Ambix_rotatorAudioProcessor::PitchParam, jlimit(0.f, 1.f, val[4]/360.f+0.5f));
        setParameterNotifyingHost(Ambix_rotatorAudioProcessor::YawParam, jlimit(0.f, 1.f, val[5]/360.f+0.5f));
        setParameterNotifyingHost(Ambix_rotatorAudioProcessor::RollParam, jlimit(0.f, 1.f, val[6]/360.f+0.5f));
        
    }
    
    // debug the message
#if 0
    std::cout << "osc message received: " << message.getAddressPattern().toString() << " ";
    
    for (int i=0; i<message.size(); i++) {
        
        if (message[i].getType() == OSCTypes::float32)
        {
            std::cout << "[f] " << message[i].getFloat32() << " ";
        }
        else if (message[i].getType() == OSCTypes::int32)
        {
            std::cout << "[i] " << message[i].getInt32() << " ";
        }
        else if (message[i].getType() == OSCTypes::string)
            std::cout << "[s] " << message[i].getString() << " ";
    }
    std::cout << std::endl;
#endif
    
}
Exemplo n.º 14
0
void Ambix_mirrorAudioProcessor::SwitchPreset()
{
    
    int active_preset = (int)(preset_param * NUM_PRESETS);
    
    // 1 do nothing...
    preset_name = "";
    
    // first set all zero
    if (active_preset > 1)
    {
        setParameterNotifyingHost(XEvenParam, 0.75f);
        setParameterNotifyingHost(XEvenInvParam, 0.f);
        setParameterNotifyingHost(XOddParam, 0.75f);
        setParameterNotifyingHost(XOddInvParam, 0.f);
        
        setParameterNotifyingHost(YEvenParam, 0.75f);
        setParameterNotifyingHost(YEvenInvParam, 0.f);
        setParameterNotifyingHost(YOddParam, 0.75f);
        setParameterNotifyingHost(YOddInvParam, 0.f);
        
        setParameterNotifyingHost(ZEvenParam, 0.75f);
        setParameterNotifyingHost(ZEvenInvParam, 0.f);
        setParameterNotifyingHost(ZOddParam, 0.75f);
        setParameterNotifyingHost(ZOddInvParam, 0.f);
        
        setParameterNotifyingHost(CircularParam, 0.75f);
        setParameterNotifyingHost(CircularInvParam, 0.f);
    }
    
    switch (active_preset) {
        case 2:
            // all zero done...
            preset_name = "no change";
            break;
            
        case 3: // flip left right -> invert Y Odd
            setParameterNotifyingHost(YOddInvParam, 1.f);
            preset_name = "flip left <> right";
            break;
            
        case 4: // flop front back -> invert X Odd
            setParameterNotifyingHost(XOddInvParam, 1.f);
            preset_name = "flop front <> back";
            break;
            
        case 5: // flap top bottom -> invert Z Odd
            setParameterNotifyingHost(ZOddInvParam, 1.f);
            preset_name = "flap top <> bottom";
            break;
            
        case 6: // merge left+right
            setParameterNotifyingHost(YOddParam, 0.f); // zero
            setParameterNotifyingHost(YEvenParam, 1.f); // +6 dB
            setParameterNotifyingHost(CircularParam, 0.530959f); // -6 dB
            preset_name = "merge left + right";
            break;
            
        case 7: // merge front+back
            setParameterNotifyingHost(XOddParam, 0.f); // zero
            setParameterNotifyingHost(XEvenParam, 1.f); // +6 dB
            setParameterNotifyingHost(CircularParam, 0.530959f); // -6 dB
            preset_name = "merge front+back";
            break;
            
        case 8: // merge top+bottom
            setParameterNotifyingHost(ZOddParam, 0.f); // zero
            setParameterNotifyingHost(ZEvenParam, 1.f); // +6 dB
            setParameterNotifyingHost(CircularParam, 0.530959f); // -6 dB
            preset_name = "merge top+bottom";
            break;
            
        default:
            break;
    }
    
}
Exemplo n.º 15
0
//==============================================================================
vstSynthAudioProcessor::vstSynthAudioProcessor()
	: delayBuffer(1,1)

{
    // Initialize all parameters
	setParameterNotifyingHost(osc1WaveParam, 1);
	setParameterNotifyingHost(osc2WaveParam, 1);
	setParameterNotifyingHost(osc3WaveParam, 1);

	setParameterNotifyingHost(osc1OctaveParam, 0);
	setParameterNotifyingHost(osc2OctaveParam, 0);
	setParameterNotifyingHost(osc3OctaveParam, 0);

	setParameterNotifyingHost(osc1LevelParam, 1);
	setParameterNotifyingHost(osc2LevelParam, 1);
	setParameterNotifyingHost(osc3LevelParam, 1);

	setParameterNotifyingHost(noiseParam, 0.0001);

	setParameterNotifyingHost(attackParam, 0);
	setParameterNotifyingHost(decayParam, 0);
	setParameterNotifyingHost(sustainParam, 5);
	setParameterNotifyingHost(releaseParam, 0);

	setParameterNotifyingHost(lfoDestParam, 0);
	setParameterNotifyingHost(lfoWaveParam, 0);
	setParameterNotifyingHost(lfoFreqParam, 0);
	setParameterNotifyingHost(lfoDevParam, 0);

	setParameterNotifyingHost(filterTypeParam, 0);
	setParameterNotifyingHost(filterCutoffParam, 0.25 * PI);
	setParameterNotifyingHost(filterResonanceParam, 1);
	setParameterNotifyingHost(filterGainParam, 1);

	setParameterNotifyingHost(delayTimeParam, 0);
	setParameterNotifyingHost(delayFeedbackParam, 0.0001);
	setParameterNotifyingHost(delayGainParam, 0.0001);

	setParameterNotifyingHost(driveParam, 1);
	setParameterNotifyingHost(outputGainParam, 1); //log

	// Initialise the synth. 
	for (int numVoices = 1; --numVoices >= 0;)
	{
		// A reference to global parameters is passed to each
        // voice so that it can reference them locally. 
        vstSynth.addVoice (new vstSynthVoice(parameters));
	}
	vstSynth.addSound(new vstSynthSound());
}
Exemplo n.º 16
0
void UGenPlugin::setMappedParameterNotifyingHost(int index, float newValue)
{
	setParameterNotifyingHost(index, calculateNormalisedParameter(index, newValue));
}
Exemplo n.º 17
0
void MidiplugAudioProcessor::setMIDIParameter (int index, int newValue)
{
    MIDIParameter param = findMIDIParameter(index);
    param.setMIDIValue(newValue);
    setParameterNotifyingHost(index, param.getValue());
}
Exemplo n.º 18
0
void CtrlrModulatorProcessor::setValueFromGUI(const double inValue, const bool force, const bool mute)
{
	/* there are 3 sources of value changes

		- gui
		- midi
		- host

		- gui should affect the MIDI first and then send the value to host, when it comes back from host
			and is the same as the value set before sending it to host, nothing should happen, if theyre
			different it should be set to the MIDI and a async update should be triggered

		- midi should affect the host first

		- host update has to check what's different from the value received, if it is different an update
			should be triggered (midi sent and/or async update done)


		** problem, when a value comes back from host it needs to be re-mapped to a midi value that lives
			in the UI component, this will be the audio thread so asking the component will require locking
			it might be better to keep a copy of value mapping (just the numeric part, we don't need the text, or do we?)
			internaly in the processor so we can avoid locking at runtime
	*/
	{
		/* if the values are already the same, and the force flag is set to false
			don't do anything the modulator is already in the state it should be */

		const ScopedReadLock sl(processorLock);

		if (currentValue == inValue && force == false)
		{
			return;
		}
	}

	{
		/* set the current value and the midi messages value,
			send the MIDI out and notify the host about the parameter change */
		const ScopedWriteLock sl(processorLock);

		/* it's the same value, but it's forced, send out MIDI and triggerAsyncUpdate
			don't inform the host, it already knows about it

			if mute is true, no midi goes out */
		if (currentValue == inValue && force == true)
		{
			if (!mute)
				sendMidiMessage();

			triggerAsyncUpdate();

			return;
		}

		/* first we se the currentValue to the new value comming from the gui, it's needed for the
			expressions evaluations to work */

		currentValue = inValue;

		/* send the midi message, this is done using a special thread so it won't wait until it's actualy sent */
		if (!mute)
			sendMidiMessage();

		triggerAsyncUpdate();
	}

	/* notify the pluginHost about the change */
	setParameterNotifyingHost();
}
Exemplo n.º 19
0
void InstanceProcessor::setParameterNonNormalizedNotifyingHost(int index, float newValue)
{
    setParameterNotifyingHost(index, m_parameters[index].getValueNormalized(newValue));
}