예제 #1
0
void PlayerWidget::prevPressed() {
	if (isHidden()) return;

	History *history = _msgmigrated ? _migrated : _history;
	const History::MediaOverview *o = history ? &history->overview[OverviewAudioDocuments] : 0;
	if (audioPlayer() && o && _index > 0 && _index <= o->size() && !o->isEmpty()) {
		startPlay(FullMsgId(history->channelId(), o->at(_index - 1)));
	} else if (!_index && _history && _migrated && !_msgmigrated) {
		o = &_migrated->overview[OverviewAudioDocuments];
		if (!o->isEmpty()) {
			startPlay(FullMsgId(_migrated->channelId(), o->at(o->size() - 1)));
		}
	}
}
예제 #2
0
void PlayerWidget::nextPressed() {
	if (isHidden()) return;

	History *history = _msgmigrated ? _migrated : _history;
	const History::MediaOverview *o = history ? &history->overview[OverviewAudioDocuments] : 0;
	if (audioPlayer() && o && _index >= 0 && _index < o->size() - 1) {
		startPlay(FullMsgId(history->channelId(), o->at(_index + 1)));
	} else if (o && (_index == o->size() - 1) && _msgmigrated && _history->overviewLoaded(OverviewAudioDocuments)) {
		o = &_history->overview[OverviewAudioDocuments];
		if (!o->isEmpty()) {
			startPlay(FullMsgId(_history->channelId(), o->at(0)));
		}
	}
}
예제 #3
0
void MainWindow2::makeTimeLineConnections()
{
    connect(m_pTimeLine, SIGNAL(endplayClick()), editor, SLOT(endPlay()));
    connect(m_pTimeLine, SIGNAL(startplayClick()), editor, SLOT(startPlay()));
    connect(m_pTimeLine, SIGNAL(duplicateKeyClick()), editor, SLOT(duplicateKey()));

    connect(m_pTimeLine, SIGNAL(modification()), editor, SLOT(modification()));
    connect(m_pTimeLine, SIGNAL(addKeyClick()), editor, SLOT(addKey()));
    connect(m_pTimeLine, SIGNAL(removeKeyClick()), editor, SLOT(removeKey()));

    connect(m_pTimeLine, SIGNAL(newBitmapLayer()), editor, SLOT(newBitmapLayer()));
    connect(m_pTimeLine, SIGNAL(newVectorLayer()), editor, SLOT(newVectorLayer()));
    connect(m_pTimeLine, SIGNAL(newSoundLayer()), editor, SLOT(newSoundLayer()));
    connect(m_pTimeLine, SIGNAL(newCameraLayer()), editor, SLOT(newCameraLayer()));
    connect(m_pTimeLine, SIGNAL(deleteCurrentLayer()), editor, SLOT(deleteCurrentLayer()));

    connect(m_pTimeLine, SIGNAL(playClick()), editor, SLOT(play()));
    connect(m_pTimeLine, SIGNAL(loopClick(bool)), editor, SLOT(setLoop(bool)));
    connect(m_pTimeLine, SIGNAL(soundClick()), editor, SLOT(setSound()));
    connect(m_pTimeLine, SIGNAL(fpsClick(int)), editor, SLOT(changeFps(int)));

    connect(editor, SIGNAL(toggleLoop(bool)), m_pTimeLine, SIGNAL(toggleLoop(bool)));
    connect(m_pTimeLine, SIGNAL(loopClick(bool)), editor, SIGNAL(loopToggled(bool)));

    m_pTimeLine->setFocusPolicy(Qt::NoFocus);
}
예제 #4
0
파일: main.c 프로젝트: Mohnish-SPU/DrumHero
void sense(int x, int y)
{
	if( (x > 545 && x < 600) && (y > 15 && y < 49) )//Record Button
		startRec();
	else if( (x > 476 && x < 545) && (y > 15 && y < 49) )//Play
		startPlay();
	else if( (x > 426 && x < 476) && (y > 15 && y < 49) )//Back
		goBack();
	else if( (x > 452 && x < 574) && (y > 115 && y < 160) )//Back
		playRest();
	else if( (x > 50 && x < 325) && (y > 534 && y < 711) )//Snare
		playSnare();
	else if( (x > 0 && x < 270) && (y > 340 && y < 480) )//Hihat
		playHihat();
	else if( (x > 365 && x < 665) && (y > 550 && y < 715) )//Bass
		playBass();
	else if( (x > 288 && x < 468) && (y > 255 && y < 387) )//Hi tom
		playHi();
	else if( (x > 547 && x < 741) && (y > 241 && y < 381) )//Low tom
		playLow();
	else if( (x > 718 && x < 1024) && (y > 502 && y < 692) )//Floor tom
		playFloor();
	else if( (x > 773 && x < 1024) && (y > 100 && y < 390) )//Crash
		playCrash();
	else if( (x > 0 && x < 325) && (y > 100 && y < 275) )//Ride
		playRide();
}
예제 #5
0
void PlayerWidget::nextPressed() {
	if (isHidden()) return;

	const History::MediaOverview *o = _history ? &_history->overview[OverviewAudioDocuments] : 0;
	if (audioPlayer() && o && _index >= 0 && _index < o->size() - 1) {
		startPlay(FullMsgId(_history->channelId(), o->at(_index + 1)));
	}
}
예제 #6
0
bool PlayLayer::init()
{
    if(!BaseLayer::init())
    {
        return false;
    }

    Size visibleSize = Director::getInstance()->getVisibleSize();

    MenuItemFont *back = MenuItemFont::create("back", CC_CALLBACK_1(PlayLayer::back, this));
    Menu *menu = Menu::create(back, NULL);
    menu->setPosition(visibleSize.width*9/10, visibleSize.height*9/10);

    this->addChild(menu);

    SpriteFrameCache* cache = SpriteFrameCache::getInstance();
    cache->addSpriteFramesWithFile("UI.plist", "UI.png");

    mJoystick = NULL;
    mJoystick = new SneakyJoystick();
    mJoystick->initWithRect(Rect::ZERO);
    mJoystick->setAutoCenter(true);
    mJoystick->setHasDeadzone(true);
    mJoystick->setDeadRadius(10);
    SneakyJoystickSkinnedBase* jstickSkin = new SneakyJoystickSkinnedBase();
    jstickSkin->autorelease();
    jstickSkin->init();
    jstickSkin->setBackgroundSprite(CCSprite::createWithSpriteFrameName("JoyStick-base.png"));
    jstickSkin->setThumbSprite(CCSprite::createWithSpriteFrameName("JoyStick-thumb.png"));
    //jstickSkin->getThumbSprite()->setScale(0.5f);
    jstickSkin->setPosition(visibleSize.width*1/10, visibleSize.width*1/10);
    jstickSkin->setJoystick(mJoystick);
    this->addChild(jstickSkin);

    mButtonA = NULL;
    mButtonA = new SneakyButton();
    mButtonA->initWithRect(Rect::ZERO);
    mButtonA->setIsToggleable(false);
    mButtonA->setIsHoldable(true);
    SneakyButtonSkinnedBase* btnASkin = new SneakyButtonSkinnedBase();
    btnASkin->autorelease();
    btnASkin->init();
    btnASkin->setPosition(visibleSize.width*9/10, visibleSize.width*1/10);
    btnASkin->setDefaultSprite(CCSprite::createWithSpriteFrameName("button-default.png"));
    btnASkin->setPressSprite(CCSprite::createWithSpriteFrameName("button-pressed.png"));
    btnASkin->setActivatedSprite(CCSprite::createWithSpriteFrameName("button-activated.png"));
    //btnASkin->setDisabledSprite(CCSprite::createWithSpriteFrameName("button-disabled.png"));
    btnASkin->setButton(mButtonA);
    this->addChild(btnASkin);

    this->schedule(schedule_selector(PlayLayer::inputUpdate));

    startPlay();

    return true;
}
예제 #7
0
// 播放/暂停
void frmPlayLog::onBtnStartPlay()
{
	if (!mStarted)
	{
		startPlay();
	}
	else
	{
		stopPlay();
	}	
}
예제 #8
0
bool AudioInterfaceOpenSL::playAuxCommand(AuxCommand command)
{  
    uint8_t *commandBuffer;
    loadAuxCommandBuffer(&commandBuffer, command.auxValue);
    
    mBufferQueue.pushElement(commandBuffer);
    
    loadBuffer(commandBuffer, mBufferSize);
    startPlay();
    
    return TRUE;
}
예제 #9
0
bool AudioInterfaceOpenSL::playMotorCommand(MotorCommand command)
{    
    uint8_t *commandBuffer;
    
    if (command.rightValue != 0x80)
        command.rightValue = 0xFF - command.rightValue;
    
    loadMotorCommandBuffer(&commandBuffer, command.leftValue, command.rightValue);
    
    mBufferQueue.pushElement(commandBuffer);
    
    loadBuffer(commandBuffer, mBufferSize * 2);
    startPlay();
    
    return TRUE;
}
예제 #10
0
파일: audioApp.c 프로젝트: ericzhc/pdale
void tstAudioPCM_rec(void)
{
    static   INT16U  cnt = 0;
    INT16S          *dP;

    if( audioMode == A_REC ){
        dP =(INT16S*) inChnnlNxtBuf();
        erG711A_encoder(dP,audioBufP,frameSize);
        audioBufP += frameSize;
        if( audioBufP >= &audioBuffer[AUDIOBUFFSIZE] ){
            audioMode = A_STOP;
            audioIoChnnlStop();
            erD_sndstr("\n\rRec_END\n\r");
            recFlg = 1;
            startPlay();
        }
        else if(!(++cnt & 0x03))
                erD_sndchr('@');
    }
}
예제 #11
0
WatchMoviesView::WatchMoviesView(QWidget *parent) :
	QWidget(parent),
	mUi(new Ui::WatchMoviesView)
{
	mUi->setupUi(this);

	mUi->moviesTable->verticalHeader()->hide();
	mUi->moviesTable->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
	mUi->moviesTable->hideColumn(4);

	mMovieFile = NULL;

	connect(mUi->speedSlider, SIGNAL(valueChanged(int)), this, SLOT(speedChanged(int)));
	connect(mUi->refreshListButton, SIGNAL(clicked()), this, SLOT(updateMoviesList()));
	connect(mUi->refreshListButton, SIGNAL(clicked()), mUi->filterText, SLOT(clear()));
	connect(mUi->startButton, SIGNAL(clicked()), this, SLOT(startPlay()));
	connect(mUi->stopButton, SIGNAL(clicked()), this, SLOT(stopPlay()));
	connect(mUi->moviesTable, SIGNAL(itemSelectionChanged()), this, SLOT(movieChanged()));
	connect(mUi->filterText, SIGNAL(textChanged(QString)), this, SLOT(filterMovies(QString)));

	updateMoviesList();
}
예제 #12
0
파일: audioApp.c 프로젝트: ericzhc/pdale
void startTask(void *pData)
{
    INT16U          delay;
    INT16U          xerr;
    char            dByte;

    (void)pData;                                                            /* Prevent compiler warning                        */
  
    
    Tmr_Init();
    iniAudioDvce();
    audioMode = A_STOP;
        
    erD_sndstr("\r\n\CerfPDA audio driver demo\r\n");
    erD_sndstr("Press H for help\r\n");
   
    
	
	while (1) {
        startPlay();
		OSTimeDly(1000);
    
		}
    }
