void EnPlayerSound::handleNotification( const yaf3d::EntityNotification& notification ) { // handle attribute changing switch( notification.getId() ) { case YAF3D_NOTIFY_MENU_LEAVE: { // respond to sound setting changes in menu for fx sound bool sndenable = false; yaf3d::Configuration::get()->getSettingValue( VRC_GS_FX_ENABLE, sndenable ); // did we just enabled the fx sound in menu? if ( sndenable && ( _mapSounds.size() == 0 ) ) { setupSounds(); } // did we just disabled fx sound in menu? else if ( !sndenable && ( _mapSounds.size() > 0 ) ) { releaseSounds(); } } break; case YAF3D_NOTIFY_ENTITY_ATTRIBUTE_CHANGED: { _volume = std::max( std::min( _volume, 1.0f ), 0.0f ); } break; default: ; } }
void setup() { setupLevels(); stateFunction = runSplash; setupSplash(); setupInterrupts(); setupSounds(); playSound(B, (unsigned char*)main_11025Hz, MAIN_11025HZ_SIZE, 11025, 1); }
int startSounds() { setupInterrupts(); setupSounds(); //playSoundA(powerupsfx, POWERUPSFXLEN, POWERUPSFXFREQ, 0); // don't play sound B inside while loop !!!!! //playSoundB(specialbgm2, SPECIALBGM2LEN, SPECIALBGM2FREQ, 1); //playSoundA(powerupsfx, POWERUPSFXLEN, POWERUPSFXFREQ, 0); }
void EnPlayerSound::postInitialize() { // register entity for getting notifications yaf3d::EntityManager::get()->registerNotification( this, true ); // is fx sound enabled? bool sndenable = false; yaf3d::Configuration::get()->getSettingValue( VRC_GS_FX_ENABLE, sndenable ); if ( !sndenable ) return; // setup all player sounds setupSounds(); }
Bullet::Bullet(Score* score, float x, float y, float direction, bool good) { setupSounds(); this->active = 1; if (good) { this->groupId = 3; } else { this->groupId = 4; } this->Load("ship.png"); this->setColor(sf::Color::White); this->setScale(0.25f, 0.5f); this->velocity.y = direction * BULLET_SPEED; this->score = score; this->setPosition(x - this->getGlobalBounds().width / 2, y - this->getGlobalBounds().height / 2); }
int main() { setupInterrupts(); setupSounds(); playSoundA(titleSong, TITLESONGLEN, TITLESONGFREQ, 1); // Start game with splash screen splash(); // Main Game Loop while (1) { oldButtons = buttons; buttons = BUTTONS; // Update player row and column player.bigRow = player.row + vOff; player.bigCol = player.col + hOff; switch(state) { case SPLASH: // Displays splash screen splash(); break; case INSTRUCTIONS: instructions(); break; case GAME: // Game Function holds all game logic game(); break; case SEASONCHANGE: // Warp-like animation as player changes between seasons warpAnimation(); // Change game to correct season, based on prevSeason and return to gameplay if (vBlankCount < 1) { seasonChange(); state = GAME; } break; case PAUSE: pause(); break; case LOSE: lose(); break; case WINLEVEL: winLevel(); break; case GAMEEND: gameEnd(); break; } // Shadow OAM Handling // Player Sprite shadowOAM[0].attr0 = (ROWMASK & player.row) | ATTR0_SQUARE; shadowOAM[0].attr1 = (COLMASK & player.col) | ATTR1_SIZE16 | (ATTR1_HFLIP & (player.facing << 12)); shadowOAM[0].attr2 = (SPRITEOFFSET16(season * 2, player.currentFrame * 2)) | ATTR2_PRIORITY2; // Season Icon Sprite shadowOAM[1].attr0 = (ROWMASK & icon.row) | ATTR0_SQUARE; shadowOAM[1].attr1 = (COLMASK & icon.col) | ATTR1_SIZE16; shadowOAM[1].attr2 = (SPRITEOFFSET16(season * 2, 6)) | (1 << 10); // Priority 1 REG_BG2HOFS = hOff; REG_BG2VOFS = vOff; // Set BG1 offsets - used for snow and falling leaves REG_BG1HOFS = bg1HOff; REG_BG1VOFS = bg1VOff; //Copy the shadowOAM into the OAM DMANow(3, &shadowOAM, OAM, 512); waitForVblank(); } return 0; }
int main(int argc, char** argv) { SWFMovie mo; SWFSound so; const char* soundFile; const char* srcdir; int frame; if (argc > 1) { soundFile = argv[1]; } else { soundFile = "brokenchord.wav"; } if (argc > 2) { srcdir = argv[2]; } else { srcdir = "."; } /* setup ming and basic movie properties */ Ming_init(); Ming_useSWFVersion(OUTPUT_VERSION); mo = newSWFMovie(); SWFMovie_setDimension(mo, 800, 600); SWFMovie_setRate(mo, 0.5); setupMovie(mo, srcdir); so = setupSounds(soundFile); /// Add as an export so we can attach it. SWFMovie_addExport(mo, (SWFBlock)so, "es"); SWFMovie_writeExports(mo); add_actions(mo, "c = 0;"); SWFMovie_nextFrame(mo); add_actions(mo, "note('You will hear several short tests with a succession of sounds. " "Each frame is two seconds long.\n" "The movie will describe what you should hear at the beginning of " "the frame.');"); frame = 0; pauseForNextTest(mo); runMultipleSoundsTest(mo, so, &frame); pauseForNextTest(mo); runNoMultipleSoundsTest(mo, so, &frame); pauseForNextTest(mo); runTrimmedSoundsTest(mo, so, &frame); pauseForNextTest(mo); runAttachedSoundsTest(mo, so, &frame); // TODO: test start(<sec_offset>) (+ with loop ?) endOfTests(mo); //Output movie puts("Saving " OUTPUT_FILENAME ); SWFMovie_save(mo, OUTPUT_FILENAME); return 0; }
JNIEXPORT void JNICALL Java_com_limasky_test_LSGL1Renderer_init(JNIEnv *env, jclass jcls, jint width, jint height) { setupSounds(); setupTextures(); setupGraphics( width, height ); }