void App::run() { // startVoice(); startListen(m_pipelineIn, 5000); // TODO settings m_pipelineOut->setState(QGst::StatePlaying); m_pipelineIn->setState(QGst::StatePlaying); QTimer::singleShot(2000, this, SLOT(testSlot())); QTimer::singleShot(4000, this, SLOT(testSlot2())); }
void AudioInSettings::restoreDefaults() { if (!m_testDisabled) testSlot(); enableInBox->setChecked(true); freqSpin->setValue(440); m_intervalSpin->setValue(0); m_inDeviceCombo->setCurrentIndex(0); m_methodCombo->setCurrentIndex(2); volumeSlider->setValue(0.4); // It is multiplied by 100 durationSpin->setValue(150); m_intonationCombo->setCurrentIndex(3); // normal adjustInstrSlot((int)e_classicalGuitar); }
UnsignedDerivedImage::UnsignedDerivedImage(ImagePtr base) : Image(base->getUid()+"_u", vtkImageDataPtr(), base->getName()) { this->mBase = base; // redirected signals: connect(base.get(), SIGNAL(transformChanged()), this, SIGNAL(transformChanged())); connect(base.get(), SIGNAL(propertiesChanged()), this, SIGNAL(propertiesChanged())); connect(base.get(), SIGNAL(clipPlanesChanged()), this, SIGNAL(clipPlanesChanged())); connect(base.get(), SIGNAL(cropBoxChanged()), this, SIGNAL(cropBoxChanged())); // override signals: connect(base.get(), SIGNAL(transferFunctionsChanged()), this, SLOT(unsignedTransferFunctionsChangedSlot())); connect(base.get(), SIGNAL(vtkImageDataChanged()), this, SLOT(unsignedImageChangedSlot())); connect(this, SIGNAL(transferFunctionsChanged()), this, SLOT(testSlot())); this->unsignedImageChangedSlot(); this->unsignedTransferFunctionsChangedSlot(); }
bool TankEngine::storeTSRS ( const TSRSExt& pTsrs ) { if(testTankCID ( pTsrs )&& testFillOrderAndSection ( pTsrs )&& testRack(pTsrs ) && testSlot(pTsrs)) { sli.initialize(); if( setTankExt(pTsrs ) ) { // if( setFillOrderAndSection( pTsrs.fillOrder, pTsrs.section )) if( setFillOrderAndSection( pTsrs )) { if( setRack(pTsrs.rack )) { if( setSlot(pTsrs.slot)) { selectSlot(pTsrs ); return true; }else { sli.initialize(); return false; } }else { sli.initialize(); return false; } }else { sli.initialize(); return false; } }else { sli.initialize(); return false; } } return false; }
int netanim::AnimatorMode::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: gridLinesSlot((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: nodeSizeSlot((*reinterpret_cast< QString(*)>(_a[1]))); break; case 2: gridSlot(); break; case 3: traceFileOpenSlot(); break; case 4: testSlot(); break; case 5: playSlot(); break; case 6: showNodeIdSlot(); break; case 7: updateRateChangedSlot((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: updateRateTimeoutSlot(); break; case 9: zoomInSlot(); break; case 10: zoomOutSlot(); break; case 11: showWirelessCirclesSlot(); break; case 12: packetStatsSlot(); break; case 13: nodePositionStatsSlot(); break; case 14: timelineSlot((*reinterpret_cast< int(*)>(_a[1]))); break; case 15: pktFilterFromSlot((*reinterpret_cast< QString(*)>(_a[1]))); break; case 16: pktFilterToSlot((*reinterpret_cast< QString(*)>(_a[1]))); break; case 17: showPacketSlot(); break; case 18: precisionSlot(); break; case 19: saveSlot(); break; case 20: resetSlot(); break; case 21: fastFwdSlot(); break; case 22: showMetaSlot(); break; case 23: packetPersistenceSlot((*reinterpret_cast< QString(*)>(_a[1]))); break; case 24: metaFontSizeSlot((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 25; } return _id; }
void AudioInSettings::stopSoundTest() { if (m_audioIn) testSlot(); }
AudioInSettings::AudioInSettings(TaudioParams* params, Ttune* tune, QWidget* parent) : TtouchArea(parent), m_audioIn(0), m_glParams(params), m_listGenerated(false), m_tune(tune) { QString styleTxt = "background-color: palette(button); border: 1px solid palette(Text); border-radius: 5px;"; m_tmpParams = new TaudioParams(); *m_tmpParams = *m_glParams; #if defined (Q_OS_ANDROID) m_topList = new TlistMenu(QListWidget::LeftToRight, this); QStackedLayout *m_stackedLay = new QStackedLayout; m_stackedLay->setContentsMargins(0, 0, 0, 0); TtouchArea *m_1_device, *m_2_middleA, *m_3_advanced; // m_4_test is declared in header #else m_toolBox = new QToolBox(this); QWidget *m_1_device, *m_2_middleA, *m_3_advanced; // m_4_test is declared in header #endif //################### 1. Input device & pitch detection ################################# #if defined (Q_OS_ANDROID) m_1_device = new TtouchArea(this); m_topList->addItem("1. " + tr("Input device and pitch detection")); m_stackedLay->addWidget(m_1_device); #else m_1_device = new QWidget(); m_toolBox->addItem(m_1_device, "1. " + tr("Input device and pitch detection")); #endif QLabel *devLab = new QLabel(tr("input device"), m_1_device); m_inDeviceCombo = new QComboBox(m_1_device); m_inDeviceCombo->setStatusTip(tr("Be sure your input device (microphone, webcam, instrument, etc.) is plugged in, properly configured, and working.")); m_inDeviceCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); #if !defined (Q_OS_ANDROID) && (defined (Q_OS_LINUX) || defined (Q_OS_WIN)) m_JACK_ASIO_ChB = new QCheckBox(this); #if defined (Q_OS_WIN) m_JACK_ASIO_ChB->setText("ASIO"); #elif defined (Q_OS_LINUX) m_JACK_ASIO_ChB->setText("JACK"); #endif m_JACK_ASIO_ChB->setChecked(m_glParams->JACKorASIO); #endif durHeadLab = new QLabel(tr("minimum note duration"), m_1_device); durationSpin = new QSpinBox(m_1_device); durationSpin->setMinimum(10); durationSpin->setMaximum(1000); durationSpin->setSuffix(" " + tr("[milliseconds]")); durationSpin->setSingleStep(50); durationSpin->setValue(qRound(m_glParams->minDuration * 1000)); // minimum duration is stored in seconds but displayed in milliseconds durationSpin->setStatusTip(tr("Only sounds longer than the selected time will be pitch-detected.<br>Selecting a longer minimum note duration helps avoid capturing fret noise or other unexpected sounds but decreases responsiveness.")); QLabel *volLabel = new QLabel(tr("minimum volume"), m_1_device); volumeSlider = new TvolumeSlider(m_1_device); volumeSlider->setValue(m_glParams->minimalVol); volumeSlider->setStatusTip(tr("Minimum volume of a sound to be pitch-detected")); TintonationCombo *intoCombo = new TintonationCombo(m_1_device); m_intonationCombo = intoCombo->accuracyCombo; m_intonationCombo->setCurrentIndex(m_glParams->intonation); // 1. Layout QVBoxLayout *deviceLay = new QVBoxLayout; QHBoxLayout *rtDevLay = new QHBoxLayout; rtDevLay->addWidget(devLab); rtDevLay->addWidget(m_inDeviceCombo); #if !defined (Q_OS_ANDROID) && (defined (Q_OS_LINUX) || defined (Q_OS_WIN)) rtDevLay->addWidget(m_JACK_ASIO_ChB); #endif deviceLay->addLayout(rtDevLay); #if defined (Q_OS_ANDROID) deviceLay->addWidget(getLabelFromStatus(m_inDeviceCombo, false, true)); deviceLay->addStretch(2); #endif QHBoxLayout *durLay = new QHBoxLayout; // durLay->addStretch(); durLay->addWidget(durHeadLab); durLay->addWidget(durationSpin, 0, Qt::AlignLeft); // durLay->addStretch(); deviceLay->addLayout(durLay); #if defined (Q_OS_ANDROID) // durationSpin->setMinimumWidth(fontMetrics().width(durationSpin->suffix()) * 3); deviceLay->addWidget(getLabelFromStatus(durationSpin, true, true)); deviceLay->addStretch(1); #endif QHBoxLayout *volLay = new QHBoxLayout; volLay->addWidget(volLabel); volLay->addWidget(volumeSlider); deviceLay->addLayout(volLay); #if defined (Q_OS_ANDROID) deviceLay->addWidget(getLabelFromStatus(volumeSlider)); deviceLay->addStretch(1); #endif deviceLay->addWidget(intoCombo); deviceLay->addStretch(1); m_1_device->setLayout(deviceLay); //################### 2. Middle a & transposition ################################# #if defined (Q_OS_ANDROID) m_2_middleA = new TtouchArea(this); m_topList->addItem("2. " + tr("'Middle a' and transposition")); m_stackedLay->addWidget(m_2_middleA); #else m_2_middleA = new QWidget(); m_toolBox->addItem(m_2_middleA, "2. " + tr("'Middle a' and transposition")); #endif QLabel *headLab = new QLabel("<table><tr><td valign=\"middle\">" + tr("middle A") + QString(" %1</td></tr></table>").arg(wrapPixToHtml(Tnote(6, 1, 0), Tclef::e_treble_G, TkeySignature(0), 4.0)), m_2_middleA); QLabel *frLab = new QLabel(tr("frequency:"), m_2_middleA); freqSpin = new QSpinBox(m_2_middleA); freqSpin->setStatusTip(tr("The base frequency of <i>middle a</i>.<br>Detection of the proper pitch of notes is relative to this value. This also affects the pitch of played sounds.").replace(". ", ".<br>")); freqSpin->setMinimum(200); freqSpin->setMaximum(900); freqSpin->setSuffix(" Hz"); frLab->setStatusTip(freqSpin->statusTip()); QLabel *intervalLab = new QLabel(tr("interval:"), m_2_middleA); m_intervalSpin = new QSpinBox(m_2_middleA); m_intervalSpin->setRange(0, 12); m_intervalSpin->setSpecialValueText(tr("none")); m_intervalSpin->setMinimumWidth(fontMetrics().boundingRect("w").width() * 15); // width of ten letters 'w' m_intervalSpin->setStatusTip(tr("Shifts the frequency of <i>middle a</i>. It can be used as a transposition.").replace(". ", ".<br>")); m_upSemiToneRadio = new QRadioButton(tr("up"), m_2_middleA); m_upSemiToneRadio->setIcon(QIcon(style()->standardIcon(QStyle::SP_ArrowUp))); m_downsSemitoneRadio = new QRadioButton(tr("down"), m_2_middleA); m_downsSemitoneRadio->setIcon(QIcon(style()->standardIcon(QStyle::SP_ArrowDown))); intervalLab->setStatusTip(m_intervalSpin->statusTip()); QButtonGroup *upDownGroup = new QButtonGroup(m_2_middleA); upDownGroup->addButton(m_upSemiToneRadio); upDownGroup->addButton(m_downsSemitoneRadio); m_upSemiToneRadio->setChecked(true); tuneFreqlab = new TroundedLabel(m_2_middleA); tuneFreqlab->setAlignment(Qt::AlignCenter); QFont ff = tuneFreqlab->font(); ff.setPixelSize(fontMetrics().boundingRect("A").height() * 1.2); tuneFreqlab->setFont(ff); tuneFreqlab->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); // 2. Layout QGridLayout *midGrLay = new QGridLayout; midGrLay->addWidget(frLab, 0, 0); midGrLay->addWidget(freqSpin, 0, 1); midGrLay->addWidget(intervalLab, 1, 0); QVBoxLayout *upDownLay = new QVBoxLayout; upDownLay->addWidget(m_upSemiToneRadio); upDownLay->addWidget(m_downsSemitoneRadio); QHBoxLayout *intervalLay = new QHBoxLayout; intervalLay->addWidget(m_intervalSpin); intervalLay->addLayout(upDownLay); midGrLay->addLayout(intervalLay, 1, 1); #if defined (Q_OS_ANDROID) QVBoxLayout *aLay = new QVBoxLayout; #else QHBoxLayout *aLay = new QHBoxLayout; #endif aLay->addWidget(headLab, 0, Qt::AlignCenter); #if defined (Q_OS_ANDROID) aLay->addWidget(getLabelFromStatus(freqSpin, true, true)); #endif aLay->addLayout(midGrLay); #if defined (Q_OS_ANDROID) aLay->addWidget(getLabelFromStatus(m_intervalSpin, true, true)); #endif QVBoxLayout *middleAlay = new QVBoxLayout(); middleAlay->addLayout(aLay); middleAlay->addWidget(tuneFreqlab, 0, Qt::AlignCenter); m_2_middleA->setLayout(middleAlay); //################### 3. Advanced ################################# #if defined (Q_OS_ANDROID) m_3_advanced = new TtouchArea(this); m_topList->addItem("3. " + tr("Advanced")); m_stackedLay->addWidget(m_3_advanced); #else m_3_advanced = new QWidget(); m_toolBox->addItem(m_3_advanced, "3. " + tr("Advanced")); #endif QLabel *methodLab = new QLabel(tr("pitch detection mode"), m_3_advanced); m_methodCombo = new QComboBox(m_3_advanced); m_methodCombo->addItem("MPM"); m_methodCombo->addItem("autocorrelation"); m_methodCombo->addItem("MPM + modified cepstrum"); if (m_glParams->detectMethod == e_MPM) m_methodCombo->setCurrentIndex(0); else if (m_glParams->detectMethod == e_AUTOCORRELATION) m_methodCombo->setCurrentIndex(1); else m_methodCombo->setCurrentIndex(2); m_splitVolChB = new QCheckBox(tr("split when volume rise"), this); m_splitVolChB->setStatusTip(tr("Helps to properly detect the same notes repeated quickly on the guitar.")); m_splitVolSpin = new QSpinBox(this); m_splitVolSpin->setRange(5, 50); m_splitVolSpin->setSingleStep(5); m_splitVolSpin->setSuffix(" %"); m_splitVolSpin->setStatusTip(m_splitVolChB->statusTip()); if (m_glParams->minSplitVol > 0.0) { m_splitVolChB->setChecked(true); m_splitVolSpin->setValue(m_glParams->minSplitVol); } else { m_splitVolChB->setChecked(false); m_splitVolSpin->setDisabled(true); } m_skipStillerChB = new QCheckBox(tr("skip stiller than"), this); m_skipStillerChB->setStatusTip(tr("Skips stiller sounds, below given percent of average volume. It prevents detecting of harmonics on classical or acoustic guitar but requires playing with similar strength.").replace(". ", ".<br>")); m_skipStillerSpin = new QSpinBox(this); m_skipStillerSpin->setRange(10, 95); m_skipStillerSpin->setSingleStep(5); m_skipStillerSpin->setSuffix(" %"); m_skipStillerSpin->setStatusTip(m_skipStillerChB->statusTip()); m_skipStillerSpin->setValue(m_glParams->skipStillerVal); m_skipStillerChB->setChecked(m_glParams->skipStillerVal > 0.0); m_skipStillerSpin->setDisabled(m_glParams->skipStillerVal == 0.0); m_noiseFilterChB = new QCheckBox(tr("noise filter"), m_3_advanced); m_noiseFilterChB->setChecked(m_glParams->equalLoudness); m_noiseFilterChB->setStatusTip(tr("It is rather necessary for mic input but may be switched off for instrument line-in plugged with less noise.")); QLabel *adjustLab = new QLabel(tr("adjust to instrument"), m_3_advanced); m_adjustToInstrButt = new TselectInstrument(m_3_advanced, TselectInstrument::e_buttonsOnlyHorizontal); #if defined (Q_OS_ANDROID) m_adjustToInstrButt->setGlyphSize(Tmtr::fingerPixels() * 0.8); #else m_adjustToInstrButt->setGlyphSize(fontMetrics().height() * 2); #endif //3. Layout QVBoxLayout *advLay = new QVBoxLayout; QHBoxLayout *methodLay = new QHBoxLayout; methodLay->addStretch(); methodLay->addWidget(methodLab); methodLay->addWidget(m_methodCombo); methodLay->addStretch(); advLay->addLayout(methodLay); advLay->addStretch(); QHBoxLayout *splitLay = new QHBoxLayout; splitLay->addStretch(); splitLay->addWidget(m_splitVolChB); splitLay->addWidget(m_splitVolSpin); splitLay->addStretch(); advLay->addLayout(splitLay); #if defined (Q_OS_ANDROID) advLay->addWidget(getLabelFromStatus(m_splitVolChB, false, true)); #endif advLay->addStretch(); QHBoxLayout *skipLay = new QHBoxLayout; skipLay->addStretch(); skipLay->addWidget(m_skipStillerChB); skipLay->addWidget(m_skipStillerSpin); skipLay->addStretch(); advLay->addLayout(skipLay); #if defined (Q_OS_ANDROID) advLay->addWidget(getLabelFromStatus(m_skipStillerChB, false, true)); #endif advLay->addStretch(); advLay->addWidget(m_noiseFilterChB, 0, Qt::AlignCenter); #if defined (Q_OS_ANDROID) advLay->addWidget(getLabelFromStatus(m_noiseFilterChB, true, true)); #endif advLay->addStretch(1); QHBoxLayout *adjustLay = new QHBoxLayout; adjustLay->addStretch(); adjustLay->addWidget(adjustLab); adjustLay->addWidget(m_adjustToInstrButt); adjustLay->addStretch(); advLay->addLayout(adjustLay); advLay->addStretch(1); m_3_advanced->setLayout(advLay); //################### 4. Test the settings ################################# #if defined (Q_OS_ANDROID) m_4_test = new TtouchArea(this); m_topList->addItem("4. " + tr("Test the settings")); m_stackedLay->addWidget(m_4_test); #else m_4_test = new QWidget(); m_toolBox->addItem(m_4_test, "4. " + tr("Test the settings")); #endif m_4_test->setStatusTip(tr("Check, are your audio input settings appropriate?<br>And how well does pitch detection work for your selected settings?")); testTxt = tr("Test"); stopTxt = tr("Stop"); testButt = new QPushButton(testTxt, m_4_test); testButt->setIconSize(QSize(48, 48)); pitchView = new TpitchView(m_audioIn, m_4_test, false); pitchView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); pitchView->setFixedHeight(fontMetrics().boundingRect("A").height() * 5); pitchView->setPitchColor(Qt::darkGreen); pitchView->setMinimalVolume(m_glParams->minimalVol); // pitchView->enableAccuracyChange(false); QFont labFont = font(); labFont.setPixelSize(fontMetrics().boundingRect("A").height() * 2); pitchLab = new TroundedLabel("--", this); pitchLab->setFont(labFont); pitchLab->setFixedWidth(fontMetrics().boundingRect("w").width() * 10); pitchLab->setStatusTip(tr("Detected pitch")); pitchLab->setAlignment(Qt::AlignCenter); freqLab = new TroundedLabel("--", this); freqLab->setFixedWidth(pitchLab->width() * 2); freqLab->setFont(labFont); freqLab->setAlignment(Qt::AlignCenter); getFreqStatusTip(); // 4. Layout QHBoxLayout *labelsLay = new QHBoxLayout; labelsLay->addStretch(); labelsLay->addWidget(testButt); labelsLay->addStretch(); labelsLay->addWidget(pitchLab); labelsLay->addStretch(); labelsLay->addWidget(freqLab); labelsLay->addStretch(); QVBoxLayout *testLay = new QVBoxLayout; #if defined (Q_OS_ANDROID) testLay->addWidget(getLabelFromStatus(m_4_test, false, true)); #endif testLay->addStretch(); testLay->addLayout(labelsLay); testLay->addStretch(); testLay->addWidget(pitchView); testLay->addStretch(); m_4_test->setLayout(testLay); // Whole layout QVBoxLayout *inLay = new QVBoxLayout(); #if defined (Q_OS_ANDROID) inLay->addWidget(m_topList); inLay->addLayout(m_stackedLay); inLay->setContentsMargins(0, 0, 0, 0); m_stackedLay->setCurrentIndex(0); m_topList->setCurrentRow(0); connect(m_topList, &TlistMenu::currentRowChanged, m_stackedLay, &QStackedLayout::setCurrentIndex); m_topList->adjustItemsLayout(100); #else inLay->addWidget(m_toolBox); #endif enableInBox = new QGroupBox(tr("enable pitch detection"), this); enableInBox->setLayout(inLay); QVBoxLayout *lay = new QVBoxLayout(); lay->setContentsMargins(0, 0, 0, 0); lay->addWidget(enableInBox); setLayout(lay); m_testDisabled = false; setTestDisabled(true); enableInBox->setCheckable(true); enableInBox->setChecked(m_glParams->INenabled); freqSpin->setValue(getFreq(440.0)); intervalFromFreq(freqSpin->value()); connect(testButt, SIGNAL(clicked()), this, SLOT(testSlot())); connect(m_intervalSpin, SIGNAL(valueChanged(int)), this, SLOT(intervalChanged())); connect(m_upSemiToneRadio, SIGNAL(clicked(bool)), this, SLOT(upDownIntervalSlot())); connect(m_downsSemitoneRadio, SIGNAL(clicked(bool)), this, SLOT(upDownIntervalSlot())); connect(freqSpin, SIGNAL(valueChanged(int)), this, SLOT(baseFreqChanged(int))); connect(volumeSlider, SIGNAL(valueChanged(float)), this, SLOT(minimalVolChanged(float))); #if defined (Q_OS_ANDROID) connect(m_topList, &TlistMenu::currentRowChanged, this, &AudioInSettings::testSlot); #else connect(m_toolBox, SIGNAL(currentChanged(int)), this, SLOT(testSlot())); #if defined (Q_OS_LINUX) || defined (Q_OS_WIN) connect(m_JACK_ASIO_ChB, &QCheckBox::clicked, this, &AudioInSettings::JACKASIOSlot); #endif #endif connect(enableInBox, &QGroupBox::clicked, this, &AudioInSettings::testSlot); connect(m_splitVolChB, &QCheckBox::toggled, this, &AudioInSettings::splitByVolChanged); connect(m_skipStillerChB, &QCheckBox::toggled, this, &AudioInSettings::skipStillerChanged); connect(m_adjustToInstrButt, &TselectInstrument::instrumentChanged, this, &AudioInSettings::adjustInstrSlot); #if defined(Q_OS_WIN) connect(m_inDeviceCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(asioDriverChanged(int))); #endif }