int main(void) { int playPauseButton, playPauseButtonPrev, stopButton, stopButtonPrev; // Music output port. The DAC MUST use pins 0-3 on the port! Port dac = portInit('YOUR PORT LETTER HERE', 0x00, 0x0F); // port used for the play/pause and stop buttons // and the LED outputs (one for tempo/beat, one to show a note is playing) io = portInit(/* YOUR PORT INFO HERE*/); musicInit(dac); musicLoad(/* YOUR SONG INFO HERE */); // Main loop while(TRUE) { // Read inputs and call one of: // musicPlay() // musicPause() // musicStop() if (playing == TRUE) { WaitForInterrupt(); } } }
int main(void){ PLL_Init(); // configure for 50 MHz clock SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOD; SysTick_Init(); buttonInit(); musicInit(); DAC_Init(0xC000); setChangeTrackFunction(&changeTrack); while(1){ toggleLED(2); } }
int main(int argc, char **argv) { int setting; /* number of rings */ if (argc > 1) setting = atoi(argv[1]); else setting = 3; if (setting > 10) setting = 10; else if (setting < 3) setting = 3; /* init display */ init(); /* init game variables */ gameInit(setting); musicInit(); atexit(freeMusic); while (1) { /* eventMainLoop handles all SDL events, when an SDL_QUIT is received, * the program will exit */ eventMainLoop(); drawScreen(); if (SDL_Flip(screen) < 0) { fprintf(stderr, "SDL_Flip() failed to flip screen: %s\n", SDL_GetError()); return EXIT_FAILED_FLIP; } } return 0; }
//////////////////////////////////////////////// /// @brief constructor of QS mainwindow /// /// /// /// @author wyj /////////////////////////////////////////////// QSWindow::QSWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::QSWindow), openFileName(""), saveFileName(""), tempFileName(""), mediaPlayer(0), musicthread(0), recorder(new QSRecorder(this)), preset(QSPreset::getInstance(this)) { //qDebug()<<QSettings(QSAbout::domainName, QSAbout::appName).scope(); //QSettings(QSAbout::domainName, QSAbout::appName).clear();//remove this line in release version ui->setupUi(this); preset->readSettings();//ALSO construct ALL Views!! //set icon QIcon iconQS(":/image/QScore.jpg"); setWindowIcon(iconQS); //initialize ui->statusBar->showMessage(QString("Welcome to QtScoreur! ")+QDir::currentPath()); //setAutoFillBackground(false); QPalette winPalette; winPalette.setBrush(QPalette::Window, QBrush(QPixmap(QString(":/image/glry.jpg"), "JPG").scaled(900,600))); //setPalette(winPalette); //music play musicInit(); musicthread = new QSPlayer(openFileName); //// mediaPlayer = musicthread->player; musicthread->start(); preload();//holding all connections needed // load sample score from qrc QString sampleScore = QDir::homePath()+QString("/QS_tmp/thu_anthem_short"); QDir::home().mkdir(QString("QS_tmp")); QFile fw(sampleScore+QString(".txt")), fd(":/sample/thu_anthem_short.txt"); fw.open(QFile::WriteOnly); fd.open(QFile::ReadOnly); QByteArray ba = fd.readAll(); fw.write(ba.constData(),ba.size()); fd.close(); fw.close(); addScene(staffView); addScene(scoreView, sampleScore+QString(".txt")); if(! QFileInfo(sampleScore+QString(".wav")).isFile()){ WavFile wavOut; qDebug()<<"THERE"; if(wavOut.fromScore(60.0/80, (sampleScore+QString(".txt")).toStdString().c_str())){ qDebug()<<"HERE"; wavOut.save(sampleScore.toStdString().append(".wav").c_str()); addScene(wavView, wavOut, sampleScore+QString(".wav")); playButton->setEnabled(true); } }else{ addScene(wavView, sampleScore+QString(".wav")); playButton->setEnabled(true); } keyScene = new KeyScene(keyView, this); //add webView webView = new Html5ApplicationViewer(ui->webTab); webView->setOrientation(Html5ApplicationViewer::ScreenOrientationAuto); webView->resize(900, 400); webView->showExpanded(); webView->loadUrl(QUrl(QLatin1String("http://www.scoreur.net"))); }