void AudioProcessor::setParameterNotifyingHost (const int parameterIndex,
                                                const float newValue)
{
    setParameter (parameterIndex, newValue);
    sendParamChangeMessageToListeners (parameterIndex, newValue);
	getParamChecked(parameterIndex)->setNeedsUIUpdate(false);
}
void AudioProcessor::setParameterNotifyingHost (const int parameterIndex,
                                                const float newValue)
{
	//DBG("In AudioProcessor::setParameterNotifyingHost() with input value: " + String(newValue));
    setParameter (parameterIndex, newValue);
    sendParamChangeMessageToListeners (parameterIndex, newValue);
}
/**
 * Values updated by the UI
 * Here values are already up to date
 . tell host
 . Send NRPN
 */
void Pfm2AudioProcessor::onParameterUpdated(const teragon::Parameter *parameter) {
    // printf("Pfm2AudioProcessor::onParameterUpdated %s = %f \n", parameter->getName().c_str(), parameter->getValue());

    const MidifiedFloatParameter* midifiedFP = dynamic_cast<const MidifiedFloatParameter*>(parameter);
    if (midifiedFP != nullptr) {
        int index = midifiedFP->getParamIndex();

        if (index == nrpmIndex[2046]) {
            // Push button
            flushAllParametrsToNrpn();
        } else if (index == nrpmIndex[2045]) {
            // Midi Channel changed
            currentMidiChannel = parameter->getValue();
            // printf("New midi channel : %d\r\n", currentMidiChannel);
        } else {
            // Notify host
            sendParamChangeMessageToListeners(index, parameter->getScaledValue());
            // send nrpn
            if (!midifiedFP->getSendRealValue() || parameter->getValue() != 1) {
//				printf("Value : %f\n",  parameter->getValue());
                midifiedFP->addNrpn(midiMessageCollector, currentMidiChannel, parameter->getValue());
            }
        }
    }
}
/**
 * Values updated by the PreenFM2 hardware
 * Here the values has to be modified
  . Modify Value
  . tell host
  . refresh UI
 */
void Pfm2AudioProcessor::handleIncomingNrpn(int param, int value, int forceIndex) {
    // NRPM from the preenFM2
    if (param >= PREENFM2_NRPN_LETTER1 && param <= PREENFM2_NRPN_LETTER12) {
        presetName[param - PREENFM2_NRPN_LETTER1] = value;
        if (pfm2Editor) {
            pfm2Editor->setPresetName(presetName);
        }
    }

    int index = (forceIndex == -1 ? nrpmIndex[param] : forceIndex);

    if (index == -1) {
        printf("Pfm2AudioProcessor::handleIncomingNrpn NRPNparam %d not registered\r\n", param);
        return;
    }

    Parameter* parameter = parameterSet[index];

/*
    if (forceIndex != -1) {
        printf("Pfm2AudioProcessor::handleIncomingNrpn redirected to combBox %s (%d, %d)\r\n", parameter->getName().c_str(), param, value);
    } else {
        printf("Pfm2AudioProcessor::handleIncomingNrpn(%d, %d) : %s\r\n", param, value, parameter->getName().c_str());
    }
*/


    MidifiedFloatParameter* midifiedFP = dynamic_cast<MidifiedFloatParameter*>(parameter);
    if (parameter != nullptr) {
        float newFloatValue = midifiedFP->getValueFromNrpn(value);
        // Redirect to combo ?
        if ((newFloatValue > midifiedFP->getMaxValue() || newFloatValue < midifiedFP->getMinValue()) && forceIndex == -1) {
            // First remove current Slider value
			parametersToUpdateMutex.lock();
            parametersToUpdate.erase(midifiedFP->getName().c_str());
			parametersToUpdateMutex.unlock();
            if (pfm2Editor) {
                pfm2Editor->removeParamToUpdateUI(midifiedFP->getName().c_str());
            }

            // We redirect the Nrpn to previous param
            handleIncomingNrpn(param, value, index -1);
            return;
        }
        // Set the value but we don't want to be notified
        parameterSet.set(index, midifiedFP->getValueFromNrpn(value), this);
        // Notify host
        sendParamChangeMessageToListeners(index, midifiedFP->getScaledValueFromNrpn(value));
        // REDRAW UI : must be done in processblock after parameterSet is really udpated.
        if (pfm2Editor) {
            pfm2Editor->newNrpnParam(param, value);
        }
		parametersToUpdateMutex.lock();
        parametersToUpdate.insert(midifiedFP->getName().c_str());
		parametersToUpdateMutex.unlock();
    }
}
Exemple #5
0
//==============================================================================
void HoaMeterAudioProcessor::valueChanged (Value& value)
{
    for (int i = 0; i < m_number_of_parameters; i++)
    {
        PluginParameter& currentParameter = parameters[i];
        if (value.refersToSameSourceAs(currentParameter.getValueObject()))
        {
            sendParamChangeMessageToListeners(i, currentParameter.getNormalisedValue());
        }
    }
}
void AudioProcessor::setParameterNotifyingHost (const int parameterIndex,
                                                const float newValue)
{
    setParameter (parameterIndex, newValue);
    sendParamChangeMessageToListeners (parameterIndex, newValue);
}
void AudioProcessorExt::setScaledParameterNotifyingHost (int parameterIndex, float newValue)
{
    setScaledParameter (parameterIndex, newValue);
    sendParamChangeMessageToListeners (parameterIndex, newValue);
}
Exemple #8
0
void PluginProcessor::updateListeners(int index, float newValue)
{
    sendParamChangeMessageToListeners(index, newValue);
}