void ControlLockAttitudeWidget::refreshControl()
{
    m_control.assign(1,-m_posY * m_horizontalSensitivity,m_posX * m_horizontalSensitivity,0);
    m_control.nomalize();
    //
    emit controlChanged();
}
Ejemplo n.º 2
0
void ContextPrivate::registerNode( QSharedPointer<fugio::NodeInterface> pNode )
{
	if( mNodeHash.contains( pNode->uuid() ) )
	{
		if( NodePrivate *NP = qobject_cast<NodePrivate *>( pNode->qobject() ) )
		{
			NP->setUuid( QUuid::createUuid() );
		}
	}

	pNode->setContext( this );

	mNodeHash.insert( pNode->uuid(), pNode );

	fugio::NodeSignals		*N = pNode->qobject();

	connect( N, SIGNAL(controlChanged(QSharedPointer<fugio::NodeInterface>)), this, SLOT(nodeControlChanged(QSharedPointer<fugio::NodeInterface>)) );
	connect( N, SIGNAL(nameChanged(QSharedPointer<fugio::NodeInterface>)), this, SLOT(nodeNameChanged(QSharedPointer<fugio::NodeInterface>)) );
	connect( N, SIGNAL(activationChanged(QSharedPointer<fugio::NodeInterface>)), this, SLOT(onNodeActivationChanged(QSharedPointer<fugio::NodeInterface>)) );

	connect( N, SIGNAL(pinAdded(QSharedPointer<fugio::NodeInterface>,QSharedPointer<fugio::PinInterface>)), this, SLOT(onPinAdded(QSharedPointer<fugio::NodeInterface>,QSharedPointer<fugio::PinInterface>)) );
	connect( N, SIGNAL(pinRemoved(QSharedPointer<fugio::NodeInterface>,QSharedPointer<fugio::PinInterface>)), this, SLOT(onPinRemoved(QSharedPointer<fugio::NodeInterface>,QSharedPointer<fugio::PinInterface>)) );

	addDeferredNode( pNode );

	mNodeDeferProcess = true;

	emit nodeAdded( pNode->uuid() );
}
Ejemplo n.º 3
0
void QEqualizerControl::setControlFrequency(double controlFrequency)
{
    _controlFrequency = controlFrequency;
    emit controlFrequencyChanged(_controlFrequency);
    emit controlFrequencyChanged((int)_controlFrequency);
    emit controlChanged();
}
Ejemplo n.º 4
0
void QEqualizerControl::setAmount(double amount)
{
    _amount = amount;
    emit amountChanged(_amount);
    emit amountChanged((int)_amount);
    emit controlChanged();
}
Ejemplo n.º 5
0
void NumberControl::setValue(float value) {
    // std::cerr<<"In setValue "<<_id<<value<<std::endl;
    if (fabs(_numberEditable->v - value) < 1e-5) return;
    _numberEditable->v = value;
    updateControl();
    emit controlChanged(_id);
}
void MidiControllerCheckBox::onToggled(bool checked)
{
  // emit the corresponding signal:
  if (!changingValue) {
      controlChanged(channel, controller, checked ? 127 : 0);
  }
}
Ejemplo n.º 7
0
void QEqualizerControl::setBandwidth(double bandwidth)
{
    _bandwidth = bandwidth;
    emit bandwidthChanged(_bandwidth);
    emit bandwidthChanged((int)_bandwidth);
    emit controlChanged();
}
Ejemplo n.º 8
0
void SeExprEdCurveControl::curveChanged()
{
    if(_curve && _curveEditable){
        _curveEditable->cvs=_curve->_scene->_cvs;
        emit controlChanged(_id);
    }
}
Ejemplo n.º 9
0
void SeExprEdAnimCurveControl::editGraphClicked(){
#ifdef SEEXPR_USE_ANIMLIB
    QDialog* dialog=new QDialog(this);
    CETool* tool=new CETool;
    animlib::AnimAttrID attr1("","");
    animlib::AnimCurve& anim=*new animlib::AnimCurve(attr1);
    anim=_editable->curve;
    
    QWidget *widg;
    tool->map(widg,0);
    QVBoxLayout* layout=new QVBoxLayout();
    dialog->resize(QSize(1024,640));
    dialog->setLayout(layout);
    layout->addWidget(widg);
    tool->addCurve(&anim);

    QDialogButtonBox* buttonbar=new QDialogButtonBox();
    buttonbar->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
    connect(buttonbar,SIGNAL(accepted()),dialog,SLOT(accept()));
    connect(buttonbar,SIGNAL(rejected()),dialog,SLOT(reject()));
    layout->addWidget(buttonbar);

    if(dialog->exec()==QDialog::Accepted){
        // copy points back from child
        _editable->curve=anim;
        _preview->sample(_editable->curve);
        _preview->repaint();
        emit controlChanged(_id);
    }
#endif
}
Ejemplo n.º 10
0
void QEqualizerControl::setQ(double q)
{
    _q = q;
    emit qChanged(_q);
    emit qChanged((int)_q);
    emit controlChanged();
}
Ejemplo n.º 11
0
void VectorControl::setValue(int n, float value) {
    if (n < 0 || n >= 3) return;
    if (fabs(_numberEditable->v[n] - value) < 1e-5) return;
    _numberEditable->v[n] = value;
    if (_swatch) _swatch->setValue(_numberEditable->v);
    updateControl();
    emit controlChanged(_id);
}
Ejemplo n.º 12
0
void TraktorF1MK2::processButtons(const Transfer& input_)
{
  bool shiftPressed(isButtonPressed(input_, Button::Shift));
  Device::Button changedButton(Device::Button::Unknown);
  bool buttonPressed(false);

  for (int i = 0; i < kF1MK2_buttonsDataSize - 1; i++) // Skip the last byte (encoder value)
  {
    for (int k = 0; k < 8; k++)
    {
      uint8_t btn = (i * 8) + k;
      Button currentButton(static_cast<Button>(btn));
      if (currentButton == Button::Shift)
      {
        continue;
      }
      buttonPressed = isButtonPressed(input_, currentButton);
      if (buttonPressed != m_buttonStates[btn])
      {
        m_buttonStates[btn] = buttonPressed;
        changedButton = deviceButton(currentButton);
        if (changedButton != Device::Button::Unknown)
        {
          if (currentButton >= Button::Pad8 && currentButton <= Button::Pad9)
          {
            keyChanged(btn, buttonPressed ? 1.0 : 0.0, shiftPressed);
          }
          else
          {
            buttonChanged(changedButton, buttonPressed, shiftPressed);
          }
        }
      }
    }
  }

  // encoder
  uint8_t currentValue = input_.data()[kF1MK2_buttonsDataSize];
  if (currentValue != m_encoderValue)
  {
    bool valueIncreased = ((static_cast<uint8_t>(m_encoderValue) < currentValue)
                            || ((m_encoderValue == 0xff) && (currentValue == 0x00)))
                          && (!((m_encoderValue == 0x0) && (currentValue == 0xff)));
    m_encoderValue = currentValue;
    encoderChanged(0, valueIncreased, shiftPressed);
  }

  // pots/faders
  for (uint8_t potIndex = 0, i = kF1MK2_buttonsDataSize + 1; potIndex < 8; i += 2, potIndex++)
  {
    unsigned value = (input_.data()[i]) | (input_.data()[i + 1] << 8);
    if (m_potentiometersValues[potIndex] != value)
    {
      m_potentiometersValues[potIndex] = value;
      controlChanged(potIndex, value / 1024.0, shiftPressed);
    }
  }
}
Ejemplo n.º 13
0
void AMSlitsView::setControl(AMSlits *newControl)
{
	if (slits_ != newControl) {
		slits_ = newControl;
		refresh();

		emit controlChanged(slits_);
	}
}
void BioXASCarbonFilterFarmView::setControl(BioXASCarbonFilterFarm *newControl)
{
	if (filterFarm_ != newControl) {
		filterFarm_ = newControl;
		refresh();

		emit controlChanged(filterFarm_);
	}
}
Ejemplo n.º 15
0
void AMExtendedControlEditor::setControl(AMControl *newControl)
{
	if (control_ != newControl) {

		if (control_) {

			// Disconnect from control.

			disconnect( control_, 0, this, 0 );
			disconnect( dialog_, 0, control_, 0 );

			control_ = 0;

			// Clear the frame title.

			if (!titleSetManually_)
				setTitleText("");
		}

		control_ = newControl;

		if (control_) {

			// Set the frame title.

			if (!titleSetManually_) {
				if (control_->description().isEmpty())
					setTitleText(control_->name());
				else
					setTitleText(control_->description());
			}

			// Set control values
			precision_ = control_->displayPrecision();
			maxValue_ = control_->maximumValue();
			minValue_ = control_->minimumValue();

			// Make connections.
			connect(control_, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged(double)));
			connect(control_, SIGNAL(unitsChanged(QString)), this, SLOT(onUnitsChanged(QString)));
			connect(control_, SIGNAL(connected(bool)), this, SLOT(onConnectedChanged()) );
			connect(control_, SIGNAL(movingChanged(bool)), this, SLOT(onMotion(bool)));
			connect(control_, SIGNAL(enumChanged()), this, SLOT(onControlEnumChanged()));
			connect(control_, SIGNAL(moveStarted()), this, SLOT(onControlMoveStarted()));

			if(!configureOnly_)
				connect(dialog_, SIGNAL(doubleValueSelected(double)), control_, SLOT(move(double)));
			else
				connect(dialog_, SIGNAL(doubleValueSelected(double)), this, SLOT(onNewSetpoint(double)));
		}

		onConnectedChanged();

		emit controlChanged(control_);
	}
}
Ejemplo n.º 16
0
void AnimCurveControl::refreshClicked() {
    if (callback) {
#ifdef SEEXPR_USE_ANIMLIB
        callback(_editable->link, _editable->curve);
        _preview->sample(_editable->curve);
        _preview->repaint();
        emit controlChanged(_id);
#endif
    }
}
Ejemplo n.º 17
0
void ColorSwatchControl::colorRemoved(int index) {
    if (_updating) return;
    if (index >= 0 && index < int(_swatchEditable->colors.size())) {
        _swatchEditable->remove(index);
        _swatch->deleteLater();
        _swatch = 0;
        buildSwatchWidget();
    }
    emit controlChanged(_id);
}
Ejemplo n.º 18
0
void ModControl::setupUi()
{
    QVBoxLayout* layout = new QVBoxLayout(this);

    ModDial* dial = new ModDial(title_, this, dockSize_);

    connect(dial, &ModDial::scaledValueChanged,
            [=] (double value)
    {
        emit controlChanged(value);
    });

    layout->addWidget(dial);

    ModDockUi* dock = new ModDockUi(dockSize_, wrap_, this);

    connect(dock, &ModDockUi::depthChanged,
            [=] (ModDockUi::index_t index, double value)
    {
        dial->setModArcValue(index, value);
        emit depthChanged(index, value);
    });

    connect(dock, &ModDockUi::modUnitInserted,
            [=] (ModDockUi::index_t index, const ModUnitUi& mod)
    {
        emit modUnitInserted(index, mod);
        dial->setModUnitUiForModArc(index, mod);
    });

    connect(dock, &ModDockUi::modUnitRemoved,
            [=] (ModDockUi::index_t index)
    {
        dial->removeModUnitUiForModArc(index);
        emit modUnitRemoved(index);
    });

    connect(dock, &ModDockUi::itemHovered,
            [=] (ModDockUi::index_t index)
    {
        dial->showModArc(index);
    });

    // Adding the dock in a grid layout centers
    // it in the parent layout
    QGridLayout* dockLayout = new QGridLayout;

    dockLayout->addWidget(dock);

    layout->addLayout(dockLayout);

    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    QWidget::setMouseTracking(true);
}
Ejemplo n.º 19
0
void BioXASZebraInputView::setControl(BioXASZebraInput *newControl)
{
	if (control_ != newControl) {

		if (control_) {
			disconnect( control_, 0, this, 0 );
		}

		control_ = newControl;

		if (control_) {
			connect( control_, SIGNAL(connected(bool)), this, SLOT(refresh()) );
			connect( control_, SIGNAL(inputValueChanged(int)), this, SLOT(updateInputBox()) );
			connect( control_, SIGNAL(inputValueStringChanged(QString)), this, SLOT(updateInputLabel()) );
			connect( control_, SIGNAL(inputStateChanged(double)), this, SLOT(updateInputStatusLabel()) );
		}

		refresh();

		emit controlChanged(control_);
	}
}
Ejemplo n.º 20
0
void MidiOutputHandler::update() {
    controlChanged(m_cobj.get());
}
Ejemplo n.º 21
0
void ColorSwatchControl::colorAdded(int index, SeExpr2::Vec3d value) {
    if (_updating) return;
    if (index >= 0 && index <= int(_swatchEditable->colors.size()))
        _swatchEditable->add(value);  // add to end; TODO insert
    emit controlChanged(_id);
}
Ejemplo n.º 22
0
void ColorSwatchControl::colorChanged(int index, SeExpr2::Vec3d value) {
    if (_updating) return;
    if (index >= 0 && index < int(_swatchEditable->colors.size())) _swatchEditable->change(index, value);
    emit controlChanged(_id);
}
Ejemplo n.º 23
0
void DeepWaterControl::deepWaterChanged() {
    if (_deepWater && _deepWaterEditable) {
        _deepWaterEditable->params = _deepWater->_scene->params;
        emit controlChanged(_id);
    }
}
Ejemplo n.º 24
0
void SeExprEdStringControl::textChanged(const QString& newText)
{
    if(_updating) return;
    _stringEditable->v=newText.toStdString();
    emit controlChanged(_id);
}
Ejemplo n.º 25
0
void SeExprEdControlCollection::
singleControlChanged(int id)
{
    emit controlChanged(id);
}
Ejemplo n.º 26
0
void MidiInterface::midiCallback(double deltatime, std::vector< unsigned char > *message)
{
    (void)deltatime;
    unsigned char command = message->at(0);
    quint8 channel = command & 0x0f;
    if ((command&0xf0) != 0xf0) // if it is NOT a System message
    {
        command &= 0xf0; // It removes channel from MIDI message
    }

    switch(command) {
    case MIDI_CVM_NOTE_OFF:
        if(_acceptNoteChange)
            emit noteChanged(_id, quint8 (channel), quint8 (message->at(1)), false, quint8(message->at(2)));
        break;
    case MIDI_CVM_NOTE_ON:
        if(_acceptNoteChange)
            emit noteChanged(_id, quint8 (channel), quint8 (message->at(1)), true, quint8(message->at(2)));
        break;
    case MIDI_CVM_CONTROL_CHANGE:
        if(_acceptControlChange)
            emit controlChanged(_id, quint8 (channel), quint8 (message->at(1)), quint8(message->at(2)));
        break;
    case MIDI_CVM_PROGRAM_CHANGE:
        if(_acceptProgramChange)
            emit programChanged(_id, quint8 (channel), quint8 (message->at(1)));
        break;
    case MIDI_SRTM_CLOCK: emit clockReceived(); break;
    case MIDI_SRTM_STOP: emit stopReceived(); break;
    case MIDI_SRTM_START: emit startReceived(); break;
    case MIDI_SRTM_CONTINUE: emit continueReceived(); break;
    case MIDI_SCM_SYSEX:
    {
        bool sysex_reconized = false;
        if (message->size() > 13)
        {
            if((message->at(1) == SYSEX_NON_REALTIME_MESSAGE)
                    && (message->at(3) == SYSEX_GENERAL_INFORMATION)
                    && (message->at(4) == SYSEX_IDENTITY_REPLY))
            {
                sysex_reconized = true;
                // Grab Manufacturer ID
                quint32 manufacturer_id;
                manufacturer_id = message->at(5);
                if(manufacturer_id == 0) // if use a long manufacturer ID
                {
                    manufacturer_id = message->at(6) << 16;
                    manufacturer_id = message->at(7) << 8;
                }

                QString description;
                switch (manufacturer_id)
                {
                case MIDI_MANUFACTURER_ID__KORG:
                {
                    description += "Manufacturer: Korg\n";
                    quint16 family_id = message->at(6) | (message->at(7) << 8);
                    switch(family_id)
                    {
                    case MIDI_KORG_FAMILY_ID__NANOKONTROL:
                        description += "Model: nanoKontrol\n";
                        break;
                    case MIDI_KORG_FAMILY_ID__NANOKONTROL2:
                        description += "Model: nanoKontrol2\n";
                        break;
                    default:
                        break;
                    }
                    quint16 minor_version = message->at(10) | (message->at(11) << 8);
                    quint16 major_version = message->at(12) | (message->at(13) << 8);
                    description += QString("Version: %1.%2\n").arg(major_version).arg(minor_version);
                    qDebug() << Q_FUNC_INFO << description.replace('\n', ' ');
                    _description = description;
                }
                    break;
                default:
                    qDebug() << Q_FUNC_INFO
                             << "Unknown MIDI Manufacturer ID:" << manufacturer_id;
                    break;
                }
            }
        }
        else if (message->size() == 11)
        {
            // HACK to use Korg nanoKontrol scene button in order to change master view
            if((message->at(1) == KORG_SYSEX_HEADER) && (message->at(8) == KORG_SYSEX__SCENE_CHANGED))
            {
                // message->at(2) == 0x40 // 4g where g is Global Channel
                // Software Project (nanoKontrol 1) (4 bytes)
                // message->at(3) == 0x00
                // message->at(4) == 0x01
                // message->at(5) == 0x04
                // message->at(6) == 0x00

                // message->at(7) == 0x5f // Data Dump Command  (Host<-Controller, 2Bytes Format)
                // message->at(8) == 0x4f // Not documented but seems to be "Screen changed"
                // message->at(9) stores scene ID (0x00 -> Scene 1, ... , 0x03 -> Scene 4

                // This SysEx is emitted by Korg nanoKontrol 1 when scene changed
                sysex_reconized = true;
                emit programChanged(_id, quint8 (channel), quint8 (message->at(9)));
            }
        }

        if(!sysex_reconized)
        {
            QString msg;
            for(uint i=0; i<message->size(); ++i)
            {
                msg += QString("%1 ").arg(message->at(i), 0, 16);
            }
            qDebug() << Q_FUNC_INFO
                     << "Unknown sysex received: size=" << message->size() << "content=[" << msg << "]";
            //Q_ASSERT(false);
        }
    }
        break;
    default:
        qDebug() << Q_FUNC_INFO
                 << QString("no handler for: %1 (%2)").arg(command).arg(command, 0, 16)
                 << "message size:" << message->size()
                 << "deltatime:" << deltatime;
    }
}
Ejemplo n.º 27
0
void QEqualizerControl::setControlType(ControlType controlType)
{
    _controlType = controlType;
    emit controlTypeChanged(_controlType);
    emit controlChanged();
}