コード例 #1
0
/**
 Wczytuje algorytm opisany w pliku
 @param algo Wskaznik do konfigurowanego algorytmu
*/
void XMLConfigFile::LoadAlgorithm(Algorithm* algo) {
	TRACE("XMLConfigFile::LoadModules - Wczytywanie calego algorytmu...\n" );
	LoadAlgorithmSettings(algo);
	LoadModules(algo);
	LoadParameters(algo);
	LoadConnections(algo);
	algo->Init();
	TRACE( "XMLConfigFile::LoadModules - Algorytm wczytany\n" );
}
コード例 #2
0
MOboolean
moDirectorChildConsole::Init(
                        moText p_apppath,
                        moText p_datapath,
						moText p_consoleconfig,
						moIODeviceManager* p_pIODeviceManager,
						moResourceManager *p_pResourceManager,
		               MOint p_render_to_texture_mode,
					   MOint p_screen_width, MOint p_screen_height,
					   MOint p_render_width, MOint p_render_height ) {

	moText text;
	int i,verif;
	//int a,b;

	idebug = -1;
	iligia = -1;
	iborrado = -1;

	srand( time(NULL) );

	if(m_EffectName==moText("") || m_EffectConfigName==moText("")) {
		Finish();
		return false;
	}

	if( p_pIODeviceManager == NULL ) {
		m_bIODeviceManagerDefault = true;
		m_pIODeviceManager = new moIODeviceManager();
	} else {
		m_bIODeviceManagerDefault = false;
		m_pIODeviceManager = p_pIODeviceManager;
	}

	m_EffectManager.Init();

	//INITIALIZING FIXED COMPONENTS
	state.Init();

	verif = m_Config.LoadConfig( p_consoleconfig ) ;//este parametro debe pasarse desde fuera
	if(verif != MO_CONFIG_OK) {
	    Finish();
		//then
		return false;
	} else SetConfigName(p_consoleconfig);

	InitResources(  p_pResourceManager,
					p_apppath,
					p_datapath,
					m_Config,
					p_render_to_texture_mode,
					p_screen_width, p_screen_height,
					p_render_width, p_render_height );

	//NEW CODE FOR CHILD, ONE EFFECT ONLY

	// 0: Load Ressources
	LoadResources();
	// 1: Load IODevices: same than console.cfg
	LoadIODevices();
	// 2: Load MasterEffects
	LoadMasterEffects();

	moText fxname, cfname, lblname;
	// 3: Load PreEffects Erase
	fxname = moText("erase");
	cfname = moText("_erase");
	lblname = moText("erase");
	moPreEffect* ppreeffect = (moPreEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname,  MO_OBJECT_PREEFFECT, -1, -1);
	if (ppreeffect) {
		m_MoldeoObjects.Add( (moMoldeoObject*) ppreeffect );
		ppreeffect->SetResourceManager( m_pResourceManager );
		if ( ppreeffect->GetName() == moText("erase") ) {
				iborrado = i;
				printf("erase");
				ppreeffect->Init();
				ppreeffect->state.on = MO_ON;
		}
	} else return false;

	// 4: Load Effect one: the only one...
	fxname = m_EffectName;
	cfname = m_EffectConfigName;
	lblname = m_EffectConfigName;
	moEffect* peffect = (moEffect*)m_EffectManager.NewEffect( fxname, cfname, lblname,  MO_OBJECT_EFFECT, -1, -1);
	if (peffect) {
		m_MoldeoObjects.Add( (moMoldeoObject*) peffect );
		peffect->SetResourceManager( m_pResourceManager );
	} else return false;

	state.m_nAllEffects = m_EffectManager.AllEffects().Count();

	InitializeAllEffects();

	StartMasterEffects();

	LoadConnections();

	return true;

}
コード例 #3
0
ファイル: JackProxyDriver.cpp プロジェクト: HI-CARL/jack2
    /*
        JackProxyDriver is wrapped in a JackWaitCallbackDriver decorator that behaves
        as a "dummy driver, until Initialize method returns.
    */
    bool JackProxyDriver::Initialize()
    {
        jack_log("JackProxyDriver::Initialize");

        // save existing local connections if needed
        if (fAutoSave) {
            SaveConnections(0);
        }

        // new loading, but existing client, restart the driver
        if (fClient) {
            jack_info("JackProxyDriver restarting...");
            jack_client_close(fClient);
        }
        FreePorts();

        // display some additional infos
        jack_info("JackProxyDriver started in %s mode.",
                    (fEngineControl->fSyncMode) ? "sync" : "async");

        do {
            jack_status_t status;
            char *old = NULL;

            if (fPromiscuous) {
                // as we are fiddling with the environment variable content, save it
                const char* tmp = getenv("JACK_PROMISCUOUS_SERVER");
                if (tmp) {
                    old = strdup(tmp);
                }
                // temporary enable promiscuous mode
                if (setenv("JACK_PROMISCUOUS_SERVER", fPromiscuous, 1) < 0) {
                    free(old);
                    jack_error("Error allocating memory.");
                    return false;
                }
            }

            jack_info("JackProxyDriver connecting to %s", fUpstream);
            fClient = jack_client_open(fClientName, static_cast<jack_options_t>(JackNoStartServer|JackServerName), &status, fUpstream);

            if (fPromiscuous) {
                // restore previous environment variable content
                if (old) {
                    if (setenv("JACK_PROMISCUOUS_SERVER", old, 1) < 0) {
                        free(old);
                        jack_error("Error allocating memory.");
                        return false;
                    }
                    free(old);
                } else {
                    unsetenv("JACK_PROMISCUOUS_SERVER");
                }
            }

            // the connection failed, try again later
            if (!fClient) {
                JackSleep(1000000);
            }

        } while (!fClient);
        jack_info("JackProxyDriver connected to %s", fUpstream);

        // we are connected, let's register some callbacks

        jack_on_shutdown(fClient, shutdown_callback, this);

        if (jack_set_process_callback(fClient, process_callback, this) != 0) {
            jack_error("Cannot set process callback.");
            return false;
        }

        if (jack_set_buffer_size_callback(fClient, bufsize_callback, this) != 0) {
            jack_error("Cannot set buffer size callback.");
            return false;
        }

        if (jack_set_sample_rate_callback(fClient, srate_callback, this) != 0) {
            jack_error("Cannot set sample rate callback.");
            return false;
        }

        if (jack_set_port_connect_callback(fClient, connect_callback, this) != 0) {
            jack_error("Cannot set port connect callback.");
            return false;
        }

        // detect upstream physical playback ports if needed
        if (fDetectPlaybackChannels) {
            fPlaybackChannels = CountIO(JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical | JackPortIsOutput);
        }

        // detect upstream physical capture ports if needed
        if (fDetectCaptureChannels) {
            fCaptureChannels = CountIO(JACK_DEFAULT_AUDIO_TYPE, JackPortIsPhysical | JackPortIsInput);
        }

        if (AllocPorts() != 0) {
            jack_error("Can't allocate ports.");
            return false;
        }

        bufsize_callback(jack_get_buffer_size(fClient));
        srate_callback(jack_get_sample_rate(fClient));

        // restore local connections if needed
        if (fAutoSave) {
            LoadConnections(0);
        }

        // everything is ready, start upstream processing
        if (jack_activate(fClient) != 0) {
            jack_error("Cannot activate jack client.");
            return false;
        }

        // connect upstream ports if needed
        if (fAutoConnect) {
            ConnectPorts();
        }

        return true;
    }