LMMS
Loading...
Searching...
No Matches
CarlaStandalone.cpp
Go to the documentation of this file.
1/*
2 * Carla Standalone
3 * Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
16 */
17
18// TODO:
19// Check carla_stderr2("Engine is not running"); <= prepend func name and args
20
21#include "CarlaHostImpl.hpp"
22#include "CarlaMIDI.h"
23
24#include "CarlaEngineInit.hpp"
25#include "CarlaPlugin.hpp"
26
27#include "CarlaBackendUtils.hpp"
28#include "CarlaBase64Utils.hpp"
29#include "ThreadSafeFFTW.hpp"
30
31#include "water/files/File.h"
32
33#if defined(USING_JUCE) && !defined(BUILD_BRIDGE)
35#endif
36
37#define CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(cond, msg, ret) \
38 if (! (cond)) { \
39 carla_stderr2("%s: " msg, __FUNCTION__); \
40 if (handle->isStandalone) \
41 ((CarlaHostStandalone*)handle)->lastError = msg; \
42 return ret; \
43 }
44
45// -------------------------------------------------------------------------------------------------------------------
46// Always return a valid string ptr for standalone functions
47
48static const char* const gNullCharPtr = "";
49
50static void checkStringPtr(const char*& charPtr) noexcept
51{
52 if (charPtr == nullptr)
53 charPtr = gNullCharPtr;
54}
55
56// -------------------------------------------------------------------------------------------------------------------
57// Constructors
58
59_CarlaPluginInfo::_CarlaPluginInfo() noexcept
60 : type(CB::PLUGIN_NONE),
61 category(CB::PLUGIN_CATEGORY_NONE),
62 hints(0x0),
63 optionsAvailable(0x0),
64 optionsEnabled(0x0),
67 label(gNullCharPtr),
68 maker(gNullCharPtr),
70 iconName(gNullCharPtr),
71 uniqueId(0) {}
72
73_CarlaPluginInfo::~_CarlaPluginInfo() noexcept
74{
75 if (label != gNullCharPtr)
76 delete[] label;
77 if (maker != gNullCharPtr)
78 delete[] maker;
80 delete[] copyright;
81}
82
83_CarlaParameterInfo::_CarlaParameterInfo() noexcept
85 symbol(gNullCharPtr),
87 comment(gNullCharPtr),
88 groupName(gNullCharPtr),
89 scalePointCount(0) {}
90
91_CarlaParameterInfo::~_CarlaParameterInfo() noexcept
92{
93 if (name != gNullCharPtr)
94 delete[] name;
95 if (symbol != gNullCharPtr)
96 delete[] symbol;
97 if (unit != gNullCharPtr)
98 delete[] unit;
99 if (comment != gNullCharPtr)
100 delete[] comment;
101 if (groupName != gNullCharPtr)
102 delete[] groupName;
103}
104
105_CarlaScalePointInfo::_CarlaScalePointInfo() noexcept
106 : value(0.0f),
107 label(gNullCharPtr) {}
108
109_CarlaScalePointInfo::~_CarlaScalePointInfo() noexcept
110{
111 if (label != gNullCharPtr)
112 delete[] label;
113}
114
115_CarlaTransportInfo::_CarlaTransportInfo() noexcept
116 : playing(false),
117 frame(0),
118 bar(0),
119 beat(0),
120 tick(0),
121 bpm(0.0) {}
122
123void _CarlaTransportInfo::clear() noexcept
124{
125 playing = false;
126 frame = 0;
127 bar = 0;
128 beat = 0;
129 tick = 0;
130 bpm = 0.0;
131}
132
133// --------------------------------------------------------------------------------------------------------------------
134
135using CARLA_BACKEND_NAMESPACE::CarlaPluginPtr;
136
137// --------------------------------------------------------------------------------------------------------------------
138
140{
141 carla_debug("carla_get_engine_driver_count()");
142
143 return CarlaEngine::getDriverCount();
144}
145
147{
148 carla_debug("carla_get_engine_driver_name(%i)", index);
149
150 return CarlaEngine::getDriverName(index);
151}
152
154{
155 carla_debug("carla_get_engine_driver_device_names(%i)", index);
156
157 return CarlaEngine::getDriverDeviceNames(index);
158}
159
161{
162 CARLA_SAFE_ASSERT_RETURN(name != nullptr, nullptr);
163
164 static EngineDriverDeviceInfo retDevInfo;
165 static const uint32_t nullBufferSizes[] = { 0 };
166 static const double nullSampleRates[] = { 0.0 };
167
168 carla_debug("carla_get_engine_driver_device_info(%i, \"%s\")", index, name);
169
170 if (const EngineDriverDeviceInfo* const devInfo = CarlaEngine::getDriverDeviceInfo(index, name))
171 {
172 retDevInfo.hints = devInfo->hints;
173 retDevInfo.bufferSizes = devInfo->bufferSizes != nullptr ? devInfo->bufferSizes : nullBufferSizes;
174 retDevInfo.sampleRates = devInfo->sampleRates != nullptr ? devInfo->sampleRates : nullSampleRates;
175 }
176 else
177 {
178 retDevInfo.hints = 0x0;
179 retDevInfo.bufferSizes = nullBufferSizes;
180 retDevInfo.sampleRates = nullSampleRates;
181 }
182
183 return &retDevInfo;
184}
185
187{
188 return CarlaEngine::showDriverDeviceControlPanel(index, name);
189}
190
191// --------------------------------------------------------------------------------------------------------------------
192
194{
195#ifdef CARLA_OS_UNIX
196 static const ThreadSafeFFTW sThreadSafeFFTW;
197#endif
198
199 static CarlaHostStandalone gStandalone;
200
201 return &gStandalone;
202}
203
205{
206 carla_debug("carla_get_engine(%p)", handle);
207
208 return handle->engine;
209}
210
211// --------------------------------------------------------------------------------------------------------------------
212
213static void carla_engine_init_common(const CarlaHostStandalone& standalone, CarlaEngine* const engine)
214{
215 engine->setCallback(standalone.engineCallback, standalone.engineCallbackPtr);
216 engine->setFileCallback(standalone.fileCallback, standalone.fileCallbackPtr);
217
218 using water::File;
219 const File waterBinaryDir(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory());
220
221#ifdef BUILD_BRIDGE
222 /*
223 if (const char* const forceStereo = std::getenv("ENGINE_OPTION_FORCE_STEREO"))
224 engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, (std::strcmp(forceStereo, "true") == 0) ? 1 : 0, nullptr);
225
226 if (const char* const preferPluginBridges = std::getenv("ENGINE_OPTION_PREFER_PLUGIN_BRIDGES"))
227 engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, (std::strcmp(preferPluginBridges, "true") == 0) ? 1 : 0, nullptr);
228
229 if (const char* const preferUiBridges = std::getenv("ENGINE_OPTION_PREFER_UI_BRIDGES"))
230 engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, (std::strcmp(preferUiBridges, "true") == 0) ? 1 : 0, nullptr);
231 */
232
233 if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_UIS_ALWAYS_ON_TOP"))
234 engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);
235
236 if (const char* const maxParameters = std::getenv("ENGINE_OPTION_MAX_PARAMETERS"))
237 engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, std::atoi(maxParameters), nullptr);
238
239 if (const char* const resetXruns = std::getenv("ENGINE_OPTION_RESET_XRUNS"))
240 engine->setOption(CB::ENGINE_OPTION_RESET_XRUNS, (std::strcmp(resetXruns, "true") == 0) ? 1 : 0, nullptr);
241
242 if (const char* const uiBridgesTimeout = std::getenv("ENGINE_OPTION_UI_BRIDGES_TIMEOUT"))
243 engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, std::atoi(uiBridgesTimeout), nullptr);
244
245 if (const char* const pathAudio = std::getenv("ENGINE_OPTION_FILE_PATH_AUDIO"))
246 engine->setOption(CB::ENGINE_OPTION_FILE_PATH, CB::FILE_AUDIO, pathAudio);
247
248 if (const char* const pathMIDI = std::getenv("ENGINE_OPTION_FILE_PATH_MIDI"))
249 engine->setOption(CB::ENGINE_OPTION_FILE_PATH, CB::FILE_MIDI, pathMIDI);
250
251 if (const char* const pathLADSPA = std::getenv("ENGINE_OPTION_PLUGIN_PATH_LADSPA"))
252 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LADSPA, pathLADSPA);
253
254 if (const char* const pathDSSI = std::getenv("ENGINE_OPTION_PLUGIN_PATH_DSSI"))
255 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_DSSI, pathDSSI);
256
257 if (const char* const pathLV2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_LV2"))
258 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LV2, pathLV2);
259
260 if (const char* const pathVST2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_VST2"))
261 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST2, pathVST2);
262
263 if (const char* const pathVST3 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_VST3"))
264 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST3, pathVST3);
265
266 if (const char* const pathSF2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_SF2"))
267 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SF2, pathSF2);
268
269 if (const char* const pathSFZ = std::getenv("ENGINE_OPTION_PLUGIN_PATH_SFZ"))
270 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SFZ, pathSFZ);
271
272 if (const char* const pathJSFX = std::getenv("ENGINE_OPTION_PLUGIN_PATH_JSFX"))
273 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_JSFX, pathJSFX);
274
275 if (const char* const pathCLAP = std::getenv("ENGINE_OPTION_PLUGIN_PATH_CLAP"))
276 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_CLAP, pathCLAP);
277
278 if (const char* const binaryDir = std::getenv("ENGINE_OPTION_PATH_BINARIES"))
279 engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, binaryDir);
280 else
281 engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, waterBinaryDir.getFullPathName().toRawUTF8());
282
283 if (const char* const resourceDir = std::getenv("ENGINE_OPTION_PATH_RESOURCES"))
284 engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, resourceDir);
285 else
286 engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, waterBinaryDir.getChildFile("resources").getFullPathName().toRawUTF8());
287
288 if (const char* const preventBadBehaviour = std::getenv("ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR"))
289 engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, (std::strcmp(preventBadBehaviour, "true") == 0) ? 1 : 0, nullptr);
290
291 if (const char* const frontendWinId = std::getenv("ENGINE_OPTION_FRONTEND_WIN_ID"))
292 engine->setOption(CB::ENGINE_OPTION_FRONTEND_WIN_ID, 0, frontendWinId);
293#else
294 engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, standalone.engineOptions.forceStereo ? 1 : 0, nullptr);
295 engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, standalone.engineOptions.preferPluginBridges ? 1 : 0, nullptr);
296 engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, standalone.engineOptions.preferUiBridges ? 1 : 0, nullptr);
297 engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, standalone.engineOptions.uisAlwaysOnTop ? 1 : 0, nullptr);
298 engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, static_cast<int>(standalone.engineOptions.maxParameters), nullptr);
299 engine->setOption(CB::ENGINE_OPTION_RESET_XRUNS, standalone.engineOptions.resetXruns ? 1 : 0, nullptr);
300 engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, static_cast<int>(standalone.engineOptions.uiBridgesTimeout), nullptr);
301 engine->setOption(CB::ENGINE_OPTION_AUDIO_BUFFER_SIZE, static_cast<int>(standalone.engineOptions.audioBufferSize), nullptr);
302 engine->setOption(CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE, static_cast<int>(standalone.engineOptions.audioSampleRate), nullptr);
303 engine->setOption(CB::ENGINE_OPTION_AUDIO_TRIPLE_BUFFER, standalone.engineOptions.audioTripleBuffer ? 1 : 0, nullptr);
304
305 if (standalone.engineOptions.audioDriver != nullptr)
306 engine->setOption(CB::ENGINE_OPTION_AUDIO_DRIVER, 0, standalone.engineOptions.audioDriver);
307
308 if (standalone.engineOptions.audioDevice != nullptr)
309 engine->setOption(CB::ENGINE_OPTION_AUDIO_DEVICE, 0, standalone.engineOptions.audioDevice);
310
311 engine->setOption(CB::ENGINE_OPTION_OSC_ENABLED, standalone.engineOptions.oscEnabled, nullptr);
312 engine->setOption(CB::ENGINE_OPTION_OSC_PORT_TCP, standalone.engineOptions.oscPortTCP, nullptr);
313 engine->setOption(CB::ENGINE_OPTION_OSC_PORT_UDP, standalone.engineOptions.oscPortUDP, nullptr);
314
315 if (standalone.engineOptions.pathAudio != nullptr)
316 engine->setOption(CB::ENGINE_OPTION_FILE_PATH, CB::FILE_AUDIO, standalone.engineOptions.pathAudio);
317
318 if (standalone.engineOptions.pathMIDI != nullptr)
319 engine->setOption(CB::ENGINE_OPTION_FILE_PATH, CB::FILE_MIDI, standalone.engineOptions.pathMIDI);
320
321 if (standalone.engineOptions.pathLADSPA != nullptr)
322 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LADSPA, standalone.engineOptions.pathLADSPA);
323
324 if (standalone.engineOptions.pathDSSI != nullptr)
325 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_DSSI, standalone.engineOptions.pathDSSI);
326
327 if (standalone.engineOptions.pathLV2 != nullptr)
328 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LV2, standalone.engineOptions.pathLV2);
329
330 if (standalone.engineOptions.pathVST2 != nullptr)
331 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST2, standalone.engineOptions.pathVST2);
332
333 if (standalone.engineOptions.pathVST3 != nullptr)
334 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST3, standalone.engineOptions.pathVST3);
335
336 if (standalone.engineOptions.pathSF2 != nullptr)
337 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SF2, standalone.engineOptions.pathSF2);
338
339 if (standalone.engineOptions.pathSFZ != nullptr)
340 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SFZ, standalone.engineOptions.pathSFZ);
341
342 if (standalone.engineOptions.pathJSFX != nullptr)
343 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_JSFX, standalone.engineOptions.pathJSFX);
344
345 if (standalone.engineOptions.pathCLAP != nullptr)
346 engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_CLAP, standalone.engineOptions.pathCLAP);
347
348 if (standalone.engineOptions.binaryDir != nullptr && standalone.engineOptions.binaryDir[0] != '\0')
349 engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, standalone.engineOptions.binaryDir);
350 else
351 engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, waterBinaryDir.getFullPathName().toRawUTF8());
352
353 if (standalone.engineOptions.resourceDir != nullptr && standalone.engineOptions.resourceDir[0] != '\0')
354 engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, standalone.engineOptions.resourceDir);
355
356 engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, standalone.engineOptions.preventBadBehaviour ? 1 : 0, nullptr);
357
358 engine->setOption(CB::ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR, static_cast<int>(standalone.engineOptions.bgColor), nullptr);
359 engine->setOption(CB::ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR, static_cast<int>(standalone.engineOptions.fgColor), nullptr);
360 engine->setOption(CB::ENGINE_OPTION_FRONTEND_UI_SCALE, static_cast<int>(standalone.engineOptions.uiScale * 1000.0f), nullptr);
361
362 if (standalone.engineOptions.frontendWinId != 0)
363 {
364 char strBuf[STR_MAX+1];
365 strBuf[STR_MAX] = '\0';
366 std::snprintf(strBuf, STR_MAX, P_UINTPTR, standalone.engineOptions.frontendWinId);
367 engine->setOption(CB::ENGINE_OPTION_FRONTEND_WIN_ID, 0, strBuf);
368 }
369 else
370 {
371 engine->setOption(CB::ENGINE_OPTION_FRONTEND_WIN_ID, 0, "0");
372 }
373
374# ifndef CARLA_OS_WIN
375 if (standalone.engineOptions.wine.executable != nullptr && standalone.engineOptions.wine.executable[0] != '\0')
376 engine->setOption(CB::ENGINE_OPTION_WINE_EXECUTABLE, 0, standalone.engineOptions.wine.executable);
377
378 engine->setOption(CB::ENGINE_OPTION_WINE_AUTO_PREFIX, standalone.engineOptions.wine.autoPrefix ? 1 : 0, nullptr);
379
380 if (standalone.engineOptions.wine.fallbackPrefix != nullptr && standalone.engineOptions.wine.fallbackPrefix[0] != '\0')
381 engine->setOption(CB::ENGINE_OPTION_WINE_FALLBACK_PREFIX, 0, standalone.engineOptions.wine.fallbackPrefix);
382
383 engine->setOption(CB::ENGINE_OPTION_WINE_RT_PRIO_ENABLED, standalone.engineOptions.wine.rtPrio ? 1 : 0, nullptr);
384 engine->setOption(CB::ENGINE_OPTION_WINE_BASE_RT_PRIO, standalone.engineOptions.wine.baseRtPrio, nullptr);
385 engine->setOption(CB::ENGINE_OPTION_WINE_SERVER_RT_PRIO, standalone.engineOptions.wine.serverRtPrio, nullptr);
386# endif
387
388 engine->setOption(CB::ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, standalone.engineOptions.clientNamePrefix);
389
390 engine->setOption(CB::ENGINE_OPTION_PLUGINS_ARE_STANDALONE, standalone.engineOptions.pluginsAreStandalone, nullptr);
391#endif // BUILD_BRIDGE
392}
393
394bool carla_engine_init(CarlaHostHandle handle, const char* driverName, const char* clientName)
395{
396 CARLA_SAFE_ASSERT_RETURN(driverName != nullptr && driverName[0] != '\0', false);
397 CARLA_SAFE_ASSERT_RETURN(clientName != nullptr && clientName[0] != '\0', false);
398 carla_debug("carla_engine_init(%p, \"%s\", \"%s\")", handle, driverName, clientName);
399
400 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->isStandalone, "Must be a standalone host handle", false);
401 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine == nullptr, "Engine is already initialized", false);
402
403#ifdef CARLA_OS_WIN
404 carla_setenv("WINEASIO_CLIENT_NAME", clientName);
405#endif
406
407#if defined(USING_JUCE) && !defined(BUILD_BRIDGE)
409#endif
410
411 CarlaHostStandalone& shandle((CarlaHostStandalone&)*handle);
412
413 CarlaEngine* const engine = CarlaEngine::newDriverByName(driverName);
414 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(engine != nullptr, "The selected audio driver is not available", false);
415
416 shandle.engine = engine;
417
418#ifdef BUILD_BRIDGE
419 if (std::getenv("CARLA_BRIDGE_DUMMY") != nullptr)
420 {
421 // engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_PATCHBAY, nullptr);
422 engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_CONTINUOUS_RACK, nullptr);
423 engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_INTERNAL, nullptr);
424
425 engine->setOption(CB::ENGINE_OPTION_AUDIO_BUFFER_SIZE, 4096, nullptr);
426 engine->setOption(CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE, 48000, nullptr);
427 }
428 else
429 {
430 engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, nullptr);
431 engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_JACK, nullptr);
432 }
433 engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, false, nullptr);
434 engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, false, nullptr);
435 engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, false, nullptr);
436#else
437 engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, static_cast<int>(shandle.engineOptions.processMode), nullptr);
438 engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, static_cast<int>(shandle.engineOptions.transportMode), shandle.engineOptions.transportExtra);
439#endif
440
441 carla_engine_init_common(shandle, engine);
442
443 if (engine->init(clientName))
444 {
445#ifdef CARLA_CAN_USE_LOG_THREAD
446 if (shandle.logThreadEnabled && std::getenv("CARLA_LOGS_DISABLED") == nullptr)
447 shandle.logThread.init();
448#endif
449 shandle.lastError = "No error";
450 return true;
451 }
452 else
453 {
454 shandle.lastError = engine->getLastError();
455 shandle.engine = nullptr;
456 delete engine;
457#if defined(USING_JUCE) && !defined(BUILD_BRIDGE)
459#endif
460 return false;
461 }
462}
463
464#ifdef BUILD_BRIDGE
465bool carla_engine_init_bridge(CarlaHostHandle handle,
466 const char audioBaseName[6+1],
467 const char rtClientBaseName[6+1],
468 const char nonRtClientBaseName[6+1],
469 const char nonRtServerBaseName[6+1],
470 const char* const clientName)
471{
472 CARLA_SAFE_ASSERT_RETURN(audioBaseName != nullptr && audioBaseName[0] != '\0', false);
473 CARLA_SAFE_ASSERT_RETURN(rtClientBaseName != nullptr && rtClientBaseName[0] != '\0', false);
474 CARLA_SAFE_ASSERT_RETURN(nonRtClientBaseName != nullptr && nonRtClientBaseName[0] != '\0', false);
475 CARLA_SAFE_ASSERT_RETURN(nonRtServerBaseName != nullptr && nonRtServerBaseName[0] != '\0', false);
476 CARLA_SAFE_ASSERT_RETURN(clientName != nullptr && clientName[0] != '\0', false);
477 carla_debug("carla_engine_init_bridge(%p, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\")",
478 handle, audioBaseName, rtClientBaseName, nonRtClientBaseName, nonRtServerBaseName, clientName);
479
480 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->isStandalone, "Must be a standalone host handle", false);
481 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine == nullptr, "Engine is already initialized", false);
482
483 CarlaScopedPointer<CarlaEngine> engine(CB::EngineInit::newBridge(audioBaseName,
484 rtClientBaseName,
485 nonRtClientBaseName,
486 nonRtServerBaseName));
487
488 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(engine != nullptr, "The selected audio driver is not available", false);
489
490 engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_BRIDGE, nullptr);
491 engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_BRIDGE, nullptr);
492
493 CarlaHostStandalone& shandle((CarlaHostStandalone&)*handle);
494
495 carla_engine_init_common(shandle, engine);
496
497 if (engine->init(clientName))
498 {
499 shandle.lastError = "No error";
500 shandle.engine = engine.release();
501 return true;
502 }
503 else
504 {
505 shandle.lastError = engine->getLastError();
506 return false;
507 }
508}
509#endif
510
512{
513 carla_debug("carla_engine_close(%p)", handle);
514
515 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->isStandalone, "Must be a standalone host handle", false);
516 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
517
518 CarlaHostStandalone& shandle((CarlaHostStandalone&)*handle);
519
520 CarlaEngine* const engine = shandle.engine;
521
522 engine->setAboutToClose();
523 engine->removeAllPlugins();
524
525 const bool closed = engine->close();
526
527 if (! closed)
528 shandle.lastError = engine->getLastError();
529
530#ifdef CARLA_CAN_USE_LOG_THREAD
531 shandle.logThread.stop();
532#endif
533
534 shandle.engine = nullptr;
535 delete engine;
536
537#if defined(USING_JUCE) && !defined(BUILD_BRIDGE)
539#endif
540 return closed;
541}
542
544{
545 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->isStandalone,);
546
547 handle->engine->idle();
548
549#if defined(USING_JUCE) && !defined(BUILD_BRIDGE)
550 if (handle->isStandalone)
552#endif
553}
554
556{
557 return (handle->engine != nullptr && handle->engine->isRunning());
558}
559
561{
562 static CarlaRuntimeEngineInfo retInfo;
563
564 // reset
565 retInfo.load = 0.0f;
566 retInfo.xruns = 0;
567
568 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retInfo);
569
570 retInfo.load = handle->engine->getDSPLoad();
571 retInfo.xruns = handle->engine->getTotalXruns();
572
573 return &retInfo;
574}
575
576#ifndef BUILD_BRIDGE
578{
580
581 // reset
582 retInfo.name = gNullCharPtr;
583 retInfo.hints = 0x0;
584 retInfo.bufferSize = 0;
585 retInfo.bufferSizes = nullptr;
586 retInfo.sampleRate = 0.0;
587 retInfo.sampleRates = nullptr;
588
589 const char* audioDriver;
590 const char* audioDevice;
591
592 if (CarlaEngine* const engine = handle->engine)
593 {
594 audioDriver = engine->getCurrentDriverName();
595 audioDevice = engine->getOptions().audioDevice;
596
597 retInfo.bufferSize = engine->getBufferSize();
598 retInfo.sampleRate = engine->getSampleRate();
599 }
600 else if (handle->isStandalone)
601 {
602 CarlaHostStandalone& shandle((CarlaHostStandalone&)*handle);
603
604 audioDriver = shandle.engineOptions.audioDriver;
605 audioDevice = shandle.engineOptions.audioDevice;
606
607 retInfo.bufferSize = shandle.engineOptions.audioBufferSize;
608 retInfo.sampleRate = shandle.engineOptions.audioSampleRate;
609 }
610 else
611 {
612 return &retInfo;
613 }
614 CARLA_SAFE_ASSERT_RETURN(audioDriver != nullptr, &retInfo);
615 CARLA_SAFE_ASSERT_RETURN(audioDevice != nullptr, &retInfo);
616
617 uint index = 0;
618 uint count = CarlaEngine::getDriverCount();
619 for (; index<count; ++index)
620 {
621 const char* const testDriverName = CarlaEngine::getDriverName(index);
622 CARLA_SAFE_ASSERT_CONTINUE(testDriverName != nullptr);
623
624 if (std::strcmp(testDriverName, audioDriver) == 0)
625 break;
626 }
627 CARLA_SAFE_ASSERT_RETURN(index != count, &retInfo);
628
629 const EngineDriverDeviceInfo* const devInfo = CarlaEngine::getDriverDeviceInfo(index, audioDevice);
630 CARLA_SAFE_ASSERT_RETURN(devInfo != nullptr, &retInfo);
631
632 retInfo.name = audioDevice;
633 retInfo.hints = devInfo->hints;
634 retInfo.bufferSizes = devInfo->bufferSizes;
635 retInfo.sampleRates = devInfo->sampleRates;
636
637 return &retInfo;
638}
639
640bool carla_set_engine_buffer_size_and_sample_rate(CarlaHostHandle handle, uint bufferSize, double sampleRate)
641{
642 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, false);
643 carla_debug("carla_set_engine_buffer_size_and_sample_rate(%p, %u, %f)", handle, bufferSize, sampleRate);
644
645 return handle->engine->setBufferSizeAndSampleRate(bufferSize, sampleRate);
646}
647
649{
650 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, false);
651 carla_debug("carla_show_engine_device_control_panel(%p)", handle);
652
653 return handle->engine->showDeviceControlPanel();
654}
655#endif // BUILD_BRIDGE
656
658{
659 if (handle->engine != nullptr)
660 handle->engine->clearXruns();
661}
662
664{
665 if (handle->engine != nullptr)
666 handle->engine->setActionCanceled(true);
667}
668
670{
671 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, true);
672 carla_debug("carla_set_engine_about_to_close(%p)", handle);
673
674 return handle->engine->setAboutToClose();
675}
676
678{
679 carla_debug("carla_set_engine_callback(%p, %p, %p)", handle, func, ptr);
680
681 if (handle->isStandalone)
682 {
683 CarlaHostStandalone& shandle((CarlaHostStandalone&)*handle);
684
685 shandle.engineCallback = func;
686 shandle.engineCallbackPtr = ptr;
687
688#ifdef CARLA_CAN_USE_LOG_THREAD
689 shandle.logThread.setCallback(func, ptr);
690#endif
691 }
692
693 if (handle->engine != nullptr)
694 handle->engine->setCallback(func, ptr);
695}
696
697void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int value, const char* valueStr)
698{
699 carla_debug("carla_set_engine_option(%p, %i:%s, %i, \"%s\")",
700 handle, option, CB::EngineOption2Str(option), value, valueStr);
701
702 if (handle->isStandalone)
703 {
704 CarlaHostStandalone& shandle((CarlaHostStandalone&)*handle);
705
706 switch (option)
707 {
708 case CB::ENGINE_OPTION_DEBUG:
709 break;
710
711 case CB::ENGINE_OPTION_PROCESS_MODE:
712 CARLA_SAFE_ASSERT_RETURN(value >= CB::ENGINE_PROCESS_MODE_SINGLE_CLIENT && value < CB::ENGINE_PROCESS_MODE_BRIDGE,);
713 shandle.engineOptions.processMode = static_cast<CB::EngineProcessMode>(value);
714 break;
715
716 case CB::ENGINE_OPTION_TRANSPORT_MODE:
717 CARLA_SAFE_ASSERT_RETURN(value >= CB::ENGINE_TRANSPORT_MODE_DISABLED && value <= CB::ENGINE_TRANSPORT_MODE_BRIDGE,);
718
719 // jack transport cannot be disabled in multi-client
720 if (shandle.engineOptions.processMode == CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS
721 && value != CB::ENGINE_TRANSPORT_MODE_JACK)
722 {
723 shandle.engineOptions.transportMode = CB::ENGINE_TRANSPORT_MODE_JACK;
724
725 if (shandle.engineCallback != nullptr)
726 shandle.engineCallback(shandle.engineCallbackPtr,
727 CB::ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED,
728 0,
729 CB::ENGINE_TRANSPORT_MODE_JACK,
730 0, 0, 0.0f,
731 shandle.engineOptions.transportExtra);
732 }
733 else
734 {
735 shandle.engineOptions.transportMode = static_cast<CB::EngineTransportMode>(value);
736 }
737
738 delete[] shandle.engineOptions.transportExtra;
739 if (value != CB::ENGINE_TRANSPORT_MODE_DISABLED && valueStr != nullptr)
740 shandle.engineOptions.transportExtra = carla_strdup_safe(valueStr);
741 else
742 shandle.engineOptions.transportExtra = nullptr;
743 break;
744
745 case CB::ENGINE_OPTION_FORCE_STEREO:
746 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
747 shandle.engineOptions.forceStereo = (value != 0);
748 break;
749
750 case CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES:
751 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
752 shandle.engineOptions.preferPluginBridges = (value != 0);
753 break;
754
755 case CB::ENGINE_OPTION_PREFER_UI_BRIDGES:
756 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
757 shandle.engineOptions.preferUiBridges = (value != 0);
758 break;
759
760 case CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP:
761 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
762 shandle.engineOptions.uisAlwaysOnTop = (value != 0);
763 break;
764
765 case CB::ENGINE_OPTION_MAX_PARAMETERS:
767 shandle.engineOptions.maxParameters = static_cast<uint>(value);
768 break;
769
770 case CB::ENGINE_OPTION_RESET_XRUNS:
771 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
772 shandle.engineOptions.resetXruns = (value != 0);
773 break;
774
775 case CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT:
777 shandle.engineOptions.uiBridgesTimeout = static_cast<uint>(value);
778 break;
779
780 case CB::ENGINE_OPTION_AUDIO_BUFFER_SIZE:
782 shandle.engineOptions.audioBufferSize = static_cast<uint>(value);
783 break;
784
785 case CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE:
787 shandle.engineOptions.audioSampleRate = static_cast<uint>(value);
788 break;
789
790 case CB::ENGINE_OPTION_AUDIO_TRIPLE_BUFFER:
791 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
792 shandle.engineOptions.audioTripleBuffer = (value != 0);
793 break;
794
795 case CB::ENGINE_OPTION_AUDIO_DRIVER:
796 CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,);
797
798 if (shandle.engineOptions.audioDriver != nullptr)
799 delete[] shandle.engineOptions.audioDriver;
800
801 shandle.engineOptions.audioDriver = carla_strdup_safe(valueStr);
802 break;
803
804 case CB::ENGINE_OPTION_AUDIO_DEVICE:
805 CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,);
806
807 if (shandle.engineOptions.audioDevice != nullptr)
808 delete[] shandle.engineOptions.audioDevice;
809
810 shandle.engineOptions.audioDevice = carla_strdup_safe(valueStr);
811 break;
812
813#ifndef BUILD_BRIDGE
814 case CB::ENGINE_OPTION_OSC_ENABLED:
815 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
816 shandle.engineOptions.oscEnabled = (value != 0);
817 break;
818
819 case CB::ENGINE_OPTION_OSC_PORT_TCP:
821 shandle.engineOptions.oscPortTCP = value;
822 break;
823
824 case CB::ENGINE_OPTION_OSC_PORT_UDP:
826 shandle.engineOptions.oscPortUDP = value;
827 break;
828#endif
829
830 case CB::ENGINE_OPTION_FILE_PATH:
831 CARLA_SAFE_ASSERT_RETURN(value > CB::FILE_NONE,);
832 CARLA_SAFE_ASSERT_RETURN(value <= CB::FILE_MIDI,);
833 CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,);
834
835 switch (value)
836 {
837 case CB::FILE_AUDIO:
838 if (shandle.engineOptions.pathAudio != nullptr)
839 delete[] shandle.engineOptions.pathAudio;
840 shandle.engineOptions.pathAudio = carla_strdup_safe(valueStr);
841 break;
842 case CB::FILE_MIDI:
843 if (shandle.engineOptions.pathMIDI != nullptr)
844 delete[] shandle.engineOptions.pathMIDI;
845 shandle.engineOptions.pathMIDI = carla_strdup_safe(valueStr);
846 break;
847 }
848 break;
849
850 case CB::ENGINE_OPTION_PLUGIN_PATH:
851 CARLA_SAFE_ASSERT_RETURN(value > CB::PLUGIN_NONE,);
852 CARLA_SAFE_ASSERT_RETURN(value <= CB::PLUGIN_TYPE_COUNT,);
853 CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr,);
854
855 switch (value)
856 {
857 case CB::PLUGIN_LADSPA:
858 if (shandle.engineOptions.pathLADSPA != nullptr)
859 delete[] shandle.engineOptions.pathLADSPA;
860 shandle.engineOptions.pathLADSPA = carla_strdup_safe(valueStr);
861 break;
862 case CB::PLUGIN_DSSI:
863 if (shandle.engineOptions.pathDSSI != nullptr)
864 delete[] shandle.engineOptions.pathDSSI;
865 shandle.engineOptions.pathDSSI = carla_strdup_safe(valueStr);
866 break;
867 case CB::PLUGIN_LV2:
868 if (shandle.engineOptions.pathLV2 != nullptr)
869 delete[] shandle.engineOptions.pathLV2;
870 shandle.engineOptions.pathLV2 = carla_strdup_safe(valueStr);
871 break;
872 case CB::PLUGIN_VST2:
873 if (shandle.engineOptions.pathVST2 != nullptr)
874 delete[] shandle.engineOptions.pathVST2;
875 shandle.engineOptions.pathVST2 = carla_strdup_safe(valueStr);
876 break;
877 case CB::PLUGIN_VST3:
878 if (shandle.engineOptions.pathVST3 != nullptr)
879 delete[] shandle.engineOptions.pathVST3;
880 shandle.engineOptions.pathVST3 = carla_strdup_safe(valueStr);
881 break;
882 case CB::PLUGIN_SF2:
883 if (shandle.engineOptions.pathSF2 != nullptr)
884 delete[] shandle.engineOptions.pathSF2;
885 shandle.engineOptions.pathSF2 = carla_strdup_safe(valueStr);
886 break;
887 case CB::PLUGIN_SFZ:
888 if (shandle.engineOptions.pathSFZ != nullptr)
889 delete[] shandle.engineOptions.pathSFZ;
890 shandle.engineOptions.pathSFZ = carla_strdup_safe(valueStr);
891 break;
892 case CB::PLUGIN_JSFX:
893 if (shandle.engineOptions.pathJSFX != nullptr)
894 delete[] shandle.engineOptions.pathJSFX;
895 shandle.engineOptions.pathJSFX = carla_strdup_safe(valueStr);
896 break;
897 case CB::PLUGIN_CLAP:
898 if (shandle.engineOptions.pathCLAP != nullptr)
899 delete[] shandle.engineOptions.pathCLAP;
900 shandle.engineOptions.pathCLAP = carla_strdup_safe(valueStr);
901 break;
902 }
903 break;
904
905 case CB::ENGINE_OPTION_PATH_BINARIES:
906 CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
907
908 if (shandle.engineOptions.binaryDir != nullptr)
909 delete[] shandle.engineOptions.binaryDir;
910
911 shandle.engineOptions.binaryDir = carla_strdup_safe(valueStr);
912 break;
913
914 case CB::ENGINE_OPTION_PATH_RESOURCES:
915 CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
916
917 if (shandle.engineOptions.resourceDir != nullptr)
918 delete[] shandle.engineOptions.resourceDir;
919
920 shandle.engineOptions.resourceDir = carla_strdup_safe(valueStr);
921 break;
922
923 case CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR:
924 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
925 shandle.engineOptions.preventBadBehaviour = (value != 0);
926 break;
927
928 case CB::ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR:
929 shandle.engineOptions.bgColor = static_cast<uint>(value);
930 break;
931
932 case CB::ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR:
933 shandle.engineOptions.fgColor = static_cast<uint>(value);
934 break;
935
936 case CB::ENGINE_OPTION_FRONTEND_UI_SCALE:
938 shandle.engineOptions.uiScale = static_cast<float>(value) / 1000;
939 break;
940
941 case CB::ENGINE_OPTION_FRONTEND_WIN_ID: {
942 CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
943 const long long winId(std::strtoll(valueStr, nullptr, 16));
944 CARLA_SAFE_ASSERT_RETURN(winId >= 0,);
945 shandle.engineOptions.frontendWinId = static_cast<uintptr_t>(winId);
946 } break;
947
948#if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
949 case CB::ENGINE_OPTION_WINE_EXECUTABLE:
950 CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
951
952 if (shandle.engineOptions.wine.executable != nullptr)
953 delete[] shandle.engineOptions.wine.executable;
954
955 shandle.engineOptions.wine.executable = carla_strdup_safe(valueStr);
956 break;
957
958 case CB::ENGINE_OPTION_WINE_AUTO_PREFIX:
959 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
960 shandle.engineOptions.wine.autoPrefix = (value != 0);
961 break;
962
963 case CB::ENGINE_OPTION_WINE_FALLBACK_PREFIX:
964 CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);
965
966 if (shandle.engineOptions.wine.fallbackPrefix != nullptr)
967 delete[] shandle.engineOptions.wine.fallbackPrefix;
968
969 shandle.engineOptions.wine.fallbackPrefix = carla_strdup_safe(valueStr);
970 break;
971
972 case CB::ENGINE_OPTION_WINE_RT_PRIO_ENABLED:
973 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
974 shandle.engineOptions.wine.rtPrio = (value != 0);
975 break;
976
977 case CB::ENGINE_OPTION_WINE_BASE_RT_PRIO:
978 CARLA_SAFE_ASSERT_RETURN(value >= 1 && value <= 89,);
979 shandle.engineOptions.wine.baseRtPrio = value;
980 break;
981
982 case CB::ENGINE_OPTION_WINE_SERVER_RT_PRIO:
983 CARLA_SAFE_ASSERT_RETURN(value >= 1 && value <= 99,);
984 shandle.engineOptions.wine.serverRtPrio = value;
985 break;
986#endif
987
988#ifndef BUILD_BRIDGE
989 case CB::ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
990#ifdef CARLA_CAN_USE_LOG_THREAD
991 shandle.logThreadEnabled = (value != 0);
992#endif
993 break;
994#endif
995
996 case CB::ENGINE_OPTION_CLIENT_NAME_PREFIX:
997 if (shandle.engineOptions.clientNamePrefix != nullptr)
998 delete[] shandle.engineOptions.clientNamePrefix;
999
1000 shandle.engineOptions.clientNamePrefix = valueStr != nullptr && valueStr[0] != '\0'
1001 ? carla_strdup_safe(valueStr)
1002 : nullptr;
1003 break;
1004
1005 case CB::ENGINE_OPTION_PLUGINS_ARE_STANDALONE:
1006 CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
1007 shandle.engineOptions.pluginsAreStandalone = (value != 0);
1008 break;
1009 }
1010 }
1011
1012 if (handle->engine != nullptr)
1013 handle->engine->setOption(option, value, valueStr);
1014}
1015
1017{
1018 carla_debug("carla_set_file_callback(%p, %p, %p)", handle, func, ptr);
1019
1020 if (handle->isStandalone)
1021 {
1022 CarlaHostStandalone& shandle((CarlaHostStandalone&)*handle);
1023
1024 shandle.fileCallback = func;
1025 shandle.fileCallbackPtr = ptr;
1026 }
1027
1028 if (handle->engine != nullptr)
1029 handle->engine->setFileCallback(func, ptr);
1030}
1031
1032// --------------------------------------------------------------------------------------------------------------------
1033
1035{
1036 CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
1037 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1038
1039 carla_debug("carla_load_file(%p, \"%s\")", handle, filename);
1040
1041 return handle->engine->loadFile(filename);
1042}
1043
1045{
1046 CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
1047 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1048
1049 carla_debug("carla_load_project(%p, \"%s\")", handle, filename);
1050
1051 return handle->engine->loadProject(filename, true);
1052}
1053
1055{
1056 CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
1057 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1058
1059 carla_debug("carla_save_project(%p, \"%s\")", handle, filename);
1060
1061 return handle->engine->saveProject(filename, true);
1062}
1063
1064#ifndef BUILD_BRIDGE
1066{
1067 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, gNullCharPtr);
1068
1069 carla_debug("carla_get_current_project_folder(%p)", handle);
1070
1071 if (const char* const ret = handle->engine->getCurrentProjectFolder())
1072 return ret;
1073
1074 return gNullCharPtr;
1075}
1076
1078{
1079 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->isStandalone, gNullCharPtr);
1080
1081 carla_debug("carla_get_current_project_filename(%p)", handle);
1082
1083 if (const char* const ret = handle->engine->getCurrentProjectFilename())
1084 return ret;
1085
1086 return gNullCharPtr;
1087}
1088
1090{
1091 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
1092
1093 carla_debug("carla_clear_project_filename(%p)", handle);
1094
1095 handle->engine->clearCurrentProjectFilename();
1096}
1097
1098// --------------------------------------------------------------------------------------------------------------------
1099
1100bool carla_patchbay_connect(CarlaHostHandle handle, bool external, uint groupIdA, uint portIdA, uint groupIdB, uint portIdB)
1101{
1102 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1103
1104 carla_debug("carla_patchbay_connect(%p, %s, %u, %u, %u, %u)",
1105 handle, bool2str(external), groupIdA, portIdA, groupIdB, portIdB);
1106
1107 return handle->engine->patchbayConnect(external, groupIdA, portIdA, groupIdB, portIdB);
1108}
1109
1110bool carla_patchbay_disconnect(CarlaHostHandle handle, bool external, uint connectionId)
1111{
1112 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1113
1114 carla_debug("carla_patchbay_disconnect(%p, %s, %i)", handle, bool2str(external), connectionId);
1115
1116 return handle->engine->patchbayDisconnect(external, connectionId);
1117}
1118
1119bool carla_patchbay_set_group_pos(CarlaHostHandle handle, bool external, uint groupId, int x1, int y1, int x2, int y2)
1120{
1121 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr && handle->engine->isRunning(),
1122 "Engine is not running", false);
1123
1124 carla_debug("carla_patchbay_set_group_pos(%p, %s, %u, %i, %i, %i, %i)",
1125 handle, bool2str(external), groupId, x1, y1, x2, y2);
1126
1127 if (handle->engine->isAboutToClose())
1128 return true;
1129
1130 return handle->engine->patchbaySetGroupPos(false, true, external, groupId, x1, y1, x2, y2);
1131}
1132
1133bool carla_patchbay_refresh(CarlaHostHandle handle, bool external)
1134{
1135 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1136
1137 carla_debug("carla_patchbay_refresh(%p, %s)", handle, bool2str(external));
1138
1139 return handle->engine->patchbayRefresh(true, false, external);
1140}
1141
1142// --------------------------------------------------------------------------------------------------------------------
1143
1145{
1146 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->engine->isRunning(),);
1147
1148 carla_debug("carla_transport_play(%p)", handle);
1149
1150 handle->engine->transportPlay();
1151}
1152
1154{
1155 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->engine->isRunning(),);
1156
1157 carla_debug("carla_transport_pause(%p)", handle);
1158
1159 handle->engine->transportPause();
1160}
1161
1162void carla_transport_bpm(CarlaHostHandle handle, double bpm)
1163{
1164 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->engine->isRunning(),);
1165
1166 carla_debug("carla_transport_bpm(%p, %f)", handle, bpm);
1167
1168 handle->engine->transportBPM(bpm);
1169}
1170
1171void carla_transport_relocate(CarlaHostHandle handle, uint64_t frame)
1172{
1173 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->engine->isRunning(),);
1174
1175 carla_debug("carla_transport_relocate(%p, %i)", handle, frame);
1176
1177 handle->engine->transportRelocate(frame);
1178}
1179
1181{
1182 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->engine->isRunning(), 0);
1183
1184 return handle->engine->getTimeInfo().frame;
1185}
1186
1188{
1189 static CarlaTransportInfo retTransInfo;
1190 retTransInfo.clear();
1191
1192 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->engine->isRunning(), &retTransInfo);
1193
1194 const CB::EngineTimeInfo& timeInfo(handle->engine->getTimeInfo());
1195
1196 retTransInfo.playing = timeInfo.playing;
1197 retTransInfo.frame = timeInfo.frame;
1198
1199 if (timeInfo.bbt.valid)
1200 {
1201 retTransInfo.bar = timeInfo.bbt.bar;
1202 retTransInfo.beat = timeInfo.bbt.beat;
1203 retTransInfo.tick = static_cast<int32_t>(timeInfo.bbt.tick + 0.5);
1204 retTransInfo.bpm = timeInfo.bbt.beatsPerMinute;
1205 }
1206
1207 return &retTransInfo;
1208}
1209#endif
1210
1211// --------------------------------------------------------------------------------------------------------------------
1212
1214{
1215 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0);
1216
1217 // too noisy!
1218 // carla_debug("carla_get_current_plugin_count(%p)", handle);
1219
1220 return handle->engine->getCurrentPluginCount();
1221}
1222
1224{
1225 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0);
1226
1227 carla_debug("carla_get_max_plugin_number(%p)", handle);
1228
1229 return handle->engine->getMaxPluginNumber();
1230}
1231
1232// --------------------------------------------------------------------------------------------------------------------
1233
1235 BinaryType btype, PluginType ptype,
1236 const char* filename, const char* name, const char* label, int64_t uniqueId,
1237 const void* extraPtr, uint options)
1238{
1239 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1240
1241 carla_debug("carla_add_plugin(%p, %i:%s, %i:%s, \"%s\", \"%s\", \"%s\", " P_INT64 ", %p, %u)",
1242 handle,
1243 btype, CB::BinaryType2Str(btype),
1244 ptype, CB::PluginType2Str(ptype),
1245 filename, name, label, uniqueId, extraPtr, options);
1246
1247 return handle->engine->addPlugin(btype, ptype, filename, name, label, uniqueId, extraPtr, options);
1248}
1249
1251{
1252 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1253
1254 carla_debug("carla_remove_plugin(%p, %i)", handle, pluginId);
1255
1256 return handle->engine->removePlugin(pluginId);
1257}
1258
1260{
1261 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1262
1263 carla_debug("carla_remove_all_plugins(%p)", handle);
1264
1265 return handle->engine->removeAllPlugins();
1266}
1267
1268#ifndef BUILD_BRIDGE
1269bool carla_rename_plugin(CarlaHostHandle handle, uint pluginId, const char* newName)
1270{
1271 CARLA_SAFE_ASSERT_RETURN(newName != nullptr && newName[0] != '\0', false);
1272 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1273
1274 carla_debug("carla_rename_plugin(%p, %i, \"%s\")", handle, pluginId, newName);
1275
1276 return handle->engine->renamePlugin(pluginId, newName);
1277}
1278
1280{
1281 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1282
1283 carla_debug("carla_clone_plugin(%p, %i)", handle, pluginId);
1284
1285 return handle->engine->clonePlugin(pluginId);
1286}
1287
1289{
1290 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1291
1292 carla_debug("carla_replace_plugin(%p, %i)", handle, pluginId);
1293
1294 return handle->engine->replacePlugin(pluginId);
1295}
1296
1297bool carla_switch_plugins(CarlaHostHandle handle, uint pluginIdA, uint pluginIdB)
1298{
1299 CARLA_SAFE_ASSERT_RETURN(pluginIdA != pluginIdB, false);
1300 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1301
1302 carla_debug("carla_switch_plugins(%p, %i, %i)", handle, pluginIdA, pluginIdB);
1303
1304 return handle->engine->switchPlugins(pluginIdA, pluginIdB);
1305}
1306#endif
1307
1308// --------------------------------------------------------------------------------------------------------------------
1309
1310bool carla_load_plugin_state(CarlaHostHandle handle, uint pluginId, const char* filename)
1311{
1312 CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
1313 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr
1314 && handle->engine->isRunning(), "Engine is not running", false);
1315
1316 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1317 return plugin->loadStateFromFile(filename);
1318
1319 return false;
1320}
1321
1322bool carla_save_plugin_state(CarlaHostHandle handle, uint pluginId, const char* filename)
1323{
1324 CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
1325 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1326
1327 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1328 return plugin->saveStateToFile(filename);
1329
1330 return false;
1331}
1332
1333#ifndef CARLA_PLUGIN_ONLY_BRIDGE
1334bool carla_export_plugin_lv2(CarlaHostHandle handle, uint pluginId, const char* lv2path)
1335{
1336 CARLA_SAFE_ASSERT_RETURN(lv2path != nullptr && lv2path[0] != '\0', false);
1337 CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(handle->engine != nullptr, "Engine is not initialized", false);
1338
1339 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1340 return plugin->exportAsLV2(lv2path);
1341
1342 return false;
1343}
1344#endif
1345
1346// --------------------------------------------------------------------------------------------------------------------
1347
1349{
1350 static CarlaPluginInfo retInfo;
1351
1352 // reset
1353 retInfo.type = CB::PLUGIN_NONE;
1354 retInfo.category = CB::PLUGIN_CATEGORY_NONE;
1355 retInfo.hints = 0x0;
1356 retInfo.optionsAvailable = 0x0;
1357 retInfo.optionsEnabled = 0x0;
1358 retInfo.filename = gNullCharPtr;
1359 retInfo.name = gNullCharPtr;
1360 retInfo.iconName = gNullCharPtr;
1361 retInfo.uniqueId = 0;
1362
1363 // cleanup
1364 if (retInfo.label != gNullCharPtr)
1365 {
1366 delete[] retInfo.label;
1367 retInfo.label = gNullCharPtr;
1368 }
1369
1370 if (retInfo.maker != gNullCharPtr)
1371 {
1372 delete[] retInfo.maker;
1373 retInfo.maker = gNullCharPtr;
1374 }
1375
1376 if (retInfo.copyright != gNullCharPtr)
1377 {
1378 delete[] retInfo.copyright;
1379 retInfo.copyright = gNullCharPtr;
1380 }
1381
1382 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retInfo);
1383
1384 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1385 {
1386 char strBuf[STR_MAX+1];
1387 carla_zeroChars(strBuf, STR_MAX+1);
1388
1389 retInfo.type = plugin->getType();
1390 retInfo.category = plugin->getCategory();
1391 retInfo.hints = plugin->getHints();
1392 retInfo.filename = plugin->getFilename();
1393 retInfo.name = plugin->getName();
1394 retInfo.iconName = plugin->getIconName();
1395 retInfo.uniqueId = plugin->getUniqueId();
1396
1397 retInfo.optionsAvailable = plugin->getOptionsAvailable();
1398 retInfo.optionsEnabled = plugin->getOptionsEnabled();
1399
1400 if (plugin->getLabel(strBuf))
1401 retInfo.label = carla_strdup_safe(strBuf);
1402 if (plugin->getMaker(strBuf))
1403 retInfo.maker = carla_strdup_safe(strBuf);
1404 if (plugin->getCopyright(strBuf))
1405 retInfo.copyright = carla_strdup_safe(strBuf);
1406
1407 checkStringPtr(retInfo.filename);
1408 checkStringPtr(retInfo.name);
1409 checkStringPtr(retInfo.iconName);
1410 checkStringPtr(retInfo.label);
1411 checkStringPtr(retInfo.maker);
1412 checkStringPtr(retInfo.copyright);
1413 }
1414
1415 return &retInfo;
1416}
1417
1419{
1420 static CarlaPortCountInfo retInfo;
1421 carla_zeroStruct(retInfo);
1422
1423 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retInfo);
1424
1425 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1426 {
1427 retInfo.ins = plugin->getAudioInCount();
1428 retInfo.outs = plugin->getAudioOutCount();
1429 }
1430
1431 return &retInfo;
1432}
1433
1435{
1436 static CarlaPortCountInfo retInfo;
1437 carla_zeroStruct(retInfo);
1438
1439 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retInfo);
1440
1441 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1442 {
1443 retInfo.ins = plugin->getMidiInCount();
1444 retInfo.outs = plugin->getMidiOutCount();
1445 }
1446
1447 return &retInfo;
1448}
1449
1451{
1452 static CarlaPortCountInfo retInfo;
1453 carla_zeroStruct(retInfo);
1454
1455 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retInfo);
1456
1457 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1458 plugin->getParameterCountInfo(retInfo.ins, retInfo.outs);
1459
1460 return &retInfo;
1461}
1462
1464{
1465 static CarlaParameterInfo retInfo;
1466
1467 // reset
1468 retInfo.scalePointCount = 0;
1469
1470 // cleanup
1471 if (retInfo.name != gNullCharPtr)
1472 {
1473 delete[] retInfo.name;
1474 retInfo.name = gNullCharPtr;
1475 }
1476
1477 if (retInfo.symbol != gNullCharPtr)
1478 {
1479 delete[] retInfo.symbol;
1480 retInfo.symbol = gNullCharPtr;
1481 }
1482
1483 if (retInfo.unit != gNullCharPtr)
1484 {
1485 delete[] retInfo.unit;
1486 retInfo.unit = gNullCharPtr;
1487 }
1488
1489 if (retInfo.comment != gNullCharPtr)
1490 {
1491 delete[] retInfo.comment;
1492 retInfo.comment = gNullCharPtr;
1493 }
1494
1495 if (retInfo.groupName != gNullCharPtr)
1496 {
1497 delete[] retInfo.groupName;
1498 retInfo.groupName = gNullCharPtr;
1499 }
1500
1501 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retInfo);
1502
1503 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1504 {
1505 char strBuf[STR_MAX+1];
1506 carla_zeroChars(strBuf, STR_MAX+1);
1507
1508 retInfo.scalePointCount = plugin->getParameterScalePointCount(parameterId);
1509
1510 if (plugin->getParameterName(parameterId, strBuf))
1511 {
1512 retInfo.name = carla_strdup_safe(strBuf);
1513 carla_zeroChars(strBuf, STR_MAX+1);
1514 }
1515
1516 if (plugin->getParameterSymbol(parameterId, strBuf))
1517 {
1518 retInfo.symbol = carla_strdup_safe(strBuf);
1519 carla_zeroChars(strBuf, STR_MAX+1);
1520 }
1521
1522 if (plugin->getParameterUnit(parameterId, strBuf))
1523 {
1524 retInfo.unit = carla_strdup_safe(strBuf);
1525 carla_zeroChars(strBuf, STR_MAX+1);
1526 }
1527
1528 if (plugin->getParameterComment(parameterId, strBuf))
1529 {
1530 retInfo.comment = carla_strdup_safe(strBuf);
1531 carla_zeroChars(strBuf, STR_MAX+1);
1532 }
1533
1534 if (plugin->getParameterGroupName(parameterId, strBuf))
1535 {
1536 retInfo.groupName = carla_strdup_safe(strBuf);
1537 carla_zeroChars(strBuf, STR_MAX+1);
1538 }
1539
1540 checkStringPtr(retInfo.name);
1541 checkStringPtr(retInfo.symbol);
1542 checkStringPtr(retInfo.unit);
1543 checkStringPtr(retInfo.comment);
1544 checkStringPtr(retInfo.groupName);
1545 }
1546
1547 return &retInfo;
1548}
1549
1551 uint pluginId,
1552 uint32_t parameterId,
1553 uint32_t scalePointId)
1554{
1555 CARLA_ASSERT(handle->engine != nullptr);
1556
1557 static CarlaScalePointInfo retInfo;
1558
1559 // reset
1560 retInfo.value = 0.0f;
1561
1562 // cleanup
1563 if (retInfo.label != gNullCharPtr)
1564 {
1565 delete[] retInfo.label;
1566 retInfo.label = gNullCharPtr;
1567 }
1568
1569 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retInfo);
1570
1571 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1572 {
1573 char strBuf[STR_MAX+1];
1574
1575 retInfo.value = plugin->getParameterScalePointValue(parameterId, scalePointId);
1576
1577 carla_zeroChars(strBuf, STR_MAX+1);
1578 if (plugin->getParameterScalePointLabel(parameterId, scalePointId, strBuf))
1579 retInfo.label = carla_strdup_safe(strBuf);
1580
1581 checkStringPtr(retInfo.label);
1582 }
1583
1584 return &retInfo;
1585}
1586
1587// --------------------------------------------------------------------------------------------------------------------
1588
1589uint carla_get_audio_port_hints(CarlaHostHandle handle, uint pluginId, bool isOutput, uint32_t portIndex)
1590{
1591 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0x0);
1592
1593 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1594 {
1595 CARLA_SAFE_ASSERT_RETURN(portIndex < (isOutput ? plugin->getAudioOutCount() : plugin->getAudioInCount()), 0x0);
1596
1597 return plugin->getAudioPortHints(isOutput, portIndex);
1598 }
1599
1600 return 0x0;
1601}
1602
1603// --------------------------------------------------------------------------------------------------------------------
1604
1606{
1607 static ParameterData retParamData;
1608
1609 // reset
1610 retParamData.type = CB::PARAMETER_UNKNOWN;
1611 retParamData.hints = 0x0;
1612 retParamData.index = CB::PARAMETER_NULL;
1613 retParamData.rindex = -1;
1614 retParamData.midiChannel = 0;
1615 retParamData.mappedControlIndex = CB::CONTROL_INDEX_NONE;
1616 retParamData.mappedMinimum = 0.0f;
1617 retParamData.mappedMaximum = 0.0f;
1618
1619 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retParamData);
1620
1621 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1622 {
1623 CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(), &retParamData);
1624
1625 const ParameterData& pluginParamData(plugin->getParameterData(parameterId));
1626 retParamData.type = pluginParamData.type;
1627 retParamData.hints = pluginParamData.hints;
1628 retParamData.index = pluginParamData.index;
1629 retParamData.rindex = pluginParamData.rindex;
1630 retParamData.midiChannel = pluginParamData.midiChannel;
1631 retParamData.mappedControlIndex = pluginParamData.mappedControlIndex;
1632 retParamData.mappedMinimum = pluginParamData.mappedMinimum;
1633 retParamData.mappedMaximum = pluginParamData.mappedMaximum;
1634 }
1635
1636 return &retParamData;
1637}
1638
1640{
1641 static ParameterRanges retParamRanges;
1642
1643 // reset
1644 retParamRanges.def = 0.0f;
1645 retParamRanges.min = 0.0f;
1646 retParamRanges.max = 1.0f;
1647 retParamRanges.step = 0.01f;
1648 retParamRanges.stepSmall = 0.0001f;
1649 retParamRanges.stepLarge = 0.1f;
1650
1651 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retParamRanges);
1652
1653 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1654 {
1655 CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(), &retParamRanges);
1656
1657 const ParameterRanges& pluginParamRanges(plugin->getParameterRanges(parameterId));
1658 retParamRanges.def = pluginParamRanges.def;
1659 retParamRanges.min = pluginParamRanges.min;
1660 retParamRanges.max = pluginParamRanges.max;
1661 retParamRanges.step = pluginParamRanges.step;
1662 retParamRanges.stepSmall = pluginParamRanges.stepSmall;
1663 retParamRanges.stepLarge = pluginParamRanges.stepLarge;
1664 }
1665
1666 return &retParamRanges;
1667}
1668
1670{
1671 static MidiProgramData retMidiProgData = { 0, 0, gNullCharPtr };
1672
1673 // reset
1674 retMidiProgData.bank = 0;
1675 retMidiProgData.program = 0;
1676
1677 if (retMidiProgData.name != gNullCharPtr)
1678 {
1679 delete[] retMidiProgData.name;
1680 retMidiProgData.name = gNullCharPtr;
1681 }
1682
1683 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retMidiProgData);
1684
1685 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1686 {
1687 CARLA_SAFE_ASSERT_RETURN(midiProgramId < plugin->getMidiProgramCount(), &retMidiProgData);
1688
1689 const MidiProgramData& pluginMidiProgData(plugin->getMidiProgramData(midiProgramId));
1690 retMidiProgData.bank = pluginMidiProgData.bank;
1691 retMidiProgData.program = pluginMidiProgData.program;
1692
1693 if (pluginMidiProgData.name != nullptr)
1694 {
1695 retMidiProgData.name = carla_strdup_safe(pluginMidiProgData.name);
1696 checkStringPtr(retMidiProgData.name);
1697 }
1698 else
1699 {
1700 retMidiProgData.name = gNullCharPtr;
1701 }
1702 }
1703
1704 return &retMidiProgData;
1705}
1706
1707const CustomData* carla_get_custom_data(CarlaHostHandle handle, uint pluginId, uint32_t customDataId)
1708{
1709 static CustomData retCustomData = { gNullCharPtr, gNullCharPtr, gNullCharPtr };
1710
1711 // reset
1712 if (retCustomData.type != gNullCharPtr)
1713 {
1714 delete[] retCustomData.type;
1715 retCustomData.type = gNullCharPtr;
1716 }
1717
1718 if (retCustomData.key != gNullCharPtr)
1719 {
1720 delete[] retCustomData.key;
1721 retCustomData.key = gNullCharPtr;
1722 }
1723
1724 if (retCustomData.value != gNullCharPtr)
1725 {
1726 delete[] retCustomData.value;
1727 retCustomData.value = gNullCharPtr;
1728 }
1729
1730 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, &retCustomData);
1731
1732 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1733 {
1734 CARLA_SAFE_ASSERT_RETURN(customDataId < plugin->getCustomDataCount(), &retCustomData)
1735
1736 const CustomData& pluginCustomData(plugin->getCustomData(customDataId));
1737 retCustomData.type = carla_strdup_safe(pluginCustomData.type);
1738 retCustomData.key = carla_strdup_safe(pluginCustomData.key);
1739 retCustomData.value = carla_strdup_safe(pluginCustomData.value);
1740 checkStringPtr(retCustomData.type);
1741 checkStringPtr(retCustomData.key);
1742 checkStringPtr(retCustomData.value);
1743 }
1744
1745 return &retCustomData;
1746}
1747
1748const char* carla_get_custom_data_value(CarlaHostHandle handle, uint pluginId, const char* type, const char* key)
1749{
1750 CARLA_SAFE_ASSERT_RETURN(type != nullptr && type[0] != '\0', gNullCharPtr);
1751 CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0', gNullCharPtr);
1752 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, gNullCharPtr);
1753
1754 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1755 {
1756 const uint32_t count = plugin->getCustomDataCount();
1757
1758 if (count == 0)
1759 return gNullCharPtr;
1760
1761 static CarlaString customDataValue;
1762
1763 for (uint32_t i=0; i<count; ++i)
1764 {
1765 const CustomData& pluginCustomData(plugin->getCustomData(i));
1766
1767 if (std::strcmp(pluginCustomData.type, type) != 0)
1768 continue;
1769 if (std::strcmp(pluginCustomData.key, key) != 0)
1770 continue;
1771
1772 customDataValue = pluginCustomData.value;
1773 return customDataValue.buffer();
1774 }
1775 }
1776
1777 return gNullCharPtr;
1778}
1779
1780const char* carla_get_chunk_data(CarlaHostHandle handle, uint pluginId)
1781{
1782 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, gNullCharPtr);
1783
1784 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1785 {
1786 CARLA_SAFE_ASSERT_RETURN(plugin->getOptionsEnabled() & CB::PLUGIN_OPTION_USE_CHUNKS, gNullCharPtr);
1787
1788 void* data = nullptr;
1789 const std::size_t dataSize(plugin->getChunkData(&data));
1790 CARLA_SAFE_ASSERT_RETURN(data != nullptr && dataSize > 0, gNullCharPtr);
1791
1792 static CarlaString chunkData;
1793
1794 chunkData = CarlaString::asBase64(data, static_cast<std::size_t>(dataSize));
1795 return chunkData.buffer();
1796 }
1797
1798 return gNullCharPtr;
1799}
1800
1801// --------------------------------------------------------------------------------------------------------------------
1802
1804{
1805 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0);
1806
1807 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1808 return plugin->getParameterCount();
1809
1810 return 0;
1811}
1812
1814{
1815 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0);
1816
1817 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1818 return plugin->getProgramCount();
1819
1820 return 0;
1821}
1822
1824{
1825 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0);
1826
1827 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1828 return plugin->getMidiProgramCount();
1829
1830 return 0;
1831}
1832
1834{
1835 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0);
1836
1837 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1838 return plugin->getCustomDataCount();
1839
1840 return 0;
1841}
1842
1843// --------------------------------------------------------------------------------------------------------------------
1844
1845const char* carla_get_parameter_text(CarlaHostHandle handle, uint pluginId, uint32_t parameterId)
1846{
1847 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, gNullCharPtr);
1848
1849 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1850 {
1851 CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(), gNullCharPtr);
1852
1853 static char textBuf[STR_MAX+1];
1854 carla_zeroChars(textBuf, STR_MAX+1);
1855
1856 if (! plugin->getParameterText(parameterId, textBuf))
1857 textBuf[0] = '\0';
1858
1859 return textBuf;
1860 }
1861
1862 return gNullCharPtr;
1863}
1864
1865const char* carla_get_program_name(CarlaHostHandle handle, uint pluginId, uint32_t programId)
1866{
1867 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, nullptr);
1868
1869 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1870 {
1871 CARLA_SAFE_ASSERT_RETURN(programId < plugin->getProgramCount(), gNullCharPtr);
1872
1873 static char programName[STR_MAX+1];
1874 carla_zeroChars(programName, STR_MAX+1);
1875
1876 if (! plugin->getProgramName(programId, programName))
1877 programName[0] = '\0';
1878
1879 return programName;
1880 }
1881
1882 return gNullCharPtr;
1883}
1884
1885const char* carla_get_midi_program_name(CarlaHostHandle handle, uint pluginId, uint32_t midiProgramId)
1886{
1887 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, gNullCharPtr);
1888
1889 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1890 {
1891 CARLA_SAFE_ASSERT_RETURN(midiProgramId < plugin->getMidiProgramCount(), gNullCharPtr);
1892
1893 static char midiProgramName[STR_MAX+1];
1894 carla_zeroChars(midiProgramName, STR_MAX+1);
1895
1896 if (! plugin->getMidiProgramName(midiProgramId, midiProgramName))
1897 midiProgramName[0] = '\0';
1898
1899 return midiProgramName;
1900 }
1901
1902 return gNullCharPtr;
1903}
1904
1906{
1907 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, gNullCharPtr);
1908
1909 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1910 {
1911 static char realPluginName[STR_MAX+1];
1912 carla_zeroChars(realPluginName, STR_MAX+1);
1913
1914 if (! plugin->getRealName(realPluginName))
1915 realPluginName[0] = '\0';
1916
1917 return realPluginName;
1918 }
1919
1920 return gNullCharPtr;
1921}
1922
1923// --------------------------------------------------------------------------------------------------------------------
1924
1926{
1927 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, -1);
1928
1929 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1930 return plugin->getCurrentProgram();
1931
1932 return -1;
1933}
1934
1936{
1937 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, -1);
1938
1939 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1940 return plugin->getCurrentMidiProgram();
1941
1942 return -1;
1943}
1944
1945// --------------------------------------------------------------------------------------------------------------------
1946
1948{
1949 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0.0f);
1950
1951 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1952 {
1953 CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(), 0.0f);
1954
1955 return plugin->getParameterRanges(parameterId).def;
1956 }
1957
1958 return 0.0f;
1959}
1960
1962{
1963 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0.0f);
1964
1965 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1966 {
1967 CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(), 0.0f);
1968
1969 return plugin->getParameterValue(parameterId);
1970 }
1971
1972 return 0.0f;
1973}
1974
1976{
1977#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
1978 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, (parameterId == CB::PARAMETER_CTRL_CHANNEL) ? -1.0f : 0.0f);
1979#else
1980 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0.0f);
1981#endif
1982 CARLA_SAFE_ASSERT_RETURN(parameterId != CB::PARAMETER_NULL && parameterId > CB::PARAMETER_MAX, 0.0f);
1983
1984 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1985 return plugin->getInternalParameterValue(parameterId);
1986
1987 return 0.0f;
1988}
1989
1990// --------------------------------------------------------------------------------------------------------------------
1991
1993{
1994 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0);
1995
1996 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
1997 return plugin->getLatencyInFrames();
1998
1999 return 0;
2000}
2001
2002// --------------------------------------------------------------------------------------------------------------------
2003
2004const float* carla_get_peak_values(CarlaHostHandle handle, uint pluginId)
2005{
2006 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, nullptr);
2007
2008 return handle->engine->getPeaks(pluginId);
2009}
2010
2011float carla_get_input_peak_value(CarlaHostHandle handle, uint pluginId, bool isLeft)
2012{
2013 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0.0f);
2014
2015 return handle->engine->getInputPeak(pluginId, isLeft);
2016}
2017
2018float carla_get_output_peak_value(CarlaHostHandle handle, uint pluginId, bool isLeft)
2019{
2020 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0.0f);
2021
2022 return handle->engine->getOutputPeak(pluginId, isLeft);
2023}
2024
2025// --------------------------------------------------------------------------------------------------------------------
2026
2027CARLA_BACKEND_START_NAMESPACE
2028
2029#if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE))
2030// defined in CarlaPluginInternal.cpp
2031const void* carla_render_inline_display_internal(const CarlaPluginPtr& plugin, uint32_t width, uint32_t height);
2032#endif
2033
2034#ifndef CARLA_PLUGIN_ONLY_BRIDGE
2035// defined in CarlaPluginLV2.cpp
2036const void* carla_render_inline_display_lv2(const CarlaPluginPtr& plugin, uint32_t width, uint32_t height);
2037#endif
2038
2039CARLA_BACKEND_END_NAMESPACE
2040
2042 uint pluginId,
2044{
2045 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->engine->isRunning(), nullptr);
2046
2047 if (handle->engine->isAboutToClose())
2048 return nullptr;
2049
2050 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2051 {
2052 switch (plugin->getType())
2053 {
2054#if !(defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) || defined(CARLA_PLUGIN_ONLY_BRIDGE))
2055 case CB::PLUGIN_INTERNAL:
2056 return (const CarlaInlineDisplayImageSurface*)CB::carla_render_inline_display_internal(plugin, width, height);
2057#endif
2058#ifndef CARLA_PLUGIN_ONLY_BRIDGE
2059 case CB::PLUGIN_LV2:
2060 return (const CarlaInlineDisplayImageSurface*)CB::carla_render_inline_display_lv2(plugin, width, height);
2061#endif
2062 default:
2063 return nullptr;
2064 }
2065 }
2066
2067 return nullptr;
2068
2069 // maybe unused
2070 (void)width;
2071 (void)height;
2072}
2073
2074// --------------------------------------------------------------------------------------------------------------------
2075
2076void carla_set_active(CarlaHostHandle handle, uint pluginId, bool onOff)
2077{
2078 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2079
2080 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2081 plugin->setActive(onOff, true, false);
2082}
2083
2084#ifndef BUILD_BRIDGE
2085void carla_set_drywet(CarlaHostHandle handle, uint pluginId, float value)
2086{
2087 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2088
2089 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2090 plugin->setDryWet(value, true, false);
2091}
2092
2093void carla_set_volume(CarlaHostHandle handle, uint pluginId, float value)
2094{
2095 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2096
2097 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2098 plugin->setVolume(value, true, false);
2099}
2100
2102{
2103 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2104
2105 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2106 plugin->setBalanceLeft(value, true, false);
2107}
2108
2110{
2111 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2112
2113 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2114 plugin->setBalanceRight(value, true, false);
2115}
2116
2117void carla_set_panning(CarlaHostHandle handle, uint pluginId, float value)
2118{
2119 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2120
2121 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2122 plugin->setPanning(value, true, false);
2123}
2124
2125void carla_set_ctrl_channel(CarlaHostHandle handle, uint pluginId, int8_t channel)
2126{
2127 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2128 CARLA_SAFE_ASSERT_RETURN(channel >= -1 && channel < MAX_MIDI_CHANNELS,);
2129
2130 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2131 plugin->setCtrlChannel(channel, true, false);
2132}
2133#endif
2134
2135void carla_set_option(CarlaHostHandle handle, uint pluginId, uint option, bool yesNo)
2136{
2137 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2138
2139 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2140 plugin->setOption(option, yesNo, false);
2141}
2142
2143// --------------------------------------------------------------------------------------------------------------------
2144
2145void carla_set_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, float value)
2146{
2147 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2148
2149 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2150 {
2151 CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(),);
2152
2153 plugin->setParameterValue(parameterId, value, true, true, false);
2154 }
2155}
2156
2157#ifndef BUILD_BRIDGE
2158
2159void carla_set_parameter_midi_channel(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, uint8_t channel)
2160{
2161 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2163
2164 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2165 {
2166 CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(),);
2167
2168 plugin->setParameterMidiChannel(parameterId, channel, true, false);
2169 }
2170}
2171
2173{
2174 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2175 CARLA_SAFE_ASSERT_RETURN(index >= CB::CONTROL_INDEX_NONE && index <= CB::CONTROL_INDEX_MAX_ALLOWED,);
2176
2177 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2178 {
2179 CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(),);
2180
2181 plugin->setParameterMappedControlIndex(parameterId, index, true, false, true);
2182 }
2183}
2184
2185void carla_set_parameter_mapped_range(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, float minimum, float maximum)
2186{
2187 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2188
2189 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2190 {
2191 CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(),);
2192
2193 plugin->setParameterMappedRange(parameterId, minimum, maximum, true, false);
2194 }
2195}
2196
2197void carla_set_parameter_touch(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, bool touch)
2198{
2199 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2200
2201 carla_debug("carla_set_parameter_touch(%p, %i, %i, %s)", handle, pluginId, parameterId, bool2str(touch));
2202 return handle->engine->touchPluginParameter(pluginId, parameterId, touch);
2203}
2204#endif
2205
2206// --------------------------------------------------------------------------------------------------------------------
2207
2208void carla_set_program(CarlaHostHandle handle, uint pluginId, uint32_t programId)
2209{
2210 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2211
2212 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2213 {
2214 CARLA_SAFE_ASSERT_RETURN(programId < plugin->getProgramCount(),);
2215
2216 plugin->setProgram(static_cast<int32_t>(programId), true, true, false);
2217 }
2218}
2219
2220void carla_set_midi_program(CarlaHostHandle handle, uint pluginId, uint32_t midiProgramId)
2221{
2222 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2223
2224 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2225 {
2226 CARLA_SAFE_ASSERT_RETURN(midiProgramId < plugin->getMidiProgramCount(),);
2227
2228 plugin->setMidiProgram(static_cast<int32_t>(midiProgramId), true, true, false);
2229 }
2230}
2231
2232// --------------------------------------------------------------------------------------------------------------------
2233
2234void carla_set_custom_data(CarlaHostHandle handle, uint pluginId, const char* type, const char* key, const char* value)
2235{
2236 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2237 CARLA_SAFE_ASSERT_RETURN(type != nullptr && type[0] != '\0',);
2238 CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',);
2239 CARLA_SAFE_ASSERT_RETURN(value != nullptr,);
2240
2241 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2242 plugin->setCustomData(type, key, value, true);
2243}
2244
2245void carla_set_chunk_data(CarlaHostHandle handle, uint pluginId, const char* chunkData)
2246{
2247 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2248 CARLA_SAFE_ASSERT_RETURN(chunkData != nullptr && chunkData[0] != '\0',);
2249
2250 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2251 {
2252 CARLA_SAFE_ASSERT_RETURN(plugin->getOptionsEnabled() & CB::PLUGIN_OPTION_USE_CHUNKS,);
2253
2254 std::vector<uint8_t> chunk(carla_getChunkFromBase64String(chunkData));
2255#ifdef CARLA_PROPER_CPP11_SUPPORT
2256 plugin->setChunkData(chunk.data(), chunk.size());
2257#else
2258 plugin->setChunkData(&chunk.front(), chunk.size());
2259#endif
2260 }
2261}
2262
2263// --------------------------------------------------------------------------------------------------------------------
2264
2266{
2267 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2268
2269 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2270 plugin->prepareForSave(false);
2271}
2272
2274{
2275 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2276
2277 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2278 plugin->resetParameters();
2279}
2280
2282{
2283 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2284
2285 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2286 plugin->randomizeParameters();
2287}
2288
2289#ifndef BUILD_BRIDGE
2290void carla_send_midi_note(CarlaHostHandle handle, uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity)
2291{
2292 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr && handle->engine->isRunning(),);
2293
2294 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2295 plugin->sendMidiSingleNote(channel, note, velocity, true, true, false);
2296}
2297#endif
2298
2299void carla_set_custom_ui_title(CarlaHostHandle handle, uint pluginId, const char* title)
2300{
2301 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2302 CARLA_SAFE_ASSERT_RETURN(title != nullptr,);
2303
2304 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2305 plugin->setCustomUITitle(title);
2306}
2307
2308void carla_show_custom_ui(CarlaHostHandle handle, uint pluginId, bool yesNo)
2309{
2310 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr,);
2311
2312 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2313 plugin->showCustomUI(yesNo);
2314}
2315
2316void* carla_embed_custom_ui(CarlaHostHandle handle, uint pluginId, void* ptr)
2317{
2318 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, nullptr);
2319
2320 if (const CarlaPluginPtr plugin = handle->engine->getPlugin(pluginId))
2321 return plugin->embedCustomUI(ptr);
2322
2323 return nullptr;
2324}
2325
2326// --------------------------------------------------------------------------------------------------------------------
2327
2329{
2330 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0);
2331
2332 carla_debug("carla_get_buffer_size(%p)", handle);
2333 return handle->engine->getBufferSize();
2334}
2335
2337{
2338 CARLA_SAFE_ASSERT_RETURN(handle->engine != nullptr, 0.0);
2339
2340 carla_debug("carla_get_sample_rate(%p)", handle);
2341 return handle->engine->getSampleRate();
2342}
2343
2344// --------------------------------------------------------------------------------------------------------------------
2345
2347{
2348 carla_debug("carla_get_last_error(%p)", handle);
2349
2350 if (handle->engine != nullptr)
2351 return handle->engine->getLastError();
2352
2353 return handle->isStandalone
2354 ? ((CarlaHostStandalone*)handle)->lastError.buffer()
2355 : gNullCharPtr;
2356}
2357
2359{
2360 carla_debug("carla_get_host_osc_url_tcp(%p)", handle);
2361
2362#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE)
2363 if (handle->engine == nullptr)
2364 {
2365 carla_stderr2("carla_get_host_osc_url_tcp() failed, engine is not running");
2366 if (handle->isStandalone)
2367 ((CarlaHostStandalone*)handle)->lastError = "Engine is not running";
2368 return gNullCharPtr;
2369 }
2370
2371 const char* const path = handle->engine->getOscServerPathTCP();
2372
2373 if (path != nullptr && path[0] != '\0')
2374 return path;
2375
2376 static const char* const notAvailable = "(OSC TCP port not available)";
2377 return notAvailable;
2378#else
2379 return "(OSC support not available in this build)";
2380
2381 // unused
2382 (void)handle;
2383#endif
2384}
2385
2387{
2388 carla_debug("carla_get_host_osc_url_udp(%p)", handle);
2389
2390#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE)
2391 if (handle->engine == nullptr)
2392 {
2393 carla_stderr2("carla_get_host_osc_url_udp() failed, engine is not running");
2394 if (handle->isStandalone)
2395 ((CarlaHostStandalone*)handle)->lastError = "Engine is not running";
2396 return gNullCharPtr;
2397 }
2398
2399 const char* const path = handle->engine->getOscServerPathUDP();
2400
2401 if (path != nullptr && path[0] != '\0')
2402 return path;
2403
2404 static const char* const notAvailable = "(OSC UDP port not available)";
2405 return notAvailable;
2406#else
2407 return "(OSC support not available in this build)";
2408
2409 // unused
2410 (void)handle;
2411#endif
2412}
2413
2414// --------------------------------------------------------------------------------------------------------------------
2415
2416#ifndef CARLA_PLUGIN_BUILD
2417# define CARLA_PLUGIN_UI_CLASS_PREFIX Standalone
2418# include "CarlaPluginUI.cpp"
2419# undef CARLA_PLUGIN_UI_CLASS_PREFIX
2420# include "CarlaDssiUtils.cpp"
2421# include "CarlaMacUtils.cpp"
2422# include "CarlaPatchbayUtils.cpp"
2423# include "CarlaPipeUtils.cpp"
2424# include "CarlaProcessUtils.cpp"
2425# include "CarlaStateUtils.cpp"
2426# include "utils/Information.cpp"
2427# include "utils/Windows.cpp"
2428#endif /* CARLA_PLUGIN_BUILD */
2429
2430// --------------------------------------------------------------------------------------------------------------------
#define STR_MAX
Definition CarlaBackend.h:29
#define CARLA_SAFE_ASSERT_CONTINUE(cond)
Definition CarlaDefines.h:189
#define CARLA_SAFE_ASSERT_RETURN(cond, ret)
Definition CarlaDefines.h:190
unsigned int uint
Definition CarlaDefines.h:327
#define P_UINTPTR
Definition CarlaDefines.h:139
#define P_INT64
Definition CarlaDefines.h:136
#define CARLA_ASSERT(cond)
Definition CarlaDefines.h:176
#define MAX_MIDI_CHANNELS
Definition CarlaMIDI.h:21
CarlaEngine * carla_get_engine_from_handle(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:204
static void checkStringPtr(const char *&charPtr) noexcept
Definition CarlaStandalone.cpp:50
static void carla_engine_init_common(const CarlaHostStandalone &standalone, CarlaEngine *const engine)
Definition CarlaStandalone.cpp:213
const void * carla_render_inline_display_lv2(const CarlaPluginPtr &plugin, uint32_t width, uint32_t height)
Definition CarlaPluginLV2.cpp:8472
#define CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(cond, msg, ret)
Definition CarlaStandalone.cpp:37
static const char *const gNullCharPtr
Definition CarlaStandalone.cpp:48
CARLA_BACKEND_START_NAMESPACE const void * carla_render_inline_display_internal(const CarlaPluginPtr &plugin, uint32_t width, uint32_t height)
Definition CarlaPluginNative.cpp:3189
#define noexcept
Definition DistrhoDefines.h:72
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
static void copyright()
Definition adplugdb.cpp:261
static char strBuf[kStrBufSize+1]
Definition buffers.cpp:40
Definition File.h:50
@ currentExecutableFile
Definition File.h:649
File getChildFile(StringRef relativeOrAbsolutePath) const
Definition File.cpp:418
const String & getFullPathName() const noexcept
Definition File.h:152
static File getSpecialLocation(const SpecialLocationType type)
Definition File.cpp:1642
Definition File.h:50
const String & getFullPathName() const noexcept
Definition File.h:152
const char * toRawUTF8() const
Definition String.cpp:1925
register unsigned i
Definition inflate.c:1575
unsigned f
Definition inflate.c:1572
static char filename[]
Definition features.c:5
void(* EngineCallbackFunc)(void *ptr, EngineCallbackOpcode action, uint pluginId, int value1, int value2, int value3, float valuef, const char *valueStr)
Definition CarlaBackend.h:1710
const char *(* FileCallbackFunc)(void *ptr, FileCallbackOpcode action, bool isDir, const char *title, const char *filter)
Definition CarlaBackend.h:1718
PluginType
Definition CarlaBackend.h:614
BinaryType
Definition CarlaBackend.h:550
struct _ParameterRanges ParameterRanges
EngineOption
Definition CarlaBackend.h:1333
struct _CustomData CustomData
Definition CarlaStateUtils.cpp:153
@ PLUGIN_NONE
Definition CarlaBackend.h:618
@ PLUGIN_CATEGORY_NONE
Definition CarlaBackend.h:708
void carla_set_file_callback(CarlaHostHandle handle, FileCallbackFunc func, void *ptr)
Definition CarlaStandalone.cpp:1016
const ParameterData * carla_get_parameter_data(CarlaHostHandle handle, uint pluginId, uint32_t parameterId)
Definition CarlaStandalone.cpp:1605
void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func, void *ptr)
Definition CarlaStandalone.cpp:677
bool carla_clone_plugin(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1279
void carla_set_option(CarlaHostHandle handle, uint pluginId, uint option, bool yesNo)
Definition CarlaStandalone.cpp:2135
const char * carla_get_host_osc_url_udp(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:2386
const char * carla_get_current_project_folder(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1065
const CustomData * carla_get_custom_data(CarlaHostHandle handle, uint pluginId, uint32_t customDataId)
Definition CarlaStandalone.cpp:1707
const float * carla_get_peak_values(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:2004
const CarlaTransportInfo * carla_get_transport_info(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1187
struct _CarlaScalePointInfo CarlaScalePointInfo
const EngineDriverDeviceInfo * carla_get_engine_driver_device_info(uint index, const char *name)
Definition CarlaStandalone.cpp:160
void carla_set_volume(CarlaHostHandle handle, uint pluginId, float value)
Definition CarlaStandalone.cpp:2093
bool carla_engine_close(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:511
struct _CarlaParameterInfo CarlaParameterInfo
void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int value, const char *valueStr)
Definition CarlaStandalone.cpp:697
const CarlaPortCountInfo * carla_get_parameter_count_info(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1450
void carla_set_ctrl_channel(CarlaHostHandle handle, uint pluginId, int8_t channel)
Definition CarlaStandalone.cpp:2125
bool carla_load_plugin_state(CarlaHostHandle handle, uint pluginId, const char *filename)
Definition CarlaStandalone.cpp:1310
const char * carla_get_current_project_filename(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1077
void carla_set_program(CarlaHostHandle handle, uint pluginId, uint32_t programId)
Definition CarlaStandalone.cpp:2208
const ParameterRanges * carla_get_parameter_ranges(CarlaHostHandle handle, uint pluginId, uint32_t parameterId)
Definition CarlaStandalone.cpp:1639
float carla_get_current_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId)
Definition CarlaStandalone.cpp:1961
float carla_get_default_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId)
Definition CarlaStandalone.cpp:1947
void carla_prepare_for_save(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:2265
void carla_transport_bpm(CarlaHostHandle handle, double bpm)
Definition CarlaStandalone.cpp:1162
bool carla_patchbay_disconnect(CarlaHostHandle handle, bool external, uint connectionId)
Definition CarlaStandalone.cpp:1110
CarlaHostHandle carla_standalone_host_init(void)
Definition CarlaStandalone.cpp:193
CARLA_BACKEND_END_NAMESPACE const CarlaInlineDisplayImageSurface * carla_render_inline_display(CarlaHostHandle handle, uint pluginId, uint32_t width, uint32_t height)
Definition CarlaStandalone.cpp:2041
const char *const * carla_get_engine_driver_device_names(uint index)
Definition CarlaStandalone.cpp:153
int32_t carla_get_current_program_index(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1925
void carla_set_custom_ui_title(CarlaHostHandle handle, uint pluginId, const char *title)
Definition CarlaStandalone.cpp:2299
bool carla_patchbay_refresh(CarlaHostHandle handle, bool external)
Definition CarlaStandalone.cpp:1133
bool carla_rename_plugin(CarlaHostHandle handle, uint pluginId, const char *newName)
Definition CarlaStandalone.cpp:1269
float carla_get_input_peak_value(CarlaHostHandle handle, uint pluginId, bool isLeft)
Definition CarlaStandalone.cpp:2011
void carla_reset_parameters(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:2273
const char * carla_get_real_plugin_name(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1905
bool carla_save_plugin_state(CarlaHostHandle handle, uint pluginId, const char *filename)
Definition CarlaStandalone.cpp:1322
void carla_set_parameter_mapped_range(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, float minimum, float maximum)
Definition CarlaStandalone.cpp:2185
bool carla_load_project(CarlaHostHandle handle, const char *filename)
Definition CarlaStandalone.cpp:1044
void carla_cancel_engine_action(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:663
void carla_transport_relocate(CarlaHostHandle handle, uint64_t frame)
Definition CarlaStandalone.cpp:1171
bool carla_patchbay_connect(CarlaHostHandle handle, bool external, uint groupIdA, uint portIdA, uint groupIdB, uint portIdB)
Definition CarlaStandalone.cpp:1100
struct _CarlaHostHandle * CarlaHostHandle
Definition CarlaHost.h:354
bool carla_export_plugin_lv2(CarlaHostHandle handle, uint pluginId, const char *lv2path)
Definition CarlaStandalone.cpp:1334
struct _CarlaPortCountInfo CarlaPortCountInfo
const char * carla_get_host_osc_url_tcp(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:2358
uint32_t carla_get_midi_program_count(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1823
const char * carla_get_program_name(CarlaHostHandle handle, uint pluginId, uint32_t programId)
Definition CarlaStandalone.cpp:1865
void * carla_embed_custom_ui(CarlaHostHandle handle, uint pluginId, void *ptr)
Definition CarlaStandalone.cpp:2316
struct _CarlaTransportInfo CarlaTransportInfo
const CarlaPluginInfo * carla_get_plugin_info(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1348
uint32_t carla_get_program_count(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1813
uint32_t carla_get_max_plugin_number(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1223
void carla_set_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, float value)
Definition CarlaStandalone.cpp:2145
void carla_send_midi_note(CarlaHostHandle handle, uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity)
Definition CarlaStandalone.cpp:2290
void carla_set_midi_program(CarlaHostHandle handle, uint pluginId, uint32_t midiProgramId)
Definition CarlaStandalone.cpp:2220
void carla_engine_idle(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:543
uint32_t carla_get_custom_data_count(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1833
const CarlaParameterInfo * carla_get_parameter_info(CarlaHostHandle handle, uint pluginId, uint32_t parameterId)
Definition CarlaStandalone.cpp:1463
struct _CarlaRuntimeEngineInfo CarlaRuntimeEngineInfo
bool carla_set_engine_about_to_close(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:669
void carla_set_chunk_data(CarlaHostHandle handle, uint pluginId, const char *chunkData)
Definition CarlaStandalone.cpp:2245
bool carla_add_plugin(CarlaHostHandle handle, BinaryType btype, PluginType ptype, const char *filename, const char *name, const char *label, int64_t uniqueId, const void *extraPtr, uint options)
Definition CarlaStandalone.cpp:1234
uint32_t carla_get_plugin_latency(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1992
bool carla_load_file(CarlaHostHandle handle, const char *filename)
Definition CarlaStandalone.cpp:1034
void carla_set_custom_data(CarlaHostHandle handle, uint pluginId, const char *type, const char *key, const char *value)
Definition CarlaStandalone.cpp:2234
bool carla_engine_init(CarlaHostHandle handle, const char *driverName, const char *clientName)
Definition CarlaStandalone.cpp:394
void carla_transport_pause(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1153
const CarlaPortCountInfo * carla_get_midi_port_count_info(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1434
bool carla_replace_plugin(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1288
void carla_set_active(CarlaHostHandle handle, uint pluginId, bool onOff)
Definition CarlaStandalone.cpp:2076
void carla_set_panning(CarlaHostHandle handle, uint pluginId, float value)
Definition CarlaStandalone.cpp:2117
bool carla_remove_plugin(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1250
bool carla_save_project(CarlaHostHandle handle, const char *filename)
Definition CarlaStandalone.cpp:1054
void carla_set_parameter_touch(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, bool touch)
Definition CarlaStandalone.cpp:2197
bool carla_patchbay_set_group_pos(CarlaHostHandle handle, bool external, uint groupId, int x1, int y1, int x2, int y2)
Definition CarlaStandalone.cpp:1119
const char * carla_get_parameter_text(CarlaHostHandle handle, uint pluginId, uint32_t parameterId)
Definition CarlaStandalone.cpp:1845
bool carla_remove_all_plugins(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1259
void carla_randomize_parameters(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:2281
struct _CarlaPluginInfo CarlaPluginInfo
void carla_set_parameter_midi_channel(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, uint8_t channel)
Definition CarlaStandalone.cpp:2159
float carla_get_internal_parameter_value(CarlaHostHandle handle, uint pluginId, int32_t parameterId)
Definition CarlaStandalone.cpp:1975
void carla_set_drywet(CarlaHostHandle handle, uint pluginId, float value)
Definition CarlaStandalone.cpp:2085
void carla_transport_play(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1144
void carla_show_custom_ui(CarlaHostHandle handle, uint pluginId, bool yesNo)
Definition CarlaStandalone.cpp:2308
uint carla_get_engine_driver_count()
Definition CarlaStandalone.cpp:139
bool carla_set_engine_buffer_size_and_sample_rate(CarlaHostHandle handle, uint bufferSize, double sampleRate)
Definition CarlaStandalone.cpp:640
const char * carla_get_engine_driver_name(uint index)
Definition CarlaStandalone.cpp:146
void carla_set_balance_right(CarlaHostHandle handle, uint pluginId, float value)
Definition CarlaStandalone.cpp:2109
bool carla_show_engine_device_control_panel(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:648
const CarlaRuntimeEngineInfo * carla_get_runtime_engine_info(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:560
bool carla_show_engine_driver_device_control_panel(uint index, const char *name)
Definition CarlaStandalone.cpp:186
const char * carla_get_chunk_data(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1780
bool carla_is_engine_running(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:555
const MidiProgramData * carla_get_midi_program_data(CarlaHostHandle handle, uint pluginId, uint32_t midiProgramId)
Definition CarlaStandalone.cpp:1669
const CarlaRuntimeEngineDriverDeviceInfo * carla_get_runtime_engine_driver_device_info(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:577
const CarlaScalePointInfo * carla_get_parameter_scalepoint_info(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, uint32_t scalePointId)
Definition CarlaStandalone.cpp:1550
bool carla_switch_plugins(CarlaHostHandle handle, uint pluginIdA, uint pluginIdB)
Definition CarlaStandalone.cpp:1297
const char * carla_get_last_error(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:2346
const CarlaPortCountInfo * carla_get_audio_port_count_info(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1418
const char * carla_get_custom_data_value(CarlaHostHandle handle, uint pluginId, const char *type, const char *key)
Definition CarlaStandalone.cpp:1748
int32_t carla_get_current_midi_program_index(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1935
double carla_get_sample_rate(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:2336
float carla_get_output_peak_value(CarlaHostHandle handle, uint pluginId, bool isLeft)
Definition CarlaStandalone.cpp:2018
void carla_set_balance_left(CarlaHostHandle handle, uint pluginId, float value)
Definition CarlaStandalone.cpp:2101
void carla_set_parameter_mapped_control_index(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, int16_t index)
Definition CarlaStandalone.cpp:2172
const char * carla_get_midi_program_name(CarlaHostHandle handle, uint pluginId, uint32_t midiProgramId)
Definition CarlaStandalone.cpp:1885
uint carla_get_audio_port_hints(CarlaHostHandle handle, uint pluginId, bool isOutput, uint32_t portIndex)
Definition CarlaStandalone.cpp:1589
uint32_t carla_get_parameter_count(CarlaHostHandle handle, uint pluginId)
Definition CarlaStandalone.cpp:1803
uint32_t carla_get_current_plugin_count(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1213
uint64_t carla_get_current_transport_frame(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1180
uint32_t carla_get_buffer_size(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:2328
void carla_clear_engine_xruns(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:657
void carla_clear_project_filename(CarlaHostHandle handle)
Definition CarlaStandalone.cpp:1089
static PuglViewHint int value
Definition pugl.h:1708
static const char * title
Definition pugl.h:1747
static const char * name
Definition pugl.h:1582
static int int height
Definition pugl.h:1594
static int width
Definition pugl.h:1593
JSAMPIMAGE data
Definition jpeglib.h:945
int int32_t
Definition mid.cpp:97
unsigned int uint32_t
Definition mid.cpp:100
short int16_t
Definition mid.cpp:96
unsigned char uint8_t
Definition mid.cpp:98
signed char int8_t
Definition mid.cpp:95
void initialiseJuce_GUI()
Definition carla_juce.cpp:37
void shutdownJuce_GUI()
Definition carla_juce.cpp:52
void idleJuce_GUI()
Definition carla_juce.cpp:45
#define false
Definition ordinals.h:83
png_const_structrp png_const_inforp int * unit
Definition png.h:2161
const char * symbol
Definition CarlaHost.h:178
const char * comment
Definition CarlaHost.h:188
uint32_t scalePointCount
Definition CarlaHost.h:199
const char * name
Definition CarlaHost.h:173
const char * unit
Definition CarlaHost.h:183
const char * groupName
Definition CarlaHost.h:193
uint optionsAvailable
Definition CarlaHost.h:86
const char * label
Definition CarlaHost.h:111
uint optionsEnabled
Definition CarlaHost.h:93
int64_t uniqueId
Definition CarlaHost.h:133
PluginCategory category
Definition CarlaHost.h:74
const char * name
Definition CarlaHost.h:106
const char * maker
Definition CarlaHost.h:116
uint hints
Definition CarlaHost.h:80
const char * iconName
Definition CarlaHost.h:127
PluginType type
Definition CarlaHost.h:69
const char * copyright
Definition CarlaHost.h:121
const char * filename
Definition CarlaHost.h:99
uint32_t outs
Definition CarlaHost.h:161
uint32_t ins
Definition CarlaHost.h:156
uint32_t xruns
Definition CarlaHost.h:299
float load
Definition CarlaHost.h:294
float value
Definition CarlaHost.h:220
const char * label
Definition CarlaHost.h:225
double bpm
Definition CarlaHost.h:271
uint64_t frame
Definition CarlaHost.h:251
int32_t bar
Definition CarlaHost.h:256
int32_t beat
Definition CarlaHost.h:261
int32_t tick
Definition CarlaHost.h:266
bool playing
Definition CarlaHost.h:246
const char * key
Definition CarlaBackend.h:1959
const char * type
Definition CarlaBackend.h:1953
const char * value
Definition CarlaBackend.h:1964
float stepSmall
Definition CarlaBackend.h:1802
float stepLarge
Definition CarlaBackend.h:1807
float def
Definition CarlaBackend.h:1782
float max
Definition CarlaBackend.h:1792
float step
Definition CarlaBackend.h:1797
float min
Definition CarlaBackend.h:1787
Definition CarlaHost.h:346
Definition CarlaHost.h:306
double sampleRate
Definition CarlaHost.h:332
const char * name
Definition CarlaHost.h:310
uint bufferSize
Definition CarlaHost.h:321
const uint32_t * bufferSizes
Definition CarlaHost.h:327
uint hints
Definition CarlaHost.h:316
const double * sampleRates
Definition CarlaHost.h:338
Definition CarlaBackend.h:1984
const double * sampleRates
Definition CarlaBackend.h:2001
const uint32_t * bufferSizes
Definition CarlaBackend.h:1995
uint hints
Definition CarlaBackend.h:1989
Definition CarlaBackend.h:1927
uint32_t program
Definition CarlaBackend.h:1936
const char * name
Definition CarlaBackend.h:1941
uint32_t bank
Definition CarlaBackend.h:1931
Definition CarlaBackend.h:1723
ParameterType type
Definition CarlaBackend.h:1727
uint8_t midiChannel
Definition CarlaBackend.h:1749
int32_t index
Definition CarlaBackend.h:1738
float mappedMaximum
Definition CarlaBackend.h:1765
int32_t rindex
Definition CarlaBackend.h:1743
float mappedMinimum
Definition CarlaBackend.h:1760
uint hints
Definition CarlaBackend.h:1733
int16_t mappedControlIndex
Definition CarlaBackend.h:1755
Definition mygetopt.h:88
ZCONST char * key
Definition crypt.c:587
#define void
Definition unzip.h:396
_WDL_CSTRING_PREFIX void INT_PTR count
Definition wdlcstring.h:263