Browse Source

Correct some settings code; Apply to plugin version properly

tags/1.9.5
falkTX 10 years ago
parent
commit
8de33fc1c3
4 changed files with 77 additions and 35 deletions
  1. +32
    -1
      source/backend/engine/CarlaEngineNative.cpp
  2. +34
    -33
      source/carla_settings.py
  3. +7
    -0
      source/modules/native-plugins/resources/carla-plugin
  4. +4
    -1
      source/utils/CarlaExternalUI.hpp

+ 32
- 1
source/backend/engine/CarlaEngineNative.cpp View File

@@ -81,6 +81,12 @@ public:
return fWriteLock;
}

void show() noexcept
{
const CarlaMutexLocker cml(fWriteLock);
writeMsg("show\n", 5);
}

protected:
bool msgReceived(const char* const msg) noexcept override
{
@@ -568,6 +574,7 @@ public:
fIsActive(false),
fIsRunning(false),
fUiServer(this),
fOptionsForced(false),
leakDetector_CarlaEngineNative()
{
carla_debug("CarlaEngineNative::CarlaEngineNative()");
@@ -939,51 +946,71 @@ protected:

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_PROCESS_MODE);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%i\n", options.processMode);
fUiServer.writeMsg(fTmpBuf);

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_TRANSPORT_MODE);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%i\n", options.transportMode);
fUiServer.writeMsg(fTmpBuf);

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_FORCE_STEREO);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(options.forceStereo));
fUiServer.writeMsg(fTmpBuf);

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_PREFER_PLUGIN_BRIDGES);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(options.preferPluginBridges));
fUiServer.writeMsg(fTmpBuf);

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_PREFER_UI_BRIDGES);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(options.preferUiBridges));
fUiServer.writeMsg(fTmpBuf);

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_UIS_ALWAYS_ON_TOP);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(options.uisAlwaysOnTop));
fUiServer.writeMsg(fTmpBuf);

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_MAX_PARAMETERS);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%i\n", options.maxParameters);
fUiServer.writeMsg(fTmpBuf);

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_UI_BRIDGES_TIMEOUT);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%i\n", options.uiBridgesTimeout);
fUiServer.writeMsg(fTmpBuf);

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_PATH_BINARIES);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", options.binaryDir);
fUiServer.writeMsg(fTmpBuf);

std::sprintf(fTmpBuf, "ENGINE_OPTION_%i\n", ENGINE_OPTION_PATH_RESOURCES);
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", bool2str(fOptionsForced));
fUiServer.writeMsg(fTmpBuf);
std::sprintf(fTmpBuf, "%s\n", options.resourceDir);
fUiServer.writeMsg(fTmpBuf);
}
@@ -1327,10 +1354,12 @@ protected:
carla_stdout("Trying to start carla-plugin using \"%s\"", path.buffer());

fUiServer.setData(path, pData->sampleRate, pHost->uiName);
fUiServer.start();
fUiServer.start(false);

uiServerOptions();

fUiServer.show();

for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPlugin* const plugin(pData->plugins[i].plugin);
@@ -1414,6 +1443,7 @@ protected:

void setState(const char* const data)
{
fOptionsForced = true;
const String state(data);
XmlDocument xml(state);
loadProjectInternal(xml);
@@ -1561,6 +1591,7 @@ private:
bool fIsActive, fIsRunning;
CarlaEngineNativeUI fUiServer;

bool fOptionsForced;
char fTmpBuf[STR_MAX+1];

CarlaPlugin* _getFirstPlugin() const noexcept


+ 34
- 33
source/carla_settings.py View File

@@ -454,32 +454,33 @@ class CarlaSettingsW(QDialog):
settings.setValue(CARLA_KEY_ENGINE_AUDIO_DRIVER, audioDriver)

if not self.host.processModeForced:
# engine sends callback if processMode really changes
processMode = self.ui.cb_engine_process_mode_jack.currentIndex() if audioDriver == "JACK" else self.ui.cb_engine_process_mode_other.currentIndex()+self.PROCESS_MODE_NON_JACK_PADDING

settings.setValue(CARLA_KEY_ENGINE_PROCESS_MODE, processMode)

self.host.set_engine_option(ENGINE_OPTION_PROCESS_MODE, processMode, "")

forceStereo = self.ui.ch_engine_force_stereo.isChecked()
preferPluginBridges = self.ui.ch_engine_prefer_plugin_bridges.isChecked()
preferUIBridges = self.ui.ch_engine_prefer_ui_bridges.isChecked()
uisAlwaysOnTop = self.ui.ch_engine_uis_always_on_top.isChecked()
maxParameters = self.ui.sb_engine_max_params.value()
uiBridgesTimeout = self.ui.sb_engine_ui_bridges_timeout.value()

settings.setValue(CARLA_KEY_ENGINE_FORCE_STEREO, forceStereo)
settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, preferPluginBridges)
settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, preferUIBridges)
settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, uisAlwaysOnTop)
settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, maxParameters)
settings.setValue(CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, uiBridgesTimeout)

