Beispiel #1
0
    void projectM::projectM_init ( int gx, int gy, int fps, int texsize, int width, int height )
    {
        setlocale(LC_NUMERIC, "C");

        /** Initialise start time */
        timeKeeper = new TimeKeeper(_settings.presetDuration,_settings.smoothPresetDuration, _settings.easterEgg);

        /** Nullify frame stash */

        /** Initialise per-pixel matrix calculations */
        /** We need to initialise this before the builtin param db otherwise bass/mid etc won't bind correctly */
        assert ( !beatDetect );

        if (!_pcm)
            _pcm = new PCM();
        assert(pcm());
        beatDetect = new BeatDetect ( _pcm );

        if ( _settings.fps > 0 )
            mspf= ( int ) ( 1000.0/ ( float ) _settings.fps );
        else mspf = 0;

        this->renderer = new Renderer ( width, height, gx, gy, texsize,  beatDetect, settings().presetURL, settings().titleFontURL, settings().menuFontURL );

        running = true;

        initPresetTools(gx, gy);


        #ifdef USE_THREADS
        pthread_mutex_init(&mutex, NULL);

	#ifdef SYNC_PRESET_SWITCHES
        pthread_mutex_init(&preset_mutex, NULL);
	#endif

        pthread_cond_init(&condition, NULL);
        if (pthread_create(&thread, NULL, thread_callback, this) != 0)
        {

            std::cerr << "[projectM] failed to allocate a thread! try building with option USE_THREADS turned off" << std::endl;;
            exit(EXIT_FAILURE);
        }
        pthread_mutex_lock( &mutex );
        #endif

        /// @bug order of operatoins here is busted
        //renderer->setPresetName ( m_activePreset->name() );
        timeKeeper->StartPreset();
        assert(pcm());

       pipelineContext().fps = fps;
       pipelineContext2().fps = fps;

    }
Beispiel #2
0
void projectM::projectM_init ( int gx, int gy, int fps, int texsize, int width, int height )
{

	/** Initialise engine variables */

	projectM_initengine();
	presetInputs.Initialize ( gx, gy );
	presetInputs2.Initialize ( gx, gy );
	presetOutputs.Initialize ( gx, gy );
	presetOutputs2.Initialize ( gx, gy );

	/** Initialise start time */
        timeKeeper = new TimeKeeper(_settings.presetDuration,_settings.smoothPresetDuration, _settings.easterEgg);

	/** Nullify frame stash */


	/** Initialise per-pixel matrix calculations */


	presetInputs.fps = fps;
	presetInputs2.fps = fps;
	/** We need to initialise this before the builtin param db otherwise bass/mid etc won't bind correctly */
	assert ( !beatDetect );

	std::cerr << "pcm new" << std::endl;
	if (!_pcm)
		_pcm = new PCM();
	assert(pcm());
	beatDetect = new BeatDetect ( _pcm );

        this->renderer = new Renderer(width, height, gx, gy, texsize,
                                      beatDetect, settings().presetURL,
                                      settings().titleFontURL,
                                      settings().menuFontURL);

        running = true;

	initPresetTools();
	if ( presetInputs.fps > 0 )
		mspf= ( int ) ( 1000.0/ ( float ) presetInputs.fps );
	else mspf = 0;
	
	this->presetInputs.gx = gx;
	this->presetInputs.gy = gy;
	this->presetInputs2.gx = gx;
	this->presetInputs2.gy = gy;

#ifdef USE_THREADS
	pthread_mutex_init(&mutex, NULL);
	pthread_cond_init(&condition, NULL);
	if (pthread_create(&thread, NULL, thread_callback, this) != 0)
	    { 	      
	      printf("oops\n");
	      exit(1);
	    }
	pthread_mutex_lock( &mutex );
	printf("got lock\n");
#endif

	renderer->setPresetName ( m_activePreset->presetName() );
	timeKeeper->StartPreset();
	assert(pcm());
//	printf ( "exiting projectM_init()\n" );
}