Beispiel #1
0
void YigModField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
    //setCursor(Qt::ArrowCursor);
    rotationAngle = angleFromCenter(event->scenePos());
    setRotation(rotationAngle);
    transformOriginPoint();
    updateParameter(fmod((rotationAngle+180), 360)/360);
    QGraphicsEllipseItem::mouseReleaseEvent(event);
}
Beispiel #2
0
void ActionEditor::setPredicate( Solid::Predicate predicate )
{
    delete topItem;
    topItem = new PredicateItem( Solid::Predicate(), 0 );
    rootItem = new PredicateItem( predicate, topItem );
    rootModel->setRootPredicate( rootItem->parent() );

    // Select the top item, not the hidden root
    QModelIndex topItem = rootModel->index( 0, 0, QModelIndex() );
    ui.TvPredicateTree->setCurrentIndex( topItem );
    ui.TvPredicateTree->expandToDepth( 2 );
    updateParameter();
}
Beispiel #3
0
YigModField::YigModField(YigSynthGraphic *synthGraphic, float param, qreal x, qreal y, qreal width, qreal height, QGraphicsItem *parent) :
    QGraphicsEllipseItem( x, y, width, height, parent ),
    modArc(this),
    yigAttractor(this),
    modTriangle(this)
{
    //createModCircle();
    parentGraphic = synthGraphic;
    setTransformOriginPoint(boundingRect().width()/2, boundingRect().height()/2);
    rotationAngle = param * 360;
    setRotation(fmod(rotationAngle+180, 360));
    transformOriginPoint();
    updateParameter(fmod((rotationAngle+180), 360)/360);
    modTriangle.setZValue(99);
    QPolygonF modPolygon;
    modPolygon.append(QPointF(0, 0));
    modPolygon.append(QPointF(5, 15));
    modPolygon.append(QPointF(-5, 15));
    modPolygon.translate(width/2, 0);
    modTriangle.setPolygon(modPolygon);
    QPen modPen(Qt::NoPen);
    modTriangle.setPen(modPen);
    QColor modColor(YigColorKit::background2);
    modColor.setAlpha(200);
    QBrush modBrush(modColor);
    modTriangle.setBrush(modBrush);
    // Mod amount
    /*
    modElectron = new QGraphicsEllipseItem(0, 0, 25, 25, this);
    modElectron->moveBy(0, (boundingRect().width()/2) - 3);
    modElectron->setFlag( QGraphicsItem::ItemIsSelectable, false );
    modElectron->setFlag( QGraphicsItem::ItemIsMovable, false );
    modElectron->setCacheMode( QGraphicsItem::ItemCoordinateCache );
    QColor modColor(YigColorKit::background2);
    modColor.setAlpha(200);
    modElectron->setPen(QPen(modColor));
    modColor.setAlpha(20);
    modElectron->setBrush(modColor);*/

    /*
    QColor modFill(YigColorKit::background2);
    modFill.setAlpha(100);
    QColor modOutline(YigColorKit::background2);
    modOutline.setAlpha(220);
    modArc.setBrush(modFill);
    modArc.setPen(Qt::NoPen);*/
    //redrawArc();
}
// set the displayed value (and, if setParam is true, the
// linked parameter.)  The value will be constrained if necessary.
void NumericValControl::setValue(
	double											value,
	bool												setParam) {

//	PRINT((
//		"### NumericValControl::setValue(%.12f)\n", value));

	// round to displayed precision
	double scaleFactor = pow(10, m_fractionalDigits);

	int64 fixed = (int64)(value * scaleFactor);
	double junk = (value * scaleFactor) - (double)fixed;
	
//	PRINT((
//		" :  junk == %.12f\n", junk));
	
	if(value < 0.0) {
		if(junk * scaleFactor < 0.5)
			fixed--;
	} else {
		if(junk * scaleFactor >= 0.5)
			fixed++;
	}
	
	value = (double)fixed / scaleFactor;
	
//	PRINT((
//		" -> %.12f, %Ld\n", value, fixed));

	_set_value_fixed(fixed);
		
	// notify target 
	Invoke();

	// set parameter
	if(setParam && m_param)
		updateParameter(value);
	
	// +++++ redraw?
}
Beispiel #5
0
void AddAction::updateParameters()
{
	theParameters->clear();
	theArguments.clear();
	if(theUseDCOP->isChecked() && theFunctions->currentItem())
	{
		Prototype p(theFunctions->currentItem()->text(2));
		for(unsigned k = 0; k < p.count(); k++)
		{	new KListViewItem(theParameters, p.name(k).isEmpty() ? i18n( "<anonymous>" ) : p.name(k), "", p.type(k), QString().setNum(k + 1));
			theArguments.append(QVariant(""));
			theArguments.back().cast(QVariant::nameToType(p.type(k).utf8()));
		}
	}
	else if(theUseProfile->isChecked() && theProfiles->currentItem())
	{
		ProfileServer *theServer = ProfileServer::profileServer();

		if(!theProfiles->currentItem()) return;
		if(!theProfileFunctions->currentItem()) return;
		const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]];
		const ProfileAction *pa = p->actions()[profileFunctionMap[theProfileFunctions->currentItem()]];

		int index = 1;
		for(QValueList<ProfileActionArgument>::const_iterator i = pa->arguments().begin(); i != pa->arguments().end(); ++i, index++)
		{	theArguments.append(QVariant((*i).getDefault()));
			theArguments.back().cast(QVariant::nameToType((*i).type().utf8()));
			new QListViewItem(theParameters, (*i).comment(), theArguments.back().toString(), (*i).type(), QString().setNum(index));
		}

		// quicky update options too...
		theRepeat->setChecked(pa->repeat());
		theAutoStart->setChecked(pa->autoStart());
	}

	updateParameter();
}
Beispiel #6
0
SqueezerAudioProcessorEditor::SqueezerAudioProcessorEditor(
    SqueezerAudioProcessor *OwnerFilter,
    SqueezerPluginParameters *PluginParameters,
    int NumberOfChannels)
    : AudioProcessorEditor(OwnerFilter)
{
    // load look and feel
    currentLookAndFeel_ = new frut::skin::LookAndFeel_Frut_V3;
    setLookAndFeel(currentLookAndFeel_);

    // the editor window does not have any transparent areas
    // (increases performance on redrawing)
    setOpaque(true);

    // prevent meter updates during initialisation
    IsInitialising_ = true;

    // The plug-in editor's size as well as the location of buttons
    // and labels will be set later on in this constructor.

    PluginProcessor_ = OwnerFilter;
    PluginProcessor_->addActionListener(this);

    NumberOfChannels_ = NumberOfChannels;

    SliderThreshold_ = new frut::widgets::SliderCombined(
        PluginParameters,
        SqueezerPluginParameters::selThreshold,
        SqueezerPluginParameters::selThresholdSwitch);

    SliderThreshold_->addListener(this);
    SliderThreshold_->addButtonListener(this);
    addAndMakeVisible(SliderThreshold_);


    SliderRatio_ = new frut::widgets::SliderCombined(
        PluginParameters,
        SqueezerPluginParameters::selRatio,
        SqueezerPluginParameters::selRatioSwitch);

    SliderRatio_->addListener(this);
    SliderRatio_->addButtonListener(this);
    addAndMakeVisible(SliderRatio_);


    SliderAttackRate_ = new frut::widgets::SliderCombined(
        PluginParameters,
        SqueezerPluginParameters::selAttackRate,
        SqueezerPluginParameters::selAttackRateSwitch);

    SliderAttackRate_->addListener(this);
    SliderAttackRate_->addButtonListener(this);
    addAndMakeVisible(SliderAttackRate_);


    SliderReleaseRate_ = new frut::widgets::SliderCombined(
        PluginParameters,
        SqueezerPluginParameters::selReleaseRate,
        SqueezerPluginParameters::selReleaseRateSwitch);

    SliderReleaseRate_->addListener(this);
    SliderReleaseRate_->addButtonListener(this);
    addAndMakeVisible(SliderReleaseRate_);


    SliderMakeupGain_ = new frut::widgets::SliderCombined(
        PluginParameters,
        SqueezerPluginParameters::selMakeupGain,
        SqueezerPluginParameters::selMakeupGainSwitch);

    SliderMakeupGain_->addListener(this);
    SliderMakeupGain_->addButtonListener(this);
    addAndMakeVisible(SliderMakeupGain_);


    SliderWetMix_ = new frut::widgets::SliderCombined(
        PluginParameters,
        SqueezerPluginParameters::selWetMix,
        SqueezerPluginParameters::selWetMixSwitch);

    SliderWetMix_->addListener(this);
    SliderWetMix_->addButtonListener(this);
    addAndMakeVisible(SliderWetMix_);


    SliderSidechainHPFCutoff_ = new frut::widgets::SliderCombined(
        PluginParameters,
        SqueezerPluginParameters::selSidechainHPFCutoff,
        SqueezerPluginParameters::selSidechainHPFCutoffSwitch);

    SliderSidechainHPFCutoff_->addListener(this);
    SliderSidechainHPFCutoff_->addButtonListener(this);
    addAndMakeVisible(SliderSidechainHPFCutoff_);


    SliderSidechainLPFCutoff_ = new frut::widgets::SliderCombined(
        PluginParameters,
        SqueezerPluginParameters::selSidechainLPFCutoff,
        SqueezerPluginParameters::selSidechainLPFCutoffSwitch);

    SliderSidechainLPFCutoff_->addListener(this);
    SliderSidechainLPFCutoff_->addButtonListener(this);
    addAndMakeVisible(SliderSidechainLPFCutoff_);


    ButtonBypass_.addListener(this);
    addAndMakeVisible(&ButtonBypass_);

    ButtonDetectorRms_.addListener(this);
    addAndMakeVisible(&ButtonDetectorRms_);

    ButtonDesignFeedback_.addListener(this);
    addAndMakeVisible(&ButtonDesignFeedback_);

    ButtonGainStageOptical_.addListener(this);
    addAndMakeVisible(&ButtonGainStageOptical_);

    ButtonDetectorLinear_.setRadioGroupId(1);
    ButtonDetectorLinear_.addListener(this);
    addAndMakeVisible(&ButtonDetectorLinear_);

    ButtonDetectorSmoothDecoupled_.setRadioGroupId(1);
    ButtonDetectorSmoothDecoupled_.addListener(this);
    addAndMakeVisible(&ButtonDetectorSmoothDecoupled_);

    ButtonDetectorSmoothBranching_.setRadioGroupId(1);
    ButtonDetectorSmoothBranching_.addListener(this);
    addAndMakeVisible(&ButtonDetectorSmoothBranching_);

    ButtonKneeHard_.setRadioGroupId(2);
    ButtonKneeHard_.addListener(this);
    addAndMakeVisible(&ButtonKneeHard_);

    ButtonKneeMedium_.setRadioGroupId(2);
    ButtonKneeMedium_.addListener(this);
    addAndMakeVisible(&ButtonKneeMedium_);

    ButtonKneeSoft_.setRadioGroupId(2);
    ButtonKneeSoft_.addListener(this);
    addAndMakeVisible(&ButtonKneeSoft_);

    ButtonAutoMakeupGain_.addListener(this);
    addAndMakeVisible(&ButtonAutoMakeupGain_);

    ButtonSidechainInput_.addListener(this);
    addAndMakeVisible(&ButtonSidechainInput_);

    ButtonSidechainListen_.addListener(this);
    addAndMakeVisible(&ButtonSidechainListen_);

    ButtonSkin_.addListener(this);
    addAndMakeVisible(&ButtonSkin_);

    ButtonReset_.addListener(this);
    addAndMakeVisible(&ButtonReset_);

    ButtonSettings_.addListener(this);
    addAndMakeVisible(&ButtonSettings_);

    ButtonAbout_.addListener(this);
    addAndMakeVisible(&ButtonAbout_);

#ifdef DEBUG
    // moves debug label to the back of the editor's z-plane to that
    // it doesn't overlay (and thus block) any other components
    addAndMakeVisible(LabelDebug_, 0);
#endif

    // prevent unnecessary redrawing of plugin editor
    BackgroundImage_.setOpaque(true);
    // moves background image to the back of the editor's z-plane to
    // that it doesn't overlay (and thus block) any other components
    addAndMakeVisible(BackgroundImage_, 0);

    updateParameter(SqueezerPluginParameters::selBypass);

    updateParameter(SqueezerPluginParameters::selThresholdSwitch);
    updateParameter(SqueezerPluginParameters::selThreshold);
    updateParameter(SqueezerPluginParameters::selRatioSwitch);
    updateParameter(SqueezerPluginParameters::selRatio);

    updateParameter(SqueezerPluginParameters::selAttackRateSwitch);
    updateParameter(SqueezerPluginParameters::selAttackRate);
    updateParameter(SqueezerPluginParameters::selReleaseRateSwitch);
    updateParameter(SqueezerPluginParameters::selReleaseRate);

    updateParameter(SqueezerPluginParameters::selMakeupGainSwitch);
    updateParameter(SqueezerPluginParameters::selMakeupGain);
    updateParameter(SqueezerPluginParameters::selWetMixSwitch);
    updateParameter(SqueezerPluginParameters::selWetMix);

    updateParameter(SqueezerPluginParameters::selSidechainHPFCutoffSwitch);
    updateParameter(SqueezerPluginParameters::selSidechainHPFCutoff);
    updateParameter(SqueezerPluginParameters::selSidechainLPFCutoffSwitch);
    updateParameter(SqueezerPluginParameters::selSidechainLPFCutoff);

    updateParameter(SqueezerPluginParameters::selDetectorRmsFilter);
    updateParameter(SqueezerPluginParameters::selDesign);
    updateParameter(SqueezerPluginParameters::selDetector);
    updateParameter(SqueezerPluginParameters::selGainStage);
    updateParameter(SqueezerPluginParameters::selKneeWidth);

    updateParameter(SqueezerPluginParameters::selAutoMakeupGain);
    updateParameter(SqueezerPluginParameters::selSidechainInput);
    updateParameter(SqueezerPluginParameters::selSidechainListen);

    // locate directory containing the skins
    SkinDirectory_ = SqueezerPluginParameters::getSkinDirectory();

    // apply skin to plug-in editor
    CurrentSkinName_ = PluginProcessor_->getParameterSkinName();
    loadSkin_();
}
Beispiel #7
0
void SqueezerAudioProcessorEditor::actionListenerCallback(
    const String &Message)
{
    // "PC" ==> parameter changed, followed by a hash and the
    // parameter's ID
    if (Message.startsWith("PC#"))
    {
        String StringIndex = Message.substring(3);
        int Index = StringIndex.getIntValue();
        jassert(Index >= 0);
        jassert(Index < PluginProcessor_->getNumParameters());

        if (PluginProcessor_->hasChanged(Index))
        {
            updateParameter(Index);
        }
    }
    // "UM" ==> update meters
    else if (!Message.compare("UM"))
    {
        // prevent meter updates during initialisation
        if (!IsInitialising_)
        {
            for (int Channel = 0; Channel < NumberOfChannels_; ++Channel)
            {
                float AverageInputLevel =
                    PluginProcessor_->getAverageMeterInputLevel(Channel);
                float MaximumInputLevel =
                    PluginProcessor_->getMaximumInputLevel(Channel);

                float PeakInputLevel =
                    PluginProcessor_->getPeakMeterInputLevel(Channel);
                float PeakInputPeakLevel =
                    PluginProcessor_->getPeakMeterPeakInputLevel(Channel);

                InputLevelMeters_[Channel]->setLevels(
                    AverageInputLevel, MaximumInputLevel,
                    PeakInputLevel, PeakInputPeakLevel);

                float AverageOutputLevel =
                    PluginProcessor_->getAverageMeterOutputLevel(Channel);
                float MaximumOutputLevel =
                    PluginProcessor_->getMaximumOutputLevel(Channel);

                float PeakOutputLevel =
                    PluginProcessor_->getPeakMeterOutputLevel(Channel);
                float PeakOutputPeakLevel =
                    PluginProcessor_->getPeakMeterPeakOutputLevel(Channel);

                OutputLevelMeters_[Channel]->setLevels(
                    AverageOutputLevel, MaximumOutputLevel,
                    PeakOutputLevel, PeakOutputPeakLevel);

                float GainReduction =
                    PluginProcessor_->getGainReduction(Channel);
                float GainReductionMeterPeak =
                    PluginProcessor_->getGainReductionMeterPeak(Channel);

                // make sure gain reduction meter doesn't show anything
                // while there is no gain reduction
                GainReduction -= 0.01f;
                GainReductionMeterPeak -= 0.01f;

                GainReductionMeters_[Channel]->setNormalLevels(
                    GainReduction, GainReductionMeterPeak);
            }
        }
    }
    else
    {
        DBG("[Squeezer] Received unknown action message \"" + Message + "\".");
    }
}
Beispiel #8
0
void ParameterManager::setParameterFilters(StringParameter *param, const std::string &filters)
{
    // abuse Minumum for filters
    param->setMinimum(filters);
    updateParameter(param->getName(), param, nullptr, Parameter::Minimum);
}
Beispiel #9
0
void SwirlFilter::setAngle(float angle) {
	_angle = angle;
	updateParameter("angle", angle);
}
Beispiel #10
0
void SwirlFilter::setRadius(float radius) {
	_radius = radius;
	updateParameter("radius", radius);
}
Beispiel #11
0
void Transformation::update()
{
    updateParameter();
    updateMatrix();
}