self.host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, forceStereo, "")
self.host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, preferPluginBridges, "")
self.host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, preferUIBridges, "")
self.host.set_engine_option(ENGINE_OPTION_UIS_ALWAYS_ON_TOP, uisAlwaysOnTop, "")
self.host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, maxParameters, "")
self.host.set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, uiBridgesTimeout, "")
settings.setValue(CARLA_KEY_ENGINE_PROCESS_MODE, processMode)

self.host.forceStereo = self.ui.ch_engine_force_stereo.isChecked()
self.host.preferPluginBridges = self.ui.ch_engine_prefer_plugin_bridges.isChecked()
self.host.preferUIBridges = self.ui.ch_engine_prefer_ui_bridges.isChecked()
self.host.uisAlwaysOnTop = self.ui.ch_engine_uis_always_on_top.isChecked()
self.host.maxParameters = self.ui.sb_engine_max_params.value()
self.host.uiBridgesTimeout = self.ui.sb_engine_ui_bridges_timeout.value()

self.host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, self.host.forceStereo, "")
self.host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges, "")
self.host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, self.host.preferUIBridges, "")
self.host.set_engine_option(ENGINE_OPTION_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop, "")
self.host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, self.host.maxParameters, "")
self.host.set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, self.host.uiBridgesTimeout, "")

settings.setValue(CARLA_KEY_ENGINE_FORCE_STEREO, self.host.forceStereo)
settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges)
settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, self.host.preferUIBridges)
settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop)
settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, self.host.maxParameters)
settings.setValue(CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, self.host.uiBridgesTimeout)

# ----------------------------------------------------------------------------------------------------
# Paths
@@ -521,16 +522,6 @@ class CarlaSettingsW(QDialog):
for i in range(self.ui.lw_sfz.count()):
sfzs.append(self.ui.lw_sfz.item(i).text())

settings.setValue(CARLA_KEY_PATHS_LADSPA, ladspas)
settings.setValue(CARLA_KEY_PATHS_DSSI, dssis)
settings.setValue(CARLA_KEY_PATHS_LV2, lv2s)
settings.setValue(CARLA_KEY_PATHS_VST, vsts)
settings.setValue(CARLA_KEY_PATHS_VST3, vst3s)
settings.setValue(CARLA_KEY_PATHS_AU, aus)
settings.setValue(CARLA_KEY_PATHS_GIG, gigs)
settings.setValue(CARLA_KEY_PATHS_SF2, sf2s)
settings.setValue(CARLA_KEY_PATHS_SFZ, sfzs)

self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(ladspas))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(dssis))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(lv2s))
@@ -541,6 +532,16 @@ class CarlaSettingsW(QDialog):
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(sf2s))
self.host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(sfzs))

settings.setValue(CARLA_KEY_PATHS_LADSPA, ladspas)
settings.setValue(CARLA_KEY_PATHS_DSSI, dssis)
settings.setValue(CARLA_KEY_PATHS_LV2, lv2s)
settings.setValue(CARLA_KEY_PATHS_VST, vsts)
settings.setValue(CARLA_KEY_PATHS_VST3, vst3s)
settings.setValue(CARLA_KEY_PATHS_AU, aus)
settings.setValue(CARLA_KEY_PATHS_GIG, gigs)
settings.setValue(CARLA_KEY_PATHS_SF2, sf2s)
settings.setValue(CARLA_KEY_PATHS_SFZ, sfzs)

# --------------------------------------------------------------------------------------------------------

@pyqtSlot()
@@ -855,7 +856,7 @@ if __name__ == '__main__':
host = initHost("Settings", None, False, False, False)
loadHostSettings(host)

gui = CarlaSettingsW(None, host, True, True, True)
gui = CarlaSettingsW(None, host, True, True)
gui.show()

app.exit_exec()


+ 7
- 0
source/modules/native-plugins/resources/carla-plugin View File

@@ -99,6 +99,8 @@ class CarlaMiniW(ExternalUI, HostWindow):
self.fContainer = CarlaRackW(self, host)
self.setupContainer(False)

self.fFirstInit = True

self.setWindowTitle(self.fUiName)
self.ready()

@@ -183,8 +185,12 @@ class CarlaMiniW(ExternalUI, HostWindow):

elif msg.startswith("ENGINE_OPTION_"):
option = int(msg.replace("ENGINE_OPTION_", ""))
forced = bool(self.readlineblock() == "true")
value = self.readlineblock()

if self.fFirstInit and not forced:
continue

if option == ENGINE_OPTION_PROCESS_MODE:
self.host.processMode = int(value)
elif option == ENGINE_OPTION_TRANSPORT_MODE:
@@ -313,6 +319,7 @@ class CarlaMiniW(ExternalUI, HostWindow):
engineCallback(self.host, ENGINE_CALLBACK_ERROR, 0, 0, 0, 0.0, error)

elif msg == "show":
self.fFirstInit = False
self.d_uiShow()

elif msg == "hide":


+ 4
- 1
source/utils/CarlaExternalUI.hpp View File

@@ -58,10 +58,13 @@ public:
fUiTitle = uiTitle;
}

void start() noexcept
void start(const bool show = true) noexcept
{
CarlaPipeServer::start(fFilename, fSampleRate, fUiTitle);

if (! show)
return;

const CarlaMutexLocker cml(fWriteLock);
writeMsg("show\n", 5);
}


Loading…
Cancel
Save