Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

991 lines
26KB

  1. /*
  2. * Carla Engine API
  3. * Copyright (C) 2012-2013 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 GPL.txt file
  16. */
  17. #ifndef __CARLA_ENGINE_HPP__
  18. #define __CARLA_ENGINE_HPP__
  19. #include "carla_backend.hpp"
  20. #include "carla_utils.hpp"
  21. #ifdef BUILD_BRIDGE
  22. struct CarlaOscData;
  23. #else
  24. class QProcessEnvironment;
  25. #endif
  26. CARLA_BACKEND_START_NAMESPACE
  27. #if 0
  28. } // Fix editor indentation
  29. #endif
  30. // -----------------------------------------------------------------------
  31. /*!
  32. * The type of an engine.
  33. */
  34. enum EngineType {
  35. /*!
  36. * Null engine type.
  37. */
  38. kEngineTypeNull = 0,
  39. /*!
  40. * JACK engine type.\n
  41. * Provides all processing modes.
  42. */
  43. kEngineTypeJack = 1,
  44. /*!
  45. * RtAudio engine type, used to provide Native Audio and MIDI support.
  46. */
  47. kEngineTypeRtAudio = 2,
  48. /*!
  49. * Plugin engine type, used to export the engine as a plugin (DSSI, LV2 and VST) via the DISTRHO Plugin Toolkit.
  50. */
  51. kEngineTypePlugin = 3
  52. };
  53. /*!
  54. * The type of an engine port.
  55. */
  56. enum EnginePortType {
  57. /*!
  58. * Null port type.
  59. */
  60. kEnginePortTypeNull = 0,
  61. /*!
  62. * Audio port type.
  63. * \see CarlaEngineAudioPort
  64. */
  65. kEnginePortTypeAudio = 1,
  66. /*!
  67. * Event port type.
  68. ** \see CarlaEngineEventPort
  69. */
  70. kEnginePortTypeEvent = 2
  71. };
  72. /*!
  73. * The type of an engine event.
  74. */
  75. enum EngineEventType {
  76. /*!
  77. * Null port type.
  78. */
  79. kEngineEventTypeNull = 0,
  80. /*!
  81. * Control event type.
  82. * \see EngineControlEvent
  83. */
  84. kEngineEventTypeControl = 1,
  85. /*!
  86. * MIDI event type.
  87. * \see EngineMidiEvent
  88. */
  89. kEngineEventTypeMidi = 2
  90. };
  91. /*!
  92. * The type of an engine control event.
  93. */
  94. enum EngineControlEventType {
  95. /*!
  96. * Null event type.
  97. */
  98. kEngineControlEventTypeNull = 0,
  99. /*!
  100. * Parameter event type.\n
  101. * \note Value uses a range of 0.0<->1.0.
  102. */
  103. kEngineControlEventTypeParameter = 1,
  104. /*!
  105. * MIDI Bank event type.
  106. */
  107. kEngineControlEventTypeMidiBank = 2,
  108. /*!
  109. * MIDI Program change event type.
  110. */
  111. kEngineControlEventTypeMidiProgram = 3,
  112. /*!
  113. * All sound off event type.
  114. */
  115. kEngineControlEventTypeAllSoundOff = 4,
  116. /*!
  117. * All notes off event type.
  118. */
  119. kEngineControlEventTypeAllNotesOff = 5
  120. };
  121. /*!
  122. * Engine control event.
  123. */
  124. struct EngineControlEvent {
  125. EngineControlEventType type; //!< Control-Event type.
  126. uint16_t parameter; //!< Parameter ID, midi bank or midi program.
  127. double value; //!< Parameter value.
  128. EngineControlEvent()
  129. {
  130. clear();
  131. }
  132. void clear()
  133. {
  134. type = kEngineControlEventTypeNull;
  135. parameter = 0;
  136. value = 0.0;
  137. }
  138. };
  139. /*!
  140. * Engine MIDI event.
  141. */
  142. struct EngineMidiEvent {
  143. uint8_t port; //!< Port offset (usually 0)
  144. uint8_t data[3]; //!< MIDI data, without channel
  145. uint8_t size; //!< Number of bytes used
  146. EngineMidiEvent()
  147. {
  148. clear();
  149. }
  150. void clear()
  151. {
  152. port = 0;
  153. data[0] = data[1] = data[2] = 0;
  154. size = 0;
  155. }
  156. };
  157. /*!
  158. * Engine event.
  159. */
  160. struct EngineEvent {
  161. EngineEventType type; //!< Event Type; either Control or MIDI
  162. uint32_t time; //!< Time offset in frames
  163. uint8_t channel; //!< Channel, used for MIDI-related events
  164. union {
  165. EngineControlEvent ctrl;
  166. EngineMidiEvent midi;
  167. };
  168. EngineEvent()
  169. {
  170. clear();
  171. }
  172. void clear()
  173. {
  174. type = kEngineEventTypeNull;
  175. time = 0;
  176. channel = 0;
  177. }
  178. };
  179. // -----------------------------------------------------------------------
  180. /*!
  181. * Engine options.
  182. */
  183. struct EngineOptions {
  184. ProcessMode processMode;
  185. bool forceStereo;
  186. bool preferPluginBridges;
  187. bool preferUiBridges;
  188. #ifdef WANT_DSSI
  189. bool useDssiVstChunks;
  190. #endif
  191. uint maxParameters;
  192. uint oscUiTimeout;
  193. uint preferredBufferSize;
  194. uint preferredSampleRate;
  195. #ifndef BUILD_BRIDGE
  196. CarlaString bridge_native;
  197. CarlaString bridge_posix32;
  198. CarlaString bridge_posix64;
  199. CarlaString bridge_win32;
  200. CarlaString bridge_win64;
  201. #endif
  202. #ifdef WANT_LV2
  203. CarlaString bridge_lv2gtk2;
  204. CarlaString bridge_lv2gtk3;
  205. CarlaString bridge_lv2qt4;
  206. CarlaString bridge_lv2qt5;
  207. CarlaString bridge_lv2cocoa;
  208. CarlaString bridge_lv2win;
  209. CarlaString bridge_lv2x11;
  210. #endif
  211. #ifdef WANT_VST
  212. CarlaString bridge_vstcocoa;
  213. CarlaString bridge_vsthwnd;
  214. CarlaString bridge_vstx11;
  215. #endif
  216. EngineOptions()
  217. : processMode(PROCESS_MODE_CONTINUOUS_RACK),
  218. forceStereo(false),
  219. preferPluginBridges(false),
  220. preferUiBridges(true),
  221. #ifdef WANT_DSSI
  222. useDssiVstChunks(false),
  223. #endif
  224. maxParameters(MAX_DEFAULT_PARAMETERS),
  225. oscUiTimeout(4000),
  226. preferredBufferSize(512),
  227. preferredSampleRate(44100) {}
  228. };
  229. /*!
  230. * Engine BBT Time information.
  231. */
  232. struct EngineTimeInfoBBT {
  233. int32_t bar; //!< current bar
  234. int32_t beat; //!< current beat-within-bar
  235. int32_t tick; //!< current tick-within-beat
  236. double barStartTick;
  237. float beatsPerBar; //!< time signature "numerator"
  238. float beatType; //!< time signature "denominator"
  239. double ticksPerBeat;
  240. double beatsPerMinute;
  241. EngineTimeInfoBBT()
  242. : bar(0),
  243. beat(0),
  244. tick(0),
  245. barStartTick(0.0),
  246. beatsPerBar(0.0f),
  247. beatType(0.0f),
  248. ticksPerBeat(0.0),
  249. beatsPerMinute(0.0) {}
  250. };
  251. /*!
  252. * Engine Time information.
  253. */
  254. struct EngineTimeInfo {
  255. static const uint32_t ValidBBT = 0x1;
  256. bool playing;
  257. uint32_t frame;
  258. uint32_t time;
  259. uint32_t valid;
  260. EngineTimeInfoBBT bbt;
  261. EngineTimeInfo()
  262. : playing(false),
  263. frame(0),
  264. time(0),
  265. valid(0x0) {}
  266. void clear()
  267. {
  268. playing = false;
  269. frame = 0;
  270. time = 0;
  271. valid = 0x0;
  272. }
  273. };
  274. // -----------------------------------------------------------------------
  275. /*!
  276. * Carla Engine port (Abstract).\n
  277. * This is the base class for all Carla Engine ports.
  278. */
  279. class CarlaEnginePort
  280. {
  281. public:
  282. /*!
  283. * The contructor.\n
  284. * Param \a isInput defines wherever this is an input port or not (output otherwise).\n
  285. * Input/output state and process mode are constant for the lifetime of the port.
  286. */
  287. CarlaEnginePort(const bool isInput, const ProcessMode processMode);
  288. /*!
  289. * The decontructor.
  290. */
  291. virtual ~CarlaEnginePort();
  292. /*!
  293. * Get the type of the port, as provided by the respective subclasses.
  294. */
  295. virtual EnginePortType type() const = 0;
  296. /*!
  297. * Initialize the port's internal buffer for \a engine.
  298. */
  299. virtual void initBuffer(CarlaEngine* const engine) = 0;
  300. protected:
  301. const bool kIsInput;
  302. const ProcessMode kProcessMode;
  303. private:
  304. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEnginePort)
  305. };
  306. // -----------------------------------------------------------------------
  307. /*!
  308. * Carla Engine Audio port.
  309. */
  310. class CarlaEngineAudioPort : public CarlaEnginePort
  311. {
  312. public:
  313. /*!
  314. * The contructor.\n
  315. * All constructor parameters are constant and will never change in the lifetime of the port.
  316. */
  317. CarlaEngineAudioPort(const bool isInput, const ProcessMode processMode);
  318. /*!
  319. * The decontructor.
  320. */
  321. virtual ~CarlaEngineAudioPort();
  322. /*!
  323. * Get the type of the port, in this case CarlaEnginePortTypeAudio.
  324. */
  325. EnginePortType type() const
  326. {
  327. return kEnginePortTypeAudio;
  328. }
  329. /*!
  330. * Initialize the port's internal buffer for \a engine.
  331. */
  332. virtual void initBuffer(CarlaEngine* const engine);
  333. /*!
  334. * Direct access to the port's audio buffer.
  335. */
  336. float* getBuffer() const
  337. {
  338. return fBuffer;
  339. }
  340. protected:
  341. float* fBuffer;
  342. private:
  343. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineAudioPort)
  344. };
  345. // -----------------------------------------------------------------------
  346. /*!
  347. * Carla Engine Event port.
  348. */
  349. class CarlaEngineEventPort : public CarlaEnginePort
  350. {
  351. public:
  352. /*!
  353. * The contructor.\n
  354. * All constructor parameters are constant and will never change in the lifetime of the port.
  355. */
  356. CarlaEngineEventPort(const bool isInput, const ProcessMode processMode);
  357. /*!
  358. * The decontructor.
  359. */
  360. virtual ~CarlaEngineEventPort();
  361. /*!
  362. * Get the type of the port, in this case CarlaEnginePortTypeControl.
  363. */
  364. EnginePortType type() const
  365. {
  366. return kEnginePortTypeEvent;
  367. }
  368. /*!
  369. * Initialize the port's internal buffer for \a engine.
  370. */
  371. virtual void initBuffer(CarlaEngine* const engine);
  372. /*!
  373. * Get the number of events present in the buffer.
  374. * \note You must only call this for input ports.
  375. */
  376. virtual uint32_t getEventCount();
  377. /*!
  378. * Get the event at \a index.
  379. ** \note You must only call this for input ports.
  380. */
  381. virtual const EngineEvent* getEvent(const uint32_t index);
  382. /*!
  383. * Write a control event into the buffer.\n
  384. * Arguments are the same as in the EngineControlEvent struct.
  385. ** \note You must only call this for output ports.
  386. */
  387. virtual void writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t parameter, const double value = 0.0);
  388. /*!
  389. * Write a MIDI event into the buffer.\n
  390. * Arguments are the same as in the EngineMidiEvent struct.
  391. ** \note You must only call this for output ports.
  392. */
  393. virtual void writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t* const data, const uint8_t size);
  394. private:
  395. const uint32_t kMaxEventCount;
  396. EngineEvent* fBuffer;
  397. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineEventPort)
  398. };
  399. // -----------------------------------------------------------------------
  400. /*!
  401. * Carla Engine client (Abstract).\n
  402. * Each plugin requires one client from the engine (created via CarlaEngine::addPort()).\n
  403. * \note This is a virtual class, each engine type provides its own funtionality.
  404. */
  405. class CarlaEngineClient
  406. {
  407. protected:
  408. /*!
  409. * The constructor, protected.\n
  410. * All constructor parameters are constant and will never change in the lifetime of the client.\n
  411. * Client starts in deactivated state.
  412. */
  413. CarlaEngineClient(const CarlaBackend::EngineType engineType, const CarlaBackend::ProcessMode processMode);
  414. public:
  415. /*!
  416. * The destructor.
  417. */
  418. virtual ~CarlaEngineClient();
  419. /*!
  420. * Activate this client.\n
  421. * Client must be deactivated before calling this function.
  422. */
  423. virtual void activate();
  424. /*!
  425. * Deactivate this client.\n
  426. * Client must be activated before calling this function.
  427. */
  428. virtual void deactivate();
  429. /*!
  430. * Check if the client is activated.
  431. */
  432. virtual bool isActive() const;
  433. /*!
  434. * Check if the client is ok.\n
  435. * Plugins will refuse to instantiate if this returns false.
  436. * \note This is always true in rack and patchbay processing modes.
  437. */
  438. virtual bool isOk() const;
  439. /*!
  440. * Get the current latency, in samples.
  441. */
  442. virtual uint32_t getLatency() const;
  443. /*!
  444. * Change the client's latency.
  445. */
  446. virtual void setLatency(const uint32_t samples);
  447. /*!
  448. * Add a new port of type \a portType.
  449. * \note This function does nothing in rack processing mode since ports are static there (2 audio + 1 event for both input and output).
  450. */
  451. virtual const CarlaEnginePort* addPort(const EnginePortType portType, const char* const name, const bool isInput) = 0;
  452. protected:
  453. const EngineType kEngineType;
  454. const ProcessMode kProcessMode;
  455. private:
  456. bool fActive;
  457. uint32_t fLatency;
  458. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineClient)
  459. };
  460. // -----------------------------------------------------------------------
  461. /*!
  462. * Private data used in CarlaEngine.
  463. * Non-engine code MUST NEVER have direct access to this.
  464. */
  465. struct CarlaEngineProtectedData;
  466. /*!
  467. * Carla Engine.
  468. * \note This is a virtual class for all available engine types available in Carla.
  469. */
  470. class CarlaEngine
  471. {
  472. protected:
  473. /*!
  474. * The constructor, protected.\n
  475. * \note This only initializes engine data, it doesn't initialize the engine itself.
  476. */
  477. CarlaEngine();
  478. public:
  479. /*!
  480. * The decontructor.
  481. * The engine must have been closed before this happens.
  482. */
  483. virtual ~CarlaEngine();
  484. // -------------------------------------------------------------------
  485. // Static values and calls
  486. /*!
  487. * Get the number of available engine drivers.
  488. */
  489. static unsigned int getDriverCount();
  490. /*!
  491. * Get the name of the engine driver at \a index.
  492. */
  493. static const char* getDriverName(unsigned int index);
  494. /*!
  495. * Create a new engine, using driver \a driverName.\n
  496. * Returned variable must be deleted when no longer needed.
  497. */
  498. static CarlaEngine* newDriverByName(const char* const driverName);
  499. // -------------------------------------------------------------------
  500. // Constant values
  501. /*!
  502. * Maximum client name size.
  503. */
  504. virtual unsigned int maxClientNameSize() const;
  505. /*!
  506. * Maximum port name size.
  507. */
  508. virtual unsigned int maxPortNameSize() const;
  509. /*!
  510. * Current number of plugins loaded.
  511. */
  512. unsigned int currentPluginCount() const;
  513. /*!
  514. * Maximum number of loadable plugins allowed.
  515. * \note This function returns 0 if engine is not started.
  516. */
  517. unsigned int maxPluginNumber() const;
  518. // -------------------------------------------------------------------
  519. // Virtual, per-engine type calls
  520. /*!
  521. * Initialize engine, using \a clientName.
  522. */
  523. virtual bool init(const char* const clientName);
  524. /*!
  525. * Close engine.
  526. */
  527. virtual bool close();
  528. /*!
  529. * Idle.
  530. */
  531. virtual void idle();
  532. /*!
  533. * Check if engine is running.
  534. */
  535. virtual bool isRunning() const = 0;
  536. /*!
  537. * Check if engine is running offline (aka freewheel mode).
  538. */
  539. virtual bool isOffline() const = 0;
  540. /*!
  541. * Get engine type.
  542. */
  543. virtual EngineType type() const = 0;
  544. /*!
  545. * Add new engine client.
  546. * \note This must only be called within a plugin class.
  547. */
  548. virtual CarlaEngineClient* addClient(CarlaPlugin* const plugin) = 0;
  549. // -------------------------------------------------------------------
  550. // Plugin management
  551. /*!
  552. * Get plugin with id \a id.
  553. */
  554. CarlaPlugin* getPlugin(const unsigned int id) const;
  555. /*!
  556. * Get plugin with id \a id, faster unchecked version.
  557. */
  558. CarlaPlugin* getPluginUnchecked(const unsigned int id) const;
  559. /*!
  560. * Get a unique plugin name within the engine.\n
  561. * Returned variable must NOT be free'd.
  562. */
  563. const char* getNewUniquePluginName(const char* const name);
  564. /*!
  565. * Add new plugin.\n
  566. * Returns the id of the plugin, or -1 if the operation failed.
  567. */
  568. bool addPlugin(const BinaryType btype, const PluginType ptype, const char* const filename, const char* const name, const char* const label, const void* const extra = nullptr);
  569. /*!
  570. * Add new plugin, using native binary type.\n
  571. * Returns the id of the plugin, or -1 if the operation failed.
  572. */
  573. bool addPlugin(const PluginType ptype, const char* const filename, const char* const name, const char* const label, const void* const extra = nullptr)
  574. {
  575. return addPlugin(BINARY_NATIVE, ptype, filename, name, label, extra);
  576. }
  577. /*!
  578. * Remove plugin with id \a id.
  579. */
  580. bool removePlugin(const unsigned int id);
  581. /*!
  582. * Remove all plugins.
  583. */
  584. void removeAllPlugins();
  585. // bridge, internal use only
  586. // TODO - find a better way for this
  587. //void __bridgePluginRegister(const unsigned short id, CarlaPlugin* const plugin);
  588. //{
  589. // m_carlaPlugins[id] = plugin;
  590. //}
  591. // -------------------------------------------------------------------
  592. // Information (base)
  593. /*!
  594. * Get engine name.
  595. */
  596. const char* getName() const
  597. {
  598. return (const char*)fName;
  599. }
  600. /*!
  601. * Get current buffer size.
  602. */
  603. uint32_t getBufferSize() const
  604. {
  605. return fBufferSize;
  606. }
  607. /*!
  608. * Get current sample rate.
  609. */
  610. double getSampleRate() const
  611. {
  612. return fSampleRate;
  613. }
  614. /*!
  615. * Get the engine options (read-only).
  616. */
  617. const EngineOptions& getOptions() const
  618. {
  619. return fOptions;
  620. }
  621. ProcessMode getProccessMode() const
  622. {
  623. return fOptions.processMode;
  624. }
  625. /*!
  626. * Get current Time information (read-only).
  627. */
  628. const EngineTimeInfo& getTimeInfo() const
  629. {
  630. return fTimeInfo;
  631. }
  632. /*!
  633. * Tell the engine it's about to close.\n
  634. * This is used to prevent the engine thread(s) from reactivating.
  635. */
  636. void setAboutToClose();
  637. /*!
  638. * Safely block wait until the current proccessing callback ends.
  639. */
  640. void waitForProccessEnd();
  641. #if 0
  642. // -------------------------------------------------------------------
  643. // Information (audio peaks)
  644. double getInputPeak(const unsigned short pluginId, const unsigned short id) const;
  645. double getOutputPeak(const unsigned short pluginId, const unsigned short id) const;
  646. void setInputPeak(const unsigned short pluginId, const unsigned short id, double value);
  647. void setOutputPeak(const unsigned short pluginId, const unsigned short id, double value);
  648. #endif
  649. // -------------------------------------------------------------------
  650. // Callback
  651. /*!
  652. * TODO.
  653. */
  654. void callback(const CallbackType action, const unsigned short pluginId, const int value1, const int value2, const float value3, const char* const valueStr);
  655. /*!
  656. * TODO.
  657. */
  658. void setCallback(const CallbackFunc func, void* const ptr);
  659. // -------------------------------------------------------------------
  660. // Error handling
  661. /*!
  662. * Get last error.
  663. */
  664. const char* getLastError() const;
  665. /*!
  666. * Set last error.
  667. */
  668. void setLastError(const char* const error);
  669. // -------------------------------------------------------------------
  670. // Options
  671. #ifndef BUILD_BRIDGE
  672. /*!
  673. * Get the engine options as process environment.
  674. */
  675. const QProcessEnvironment& getOptionsAsProcessEnvironment() const;
  676. /*!
  677. * Set the engine option \a option.
  678. */
  679. void setOption(const OptionsType option, const int value, const char* const valueStr);
  680. #endif
  681. // -------------------------------------------------------------------
  682. // OSC Stuff
  683. #ifdef BUILD_BRIDGE
  684. /*!
  685. * Check if OSC bridge is registered.
  686. */
  687. bool isOscBridgeRegistered() const;
  688. #else
  689. /*!
  690. * Check if OSC controller is registered.
  691. */
  692. bool isOscControlRegistered() const;
  693. #endif
  694. /*!
  695. * Idle OSC.
  696. */
  697. void idleOsc();
  698. /*!
  699. * Get OSC TCP server path.
  700. */
  701. const char* getOscServerPathTCP() const;
  702. /*!
  703. * Get OSC UDP server path.
  704. */
  705. const char* getOscServerPathUDP() const;
  706. #ifdef BUILD_BRIDGE
  707. /*!
  708. * Set OSC bridge data.
  709. */
  710. void setOscBridgeData(const CarlaOscData* const oscData);
  711. #endif
  712. // -------------------------------------
  713. protected:
  714. uint32_t fBufferSize;
  715. double fSampleRate;
  716. CarlaString fName;
  717. EngineOptions fOptions;
  718. EngineTimeInfo fTimeInfo;
  719. ScopedPointer<CarlaEngineProtectedData> const fData;
  720. /*!
  721. * Report to all plugins about buffer size change.
  722. */
  723. void bufferSizeChanged(const uint32_t newBufferSize);
  724. /*!
  725. * Report to all plugins about sample rate change.\n
  726. * This is not supported on all plugin types, on which case they will be re-initiated.\n
  727. * TODO: Not implemented yet.
  728. */
  729. void sampleRateChanged(const double newSampleRate);
  730. /*!
  731. * TODO.
  732. */
  733. void proccessPendingEvents();
  734. #ifndef BUILD_BRIDGE
  735. // Rack mode data
  736. EngineEvent* getRackEventBuffer(const bool isInput);
  737. //static const unsigned short MAX_EVENTS = 1024;
  738. //EngineEvent fRackEventsIn[MAX_EVENTS];
  739. //EngineEvent fRackEventsOut[MAX_EVENTS];
  740. /*!
  741. * Proccess audio buffer in rack mode.
  742. */
  743. void processRack(float* inBuf[2], float* outBuf[2], const uint32_t frames);
  744. /*!
  745. * Proccess audio buffer in patchbay mode.
  746. * In \a bufCount, [0]=inBufCount and [1]=outBufCount
  747. */
  748. void processPatchbay(float** inBuf, float** outBuf, const uint32_t bufCount[2], const uint32_t frames);
  749. #endif
  750. private:
  751. #ifdef WANT_JACK
  752. static CarlaEngine* newJack();
  753. #endif
  754. #ifdef WANT_RTAUDIO
  755. enum RtAudioApi {
  756. RTAUDIO_DUMMY = 0,
  757. RTAUDIO_LINUX_ALSA = 1,
  758. RTAUDIO_LINUX_PULSE = 2,
  759. RTAUDIO_LINUX_OSS = 3,
  760. RTAUDIO_UNIX_JACK = 4,
  761. RTAUDIO_MACOSX_CORE = 5,
  762. RTAUDIO_WINDOWS_ASIO = 6,
  763. RTAUDIO_WINDOWS_DS = 7
  764. };
  765. static CarlaEngine* newRtAudio(const RtAudioApi api);
  766. static unsigned int getRtAudioApiCount();
  767. static const char* getRtAudioApiName(unsigned int index);
  768. #endif
  769. public:
  770. #ifdef BUILD_BRIDGE
  771. void osc_send_peaks(CarlaPlugin* const plugin);
  772. #else
  773. void osc_send_peaks(CarlaPlugin* const plugin, const unsigned short& id);
  774. #endif
  775. #ifdef BUILD_BRIDGE
  776. void osc_send_bridge_audio_count(const int32_t ins, const int32_t outs, const int32_t total);
  777. void osc_send_bridge_midi_count(const int32_t ins, const int32_t outs, const int32_t total);
  778. void osc_send_bridge_parameter_count(const int32_t ins, const int32_t outs, const int32_t total);
  779. void osc_send_bridge_program_count(const int32_t count);
  780. void osc_send_bridge_midi_program_count(const int32_t count);
  781. void osc_send_bridge_plugin_info(const int32_t category, const int32_t hints, const char* const name, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId);
  782. void osc_send_bridge_parameter_info(const int32_t index, const char* const name, const char* const unit);
  783. void osc_send_bridge_parameter_data(const int32_t index, const int32_t type, const int32_t rindex, const int32_t hints, const int32_t midiChannel, const int32_t midiCC);
  784. void osc_send_bridge_parameter_ranges(const int32_t index, const double def, const double min, const double max, const double step, const double stepSmall, const double stepLarge);
  785. void osc_send_bridge_program_info(const int32_t index, const char* const name);
  786. void osc_send_bridge_midi_program_info(const int32_t index, const int32_t bank, const int32_t program, const char* const label);
  787. void osc_send_bridge_configure(const char* const key, const char* const value);
  788. void osc_send_bridge_set_parameter_value(const int32_t index, const double value);
  789. void osc_send_bridge_set_default_value(const int32_t index, const double value);
  790. void osc_send_bridge_set_program(const int32_t index);
  791. void osc_send_bridge_set_midi_program(const int32_t index);
  792. void osc_send_bridge_set_custom_data(const char* const type, const char* const key, const char* const value);
  793. void osc_send_bridge_set_chunk_data(const char* const chunkFile);
  794. void osc_send_bridge_set_inpeak(const int32_t portId);
  795. void osc_send_bridge_set_outpeak(const int32_t portId);
  796. #else
  797. void osc_send_control_add_plugin_start(const int32_t pluginId, const char* const pluginName);
  798. void osc_send_control_add_plugin_end(const int32_t pluginId);
  799. void osc_send_control_remove_plugin(const int32_t pluginId);
  800. void osc_send_control_set_plugin_data(const int32_t pluginId, const int32_t type, const int32_t category, const int32_t hints, const char* const realName, const char* const label, const char* const maker, const char* const copyright, const int64_t uniqueId);
  801. void osc_send_control_set_plugin_ports(const int32_t pluginId, const int32_t audioIns, const int32_t audioOuts, const int32_t midiIns, const int32_t midiOuts, const int32_t cIns, const int32_t cOuts, const int32_t cTotals);
  802. void osc_send_control_set_parameter_data(const int32_t pluginId, const int32_t index, const int32_t type, const int32_t hints, const char* const name, const char* const label, const double current);
  803. void osc_send_control_set_parameter_ranges(const int32_t pluginId, const int32_t index, const double min, const double max, const double def, const double step, const double stepSmall, const double stepLarge);
  804. void osc_send_control_set_parameter_midi_cc(const int32_t pluginId, const int32_t index, const int32_t cc);
  805. void osc_send_control_set_parameter_midi_channel(const int32_t pluginId, const int32_t index, const int32_t channel);
  806. void osc_send_control_set_parameter_value(const int32_t pluginId, const int32_t index, const double value);
  807. void osc_send_control_set_default_value(const int32_t pluginId, const int32_t index, const double value);
  808. void osc_send_control_set_program(const int32_t pluginId, const int32_t index);
  809. void osc_send_control_set_program_count(const int32_t pluginId, const int32_t count);
  810. void osc_send_control_set_program_name(const int32_t pluginId, const int32_t index, const char* const name);
  811. void osc_send_control_set_midi_program(const int32_t pluginId, const int32_t index);
  812. void osc_send_control_set_midi_program_count(const int32_t pluginId, const int32_t count);
  813. void osc_send_control_set_midi_program_data(const int32_t pluginId, const int32_t index, const int32_t bank, const int32_t program, const char* const name);
  814. void osc_send_control_note_on(const int32_t pluginId, const int32_t channel, const int32_t note, const int32_t velo);
  815. void osc_send_control_note_off(const int32_t pluginId, const int32_t channel, const int32_t note);
  816. void osc_send_control_set_input_peak_value(const int32_t pluginId, const int32_t portId);
  817. void osc_send_control_set_output_peak_value(const int32_t pluginId, const int32_t portId);
  818. void osc_send_control_exit();
  819. #endif
  820. private:
  821. friend class CarlaEngineEventPort;
  822. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngine)
  823. };
  824. // -----------------------------------------------------------------------
  825. /**@}*/
  826. CARLA_BACKEND_END_NAMESPACE
  827. #endif // __CARLA_ENGINE_HPP__