Browse Source

Adjust the (incomplete) C++ port to latest API changes

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
9e82f55aca
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
9 changed files with 154 additions and 116 deletions
  1. +3
    -3
      resources/resources.qrc
  2. +12
    -4
      source/frontend/Makefile
  3. +19
    -7
      source/frontend/carla_app.cpp
  4. +99
    -88
      source/frontend/carla_host.cpp
  5. +4
    -1
      source/frontend/carla_host.hpp
  6. +10
    -7
      source/frontend/carla_settings.cpp
  7. +2
    -1
      source/frontend/carla_settings.hpp
  8. +2
    -2
      source/frontend/carla_settings_app.cpp
  9. +3
    -3
      source/frontend/carla_widgets.cpp

+ 3
- 3
resources/resources.qrc View File

@@ -87,11 +87,11 @@
<file>bitmaps/button_file_down-white.png</file> <file>bitmaps/button_file_down-white.png</file>
<file>bitmaps/button_file_hover-black.png</file> <file>bitmaps/button_file_hover-black.png</file>
<file>bitmaps/button_file_hover-white.png</file> <file>bitmaps/button_file_hover-white.png</file>
<file>scalable/button_gui-black.svg</file>
<!--<file>scalable/button_gui-black.svg</file>-->
<file>scalable/button_gui-white.svg</file> <file>scalable/button_gui-white.svg</file>
<file>scalable/button_gui_down-black.svg</file>
<!--<file>scalable/button_gui_down-black.svg</file>-->
<file>scalable/button_gui_down-white.svg</file> <file>scalable/button_gui_down-white.svg</file>
<file>scalable/button_gui_hover-black.svg</file>
<!--<file>scalable/button_gui_hover-black.svg</file>-->
<file>scalable/button_gui_hover-white.svg</file> <file>scalable/button_gui_hover-white.svg</file>


<file>scalable/button_off.svg</file> <file>scalable/button_off.svg</file>


+ 12
- 4
source/frontend/Makefile View File

@@ -156,17 +156,21 @@ endif


ifeq ($(USING_JUCE),true) ifeq ($(USING_JUCE),true)
LIBS += $(MODULEDIR)/juce_audio_basics.a LIBS += $(MODULEDIR)/juce_audio_basics.a
ifeq ($(USING_JUCE_AUDIO_DEVICES),true)
LIBS += $(MODULEDIR)/juce_audio_devices.a LIBS += $(MODULEDIR)/juce_audio_devices.a
endif
LIBS += $(MODULEDIR)/juce_audio_processors.a LIBS += $(MODULEDIR)/juce_audio_processors.a
LIBS += $(MODULEDIR)/juce_core.a LIBS += $(MODULEDIR)/juce_core.a
LIBS += $(MODULEDIR)/juce_data_structures.a LIBS += $(MODULEDIR)/juce_data_structures.a
LIBS += $(MODULEDIR)/juce_events.a LIBS += $(MODULEDIR)/juce_events.a
LIBS += $(MODULEDIR)/juce_graphics.a LIBS += $(MODULEDIR)/juce_graphics.a
LIBS += $(MODULEDIR)/juce_gui_basics.a LIBS += $(MODULEDIR)/juce_gui_basics.a
ifeq ($(MACOS),true)
ifeq ($(USING_JUCE_GUI_EXTRA),true)
LIBS += $(MODULEDIR)/juce_gui_extra.a LIBS += $(MODULEDIR)/juce_gui_extra.a
endif endif
else
endif

ifneq ($(USING_JUCE_AUDIO_DEVICES),true)
LIBS += $(MODULEDIR)/rtaudio.a LIBS += $(MODULEDIR)/rtaudio.a
LIBS += $(MODULEDIR)/rtmidi.a LIBS += $(MODULEDIR)/rtmidi.a
endif endif
@@ -188,17 +192,21 @@ LINK_FLAGS += $(X11_LIBS)


ifeq ($(USING_JUCE),true) ifeq ($(USING_JUCE),true)
LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS)
ifeq ($(USING_JUCE_AUDIO_DEVICES),true)
LINK_FLAGS += $(JUCE_AUDIO_DEVICES_LIBS) LINK_FLAGS += $(JUCE_AUDIO_DEVICES_LIBS)
endif
LINK_FLAGS += $(JUCE_AUDIO_PROCESSORS_LIBS) LINK_FLAGS += $(JUCE_AUDIO_PROCESSORS_LIBS)
LINK_FLAGS += $(JUCE_CORE_LIBS) LINK_FLAGS += $(JUCE_CORE_LIBS)
LINK_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS) LINK_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS)
LINK_FLAGS += $(JUCE_EVENTS_LIBS) LINK_FLAGS += $(JUCE_EVENTS_LIBS)
LINK_FLAGS += $(JUCE_GRAPHICS_LIBS) LINK_FLAGS += $(JUCE_GRAPHICS_LIBS)
LINK_FLAGS += $(JUCE_GUI_BASICS_LIBS) LINK_FLAGS += $(JUCE_GUI_BASICS_LIBS)
ifeq ($(MACOS),true)
ifeq ($(USING_JUCE_GUI_EXTRA),true)
LINK_FLAGS += $(JUCE_GUI_EXTRA_LIBS) LINK_FLAGS += $(JUCE_GUI_EXTRA_LIBS)
endif endif
else
endif

