void PlayPanel::setScore(Score* s) { if (cs != 0 && cs == s) return; cs = s; bool enable = cs != 0; volumeSlider->setEnabled(enable); posSlider->setEnabled(enable); tempoSlider->setEnabled(enable); if (cs && seq && seq->canStart()) { setTempo(cs->tempomap()->tempo(0)); setRelTempo(cs->tempomap()->relTempo()); setEndpos(cs->repeatList()->ticks()); int tick = cs->playPos(); heartBeat(tick, tick, 0); } else { setTempo(120.0); setRelTempo(1.0); setEndpos(0); heartBeat(0, 0, 0); updatePosLabel(0); } update(); }
void MainWindow::play() { videoState = PLAY; ui->pauzeButton->setEnabled(true); ui->continueButton->setEnabled(false); heartBeat(); };
void MainWindow::loadFile(const QString &fileName) { source.close(); if (!source.open(fileName)) { QMessageBox::warning(this, tr("Can't open file"), source.error, QMessageBox::Ok); return; } finder.init(source.size); capture.init(source.size); labeler.init(source.movieLocation); ui->actionOpen_Video->setChecked(true); ui->actionOpen_Device_2->setChecked(false); ui->pauzeButton->setEnabled(false); ui->continueButton->setEnabled(true); ui->positionSlider->setEnabled(true); ui->recordButton->setEnabled(true); videoState = PAUZE; stopRecord(); // do one step so we see something on the screen step(); ui->CVWindow->setImage(&whatWeSee); heartBeat(); }
void MainWindow::openDevice() { source.close(); if (!source.open(settings->deviceId)) { QMessageBox::warning(this, tr("Can't open file"), source.error, QMessageBox::Ok); return; } this->setWindowTitle(QString("Sonic Gesture - device %1").arg(settings->deviceId)); finder.init(source.size); capture.init(source.size); ui->actionOpen_Video->setChecked(false); ui->actionOpen_Device_2->setChecked(true); ui->pauzeButton->setEnabled(false); ui->continueButton->setEnabled(false); ui->positionSlider->setEnabled(false); ui->recordButton->setEnabled(true); videoState = PLAY; stopRecord(); // do one step so we see something on the screen step(); ui->CVWindow->setImage(&whatWeSee); heartBeat(); };
Seq::Seq() { running = false; playlistChanged = false; cs = 0; cv = 0; endTick = 0; state = TRANSPORT_STOP; oggInit = false; _driver = 0; playPos = events.constBegin(); playTime = 0; metronomeVolume = 0.3; meterValue[0] = 0.0; meterValue[1] = 0.0; meterPeakValue[0] = 0.0; meterPeakValue[1] = 0.0; peakTimer[0] = 0; peakTimer[1] = 0; heartBeatTimer = new QTimer(this); connect(heartBeatTimer, SIGNAL(timeout()), this, SLOT(heartBeat())); noteTimer = new QTimer(this); noteTimer->setSingleShot(true); connect(noteTimer, SIGNAL(timeout()), this, SLOT(stopNotes())); noteTimer->stop(); connect(this, SIGNAL(toGui(int)), this, SLOT(seqMessage(int)), Qt::QueuedConnection); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); settings = Settings::getInstance(); // make sure only ME gets keys grabKeyboard(); startScreen(); // initialize finder and capture, check if they start if (!finder.init(source.size) || !capture.init(source.size)) { QMessageBox::warning(this, tr("Can't initialize finder"), finder.error, QMessageBox::Ok); } whatWeSee = source.frame; ui->CVWindow->setImage(&whatWeSee); // set start flags viewMode = NORMAL; recMode = INPUT_; // call hearbeat to initialize image heartBeat(); }
void BlockManager::initialize(){ // 读配置文件中的配置,然后根据是否是master注册 // 1,建两个存储,一个是内存的,一个磁盘的 diskstore_=new DiskStore(DISKDIR); memstore_=MemoryChunkStore::getInstance(); ///the version written by zhanglei///////////////////////////////// // blockManagerId_=new BlockManagerId(); // 2,注册 registerToMaster(blockManagerId_); // 3,开启心跳监听 heartBeat(); /////////////////////////////////////////////////////////////////// //////////////the version written by Li//////////////////////////// //the following values should be read from configure file. const int memory=BufferManager::getInstance()->getStorageMemoryBudegeInMilibyte(); const int disk=1000000; const NodeID NodeID=Environment::getInstance()->getNodeID(); // StorageBudgetMessage message(disk,memory,NodeID); Environment::getInstance()->getResourceManagerSlave()->ReportStorageBudget(message); }
void PRadHVChannel::queryLoop() { while(alive) { if(!(loopCount%60)) ReadVoltage(); else if(!loopCount%20) heartBeat(); ++loopCount; //this_thread::sleep_for(chrono::seconds(1)); sleep(1); } }
void MainWindow::heartBeat() { if (videoState == PAUZE) return; time.restart(); step(); int elapsed = time.elapsed(); int MINWAIT = 4; int wait = (1000/settings->FPS) - elapsed; wait = MAX(wait, MINWAIT); //qDebug() << elapsed << "\t" << wait; QTimer::singleShot(wait, this, SLOT(heartBeat())); };
Seq::Seq() { synti = new FluidS::Fluid(); driver = 0; running = false; playPos = events.constBegin(); endTick = 0; cs = 0; state = TRANSPORT_STOP; playlistChanged = false; heartBeatTimer = new QTimer(this); connect(heartBeatTimer, SIGNAL(timeout()), this, SLOT(heartBeat())); }
int HeartBeat::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = IconWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: heartBeat(); break; default: ; } _id -= 1; } return _id; }
void PlayPanel::setScore(Score* s) { if (cs != 0 && cs == s) return; cs = s; if (cs) { MeasureBase* lm = cs->last(); if (lm) setEndpos(lm->tick() + lm->ticks()); } bool enable = cs != 0; volumeSlider->setEnabled(enable); posSlider->setEnabled(enable); tempoSlider->setEnabled(enable); swingStyle->setEnabled(enable); if (cs) { setTempo(cs->tempomap()->tempo(0)); setRelTempo(cs->tempomap()->relTempo()); Measure* m = cs->lastMeasure(); if (m) setEndpos(m ? m->tick() + m->ticks() : 0); int tick = cs->playPos(); heartBeat(tick, tick); } else { setTempo(120.0); setRelTempo(1.0); setEndpos(0); heartBeat(0, 0); } // heartBeat2(seq->getCurTime()); // int tick, utick; // seq->getCurTick(&tick, &utick); // heartBeat(tick, utick); update(); }
void send_data_loop(float temperature_sensor_value, int light_sensor_value) { if (LWiFi.status() == LWIFI_STATUS_DISCONNECTED) { Serial.println("Disconnected from WiFi"); while (0 == LWiFi.connect(ssid, LWiFiLoginInfo(WIFI_AUTH, key))){ Serial.println("Connecting to WiFi..."); delay(1000); } } LDateTime.getRtc(&rtc); if ((rtc - lrtc) >= per) { senddata(temperature_sensor_value, light_sensor_value); lrtc = rtc; } //Check for TCP socket command from MCS Server String tcpcmd=""; while (c.available()) { int v = c.read(); if (v != -1) { Serial.print((char)v); tcpcmd += (char)v; if (tcpcmd.indexOf("led on") >= 0) { Serial.print("Received actuator command: "); Serial.println(tcpcmd); Serial.println("Switching LED ON..."); led_on(); tcpcmd=""; }else if(tcpcmd.indexOf("led off") >= 0) { Serial.print("Received actuator command: "); Serial.println(tcpcmd); Serial.println("Switching LED OFF..."); led_off(); tcpcmd=""; } } } //Check for hearbeat interval LDateTime.getRtc(&rtc2); if ((rtc2 - lrtc2) >= per1) { heartBeat(); lrtc2 = rtc2; } }
///////////////////////////////////////////////////////////////////////////////////////// //// SLOTS ////////// void BfVM::step() { qDebug("BfVM::step()"); //Q_ASSERT_X(m_IP < m_programSize, "BfVM::step()", "IP larger than program size"); /* If we've reached the last instruction, post an EndEvent and let the state machine handle the rest */ if(m_IP >= m_programSize) { qDebug("BfVM::step() program end reached"); m_stateMachine->postEvent(new EndEvent); return; } // Inform the world of our IP emit heartBeat(m_IP); // NOTE: the IP is increased by the runInstruction() function runInstruction(m_program[m_IP]); // emit "heart beat" with current IP and then increase it }
void PlayPanel::setPos(int tick) { if (cachedTickPosition != tick) emit posChange(tick); heartBeat(tick, tick); }
int main(void) { ConfigureOscillator(); InitApp(); ADCInit(); LCD_Init(NONE); __delay_ms(100); LCD_Clear(); RTCC_Initialize(); InitCustomChars(); // ****************************************************************************** char * WeekDay[7] = {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}; int8_t loopCounter = 12, previousLoopCounter = 12; int OutAirTemp; int Temp[11]; int OldTemp[11] = {300}; _Bool Out[11] = {0}; // Startup values for all outputs, 0 = OFF (Output 0 - 11)) _Bool OutSum = 0, outSumOldState = 0; // Sum of all Outputs, Previous scan OutSum state unsigned char i = 0; char reset = 0; char TestKey; // Variable used for Storing Which Menu Key is Pressed int internalBGV; unsigned int backLightTimer = 0; // ****************************************************************************** while(1) { time = getRTCTime(); // get the time unsigned int timer = 0; // Used to count up time in a loop, to auto exit if user in a menu too long // ****************************************************************************** // OutAirTemp = ((ADCRead(9) - 785)/3.2 - 500); // Setup for protoBoard // OutAirTemp = ((ADCRead(9) - 804)/3.178 - 500); // Setup for first Board built, Green LED's OutAirTemp = ((ADCRead(9) - 807)/3.196 - 500); // Setup for second Board built, Blue LED's // ****************************************************************************** Temp[0] = ADCRead(0); //Read Deck air temperature Pin 19 // ****************************************************************************** Temp[1] = ADCRead(4); //Read Deck floor temperature Pin 23 // ****************************************************************************** Temp[2] = ADCRead(5); //Read Utility room floor temperature Pin 24 // ****************************************************************************** Temp[3] = ADCRead(6); //Read Entrance floor temperature Pin 25 // ****************************************************************************** Temp[4] = ADCRead(10); //Read Master bathroom floor temperature Pin 14 // ****************************************************************************** Temp[5] = ADCRead(11); //Read Office floor temperature Pin 11 // ****************************************************************************** Temp[6] = ADCRead(12); //Read Craft room floor temperature Pin 10 // ****************************************************************************** Temp[7] = ADCRead(17); //Read SE basement bedroom floor temperature Pin 41 // ****************************************************************************** Temp[8] = ADCRead(18); //Read Media room floor temperature Pin 42 // ****************************************************************************** Temp[9] = ADCRead(19); //Read Garage floor temperature Pin 43 // ****************************************************************************** Temp[10] = ADCRead(20); //Read Garage room air temperature Pin 44 // ****************************************************************************** internalBGV = ADCRead(0x1A); for(i = 0;i<11;++i) { Temp[i] = TempCalc(Temp[i]); if(Temp[i] > OldTemp[i] + 1 || Temp[i] < OldTemp[i] - 1) { Temp[i] = ((OldTemp[i] + Temp[i])/2); OldTemp[i] = Temp[i]; } else Temp[i] = OldTemp[i]; } // ****************************************************************************** for(i=0;i<11;i++) { if(OutAirTemp <= -250) { Bias[i] = eepromGetData(biasNeg25[i]); } else if (OutAirTemp > -250 && OutAirTemp <= -240) { Bias[i] = Bias[i]; } else if (OutAirTemp > -240 && OutAirTemp <= -150) { Bias[i] = eepromGetData(biasNeg15[i]); } else if (OutAirTemp > -150 && OutAirTemp <= -140) { Bias[i] = Bias[i]; } else if (OutAirTemp > -140 && OutAirTemp <= -50) { Bias[i] = BiasNeg5[i]; } else if (OutAirTemp > -50 && OutAirTemp <= -40) { Bias[i] = Bias[i]; } else if (OutAirTemp > -40 && OutAirTemp <= 0) { Bias[i] = Bias0[i]; } else if (OutAirTemp > 0 && OutAirTemp <= 10) { Bias[i] = Bias[i]; } else if (OutAirTemp > 10 && OutAirTemp <= 50) { Bias[i] = Bias5[i]; } else if (OutAirTemp > 50 && OutAirTemp <= 60) { Bias[i] = Bias[i]; } else { Bias[i] = BiasWarm[i]; } } // ****************************************************************************** for (i=0;i<11;i++) { Out[i] = SetOutput(Out[i], eepromGetData(setpoint[i]), Bias[i], Temp[i], eepromGetData(deadband[i])); } // ****************************************************************************** for(i=0;i<11;i++) { if (Temp[i] <= eepromGetData(setpoint[i]) + Bias[i]) //If Out is not Off { outState[i] = 1; } else if (Temp[i] >= eepromGetData(setpoint[i]) + Bias[i] + eepromGetData(deadband[i])) { outState[i] = 0; } else { outState[i] = outState[i]; } if(outState[i] != 0) { if (outState[i] != lastOutState[i]) //If Out changed since last read { outStateCounter[i]+=1; //Increment the OutState Counter } } lastOutState[i] = outState[i]; //And set them equal to each other, so, it doesn't count again next time through } // ****************************************************************************** OutSum = Out[1] + Out[2] + Out[3] + Out[4] + Out[5] + Out[6] + Out[7] + Out[8] + Out[9]; if(outSumOldState != OutSum) // OutSum has changed, { if(OutSum != 0) // because an Out is turned on { for(i=0;i<11;i++) { if (Temp[i] < eepromGetData(setpoint[i]) + eepromGetData(deadband[i]) + Bias[i])// Check for other PV's below SP + DB + Bias, { Out[i] = 1; // and turn them on. } else { Out[i] = 0; // Turn them off if they are already too hot!! } } } outSumOldState = OutSum; } // ****************************************************************************** if(Out[0] == 0) // If Deck Air Temp is NOT calling, { Out[1] = 0; // turn OFF Deck Floor Out } if(Out[10] == 0) // If Garage Air Temp is NOT calling, { Out[9] = 0; // turn OFF Garage Floor Out } DeckFloorOut = Out[1]; UtilityRoomFloorOut = Out[2]; EntranceFloorOut = Out[3]; MasterBathFloorOut = Out[4]; OfficeFloorOut = Out[5]; CraftRoomFloorOut = Out[6]; SEBasementFloorOut = Out[7]; MediaRoomFloorOut = Out[8]; GarageFloorOut = Out[9]; // ****************************************************************************** if(previousLoopCounter != loopCounter) { LCD_Clear(); mainTimer = 0; previousLoopCounter = loopCounter; } if(loopCounter < 11) { LCD_Set_Cursor(0,0); //LCD Line 0 Display LCD_Write_String(desc[loopCounter]); LCDWriteStringXY(0,13,"Loop "); LCD_Write_Int(loopCounter,2); LCDWriteStringXY(1,0,"Bs:"); //LCD Line 1 SetPoint Display LCDWriteDecIntXY(1,3,eepromGetData(setpoint[loopCounter]) + Bias[loopCounter],3); LCD_Write_Char(0); LCD_Write_Char('C'); LCDWriteStringXY(1,10,"Set:"); LCDWriteDecIntXY(1,14,eepromGetData(setpoint[loopCounter]),3); LCD_Write_Char(0); LCD_Write_Char(67); LCDWriteStringXY(2,0,"Temp:"); //LCD Line 2 Temperature Display LCDWriteDecIntXY(2,5,Temp[loopCounter],3); LCD_Write_Char(0); LCD_Write_Char(67); LCDWriteStringXY(2,12,"Db:"); //LCD Line 2 Deadband Display LCDWriteDecIntXY(2,15,eepromGetData(deadband[loopCounter]),2); LCD_Write_Char(0); LCD_Write_Char(67); LCDWriteIntXY(3,0,outStateCounter[loopCounter],5); LCDWriteStringXY(3,6,"On: "); //LCD Line 3 Out Display if(outState[loopCounter] == 1) { LCD_Write_Char('Y'); } else { LCD_Write_Char('N'); } LCDWriteStringXY(3,12,"FOn: "); if(outState[loopCounter] == 1 || Out[loopCounter] == 0) { LCD_Write_Char('N'); } else { LCD_Write_Char('Y'); } } if(loopCounter == 11) { if(mainTimer < 10) { LCDWriteStringXY(0,0,"Output loop counters"); } if(mainTimer >= 10) { LCDWriteStringXY(0,0,"Hold Cancel to Reset"); } LCDWriteIntXY(1,0,outStateCounter[0],4); LCDWriteIntXY(1,5,outStateCounter[1],4); LCDWriteIntXY(1,10,outStateCounter[2],4); LCDWriteIntXY(1,15,outStateCounter[3],4); LCDWriteIntXY(2,0,outStateCounter[4],4); LCDWriteIntXY(2,5,outStateCounter[5],4); LCDWriteIntXY(2,10,outStateCounter[6],4); LCDWriteIntXY(2,15,outStateCounter[7],4); LCDWriteIntXY(3,0,outStateCounter[8],4); LCDWriteIntXY(3,5,outStateCounter[9],4); LCDWriteIntXY(3,10,outStateCounter[10],4); LCD_Set_Cursor(3,15); // LCD_Write_2VDec_Int(421872/internalBGV,3); // Board with Green LCD's LCD_Write_2VDec_Int(405070/internalBGV,3); // Board with Blue LCD's if(TestKey == KEY_CANCEL) { reset += 1; if(reset > 10) { for(i=0;i<11;i++) { outStateCounter[i]= 0; reset = 0; } } } else { reset -= 1; if(reset < 0) { reset = 0; } } } if(loopCounter == 12) { if(powerFail == 1) { if(toggle == 1) { LCDWriteIntXY(0,0,time.year,2); LCDWriteStringXY(0,2,"/"); LCDWriteIntXY(0,3,time.month,2); LCDWriteStringXY(0,5,"/"); LCDWriteIntXY(0,6,time.day,2); LCDWriteStringXY(0,9,WeekDay[time.weekday]); LCDWriteIntXY(0,12,time.hour,2); LCDWriteStringXY(0,14,":"); LCDWriteIntXY(0,15,time.minute,2); LCDWriteStringXY(0,17,":"); LCDWriteIntXY(0,18,time.second,2); } else { LCDWriteStringXY(0,0," "); } } else { LCDWriteIntXY(0,0,time.year,2); LCDWriteStringXY(0,2,"/"); LCDWriteIntXY(0,3,time.month,2); LCDWriteStringXY(0,5,"/"); LCDWriteIntXY(0,6,time.day,2); LCDWriteStringXY(0,9,WeekDay[time.weekday]); LCDWriteIntXY(0,12,time.hour,2); LCDWriteStringXY(0,14,":"); LCDWriteIntXY(0,15,time.minute,2); LCDWriteStringXY(0,17,":"); LCDWriteIntXY(0,18,time.second,2); } /* LCDWriteStringXY(1,0,"X Pos:"); LCDWriteIntXY(1,7,x,5); LCDWriteStringXY(1,13,"Col:"); LCDWriteIntXY(1,18,col,1); LCDWriteStringXY(2,0,"Y Pos:"); LCDWriteIntXY(2,7,y,5); LCDWriteStringXY(2,13,"Row:"); LCDWriteIntXY(2,18,row,1); */ if(mainTimer <= 8) { LCDWriteStringXY(1,0,"OutSide Temp:"); LCDWriteSignedDecIntXY(1,13,OutAirTemp,3); LCD_Write_Char(0); LCD_Write_Char(67); // LCDWriteSignedDecIntXY(2,0,ADCRead(6),6); LCDWriteStringXY(2,0,"Enter Key Sets Time "); LCDWriteStringXY(3,0,"Menu Key Sets Temp "); } if(mainTimer > 8 && mainTimer <= 16) { LCDWriteStringXY(1,0,"OutSide Temp:"); LCDWriteSignedDecIntXY(1,13,OutAirTemp,3); LCD_Write_Char(0); LCD_Write_Char(67); LCDWriteStringXY(2,0," <- / -> Keys page "); LCDWriteStringXY(3,0," through Loop Info "); } if(mainTimer > 16 && mainTimer <= 20) { LCDWriteStringXY(1,0,"Left Key to display "); LCDWriteStringXY(2,0," all Loop Run-time "); LCDWriteStringXY(3,0," Info on One Page "); } } if(mainTimer > 19) { mainTimer = 0; // loopCounter = 12; } // ****************************************************************************** TestKey = menuRead(); // ****************************************************************************** heartBeat(); // HeartBeat displays the HeartBeat on the LCD, // ****************************************************************************** but, also increments mainTimer every second if(TestKey == KEY_NONE) // If no key is pressed for 60 seconds { // Turn OFF the LCD Backlight backLightTimer += 1; } else { backLightTimer = 0; } if (backLightTimer < 4450) { backLightOn = 1; } else { backLightTimer = 4450; backLightOn = 0; } if (TestKey == KEY_ENTER) { // TestKey = 9; SetTime(); } if (TestKey == KEY_RESET_LCD) { LCD_Cmd(0x08); LCD_Cmd(0x00); LCD_Cmd(0x0C|0); //Enable Display ON with style selected (BLINK, ULINE, BLUL, or NONE)) LCD_Cmd(0x00); } if(TestKey == KEY_LEFT) { loopCounter -=1; if(loopCounter < 0) { loopCounter = 12; } } if(TestKey == KEY_RIGHT) { loopCounter +=1; if(loopCounter >12) { loopCounter = 0; } } if (TestKey == KEY_MENU) { signed char choice = 5; while(TestKey != KEY_ENTER) { TestKey = menuRead(); if(timer > 1000) { timer = 0; goto Exit; //This uses less memory than TestKey = KEY_ENTER // TestKey = KEY_ENTER; // This functions fine, but forces a write to EEProm } switch(TestKey) { case KEY_DOWN: { choice -=1; if (choice < 0) { choice = 0; } } break; case KEY_LEFT: { choice -=1; if (choice < 0) { choice = 0; } } break; case KEY_UP: { choice += 1; if(choice > 10) { choice = 10; } } break; case KEY_RIGHT: { choice += 1; if(choice > 10) { choice = 10; } } break; case KEY_CANCEL: { goto Exit; } break; } if(timer < 2) { LCD_Clear(); } LCD_Set_Cursor(0,0); LCD_Write_String("Set Temperature for"); LCD_Set_Cursor(1,0); LCD_Write_String(desc[choice]); LCDWriteStringXY(2,0,"Up/Dn Keys to change"); LCDWriteStringXY(3,0,"Enter Key for Yes "); heartBeat(); // HeartBeat displays the HeartBeat on the LCD, // but, also increments mainTimer every second timer += 1; } // TestKey = 9; LCD_Clear(); LCD_Set_Cursor(0,0); LCD_Write_String(desc[choice]); LCDWriteStringXY(0,strlen(desc[choice]),"Set Tmp"); eepromPutData(setpoint[choice], TempSetpoint(eepromGetData(setpoint[choice]))); LCD_Set_Cursor(2,0); LCD_Write_String(desc[choice]); LCDWriteStringXY(2,strlen(desc[choice]),"Set DB"); eepromPutData(deadband[choice], SetDeadband(eepromGetData(deadband[choice]))); LCD_Clear(); LCD_Set_Cursor(0,0); LCD_Write_String(desc[choice]); LCDWriteStringXY(0,strlen(desc[choice]),"15 Bias"); eepromPutData(biasNeg15[choice], SetBiasNeg15(eepromGetData(biasNeg15[choice]))); LCD_Set_Cursor(2,0); LCD_Write_String(desc[choice]); LCDWriteStringXY(2,strlen(desc[choice]),"25 Bias"); eepromPutData(biasNeg25[choice], SetBiasNeg25(eepromGetData(biasNeg25[choice]))); Exit: LCD_Clear(); } // ****************************************************************************** ClrWdt(); //Clr (Re-Set) the WatchDog Timer } return(0); }
void Game::titleScreen() { Object titleScreen(10,5); Object pStart(15, 18); titleScreen.Frame(1); int i = 0; int pressStartEffect = 0; if (HEARTBEAT_THEME) pressStartEffect = 3; else pressStartEffect = 50; int done = false; while (titleScreen.Frame() < 57 && !done) // draw zoom animation of title { ticks = GetTickCount(); console.clear(); titleScreen.draw(title); titleScreen.Frame(titleScreen.Frame()+1); titleScreen.x(titleScreen.x()+1); if (GetKeyState(VK_RETURN) & 0x80) done = true; if (1000/FPS > GetTickCount()-ticks) { Sleep(1000/FPS-(GetTickCount()-ticks)); } } done = false; console.clear(); if (!HEARTBEAT_THEME) Sleep(200); titleScreen.x(10); titleScreen.y(5); titleScreen.Frame(0); while (!done) { ticks = GetTickCount(); if (HEARTBEAT_THEME) heartBeat(); if (i == 0) { titleScreen.draw(title); pStart.draw(pressStart); } if (i == pressStartEffect/2) { console.clear(); titleScreen.draw(title); } if (i < pressStartEffect) i++; else i = 0; if (GetKeyState(VK_RETURN) & 0x80) done = true; if (1000/FPS > GetTickCount()-ticks) { Sleep(1000/FPS-(GetTickCount()-ticks)); } } }
/*! \fn SimpleSynthGui::SimpleSynthGui() */ SimpleSynthGui::SimpleSynthGui() { SS_TRACE_IN setupUi(this); simplesynthgui_ptr = this; pluginGui = new SS_PluginGui(this); pluginGui->hide(); for (int i=0; i<SS_NR_OF_CHANNELS; i++) { channelButtonGroups[i] = new QGroupBox(this); // channelButtonGroups[i]->setMinimumSize(SS_BTNGRP_WIDTH, SS_BTNGRP_HEIGHT); channelButtonGroups[i]->setTitle(QString::number(i + 1)); QString name = QString("volumeSlider"); name.append(i + 1); channelLayout->addWidget(channelButtonGroups[i]); QVBoxLayout* inchnlLayout = new QVBoxLayout(channelButtonGroups[i]); //, 2, 0, "channelinternallayout"); inchnlLayout->setAlignment(Qt::AlignHCenter); inchnlLayout->setSpacing(1); inchnlLayout->setMargin(0); onOff[i] = new QChannelCheckbox(channelButtonGroups[i], i); // onOff[i]->setMinimumSize(SS_ONOFF_WIDTH, SS_ONOFF_HEIGHT); onOff[i]->setToolTip("Channel " + QString::number(i + 1) + " on/off"); inchnlLayout->addWidget(onOff[i]); connect(onOff[i], SIGNAL(channelState(int, bool)), SLOT(channelOnOff(int, bool))); ///volumeSliders[i] = new QInvertedChannelSlider(Qt::Vertical, i, channelButtonGroups[i]); // By Tim. p4.0.27 Inverted was not correct type. Maybe was work in progress, rest of code was not converted yet? QHBoxLayout *volLayout = new QHBoxLayout(channelButtonGroups[i]); volumeSliders[i] = new QChannelSlider(Qt::Vertical, i, channelButtonGroups[i]); volumeSliders[i]->setMinimum(SS_VOLUME_MIN_VALUE); volumeSliders[i]->setMaximum(SS_VOLUME_MAX_VALUE); ///volumeSliders[i]->setValue(SS_VOLUME_MAX_VALUE - SS_VOLUME_DEFAULT_VALUE); volumeSliders[i]->setValue(SS_VOLUME_DEFAULT_VALUE); // p4.0.27 // volumeSliders[i]->setMinimumSize(SS_VOLSLDR_WIDTH, SS_VOLSLDR_LENGTH); volumeSliders[i]->setToolTip("Volume, channel " + QString::number(i + 1)); // setMinimumSize(SS_VOLSLDR_WIDTH, SS_VOLSLDR_LENGTH); volLayout->addWidget(volumeSliders[i]); chnMeter[i] = new MusEGui::Meter(channelButtonGroups[i]); chnMeter[i]->setFixedWidth(9); chnMeter[i]->setVal(0.0, 0.0, false); meterVal[i] = peakVal[i] = 0.0; chnMeter[i]->setRange(MusEGlobal::config.minMeter, 10.0); chnMeter[i]->show(); volLayout->addWidget(chnMeter[i]); inchnlLayout->addLayout(volLayout); //inchnlLayout->addWidget(volumeSliders[i]); connect(volumeSliders[i], SIGNAL(valueChanged(int, int)), SLOT(volumeChanged(int, int))); pitchKnobs[i] = new QChannelDial(channelButtonGroups[i], i, 0); pitchKnobs[i]->setRange(-63,63); pitchKnobs[i]->setValue(0); pitchKnobs[i]->setToolTip("Pitch, channel " + QString::number(i + 1)); pitchKnobs[i]->setFixedSize(30,30); inchnlLayout->addWidget(pitchKnobs[i]); connect(pitchKnobs[i], SIGNAL(valueChanged(int,int,int)), SLOT(pitchChanged(int,int, int))); nOffLabel[i] = new QLabel(channelButtonGroups[i]); nOffLabel[i]->setText("nOff"); inchnlLayout->addWidget(nOffLabel[i]); nOffIgnore[i] = new QChannelCheckbox(channelButtonGroups[i], i); nOffIgnore[i]->setToolTip("Note off ignore, channel " + QString::number(i + 1)); inchnlLayout->addWidget(nOffIgnore[i]); connect(nOffIgnore[i], SIGNAL(channelState(int, bool)),SLOT(channelNoteOffIgnore(int, bool))); panSliders[i] = new QChannelSlider(Qt::Horizontal, i, channelButtonGroups[i]); panSliders[i]->setRange(0, 127); panSliders[i]->setValue(SS_PANSLDR_DEFAULT_VALUE); panSliders[i]->setToolTip("Pan, channel " + QString::number(i + 1)); inchnlLayout->addWidget(panSliders[i]); connect(panSliders[i], SIGNAL(valueChanged(int, int)), SLOT(panChanged(int, int))); QGridLayout* dialGrid = new QGridLayout; inchnlLayout->addLayout(dialGrid); sendFxDial[i][0] = new QChannelDial(channelButtonGroups[i], i, 0); sendFxDial[i][0]->setRange(0, 127); sendFxDial[i][0]->setMaximumSize(SS_SENDFX_WIDTH, SS_SENDFX_HEIGHT); sendFxDial[i][0]->setToolTip("Fx 1 send amount"); dialGrid->addWidget(sendFxDial[i][0], 0, 0, Qt::AlignCenter | Qt::AlignTop); connect(sendFxDial[i][0], SIGNAL(valueChanged(int, int, int)), SLOT(sendFxChanged(int, int, int))); sendFxDial[i][1] = new QChannelDial(channelButtonGroups[i], i, 1); sendFxDial[i][1]->setRange(0, 127); dialGrid->addWidget(sendFxDial[i][1], 0, 1, Qt::AlignCenter | Qt::AlignTop); sendFxDial[i][1]->setMaximumSize(SS_SENDFX_WIDTH, SS_SENDFX_HEIGHT); sendFxDial[i][1]->setToolTip("Fx 2 send amount"); connect(sendFxDial[i][1], SIGNAL(valueChanged(int, int, int)), SLOT(sendFxChanged(int, int, int))); sendFxDial[i][2] = new QChannelDial(channelButtonGroups[i], i, 2); sendFxDial[i][2]->setRange(0, 127); sendFxDial[i][2]->setMaximumSize(SS_SENDFX_WIDTH, SS_SENDFX_HEIGHT); dialGrid->addWidget(sendFxDial[i][2], 1, 0, Qt::AlignCenter | Qt::AlignTop); sendFxDial[i][2]->setToolTip("Fx 3 send amount"); connect(sendFxDial[i][2], SIGNAL(valueChanged(int, int, int)), SLOT(sendFxChanged(int, int, int))); sendFxDial[i][3] = new QChannelDial(channelButtonGroups[i], i, 3); sendFxDial[i][3]->setRange(0, 127); sendFxDial[i][3]->setMaximumSize(SS_SENDFX_WIDTH, SS_SENDFX_HEIGHT); sendFxDial[i][3]->setToolTip("Fx 4 send amount"); dialGrid->addWidget(sendFxDial[i][3], 1, 1, Qt::AlignCenter | Qt::AlignTop); connect(sendFxDial[i][3], SIGNAL(valueChanged(int, int, int)), SLOT(sendFxChanged(int, int, int))); chnRoutingCb[i] = new QComboBox(channelButtonGroups[i]); chnRoutingCb[i]->addItem(tr("Mix"), QVariant(0)); chnRoutingCb[i]->addItem(tr("Chn"), QVariant(1)); chnRoutingCb[i]->setMaximumSize(SS_PANSLDR_WIDTH, SS_PANSLDR_LENGTH); chnRoutingCb[i]->setToolTip(tr("Channel routing")); QFont chnRFont; chnRFont.setPointSize(6); chnRoutingCb[i]->setFont(chnRFont); connect(chnRoutingCb[i], SIGNAL(currentIndexChanged(int)), this, SLOT(routeChanged(int))); inchnlLayout->addWidget(chnRoutingCb[i]); inchnlLayout->activate(); } masterSlider = new QSlider(Qt::Vertical, this); masterSlider->setToolTip("Master volume"); channelLayout->addWidget(masterSlider); masterSlider->setRange(0, 127); masterSlider->setValue((int)(SS_MASTERVOL_DEFAULT_VALUE*SS_VOLUME_MAX_VALUE)); // p4.0.27 connect(masterSlider, SIGNAL(valueChanged(int)), SLOT(masterVolChanged(int))); // p4.0.27 int i=0; for (int c=0; c<2; c++) { for (int r=0; r<SS_NR_OF_CHANNELS/2; r++) { QHBoxLayout* strip = new QHBoxLayout; mgbLayout->addLayout(strip, r, c); QLabel* channelLabel = new QLabel(QString::number(i + 1) + ": (" +labelStrings[i] + ")", mainGroupBox); strip->addWidget(channelLabel); sampleNameLineEdit[i] = new QLineEdit(mainGroupBox); sampleNameLineEdit[i]->setReadOnly(true); sampleNameLineEdit[i]->setFixedWidth(180); strip->addWidget(sampleNameLineEdit[i]); loadSampleButton[i] = new QChannelButton(mainGroupBox, "L", i); loadSampleButton[i]->setToolTip("Load sample on channel " + QString::number(i + 1)); loadSampleButton[i]->setFixedSize(23,23); strip->addWidget(loadSampleButton[i]); connect(loadSampleButton[i], SIGNAL(channelState(int, bool)), SLOT(loadSampleDialogue(int))); clearSampleButton[i] = new QChannelButton(mainGroupBox, "C", i); clearSampleButton[i]->setToolTip("Clear sample on channel " + QString::number(i + 1)); clearSampleButton[i]->setFixedSize(23,23); strip->addWidget(clearSampleButton[i]); connect(clearSampleButton[i], SIGNAL(channelState(int, bool)), SLOT(clearSample(int))); i++; } } // Right bottom panel: QGroupBox* rbPanel= new QGroupBox(mainGroupBox); mgbLayout->addWidget(rbPanel, 1, 3, 7, 1, Qt::AlignCenter); QGridLayout* rbLayout = new QGridLayout(rbPanel); openPluginsButton = new QPushButton("&Send Effects"); openPluginsButton->setToolTip("Configure LADSPA send effects"); connect(openPluginsButton, SIGNAL(clicked()), SLOT(openPluginButtonClicked())); rbLayout->addWidget(openPluginsButton, 2, 1, Qt::AlignCenter | Qt::AlignVCenter); rbLayout->setSpacing(0); rbLayout->setMargin(0); aboutButton = new QPushButton("About SimpleDrums"); connect(aboutButton, SIGNAL(clicked()), SLOT(aboutButtonClicked())); rbLayout->addWidget(aboutButton, 4, 1, Qt::AlignLeft | Qt::AlignVCenter); loadButton = new QPushButton(tr("&Load setup"), rbPanel); connect(loadButton, SIGNAL(clicked()), SLOT(loadSetup())); saveButton = new QPushButton(tr("&Save setup"), rbPanel); connect(saveButton, SIGNAL(clicked()), SLOT(saveSetup())); rbLayout->addWidget(loadButton, 3, 1, Qt::AlignCenter | Qt::AlignVCenter); rbLayout->addWidget(saveButton, 4, 1, Qt::AlignCenter | Qt::AlignVCenter); rbLayout->addWidget(aboutButton, 6, 1, Qt::AlignCenter | Qt::AlignVCenter); lastDir = ""; //Connect socketnotifier to fifo QSocketNotifier* s = new QSocketNotifier(readFd, QSocketNotifier::Read); connect(s, SIGNAL(activated(int)), SLOT(readMessage(int))); //connect heartBeat timer (for channel meters) connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat())); SS_TRACE_OUT }