Exemple #1
0
void MainWindow::on_actionImport_Song_triggered()
{
    audioFileName = QFileDialog::getOpenFileName(this, tr("Open File"),"/home/matt/Desktop",tr("Audio (*.mp3 *.wav)"));
    if(audioFileName!="")
    {
        if(thePlayer!=NULL)
        {
            delete thePlayer;
            thePlayer=NULL;
        }
        thePlayer = new QMediaPlayer();
        thePlayer->setNotifyInterval(20);
        connect(thePlayer,SIGNAL(durationChanged(qint64)),this,SLOT(updateSongDuration(qint64)));
        connect(thePlayer,SIGNAL(stateChanged(QMediaPlayer::State)),this,SLOT(checkForNextSong(QMediaPlayer::State)));
        connect(thePlayer,SIGNAL(positionChanged(qint64)),ui->label_2,SLOT(playPositionChanged(qint64)));
        connect(ui->label_2,SIGNAL(userChangePlayPosition(qint64)),thePlayer,SLOT(setPosition(qint64)));

        thePlayer->setMedia(QUrl::fromLocalFile(audioFileName));
        if(ui->label_2->isSongAdded())
        {
            tempTrackCount=ui->label_2->getChannelSize();
            ui->label_2->clearAllData();
            ui->label_2->resetSongAdded();
        }

    }
}
/**
  * Creating needed connections
  */