ifneq ($(USING_JUCE_AUDIO_DEVICES),true)
LINK_FLAGS += $(RTAUDIO_LIBS) LINK_FLAGS += $(RTAUDIO_LIBS)
LINK_FLAGS += $(RTMIDI_LIBS) LINK_FLAGS += $(RTMIDI_LIBS)
endif endif


+ 19
- 7
source/frontend/carla_app.cpp View File

@@ -248,18 +248,30 @@ QApplication* CarlaApplication::createApp(const QString& appName, int& argc, cha
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif #endif


/*
// TODO
args = sys.argv[:]
#ifdef CARLA_OS_WIN
static int r_argc = argc + 2;
static char** const r_argv = static_cast<char**>(calloc(sizeof(char*), r_argc));
static char argvExtra1[] = "-platform\0";
static char argvExtra2[] = "windows:fontengine=freetype\0";
for (int i=0; i<argc; ++i)
r_argv[i] = argv[i];
r_argv[argc] = argvExtra1;
r_argv[argc] = argvExtra2;
#else
# define r_argc argc
# define r_argv argv
#endif


if WINDOWS:
args += ["-platform", "windows:fontengine=freetype"]
*/
fApp = gCarla.nogui ? new QCoreApplication(argc, argv) : new QApplication(argc, argv);
fApp = gCarla.nogui ? new QCoreApplication(r_argc, r_argv) : new QApplication(r_argc, r_argv);
fApp->setApplicationName(appName); fApp->setApplicationName(appName);
fApp->setApplicationVersion(CARLA_VERSION_STRING); fApp->setApplicationVersion(CARLA_VERSION_STRING);
fApp->setOrganizationName("falkTX"); fApp->setOrganizationName("falkTX");


#ifndef CARLA_OS_WIN
# undef r_argc
# undef r_argv
#endif

if (gCarla.nogui) if (gCarla.nogui)
return nullptr; return nullptr;




+ 99
- 88
source/frontend/carla_host.cpp View File

@@ -471,9 +471,9 @@ struct CarlaHostWindow::PrivateData {


updateStyle(); updateStyle();


ui.rack->setStyleSheet(" \
ui.rack->setStyleSheet(" \
CarlaRackList#CarlaRackList { \ CarlaRackList#CarlaRackList { \
background-color: black; \
background-color: black; \
} \ } \
"); ");


