예제 #1
0
파일: player.cpp 프로젝트: jck/MellowPlayer
//---------------------------------------------------------
void PlayerInterface::previous()
{
    IStreamingService* iService =
            Services::streamingServices()->currentService();
    if(!iService || !iService->currentSongInfo().isValid())
        return;
    if(m_tempo  !=  0)
        return;
    iService->previous();
    runTimer();
}
예제 #2
0
// find time till next note and start timer
void MusicPlayer::startNoteTimer()  {

    // end of music
    if (startIt == startNotes.end() && stopIt == stopNotes.end()) {

        return;

    }

    // start liste empty
    if (startIt == startNotes.end()) {

        runTimer((*stopIt)->getEndTime());
        return;

    }

    // stop list empty
    if (stopIt == stopNotes.end()) {

        qDebug() << (*startIt)->getStartTime();
        runTimer((*startIt)->getStartTime());
        return;

    }

    int startTime = (*startIt)->getStartTime();
    int stopTime = (*stopIt)->getEndTime();

    // decide if start or stop is first
    if (startTime > stopTime) {

        runTimer(stopTime);

    } else {

        runTimer(startTime);

    }

}
예제 #3
0
파일: player.cpp 프로젝트: jck/MellowPlayer
//---------------------------------------------------------
void PlayerInterface::playPause()
{
    IStreamingService* iService =
            Services::streamingServices()->currentService();
    if(!iService || !iService->currentSongInfo().isValid())
        return;
    SongInfo song = iService->currentSongInfo();
    if(m_tempo != 0)
        return;
    if(playbackStatus() > Playing)
        iService->play();
    else
        iService->pause();
    runTimer();
}
예제 #4
0
void loop (){
  //WHAT MODE
  LCDSerial.print(mode);
  if (digitalRead(buttonApin) == LOW){
    while (digitalRead(buttonApin)){
     //avoids flipping modes rapidly
    }
     if (mode == 1){mode=2;}
     else if (mode == 2){mode=3;}
     else if (mode == 3){mode=4;}
     else if (mode == 4){mode=5;}
     else if (mode == 5){mode=6;}
     else if (mode == 6){mode=7;}
     else mode = 1;
  }
  //ACCELEROMETER
 if (mode == 2) {
    accelerometer();
 }
 //LAP TIMER 
 if (mode == 6){
   runTimer();
 } 
 if (mode == 1){
  temp_meter(); 
 }
 if (mode == 3){
  boost_meter(); 
 }
 if (mode == 4){
  temp_boost_meter(); 
 }
 if (mode == 5){
   two_temp_meter();
 }
 if (mode == 7){
   usb_logger();
 }
 
}
예제 #5
0
void TestServer::test(Socket *s) {
  m_keepRunning = true;
  m_wantsToReceive = false;
  m_actionQueueHead = NULL;
  delete m_driver;
  m_driver = new SessionDriver(this, m_master);
  m_driver->newSession(s);
  while (m_keepRunning) {
    m_keepRunning = false;
    if (m_wantsToReceive) {
      m_keepRunning = true;
      m_wantsToReceive = false;
      m_driver->doWork();
    }
    // If it doesn't want to receive more data, then it's waiting for a timer to expire
    // so run through the timer items until it does want to receive more data
    while (m_keepRunning && !m_wantsToReceive) {
      runTimer();
    }
  }
  delete m_driver;
}
예제 #6
0
파일: flash.c 프로젝트: binarman/diskBench
void writeTest(const struct device *dev, long firstChnk, size_t blockSize){
  char *buf;
  flushDevice(dev);
  long numChnks = dev->size / DISP;
  long reps = PAGE_WRITE_REPS;
  prepareTest("  ", blockSize, &buf, blockSize*reps, STRICT_ACCESS_OPT);
  stopTimer();
  for (long i=0; i<reps; ++i){
    unsigned long chnkNum = (i+firstChnk) % numChnks;
    off_t offset = chnkNum * DISP;
    readTestBlock(dev->fd, offset, buf+i*blockSize, blockSize);
  }
  flushDevice(dev);
  runTimer();
  for (long i=0; i<reps; ++i){
    unsigned long chnkNum = (i+firstChnk) % numChnks;
    off_t offset = chnkNum * DISP;
    writeTestBlock(dev->fd, offset, buf+i*blockSize, blockSize);
  }
  flushDevice(dev);
  concludeTest("  ", blockSize, buf);
}
IntelligentClient::IntelligentClient(int argc, char** argv) : isTimeout(false) {
  // connect to MPD server
  MPD::Client::GetInstance()->SetHostname(Config::GetInstance()->getHost());
  MPD::Client::GetInstance()->SetPassword(Config::GetInstance()->getPassword());
  MPD::Client::GetInstance()->SetPort(Config::GetInstance()->getPort());
  MPD::Client::GetInstance()->Connect();

  MPD::Client::GetInstance()->SetStatusUpdater(updatePlayer, 0);

  // check if we are connected
  if (MPD::Client::GetInstance()->Connected()) {
    GUI::MainWindow::GetInstance()->setStatusBar(_("MPD connected: ") + Config::GetInstance()->getHost() + ":" + utils::intToString(Config::GetInstance()->getPort()));
  } else {
    GUI::MainWindow::GetInstance()->setStatusBar(_("Error while connecting to MPD server"));
    GUI::MainWindow::GetInstance()->showErrorDialog(_("Error in connecting to MPD"));
  }

  runTimer();

#if ENABLE_GUI
  // run main window
  kit.run(*GUI::MainWindow::GetInstance()->getWindow());
#endif
}