void En2DSound::handleNotification( const yaf3d::EntityNotification& notification )
{
    // handle menu entring / leaving
    switch( notification.getId() )
    {
        case YAF3D_NOTIFY_MENU_ENTER:

            stopPlaying( true );
            break;

        case YAF3D_NOTIFY_MENU_LEAVE:

            // respond to sound setting changes in menu only if the sound type is not Common
            if ( yaf3d::SoundManager::get()->getSoundGroupIdFromString( _soundGroup ) != yaf3d::SoundManager::SoundGroupCommon )
                setupSound();

            startPlaying( true );
            break;

        case YAF3D_NOTIFY_ENTITY_ATTRIBUTE_CHANGED:
        {
            // recreate sound if any attribute has been changed
            if (  _soundID > 0 )
            {
                try
                {
                    stopPlaying( false );
                    yaf3d::SoundManager::get()->releaseSound( _soundID );
                    _soundID = 0;
                }
                catch ( const yaf3d::SoundException& )
                {
                }
            }
            setupSound();
        }
        break;

        case YAF3D_NOTIFY_UNLOAD_LEVEL:
        {
            // nothing to do atm
        }
        break;

        default:
            ;
    }
}
Esempio n. 2
0
int _tmain(int argc, _TCHAR* argv[])
{
    // construct the viewer
    osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;

    // make the viewer create a 512x512 window and position it at 32, 32
    viewer->setUpViewInWindow( 32, 32, 512, 512 );

	debugger = new CSulTrackballManipulatorDebugger;
	viewer->setCameraManipulator( debugger );


	// set the scene-graph data the viewer will render
	osg::Group* group = new osg::Group;
	
	group->addChild( createScene() );
  
	viewer->setSceneData( group );

	// setup sound
	setupSound( viewer );
	
	// execute main loop
	return viewer->run();
}
Esempio n. 3
0
void ofApp::setup(){
    
    setupTcpServer();
    setupArrays();
    setupSound();
    setupChannels();
    
    for (int i = 0; i < channels.size(); i++) {
        channel *channel = channels[i];
        
        movingFrameBoard *mfb = new movingFrameBoard(&channel->mFbo);
        movingFrameBoards.push_back(mfb);
        
        chessBoard1 *cb1 = new chessBoard1(&channel->mFbo);
        chessBoard1s.push_back(cb1);
        
        testBoard *tb = new testBoard(&channel->mFbo);
        testBoards.push_back(tb);
        
        oneColorBoard *ocb = new oneColorBoard(&channel->mFbo);
        oneColorBoards.push_back(ocb);
        
        chessBoard2 *cb2 = new chessBoard2(&channel->mFbo);
        chessBoard2s.push_back(cb2);
    }
    
    
}
void En2DSound::initialize()
{
    // register entity in order to get menu notifications
    yaf3d::EntityManager::get()->registerNotification( this, true );

    // setup the sound
    setupSound();
}
Esempio n. 5
0
void ofApp::setup(){
    
    ofSetDataPathRoot("../Resources/data/");
    
    setupTcp();
    setupSound();
    setupChannels();
    setupBoards();
    
}
void VoiceReceiver::initialize() throw( NetworkSoundExpection )
{
    try
    {
        setupSound();
        setupNetwork();
    }
    catch ( const NetworkSoundExpection& e )
    {
        log_error << "Error initializing voice receiver " << std::endl;
        log_error << "   reason: " << e.what() << std::endl;
        return;
    }
}
Esempio n. 7
0
int GameApp::initLibraries()
{	
	if( setupSDL() < 0 ){		// Initialize SDL.
		std::cerr << "Failed to initialize SDL." << std::endl; 
		exit(1);
	}    
    
    setupRenderingContext();	// OpenGL.
    setupMatrices();			// OpenGL.    
    setupSound();				// FMOD sound.
    
    std::srand ((unsigned int)time(NULL));	// Seed random numbers.

	return 0;
}
Esempio n. 8
0
int main(int argc __attribute__((unused)), char *argv[])
{

    /* init allegro library */
    ALLEGRO_TIMER *timer = NULL;
    al_init();

    /* prepare random number generator */
    srand(time(NULL));

    /* activate all engine subsystems using the startup macro */
    resetCollisionTable();
    STARTUP(videoInit())
    STARTUP(init_datafile(argv))
    STARTUP(al_install_keyboard())
    STARTUP(al_install_joystick())
    STARTUP(fontInit())
    STARTUP(setupSound())
    timer = al_create_timer(1.0 / 60);
    al_start_timer(timer);
    initMediaLib();
    initBuffers();

    /* prepare game */
    startGame();

    /* begin game loop */
    while(!state.terminate) {
        runState(timer);
    }

    /* finish, return control to os */
    al_destroy_timer(timer);
    shutdownState();
    shutdownGame();
    videoKill();
    shutdownSound();
    al_uninstall_system();
    PHYSFS_deinit();

    /* no problems, exit false */
    return EXIT_SUCCESS;

}
Esempio n. 9
0
int main(int argc, char *argv[]){
    state = STATE_GAME_LEVEL;
    
    ShaderProgram program = Setup();
    setupSound();
    
    done = false;
    while (!done) {
        PlayerInput(done, program);
        fixedTSUpdate(&program);
        Render(&program);
        glUseProgram(program.programID);
    }
    for (int i = 0; i < entities.size(); i++) {
        entities[i].~Entity();
    }
    for (int i = 0; i < menuEntities.size(); i++) {
        menuEntities[i].~Entity();
    }
    Mix_FreeChunk(pewpew);
    Mix_FreeMusic(music);
    SDL_Quit();
    return 0;
}