void MainWindow::createConnections()
{
    connect(ui->leSearch, SIGNAL(returnPressed()), this, SLOT(searchAudio()));

    connect(playerControls, SIGNAL(play()), player, SLOT(play()));
    connect(playerControls, SIGNAL(pause()), player, SLOT(pause()));
    connect(playerControls, SIGNAL(volumeChanged(int)), player, SLOT(setVolume(int)));
    connect(playerControls, SIGNAL(playPositionChanged(qint64)), player, SLOT(setPosition(qint64)));

    connect(player, SIGNAL(positionChanged(qint64)), playerControls, SLOT(setPlayPosition(qint64)));
    connect(player, SIGNAL(durationChanged(qint64)), playerControls, SLOT(setAudioLength(qint64)));
    connect(player, SIGNAL(volumeChanged(int)), playerControls, SLOT(setVolume(int)));
    connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), playerControls, SLOT(setState(QMediaPlayer::State)));
    connect(playlist, SIGNAL(titleChange(QString)), playerControls, SLOT(setTitle(QString)));

    connect(playerControls, SIGNAL(previous()), playlist, SLOT(previous()));
    connect(playerControls, SIGNAL(next()), playlist, SLOT(next()));

    connect(playerControls, SIGNAL(configure()), this, SLOT(showSettingsDialog()));

    connect(vkaudio, SIGNAL(statusChanged(QString, int)), this->statusBar(), SLOT(showMessage(QString,int)));

    connect(ui->tvSongs, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(playAudio()));
    connect(ui->tvSongs, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showSongsContextMenu(QPoint)));
    connect(ui->tvPlaylists, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showPlaylistsContextMenu(QPoint)));
}
Exemple #3
0
void RDCae::clockData()
{
  for(int i=0;i<RD_MAX_CARDS;i++) {
    for(int j=0;j<RD_MAX_STREAMS;j++) {
      if(cae_handle[i][j]>=0) {
	if(cae_output_positions[i][j]!=cae_pos[i][j]) {
	  emit playPositionChanged(cae_handle[i][j],
				   cae_output_positions[i][j]);
	  cae_pos[i][j]=cae_output_positions[i][j];
	}
      }
    }
  }
}
Exemple #4
0
void RDCae::DispatchCommand(RDCmdCache *cmd)
{
  int pos;
  int card;

  if(!strcmp(cmd->arg(0),"PW")) {   // Password Response
    if(cmd->arg(1)[0]=='+') {
      emit isConnected(true);
    }
    else {
      emit isConnected(false);
    }
  }

  if(!strcmp(cmd->arg(0),"LP")) {   // Load Play
    int handle=GetHandle(cmd->arg(4));
    int card=CardNumber(cmd->arg(1));
    int stream=StreamNumber(cmd->arg(3));
    syslog(LOG_ERR,"*** RDCae::DispatchCommand: received unhandled play stream from CAE, handle=%d, card=%d, stream=%d, name=\"%s\" ***",
	   handle,card,stream,cmd->arg(2));
    
    unloadPlay(handle);
  }

  if(!strcmp(cmd->arg(0),"UP")) {   // Unload Play
    if(cmd->arg(2)[0]=='+') {
      int handle=GetHandle(cmd->arg(1));
      for(int i=0;i<RD_MAX_CARDS;i++) {
	for(int j=0;j<RD_MAX_STREAMS;j++) {
	  if(cae_handle[i][j]==handle) {
	    cae_handle[i][j]=-1;
	    for(unsigned k=0;k<RD_MAX_PORTS;k++) {
	      cae_output_status_flags[i][k][j]=false;
	    }
	  }
	}
      }
      emit playUnloaded(handle);
    }
  }

  if(!strcmp(cmd->arg(0),"PP")) {   // Position Play
    if(cmd->arg(3)[0]=='+') {
      int handle=GetHandle(cmd->arg(1));
      sscanf(cmd->arg(2),"%u",&pos);
      for(int i=0;i<RD_MAX_CARDS;i++) {
	for(int j=0;j<RD_MAX_STREAMS;j++) {
	  if(cae_handle[i][j]==handle) {
	    //emit playPositionChanged(handle,cae_output_positions[i][j]);
	    emit playPositionChanged(handle,pos);
	  }
	}
      }
      emit playPositioned(handle,pos);
    }
  }

  if(!strcmp(cmd->arg(0),"PY")) {   // Play
    if(cmd->arg(4)[0]=='+') {
      emit playing(GetHandle(cmd->arg(1)));
    }
  }

  if(!strcmp(cmd->arg(0),"SP")) {   // Stop Play
    if(cmd->arg(2)[0]=='+') {
      emit playStopped(GetHandle(cmd->arg(1)));
    }
  }

  if(!strcmp(cmd->arg(0),"TS")) {   // Timescale Supported
    if(sscanf(cmd->arg(1),"%d",&card)==1) {
      if(cmd->arg(2)[0]=='+') {
	emit timescalingSupported(card,true);
      }
      else {
	emit timescalingSupported(card,false);
      }
    }
  }

  if(!strcmp(cmd->arg(0),"LR")) {   // Load Record
    if(cmd->arg(8)[0]=='+') {
      emit recordLoaded(CardNumber(cmd->arg(1)),StreamNumber(cmd->arg(2)));
    }
  }

  if(!strcmp(cmd->arg(0),"UR")) {   // Unload Record
    if(cmd->arg(4)[0]=='+') {
      emit recordUnloaded(CardNumber(cmd->arg(1)),StreamNumber(cmd->arg(2)),
			  QString(cmd->arg(3)).toUInt());
    }
  }

  if(!strcmp(cmd->arg(0),"RD")) {   // Record
  }

  if(!strcmp(cmd->arg(0),"RS")) {   // Record Start
    if(cmd->arg(3)[0]=='+') {
      emit recording(CardNumber(cmd->arg(1)),StreamNumber(cmd->arg(2)));
    }
  }

  if(!strcmp(cmd->arg(0),"SR")) {   // Stop Record
    if(cmd->arg(3)[0]=='+') {
      emit recordStopped(CardNumber(cmd->arg(1)),StreamNumber(cmd->arg(2)));
    }
  }

  if(!strcmp(cmd->arg(0),"IS")) {   // Input Status
    switch(cmd->arg(3)[0]) {
	case '0':
	  emit inputStatusChanged(CardNumber(cmd->arg(1)),
				  StreamNumber(cmd->arg(2)),true);
	  input_status[CardNumber(cmd->arg(1))][StreamNumber(cmd->arg(2))]=
	    true;
	  break;

	case '1':
	  emit inputStatusChanged(CardNumber(cmd->arg(1)),
				  StreamNumber(cmd->arg(2)),false);
	  input_status[CardNumber(cmd->arg(1))][StreamNumber(cmd->arg(2))]=
	    false;
	  break;
    }
  }
}
void PlayerControls::seekSliderReleased()
{
    emit playPositionChanged(seekSlider->value() * audioLength / seekSlider->maximum());
}