Browse Source

More of the same

tags/1.9.4
falkTX 11 years ago
parent
commit
dbd31e26f5
2 changed files with 55 additions and 33 deletions
  1. +15
    -9
      source/backend/CarlaHost.h
  2. +40
    -24
      source/backend/standalone/CarlaStandalone.cpp

+ 15
- 9
source/backend/CarlaHost.h View File

@@ -515,34 +515,40 @@ CARLA_EXPORT const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigne

#ifdef __cplusplus
/*!
* TODO.
* Get the currently used Host engine.
* @note C++ only
*/
CARLA_EXPORT CarlaEngine* carla_get_standalone_engine();
CARLA_EXPORT CarlaEngine* carla_get_host_engine();
#endif

/*!
* Initialize the engine with driver \a driverName, using \a clientName for its internal name.\n
* Initialize the engine.\n
* Make sure to call carla_engine_idle() at regular intervals afterwards.
* @param driverName Driver to use
* @param clientName Engine master client name
*/
CARLA_EXPORT bool carla_engine_init(const char* driverName, const char* clientName);

#ifdef BUILD_BRIDGE
#ifndef BUILD_BRIDGE
/*!
* Initialize the engine in bridged mode.
* @param audioBaseName Shared memory key for audio pool
* @param controlBaseName Shared memory key for control messages
* @param clientName Engine master client name
*/
CARLA_EXPORT bool carla_engine_init_bridge(const char* audioBaseName, const char* controlBaseName, const char* clientName);
CARLA_EXPORT bool carla_engine_init_bridge(const char audioBaseName[6], const char controlBaseName[6], const char* clientName);
#endif

/*!
* Close the running engine.\n
* Close the engine.\n
* This function always closes the engine even if it returns false.\n
* When false is returned, something went wrong when closing the engine, but it was still closed nonetheless.
* In other words, something went wrong when closing the engine but it was still closed nonetheless.
*/
CARLA_EXPORT bool carla_engine_close();

/*!
* Idle the running engine.\n
* \note This should never be called if the engine is not running.
* Idle the engine.\n
* Do not call this if the engine is not running.
*/
CARLA_EXPORT void carla_engine_idle();



+ 40
- 24
source/backend/standalone/CarlaStandalone.cpp View File

