void lhpControl::enterAtmo() { // lhpMap * map = lhpMap::get(); insideAtmoFlag = 1; decisionString = "enter atmo "+ofToString(insideAtmoID+1); signalString = "signal: "; for(int i = 0; i < map->numberOfZones; i++) { // set all signalActives to 0 fadeOut(map->zones[i].signals[0]); // stopping i-th signal player if playing if(map->zones[i].signalActive == 1) { map->zones[i].signalActive = 0; map->zones[i].prevSignalState = 0; signalString += "stop "+ofToString(i+1)+" "; } else { map->zones[i].prevSignalState = 0; } } graphicState = 3; // stop intro and outro and music fadeOut(map->music[0]); fadeOut(map->music[1]); fadeOut(map->music[authorID]); // starting atmo player // fadeIn(map->zones[insideAtmoID].atmo[0]); // chnaged to scene start here // TODO: start scene here int i, p, s; s = insideAtmoID ; p = map->zones[s].partID; // current p if(map->zones[s].scenes[p].finished == 1) { if (map->zones[s].partID < map->zones[s].numberOfScenes-1) { // it is NOT the last scene map->zones[s].partID++; // increment partID // printf("incrementing zone[%d].partID to %d\n", s, map->zones[s].partID); p = map->zones[s].partID; // update p map->zones[s].scenes[p].elapsedTime = 0; // reset elapsedTime for next scene } } p = map->zones[s].partID; if(map->zones[s].scenes[p].finished == 0){ sceneGraphicState = 1; // full alpha } else { sceneGraphicState = 0; // reduced alpha } // starting scene player if it was off if(p < map->zones[s].numberOfScenes){ fadeIn(map->zones[s].scenes[p]); } else { fadeIn(map->zones[s].atmo[1]); } }
void lhpControl::enterPerimeter() { decisionString = "enter perimeter"; graphicState = 1; fadeOut(map->music[1]); // stopping outro if still playing if(map->music[0].finished == 1){ // fadeIn(map->music[authorID]); // (re)start music activity if it was off fadeIn(map->music[2]); // play entry sequence } else { fadeIn(map->music[0]); // continue unfinished Intro } }
bool TransparentScrollBar::eventFilter(QObject *obj, QEvent *event) { switch (event->type()) { case QEvent::Enter: setMouseTracking(true); if (obj == view_) { fadeIn(); } else if (obj == this) { scrollButton_->hoverOn(); } else if (obj == scrollButton_) { scrollButton_->hoverOn(); } break; case QEvent::Leave: if (obj == view_) { scrollButton_->fadeOut(); } else if (obj == this) { scrollButton_->hoverOff(); } else if (obj == scrollButton_) { scrollButton_->hoverOff(); } break; case QEvent::Resize: if (obj == view_) { onResize(static_cast<QResizeEvent*>(event)); } break; case QEvent::MouseMove: fadeIn(); break; default: ; } return QWidget::eventFilter( obj, event ); }
void FadeToBlack::process(unsigned char* _buf, unsigned char * _oBuf, int _w, int _h, float _pos){ if(multiplier > 0.0){ fadeOut(_buf,_oBuf,_w,_h,_pos); } else { fadeIn(_buf,_oBuf,_w,_h,_pos); } }
void CopyGui::on_btnEdit_clicked() { checkEdit = true; QModelIndex modelBarcode = queryModel->index(ui->tableView->currentIndex().row(), 1, QModelIndex()); QModelIndex modelBorrowingStatus = queryModel->index(ui->tableView->currentIndex().row(), 2, QModelIndex()); QModelIndex modelTimeBorrowed = queryModel->index(ui->tableView->currentIndex().row(), 3, QModelIndex()); QModelIndex modelDate = queryModel->index(ui->tableView->currentIndex().row(), 4, QModelIndex()); QModelIndex modelTimeBorrow = queryModel->index(ui->tableView->currentIndex().row(), 5, QModelIndex()); ui->lnCPBarCode->setText(modelBarcode.data().toString()); ui->cbCPStatus->setCurrentText(modelBorrowingStatus.data().toString()); ui->lnCPTimeBorrowed->setText(modelTimeBorrowed.data().toString()); //ui->lnCPDateBorrow->setText(modelDate.data().toString()); ui->dateBorrow->setDate(QDate::fromString(modelDate.data().toString(), "yyyy-MM-dd")); ui->lnCPTimeBorrow->setText(modelTimeBorrow.data().toString()); ui->btnCPAdd->setText("Edit"); if(checkHide == false){ ui->widget->show(); fadeIn(ui->widget); checkHide = true; }else if(checkHide == true){ fadeOut(ui->widget); checkHide = false; } }
void initEditor(void) { lcdMainOnBottom(); videoSetMode(MODE_5_3D); videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE); vramSetPrimaryBanks(VRAM_A_TEXTURE,VRAM_B_TEXTURE,VRAM_C_SUB_BG,VRAM_D_TEXTURE); glInit(); glEnable(GL_TEXTURE_2D); // glEnable(GL_ANTIALIAS); glEnable(GL_BLEND); glEnable(GL_OUTLINE); glClearPolyID(63); glClearDepth(0x7FFF); glViewport(0,0,255,191); initVramBanks(1); initTextures(); initRoomEdition(); NOGBA("START mem free : %dko (%do)",getMemFree()/1024,getMemFree()); fadeIn(); }
void ECandle::setState(const CandleState newState) //переключение в новое состояние { #ifdef DEBUG_ECANDLE Serial.print("ECandle::setState() ID="); int tmp = getID(); Serial.print( tmp ); Serial.print(" new State="); Serial.println(newState); #endif switch ( newState ) { case csOn: this->currentState = csOn; on(); break; case csOff: this->currentState = csOff; off(); break; case csFadeIn: //????? this->currentState=csFadeIn; fadeIn(); break; case csFadeOut: //????? this->currentState = csFadeOut; fadeOut(); break; case csFlickering: //?????? this->currentState = csFlickering; startFlickering(); break; } //switch newState };
//! Init common elements CSceneMenu::CSceneMenu() : CScene() { BackBufferColor = video::SColor(255, 255, 255, 255); NewGameIsFading = false; QuitIsFading = false; InTitleFadeIn = false; InMainMenu = true; InSaveListMenu = false; InOptionMenu = false; InNewGameFadeOut = false; initModeList(); Camera = new N3D::NCamera::CThirdPerson(); Camera->setControl(false); Camera->getNode()->setPosition(core::vector3df(0.0f, 1.0f, -2700.0f)); Camera->getNode()->setTarget(core::vector3df(0.0f, 100.0f, 0.0f)); Camera->getNode()->setFarValue(10000.0f); MainMenu = new NHud::NMenu::CMenu(NEngine::NCore::CGame::ScreenPos.Hud.Left + 100.0f, -100.0f, 150.0f, 8, NHud::NMenu::EMS_TITLE); MainMenu->addOption(NHud::NMenu::EMI_NONE, GlobalTranslations->getTranslation("main_menu_launch_demo")); MainMenu->addOption(NHud::NMenu::EMI_NONE, GlobalTranslations->getTranslation("main_menu_quit")); Title = new NHud::NPrimitive::CPicture(NEngine::NCore::CGame::ScreenPos.Hud.Right - 413.0f, 100.0f, 826.0f, 101.0f, "resource/texture/menus/title/main.png"); CreativeCommons = new NHud::NPrimitive::CPicture(NEngine::NCore::CGame::ScreenPos.Hud.Left + 300.0f, NEngine::NCore::CGame::ScreenPos.Hud.Bottom + 50.0f, 420.0f, 44.0f, "resource/texture/menus/title/cc.png"); fadeIn(0.5f); }
void CompositorHelper::toggle() { if (_fadeInAlpha) { fadeOut(); } else { fadeIn(); } }
// create window three for the addition float* fillWindowThree(int fadingWindow, int startFade, float* windowOne, float* windowTwo) { // Size of the window three int windowThreeSize = fadingWindow * 2; // initial value of window three float* windowThree = new float[windowThreeSize]; for (int s = 0; s < fadingWindow; s++) { windowThree[s] = windowOne[startFade++]; windowThree[fadingWindow + s] = windowTwo[s]; } // all fading position in window three for (int i = 0; i < fadingWindow; i++) { windowThree[i] *= fadeIn(i, fadingWindow); } for (int j = fadingWindow; j < windowThreeSize; j++) { windowThree[j] *= fadeOut(j, fadingWindow); } return windowThree; }
void lhpControl::leavePerimeter() { decisionString = "exit perimeter"; graphicState = 5; fadeOut(map->music[0]); // stop Intro if running fadeOut(map->music[2]); // play entry sequence fadeOut(map->music[authorID]); // stop Music if running fadeIn(map->music[1]); // starting Outro for(int i = 0; i < map->numberOfZones; i++) { // set all signalActives to 0 // force ALL zone players off: signal, atmo, scene[ID] fadeOut(map->zones[i].signals[0]); // fadeOut(map->zones[i].atmo[0]); fadeOut(map->zones[i].atmo[1]); int ID = map->zones[i].partID; fadeOut(map->zones[i].scenes[ID]); if(map->zones[i].signalActive == 1) { signalString += "stop "+ofToString(i+1)+" "; map->zones[i].signalActive = 0; map->zones[i].prevSignalState = 1; } else { map->zones[i].signalActive = 0; map->zones[i].prevSignalState = 0; } } }
void lhpControl::leaveSignal() { decisionString = "exit Signal "+ofToString(prevSignalID+1); moreSignalChecks(); graphicState = 1; fadeIn(map->music[authorID]); // restart music activity if it was off }
void TitleScene::init() { PixelScene::init(); uiCamera->visible = false; // int w = Camera::mainCamera->width; int h = Camera::mainCamera->height; // Archs* archs = new Archs(); archs->setSize(w, h); add(archs); Image* title = BannerSprites::get(BannerSprites::Type::PIXEL_DUNGEON); add(title); float height = title->height + (PixelDungeon::landscape() ? DashboardItem_SIZE : DashboardItem_SIZE * 2); title->x = (w - title->Width()) / 2; title->y = (h - height) / 2; placeTorch(title->x + 18, title->y + 20); placeTorch(title->x + title->width - 18, title->y + 20); Image* signs = new SignImage(BannerSprites::get(BannerSprites::Type::PIXEL_DUNGEON_SIGNS)); //Image* signs = BannerSprites::get(BannerSprites::Type::PIXEL_DUNGEON_SIGNS); signs->x = title->x; signs->y = title->y; add(signs); DashboardItem* btnBadges = new DashboardItemBadge(TXT_BADGES, 3); add(btnBadges); DashboardItem* btnAbout = new DashboardItemAbout(TXT_ABOUT, 1); add(btnAbout); DashboardItem* btnPlay = new DashboardItemPlay(TXT_PLAY, 0); add(btnPlay); DashboardItem* btnHighscores = new DashboardItemHighScores(TXT_HIGHSCORES, 2); add(btnHighscores); if (PixelDungeon::landscape()) { float y = (h + height) / 2 - DashboardItem_SIZE; btnHighscores->setPos(w / 2 - btnHighscores->width(), y); btnBadges->setPos(w / 2, y); btnPlay->setPos(btnHighscores->left() - btnPlay->width(), y); btnAbout->setPos(btnBadges->right(), y); } else { btnBadges->setPos(w / 2 - btnBadges->width(), (h + height) / 2 - DashboardItem_SIZE); btnAbout->setPos(w / 2, (h + height) / 2 - DashboardItem_SIZE); btnPlay->setPos(w / 2 - btnPlay->width(), btnAbout->top() - DashboardItem_SIZE); btnHighscores->setPos(w / 2, btnPlay->top()); } fadeIn(); }
void lhpControl::enterPerimeterFirst() { decisionString = "first time entering perimeter "; graphicState = 1; fadeOut(map->music[1]); // stopping outro if still playing fadeIn(map->music[2]); // play entry sequence }
void setup (){ fadeIn(10, 5); bmp_draw("robotsh",0,0); delay(2000); fadeOut(10, 5); //display the splash screen delay(100); fadeIn(10, 5); bmp_draw("stisplsh", 0, 0); //Serial.begin(9600); //set up the TouchShield serial connection //delay(3000); //and wait a little for the Arduino to boot up //Serial.print('U'); //send a sync character to the Arduino fadeOut(10, 5); fadeIn(10,5); }
void lhpControl::enterSignal() { decisionString = "enter Signal "+ofToString(insideSignalID+1); moreSignalChecks(); graphicState = 2; fadeIn(map->music[authorID]); // restart music activity if it was off }
// prepare window two for the addition float* editWindowTwo(int fadingWindow, float* windowTwo) { for (int i = 0; i < fadingWindow; i++) { windowTwo[i] *= fadeIn(i, fadingWindow); } return windowTwo; }
void initMenu(void) { lcdMainOnTop(); videoSetMode(MODE_5_3D); videoSetModeSub(MODE_5_2D); vramSetPrimaryBanks(VRAM_A_TEXTURE,VRAM_B_TEXTURE,VRAM_C_SUB_BG,VRAM_D_TEXTURE); initD3D(); glInit(); glEnable(GL_TEXTURE_2D); glEnable(GL_ANTIALIAS); glEnable(GL_BLEND); glEnable(GL_OUTLINE); glClearPolyID(63); glClearDepth(0x7FFF); glViewport(0,0,255,191); initVramBanks(2); initTextures(); initMenuScene(); initMenuButtons(); //TEMP glLight(0, RGB15(31,31,31), cosLerp(4096), 0, sinLerp(4096)); glMaterialf(GL_AMBIENT, RGB15(8,8,8)); glMaterialf(GL_DIFFUSE, RGB15(24,24,24)); glMaterialf(GL_SPECULAR, RGB15(0,0,0)); glMaterialf(GL_EMISSION, RGB15(0,0,0)); glSetToonTableRange(0, 15, RGB15(8,8,8)); //TEMP? glSetToonTableRange(16, 31, RGB15(24,24,24)); //TEMP? applyCameraState(&menuCamera,&cameraStates[4]); tempState=cameraStates[4]; testTransition=startCameraTransition(&cameraStates[1],&cameraStates[4],64); setupMenuPage(startMenuPage, startMenuPageLength); logoMain=createTexture("logo.pcx", "menu"); logoRotate=createTexture("rotate_logo.pcx", "menu"); logoAlpha=31; glSetOutlineColor(0,RGB15(0,0,0)); //TEMP? glSetOutlineColor(1,RGB15(0,0,0)); //TEMP? glSetOutlineColor(7,RGB15(0,0,0)); //TEMP? NOGBA("END mem free : %dko (%do)",getMemFree()/1024,getMemFree()); fadeIn(); }
void FadingScrollBar::sliderChange( SliderChange change ) { if (change == SliderValueChange && !isVisible() && maximum() > 0) { fadeIn(); m_hideTimer->start(); } QScrollBar::sliderChange( change ); }
//----------------------------------------------------------------- void Section::changeTo(int section) { cout << "[Section::changeTo] begin" + ofToString(section)<< endl; nextSection = section; fadeIn(); //get json //fade in overlay //loadContent //fade out overlay cout << "[Section::changeTo] end" << endl; }
void TeenAgentEngine::loadScene(byte id, uint16 x, uint16 y, byte o) { if (scene->last_event_type() != SceneEvent::kCreditsMessage) fadeOut(); SceneEvent event(SceneEvent::kLoadScene); event.scene = id; event.dst.x = x; event.dst.y = y; event.orientation = o; scene->push(event); fadeIn(); }
void lhpControl::leaveAtmo() { decisionString = "exit atmo "+ofToString(prevAtmoID+1); graphicState = 2; // fadeOut(map->zones[prevAtmoID].atmo[0]); // fade out atmo1 if playing fadeOut(map->zones[prevAtmoID].atmo[1]); // fade out atmo2 if playing int ID = map->zones[prevAtmoID].partID; fadeOut(map->zones[prevAtmoID].scenes[ID]); // also stop scene fadeIn(map->music[authorID]); // restart music activity moreSignalChecks(); }
void CopyGui::on_btnCPSave_clicked() { clearText(); checkEdit = false; ui->btnCPAdd->setText("Add"); if(checkHide == false){ ui->widget->show(); fadeIn(ui->widget); checkHide = true; }else if(checkHide == true){ fadeOut(ui->widget); checkHide = false; } }
void TransparentScrollBarH::updatePosition() { auto scrollButton = qobject_cast<TransparentScrollButtonH*>(getScrollButton()); const auto ratio = calcScrollBarRatio(); if (ratio < 0) { scrollButton->hide(); hide(); return; } if (!L::is_show_with_small_content && ratio >= 1) { scrollButton->hide(); hide(); return; } else { scrollButton->show(); show(); if (!scrollButton->isVisible()) { fadeIn(); } } const auto button_width = calcButtonWidth(); scrollButton->setFixedSize(button_width, scrollButton->height()); const auto scrollBar = getDefaultScrollBar(); const auto val = scrollBar->value(); const auto max = scrollBar->maximum(); const auto y = pos().y() + (height() - scrollButton->getMaxHeight()) / 2; if (max == 0) { scrollButton->move(pos().x(), y); return; } const auto maxX = width() - scrollButton->width(); const auto x = (maxX * val) / max + pos().x(); scrollButton->move(x, y); }
void Visualizer::Run(){ //std::cout << animationStatus << "..."; switch(animationStatus) { case 0: clear(); break; case 1: stroboscope(); break; case 2: lightchange(); break; case 3: fadeIn(); break; case 4: pulseCircle(); break; case 5: lines(); break; case 6: circles(); break; case 7: randomLines(); break; case 8: square(); break; case 9: randomPixel(); break; case 10: rotateLine(); break; } return; }
void lhpControl::moreSignalChecks() { // check all Signals to see whether we're inside a Signalradius // RULE: no more than 3 Signal are allowed to overlap signalString = "signal: "; insideSignalFlag = 0; decisionString = "inside perimeter "; for(int i = 0; i < map->numberOfZones; i++) { // run through all zones int ID = map->zones[i].partID; // get scene ID for the zone fadeOut(map->zones[i].scenes[ID]); // stopping any scene player that might have been playing // check to see if we're inside the signal radius AND outside an atmo radius if(map->zones[i].distance <= map->zones[i].radius[2] && map->zones[i].distance > map->zones[i].radius[1]) { if(insideSignalFlag == 0) { decisionString = "inside signal "; // set if ANY signal reached insideSignalFlag = 1; } // // printf("inside zone %d signal radius: active %d, prev %d\n", i, map->zones[i].signalActive, map->zones[i].prevSignalState); map->zones[i].signalActive = 1; if(map->zones[i].prevSignalState == 0) { // it was off -> now we move inside map->zones[i].prevSignalState = 1; signalString += "start "+ofToString(i+1)+" "; decisionString += ofToString(i+1); // set if ANY signal reached fadeIn(map->zones[i].signals[0]); // starting i-th signal player if it was not playing } else { // unchanged state // stay inside signalString += "run "+ofToString(i+1)+" "; decisionString += ofToString(i+1)+" "; // set if ANY signal reached } } else { // we're outside the signal radius map->zones[i].signalActive = 0; if(map->zones[i].prevSignalState == 1) { // prevState was active -> we just moved outside map->zones[i].prevSignalState = 0; decisionString += "signal "+ofToString(i+1)+" stop "; fadeOut(map->zones[i].signals[0]); // stopping i-th signal player if it was playing } else { map->zones[i].prevSignalState = 0; // remaining outside } } } }
bool LibraryMenuControl::onMouseMove(MouseOverlayEvent& mouseEvent) { if (_dropDownMenu) { Vec3 pos = mouseEvent.getAbsolutePosition() - getPosition(); if (intersects(pos, _dropDownMenu->getBounds())) { if (!_dropDownMenu->wasMouseLastHovered()) { _dropDownMenu->setMouseLastHovered(true); fadeIn(); } } else if (_dropDownMenu->wasMouseLastHovered()) { _dropDownMenu->setMouseLastHovered(false); fadeOut(_unHoveredAlpha); } } return AbsoluteOverlayLayout::onMouseMove(mouseEvent); }
void CopyGui::on_btnBorrow_clicked() { if(checkHide2 == false){ QModelIndex current_index_status = queryModel->index(ui->tableView->currentIndex().row(),2,QModelIndex()); if (current_index_status.data().toString().compare("lost",Qt::CaseInsensitive)==0) { QMessageBox::information(0, QString("Notice"), QString("This copy is lost."), QMessageBox::Ok); } else if (current_index_status.data().toString().compare("borrowed",Qt::CaseInsensitive)!=0) { ui->widget_2->show(); fadeIn(ui->widget_2); checkHide2 = true; } else { QMessageBox::information(0, QString("Notice"), QString("This copy is already borrowed by someone."), QMessageBox::Ok); } }else if(checkHide2 == true){ fadeOut(ui->widget_2); checkHide2 = false; } }
int main(int argc, char *argv[]) { WaveHeader header; //holds the header //if there is an error reading the header or if the header ID is not "RIFF" exit if( !readHeader(&header) || strncmp((char*)header.ID, "RIFF", 4)) { fprintf(stderr, "File is not a RIFF file\n"); return 3; } //check the formatChunk.ID, if not "fmt " exit if(strncmp((char*)header.formatChunk.ID, "fmt ", 4)) { fprintf(stderr, "Format chunk is corrupted\n"); return 4; } //check the header.dataChunk.ID, if not "data" exit if(strncmp((char*)header.dataChunk.ID, "data", 4)) { fprintf(stderr, "Error: Data chunk is corrupted\n"); return 5; } //check if the number of channels is 2, if not exit if(header.formatChunk.channels != 2) { fprintf(stderr, "File is not stereo\n"); return 6; } //check the sampling rate, if its not 44100 exit if(header.formatChunk.sampleRate != 44100) { fprintf(stderr, "File does not use 44,100Hz sample rate\n"); return 7; } //check the bits per sample, if not 16 bit (short) exit if(header.formatChunk.bitsPerSample != 16) { fprintf(stderr, "File does not have 16-bit samples\n"); return 8; } //channelLenth is the size of the dataChunk divided by two for two channels //and again by two because one sample has two bytes int channelLength = header.dataChunk.size/4; //allocate two arrays for the two channels short* left = (short*) malloc(sizeof(short)*channelLength); short* right = (short*) malloc(sizeof(short)*channelLength); //if malloc fails (returns NULL pointer) exit if(! (left && right)) { fprintf(stderr, "Program out of memory\n"); return 2; } //read the data Chunk //if its size does not match the expected length exit if(! readData(left, right, channelLength)) { fprintf(stderr, "File size does not match size in header\n"); return 9; } //get formatted header info char* info = headerInfo(&header); //printout input header information to stderr fprintf(stderr, "\nInput Wave Header Information\n\n%s\n", info); free(info); //loops throuh the commandline arguments and executes the right action on the data stored in left and right int i; for(i = 1; i < argc; ++i) { //case "-r" reverse if(strcmp(argv[i], "-r") == 0) { //reverse both the left and right channel reverse(&left, channelLength); reverse(&right, channelLength); } //case "-s" speed else if(strcmp(argv[i], "-s") == 0) { //check if there is a positive number in the argument after "-s" and read it into factor, //if not exit double factor; if(i < argc - 1 && sscanf(argv[++i], "%lf", &factor) != EOF && factor > 0) { //speed up left and right channel left = speed(left, channelLength, factor); right = speed(right, channelLength, factor); //update the channelLength channelLength /= factor; //update the header data header.dataChunk.size = 4*channelLength; header.size = 4 * channelLength + 36; } else { fprintf(stderr, "Error: A positive number must be supplied for the speed change\n"); return 10; } } //case "-f" flip channels else if(strcmp(argv[i], "-f") == 0) //flip channels left and right flip(&left, &right); //case "-o" fade out else if(strcmp(argv[i], "-o") == 0) { //check if there is a positive number in the argument after "-s" and read it into seconds, //if not exit double seconds; if(i < argc - 1 && sscanf(argv[++i], "%lf", &seconds) != EOF && seconds > 0) { //fade out left and right channel fadeOut(left, channelLength, seconds); fadeOut(right, channelLength, seconds); } else { fprintf(stderr, "Error: A positive number must be supplied for the fade in and fade out time\n"); return 11; } } //case "-i" fade in else if(strcmp(argv[i], "-i") == 0) { //check if there is a positive number in the argument after "-s" and read it into seconds, //if not exit double seconds; if(i < argc - 1 && sscanf(argv[++i], "%lf", &seconds) != EOF && seconds > 0) { //fade in left and right channel fadeIn(left, channelLength, seconds); fadeIn(right, channelLength, seconds); } else { fprintf(stderr, "Error: A positive number must be supplied for the fade in and fade out time\n"); return 11; } } //case "-v" volume else if(strcmp(argv[i], "-v") == 0) { //check if there is a positive number in the argument after "-s" and read it into scale, //if not exit double scale; if(i < argc - 1 && sscanf(argv[++i], "%lf", &scale) != EOF && scale > 0) { //change the volume of left and right volume(left, channelLength, scale); volume(right, channelLength, scale); } else { fprintf(stderr, "Error: A positive number must be supplied for the volume scale\n"); return 12; } } //case "-e" echo else if(strcmp(argv[i], "-e") == 0) { //check if there are two positve numbers in the arguments after "-e" and read them into delay and factor, //if not exit double delay, factor; if(i < argc - 2 && sscanf(argv[++i], "%lf", &delay) != EOF && sscanf(argv[++i], "%lf", &factor) != EOF && delay > 0 && factor > 0) { //ad the echo to the left and right channel left = echo(left, channelLength, delay, factor); right = echo(right, channelLength, delay, factor); //update channelLength channelLength += (int)(44100 * delay); //update header data header.dataChunk.size = 4*channelLength; header.size = 4 * channelLength + 36; } else { fprintf(stderr, "Error: A positive number must be supplied for the fade in and fade out time\n"); return 13; } } //if the argument is anything else then the known commands print a help else { fprintf(stderr, "Usage: wave [[-r][-s factor][-f][-o delay][-i delay][-v scale][-e delay scale] < input > output\n"); return 1; } } //get formatted header info info = headerInfo(&header); //print output header info the stderr fprintf(stderr, "\nOutput Wave Header Information\n\n%s\n", info); free(info); //write the header to stdout writeHeader(&header); //wrinte the data to stdout printData(left, right, channelLength); //free the two arrays holding the channels free(left); free(right); return 0; }
void LAN() { PA_ResetBgSys(); PA_ResetSpriteSys(); PA_InitText(MAIN_SCREEN, 0); PA_SetTextCol(MAIN_SCREEN, 31, 31, 31); if(!IPC_Init()) { PA_OutputText(MAIN_SCREEN, 0, 0, "IPC INIT FAILED"); while(true) {} } IPC_SetChannelCallback(0, &LWIFI_IPC_Callback); PA_VBLFunctionInit(customVBL); // inits/preps DS <-> DS PA_OutputText(MAIN_SCREEN, 1, 3, "Start Game = Start/nJoin Game = Select"); fadeIn(); while(playernumber == -1) { if(!lobbyinited) { LOBBY_Init(); LOBBY_SetStreamHandler(0x0001, &receive); lobbyinited = true; } // inits liblobby else if(Pad.Newpress.Start) { playernumber = 0; LOBBY_SetOwnName("Host"); LOBBY_CreateRoom(ROOM_NAME, MAX_PLAYERS, GAME_CODE, GAME_VER); } // creates a new game else if(Pad.Newpress.Select) { playernumber = 1; LOBBY_SetOwnName("Client"); LOBBY_JoinRoom(LOBBY_GetRoomByGame(0, GAME_CODE)); } // joins a created game PA_WaitForVBL(); } int max = LOBBY_GetUsercountInRoom(LOBBY_GetRoomByUser(LOBBY_GetUserByID(USERID_MYSELF))); PA_OutputText(MAIN_SCREEN, 1, 3, " "); PA_OutputText(MAIN_SCREEN, 1, 4, " "); PA_OutputText(MAIN_SCREEN, 1, 3, "Waiting for connection"); while(max < 2) { max = LOBBY_GetUsercountInRoom(LOBBY_GetRoomByUser(LOBBY_GetUserByID(USERID_MYSELF))); PA_OutputText(MAIN_SCREEN, 1, 4, "%d", max); PA_WaitForVBL(); } players.push_back(new Kirby(512/2 -96 -32, 256/3 -32, 1, players, &display)); Stage stage = setStage(FINALDESTINATION); PA_InitText(MAIN_SCREEN, 1); // inits text on the main screen (displays time) PA_SetTextCol(MAIN_SCREEN, 31, 31, 31); // text color = white PA_OutputText(MAIN_SCREEN, 1, 3, " "); PA_OutputText(MAIN_SCREEN, 1, 4, " "); while(true) { if(playernumber == 0) { players[0] -> act(); dat[0] = (int)(players[0] -> x); dat[1] = (int)(players[0] -> y); dat[2] = PA_GetSpriteAnimFrame(MAIN_SCREEN, players[0] -> SPRITENUM); LOBBY_SendToUser(LOBBY_GetUserByID(0), 0x0001, (unsigned char *)dat, 10); } scrollScreen(); PA_WaitForVBL(); } }