void AudioProcessor::initialise (const BusesProperties& ioConfig) { cachedTotalIns = 0; cachedTotalOuts = 0; wrapperType = wrapperTypeBeingCreated.get(); playHead = nullptr; currentSampleRate = 0; blockSize = 0; latencySamples = 0; #if JUCE_DEBUG textRecursionCheck = false; #endif suspended = false; nonRealtime = false; processingPrecision = singlePrecision; const int numInputBuses = ioConfig.inputLayouts.size(); const int numOutputBuses = ioConfig.outputLayouts.size(); for (int i = 0; i < numInputBuses; ++i) createBus (true, ioConfig.inputLayouts. getReference (i)); for (int i = 0; i < numOutputBuses; ++i) createBus (false, ioConfig.outputLayouts.getReference (i)); updateSpeakerFormatStrings(); }
// Bus list view context menu handler. void qtractorBusForm::contextMenu ( const QPoint& /*pos*/ ) { // Build the device context menu... QMenu menu(this); QAction *pAction; unsigned int iFlags = flags(); pAction = menu.addAction( QIcon(":/images/formCreate.png"), tr("&Create"), this, SLOT(createBus())); pAction->setEnabled(iFlags & Create); pAction = menu.addAction( QIcon(":/images/formAccept.png"), tr("&Update"), this, SLOT(updateBus())); pAction->setEnabled(iFlags & Update); pAction = menu.addAction( QIcon(":/images/formRemove.png"), tr("&Delete"), this, SLOT(deleteBus())); pAction->setEnabled(iFlags & Delete); menu.addSeparator(); pAction = menu.addAction( QIcon(":/images/formRefresh.png"), tr("&Refresh"), this, SLOT(refreshBuses())); pAction->setEnabled(m_iDirtyCount > 0); // menu.exec(m_ui.BusListView->mapToGlobal(pos)); menu.exec(QCursor::pos()); }
int StationUpdater::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTcpServer::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: updateStation(); break; case 1: updateServer(); break; case 2: updateStationTimer(); break; case 3: initialiseStations(); break; case 4: initialisePeopleAtStations(); break; case 5: createBusA1(); break; case 6: createBusA2(); break; case 7: createBusB(); break; case 8: createBusC(); break; case 9: createBusD1(); break; case 10: createBusD2(); break; case 11: removeBus((*reinterpret_cast< int(*)>(_a[1]))); break; case 12: createBus((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< char*(*)>(_a[2]))); break; default: ; } _id -= 13; } return _id; }
//============================================================================== bool AudioProcessor::addBus (bool isInput) { if (! canAddBus (isInput)) return false; BusProperties BusesProperties; if (! canApplyBusCountChange (isInput, true, BusesProperties)) return false; createBus (isInput, BusesProperties); return true; }
void getBusData(ifstream& input,vector<Bus>& vecBus) {//读取所有节点信息 if(!input) return; string str; while(1) { str.clear(); getline(input,str); if(str=="<Bus::nx type=全数>") { int i=0; str.clear(); getline(input,str); vector<string> vecBusHeader=split(str); int busNameColumn(0);//识别表头 int busVoltColumn(0); int busVColumn(0); int busAngColumn(0); int busOffColumn(0); int busV_maxColumn(0); int busV_minColumn(0); for(size_t t=0;t<vecBusHeader.size();++t) { if(vecBusHeader[t]=="node") { busNameColumn=t; } else if(vecBusHeader[t]=="volt") { busVoltColumn=t; } else if(vecBusHeader[t]=="V") { busVColumn=t; } else if(vecBusHeader[t]=="Ang") { busAngColumn=t; } else if(vecBusHeader[t]=="off") { busOffColumn=t; } else if(vecBusHeader[t]=="v_max") { busV_maxColumn=t; } else if(vecBusHeader[t]=="v_min") { busV_minColumn=t; } else continue; } const int busNameColumnConst=busNameColumn; const int busVoltColumnConst=busVoltColumn; const int busVColumnConst=busVColumn; const int busAngColumnConst=busAngColumn; const int busOffColumnConst=busOffColumn; const int busV_maxColumnConst=busV_maxColumn; const int busV_minColumnConst=busV_minColumn; //记录所需要行列的位置 str.clear();//其中一行数据是不需要的,先清除一行数据 getline(input,str); str.clear(); getline(input,str); while(str!="</Bus::nx>") { vector<string> vec=split(str); //所有数据都已经存放在vec中,接下来是选出有用数据,对数所进行转换 int volt=stringToInt(vec[busVoltColumnConst]); double v=stringToDouble(vec[busVColumnConst]); double ang=stringToDouble(vec[busAngColumnConst]); bool off=stringToBool(vec[busOffColumnConst]); double V_max=stringToDouble(vec[busV_maxColumnConst]); double V_min=stringToDouble(vec[busV_minColumnConst]); Bus bus=createBus(i,vec[busNameColumnConst],volt,v,ang,off,V_max,V_min); size_t t=0; for(;t<vecBus.size();++t) { if(vecBus[t]==bus) { str.clear(); getline(input,str); break; } } if(t<vecBus.size())continue; vecBus.push_back(bus); i++; str.clear(); getline(input,str); } } if(str=="</Bus::nx>") break; } }
bool qtractorDeleteBusCommand::undo (void) { return createBus(); }
// Bus creation command methods. bool qtractorCreateBusCommand::redo (void) { return createBus(); }
// Constructor. qtractorBusForm::qtractorBusForm ( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog(pParent, wflags) { // Setup UI struct... m_ui.setupUi(this); // Window modality (let plugin/tool windows rave around). QDialog::setWindowModality(Qt::WindowModal); // Initialize locals. m_pBus = NULL; m_pAudioRoot = NULL; m_pMidiRoot = NULL; m_iDirtySetup = 0; m_iDirtyCount = 0; m_iDirtyTotal = 0; QHeaderView *pHeader = m_ui.BusListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); pHeader->resizeSection(0, 140); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(1, QHeaderView::ResizeToContents); pHeader->setSectionResizeMode(2, QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(1, QHeaderView::ResizeToContents); pHeader->setResizeMode(2, QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif m_ui.BusListView->setContextMenuPolicy(Qt::CustomContextMenu); const QColor& rgbDark = palette().dark().color().darker(150); m_ui.BusTitleTextLabel->setPalette(QPalette(rgbDark)); m_ui.BusTitleTextLabel->setAutoFillBackground(true); // (Re)initial contents. refreshBuses(); // Try to restore normal window positioning. adjustSize(); // UI signal/slot connections... QObject::connect(m_ui.BusListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(selectBus())); QObject::connect(m_ui.BusListView, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(contextMenu(const QPoint&))); QObject::connect(m_ui.BusNameLineEdit, SIGNAL(textChanged(const QString&)), SLOT(changed())); QObject::connect(m_ui.BusModeComboBox, SIGNAL(activated(int)), SLOT(changed())); QObject::connect(m_ui.MonitorCheckBox, SIGNAL(clicked()), SLOT(changed())); QObject::connect(m_ui.AudioChannelsSpinBox, SIGNAL(valueChanged(int)), SLOT(changed())); QObject::connect(m_ui.AudioAutoConnectCheckBox, SIGNAL(clicked()), SLOT(changed())); QObject::connect(m_ui.MidiInstrumentComboBox, SIGNAL(activated(int)), SLOT(changed())); QObject::connect(m_ui.MidiSysexPushButton, SIGNAL(clicked()), SLOT(midiSysex())); QObject::connect(m_ui.InputPluginListView, SIGNAL(currentRowChanged(int)), SLOT(stabilizeForm())); QObject::connect(m_ui.InputPluginListView, SIGNAL(contentsChanged()), SLOT(stabilizeForm())); QObject::connect(m_ui.AddInputPluginToolButton, SIGNAL(clicked()), SLOT(addInputPlugin())); QObject::connect(m_ui.RemoveInputPluginToolButton, SIGNAL(clicked()), SLOT(removeInputPlugin())); QObject::connect(m_ui.MoveUpInputPluginToolButton, SIGNAL(clicked()), SLOT(moveUpInputPlugin())); QObject::connect(m_ui.MoveDownInputPluginToolButton, SIGNAL(clicked()), SLOT(moveDownInputPlugin())); QObject::connect(m_ui.OutputPluginListView, SIGNAL(currentRowChanged(int)), SLOT(stabilizeForm())); QObject::connect(m_ui.OutputPluginListView, SIGNAL(contentsChanged()), SLOT(stabilizeForm())); QObject::connect(m_ui.AddOutputPluginToolButton, SIGNAL(clicked()), SLOT(addOutputPlugin())); QObject::connect(m_ui.RemoveOutputPluginToolButton, SIGNAL(clicked()), SLOT(removeOutputPlugin())); QObject::connect(m_ui.MoveUpOutputPluginToolButton, SIGNAL(clicked()), SLOT(moveUpOutputPlugin())); QObject::connect(m_ui.MoveDownOutputPluginToolButton, SIGNAL(clicked()), SLOT(moveDownOutputPlugin())); QObject::connect(m_ui.MoveUpPushButton, SIGNAL(clicked()), SLOT(moveUpBus())); QObject::connect(m_ui.MoveDownPushButton, SIGNAL(clicked()), SLOT(moveDownBus())); QObject::connect(m_ui.CreatePushButton, SIGNAL(clicked()), SLOT(createBus())); QObject::connect(m_ui.UpdatePushButton, SIGNAL(clicked()), SLOT(updateBus())); QObject::connect(m_ui.DeletePushButton, SIGNAL(clicked()), SLOT(deleteBus())); QObject::connect(m_ui.ClosePushButton, SIGNAL(clicked()), SLOT(reject())); stabilizeForm(); }
//----------------------------------------------------------------------------- // Function: apply() //----------------------------------------------------------------------------- void NewBusPage::apply() { emit createBus(vlnvEditor_->getVLNV(), selectedPath()); }