@@ -97,7 +97,16 @@ struct CarlaBackendStandalone {
engineCallback(nullptr),
engineCallbackPtr(nullptr),
fileCallback(nullptr),
fileCallbackPtr(nullptr) {}
fileCallbackPtr(nullptr)
{
#ifdef BUILD_BRIDGE
engineOptions.processMode = CB::ENGINE_PROCESS_MODE_BRIDGE;
engineOptions.transportMode = CB::ENGINE_TRANSPORT_MODE_BRIDGE;
engineOptions.forceStereo = CB::ENGINE_OPTION_FORCE_STEREO = false;
engineOptions.preferPluginBridges = CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = false;
engineOptions.preferUiBridges = CB::ENGINE_OPTION_PREFER_UI_BRIDGES = false;
#endif
}

~CarlaBackendStandalone()
{
@@ -299,6 +308,7 @@ const char* const* carla_get_engine_driver_device_names(unsigned int index)

const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(unsigned int index, const char* name)
{
CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', nullptr);
carla_debug("carla_get_engine_driver_device_info(%i, \"%s\")", index, name);

return CarlaEngine::getDriverDeviceInfo(index, name);
@@ -360,7 +370,13 @@ const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int index)
#endif
}

#if 0
// -------------------------------------------------------------------------------------------------------------------

CarlaEngine* carla_get_host_engine()
{
return gStandalone.engine;
}

// -------------------------------------------------------------------------------------------------------------------

bool carla_engine_init(const char* driverName, const char* clientName)
@@ -417,7 +433,7 @@ bool carla_engine_init(const char* driverName, const char* clientName)

if (gStandalone.engine->init(clientName))
{
gStandalone.lastError = "no error";
gStandalone.lastError = "No error";
#ifdef USE_JUCE
gStandalone.init();
#endif
@@ -433,12 +449,12 @@ bool carla_engine_init(const char* driverName, const char* clientName)
}

#ifdef BUILD_BRIDGE
bool carla_engine_init_bridge(const char* audioBaseName, const char* controlBaseName, const char* clientName)
bool carla_engine_init_bridge(const char audioBaseName[6], const char controlBaseName[6], const char* clientName)
{
CARLA_SAFE_ASSERT_RETURN(audioBaseName != nullptr && audioBaseName[0] != '\0', false);
CARLA_SAFE_ASSERT_RETURN(controlBaseName != nullptr && controlBaseName[0] != '\0', false);
CARLA_SAFE_ASSERT_RETURN(clientName != nullptr && clientName[0] != '\0', false);
carla_debug("carla_engine_init_bridge(\"%s\", %s, %s)", audioBaseName, controlBaseName, clientName);
carla_debug("carla_engine_init_bridge(\"%s\", \"%s\", \"%s\")", audioBaseName, controlBaseName, clientName);

if (gStandalone.engine != nullptr)
{
@@ -456,22 +472,28 @@ bool carla_engine_init_bridge(const char* audioBaseName, const char* controlBase
return false;
}

if (gStandalone.callback != nullptr)
gStandalone.engine->setCallback(gStandalone.callback, gStandalone.callbackPtr);
gStandalone.engine->setCallback(gStandalone.engineCallback, gStandalone.engineCallbackPtr);

gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::PROCESS_MODE_BRIDGE, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::TRANSPORT_MODE_BRIDGE, nullptr);
// forced options for bridge mode
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_BRIDGE, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_BRIDGE, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, false, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, false, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, false, nullptr);
//gStandalone.engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, gStandalone.engineOptions.uisAlwaysOnTop ? 1 : 0, nullptr);
//gStandalone.engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, static_cast<int>(gStandalone.engineOptions.maxParameters), nullptr);
//gStandalone.engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, static_cast<int>(gStandalone.engineOptions.uiBridgesTimeout), nullptr);

// TODO: get these from environment
gStandalone.engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, gStandalone.engineOptions.uisAlwaysOnTop ? 1 : 0, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, static_cast<int>(gStandalone.engineOptions.maxParameters), nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, static_cast<int>(gStandalone.engineOptions.uiBridgesTimeout), nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, (const char*)gStandalone.engineOptions.binaryDir);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, (const char*)gStandalone.engineOptions.resourceDir);

if (gStandalone.engine->init(clientName))
{
gStandalone.lastError = "no error";
gStandalone.lastError = "No error";
#ifdef USE_JUCE
gStandalone.init();
#endif
return true;
}
else
@@ -525,7 +547,6 @@ bool carla_is_engine_running()
return (gStandalone.engine != nullptr && gStandalone.engine->isRunning());
}

#if 0
void carla_set_engine_about_to_close()
{
CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr,);
@@ -534,12 +555,12 @@ void carla_set_engine_about_to_close()
gStandalone.engine->setAboutToClose();
}

void carla_set_engine_callback(CarlaEngineCallbackFunc func, void* ptr)
void carla_set_engine_callback(EngineCallbackFunc func, void* ptr)
{
carla_debug("carla_set_engine_callback(%p, %p)", func, ptr);

gStandalone.callback = func;
gStandalone.callbackPtr = ptr;
gStandalone.engineCallback = func;
gStandalone.engineCallbackPtr = ptr;

if (gStandalone.engine != nullptr)
gStandalone.engine->setCallback(func, ptr);
@@ -549,6 +570,8 @@ void carla_set_engine_callback(CarlaEngineCallbackFunc func, void* ptr)
//#endif
}

#if 0
#if 0
void carla_set_engine_option(CarlaEngineOption option, int value, const char* valueStr)
{
carla_debug("carla_set_engine_option(%i:%s, %i, \"%s\")", option, CB::EngineOption2Str(option), value, valueStr);
@@ -2227,10 +2250,3 @@ void carla_nsm_reply_save()
//#endif

// -------------------------------------------------------------------------------------------------------------------

#ifdef BUILD_BRIDGE
CarlaEngine* carla_get_standalone_engine()
{
return gStandalone.engine;
}
#endif

Loading…
Cancel
Save