@@ -693,7 +693,7 @@ struct CarlaHostWindow::PrivateData {
projectLoadingStarted(); projectLoadingStarted();
fIsProjectLoading = true; fIsProjectLoading = true;


if (! carla_load_project(fProjectFilename.toUtf8()))
if (! carla_load_project(host.handle, fProjectFilename.toUtf8()))
{ {
fIsProjectLoading = false; fIsProjectLoading = false;
projectLoadingFinished(); projectLoadingFinished();
@@ -702,7 +702,7 @@ struct CarlaHostWindow::PrivateData {
QMessageBox::Critical, QMessageBox::Critical,
tr("Error"), tr("Error"),
tr("Failed to load project"), tr("Failed to load project"),
carla_get_last_error(),
carla_get_last_error(host.handle),
QMessageBox::Ok, QMessageBox::Ok); QMessageBox::Ok, QMessageBox::Ok);
} }
} }
@@ -770,7 +770,7 @@ struct CarlaHostWindow::PrivateData {
{ {
killTimers(); killTimers();


if (carla_is_engine_running())
if (carla_is_engine_running(host.handle))
{ {
if (fCustomStopAction == CUSTOM_ACTION_PROJECT_LOAD) if (fCustomStopAction == CUSTOM_ACTION_PROJECT_LOAD)
{ {
@@ -782,16 +782,16 @@ struct CarlaHostWindow::PrivateData {
projectLoadingStarted(); projectLoadingStarted();
} }


if (! carla_remove_all_plugins())
if (! carla_remove_all_plugins(host.handle))
{ {
ui.text_logs->appendPlainText("Failed to remove all plugins, error was:"); ui.text_logs->appendPlainText("Failed to remove all plugins, error was:");
ui.text_logs->appendPlainText(carla_get_last_error());
ui.text_logs->appendPlainText(carla_get_last_error(host.handle));
} }


if (! carla_engine_close())
if (! carla_engine_close(host.handle))
{ {
ui.text_logs->appendPlainText("Failed to stop engine, error was:"); ui.text_logs->appendPlainText("Failed to stop engine, error was:");
ui.text_logs->appendPlainText(carla_get_last_error());
ui.text_logs->appendPlainText(carla_get_last_error(host.handle));
} }
} }


@@ -803,7 +803,7 @@ struct CarlaHostWindow::PrivateData {
{ {
hostWindow->slot_engineStart(); hostWindow->slot_engineStart();
loadProjectNow(); loadProjectNow();
carla_nsm_ready(NSM_CALLBACK_OPEN);
carla_nsm_ready(host.handle, NSM_CALLBACK_OPEN);
} }


fCustomStopAction = CUSTOM_ACTION_NONE; fCustomStopAction = CUSTOM_ACTION_NONE;
@@ -1014,10 +1014,10 @@ struct CarlaHostWindow::PrivateData {
{ {
if (! ui.l_transport_time->isVisible()) if (! ui.l_transport_time->isVisible())
return; return;
if (carla_isZero(fSampleRate) or ! carla_is_engine_running())
if (carla_isZero(fSampleRate) or ! carla_is_engine_running(host.handle))
return; return;


const CarlaTransportInfo* const timeInfo = carla_get_transport_info();
const CarlaTransportInfo* const timeInfo = carla_get_transport_info(host.handle);
const bool playing = timeInfo->playing; const bool playing = timeInfo->playing;
const uint64_t frame = timeInfo->frame; const uint64_t frame = timeInfo->frame;
const double bpm = timeInfo->bpm; const double bpm = timeInfo->bpm;
@@ -1193,15 +1193,15 @@ struct CarlaHostWindow::PrivateData {
{ {
if (! ui.pb_dsp_load->isVisible()) if (! ui.pb_dsp_load->isVisible())
return; return;
if (! carla_is_engine_running())
if (! carla_is_engine_running(host.handle))
return; return;
const CarlaRuntimeEngineInfo* const info = carla_get_runtime_engine_info();
const CarlaRuntimeEngineInfo* const info = carla_get_runtime_engine_info(host.handle);
refreshRuntimeInfo(info->load, info->xruns); refreshRuntimeInfo(info->load, info->xruns);
} }


void idleFast() void idleFast()
{ {
carla_engine_idle();
carla_engine_idle(host.handle);
refreshTransport(); refreshTransport();


if (fPluginCount == 0 || fCurrentlyRemovingAllPlugins) if (fPluginCount == 0 || fCurrentlyRemovingAllPlugins)
@@ -1514,7 +1514,7 @@ CarlaHostWindow::CarlaHostWindow(CarlaHost& host, const bool withCanvas, QWidget
// For NSM we wait for the open message // For NSM we wait for the open message
if (NSM_URL != nullptr && host.nsmOK) if (NSM_URL != nullptr && host.nsmOK)
{ {
carla_nsm_ready(NSM_CALLBACK_INIT);
carla_nsm_ready(host.handle, NSM_CALLBACK_INIT);
return; return;
} }


@@ -1634,7 +1634,7 @@ void CarlaHostWindow::closeEvent(QCloseEvent* const event)
event->ignore(); event->ignore();


for i in reversed(range(self->fPluginCount)): for i in reversed(range(self->fPluginCount)):
carla_show_custom_ui(i, false);
carla_show_custom_ui(self->host.handle, i, false);


QTimer::singleShot(100, SIGNAL(close())); QTimer::singleShot(100, SIGNAL(close()));
return; return;
@@ -1644,7 +1644,7 @@ void CarlaHostWindow::closeEvent(QCloseEvent* const event)
self->killTimers(); self->killTimers();
self->saveSettings(); self->saveSettings();


if (carla_is_engine_running() && ! (self->host.isControl or self->host.isPlugin))
if (carla_is_engine_running(self->host.handle) && ! (self->host.isControl or self->host.isPlugin))
{ {
if (! slot_engineStop(true)) if (! slot_engineStop(true))
{ {
@@ -1691,14 +1691,14 @@ void CarlaHostWindow::slot_engineStart()
self->fFirstEngineInit = false; self->fFirstEngineInit = false;
self->ui.text_logs->appendPlainText("======= Starting engine ======="); self->ui.text_logs->appendPlainText("======= Starting engine =======");


if (carla_engine_init(audioDriver.toUtf8(), self->fClientName.toUtf8()))
if (carla_engine_init(self->host.handle, audioDriver.toUtf8(), self->fClientName.toUtf8()))
{ {
if (firstInit && ! (self->host.isControl or self->host.isPlugin)) if (firstInit && ! (self->host.isControl or self->host.isPlugin))
{ {
QSafeSettings settings; QSafeSettings settings;
const double lastBpm = settings.valueDouble("LastBPM", 120.0); const double lastBpm = settings.valueDouble("LastBPM", 120.0);
if (lastBpm >= 20.0) if (lastBpm >= 20.0)
carla_transport_bpm(lastBpm);
carla_transport_bpm(self->host.handle, lastBpm);
} }
return; return;
} }
@@ -1708,7 +1708,7 @@ void CarlaHostWindow::slot_engineStart()
return; return;
} }


const QCarlaString audioError(carla_get_last_error());
const QCarlaString audioError(carla_get_last_error(self->host.handle));


if (audioError.isNotEmpty()) if (audioError.isNotEmpty())
{ {
@@ -1751,7 +1751,7 @@ bool CarlaHostWindow::slot_engineStop(const bool forced)


void CarlaHostWindow::slot_engineConfig() void CarlaHostWindow::slot_engineConfig()
{ {
RuntimeDriverSettingsW dialog(self->fParentOrSelf);
RuntimeDriverSettingsW dialog(self->host.handle, self->fParentOrSelf);


if (dialog.exec()) if (dialog.exec())
return; return;
@@ -1761,21 +1761,21 @@ void CarlaHostWindow::slot_engineConfig()
double sampleRate; double sampleRate;
dialog.getValues(audioDevice, bufferSize, sampleRate); dialog.getValues(audioDevice, bufferSize, sampleRate);


if (carla_is_engine_running())
if (carla_is_engine_running(self->host.handle))
{ {
carla_set_engine_buffer_size_and_sample_rate(bufferSize, sampleRate);
carla_set_engine_buffer_size_and_sample_rate(self->host.handle, bufferSize, sampleRate);
} }
else else
{ {
carla_set_engine_option(ENGINE_OPTION_AUDIO_DEVICE, 0, audioDevice.toUtf8());
carla_set_engine_option(ENGINE_OPTION_AUDIO_BUFFER_SIZE, static_cast<int>(bufferSize), "");
carla_set_engine_option(ENGINE_OPTION_AUDIO_SAMPLE_RATE, static_cast<int>(sampleRate), "");
carla_set_engine_option(self->host.handle, ENGINE_OPTION_AUDIO_DEVICE, 0, audioDevice.toUtf8());
carla_set_engine_option(self->host.handle, ENGINE_OPTION_AUDIO_BUFFER_SIZE, static_cast<int>(bufferSize), "");
carla_set_engine_option(self->host.handle, ENGINE_OPTION_AUDIO_SAMPLE_RATE, static_cast<int>(sampleRate), "");
} }
} }


bool CarlaHostWindow::slot_engineStopTryAgain() bool CarlaHostWindow::slot_engineStopTryAgain()
{ {
if (carla_is_engine_running() && ! carla_set_engine_about_to_close())
if (carla_is_engine_running(self->host.handle) && ! carla_set_engine_about_to_close(self->host.handle))
{ {
QTimer::singleShot(0, this, SLOT(slot_engineStopTryAgain())); QTimer::singleShot(0, this, SLOT(slot_engineStopTryAgain()));
return false; return false;
@@ -2145,8 +2145,8 @@ void CarlaHostWindow::slot_configureCarla()


if (self->host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && self->host.isPlugin) if (self->host.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK && self->host.isPlugin)
pass(); pass();
else if (carla_is_engine_running())
carla_patchbay_refresh(self->fExternalPatchbay);
else if (carla_is_engine_running(self->host.handle))
carla_patchbay_refresh(self->host.handle, self->fExternalPatchbay);
} }


//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@@ -2191,72 +2191,72 @@ void CarlaHostWindow::slot_fileTreeDoubleClicked(QModelIndex* modelIndex)


void CarlaHostWindow::slot_transportPlayPause(const bool toggled) void CarlaHostWindow::slot_transportPlayPause(const bool toggled)
{ {
if (self->host.isPlugin || ! carla_is_engine_running())
if (self->host.isPlugin || ! carla_is_engine_running(self->host.handle))
return; return;


if (toggled) if (toggled)
carla_transport_play();
carla_transport_play(self->host.handle);
else else
carla_transport_pause();
carla_transport_pause(self->host.handle);


self->refreshTransport(); self->refreshTransport();
} }


void CarlaHostWindow::slot_transportStop() void CarlaHostWindow::slot_transportStop()
{ {
if (self->host.isPlugin || ! carla_is_engine_running())
if (self->host.isPlugin || ! carla_is_engine_running(self->host.handle))
return; return;


carla_transport_pause();
carla_transport_relocate(0);
carla_transport_pause(self->host.handle);
carla_transport_relocate(self->host.handle, 0);


self->refreshTransport(); self->refreshTransport();
} }


void CarlaHostWindow::slot_transportBackwards() void CarlaHostWindow::slot_transportBackwards()
{ {
if (self->host.isPlugin || ! carla_is_engine_running())
if (self->host.isPlugin || ! carla_is_engine_running(self->host.handle))
return; return;


uint64_t newFrame = carla_get_current_transport_frame();
uint64_t newFrame = carla_get_current_transport_frame(self->host.handle);


if (newFrame > 100000) if (newFrame > 100000)
newFrame -= 100000; newFrame -= 100000;
else else
newFrame = 0; newFrame = 0;


carla_transport_relocate(newFrame);
carla_transport_relocate(self->host.handle, newFrame);
} }


void CarlaHostWindow::slot_transportBpmChanged(const qreal newValue) void CarlaHostWindow::slot_transportBpmChanged(const qreal newValue)
{ {
carla_transport_bpm(newValue);
carla_transport_bpm(self->host.handle, newValue);
} }


void CarlaHostWindow::slot_transportForwards() void CarlaHostWindow::slot_transportForwards()
{ {
if (carla_isZero(self->fSampleRate) || self->host.isPlugin || ! carla_is_engine_running())
if (carla_isZero(self->fSampleRate) || self->host.isPlugin || ! carla_is_engine_running(self->host.handle))
return; return;


const uint64_t newFrame = carla_get_current_transport_frame() + uint64_t(self->fSampleRate*2.5);
carla_transport_relocate(newFrame);
const uint64_t newFrame = carla_get_current_transport_frame(self->host.handle) + uint64_t(self->fSampleRate*2.5);
carla_transport_relocate(self->host.handle, newFrame);
} }


void CarlaHostWindow::slot_transportJackEnabled(const bool clicked) void CarlaHostWindow::slot_transportJackEnabled(const bool clicked)
{ {
if (! carla_is_engine_running())
if (! carla_is_engine_running(self->host.handle))
return; return;
self->host.transportMode = clicked ? ENGINE_TRANSPORT_MODE_JACK : ENGINE_TRANSPORT_MODE_INTERNAL; self->host.transportMode = clicked ? ENGINE_TRANSPORT_MODE_JACK : ENGINE_TRANSPORT_MODE_INTERNAL;
carla_set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, self->host.transportMode, self->host.transportExtra.toUtf8());
carla_set_engine_option(self->host.handle, ENGINE_OPTION_TRANSPORT_MODE, self->host.transportMode, self->host.transportExtra.toUtf8());
} }


void CarlaHostWindow::slot_transportLinkEnabled(const bool clicked) void CarlaHostWindow::slot_transportLinkEnabled(const bool clicked)
{ {
if (! carla_is_engine_running())
if (! carla_is_engine_running(self->host.handle))
return; return;
const char* const extra = clicked ? ":link:" : ""; const char* const extra = clicked ? ":link:" : "";
self->host.transportExtra = extra; self->host.transportExtra = extra;
carla_set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, self->host.transportMode, self->host.transportExtra.toUtf8());
carla_set_engine_option(self->host.handle, ENGINE_OPTION_TRANSPORT_MODE, self->host.transportMode, self->host.transportExtra.toUtf8());
} }


//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@@ -2264,7 +2264,7 @@ void CarlaHostWindow::slot_transportLinkEnabled(const bool clicked)


void CarlaHostWindow::slot_xrunClear() void CarlaHostWindow::slot_xrunClear()
{ {
carla_clear_engine_xruns();
carla_clear_engine_xruns(self->host.handle);
} }


//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@@ -2513,22 +2513,30 @@ CarlaHost& initHost(const QString initName, const bool isControl, const bool isP
host.isControl = isControl; host.isControl = isControl;
host.isPlugin = isPlugin; host.isPlugin = isPlugin;


carla_set_engine_callback(_engineCallback, &host);
carla_set_file_callback(_fileCallback, nullptr);
// TODO
if (isPlugin)
pass();
else if (isControl)
pass();
else
host.handle = carla_standalone_host_init();

carla_set_engine_callback(host.handle, _engineCallback, &host);
carla_set_file_callback(host.handle, _fileCallback, nullptr);


// If it's a plugin the paths are already set // If it's a plugin the paths are already set
if (! isPlugin) if (! isPlugin)
{ {
host.pathBinaries = pathBinaries; host.pathBinaries = pathBinaries;
host.pathResources = pathResources; host.pathResources = pathResources;
carla_set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, pathBinaries.toUtf8());
carla_set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, pathResources.toUtf8());
carla_set_engine_option(host.handle, ENGINE_OPTION_PATH_BINARIES, 0, pathBinaries.toUtf8());
carla_set_engine_option(host.handle, ENGINE_OPTION_PATH_RESOURCES, 0, pathResources.toUtf8());


if (! isControl) if (! isControl)
{ {
const pid_t pid = getpid(); const pid_t pid = getpid();
if (pid > 0) if (pid > 0)
host.nsmOK = carla_nsm_init(static_cast<uint64_t>(pid), initName.toUtf8());
host.nsmOK = carla_nsm_init(host.handle, static_cast<uint64_t>(pid), initName.toUtf8());
} }
} }


@@ -2609,20 +2617,20 @@ void loadHostSettings(CarlaHost& host)


void setHostSettings(const CarlaHost& host) void setHostSettings(const CarlaHost& host)
{ {
carla_set_engine_option(ENGINE_OPTION_FORCE_STEREO, host.forceStereo, "");
carla_set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, static_cast<int>(host.maxParameters), "");
carla_set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, host.preferPluginBridges, "");
carla_set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, host.preferUIBridges, "");
carla_set_engine_option(ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, host.preventBadBehaviour, "");
carla_set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, host.uiBridgesTimeout, "");
carla_set_engine_option(ENGINE_OPTION_UIS_ALWAYS_ON_TOP, host.uisAlwaysOnTop, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_FORCE_STEREO, host.forceStereo, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_MAX_PARAMETERS, static_cast<int>(host.maxParameters), "");
carla_set_engine_option(host.handle, ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, host.preferPluginBridges, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_PREFER_UI_BRIDGES, host.preferUIBridges, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, host.preventBadBehaviour, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_UI_BRIDGES_TIMEOUT, host.uiBridgesTimeout, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_UIS_ALWAYS_ON_TOP, host.uisAlwaysOnTop, "");


if (host.isPlugin || host.isRemote || carla_is_engine_running())
if (host.isPlugin || host.isRemote || carla_is_engine_running(host.handle))
return; return;


carla_set_engine_option(ENGINE_OPTION_PROCESS_MODE, host.nextProcessMode, "");
carla_set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, host.transportMode, host.transportExtra.toUtf8());
carla_set_engine_option(ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT, host.showLogs, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_PROCESS_MODE, host.nextProcessMode, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_TRANSPORT_MODE, host.transportMode, host.transportExtra.toUtf8());
carla_set_engine_option(host.handle, ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT, host.showLogs, "");
} }


//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@@ -2707,9 +2715,9 @@ QString setEngineSettings(CarlaHost& host)
else else
portNumUDP = settings.valueIntPositive(CARLA_KEY_OSC_UDP_PORT_NUMBER, CARLA_DEFAULT_OSC_UDP_PORT_NUMBER); portNumUDP = settings.valueIntPositive(CARLA_KEY_OSC_UDP_PORT_NUMBER, CARLA_DEFAULT_OSC_UDP_PORT_NUMBER);


carla_set_engine_option(ENGINE_OPTION_OSC_ENABLED, oscEnabled ? 1 : 0, "");
carla_set_engine_option(ENGINE_OPTION_OSC_PORT_TCP, portNumTCP, "");
carla_set_engine_option(ENGINE_OPTION_OSC_PORT_UDP, portNumUDP, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_OSC_ENABLED, oscEnabled ? 1 : 0, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_OSC_PORT_TCP, portNumTCP, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_OSC_PORT_UDP, portNumUDP, "");


//----------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------
// wine settings // wine settings
@@ -2721,15 +2729,15 @@ QString setEngineSettings(CarlaHost& host)
const int optWineBaseRtPrio = settings.valueIntPositive(CARLA_KEY_WINE_BASE_RT_PRIO, CARLA_DEFAULT_WINE_BASE_RT_PRIO); const int optWineBaseRtPrio = settings.valueIntPositive(CARLA_KEY_WINE_BASE_RT_PRIO, CARLA_DEFAULT_WINE_BASE_RT_PRIO);
const int optWineServerRtPrio = settings.valueIntPositive(CARLA_KEY_WINE_SERVER_RT_PRIO, CARLA_DEFAULT_WINE_SERVER_RT_PRIO); const int optWineServerRtPrio = settings.valueIntPositive(CARLA_KEY_WINE_SERVER_RT_PRIO, CARLA_DEFAULT_WINE_SERVER_RT_PRIO);


carla_set_engine_option(ENGINE_OPTION_WINE_EXECUTABLE, 0, optWineExecutable.toUtf8());
carla_set_engine_option(ENGINE_OPTION_WINE_AUTO_PREFIX, optWineAutoPrefix ? 1 : 0, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_WINE_EXECUTABLE, 0, optWineExecutable.toUtf8());
carla_set_engine_option(host.handle, ENGINE_OPTION_WINE_AUTO_PREFIX, optWineAutoPrefix ? 1 : 0, "");
/* /*
// TODO // TODO
carla_set_engine_option(ENGINE_OPTION_WINE_FALLBACK_PREFIX, 0, os.path.expanduser(optWineFallbackPrefix));
carla_set_engine_option(host.handle, ENGINE_OPTION_WINE_FALLBACK_PREFIX, 0, os.path.expanduser(optWineFallbackPrefix));
*/ */
carla_set_engine_option(ENGINE_OPTION_WINE_RT_PRIO_ENABLED, optWineRtPrioEnabled ? 1 : 0, "");
carla_set_engine_option(ENGINE_OPTION_WINE_BASE_RT_PRIO, optWineBaseRtPrio, "");
carla_set_engine_option(ENGINE_OPTION_WINE_SERVER_RT_PRIO, optWineServerRtPrio, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_WINE_RT_PRIO_ENABLED, optWineRtPrioEnabled ? 1 : 0, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_WINE_BASE_RT_PRIO, optWineBaseRtPrio, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_WINE_SERVER_RT_PRIO, optWineServerRtPrio, "");


//----------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------
// driver and device settings // driver and device settings
@@ -2750,16 +2758,16 @@ QString setEngineSettings(CarlaHost& host)
const bool audioTripleBuffer = settings.valueBool(QString("%1/TripleBuffer").arg(prefix), CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER); const bool audioTripleBuffer = settings.valueBool(QString("%1/TripleBuffer").arg(prefix), CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER);


// Only setup audio things if engine is not running // Only setup audio things if engine is not running
if (! carla_is_engine_running())
if (! carla_is_engine_running(host.handle))
{ {
carla_set_engine_option(ENGINE_OPTION_AUDIO_DRIVER, 0, audioDriver.toUtf8());
carla_set_engine_option(ENGINE_OPTION_AUDIO_DEVICE, 0, audioDevice.toUtf8());
carla_set_engine_option(host.handle, ENGINE_OPTION_AUDIO_DRIVER, 0, audioDriver.toUtf8());
carla_set_engine_option(host.handle, ENGINE_OPTION_AUDIO_DEVICE, 0, audioDevice.toUtf8());


if (! audioDriver.startsWith("JACK")) if (! audioDriver.startsWith("JACK"))
{ {
carla_set_engine_option(ENGINE_OPTION_AUDIO_BUFFER_SIZE, audioBufferSize, "");
carla_set_engine_option(ENGINE_OPTION_AUDIO_SAMPLE_RATE, audioSampleRate, "");
carla_set_engine_option(ENGINE_OPTION_AUDIO_TRIPLE_BUFFER, audioTripleBuffer ? 1 : 0, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_AUDIO_BUFFER_SIZE, audioBufferSize, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_AUDIO_SAMPLE_RATE, audioSampleRate, "");
carla_set_engine_option(host.handle, ENGINE_OPTION_AUDIO_TRIPLE_BUFFER, audioTripleBuffer ? 1 : 0, "");
} }
} }


@@ -2769,7 +2777,10 @@ QString setEngineSettings(CarlaHost& host)
if (audioDriver != "JACK" && host.transportMode == ENGINE_TRANSPORT_MODE_JACK) if (audioDriver != "JACK" && host.transportMode == ENGINE_TRANSPORT_MODE_JACK)
{ {
host.transportMode = ENGINE_TRANSPORT_MODE_INTERNAL; host.transportMode = ENGINE_TRANSPORT_MODE_INTERNAL;
carla_set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, ENGINE_TRANSPORT_MODE_INTERNAL, host.transportExtra.toUtf8());
carla_set_engine_option(host.handle,
ENGINE_OPTION_TRANSPORT_MODE,
ENGINE_TRANSPORT_MODE_INTERNAL,
host.transportExtra.toUtf8());
} }


//----------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------
@@ -2802,16 +2813,16 @@ void runHostWithoutUI(CarlaHost& host)


const QString audioDriver = setEngineSettings(host); const QString audioDriver = setEngineSettings(host);


if (! carla_engine_init(audioDriver.toUtf8(), "Carla"))
if (! carla_engine_init(host.handle, audioDriver.toUtf8(), "Carla"))
{ {
carla_stdout("Engine failed to initialize, possible reasons:\n%s", carla_get_last_error());
carla_stdout("Engine failed to initialize, possible reasons:\n%s", carla_get_last_error(host.handle));
std::exit(1); std::exit(1);
} }


if (! carla_load_project(projectFile.toUtf8()))
if (! carla_load_project(host.handle, projectFile.toUtf8()))
{ {
carla_stdout("Failed to load selected project file, possible reasons:\n%s", carla_get_last_error());
carla_engine_close();
carla_stdout("Failed to load selected project file, possible reasons:\n%s", carla_get_last_error(host.handle));
carla_engine_close(host.handle);
std::exit(1); std::exit(1);
} }


@@ -2820,16 +2831,16 @@ void runHostWithoutUI(CarlaHost& host)


carla_stdout("Carla ready!"); carla_stdout("Carla ready!");


while (carla_is_engine_running() && ! gCarla.term)
while (carla_is_engine_running(host.handle) && ! gCarla.term)
{ {
carla_engine_idle();
carla_engine_idle(host.handle);
carla_msleep(33); // 30 Hz carla_msleep(33); // 30 Hz
} }


//----------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------
// Stop // Stop


carla_engine_close();
carla_engine_close(host.handle);
std::exit(0); std::exit(0);
} }




+ 4
- 1
source/frontend/carla_host.hpp View File

@@ -40,7 +40,7 @@
#include "carla_shared.hpp" #include "carla_shared.hpp"
#include "carla_widgets.hpp" #include "carla_widgets.hpp"


#include "CarlaBackend.h"
#include "CarlaHost.h"
#include "CarlaJuceUtils.hpp" #include "CarlaJuceUtils.hpp"


CARLA_BACKEND_USE_NAMESPACE; CARLA_BACKEND_USE_NAMESPACE;
@@ -52,6 +52,9 @@ class CarlaHost : public QObject
Q_OBJECT Q_OBJECT


public: public:
// host handle
CarlaHostHandle handle;

// info about this host object // info about this host object
bool isControl; bool isControl;
bool isPlugin; bool isPlugin;


+ 10
- 7
source/frontend/carla_settings.cpp View File

@@ -258,9 +258,11 @@ void DriverSettingsW::slot_updateDeviceInfo()


struct RuntimeDriverSettingsW::PrivateData { struct RuntimeDriverSettingsW::PrivateData {
Ui::DriverSettingsW ui; Ui::DriverSettingsW ui;
const CarlaHostHandle hostHandle;


PrivateData(RuntimeDriverSettingsW* const self)
: ui()
PrivateData(RuntimeDriverSettingsW* const self, const CarlaHostHandle h)
: ui(),
hostHandle(h)
{ {
ui.setupUi(self); ui.setupUi(self);
} }
@@ -268,11 +270,12 @@ struct RuntimeDriverSettingsW::PrivateData {
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PrivateData) CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PrivateData)
}; };


RuntimeDriverSettingsW::RuntimeDriverSettingsW(QWidget* const parent)
RuntimeDriverSettingsW::RuntimeDriverSettingsW(const CarlaHostHandle hostHandle, QWidget* const parent)
: QDialog(parent), : QDialog(parent),
self(new PrivateData(this))
self(new PrivateData(this, hostHandle))
{ {
const CarlaRuntimeEngineDriverDeviceInfo* const driverDeviceInfo = carla_get_runtime_engine_driver_device_info();
const CarlaRuntimeEngineDriverDeviceInfo* const driverDeviceInfo =
carla_get_runtime_engine_driver_device_info(hostHandle);


QList<uint> bufferSizes; QList<uint> bufferSizes;
fillQUIntListFromUIntArray(bufferSizes, driverDeviceInfo->bufferSizes); fillQUIntListFromUIntArray(bufferSizes, driverDeviceInfo->bufferSizes);
@@ -307,7 +310,7 @@ RuntimeDriverSettingsW::RuntimeDriverSettingsW(QWidget* const parent)
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// Load runtime settings // Load runtime settings


if (carla_is_engine_running())
if (carla_is_engine_running(hostHandle))
{ {
self->ui.cb_device->addItem(driverDeviceInfo->name); self->ui.cb_device->addItem(driverDeviceInfo->name);
self->ui.cb_device->setCurrentIndex(0); self->ui.cb_device->setCurrentIndex(0);
@@ -393,7 +396,7 @@ void RuntimeDriverSettingsW::getValues(QString& retAudioDevice, uint& retBufferS


void RuntimeDriverSettingsW::slot_showDevicePanel() void RuntimeDriverSettingsW::slot_showDevicePanel()
{ {
carla_show_engine_device_control_panel();
carla_show_engine_device_control_panel(self->hostHandle);
} }


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


+ 2
- 1
source/frontend/carla_settings.hpp View File

@@ -37,6 +37,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// Imports (Custom) // Imports (Custom)


#include "CarlaHost.h"
#include "CarlaJuceUtils.hpp" #include "CarlaJuceUtils.hpp"


class CarlaHost; class CarlaHost;
@@ -71,7 +72,7 @@ class RuntimeDriverSettingsW : public QDialog
Q_OBJECT Q_OBJECT


public: public:
RuntimeDriverSettingsW(QWidget* parent = nullptr);
RuntimeDriverSettingsW(CarlaHostHandle hostHandle, QWidget* parent = nullptr);
~RuntimeDriverSettingsW() override; ~RuntimeDriverSettingsW() override;


void getValues(QString& audioDevice, uint& bufferSize, double& sampleRate); void getValues(QString& audioDevice, uint& bufferSize, double& sampleRate);


+ 2
- 2
source/frontend/carla_settings_app.cpp View File

@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the doc/GPL.txt file. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/ */


#include "carla_database.hpp"
#include "carla_settings.hpp"


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


@@ -46,7 +46,7 @@ int main(int argc, char* argv[])
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// Create GUI // Create GUI


PluginRefreshW gui(nullptr, host);
CarlaSettingsW gui(nullptr, host, true, true);


// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// Show GUI // Show GUI


+ 3
- 3
source/frontend/carla_widgets.cpp View File

@@ -90,10 +90,10 @@ struct CarlaAboutW::PrivateData {


ui.l_extended->setText(carla_get_complete_license_text()); ui.l_extended->setText(carla_get_complete_license_text());


if (carla_is_engine_running() && ! host.isControl)
if (carla_is_engine_running(host.handle) && ! host.isControl)
{ {
ui.le_osc_url_tcp->setText(carla_get_host_osc_url_tcp());
ui.le_osc_url_udp->setText(carla_get_host_osc_url_udp());
ui.le_osc_url_tcp->setText(carla_get_host_osc_url_tcp(host.handle));
ui.le_osc_url_udp->setText(carla_get_host_osc_url_udp(host.handle));
} }
else else
{ {


Loading…
Cancel
Save