Пример #1
0
 void Piano::play_solmD(){
     QSound::play(":/new/prefix1/son/solmD.wav");
     notes_jouees->append(QString("solmD"));
     char action2[50]=  "sol# mineur";
     log(action,action2);
     emit played();
 }
Пример #2
0
 void Piano::play_laMD(){
     QSound::play(":/new/prefix1/son/laMD.wav");
     notes_jouees->append(QString("laMD"));
     char action2[50]=  "la# Majeur";
     log(action,action2);
     emit played();
 }
Пример #3
0
 void Piano::play_mim(){
     QSound::play(":/new/prefix1/son/mim.wav");
     notes_jouees->append(QString("mim"));
     char action2[50]=  "mi mineur";
     log(action,action2);
     emit played();
 }
Пример #4
0
 void Piano::play_faM(){
     QSound::play(":/new/prefix1/son/faM.wav");
     notes_jouees->append(QString("faM"));
     char action2[50]=  "fa Majeur";
     log(action,action2);
     emit played();
 }
Пример #5
0
void Piano::retour_arriere(){

    if(notes_jouees->size()>0){
        QSound::play(":/new/prefix1/son/back.wav");
        notes_jouees->removeLast();
        emit(played());
    }

}
Пример #6
0
bool Profilmplayer::init()
{
    //m_process = new QProcess(this);
    m_process->setWorkingDirectory(m_mplayer_WD);
    QObject::connect(m_process, SIGNAL(started()), this, SIGNAL(played()));
    QObject::connect(m_process, SIGNAL(finished(int)), this, SIGNAL(finished()));
    m_initialised = true;
    return true;
}
Пример #7
0
void	FakePlayer::play()
{
  duration = optionValue["duration"].toInt();
  static bool first = true;
  if (first)
            connect(&timer, SIGNAL(timeout()), this, SLOT(newTick()));
  first = false;
  emit played();
  timer.start(interval);
}
Пример #8
0
void Player::play(double speed)
{
    emit played(speed);
    if (m_isSeekable) {
        actionPlay->setIcon(m_pauseIcon);
        actionPlay->setText(tr("Pause"));
        actionPlay->setToolTip(tr("Pause playback (K)"));
    }
    else {
        actionPlay->setIcon(QIcon::fromTheme("media-playback-stop", QIcon(":/icons/oxygen/32x32/actions/media-playback-stop.png")));
        actionPlay->setText(tr("Stop"));
        actionPlay->setToolTip(tr("Stop playback (K)"));
    }
}
Пример #9
0
bool PlayStream::play()
{
#ifdef RPLAYSTREAM_SHOW_SLOTS
  printf("play() -- Card: %d  Stream: %d\n",card_number,stream_number);
#endif  // RPLAYSTREAM_SHOW_SLOTS
  
  if(!is_open) {
    printf("FAIL1\n");
    return false;
  }
  if((!playing)&&(!is_paused)) {
    HPICall(HPI_OutStreamSetTimeScale(NULL,hpi_stream,
				      (uint16_t)((1000.0/(double)play_speed)*
						HPI_OSTREAM_TIMESCALE_UNITS)));
    if(!HPICall(HPI_OutStreamGetInfoEx(NULL,hpi_stream,
				       &state,&buffer_size,&data_to_play,
				       &samples_played,&reserved))) {
      printf("FAIL3\n");
      return false;
    }
    fragment_size=buffer_size/4;
    if(fragment_size>MAX_FRAGMENT_SIZE) {
      fragment_size=MAX_FRAGMENT_SIZE;
    }
    if(pdata!=NULL) {
      delete pdata;
    }
    pdata=(uint8_t *)malloc(fragment_size);
    if(pdata==NULL) {
      printf("FAIL4\n");
      return false;
    }
    switch(getFormatTag()) {
	case WAVE_FORMAT_PCM:
	case WAVE_FORMAT_VORBIS:
	  switch(getBitsPerSample()) {
	      case 8:
		HPICall(HPI_FormatCreate(&format,getChannels(),
					 HPI_FORMAT_PCM8_UNSIGNED,
					 getSamplesPerSec(),0,0));
		break;
	      case 16:
		HPICall(HPI_FormatCreate(&format,getChannels(),
					 HPI_FORMAT_PCM16_SIGNED,
					 getSamplesPerSec(),0,0));
		break;
	      case 32:
		HPICall(HPI_FormatCreate(&format,getChannels(),
					 HPI_FORMAT_PCM32_SIGNED,
					 getSamplesPerSec(),0,0));
		break;
	      default:
		HPICall(HPI_AdapterClose(NULL,card_number));
		return false;
		break;
	  }
	  break;
	case WAVE_FORMAT_MPEG:
	  switch(getHeadLayer()) {
	      case 1:
		HPICall(HPI_FormatCreate(&format,getChannels(),
					 HPI_FORMAT_MPEG_L1,getSamplesPerSec(),
					 getHeadBitRate(),getHeadFlags()));
		break;
	      case 2:
		HPICall(HPI_FormatCreate(&format,getChannels(),
					 HPI_FORMAT_MPEG_L2,getSamplesPerSec(),
					 getHeadBitRate(),getHeadFlags()));
		break;
	      case 3:
		HPICall(HPI_FormatCreate(&format,getChannels(),
					 HPI_FORMAT_MPEG_L3,getSamplesPerSec(),
					 getHeadBitRate(),getHeadFlags()));
		break;
	      default:
		HPI_AdapterClose(NULL,card_number);
		return false;
	  }
	  break;
	default:
	  return false;
    }
#if HPI_VER < 0x00030500
    if(HPI_DataCreate(&hpi_data,&format,pdata,fragment_size)!=0) {
      return false;
    }
#endif
  }
   if(!is_paused) {
    memset(pdata,0,fragment_size);
    left_to_write=getDataLength()-seekWave(0,SEEK_CUR);
    if(left_to_write<fragment_size) {
      read_bytes = left_to_write;
      left_to_write=0;
      stopping=true;
    }
    else {
      read_bytes=fragment_size;
      left_to_write-=fragment_size;
    }
    readWave(pdata,read_bytes);
#if HPI_VER > 0x00030500
    HPICall(HPI_OutStreamWriteBuf(NULL,hpi_stream,pdata,read_bytes,&format));
#else
    HPICall(HPI_DataCreate(&hpi_data,&format,pdata,read_bytes));
    HPICall(HPI_OutStreamWrite(NULL,hpi_stream,&hpi_data));
#endif
    if(HPI_OutStreamStart(NULL,hpi_stream)!=0) {
      printf("FAIL11\n");
      return false;
    }
    clock->start(50);
    clock->start(FRAGMENT_TIME);
    playing=true;
    is_paused=false;
    stopping=false;
    if(play_length>0) {
      play_timer->start(play_length,true);
      start_time=QTime::currentTime();
    }
    stream_state=PlayStream::Playing;
    if(!restart_transport) {
      emit isStopped(false);
      emit played();
      emit stateChanged(card_number,stream_number,(int)stream_state);
    }
  }
  if((!playing)&(is_paused|repositioned)) {
    HPICall(HPI_OutStreamStart(NULL,hpi_stream));
    clock->start(FRAGMENT_TIME);
    playing=true;
    stopping=false;
    is_paused=false;
    stream_state=PlayStream::Playing;
    if(!restart_transport) {
      emit isStopped(false);
      emit played();
      emit stateChanged(card_number,stream_number,(int)stream_state);
    }
  }      
  return true;
}
Пример #10
0
Player::Player(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Player)
{
    std::cout << "Initialize player..." << std::endl;
    ui->setupUi(this);

    //Add MPlayer frame
    mplayer = new MPlayer;
    ui->playerLayout->setMargin(0);
    ui->playerLayout->addWidget(mplayer, 1);
    //enable autohiding toolbar
    mplayer->installEventFilter(this);
    mplayer->setMouseTracking(true);
    mplayer->getLayer()->installEventFilter(this);
    mplayer->getLayer()->setMouseTracking(true);
    ui->toolBar->installEventFilter(this);

    //move window
    ui->titleBar->installEventFilter(this);

    //Add Playlist
    playlist = new Playlist;
    ui->playerLayout->addWidget(playlist);
    playlist->installEventFilter(this);

    //Add Border
    topLeftBorder = new Border(this, Border::LEFT);
    topLeftBorder->setObjectName("topLeftBorder");
    topRightBorder = new Border(this, Border::RIGHT);
    topRightBorder->setObjectName("topRightBorder");
    ui->titleBarLayout->insertWidget(0, topLeftBorder);
    ui->titleBarLayout->addWidget(topRightBorder);

    leftBorder = new Border(this, Border::LEFT);
    leftBorder->setObjectName("leftBorder");
    rightBorder = new Border(this, Border::RIGHT);
    rightBorder->setObjectName("rightBorder");
    bottomBorder = new Border(this, Border::BOTTOM);
    bottomBorder->setObjectName("bottomBorder");
    ui->playerLayout->insertWidget(0, leftBorder);
    ui->playerLayout->addWidget(rightBorder);
    ui->mainLayout->addWidget(bottomBorder);

    ui->pauseButton->hide();
    ui->progressBar->hide();
    playlist->hide();

    //Add Cutterbar
    cutterbar = new CutterBar;
    int insertPos = ui->mainLayout->indexOf(ui->toolBar);
    ui->mainLayout->insertWidget(insertPos, cutterbar);
    cutterbar->hide();
    mplayer->menu->addAction(tr("Cut video"), this, SLOT(showCutterbar()), QKeySequence("C"));

    //Add WebVideo
    webvideo = new WebVideo;
    reslibrary = new ResLibrary;
    webvideo->addTab(reslibrary, tr("Resources"));
    webvideo->setCurrentIndex(0);

    //add downloader
    downloader = new Downloader;
    webvideo->addTab(downloader, tr("Downloader"));

    //add transformer
    transformer = new Transformer;

    //Settings Dialog
    settingsDialog = new SettingsDialog(this);

    //Add menu
    menubar = new QMenuBar;
    menu = menubar->addMenu(tr("Player"));
    menu->addAction(tr("Online video"), webvideo, SLOT(show()));
    menu->addAction(tr("Transform video"), transformer, SLOT(show()));
    menu->addAction(tr("Settings"), this, SLOT(onSetButton()));
    menu->addSeparator();
    menu->addAction(tr("Homepage"), this, SLOT(openHomepage()));
    menu->addAction(tr("About"), this, SLOT(onAboutClicked()));
    ui->mainLayout->insertWidget(0, menubar);

    //Add time show
    timeShow = new QLabel(mplayer);
    timeShow->move(0, 0);
    timeShow->hide();

    //Connect
    connect(ui->playButton, SIGNAL(clicked()), mplayer, SLOT(changeState()));
    connect(ui->pauseButton, SIGNAL(clicked()), mplayer, SLOT(changeState()));
    connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(onStopButton()));
    connect(ui->progressBar, SIGNAL(valueChanged(int)), this, SLOT(onPBarChanged(int)));
    connect(ui->progressBar, SIGNAL(sliderPressed()), this, SLOT(onPBarPressed()));
    connect(ui->progressBar, SIGNAL(sliderReleased()), this, SLOT(onPBarReleased()));
    connect(ui->volumeSlider, SIGNAL(valueChanged(int)), mplayer, SLOT(setVolume(int)));
    connect(ui->volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(onSaveVolume(int)));
    connect(ui->netButton, SIGNAL(clicked()), webvideo, SLOT(show()));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(ui->minButton, SIGNAL(clicked()), this, SLOT(showMinimized()));
    connect(ui->maxButton, SIGNAL(clicked()), this, SLOT(setMaxNormal()));
    connect(ui->menuButton, SIGNAL(clicked()), this, SLOT(showMenu()));

    connect(mplayer, SIGNAL(played()), this, SLOT(setIconToPause()));
    connect(mplayer, SIGNAL(paused()), this, SLOT(setIconToPlay()));
    connect(mplayer, SIGNAL(stopped()), this, SLOT(onStopped()));
    connect(mplayer, SIGNAL(timeChanged(int)), this, SLOT(onProgressChanged(int)));
    connect(mplayer, SIGNAL(lengthChanged(int)), this, SLOT(onLengthChanged(int)));
    connect(mplayer, SIGNAL(fullScreen()), this, SLOT(setFullScreen()));
    connect(mplayer, SIGNAL(sizeChanged(QSize&)), this, SLOT(onSizeChanged(QSize&)));

    connect(playlist, SIGNAL(fileSelected(const QString&)), mplayer, SLOT(openFile(const QString&)));
    connect(playlist, SIGNAL(needPause(bool)), this, SLOT(onNeedPause(bool)));

    connect(downloader, SIGNAL(newPlay(const QString&,const QString&)), playlist, SLOT(addFileAndPlay(const QString&,const QString&)));
    connect(downloader, SIGNAL(newFile(const QString&,const QString&)), playlist, SLOT(addFile(const QString&,const QString&)));

    connect(cutterbar, SIGNAL(newFrame(int)), mplayer, SLOT(jumpTo(int)));
    connect(cutterbar, SIGNAL(finished()), cutterbar, SLOT(hide()));
    connect(cutterbar, SIGNAL(finished()), ui->toolBar, SLOT(show()));

    //Set skin
    setSkin(Settings::skinList[Settings::currentSkin]);

    //Set default volume
    ui->volumeSlider->setValue(Settings::volume);

    no_play_next = false;
    is_fullscreen = false;
}
Пример #11
0
void RDCdPlayer::clockData()
{
  bool new_state;
  struct cdrom_subchnl subchnl;

  //
  // Media Status
  //
  if(ioctl(cdrom_fd,CDROM_MEDIA_CHANGED,NULL)==0) {
    new_state=true;
    if(cdrom_old_state==false) {
      Profile("ReadToc() started");
      ReadToc();
      Profile("ReadToc() finished");
      Profile("emitting mediaChanged()");
      emit mediaChanged();
      Profile("mediaChanged() emitted");
    }
  }
  else {
    new_state=false;
    if(cdrom_old_state==true) {
      Profile("emitting ejected()");
      emit ejected();
      Profile("ejected() emitted");
    }
  }
  cdrom_old_state=new_state;

  //
  // Audio State
  //
  memset(&subchnl,0,sizeof(struct cdrom_subchnl));
  subchnl.cdsc_format=CDROM_MSF;
  Profile("calling ioctl(CDROMSUBCHNL)");
  if(ioctl(cdrom_fd,CDROMSUBCHNL,&subchnl)>=0) {
    Profile("ioctl(CDROMSUBCHNL) success");
    if(cdrom_audiostatus!=subchnl.cdsc_audiostatus) {
      cdrom_audiostatus=subchnl.cdsc_audiostatus;
      cdrom_track=subchnl.cdsc_trk;
      switch(cdrom_audiostatus) {
	  case CDROM_AUDIO_INVALID:
	    cdrom_state=NoStateInfo;
	    break;
	  case CDROM_AUDIO_PLAY:
	    cdrom_state=RDCdPlayer::Playing;
	    emit played(cdrom_track);
	    break;
	  case CDROM_AUDIO_PAUSED:
	    cdrom_state=RDCdPlayer::Paused;
	    emit paused();
	    break;
	  case CDROM_AUDIO_COMPLETED:
	    cdrom_state=RDCdPlayer::Stopped;
	    emit stopped();
	    break;
	  case CDROM_AUDIO_ERROR:
	    cdrom_state=RDCdPlayer::Stopped;
	    emit stopped();
	    break;
	  case CDROM_AUDIO_NO_STATUS:
	    cdrom_state=RDCdPlayer::Stopped;
	    emit stopped();
	    break;
      }
    }
  }
  else {
    Profile("ioctl(CDROMSUBCHNL) failure");
    if(cdrom_audiostatus!=CDROM_AUDIO_NO_STATUS) {
      cdrom_audiostatus=CDROM_AUDIO_NO_STATUS;
      cdrom_state=RDCdPlayer::Stopped;
      emit stopped();
    }
  }
  cdrom_clock->start(RDCDPLAYER_CLOCK_INTERVAL,true);
}
Пример #12
0
int main(int argc, char** argv){

    int i, j, random, boolean, players, temp, money, act_x, vil_x, action, buy;

    if(argc != 2)
    {
        printf("Usage: ./testdominion [random seed]");
        return 0;
    }
    else
    {
        random = atoi(argv[1]);
    }

    srand(random);

    struct gameState g;
    struct gameState* p = &g;

    int k[10];

    for(i = 0; i < 10; i++)
    {
        temp = (rand() % 20) + 7; 
        boolean = 1;
        for(j = 0; j < i; j++)
            if(k[j] == temp)
                boolean = 0;
        if(boolean)     //If the number does not already exist
            k[i] = temp;
        else            //If the number already exists in the array
            i--;
    }

    int not_bought[10];
    int not_played[10];

    for(i = 0; i < 10; i++)
    {
        not_bought[i] = k[i];
        not_played[i] = k[i];
    }

    players = (rand() % 3) + 2;

    int r = initializeGame(players, k, random, p);

    while(!isGameOver(p))        //Loop that continues for game
    {
        for(i = 0; i < players; i++)
        {                                           //Loop the loops through each player
            action = 1;
            buy = 1;
            money = 0;            
            while(action)             //Loop that continues for each players actions
            {
                vil_x = -1;
                act_x = -1;
                for(j = 0; j < numHandCards(p); j++)    //Loop runs through hand
                {
                    if(handCard(j, p) == village)
                    {
                        vil_x = j;
                        break;
                    }
                    else if(!played(not_played, p, handCard(j, p)))
                        act_x = j;
                }
                if(vil_x > -1)
                {
                    playCard(j, -1, -1, -1, p);
                    printf("Player %d played a village\n", j);
                }
                else if(act_x > -1)
                {
                    play(act_x, p);
                    action = 0;
                }
                else
                    action = 0;
            }

            buy_card(p, not_bought, k);

            endTurn(p);
        }
    }
    print_state(p, players);
    printf("\n");
    return 0;
}
Пример #13
0
void VlcMediaListPlayer::d_connect()
{
    connect(d, SIGNAL(played()), SIGNAL(played()));
    connect(d, SIGNAL(nextItemSet(VlcMedia)), SIGNAL(nextItemSet(VlcMedia)));
    connect(d, SIGNAL(stopped()), SIGNAL(stopped()));
}