18 #ifndef CARLA_PLUGIN_HPP_INCLUDED
19 #define CARLA_PLUGIN_HPP_INCLUDED
29 struct LADSPA_RDF_Descriptor;
33 CARLA_BACKEND_START_NAMESPACE
52 class CarlaEngineBridge;
53 struct CarlaStateSave;
97 virtual PluginType getType()
const noexcept = 0;
104 uint getId()
const noexcept;
111 uint getHints()
const noexcept;
118 uint getOptionsEnabled()
const noexcept;
126 bool isEnabled()
const noexcept;
134 const char* getName()
const noexcept;
140 const char* getFilename()
const noexcept;
145 const char* getIconName()
const noexcept;
156 virtual int64_t getUniqueId()
const noexcept;
161 virtual uint32_t getLatencyInFrames()
const noexcept;
169 uint32_t getAudioInCount()
const noexcept;
174 uint32_t getAudioOutCount()
const noexcept;
179 uint32_t getCVInCount()
const noexcept;
184 uint32_t getCVOutCount()
const noexcept;
189 virtual uint32_t getMidiInCount()
const noexcept;
194 virtual uint32_t getMidiOutCount()
const noexcept;
200 uint32_t getParameterCount()
const noexcept;
205 virtual uint32_t getParameterScalePointCount(uint32_t parameterId)
const noexcept;
210 uint32_t getProgramCount()
const noexcept;
215 uint32_t getMidiProgramCount()
const noexcept;
220 uint32_t getCustomDataCount()
const noexcept;
230 int32_t getCurrentProgram()
const noexcept;
238 int32_t getCurrentMidiProgram()
const noexcept;
243 const ParameterData& getParameterData(uint32_t parameterId)
const noexcept;
248 const ParameterRanges& getParameterRanges(uint32_t parameterId)
const noexcept;
253 bool isParameterOutput(uint32_t parameterId)
const noexcept;
260 const MidiProgramData& getMidiProgramData(uint32_t index)
const noexcept;
267 const CustomData& getCustomData(uint32_t index)
const noexcept;
277 virtual std::size_t getChunkData(
void** dataPtr) noexcept;
287 virtual uint getOptionsAvailable()
const noexcept;
292 virtual float getParameterValue(uint32_t parameterId)
const noexcept;
297 virtual float getParameterScalePointValue(uint32_t parameterId, uint32_t scalePointId)
const noexcept;
302 __attribute__((warn_unused_result))
303 virtual bool getLabel(
char* strBuf)
const noexcept;
308 __attribute__((warn_unused_result))
309 virtual bool getMaker(
char* strBuf)
const noexcept;
314 __attribute__((warn_unused_result))
315 virtual bool getCopyright(
char* strBuf)
const noexcept;
322 __attribute__((warn_unused_result))
323 virtual bool getRealName(
char* strBuf)
const noexcept;
328 __attribute__((warn_unused_result))
329 virtual
bool getParameterName(uint32_t parameterId,
char* strBuf) const noexcept;
334 __attribute__((warn_unused_result))
335 virtual
bool getParameterSymbol(uint32_t parameterId,
char* strBuf) const noexcept;
341 __attribute__((warn_unused_result))
342 virtual
bool getParameterText(uint32_t parameterId,
char* strBuf) noexcept;
347 __attribute__((warn_unused_result))
348 virtual
bool getParameterUnit(uint32_t parameterId,
char* strBuf) const noexcept;
353 __attribute__((warn_unused_result))
354 virtual
bool getParameterComment(uint32_t parameterId,
char* strBuf) const noexcept;
360 __attribute__((warn_unused_result))
361 virtual
bool getParameterGroupName(uint32_t parameterId,
char* strBuf) const noexcept;
366 __attribute__((warn_unused_result))
367 virtual
bool getParameterScalePointLabel(uint32_t parameterId, uint32_t scalePointId,
char* strBuf) const noexcept;
374 float getInternalParameterValue(int32_t parameterId) const noexcept;
379 __attribute__((warn_unused_result))
380 bool getProgramName(uint32_t index,
char* strBuf) const noexcept;
387 __attribute__((warn_unused_result))
388 bool getMidiProgramName(uint32_t index,
char* strBuf) const noexcept;
398 void getParameterCountInfo(uint32_t& ins, uint32_t& outs) const noexcept;
408 virtual
void prepareForSave(
bool temporary);
413 virtual
void resetParameters() noexcept;
418 virtual
void randomizeParameters() noexcept;
426 const CarlaStateSave& getStateSave(
bool callPrepareForSave = true);
433 void loadStateSave(const CarlaStateSave& stateSave);
440 bool saveStateToFile(const
char* filename);
447 bool loadStateFromFile(const
char* filename);
452 bool exportAsLV2(const
char* lv2path);
463 virtual
void setId(uint newId) noexcept;
470 virtual
void setName(const
char* newName);
477 virtual
void setOption(uint option,
bool yesNo,
bool sendCallback);
485 void setEnabled(
bool yesNo) noexcept;
493 void setActive(
bool active,
bool sendOsc,
bool sendCallback) noexcept;
495 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
503 void setDryWet(
float value,
bool sendOsc,
bool sendCallback) noexcept;
512 void setVolume(
float value,
bool sendOsc,
bool sendCallback) noexcept;
523 void setBalanceLeft(
float value,
bool sendOsc,
bool sendCallback) noexcept;
534 void setBalanceRight(
float value,
bool sendOsc,
bool sendCallback) noexcept;
545 void setPanning(
float value,
bool sendOsc,
bool sendCallback) noexcept;
550 void setDryWetRT(
float value,
bool sendCallbackLater) noexcept;
551 void setVolumeRT(
float value,
bool sendCallbackLater) noexcept;
552 void setBalanceLeftRT(
float value,
bool sendCallbackLater) noexcept;
553 void setBalanceRightRT(
float value,
bool sendCallbackLater) noexcept;
554 void setPanningRT(
float value,
bool sendCallbackLater) noexcept;
555 #endif // ! BUILD_BRIDGE_ALTERNATIVE_ARCH
563 virtual void setCtrlChannel(int8_t channel,
bool sendOsc,
bool sendCallback) noexcept;
579 virtual void setParameterValue(uint32_t parameterId,
float value,
bool sendGui,
bool sendOsc,
bool sendCallback) noexcept;
584 virtual void setParameterValueRT(uint32_t parameterId,
float value,
bool sendCallbackLater) noexcept;
597 void setParameterValueByRealIndex(int32_t rindex,
float value,
bool sendGui,
bool sendOsc,
bool sendCallback) noexcept;
603 virtual void setParameterMidiChannel(uint32_t parameterId, uint8_t channel,
bool sendOsc,
bool sendCallback) noexcept;
609 virtual void setParameterMappedControlIndex(uint32_t parameterId, int16_t index,
610 bool sendOsc,
bool sendCallback,
bool reconfigureNow) noexcept;
615 virtual void setParameterMappedRange(uint32_t parameterId,
float minimum,
float maximum,
616 bool sendOsc,
bool sendCallback) noexcept;
629 virtual void setCustomData(
const char* type,
const char* key,
const char* value,
bool sendGui);
638 virtual void setChunkData(
const void* data, std::size_t dataSize);
651 virtual void setProgram(int32_t index,
bool sendGui,
bool sendOsc,
bool sendCallback,
bool doingInit =
false) noexcept;
664 virtual
void setMidiProgram(int32_t index,
bool sendGui,
bool sendOsc,
bool sendCallback,
bool doingInit = false) noexcept;
670 void setMidiProgramById(uint32_t bank, uint32_t program,
bool sendGui,
bool sendOsc,
bool sendCallback) noexcept;
675 virtual
void setProgramRT(uint32_t index,
bool sendCallbackLater) noexcept;
676 virtual
void setMidiProgramRT(uint32_t index,
bool sendCallbackLater) noexcept;
685 virtual
void reload() = 0;
690 virtual
void reloadPrograms(
bool doInit);
699 virtual
void activate() noexcept;
704 virtual
void deactivate() noexcept;
710 virtual
void process(const
float* const* audioIn,
float** audioOut,
711 const
float* const* cvIn,
float** cvOut, uint32_t frames) = 0;
716 virtual
void bufferSizeChanged(uint32_t newBufferSize);
721 virtual
void sampleRateChanged(
double newSampleRate);
726 virtual
void offlineModeChanged(
bool isOffline);
741 bool tryLock(
bool forcedOffline) noexcept;
746 void unlock() noexcept;
754 virtual
void initBuffers() const noexcept;
759 virtual
void clearBuffers() noexcept;
768 virtual
void handleOscMessage(const
char* method,
782 void sendMidiSingleNote(uint8_t channel, uint8_t note, uint8_t velo,
783 bool sendGui,
bool sendOsc,
bool sendCallback);
785 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
791 void postponeRtAllNotesOff();
800 virtual void setCustomUITitle(
const char* title) noexcept;
806 virtual void showCustomUI(
bool yesNo);
813 virtual void* embedCustomUI(
void* ptr);
820 virtual void uiIdle();
826 virtual void uiParameterChange(uint32_t index,
float value) noexcept;
832 virtual void uiProgramChange(uint32_t index) noexcept;
838 virtual void uiMidiProgramChange(uint32_t index) noexcept;
844 virtual void uiNoteOn(uint8_t channel, uint8_t note, uint8_t velo) noexcept;
850 virtual void uiNoteOff(uint8_t channel, uint8_t note) noexcept;
895 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
900 void checkForMidiLearn(
EngineEvent& event) noexcept;
907 virtual void* getNativeHandle() const noexcept;
913 virtual const
void* getNativeDescriptor() const noexcept;
918 virtual uintptr_t getUiBridgeProcessId() const noexcept;
926 uint32_t getPatchbayNodeId() const noexcept;
932 void setPatchbayNodeId(uint32_t nodeId) noexcept;
943 return BINARY_NATIVE;
958 const char*
const filename;
959 const char*
const name;
960 const char*
const label;
961 const int64_t uniqueId;
968 const char* binaryArchName,
const char* bridgeBinary);
970 static CarlaPluginPtr newLADSPA(
const Initializer& init,
const LADSPA_RDF_Descriptor* rdfDescriptor);
990 struct ProtectedData;
991 ProtectedData*
const pData;
1000 virtual void cloneLV2Files(
const CarlaPlugin& other);
1007 virtual void restoreLV2State(
bool temporary) noexcept;
1012 virtual void prepareForDeletion() noexcept;
1017 virtual
void waitForBridgeSaveSignal() noexcept;
1036 CARLA_PREVENT_HEAP_ALLOCATION
1055 CARLA_PREVENT_HEAP_ALLOCATION
1060 friend class CarlaEngineBridge;
1068 CARLA_BACKEND_END_NAMESPACE
1070 #endif // CARLA_PLUGIN_HPP_INCLUDED