void TrackEffects::populateAuxForTrack(AudioTrack* t)/*{{{*/ { if (t && t->hasAuxSend()) { AuxProxy *proxy = new AuxProxy(t); int idx = 0; QHash<qint64, AuxInfo>::const_iterator iter = t->auxSends()->constBegin(); while (iter != t->auxSends()->constEnd()) { Track* at = song->findTrackByIdAndType(iter.key(), Track::AUDIO_AUX); if(at) { //qDebug("Adding AUX to strip: Name: %s, tid: %lld, auxId: %lld", at->name().toUtf8().constData(), at->id(), iter.key()); DoubleLabel* al; QLabel* nl; Knob* ak = addAuxKnob(proxy, iter.key(), at->name(), &al, &nl); proxy->auxIndexList[idx] = iter.key(); proxy->auxKnobList[iter.key()] = ak; proxy->auxLabelList[iter.key()] = al; proxy->auxNameLabelList[iter.key()] = nl; ak->setId(idx); al->setId(idx); double val = fast_log10(t->auxSend(iter.key()))*20.0; ak->setValue(val); al->setValue(val); ++idx; } ++iter; } m_proxy.insert(t->id(), proxy); } }/*}}}*/
Knob *SimpleGui::addKnob(string name, float &value, float min, float max) { Knob *k = (Knob*)INSTANTIATE_WITH_ID("knob", name); if(value<min) value = min; if(value>max) value = max; k->pointToValue(&value); k->min = min; k->max = max; k->width = SIMPLE_GUI_WIDTH; k->height = SIMPLE_GUI_WIDTH; //k->showValue = true; gui->addChild(k); return k; }
void AppendClip::knobs(Knob_Callback f) { Int_knob( f, &fadeIn, "fadeIn", "Fade In"); Text_knob( f, "frames"); Int_knob( f, &fadeOut, "fadeOut", "Fade Out"); Text_knob( f, "frames"); Int_knob( f, &crossDis, "dissolve", "Cross Dissolve"); Text_knob( f, "frames"); Int_knob( f, &firstFrame, "firstFrame", "First Frame"); SetFlags(f, Knob::EARLY_STORE); Knob* k = Int_knob(f, 0, "lastFrame", "Last Frame"); if (k) k->disable(); }
stereoEnhancerControlDialog::stereoEnhancerControlDialog( stereoEnhancerControls * _controls ) : EffectControlDialog( _controls ) { QHBoxLayout * l = new QHBoxLayout( this ); Knob * widthKnob = new Knob( knobBright_26, this ); widthKnob->setModel( &_controls->m_widthModel ); widthKnob->setLabel( tr( "WIDE" ) ); widthKnob->setHintText( tr( "Width:" ) , "samples" ); l->addWidget( widthKnob ); this->setLayout(l); }
void OutputEffectInstance::createWriterPath() { ///Make sure that the file path exists KnobPtr fileParam = getKnobByName(kOfxImageEffectFileParamName); if (fileParam) { Knob<std::string>* isString = dynamic_cast<Knob<std::string>*>( fileParam.get() ); if (isString) { std::string pattern = isString->getValue(); std::string path = SequenceParsing::removePath(pattern); std::map<std::string, std::string> env; getApp()->getProject()->getEnvironmentVariables(env); Project::expandVariable(env, path); if ( !path.empty() ) { QDir().mkpath( QString::fromUtf8( path.c_str() ) ); } } } }
void KnobGui::onSetValueUsingUndoStack(const Variant & v, ViewSpec /*view*/, int dim) { KnobPtr knob = getKnob(); Knob<int>* isInt = dynamic_cast<Knob<int>*>( knob.get() ); Knob<bool>* isBool = dynamic_cast<Knob<bool>*>( knob.get() ); Knob<double>* isDouble = dynamic_cast<Knob<double>*>( knob.get() ); Knob<std::string>* isString = dynamic_cast<Knob<std::string>*>( knob.get() ); if (isInt) { pushUndoCommand( new KnobUndoCommand<int>(shared_from_this(), isInt->getValue(dim), v.toInt(), dim) ); } else if (isBool) { pushUndoCommand( new KnobUndoCommand<bool>(shared_from_this(), isBool->getValue(dim), v.toBool(), dim) ); } else if (isDouble) { pushUndoCommand( new KnobUndoCommand<double>(shared_from_this(), isDouble->getValue(dim), v.toDouble(), dim) ); } else if (isString) { pushUndoCommand( new KnobUndoCommand<std::string>(shared_from_this(), isString->getValue(dim), v.toString().toStdString(), dim) ); } }
void KnobGui::onSetKeyActionTriggered() { QAction* action = qobject_cast<QAction*>( sender() ); assert(action); int dim = action->data().toInt(); KnobPtr knob = getKnob(); assert( knob->getHolder()->getApp() ); //get the current time on the global timeline SequenceTime time = knob->getHolder()->getApp()->getTimeLine()->currentFrame(); AddKeysCommand::KeysToAddList toAdd; KnobGuiPtr thisShared = shared_from_this(); for (int i = 0; i < knob->getDimension(); ++i) { if ( (dim == -1) || (i == dim) ) { std::list<boost::shared_ptr<CurveGui> > curves = getGui()->getCurveEditor()->findCurve(thisShared, i); for (std::list<boost::shared_ptr<CurveGui> >::iterator it = curves.begin(); it != curves.end(); ++it) { AddKeysCommand::KeyToAdd keyToAdd; KeyFrame kf; kf.setTime(time); Knob<int>* isInt = dynamic_cast<Knob<int>*>( knob.get() ); Knob<bool>* isBool = dynamic_cast<Knob<bool>*>( knob.get() ); AnimatingKnobStringHelper* isString = dynamic_cast<AnimatingKnobStringHelper*>( knob.get() ); Knob<double>* isDouble = dynamic_cast<Knob<double>*>( knob.get() ); if (isInt) { kf.setValue( isInt->getValue(i) ); } else if (isBool) { kf.setValue( isBool->getValue(i) ); } else if (isDouble) { kf.setValue( isDouble->getValue(i) ); } else if (isString) { std::string v = isString->getValue(i); double dv; isString->stringToKeyFrameValue(time, ViewIdx(0), v, &dv); kf.setValue(dv); } keyToAdd.keyframes.push_back(kf); keyToAdd.curveUI = *it; keyToAdd.knobUI = thisShared; keyToAdd.dimension = i; toAdd.push_back(keyToAdd); } } } pushUndoCommand( new AddKeysCommand(getGui()->getCurveEditor()->getCurveWidget(), toAdd) ); }
BassBoosterControlDialog::BassBoosterControlDialog( BassBoosterControls* controls ) : EffectControlDialog( controls ) { setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); setFixedSize( 120, 104 ); QVBoxLayout * tl = new QVBoxLayout( this ); tl->addSpacing( 30 ); QHBoxLayout * l = new QHBoxLayout; Knob * freqKnob = new Knob( knobBright_26, this); freqKnob->setModel( &controls->m_freqModel ); freqKnob->setLabel( tr( "FREQ" ) ); freqKnob->setHintText( tr( "Frequency:" ) + " ", "Hz" ); Knob * gainKnob = new Knob( knobBright_26, this ); gainKnob->setModel( &controls->m_gainModel ); gainKnob->setLabel( tr( "GAIN" ) ); gainKnob->setHintText( tr( "Gain:" ) + " ", "" ); Knob * ratioKnob = new Knob( knobBright_26, this ); ratioKnob->setModel( &controls->m_ratioModel ); ratioKnob->setLabel( tr( "RATIO" ) ); ratioKnob->setHintText( tr( "Ratio:" ) + " ", "" ); l->addWidget( freqKnob ); l->addWidget( gainKnob ); l->addWidget( ratioKnob ); tl->addLayout( l ); setLayout( tl ); }
TripleOscillatorView::TripleOscillatorView( Instrument * _instrument, QWidget * _parent ) : InstrumentView( _instrument, _parent ) { setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); const int mod_x = 66; const int mod1_y = 58; const int mod2_y = 75; const int osc_y = 109; const int osc_h = 52; // TODO: clean rewrite using layouts and all that... PixmapButton * pm_osc1_btn = new PixmapButton( this, NULL ); pm_osc1_btn->move( mod_x, mod1_y ); pm_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_active" ) ); pm_osc1_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_inactive" ) ); ToolTip::add( pm_osc1_btn, tr( "Use phase modulation for " "modulating oscillator 1 with " "oscillator 2" ) ); PixmapButton * am_osc1_btn = new PixmapButton( this, NULL ); am_osc1_btn->move( mod_x + 35, mod1_y ); am_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "am_active" ) ); am_osc1_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "am_inactive" ) ); ToolTip::add( am_osc1_btn, tr( "Use amplitude modulation for " "modulating oscillator 1 with " "oscillator 2" ) ); PixmapButton * mix_osc1_btn = new PixmapButton( this, NULL ); mix_osc1_btn->move( mod_x + 70, mod1_y ); mix_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_active" ) ); mix_osc1_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_inactive" ) ); ToolTip::add( mix_osc1_btn, tr( "Mix output of oscillator 1 & 2" ) ); PixmapButton * sync_osc1_btn = new PixmapButton( this, NULL ); sync_osc1_btn->move( mod_x + 105, mod1_y ); sync_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sync_active" ) ); sync_osc1_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "sync_inactive" ) ); ToolTip::add( sync_osc1_btn, tr( "Synchronize oscillator 1 with " "oscillator 2" ) ); PixmapButton * fm_osc1_btn = new PixmapButton( this, NULL ); fm_osc1_btn->move( mod_x + 140, mod1_y ); fm_osc1_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_active" ) ); fm_osc1_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_inactive" ) ); ToolTip::add( fm_osc1_btn, tr( "Use frequency modulation for " "modulating oscillator 1 with " "oscillator 2" ) ); m_mod1BtnGrp = new automatableButtonGroup( this ); m_mod1BtnGrp->addButton( pm_osc1_btn ); m_mod1BtnGrp->addButton( am_osc1_btn ); m_mod1BtnGrp->addButton( mix_osc1_btn ); m_mod1BtnGrp->addButton( sync_osc1_btn ); m_mod1BtnGrp->addButton( fm_osc1_btn ); PixmapButton * pm_osc2_btn = new PixmapButton( this, NULL ); pm_osc2_btn->move( mod_x, mod2_y ); pm_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_active" ) ); pm_osc2_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "pm_inactive" ) ); ToolTip::add( pm_osc2_btn, tr( "Use phase modulation for " "modulating oscillator 2 with " "oscillator 3" ) ); PixmapButton * am_osc2_btn = new PixmapButton( this, NULL ); am_osc2_btn->move( mod_x + 35, mod2_y ); am_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "am_active" ) ); am_osc2_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "am_inactive" ) ); ToolTip::add( am_osc2_btn, tr( "Use amplitude modulation for " "modulating oscillator 2 with " "oscillator 3" ) ); PixmapButton * mix_osc2_btn = new PixmapButton( this, NULL ); mix_osc2_btn->move( mod_x + 70, mod2_y ); mix_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_active" ) ); mix_osc2_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "mix_inactive" ) ); ToolTip::add( mix_osc2_btn, tr("Mix output of oscillator 2 & 3" ) ); PixmapButton * sync_osc2_btn = new PixmapButton( this, NULL ); sync_osc2_btn->move( mod_x + 105, mod2_y ); sync_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sync_active" ) ); sync_osc2_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "sync_inactive" ) ); ToolTip::add( sync_osc2_btn, tr( "Synchronize oscillator 2 with " "oscillator 3" ) ); PixmapButton * fm_osc2_btn = new PixmapButton( this, NULL ); fm_osc2_btn->move( mod_x + 140, mod2_y ); fm_osc2_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_active" ) ); fm_osc2_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "fm_inactive" ) ); ToolTip::add( fm_osc2_btn, tr( "Use frequency modulation for " "modulating oscillator 2 with " "oscillator 3" ) ); m_mod2BtnGrp = new automatableButtonGroup( this ); m_mod2BtnGrp->addButton( pm_osc2_btn ); m_mod2BtnGrp->addButton( am_osc2_btn ); m_mod2BtnGrp->addButton( mix_osc2_btn ); m_mod2BtnGrp->addButton( sync_osc2_btn ); m_mod2BtnGrp->addButton( fm_osc2_btn ); for( int i = 0; i < NUM_OF_OSCILLATORS; ++i ) { int knob_y = osc_y + i * osc_h; // setup volume-knob Knob * vk = new Knob( knobStyled, this ); vk->setVolumeKnob( true ); vk->setFixedSize( 28, 35 ); vk->move( 6, knob_y ); vk->setHintText( tr( "Osc %1 volume:" ).arg( i+1 ), "%" ); vk->setWhatsThis( tr( "With this knob you can set the volume of " "oscillator %1. When setting a value of 0 the " "oscillator is turned off. Otherwise you can " "hear the oscillator as loud as you set it " "here.").arg( i+1 ) ); // setup panning-knob Knob * pk = new TripleOscKnob( this ); pk->move( 35, knob_y ); pk->setHintText( tr("Osc %1 panning:").arg( i + 1 ), "" ); pk->setWhatsThis( tr( "With this knob you can set the panning of the " "oscillator %1. A value of -100 means 100% " "left and a value of 100 moves oscillator-" "output right.").arg( i+1 ) ); // setup coarse-knob Knob * ck = new TripleOscKnob( this ); ck->move( 82, knob_y ); ck->setHintText( tr( "Osc %1 coarse detuning:" ).arg( i + 1 ) , " " + tr( "semitones" ) ); ck->setWhatsThis( tr( "With this knob you can set the coarse detuning of " "oscillator %1. You can detune the oscillator " "24 semitones (2 octaves) up and down. This is " "useful for creating sounds with a chord." ). arg( i + 1 ) ); // setup knob for left fine-detuning Knob * flk = new TripleOscKnob( this ); flk->move( 111, knob_y ); flk->setHintText( tr( "Osc %1 fine detuning left:" ). arg( i + 1 ), " " + tr( "cents" ) ); flk->setWhatsThis( tr( "With this knob you can set the fine detuning of " "oscillator %1 for the left channel. The fine-" "detuning is ranged between -100 cents and " "+100 cents. This is useful for creating " "\"fat\" sounds." ).arg( i + 1 ) ); // setup knob for right fine-detuning Knob * frk = new TripleOscKnob( this ); frk->move( 140, knob_y ); frk->setHintText( tr( "Osc %1 fine detuning right:" ). arg( i + 1 ), " " + tr( "cents" ) ); frk->setWhatsThis( tr( "With this knob you can set the fine detuning of " "oscillator %1 for the right channel. The " "fine-detuning is ranged between -100 cents " "and +100 cents. This is useful for creating " "\"fat\" sounds." ).arg( i+1 ) ); // setup phase-offset-knob Knob * pok = new TripleOscKnob( this ); pok->move( 188, knob_y ); pok->setHintText( tr( "Osc %1 phase-offset:" ). arg( i + 1 ), " " + tr( "degrees" ) ); pok->setWhatsThis( tr( "With this knob you can set the phase-offset of " "oscillator %1. That means you can move the " "point within an oscillation where the " "oscillator begins to oscillate. For example " "if you have a sine-wave and have a phase-" "offset of 180 degrees the wave will first go " "down. It's the same with a square-wave." ).arg( i+1 ) ); // setup stereo-phase-detuning-knob Knob * spdk = new TripleOscKnob( this ); spdk->move( 217, knob_y ); spdk->setHintText( tr("Osc %1 stereo phase-detuning:" ). arg( i + 1 ), " " + tr( "degrees" ) ); spdk->setWhatsThis( tr( "With this knob you can set the stereo phase-" "detuning of oscillator %1. The stereo phase-" "detuning specifies the size of the difference " "between the phase-offset of left and right " "channel. This is very good for creating wide " "stereo sounds." ).arg( i+1 ) ); int btn_y = 96 + i * osc_h; PixmapButton * sin_wave_btn = new PixmapButton( this, NULL ); sin_wave_btn->move( 128, btn_y ); sin_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "sin_shape_active" ) ); sin_wave_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "sin_shape_inactive" ) ); ToolTip::add( sin_wave_btn, tr( "Use a sine-wave for " "current oscillator." ) ); PixmapButton * triangle_wave_btn = new PixmapButton( this, NULL ); triangle_wave_btn->move( 143, btn_y ); triangle_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "triangle_shape_active" ) ); triangle_wave_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "triangle_shape_inactive" ) ); ToolTip::add( triangle_wave_btn, tr( "Use a triangle-wave " "for current oscillator." ) ); PixmapButton * saw_wave_btn = new PixmapButton( this, NULL ); saw_wave_btn->move( 158, btn_y ); saw_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "saw_shape_active" ) ); saw_wave_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "saw_shape_inactive" ) ); ToolTip::add( saw_wave_btn, tr( "Use a saw-wave for " "current oscillator." ) ); PixmapButton * sqr_wave_btn = new PixmapButton( this, NULL ); sqr_wave_btn->move( 173, btn_y ); sqr_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "square_shape_active" ) ); sqr_wave_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "square_shape_inactive" ) ); ToolTip::add( sqr_wave_btn, tr( "Use a square-wave for " "current oscillator." ) ); PixmapButton * moog_saw_wave_btn = new PixmapButton( this, NULL ); moog_saw_wave_btn->move( 188, btn_y ); moog_saw_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "moog_saw_shape_active" ) ); moog_saw_wave_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "moog_saw_shape_inactive" ) ); ToolTip::add( moog_saw_wave_btn, tr( "Use a moog-like saw-wave " "for current oscillator." ) ); PixmapButton * exp_wave_btn = new PixmapButton( this, NULL ); exp_wave_btn->move( 203, btn_y ); exp_wave_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "exp_shape_active" ) ); exp_wave_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "exp_shape_inactive" ) ); ToolTip::add( exp_wave_btn, tr( "Use an exponential " "wave for current oscillator." ) ); PixmapButton * white_noise_btn = new PixmapButton( this, NULL ); white_noise_btn->move( 218, btn_y ); white_noise_btn->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "white_noise_shape_active" ) ); white_noise_btn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "white_noise_shape_inactive" ) ); ToolTip::add( white_noise_btn, tr( "Use white-noise for " "current oscillator." ) ); PixmapButton * uwb = new PixmapButton( this, NULL ); uwb->move( 233, btn_y ); uwb->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "usr_shape_active" ) ); uwb->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "usr_shape_inactive" ) ); ToolTip::add( uwb, tr( "Use a user-defined " "waveform for current oscillator." ) ); automatableButtonGroup * wsbg = new automatableButtonGroup( this ); wsbg->addButton( sin_wave_btn ); wsbg->addButton( triangle_wave_btn ); wsbg->addButton( saw_wave_btn ); wsbg->addButton( sqr_wave_btn ); wsbg->addButton( moog_saw_wave_btn ); wsbg->addButton( exp_wave_btn ); wsbg->addButton( white_noise_btn ); wsbg->addButton( uwb ); m_oscKnobs[i] = OscillatorKnobs( vk, pk, ck, flk, frk, pok, spdk, uwb, wsbg ); } }
AnalogueGUI(const std::string& URI) { std::cout << "starting GUI" <<std::endl; int control_ports = p_n_ports - 3; //initialize sliders for (int i = 0; i < control_ports; i++) { if (isOSCType(i)) { scales[i] = manage(new OSCTypeComboBox()); } else if (isFilterType(i)) { scales[i] = manage(new FilterTypeComboBox()); } else if (isPower(i)) { scales[i] = manage(new Toggle()); } else if (isBypass(i)) { scales[i] = manage(new Toggle(true)); } else { Knob* knob = new Knob(p_port_meta[i].min, p_port_meta[i].max, p_port_meta[i].step); if (isEnvControl(i)) { // small knob->set_size(30); knob->set_radius(10); } else if (isModControl(i) || isEffect(i)) { // medium knob->set_radius(12.0); } scales[i] = manage(knob); } } //connect widgets to control ports (change control values when sliders are moved) for (int i = 0; i < control_ports; i++) { slot<void> slot1 = compose(bind<0>(mem_fun(*this, &AnalogueGUI::write_control), i + 3), mem_fun(*scales[i], &Changeable::get_value)); slot<void> slot2 = compose(bind<0>(mem_fun(*this, &AnalogueGUI::change_status_bar), i + 3), mem_fun(*scales[i], &Changeable::get_value)); scales[i]->connect(slot1); if (!isOSCType(i) && !isFilterType(i) && !isToggle(i)) { scales[i]->connect(slot2); } } //connect all faders to the 'notify' function to inform the plugin to recalculate /*for (int i = 0; i < control_ports; i++) { scales[i]->signal_value_changed().connect( mem_fun(*this, &AnalogueGUI::notify_param_change)); }*/ Table* block1 = manage(new Table(2,4)); block1->attach(*createOSC1(), 0, 1, 1, 2); block1->attach(*createFilter1(), 1, 2, 1, 2); block1->attach(*createAmp1(), 2, 3, 1, 2); block1->attach(*createLFO1(), 3, 4, 1, 2); block1->attach(*createLFO2(), 0, 1, 2, 3); block1->attach(*createOSC2(), 1, 2, 2, 3); block1->attach(*createFilter2(), 2, 3, 2, 3); block1->attach(*createAmp2(), 3, 4, 2, 3); mainBox.pack_start(*align(block1)); HBox* block3 = manage(new HBox()); block3->pack_start(*createFilter1Env()); block3->pack_start(*createFilter2Env()); block3->pack_start(*createAmp1Env()); block3->pack_start(*createAmp2Env()); mainBox.pack_start(*align(block3)); HBox* block4 = manage(new HBox()); block4->pack_start(*createNoise()); block4->pack_start(*createFlanger()); block4->pack_start(*createDelay()); block4->pack_start(*createReverb()); mainBox.pack_start(*align(block4)); HBox* header = manage(new HBox()); header->pack_start(*manage(new Image("analogue.png"))); header->pack_end(*scales[p_amp_output - 3]->get_widget()); header->set_border_width(5); mainBox.pack_start(*align(header)); mainBox.pack_end(statusbar); add(*align(&mainBox)); std::cout << "GUI ready" <<std::endl; }
void PasteUndoCommand::copyFrom(const KnobPtr& serializedKnob, bool isRedo) { KnobPtr internalKnob = _imp->knob.lock()->getKnob(); switch (_imp->type) { case eKnobClipBoardTypeCopyAnim: { internalKnob->beginChanges(); for (int i = 0; i < internalKnob->getDimension(); ++i) { if ( ( _imp->targetDimension == -1) || ( i == _imp->targetDimension) ) { boost::shared_ptr<Curve> fromCurve; if ( ( i == _imp->targetDimension) && ( _imp->fromDimension != -1) ) { fromCurve = serializedKnob->getCurve(ViewIdx(0), _imp->fromDimension); } else { fromCurve = serializedKnob->getCurve(ViewIdx(0), i); } if (!fromCurve) { continue; } internalKnob->cloneCurve(ViewIdx(0), i, *fromCurve); } } internalKnob->endChanges(); break; } case eKnobClipBoardTypeCopyValue: { Knob<int>* isInt = dynamic_cast<Knob<int>*>( internalKnob.get() ); Knob<bool>* isBool = dynamic_cast<Knob<bool>*>( internalKnob.get() ); Knob<double>* isDouble = dynamic_cast<Knob<double>*>( internalKnob.get() ); Knob<std::string>* isString = dynamic_cast<Knob<std::string>*>( internalKnob.get() ); Knob<int>* isFromInt = dynamic_cast<Knob<int>*>( serializedKnob.get() ); Knob<bool>* isFromBool = dynamic_cast<Knob<bool>*>( serializedKnob.get() ); Knob<double>* isFromDouble = dynamic_cast<Knob<double>*>( serializedKnob.get() ); Knob<std::string>* isFromString = dynamic_cast<Knob<std::string>*>( serializedKnob.get() ); internalKnob->beginChanges(); for (int i = 0; i < internalKnob->getDimension(); ++i) { if ( ( _imp->targetDimension == -1) || ( i == _imp->targetDimension) ) { if (isInt && isFromInt) { int f = (i == _imp->targetDimension && _imp->fromDimension != -1) ? isFromInt->getValue(_imp->fromDimension) : isFromInt->getValue(i); isInt->setValue(f, ViewIdx(0), i, eValueChangedReasonNatronInternalEdited, 0); } else if (isBool && isFromBool) { bool f = (i == _imp->targetDimension && _imp->fromDimension != -1) ? isFromBool->getValue(_imp->fromDimension) : isFromBool->getValue(i); isBool->setValue(f, ViewIdx(0), i, eValueChangedReasonNatronInternalEdited, 0); } else if (isDouble && isFromDouble) { double f = (i == _imp->targetDimension && _imp->fromDimension != -1) ? isFromDouble->getValue(_imp->fromDimension) : isFromDouble->getValue(i); isDouble->setValue(f, ViewIdx(0), i, eValueChangedReasonNatronInternalEdited, 0); } else if (isString && isFromString) { std::string f = (i == _imp->targetDimension && _imp->fromDimension != -1) ? isFromString->getValue(_imp->fromDimension) : isFromString->getValue(i); isString->setValue(f, ViewIdx(0), i, eValueChangedReasonNatronInternalEdited, 0); } } } internalKnob->endChanges(); break; } case eKnobClipBoardTypeCopyLink: { //bool useExpression = !KnobI::areTypesCompatibleForSlave(internalKnob.get(), serializedKnob.get()); internalKnob->beginChanges(); for (int i = 0; i < internalKnob->getDimension(); ++i) { if ( ( _imp->targetDimension == -1) || ( i == _imp->targetDimension) ) { if (isRedo) { if (_imp->fromDimension != -1) { internalKnob->slaveTo(i, serializedKnob, _imp->fromDimension); } else { internalKnob->slaveTo(i, serializedKnob, i); } } else { internalKnob->unSlave(i, false); } } } internalKnob->endChanges(); break; } } // switch } // redo
void MultipleKnobEditsUndoCommand::redo() { assert( !knobs.empty() ); KnobHolder* holder = knobs.begin()->first.lock()->getKnob()->getHolder(); if (holder) { holder->beginChanges(); } ///this is the first redo command, set values for (ParamsMap::iterator it = knobs.begin(); it != knobs.end(); ++it) { KnobGuiPtr knobUI = it->first.lock(); if (!knobUI) { continue; } KnobPtr knob = knobUI->getKnob(); if (!knob) { continue; } knob->beginChanges(); Knob<int>* isInt = dynamic_cast<Knob<int>*>( knob.get() ); Knob<bool>* isBool = dynamic_cast<Knob<bool>*>( knob.get() ); Knob<double>* isDouble = dynamic_cast<Knob<double>*>( knob.get() ); Knob<std::string>* isString = dynamic_cast<Knob<std::string>*>( knob.get() ); for (std::list<ValueToSet>::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { KeyFrame k; if (!firstRedoCalled) { if (isInt) { it2->oldValue.setValue( isInt->getValueAtTime(it2->time, it2->dimension) ); } else if (isBool) { it2->oldValue.setValue( isBool->getValueAtTime(it2->time, it2->dimension) ); } else if (isDouble) { it2->oldValue.setValue( isDouble->getValueAtTime(it2->time, it2->dimension) ); } else if (isString) { it2->oldValue.setValue( isString->getValueAtTime(it2->time, it2->dimension) ); } } if (it2->setKeyFrame) { bool keyAdded = false; bool refreshGui = it2->time == knob->getHolder()->getApp()->getTimeLine()->currentFrame(); if (isInt) { keyAdded = knobUI->setValueAtTime<int>(it2->dimension, it2->newValue.toInt(), it2->time, ViewIdx(0), &k, refreshGui, _reason); } else if (isBool) { keyAdded = knobUI->setValueAtTime<bool>(it2->dimension, it2->newValue.toBool(), it2->time, ViewIdx(0), &k, refreshGui, _reason); } else if (isDouble) { keyAdded = knobUI->setValueAtTime<double>(it2->dimension, it2->newValue.toDouble(), it2->time, ViewIdx(0), &k, refreshGui, _reason); } else if (isString) { keyAdded = knobUI->setValueAtTime<std::string>(it2->dimension, it2->newValue.toString().toStdString(), it2->time, ViewIdx(0), &k, refreshGui, _reason); } else { assert(false); } it2->setValueRetCode = keyAdded ? KnobHelper::eValueChangedReturnCodeKeyframeAdded : KnobHelper::eValueChangedReturnCodeKeyframeModified; } else { if (isInt) { it2->setValueRetCode = knobUI->setValue<int>(it2->dimension, it2->newValue.toInt(), &k, true, _reason); } else if (isBool) { it2->setValueRetCode = knobUI->setValue<bool>(it2->dimension, it2->newValue.toBool(), &k, true, _reason); } else if (isDouble) { it2->setValueRetCode = knobUI->setValue<double>(it2->dimension, it2->newValue.toDouble(), &k, true, _reason); } else if (isString) { it2->setValueRetCode = knobUI->setValue<std::string>(it2->dimension, it2->newValue.toString().toStdString(), &k, true, _reason); } else { assert(false); } if (!firstRedoCalled && !it2->setKeyFrame) { it2->time = knob->getCurrentTime(); } } } knob->endChanges(); } if (holder) { holder->endChanges(); } firstRedoCalled = true; } // redo
stereoMatrixControlDialog::stereoMatrixControlDialog( stereoMatrixControls * _controls ) : EffectControlDialog( _controls ) { setFixedSize( 160, 185 ); setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); Knob * llKnob = new Knob( knobBright_26, this ); llKnob->setModel( &_controls->m_llModel ); llKnob->setHintText( tr( "Left to Left Vol:" ) , "" ); llKnob->move( 10, 79 ); Knob * lrKnob = new Knob( knobBright_26, this ); lrKnob->setModel( &_controls->m_lrModel ); lrKnob->setHintText( tr( "Left to Right Vol:" ) , "" ); lrKnob->move( 48, 79 ); Knob * rlKnob = new Knob( knobBright_26, this ); rlKnob->setModel( &_controls->m_rlModel ); rlKnob->setHintText( tr( "Right to Left Vol:" ) , "" ); rlKnob->move( 85, 79 ); Knob * rrKnob = new Knob( knobBright_26, this ); rrKnob->setModel( &_controls->m_rrModel ); rrKnob->setHintText( tr( "Right to Right Vol:" ) , "" ); rrKnob->move( 123, 79 ); }
BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) : EffectControlDialog( controls ) { setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); setFixedSize( 181, 128 ); // labels QLabel * inLabel = new QLabel( tr( "IN" ), this ); inLabel->move( 24, 15 ); QLabel * outLabel = new QLabel( tr( "OUT" ), this ); outLabel->move( 139, 15 ); // input knobs Knob * inGain = new Knob( knobBright_26, this ); inGain->move( 16, 32 ); inGain->setModel( & controls->m_inGain ); inGain->setLabel( tr( "GAIN" ) ); inGain->setHintText( tr( "Input gain:" ) , " dBFS" ); Knob * inNoise = new Knob( knobBright_26, this ); inNoise->move( 14, 76 ); inNoise->setModel( & controls->m_inNoise ); inNoise->setLabel( tr( "NOISE" ) ); inNoise->setHintText( tr( "Input noise:" ) , "%" ); // output knobs Knob * outGain = new Knob( knobBright_26, this ); outGain->move( 138, 32 ); outGain->setModel( & controls->m_outGain ); outGain->setLabel( tr( "GAIN" ) ); outGain->setHintText( tr( "Output gain:" ) , " dBFS" ); Knob * outClip = new Knob( knobBright_26, this ); outClip->move( 138, 76 ); outClip->setModel( & controls->m_outClip ); outClip->setLabel( tr( "CLIP" ) ); outClip->setHintText( tr( "Output clip:" ) , "%" ); // leds LedCheckBox * rateEnabled = new LedCheckBox( "", this, tr( "Rate enabled" ), LedCheckBox::Green ); rateEnabled->move( 64, 14 ); rateEnabled->setModel( & controls->m_rateEnabled ); ToolTip::add( rateEnabled, tr( "Enable sample-rate crushing" ) ); LedCheckBox * depthEnabled = new LedCheckBox( "", this, tr( "Depth enabled" ), LedCheckBox::Green ); depthEnabled->move( 101, 14 ); depthEnabled->setModel( & controls->m_depthEnabled ); ToolTip::add( depthEnabled, tr( "Enable bit-depth crushing" ) ); // rate crushing knobs Knob * rate = new Knob( knobBright_26, this ); rate->move( 59, 32 ); rate->setModel( & controls->m_rate ); rate->setLabel( tr( "FREQ" ) ); rate->setHintText( tr( "Sample rate:" ) , " Hz" ); Knob * stereoDiff = new Knob( knobBright_26, this ); stereoDiff->move( 72, 76 ); stereoDiff->setModel( & controls->m_stereoDiff ); stereoDiff->setLabel( tr( "STEREO" ) ); stereoDiff->setHintText( tr( "Stereo difference:" ) , "%" ); // depth crushing knob Knob * levels = new Knob( knobBright_26, this ); levels->move( 92, 32 ); levels->setModel( & controls->m_levels ); levels->setLabel( tr( "QUANT" ) ); levels->setHintText( tr( "Levels:" ) , "" ); }
void VPiano::initExtraControllers() { QWidget *w = NULL; QCheckBox *chkbox = NULL; Knob *knob = NULL; QSpinBox *spin = NULL; QSlider *slider = NULL; QToolButton *button = NULL; foreach(const QString& s, m_extraControls) { QString lbl; int control = 0; int type = 0; int minValue = 0; int maxValue = 127; int defValue = 0; int value = 0; int size = 100; QString fileName; ExtraControl::decodeString( s, lbl, control, type, minValue, maxValue, defValue, size, fileName ); if (m_ctlState[m_channel].contains(control)) value = m_ctlState[m_channel][control]; else value = defValue; switch(type) { case 0: chkbox = new QCheckBox(this); if (dlgPreferences()->getStyledWidgets()) { chkbox->setStyle(m_dialStyle); } chkbox->setProperty(MIDICTLONVALUE, maxValue); chkbox->setProperty(MIDICTLOFFVALUE, minValue); chkbox->setChecked(bool(value)); connect(chkbox, SIGNAL(clicked(bool)), SLOT(slotControlClicked(bool))); w = chkbox; break; case 1: knob = new Knob(this); knob->setFixedSize(32, 32); knob->setStyle(dlgPreferences()->getStyledWidgets()? m_dialStyle : NULL); knob->setMinimum(minValue); knob->setMaximum(maxValue); knob->setValue(value); knob->setToolTip(QString::number(value)); knob->setDefaultValue(defValue); knob->setDialMode(Knob::LinearMode); connect(knob, SIGNAL(sliderMoved(int)), SLOT(slotExtraController(int))); w = knob; break; case 2: spin = new QSpinBox(this); spin->setMinimum(minValue); spin->setMaximum(maxValue); spin->setValue(value); connect(spin, SIGNAL(valueChanged(int)), SLOT(slotExtraController(int))); w = spin; break; case 3: slider = new QSlider(this); slider->setOrientation(Qt::Horizontal); slider->setFixedWidth(size); slider->setMinimum(minValue); slider->setMaximum(maxValue); slider->setToolTip(QString::number(value)); slider->setValue(value); connect(slider, SIGNAL(sliderMoved(int)), SLOT(slotExtraController(int))); w = slider; break; case 4: button = new QToolButton(this); button->setText(lbl); button->setProperty(MIDICTLONVALUE, maxValue); button->setProperty(MIDICTLOFFVALUE, minValue); connect(button, SIGNAL(clicked(bool)), SLOT(slotControlClicked(bool))); w = button; break; case 5: control = 255; button = new QToolButton(this); button->setText(lbl); button->setProperty(SYSEXFILENAME, fileName); button->setProperty(SYSEXFILEDATA, readSysexDataFile(fileName)); connect(button, SIGNAL(clicked(bool)), SLOT(slotControlClicked(bool))); w = button; break; default: w = NULL; } if (w != NULL) { if (!lbl.isEmpty() && type < 4) { QLabel *qlbl = new QLabel(lbl, this); qlbl->setMargin(TOOLBARLABELMARGIN); ui.toolBarExtra->addWidget(qlbl); //connect(qlbl, SIGNAL(destroyed(QObject*)), SLOT(slotDebugDestroyed(QObject*))); } w->setProperty(MIDICTLNUMBER, control); w->setFocusPolicy(Qt::NoFocus); ui.toolBarExtra->addWidget(w); //connect(w, SIGNAL(destroyed(QObject*)), SLOT(slotDebugDestroyed(QObject*))); } }
void organicInstrumentView::modelChanged() { organicInstrument * oi = castModel<organicInstrument>(); const float y=91.0f; const float rowHeight = 26.0f; const float x=53.0f; const float colWidth = 24.0f; m_numOscillators = oi->m_numOscillators; m_fx1Knob->setModel( &oi->m_fx1Model ); m_volKnob->setModel( &oi->m_volModel ); if( m_oscKnobs != NULL ) { delete[] m_oscKnobs; } m_oscKnobs = new OscillatorKnobs[ m_numOscillators ]; // Create knobs, now that we know how many to make for( int i = 0; i < m_numOscillators; ++i ) { // setup harmonic knob Knob * harmKnob = new organicKnob( this ); harmKnob->move( x + i * colWidth, y - rowHeight ); harmKnob->setObjectName( "harmKnob" ); connect( &oi->m_osc[i]->m_harmModel, SIGNAL( dataChanged() ), this, SLOT( updateKnobHint() ) ); // setup waveform-knob Knob * oscKnob = new organicKnob( this ); oscKnob->move( x + i * colWidth, y ); connect( &oi->m_osc[i]->m_oscModel, SIGNAL( dataChanged() ), this, SLOT( updateKnobHint() ) ); oscKnob->setHintText( tr( "Osc %1 waveform:" ).arg( i + 1 ) + " ", QString() ); // setup volume-knob Knob * volKnob = new Knob( knobStyled, this ); volKnob->setVolumeKnob( true ); volKnob->move( x + i * colWidth, y + rowHeight*1 ); volKnob->setFixedSize( 21, 21 ); volKnob->setHintText( tr( "Osc %1 volume:" ).arg( i + 1 ) + " ", "%" ); // setup panning-knob Knob * panKnob = new organicKnob( this ); panKnob->move( x + i * colWidth, y + rowHeight*2 ); panKnob->setHintText( tr("Osc %1 panning:").arg( i + 1 ) + " ", "" ); // setup knob for fine-detuning Knob * detuneKnob = new organicKnob( this ); detuneKnob->move( x + i * colWidth, y + rowHeight*3 ); detuneKnob->setHintText( tr( "Osc %1 stereo detuning" ).arg( i + 1 ) + " ", " " + tr( "cents" ) ); m_oscKnobs[i] = OscillatorKnobs( harmKnob, volKnob, oscKnob, panKnob, detuneKnob ); // Attach to models m_oscKnobs[i].m_harmKnob->setModel( &oi->m_osc[i]->m_harmModel ); m_oscKnobs[i].m_volKnob->setModel( &oi->m_osc[i]->m_volModel ); m_oscKnobs[i].m_oscKnob->setModel( &oi->m_osc[i]->m_oscModel ); m_oscKnobs[i].m_panKnob->setModel( &oi->m_osc[i]->m_panModel ); m_oscKnobs[i].m_detuneKnob->setModel( &oi->m_osc[i]->m_detuneModel ); } updateKnobHint(); }
BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) : EffectControlDialog( controls ) { setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); setFixedSize( 215, 120 ); // labels QLabel * inLabel = new QLabel( tr( "IN" ), this ); inLabel->move( 12, 10); QLabel * outLabel = new QLabel( tr( "OUT" ), this ); outLabel->move( 176, 10 ); // input knobs Knob * inGain = new Knob( knobBright_26, this ); inGain->move( 12, 25 ); inGain->setModel( & controls->m_inGain ); inGain->setLabel( tr( "GAIN" ) ); inGain->setHintText( tr( "Input Gain:" ) + " ", " dBV" ); Knob * inNoise = new Knob( knobBright_26, this ); inNoise->move( 12, 70 ); inNoise->setModel( & controls->m_inNoise ); inNoise->setLabel( tr( "NOIS" ) ); inNoise->setHintText( tr( "Input Noise:" ) + " ", "%" ); // output knobs Knob * outGain = new Knob( knobBright_26, this ); outGain->move( 176, 25 ); outGain->setModel( & controls->m_outGain ); outGain->setLabel( tr( "GAIN" ) ); outGain->setHintText( tr( "Output Gain:" ) + " ", " dBV" ); Knob * outClip = new Knob( knobBright_26, this ); outClip->move( 176, 70 ); outClip->setModel( & controls->m_outClip ); outClip->setLabel( tr( "CLIP" ) ); outClip->setHintText( tr( "Output Clip:" ) + " ", "%" ); // leds LedCheckBox * rateEnabled = new LedCheckBox( tr( "Rate" ), this, tr( "Rate Enabled" ), LedCheckBox::Green ); rateEnabled->move( 50, 30 ); rateEnabled->setModel( & controls->m_rateEnabled ); ToolTip::add( rateEnabled, tr( "Enable samplerate-crushing" ) ); LedCheckBox * depthEnabled = new LedCheckBox( tr( "Depth" ), this, tr( "Depth Enabled" ), LedCheckBox::Green ); depthEnabled->move( 50, 80 ); depthEnabled->setModel( & controls->m_depthEnabled ); ToolTip::add( depthEnabled, tr( "Enable bitdepth-crushing" ) ); // rate crushing knobs Knob * rate = new Knob( knobBright_26, this ); rate->move( 100, 20 ); rate->setModel( & controls->m_rate ); rate->setLabel( tr( "Rate" ) ); rate->setHintText( tr( "Sample rate:" ) + " ", " Hz" ); Knob * stereoDiff = new Knob( knobBright_26, this ); stereoDiff->move( 140, 20 ); stereoDiff->setModel( & controls->m_stereoDiff ); stereoDiff->setLabel( tr( "STD" ) ); stereoDiff->setHintText( tr( "Stereo difference:" ) + " ", "%" ); // depth crushing knob Knob * levels = new Knob( knobBright_26, this ); levels->move( 140, 70 ); levels->setModel( & controls->m_levels ); levels->setLabel( tr( "Levels" ) ); levels->setHintText( tr( "Levels:" ) + " ", "" ); }
MultitapEchoControlDialog::MultitapEchoControlDialog( MultitapEchoControls * controls ) : EffectControlDialog( controls ) { setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); setFixedSize( 245, 300 ); // graph widgets Graph * ampGraph = new Graph( this, Graph::BarStyle, 204, 105 ); Graph * lpGraph = new Graph( this, Graph::BarStyle, 204, 105 ); ampGraph->move( 30, 10 ); lpGraph->move( 30, 125 ); ampGraph->setModel( & controls->m_ampGraph ); lpGraph->setModel( & controls->m_lpGraph ); pal = QPalette(); pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap("graph_bg") ); ampGraph->setAutoFillBackground( true ); ampGraph->setPalette( pal ); ampGraph->setGraphColor( QColor( 11, 213, 86) ); ampGraph -> setMaximumSize( 204, 105 ); lpGraph->setAutoFillBackground( true ); lpGraph->setPalette( pal ); lpGraph->setGraphColor( QColor( 0, 200, 187) ); lpGraph -> setMaximumSize( 204, 105 ); // steps spinbox LcdSpinBox * steps = new LcdSpinBox( 2, this, "Steps" ); steps->move( 20, 245 ); steps->setModel( & controls->m_steps ); // knobs TempoSyncKnob * stepLength = new TempoSyncKnob( knobBright_26, this ); stepLength->move( 100, 245 ); stepLength->setModel( & controls->m_stepLength ); stepLength->setLabel( tr( "Length" ) ); stepLength->setHintText( tr( "Step length:" ) , " ms" ); Knob * dryGain = new Knob( knobBright_26, this ); dryGain->move( 150, 245 ); dryGain->setModel( & controls->m_dryGain ); dryGain->setLabel( tr( "Dry" ) ); dryGain->setHintText( tr( "Dry Gain:" ) , " dBFS" ); Knob * stages = new Knob( knobBright_26, this ); stages->move( 200, 245 ); stages->setModel( & controls->m_stages ); stages->setLabel( tr( "Stages" ) ); stages->setHintText( tr( "Lowpass stages:" ) , "x" ); // switch led LedCheckBox * swapInputs = new LedCheckBox( "Swap inputs", this, tr( "Swap inputs" ), LedCheckBox::Green ); swapInputs->move( 20, 275 ); swapInputs->setModel( & controls->m_swapInputs ); ToolTip::add( swapInputs, tr( "Swap left and right input channel for reflections" ) ); }
int main() { signal(SIGINT, sig_handler); LCD lcd; LED led; Knob knob; Button button; int knob_value = 0; bool button_value = false; char msg[18]; std::string ip; led.on(); while( (ip = get_ip("wlan0")).length() == 0 ) { lcd.clear(); lcd.write("looking for IP "); sleep(1); } led.off(); lcd.clear(); lcd.setCursor(0, 0); lcd.write("My IP Address:"); lcd.setCursor(1, 0); lcd.write(ip.c_str()); sleep(3); lcd.clear(); lcd.setCursor(0, 0); lcd.write(ip.c_str()); while( running == 0 ) { lcd.setCursor(1, 0); snprintf(msg, sizeof(msg), "knob: %d%% ", knob.percent()); lcd.write(msg); if( button.value() ) { led.on(); } else { led.off(); } if( (button_value != button.value()) || (knob.percent() != knob_value) ) { button_value = button.value(); knob_value = knob.percent(); // post( button_value, knob_value ); } usleep(100000); } return MRAA_SUCCESS; }
EqControlsDialog::EqControlsDialog( EqControls *controls ) : EffectControlDialog( controls ), m_controls( controls ) { setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "EqLayout1BG" ) ); setPalette( pal ); setFixedSize( 500, 500 ); QGridLayout *mainLayout = new QGridLayout( this ); EqSpectrumView *inSpec = new EqSpectrumView( &controls->m_inFftBands, this ); mainLayout->addWidget( inSpec, 0, 1, 1, 8 ); inSpec->setColor( QColor( 238, 154, 120, 80 ) ); EqSpectrumView *outSpec = new EqSpectrumView( &controls->m_outFftBands, this ); outSpec->setColor( QColor( 145, 205, 22, 80 ) ); mainLayout->addWidget( outSpec, 0, 1, 1, 8 ); m_parameterWidget = new EqParameterWidget( this , controls ); mainLayout->addWidget( m_parameterWidget, 0, 1, 1, 8 ); setBand( 0, &controls->m_hpActiveModel, &controls->m_hpFeqModel, &controls->m_hpResModel, 0, QColor(255 ,255, 255), tr( "HP" ) ,0,0, &controls->m_hp12Model, &controls->m_hp24Model, &controls->m_hp48Model,0,0,0); setBand( 1, &controls->m_lowShelfActiveModel, &controls->m_lowShelfFreqModel, &controls->m_lowShelfResModel, &controls->m_lowShelfGainModel, QColor(255 ,255, 255), tr( "Low Shelf" ), &controls->m_lowShelfPeakL , &controls->m_lowShelfPeakR,0,0,0,0,0,0 ); setBand( 2, &controls->m_para1ActiveModel, &controls->m_para1FreqModel, &controls->m_para1BwModel, &controls->m_para1GainModel, QColor(255 ,255, 255), tr( "Peak 1" ), &controls->m_para1PeakL, &controls->m_para1PeakR,0,0,0,0,0,0 ); setBand( 3, &controls->m_para2ActiveModel, &controls->m_para2FreqModel, &controls->m_para2BwModel, &controls->m_para2GainModel, QColor(255 ,255, 255), tr( "Peak 2" ), &controls->m_para2PeakL, &controls->m_para2PeakR,0,0,0,0,0,0 ); setBand( 4, &controls->m_para3ActiveModel, &controls->m_para3FreqModel, &controls->m_para3BwModel, &controls->m_para3GainModel, QColor(255 ,255, 255), tr( "Peak 3" ), &controls->m_para3PeakL, &controls->m_para3PeakR,0,0,0,0,0,0 ); setBand( 5, &controls->m_para4ActiveModel, &controls->m_para4FreqModel, &controls->m_para4BwModel, &controls->m_para4GainModel, QColor(255 ,255, 255), tr( "Peak 4" ), &controls->m_para4PeakL, &controls->m_para4PeakR,0,0,0,0,0,0 ); setBand( 6, &controls->m_highShelfActiveModel, &controls->m_highShelfFreqModel, &controls->m_highShelfResModel, &controls->m_highShelfGainModel, QColor(255 ,255, 255), tr( "High Shelf" ), &controls->m_highShelfPeakL, &controls->m_highShelfPeakR,0,0,0,0,0,0 ); setBand( 7, &controls->m_lpActiveModel, &controls->m_lpFreqModel, &controls->m_lpResModel, 0, QColor(255 ,255, 255), tr( "LP" ) ,0,0,0,0,0, &controls->m_lp12Model, &controls->m_lp24Model, &controls->m_lp48Model); EqFader *inGainFader = new EqFader( &controls->m_inGainModel, tr( "In Gain" ), this, &controls->m_inPeakL, &controls->m_inPeakR ); mainLayout->addWidget( inGainFader, 0, 0 ); inGainFader->setDisplayConversion( false ); inGainFader->setHintText( tr( "Gain" ), "dBFS"); EqFader *outGainFader = new EqFader( &controls->m_outGainModel, tr( "Out Gain" ), this, &controls->m_outPeakL, &controls->m_outPeakR ); mainLayout->addWidget( outGainFader, 0, 9 ); outGainFader->setDisplayConversion( false ); outGainFader->setHintText( tr( "Gain" ), "dBFS" ); // Gain Fader for each Filter exepts the pass filter for( int i = 1; i < m_parameterWidget->bandCount() - 1; i++ ) { EqFader *gainFader = new EqFader( m_parameterWidget->getBandModels( i )->gain, tr( "" ), this, m_parameterWidget->getBandModels( i )->peakL, m_parameterWidget->getBandModels( i )->peakR ); mainLayout->addWidget( gainFader, 2, i+1 ); mainLayout->setAlignment( gainFader, Qt::AlignHCenter ); gainFader->setMinimumHeight(80); gainFader->resize(gainFader->width() , 80); gainFader->setDisplayConversion( false ); gainFader->setHintText( tr( "Gain") , "dB"); } //Control Button and Knobs for each Band for( int i = 0; i < m_parameterWidget->bandCount() ; i++ ) { Knob *resKnob = new Knob( knobBright_26, this ); mainLayout->setRowMinimumHeight( 4, 33 ); mainLayout->addWidget( resKnob, 5, i + 1 ); mainLayout->setAlignment( resKnob, Qt::AlignHCenter ); resKnob->setVolumeKnob(false); resKnob->setModel( m_parameterWidget->getBandModels( i )->res ); if(i > 1 && i < 6) { resKnob->setHintText( tr( "Bandwidth: " ) , tr( " Octave" ) ); } else { resKnob->setHintText( tr( "Resonance : " ) , "" ); } Knob *freqKnob = new Knob( knobBright_26, this ); mainLayout->addWidget( freqKnob, 3, i+1 ); mainLayout->setAlignment( freqKnob, Qt::AlignHCenter ); freqKnob->setVolumeKnob( false ); freqKnob->setModel( m_parameterWidget->getBandModels( i )->freq ); freqKnob->setHintText( tr( "Frequency:" ), "Hz" ); // adds the Number Active buttons PixmapButton *activeNumButton = new PixmapButton( this, NULL ); activeNumButton->setCheckable(true); activeNumButton->setModel( m_parameterWidget->getBandModels( i )->active ); QString iconActiveFileName = "bandLabel" + QString::number(i+1) + "on"; QString iconInactiveFileName = "bandLabel" + QString::number(i+1); activeNumButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( iconActiveFileName.toLatin1() ) ); activeNumButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( iconInactiveFileName.toLatin1() ) ); mainLayout->addWidget( activeNumButton, 1, i+1 ); mainLayout->setAlignment( activeNumButton, Qt::AlignHCenter ); activeNumButton->setModel( m_parameterWidget->getBandModels( i )->active ); // adds the symbols active buttons PixmapButton *activeButton = new PixmapButton( this, NULL ); activeButton->setCheckable(true); activeButton->setModel( m_parameterWidget->getBandModels( i )->active ); switch (i) { case 0: activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveHP" ) ); activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveHPoff" ) ); break; case 1: activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveLS" ) ); activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveLSoff" ) ); break; case 6: activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveHS" ) ); activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveHSoff" ) ); break; case 7: activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveLP" ) ); activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveLPoff" ) ); break; default: activeButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActivePeak" ) ); activeButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActivePeakoff" ) ); } mainLayout->addWidget( activeButton, 7, i+1 ); mainLayout->setAlignment( activeButton, Qt::AlignHCenter); activeButton->setModel( m_parameterWidget->getBandModels( i )->active ); // Connects the knobs, Faders and buttons with the curve graphic QObject::connect( m_parameterWidget->getBandModels( i )->freq , SIGNAL( dataChanged() ), m_parameterWidget, SLOT ( updateHandle() ) ); if ( m_parameterWidget->getBandModels( i )->gain ) QObject::connect( m_parameterWidget->getBandModels( i )->gain, SIGNAL( dataChanged() ), m_parameterWidget, SLOT ( updateHandle() )); QObject::connect( m_parameterWidget->getBandModels( i )->res, SIGNAL( dataChanged() ), m_parameterWidget , SLOT ( updateHandle() ) ); QObject::connect( m_parameterWidget->getBandModels( i )->active, SIGNAL( dataChanged() ), m_parameterWidget , SLOT ( updateHandle() ) ); m_parameterWidget->changeHandle( i ); } // adds the buttons for Spectrum analyser on/off PixmapButton *inSpecB = new PixmapButton(this, NULL); inSpecB->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveAnalyse" ) ); inSpecB->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveAnalyseoff" ) ); inSpecB->setCheckable( true ); inSpecB->setModel( &controls->m_analyseInModel ); PixmapButton *outSpecB = new PixmapButton(this, NULL); outSpecB->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveAnalyse" ) ); outSpecB->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "ActiveAnalyseoff" ) ); outSpecB->setCheckable( true ); outSpecB->setModel( &controls->m_analyseOutModel ); mainLayout->addWidget( inSpecB, 1, 0 ); mainLayout->addWidget( outSpecB, 1, 9 ); mainLayout->setAlignment( inSpecB, Qt::AlignHCenter ); mainLayout->setAlignment( outSpecB, Qt::AlignHCenter ); //hp filter type PixmapButton *hp12Button = new PixmapButton( this , NULL ); hp12Button->setModel( m_parameterWidget->getBandModels( 0 )->hp12 ); hp12Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "12dB" ) ); hp12Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "12dBoff" ) ); PixmapButton *hp24Button = new PixmapButton( this , NULL ); hp24Button->setModel(m_parameterWidget->getBandModels( 0 )->hp24 ); hp24Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "24dB" ) ); hp24Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "24dBoff" ) ); PixmapButton *hp48Button = new PixmapButton( this , NULL ); hp48Button->setModel( m_parameterWidget->getBandModels(0)->hp48 ); hp48Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "48dB" ) ); hp48Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "48dBoff" ) ); //LP filter type PixmapButton *lp12Button = new PixmapButton( this , NULL ); mainLayout->addWidget( lp12Button, 2, 1 ); lp12Button->setModel( m_parameterWidget->getBandModels( 7 )->lp12 ); lp12Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "12dB" ) ); lp12Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "12dBoff" ) ); PixmapButton *lp24Button = new PixmapButton( this , NULL ); lp24Button->setModel( m_parameterWidget->getBandModels( 7 )->lp24 ); lp24Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "24dB" ) ); lp24Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "24dBoff" ) ); PixmapButton *lp48Button = new PixmapButton( this , NULL ); lp48Button->setModel( m_parameterWidget->getBandModels( 7 )->lp48 ); lp48Button->setActiveGraphic( PLUGIN_NAME::getIconPixmap( "48dB" ) ); lp48Button->setInactiveGraphic( PLUGIN_NAME::getIconPixmap( "48dBoff" ) ); // the curve has to change its appearance connect( m_parameterWidget->getBandModels( 0 )->hp12 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle())); connect( m_parameterWidget->getBandModels( 0 )->hp24 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle())); connect( m_parameterWidget->getBandModels( 0 )->hp48 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle())); connect( m_parameterWidget->getBandModels( 7 )->lp12 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle())); connect( m_parameterWidget->getBandModels( 7 )->lp24 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle())); connect( m_parameterWidget->getBandModels( 7 )->lp48 , SIGNAL ( dataChanged() ), m_parameterWidget, SLOT( updateHandle())); QVBoxLayout *hpGrpBtnLayout = new QVBoxLayout; hpGrpBtnLayout->addWidget( hp12Button ); hpGrpBtnLayout->addWidget( hp24Button ); hpGrpBtnLayout->addWidget( hp48Button ); QVBoxLayout *lpGrpBtnLayout = new QVBoxLayout; lpGrpBtnLayout->addWidget( lp12Button ); lpGrpBtnLayout->addWidget( lp24Button ); lpGrpBtnLayout->addWidget( lp48Button ); mainLayout->addLayout( hpGrpBtnLayout, 2, 1, Qt::AlignCenter ); mainLayout->addLayout( lpGrpBtnLayout, 2, 8, Qt::AlignCenter ); automatableButtonGroup *lpBtnGrp = new automatableButtonGroup(this,tr ( "lp grp" ) ); lpBtnGrp->addButton( lp12Button ); lpBtnGrp->addButton( lp24Button ); lpBtnGrp->addButton( lp48Button ); lpBtnGrp->setModel( &m_controls->m_lpTypeModel, false); automatableButtonGroup *hpBtnGrp = new automatableButtonGroup( this, tr( "hp grp" ) ); hpBtnGrp->addButton( hp12Button ); hpBtnGrp->addButton( hp24Button ); hpBtnGrp->addButton( hp48Button ); hpBtnGrp->setModel( &m_controls->m_hpTypeModel,false); mainLayout->setAlignment( Qt::AlignTop ); for (int i = 0 ; i < 10; i++) { mainLayout->setColumnMinimumWidth(i, 50); } mainLayout->setAlignment( inGainFader, Qt::AlignHCenter ); mainLayout->setAlignment( outGainFader, Qt::AlignHCenter ); mainLayout->setRowMinimumHeight( 0,200 ); mainLayout->setRowMinimumHeight( 1, 40 ); mainLayout->setRowMinimumHeight(6,15); mainLayout->setContentsMargins( 0, 11, 0, 0 ); mainLayout->setAlignment(inSpec, Qt::AlignCenter ); mainLayout->setAlignment(outSpec, Qt::AlignCenter ); QLabel *freqLabel = new QLabel( this ); freqLabel->setText("- " + tr( "Frequency")+ " -" ); freqLabel->move( 217 , 377 ); QLabel *resLabel1 = new QLabel( this ); resLabel1->setText("- " + tr( "Resonance")+ " -" ); resLabel1->move( 62 , 444 ); QLabel *resLabel2 = new QLabel( this ); resLabel2->setText("- " + tr( "Resonance")+ " -" ); resLabel2->move( 365 , 444 ); QLabel *bandWidthLabel = new QLabel( this ); bandWidthLabel->setText("- " + tr( "Bandwidth")+ " -" ); bandWidthLabel->move( 215 , 444 ); setLayout(mainLayout); }
void ABCReadGeo::knobs(Knob_Callback f) { // File knobs File_knob(f, &m_filename, "file", "file", Geo_File); Button(f, "Reload"); // Set up the common SourceGeo knobs. SourceGeo::knobs(f); // Timing knobs BeginGroup(f, "TimingGroup"); Enumeration_knob(f, &interpolate, interpolation_types, "interpolation"); Enumeration_knob(f, &timing, timing_types, "timing"); Int_knob(f, &m_first, "first"); Tooltip(f, "Frame of the first sample in the Alembic archive.\n" "You can change this to clamp the animation to a smaller framerange\n"); Int_knob(f, &m_last, "last"); Tooltip(f, "Frame of the last sample in the Alembic archive.\n" "You can change this to clamp the animation to a smaller framerange\n"); ClearFlags(f, Knob::STARTLINE); Float_knob(f, &m_frame, "frame"); Tooltip(f, "Frame the animation will be sampled from.\n" "You can set this to a static frame, an animated curve,\n" "or an expression like 'frame/2' to effectively retime the animation\n" "of the Alembic archive.\n\n" "This value will be clamped to the 'first' and 'last' values above."); ClearFlags(f, Knob::SLIDER); EndGroup(f); Divider(f); // Object management knobs Button(f, "activate_selection", "Activate sel."); Tooltip(f, "Activate selected objects\n"); Button(f, "deactivate_selection", "Dectivate sel."); Tooltip(f, "Deactivate selected objects\n"); Button(f, "bbox_selection", "Bbox sel."); Tooltip(f, "Set selected objects to bbox mode\n"); Button(f, "unbbox_selection", "UnBbox sel."); Tooltip(f, "Unset bbox mode for selected objects\n"); p_tableKnob = Table_knob(f, "Obj_list", "Object list"); SetFlags(f, Knob::STARTLINE); Tooltip(f, "List of objects in the Alembic archive.\n" "For each object, the following toggles are available:\n" "<b>Active:</b> Enable/disable that particular object. Disabled objects will not be read from the Alembic archive.\n" "<b>Bbox:</b> Choose whether to read the full geometry or just a bbox of each object.\n"); // Disable/enable "frame" knob based on choice in "timing" knob Knob* _pTimingKnob = knob("timing"); Knob* _pFrameKnob = knob("frame"); if (_pTimingKnob != NULL) { _pFrameKnob->visible(_pTimingKnob->get_value()!=0); } if (f.makeKnobs()) { p_tableKnobI = p_tableKnob->tableKnob(); p_tableKnobI->addStringColumn("name", "Obj Name", false, 216 /*column width*/); p_tableKnobI->addColumn("active", "Active", Table_KnobI::BoolColumn, true, 45); p_tableKnobI->addColumn("bbox", "BBox", Table_KnobI::BoolColumn, true, 45); } // Maintain a list of active and bbox booleans, so we don't have to use the tableKnob pointer in create_geometry if (p_tableKnob) { p_tableKnobI = p_tableKnob->tableKnob(); int numObjs = p_tableKnobI->getRowCount(); active_objs.resize(numObjs); bbox_objs.resize(numObjs); for (int i = 0; i < numObjs; i++) { active_objs[i] = p_tableKnobI->getCellBool(i,1); bbox_objs[i] = p_tableKnobI->getCellBool(i,2); } } }