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.

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