예제 #13
0
void MainWindow::connect_clicked() {
    emit setRequestedTeam(ui->comboBoxTeam->currentIndex());
    emit setIP(ui->ipEdit->text(),ui->portEdit->text().toInt());
    emit startNetworkManager();
    startPlay();
}
예제 #14
0
파일: server.cpp 프로젝트: artbez/origin
void Server::on_okButton_clicked()
{
    emit startPlay(1);
    setVisible(false);
}
예제 #15
0
파일: webview.cpp 프로젝트: lotux/MediaPort
void WebView::doPlay() {
    emit startPlay();
}
예제 #16
0
void PlayerWidget::updateState(SongMsgId playing, AudioPlayerState playingState, int64 playingPosition, int64 playingDuration, int32 playingFrequency) {
	if (!playing) {
		audioPlayer()->currentState(&playing, &playingState, &playingPosition, &playingDuration, &playingFrequency);
	}

	bool songChanged = false;
	if (playing && _song != playing) {
		songChanged = true;
		_song = playing;
		if (HistoryItem *item = App::histItemById(_song.msgId)) {
			_history = item->history();
			if (_history->peer->migrateFrom()) {
				_migrated = App::history(_history->peer->migrateFrom()->id);
				_msgmigrated = false;
			} else if (_history->peer->migrateTo()) {
				_migrated = _history;
				_history = App::history(_migrated->peer->migrateTo()->id);
				_msgmigrated = true;
			}
			findCurrent();
		} else {
			_history = 0;
			_msgmigrated = false;
			_index = -1;
		}
		SongData *song = _song.song->song();
		if (song->performer.isEmpty()) {
			_name.setText(st::linkFont, song->title.isEmpty() ? (_song.song->name.isEmpty() ? qsl("Unknown Track") : _song.song->name) : song->title, _textNameOptions);
		} else {
			TextCustomTagsMap custom;
			custom.insert(QChar('c'), qMakePair(textcmdStartLink(1), textcmdStopLink()));
			_name.setRichText(st::linkFont, QString::fromUtf8("[c]%1[/c] \xe2\x80\x93 %2").arg(textRichPrepare(song->performer)).arg(song->title.isEmpty() ? qsl("Unknown Track") : textRichPrepare(song->title)), _textNameOptions, custom);
		}
		updateControls();
	}

	qint64 position = 0, duration = 0, display = 0;
	if (playing == _song) {
		if (!(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) {
			display = position = playingPosition;
			duration = playingDuration;
		} else {
			display = playingDuration;
		}
		display = display / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency);
	} else if (_song) {
		display = _song.song->song()->duration;
	}
	bool showPause = false, stopped = ((playingState & AudioPlayerStoppedMask) || playingState == AudioPlayerFinishing);
	bool wasPlaying = !!_duration;
	if (!stopped) {
		showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting);
	}
	QString time;
	float64 progress = 0.;
	int32 loaded;
	float64 loadProgress = 1.;
	if (duration || !_song || !_song.song || !_song.song->loading()) {
		time = (_down == OverPlayback) ? _time : formatDurationText(display);
		progress = duration ? snap(float64(position) / duration, 0., 1.) : 0.;
		loaded = duration ? _song.song->size : 0;
	} else {
		loaded = _song.song->loading() ? _song.song->loadOffset() : 0;
		time = formatDownloadText(loaded, _song.song->size);
		loadProgress = snap(float64(loaded) / qMax(_song.song->size, 1), 0., 1.);
	}
	if (time != _time || showPause != _showPause) {
		if (_time != time) {
			_time = time;
			_timeWidth = st::linkFont->width(_time);
		}
		_showPause = showPause;
		if (duration != _duration || position != _position || loaded != _loaded) {
			if (!songChanged && ((!stopped && duration && _duration) || (!duration && _loaded != loaded))) {
				a_progress.start(progress);
				a_loadProgress.start(loadProgress);
				_a_progress.start();
			} else {
				a_progress = anim::fvalue(progress, progress);
				a_loadProgress = anim::fvalue(loadProgress, loadProgress);
				_a_progress.stop();
			}
			_position = position;
			_duration = duration;
			_loaded = loaded;
		}
		update();
	} else if (duration != _duration || position != _position || loaded != _loaded) {
		if (!songChanged && ((!stopped && duration && _duration) || (!duration && _loaded != loaded))) {
			a_progress.start(progress);
			a_loadProgress.start(loadProgress);
			_a_progress.start();
		} else {
			a_progress = anim::fvalue(progress, progress);
			a_loadProgress = anim::fvalue(loadProgress, loadProgress);
			_a_progress.stop();
		}
		_position = position;
		_duration = duration;
		_loaded = loaded;
	}

	if (wasPlaying && playingState == AudioPlayerStoppedAtEnd) {
		if (_repeat) {
			startPlay(_song.msgId);
		} else {
			nextPressed();
		}
	}

	if (songChanged) {
		emit playerSongChanged(_song.msgId);
	}
}
예제 #17
0
파일: audioApp.c 프로젝트: ericzhc/pdale
void menuFn(char dByte)
{
    void        (*restart_vector)(void) = 0;

    switch(dByte){
		case '\\':
			restart_vector = NULL;
            printf("Restarting...");
            udelay(3000);
            restart_vector();
            break;
        case 'R':
        case 'r':
            startRec();
            break;
        case 'P':
        case 'p':
            startPlay();
            break;
        case 'E':
        case 'e':
            if(audioMode != A_STOP)
                erD_sndstr("Error: audio machine is running\n\r");
            else{
                memset(audioBuffer, 0, sizeof(audioBuffer));
                recFlg = 0;
            }
            break;
        case 'S':
        case 's':
            audioMode = A_STOP;
            audioIoChnnlStop();
            erD_sndstr("\n\rSTOP\n\r");
            break;
        case 'M':
        case 'm':
            erD_hwDump((void*)audioBuffer+512 , 512);
            break;
        case 'X':
        case 'x':
            erD_hwDump((void*)inChnnlNxtBuf() , 128);
            erD_hwDump((void*)inChnnlBufInUse() , 128);
            break;
        case 'Y':
        case 'y':
            erD_hwDump((void*)outChnnlNxtBuf() , 128);
            erD_hwDump((void*)outChnnlBufInUse() , 128);
            break;
        case 'I':
        case 'i':
            erD_sndstr("\n\rS5 info\n\r");
            erD_sndstr("\n\rCerfPDA audio demo\n\r");
            break;
        case 'H':
        case 'h':
            erD_sndstr("\n\n\rHELP\n\r");
            erD_sndstr("R: record\n\r");
            erD_sndstr("P: play\n\r");
            erD_sndstr("E: erase\n\r");
            erD_sndstr("S: stop\n\r");
            erD_sndstr("M: encoded audio buffer memory dump\n\r");
            erD_sndstr("X: input audio buffer memory dump\n\r");
            erD_sndstr("Y: output audio buffer memory dump\n\r");
            erD_sndstr("V: version\n\r");
            erD_sndstr("\\: restart unit\n\r");
            erD_sndstr("H: help\n\r");
            break;

	}
}
예제 #18
0
void MainWindow::setMainWidget()
{
   listBar_ = new QToolBar(this);
   listBar_->setAllowedAreas(Qt::NoToolBarArea);
   listBar_->setIconSize(QSize(64, 64));
   listBar_->setMovable(false);
   listBar_->setFloatable(false);
   listBar_->setStyleSheet(".QToolBar{border: none;}");
   //listBar_->setToolButtonStyle(Qt::ToolButtonTextOnly);
   listBar_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
   listBar_->setOrientation(Qt::Vertical);
   connect(listBar_, SIGNAL(actionTriggered(QAction *)),
           this, SLOT(listToggled(QAction *)));

   actionGroup_ = new QActionGroup(this);

   QAction * act = listBar_->addAction(QIcon(":/images/card.png"), tr("Range"));
   act->setCheckable(true);
   act->setShortcut(QKeySequence("F5"));
   act->setToolTip(tr("Specify the playing card range"));

   QFont fn = act->font();
   fn.setPointSize(10);
   act->setFont(fn);
   actionGroup_->addAction(act);

   act = listBar_->addAction(QIcon(":/images/settings.png"), tr("Settings"));
   act->setCheckable(true);
   act->setShortcut(QKeySequence("F6"));
   act->setFont(fn);
   actionGroup_->addAction(act);
   act->setToolTip(tr("Additional settings"));
   
   act = listBar_->addAction(QIcon(":/images/support.png"), tr("Support"));
   act->setCheckable(true);
   act->setShortcut(QKeySequence("F8"));
   act->setFont(fn);
   actionGroup_->addAction(act);
   act->setToolTip(tr("Support Information, Help"));

#ifdef DEMO_MODE   
   act = listBar_->addAction(QIcon(":/images/credit_card.png"), tr("Get Now"));
   act->setCheckable(true);
   act->setShortcut(QKeySequence("F7"));
   act->setFont(fn);
   actionGroup_->addAction(act);
   act->setToolTip(tr("Get the Full Version"));
#endif

   act = listBar_->addAction(QIcon(":/images/poker.png"), tr("Start"));
   act->setShortcut(QKeySequence("F9"));
   act->setFont(fn);
   act->setToolTip(tr("Start Playing"));
   actionGroup_->addAction(act);
   connect(act, SIGNAL(triggered()), this, SLOT(startPlay()));

   //listBar_->addSeparator();

   QWidget * widStretch = new QWidget(this);
   //widStretch->setMinimumHeight(64);
   widStretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   listBar_->addWidget(widStretch);

   //listBar_->addSeparator();
   //act = listBar_->addAction(QIcon(":/images/save.png"), tr("Save"));
   //act->setCheckable(false);
   //act->setShortcut(QKeySequence("F9"));
   //act->setFont(fn);
   //act->setToolTip(tr("Save settings"));
   //actionGroup_->addAction(act);
   //connect(act, SIGNAL(triggered()), this, SLOT(saveConf()));

   act = listBar_->addAction(QIcon(":/images/exit2.png"), tr("Exit"));
   act->setCheckable(false);
   act->setShortcut(QKeySequence("F10"));
   act->setFont(fn);
   act->setToolTip(tr("Exit"));
   actionGroup_->addAction(act);
   connect(act, SIGNAL(triggered()), this, SLOT(cancel()));

   spectrum_ = new SpectrumEditor(this);
   spectrum_->setFont(fn);
   
   QFrame * gbx = new QFrame(this);
   QVBoxLayout * vl = new QVBoxLayout;
   vl->setMargin(0);
   vl->addWidget(listBar_);
   gbx->setLayout(vl);

   stacked_ = new QStackedWidget(this);
   stacked_->addWidget(spectrum_);

   settingsPage_ = new SettingsPage(this);
   settingsPage_->setFont(fn);
   stacked_->addWidget(settingsPage_);
   
   SupportPage * supportPage = new SupportPage(this);
   supportPage->setFont(fn);
   stacked_->addWidget(supportPage);

#ifdef DEMO_MODE
   OrderPage * orderPage = new OrderPage(this);
   orderPage->setFont(fn);
   connect(orderPage, SIGNAL(unlock()), this, SLOT(unlock()));
   stacked_->addWidget(orderPage);
#endif

   //stacked_->addWidget(new QWidget());
   
   QHBoxLayout * hl = new QHBoxLayout;
   hl->setMargin(6);
   hl->setSpacing(2);
   hl->addWidget(gbx, 0);
   hl->addWidget(stacked_, 1);

   QVBoxLayout * vlmain = new QVBoxLayout;
   vlmain->setSizeConstraint(QLayout::SetFixedSize);
   vlmain->setMargin(0);
   vlmain->addLayout(hl);
   
   setLayout(vlmain);
}
예제 #19
0
WePlayGames::WePlayGames(QWidget *parent)
    : QWidget(parent)
{
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_TranslucentBackground);
    this->resize(1200, 900);

    labFram = new QLabel;

    // window title
    labWindowTitle = new QLabel("We Play Games");
    windowTools = new WindowTools(this);

    layoutWindowTitle = new QHBoxLayout;
    layoutWindowTitle->addStretch(5);
    layoutWindowTitle->addWidget(labWindowTitle);
    layoutWindowTitle->addStretch(4);
    layoutWindowTitle->addWidget(windowTools);

    // tools
    labToolFram = new QLabel;
    labToolFram->setFixedHeight(30);
    cbxGames = new QComboBox;
    cbxGames->addItem(tr("蜘蛛纸牌"));
    cbxGames->addItem(tr("2048"));
    cbxGames->addItem(tr("俄罗斯方块"));
    pbnGameRule = new QPushButton("游戏规则");
    labParticipants = new QLabel("参与者:0 人");
    tbnReady = new QToolButton;
    tbnReady->setToolTip("准备就绪");
    labUsername = new QLabel("用户名:");
    lnUsername = new QLineEdit;
    pbnApply = new QPushButton("申请加入");
    labUsername->setFixedWidth(45);
    lnUsername->setFixedWidth(100);
    pbnApply->setFixedWidth(70);

    layoutApply = new QHBoxLayout;
    layoutApply->addWidget(labUsername);
    layoutApply->addWidget(lnUsername);
    layoutApply->addWidget(pbnApply);
    layoutApply->setSpacing(5);

    layoutTool = new QHBoxLayout;
    layoutTool->addWidget(cbxGames);
    layoutTool->addWidget(pbnGameRule);
    layoutTool->addWidget(labParticipants);
    layoutTool->addStretch();
    layoutTool->addWidget(tbnReady);
    layoutTool->addStretch();
    layoutTool->addLayout(layoutApply);
    layoutTool->setSpacing(30);
    layoutTool->setMargin(5);
    labToolFram->setLayout(layoutTool);

    // game area
    gameArea = new GameArea;

    //layout top
    layoutFram = new QVBoxLayout;
    layoutFram->addLayout(layoutWindowTitle);
    layoutFram->addWidget(labToolFram);
    layoutFram->addWidget(gameArea);
    labFram->setLayout(layoutFram);

    layoutTop = new QGridLayout;
    layoutTop->addWidget(labFram);
    this->setLayout(layoutTop);

    //stylesheet
    labFram->setObjectName("labFram");
    labWindowTitle->setObjectName("labWindowTitle");
    labToolFram->setObjectName("labToolFram");
    cbxGames->setObjectName("cbxGames");
    pbnGameRule->setObjectName("pbnGameRule");
    labParticipants->setObjectName("labParticipants");
    tbnReady->setObjectName("tbnReady");
    labUsername->setObjectName("labUsername");
    this->setStyleSheet(
                "#labFram{"
                    "background: rgba(100, 100, 100, 100);"
                    "border: 1px solid rgba(255, 255, 255, 180);"
                    "border-radius: 5px;"
                "}"
                "#labWindowTitle{"
                    "font-size: 20pt;"
                    "color: red;"
                "}"
                "#labToolFram{"
                    "background: rgba(58, 88, 173, 190);"
                "}"

                "#pbnGameRule{"
//                    "background: rgba(55, 138, 48, 200);"
//                    "background: rgba(0, 0, 255, 40);"
//                    "background: rgba(0, 0, 0, 100);"
                    "background: rgba(25, 30, 255, 200);"
                    "width: 80;"
                    "height: 20;"
                    "border-radius: 10px;"
                    "color: white;"
                "}"
                "#pbnGameRule:hover{"
                    "background: rgba(55, 138, 48, 255);"
                    "background: rgba(17, 20, 169, 255);"
                "}"
                "#pbnGameRule:pressed{"
                    "background: rgba(51, 103, 56, 255);"
                    "background: rgba(25, 30, 255, 200);"
                "}"

                "#tbnReady{"
                    "border-image: url(:Images/ready);"
                "}"
                "#tbnReady:hover{"
                    "border-image: url(:Images/readyHover);"
                "}"
                "#tbnReady:pressed{"
                    "border-image: url(:Images/ready);"
                "}"

                "#labParticipants{"
                    "color: white;"
                "}"

                "#labUsername{"
                    "color: white;"
                "}"
                );

    connect(tbnReady, SIGNAL(clicked()), gameArea, SLOT(startPlay()));
}
예제 #20
0
void MciPlayer::play(const string& fileName)
{
	open(fileName);
	startPlay();
}
예제 #21
0
static void
nm256_write_block (struct nm256_info *card, char *buffer, u32 amt)
{
    u32 ringsize = card->playbackBufferSize;
    u32 endstop;
    unsigned long flags;

    if (amt > (ringsize / 2)) {
	printk (KERN_ERR "NM256: Write request too large: %d\n", amt);
	amt = (ringsize / 2);
    }

    if (amt < NM256_PLAY_WMARK_SIZE) {
	printk (KERN_ERR "NM256: Write request too small: %d\n", amt);
	return;
    }

    card->curPlayPos %= ringsize;

    card->requested_amt = amt;

    save_flags (flags);
    cli ();

    if ((card->curPlayPos + amt) >= ringsize) {
	u32 rem = ringsize - card->curPlayPos;

	nm256_writeBuffer8 (card, buffer, 1,
			      card->abuf1 + card->curPlayPos,
			      rem);
	if (amt > rem)
	    nm256_writeBuffer8 (card, buffer + rem, 1, card->abuf1,
				  amt - rem);
    } 
    else
	nm256_writeBuffer8 (card, buffer, 1,
			      card->abuf1 + card->curPlayPos,
			      amt);

    /*
     * Setup the start-n-stop-n-limit registers, and start that engine
     * goin'. 
     *
     * Normally we just let it wrap around to avoid the click-click
     * action scene.
     */
    if (! card->playing) {
	/* The PBUFFER_END register in this case points to one sample
	   before the end of the buffer. */
	int w = (card->dev_for_play == card->dev[0] ? 0 : 1);
	int sampsize = (card->sinfo[w].bits == 16 ? 2 : 1);

	if (card->sinfo[w].stereo)
	    sampsize *= 2;

	/* Need to set the not-normally-changing-registers up. */
	nm256_writePort32 (card, 2, NM_PBUFFER_START,
			     card->abuf1 + card->curPlayPos);
	nm256_writePort32 (card, 2, NM_PBUFFER_END,
			     card->abuf1 + ringsize - sampsize);
	nm256_writePort32 (card, 2, NM_PBUFFER_CURRP,
			     card->abuf1 + card->curPlayPos);
    }
    endstop = (card->curPlayPos + amt - NM256_PLAY_WMARK_SIZE) % ringsize;
    nm256_writePort32 (card, 2, NM_PBUFFER_WMARK, card->abuf1 + endstop);

    if (! card->playing)
	startPlay (card);

    restore_flags (flags);
}
예제 #22
0
JNIEXPORT jboolean JNICALL
Java_com_google_sample_echo_MainActivity_startEcho(JNIEnv *env, jclass clazz, jint rate,
                                                   jint framesPerBuf) {
    createSLEngine(rate, framesPerBuf);
    return startPlay();
}