void QSWindow::preload(){ //file control buttons and shortcuts setAcceptDrops(true); ui->tabWidget->setAcceptDrops(true); connect(ui->actionOpen_File, SIGNAL(triggered()), SLOT(openFile())); ui->actionOpen_File->setShortcut(QKeySequence::Open); connect(ui->actionSave_File, SIGNAL(triggered()), SLOT(saveFile())); ui->actionSave_File->setShortcut(QKeySequence::Save); connect(ui->actionSave_File_as, SIGNAL(triggered()), SLOT(saveFileAs())); ui->actionSave_File_as->setShortcut(QKeySequence::SaveAs); connect(ui->actionClose, SIGNAL(triggered()), SLOT(closeFile())); ui->actionClose->setShortcut(QKeySequence::Close); connect(ui->actionPreset, SIGNAL(triggered()), SLOT(changePreset())); connect(ui->actionDisplay_Keyboard, SIGNAL(triggered()), SLOT(displayKeyBoard())); ui->actionDisplay_Keyboard->setShortcut(QKeySequence("ctrl+K")); connect(ui->actionDisplay_specturm,SIGNAL(triggered()), SLOT(displaySpectrum())); connect(ui->actionScore_to_wav, SIGNAL(triggered()), SLOT(scoreToWav())); connect(ui->actionWav_to_score, SIGNAL(triggered()), SLOT(wavToScore())); connect(ui->menuOpened, SIGNAL(triggered(QAction*)), SLOT(switchScene(QAction*))); connect(this,SIGNAL(addFromLameSignal(QString)),this, SLOT(addFromLame(QString)), Qt::QueuedConnection); //music state management connect(mediaPlayer, SIGNAL(positionChanged(qint64)), this,SLOT(positionChanged(qint64)),Qt::QueuedConnection); connect(mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)),Qt::QueuedConnection); connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(mediaStateChanged(QMediaPlayer::State)),Qt::QueuedConnection); connect(positionSlider, SIGNAL(sliderReleased()), this, SLOT(setPosition()),Qt::QueuedConnection); connect(playButton, SIGNAL(clicked()), this, SLOT(musicPlay()),Qt::QueuedConnection); connect(recorder->recordButton, SIGNAL(clicked()), this, SLOT(record())); }
int main(int argc, char** argv) { wiringPiSetup( ) ; musicPlay( ); /* 음악 연주를 위한 함수 호출 */ return 0; }
void bossControllerUpdate(Controller* c, Entity* e, Iwbtg* iw, float dt) { ControllerBoss* b = &c->boss; if(b->triggered) { if(!b->initialized) { b->initialized = true; // Take the first action in the queue if(!bossIsActionQueueEmpty(b)) { b->actionQueue[0].initialized = false; bossAddActiveAction(b, &b->actionQueue[0]); } } for(int i = 0; i < MAX_ACTIONS_PER_BOSS; ++i) { BossAction* a = b->activeActions[i]; if(a == 0) continue; a->time += dt; switch(a->type) { case BossActionType_wait: if(a->time > a->wait.time) bossRemoveActiveAction(b, a); break; case BossActionType_move: if(!a->initialized) { a->move.start = e->position; a->initialized = true; } e->position = vector2fLerp(a->move.start, a->move.destination, inOutEase(clamp(a->time / a->move.time, 0, 1))); if(a->time >= a->move.time) bossRemoveActiveAction(b, a); break; case BossActionType_projectileBurst: { BossActionProjectileBurst* pb = &a->projectileBurst; if(!a->initialized) pb->shotTimer = 0; pb->shotTimer += dt; // TODO: do something a little smarter here so that // if two shots occur on the same frame, their positions // are correctly seperated from each other. if(pb->shotTimer > pb->interval) { soundPlay(assetsGetSound(&iw->game, "bossShoot"), 0.2); while(pb->shotTimer > pb->interval) { for(int i = 0; i < pb->count; ++i) { Entity* p = createEntity(iw, pb->projectileEntityType, e->position.x + (e->sprite.size.x / 2), e->position.y + (e->sprite.size.y / 2)); p->position.x -= (p->sprite.size.x / 2); p->position.y -= (p->sprite.size.y / 2); p->velocity = speedDirectionToVector2f(pb->speed, pb->direction + ((360 / pb->count) * i)); } pb->direction += pb->rotation; pb->shotTimer -= pb->interval; } } if(a->time > pb->interval * pb->repeat) bossRemoveActiveAction(b, a); } break; case BossActionType_playMusic: musicPlay(a->playMusic.music, 0.7, &iw->game); bossRemoveActiveAction(b, a); break; case BossActionType_projectileRandomSpray: if(a->time > a->projectileRandomSpray.time) bossRemoveActiveAction(b, a); BossActionProjectileRandomSpray* pb = &a->projectileRandomSpray; Entity* p = createEntity(iw, pb->projectileEntityType, e->position.x + (e->sprite.size.x / 2), e->position.y + (e->sprite.size.y / 2)); p->position.x -= (p->sprite.size.x / 2); p->position.y -= (p->sprite.size.y / 2); pb->previousDirection += (12 * 7); //pb->previousDirection = (randomfBetween(0, 360)); p->velocity = speedDirectionToVector2f(pb->speed, pb->previousDirection + randomfBetween(-12, 12)); pb->soundCounter++; if(pb->soundCounter > 1) { pb->soundCounter = 0; soundPlay(assetsGetSound(&iw->game, "bossShoot"), 0.1); } break; case BossActionType_projectileAimed: { BossActionProjectileAimed* pa = &a->projectileAimed; Entity* p = createEntity(iw, pa->projectileEntityType, e->position.x + (e->sprite.size.x / 2), e->position.y + (e->sprite.size.y / 2)); p->position.x -= (p->sprite.size.x / 2); p->position.y -= (p->sprite.size.y / 2); float direction = vector2fDirection( vector2fAdd(e->position, v2f(e->sprite.size.x / 2, e->sprite.size.y / 2)), vector2fAdd(iw->player.position, v2f(16, 16))) * (180 / PI); p->velocity = speedDirectionToVector2f(pa->speed, direction); soundPlay(assetsGetSound(&iw->game, "bossShoot"), 0.1); bossRemoveActiveAction(b, a); } break; default: bossRemoveActiveAction(b, a); printf("Warning: Tried to perform boss action that has not been implemented!\n"); break; } if(!a->initialized) a->initialized = true; } // TODO: Make this into a loop so multiple actions can start per frame. if(!bossIsActionBlocking(b) && iw->state != GameState_gameOver) bossNextAction(b); if(b->health <= 0) { if(iw->boss == e) iw->boss = 0; createEntity(iw, EntityType_warp, 480 - 64, 540 - 256); musicPlayOnce(assetsGetMusic(&iw->game, "bossDefeatedMusic"), 0.7, &iw->game); destroyEntity(e); } } }
void MusicMyDownloadRecordWidget::contextMenuEvent(QContextMenuEvent *event) { MusicAbstractTableWidget::contextMenuEvent(event); QMenu rightClickMenu(this); rightClickMenu.setStyleSheet(MusicUIObject::MMenuStyle02); rightClickMenu.addAction(QIcon(":/contextMenu/play"), tr("musicPlay"), this, SLOT(musicPlay())); rightClickMenu.addAction(tr("openFileDir"), this, SLOT(musicOpenFileDir())); rightClickMenu.addSeparator(); rightClickMenu.addAction(QIcon(":/contextMenu/delete"), tr("delete"), this, SLOT(setDeleteItemAt())); rightClickMenu.addAction(tr("deleteAll"), this, SLOT(setDeleteItemAll())); rightClickMenu.exec(QCursor::pos()); event->accept(); }
void MusicMyDownloadRecordWidget::listCellDoubleClicked(int, int) { musicPlay(); }