/*************************************************************************************************** *FunctionName: activityFresh *Description: 界面刷新 *Input: *Output: *Return: *Author: xsx *Date: 2016年12月21日09:01:16 ***************************************************************************************************/ static void activityFresh(void) { S_WaitPageData->cnt++; if(S_WaitPageData->cnt % 5 == 0) { /*是否插卡*/ if(GetCardState() == CardIN) { stopPlay(); S_WaitPageData->currenttestdata->statues = status_preread; startActivity(createPreReadCardActivity, NULL); return; } /*时间到,未插卡,返回*/ else if(TimeOut == timer_expired(&(S_WaitPageData->timer2))) { AddNumOfSongToList(11, 0); timer_restart(&(S_WaitPageData->timer2)); } } //如果排队中,有卡接近测试时间,则删除当前测试创建任务,返回 if(GetMinWaitTime() < 40) { stopPlay(); MotorMoveTo(1, 2, MaxLocation, FALSE); DeleteCurrentTest(); backToActivity(paiduiActivityName); } }
void PlaybackHandler::onPlayNotify() { // trigger in certaing intervals from audiodevice // to write into buffer more data so no gaps occur // continue more into buffer.. // TODO: also check how much actually was written before overwriting.. // m_nInBuf += m_pModPlayer->Decode(m_pDecodeBuffer->GetBegin() + m_nInBuf, m_pDecodeBuffer->GetSize() - m_nInBuf); qint64 nWritten = m_pDevOut->write(m_pDecodeBuffer->GetBegin(), m_nInBuf); if (nWritten == -1) { stopPlay(); return; } m_Written += nWritten; // if all did not fit to output, // keep rest until playing again if (m_nInBuf > nWritten) { m_nInBuf = (m_nInBuf - nWritten); // this should support overlapped move ::memmove(m_pDecodeBuffer->GetBegin(), m_pDecodeBuffer->GetBegin() + nWritten, m_nInBuf); } }
/* * Close the device * * DEV - device * * Called when closing the DMAbuf (dmabuf.c:477) * after halt_xfer */ static void nm256_audio_close(int dev) { struct nm256_info *card = nm256_find_card (dev); if (card != NULL) { int w; if (card->dev[0] == dev) w = 0; else if (card->dev[1] == dev) w = 1; else return; card->opencnt[w]--; if (card->opencnt[w] <= 0) { card->opencnt[w] = 0; if (card->dev_for_play == dev) { stopPlay (card); card->is_open_play = 0; card->dev_for_play = -1; } if (card->dev_for_record == dev) { stopRecord (card); card->is_open_record = 0; card->dev_for_record = -1; } } } }
void CCreateRTPServer::update(MEDIA_STATE_ENUM state) { this->m_state = state; if(this->m_state == STATE_STOP) { cout << "update STATE_STOP" << endl; stopPlay(); } }
void Infogrames::unload() { stopPlay(); delete[] _data; _data = 0; clearVoices(); reset(); }
void PlaybackHandler::playFile(QString filename) { if (m_pAudioOut != nullptr) { stopPlay(); } PlayFile(filename); }
/* * Initialize the hardware. */ static void nm256_initHw (struct nm256_info *card) { /* Reset everything. */ nm256_writePort8 (card, 2, 0x0, 0x11); nm256_writePort16 (card, 2, 0x214, 0); stopRecord (card); stopPlay (card); }
// 播放/暂停 void frmPlayLog::onBtnStartPlay() { if (!mStarted) { startPlay(); } else { stopPlay(); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { isBot=false; started = false; ui->setupUi(this); displayText("Start"); // Load sounds bullet = new QSound("/sounds/bullet.wav"); networkThread = new QThread(); networkManager = new NetworkManager(); networkManager->moveToThread(networkThread); networkThread->start(); //connect(networkThread, SIGNAL(started()), networkManager, SLOT(network_init())); connect(ui->connectButton,SIGNAL(clicked()),this,SLOT(connect_clicked())); connect(networkManager, SIGNAL(writeText(QString)), this, SLOT(displayText(QString))); connect(ui->disconnectButton, SIGNAL(released()), this, SLOT(stopPlay())); connect(this, SIGNAL(sendKeyEvent(QKeyEvent*,int)), networkManager, SLOT(process_key(QKeyEvent*,int))); connect(networkManager, SIGNAL(newPlayerScore(int)), ui->playerScore, SLOT(setNum(int))); connect(networkManager, SIGNAL(newHealthPoints(int)), ui->healthPoints, SLOT(setValue(int))); connect(networkManager, SIGNAL(newPlayerId(int)), ui->playerIdLabel, SLOT(setNum(int))); connect(networkManager, SIGNAL(newTeamId(int)),ui->equipe, SLOT(setNum(int))); connect(networkManager, SIGNAL(newIdInTeam(int)), this, SLOT(setSprite(int))); connect(ui->checkBoxBot, SIGNAL(stateChanged(int)), this, SLOT(setBot(int))); connect(ui->nameEdit, SIGNAL(textChanged(QString)), networkManager, SLOT(setLogin(QString))); connect(ui->disconnectButton, SIGNAL(released()), networkManager, SLOT(disconnectClient())); connect(this, SIGNAL(setIP(QString,int)), networkManager, SLOT(setIP(QString,int))); connect(this, SIGNAL(setRequestedTeam(int)), networkManager, SLOT(setRequestedTeam(int))); connect(networkManager, SIGNAL(disconnected()), this, SLOT(stopPlay())); connect(this, SIGNAL(startNetworkManager()), networkManager, SLOT(network_init())); readSettings(); }
/* Stop the current operations associated with DEV. */ static void nm256_audio_reset(int dev) { struct nm256_info *card = nm256_find_card (dev); if (card != NULL) { if (card->dev_for_play == dev) stopPlay (card); if (card->dev_for_record == dev) stopRecord (card); } }
void ADLPlayer::unload() { stopPlay(); _timbres.clear(); delete[] _songData; _songData = 0; _songDataSize = 0; _playPos = 0; }
/*************************************************************************************************** *FunctionName: activityInput *Description: 界面输入 *Input: *Output: *Return: *Author: xsx *Date: 2016年12月21日09:00:59 ***************************************************************************************************/ static void activityInput(unsigned char *pbuf , unsigned short len) { S_WaitPageData->lcdinput[0] = pbuf[4]; S_WaitPageData->lcdinput[0] = (S_WaitPageData->lcdinput[0]<<8) + pbuf[5]; /*返回*/ if(S_WaitPageData->lcdinput[0] == 0x1303) { S_WaitPageData->currenttestdata->statues = status_sample; stopPlay(); backToFatherActivity(); } }
void Infogrames::reset() { int i; stopPlay(); init(); _volSlideBlocks = 0; _periodSlideBlocks = 0; _subSong = 0; _cmdBlocks = 0; _speedCounter = 0; _speed = 0; for (i = 0; i < 4; i++) _chn[i].cmdBlockIndices = 0; }
void playNext() { if (!playing) { return; } ++playIndex; if (playIndex < (ptrdiff_t)stepsToPlay.size()) { startRotate(stepsToPlay[playIndex]); } else { stopPlay(); } }
void MainWindow::keyReleaseEvent(QKeyEvent * event) { if(!started) { event->ignore(); return; } if(event->key() == Qt::Key_Escape) { stopPlay(); //emit ui->disconnectButton->released(); return; } if(!event->isAutoRepeat()) { emit sendKeyEvent(event, -1); } else { QWidget::keyPressEvent(event); } }
Set::~Set() { vargusLog.writeToFile(QString("Destructor of set %1 started").arg(description())); stopPlay(); foreach(Camera *c, cameraList) delete c; foreach(View *v, viewList) delete v; for(int i = 0; i < stc.size(); i++) { delete stc[i]; } delete[] lastCamNum; delete[] wasChanged; delete[] offset; vargusLog.writeToFile(QString("Destructor of set %1 ended").arg(description())); }
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(); }
static void __exit cleanup_nm256 (void) { if (loaded) { struct nm256_info *card; struct nm256_info *next_card; for (card = nmcard_list; card != NULL; card = next_card) { stopPlay (card); stopRecord (card); if (card->has_irq) free_irq (card->irq, card); nm256_release_ports (card); sound_unload_mixerdev (card->mixer_oss_dev); sound_unload_audiodev (card->dev[0]); sound_unload_audiodev (card->dev[1]); next_card = card->next_card; kfree (card); } nmcard_list = NULL; } pm_unregister_all (&handle_pm_event); }
static void __devinit nm256_remove(struct pci_dev *pcidev) { struct nm256_info *xcard = pci_get_drvdata(pcidev); struct nm256_info *card,*next_card = NULL; for (card = nmcard_list; card != NULL; card = next_card) { next_card = card->next_card; if (card == xcard) { stopPlay (card); stopRecord (card); if (card->has_irq) free_irq (card->irq, card); nm256_release_ports (card); sound_unload_mixerdev (card->mixer_oss_dev); sound_unload_audiodev (card->dev[0]); sound_unload_audiodev (card->dev[1]); kfree (card); break; } } if (nmcard_list == card) nmcard_list = next_card; }
CCreateRTPServer::~CCreateRTPServer() { stopPlay(); }
bool Application::configure() { if ( !QSystemTrayIcon::isSystemTrayAvailable() ) { LOG_ERROR( "application", tr( "No system tray available!" ) ); QMessageBox::critical( 0, tr( "Error" ), tr( "No system tray available!" ) ); return false; } if ( !QSystemTrayIcon::supportsMessages() ) { LOG_ERROR( "application", tr( "System tray not support messages!" ) ); QMessageBox::critical( 0, tr( "Error" ), tr( "System tray not support messages!" ) ); return false; } // Tray icons set. trayIconList.append( ":/images/radio-active-2.png" ); trayIconList.append( ":/images/radio-active-1.png" ); trayIconList.append( ":/images/radio-active.png" ); currTrayIcon = 0; // Setup player. connect( &player, SIGNAL( playerTick( quint64 ) ), SLOT( animateIcon( quint64 ) ) ); connect( &player, SIGNAL( playing() ), SLOT( onPlayerPlay() ) ); connect( &player, SIGNAL( paused() ), SLOT( onPlayerPause() ) ); connect( &player, SIGNAL( stopped() ), SLOT( onPlayerStop() ) ); connect( &player, SIGNAL( errorOccured() ), SLOT( onPlayerError() ) ); connect( &player, SIGNAL( buffering( int ) ), SLOT( onPlayerBuffering( int ) ) ); connect( &player, SIGNAL( volumeChanged( int ) ), SLOT( onPlayerVolumeChanged( int ) ) ); connect( &player, SIGNAL( metaDataChanged( const QMultiMap< QString, QString > ) ), SLOT ( onMetaDataChange( const QMultiMap< QString, QString > ) ) ); // Setup global shortcuts. QxtGlobalShortcut * globalShortcut; globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( pauseHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( playOrPause() ) ); } globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( stopHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( stopPlay() ) ); } globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( volumeUpHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( volumeUp() ) ); } globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( volumeDownHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), &player, SLOT( volumeDown() ) ); } globalShortcut = new QxtGlobalShortcut( &trayItem ); if ( globalShortcut ) { globalShortcut->setShortcut( QKeySequence( quitHotkey ) ); connect( globalShortcut, SIGNAL( activated() ), this, SLOT( quit()) ); } // Create stations menu. stationsMenu.setTitle( tr( "Stations" ) ); stationsMenu.setIcon( QIcon( ":/images/radio-passive.png" ) ); stationsGroup = new QActionGroup( &stationsMenu ); if ( stationsGroup ) { stationsGroup->setExclusive( true ); updateStationsMenu(); connect( stationsGroup, SIGNAL( triggered( QAction * ) ), SLOT( processStationAction( QAction * ) ) ); } // Create base menu. trayMenu.addMenu( &stationsMenu ); trayMenu.addSeparator(); QAction * action; action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/audio-volume-up.png" ) ); action->setText( tr( "Volume up" ) ); action->setShortcut( QKeySequence( volumeUpHotkey ) ); connect( action, SIGNAL( triggered() ), &player, SLOT( volumeUp() ) ); trayMenu.addAction( action ); } action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/audio-volume-down.png" ) ); action->setText( tr( "Volume down" ) ); action->setShortcut( QKeySequence( volumeDownHotkey ) ); connect( action, SIGNAL( triggered() ), &player, SLOT( volumeDown() ) ); trayMenu.addAction( action ); } trayMenu.addSeparator(); action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/media-playback-start.png" ) ); action->setText( tr( "Play|Pause" ) ); action->setShortcut( QKeySequence( pauseHotkey ) ); connect( action, SIGNAL( triggered() ), &player, SLOT( playOrPause() ) ); trayMenu.addAction( action ); } action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/media-playback-stop.png" ) ); action->setText( tr( "Stop" ) ); action->setShortcut( QKeySequence( stopHotkey ) ); connect( action, SIGNAL( triggered() ), &player, SLOT( stopPlay() ) ); trayMenu.addAction( action ); } trayMenu.addSeparator(); action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/application-info.png" ) ); action->setText( tr( "Info" ) ); action->setMenuRole( QAction::AboutRole ); connect( action, SIGNAL( triggered() ), this, SLOT( about() ) ); trayMenu.addAction( action ); } action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/application-exit.png" ) ); action->setText( tr( "Exit" ) ); action->setShortcut( QKeySequence( quitHotkey ) ); action->setMenuRole( QAction::QuitRole ); connect( action, SIGNAL( triggered() ), this, SLOT( quit() ) ); trayMenu.addAction( action ); } // Create settings menu. action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/application-settings.png" ) ); action->setText( tr( "Settings" ) ); action->setMenuRole( QAction::PreferencesRole ); connect( action, SIGNAL( triggered() ), this, SLOT( manageSettings() ) ); settingsMenu.addAction( action ); } action = new QAction( &trayMenu ); if ( action ) { action->setIcon( QIcon( ":/images/application-exit.png" ) ); action->setText( tr( "Exit" ) ); action->setShortcut( QKeySequence( quitHotkey ) ); action->setMenuRole( QAction::QuitRole ); connect( action, SIGNAL( triggered() ), this, SLOT( quit() ) ); settingsMenu.addAction( action ); } // Setup tray item. trayItem.setIcon( QIcon( ":/images/radio-passive.png" ) ); trayItem.show(); trayItem.showMessage( tr( "QRadioTray" ), tr( "Program started!" ), QSystemTrayIcon::Information ); connect( &trayItem, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( processTrayActivation( QSystemTrayIcon::ActivationReason ) ) ); return true; }
void PlaybackHandler::PlayFile(QString &filename) { // TODO: different thread for module handling? // destroy old (if any) delete m_pFileBuffer; delete m_pModPlayer; delete m_pFile; // keep for debugging etc. //m_currentFilename = filename.right(filename.size() - filename.lastIndexOf('/')); m_currentFilename = filename; // open file and use memory-mapping // (leave buffering to OS) // m_pFile = new QFile(filename); qint64 nSize = m_pFile->size(); uchar *pView = m_pFile->map(0, nSize); CFileType type(pView, nSize); if (type.m_enFileCategory == HEADERCAT_ARCHIVE) { // need to know which file in archive to decompress for playback.. //m_pArchiveHandler->openArchive(filename); //m_pArchiveHandler->openArchive(m_pFile); } else if (type.m_enFileCategory == HEADERCAT_PACKER) { // single-file compression // -> just decrunch to buffer //m_pArchiveHandler->openArchive(filename); //m_pArchiveHandler->openArchive(pView, nSize); //m_pFileBuffer = m_pArchiveHandler->decrunchToBuffer(pView, nSize); } else { // module file without compression, just use as-is. // // use buffer as interface to accessing memory-mapped file: // OS will generate pagefaults as needed // m_pFileBuffer = new CReadBuffer(pView, nSize); } // format-specific handling, // fileformat, playback-to-buffer etc. m_pModPlayer = GetPlayer(m_pFileBuffer); if (m_pModPlayer == nullptr) { emit error("Failed to create player"); return; } if (m_pModPlayer->ParseFileInfo() == false) { emit error("File could not be handled"); return; } // get decoding context: // player should keep position/status information, // we want it to control position (if possible..) // // TODO: determine how we are able to output // (e.g. 256 tracker channels -> 2 channels in stereo, // 8/16-bit width?) // and check that device supports what is possible.. // m_pCtx = m_pModPlayer->PrepareDecoder(); // TODO: get info on what is suitable format for playing.. // (what is supported by player/format/module..) //QAudioFormat format = pModPlayer->GetOutputFormat(); // placeholder.. set output format // these will need changing later: // due to module-format support // and device-support we may need something or other.. QAudioFormat format; format.setByteOrder(QAudioFormat::LittleEndian); format.setCodec("audio/pcm"); format.setSampleRate(m_pCtx->sampleRate()); format.setChannels(m_pCtx->channelCount()); format.setSampleSize(m_pCtx->sampleSize()); format.setSampleType(QAudioFormat::SignedInt); QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); if (info.isNull() == true) { emit error("Failed to get default audio output"); return; } if (info.isFormatSupported(format) == false) { emit error("Output format not supported"); return; } // expect 2-channels and 8-bit samples at 44.1kHz, // get proper values later, expecting 1s buffer to be enough for now.. // size_t nBuffer = (format.sampleRate() * format.channels() * (format.sampleSize()/8)); m_pDecodeBuffer->PrepareBuffer(nBuffer, false); // get device for output m_pAudioOut = new QAudioOutput(format, this); connect(m_pAudioOut, SIGNAL(stateChanged(QAudio::State)), this, SLOT(onAudioState(QAudio::State))); connect(m_pAudioOut, SIGNAL(notify()), this, SLOT(onPlayNotify())); if (m_pAudioOut->bufferSize() < nBuffer) { m_pAudioOut->setBufferSize(nBuffer); } m_pAudioOut->setNotifyInterval(250); // 250ms // push-mode (we decode to buffer and push to device), // we might need different thread for no-gaps playback.. m_pDevOut = m_pAudioOut->start(); if (initialOutput() == false) { // failed, cleanup stopPlay(); // status message emit error("Failed on audiodevice write(): " + filename); } }
static void nm256_interrupt_zx (int irq, void *dev_id, struct pt_regs *dummy) { struct nm256_info *card = (struct nm256_info *)dev_id; u32 status; static int badintrcount = 0; if ((card == NULL) || (card->magsig != NM_MAGIC_SIG)) { printk (KERN_ERR "NM256: Bad card pointer\n"); return; } status = nm256_readPort32 (card, 2, NM_INT_REG); /* Not ours. */ if (status == 0) { if (badintrcount++ > 1000) { printk (KERN_ERR "NM256: Releasing interrupt, over 1000 invalid interrupts\n"); /* * I'm not sure if the best thing is to stop the card from * playing or just release the interrupt (after all, we're in * a bad situation, so doing fancy stuff may not be such a good * idea). * * I worry about the card engine continuing to play noise * over and over, however--that could become a very * obnoxious problem. And we know that when this usually * happens things are fairly safe, it just means the user's * inserted a PCMCIA card and someone's spamming us with * IRQ 9s. */ if (card->playing) stopPlay (card); if (card->recording) stopRecord (card); badintrcount = 0; } return; } badintrcount = 0; /* Rather boring; check for individual interrupts and process them. */ if (status & NM2_PLAYBACK_INT) { status &= ~NM2_PLAYBACK_INT; NM2_ACK_INT (card, NM2_PLAYBACK_INT); if (card->playing) nm256_get_new_block (card); } if (status & NM2_RECORD_INT) { status &= ~NM2_RECORD_INT; NM2_ACK_INT (card, NM2_RECORD_INT); if (card->recording) nm256_read_block (card); } if (status & NM2_MISC_INT_1) { u8 cbyte; status &= ~NM2_MISC_INT_1; printk (KERN_ERR "NM256: Got misc interrupt #1\n"); NM2_ACK_INT (card, NM2_MISC_INT_1); cbyte = nm256_readPort8 (card, 2, 0x400); nm256_writePort8 (card, 2, 0x400, cbyte | 2); } if (status & NM2_MISC_INT_2) { u8 cbyte; status &= ~NM2_MISC_INT_2; printk (KERN_ERR "NM256: Got misc interrupt #2\n"); NM2_ACK_INT (card, NM2_MISC_INT_2); cbyte = nm256_readPort8 (card, 2, 0x400); nm256_writePort8 (card, 2, 0x400, cbyte & ~2); } /* Unknown interrupt. */ if (status) { printk (KERN_ERR "NM256: Fire in the hole! Unknown status 0x%x\n", status); /* Pray. */ NM2_ACK_INT (card, status); } }