MostlyHarmless 0.0.1
Loading...
Searching...
No Matches
mostly_harmless::core::IEngine Class Referenceabstract

Interface for the plugin's audio processing functionality. More...

#include <mostlyharmless_IEngine.h>

Public Member Functions

virtual ~IEngine () noexcept=default
virtual void initialise (InitContext context) noexcept=0
virtual void process (ProcessContext context) noexcept=0
virtual void reset () noexcept=0
virtual void handleNoteOn (std::uint16_t portIndex, std::uint8_t channel, std::uint8_t note, double velocity)
virtual void handleNoteOff (std::uint16_t portIndex, std::uint8_t channel, std::uint8_t note, double velocity)
virtual void handleControlChange (std::uint16_t portIndex, std::uint8_t channel, std::uint8_t controlNumber, std::uint8_t data)
virtual void handleProgramChange (std::uint16_t portIndex, std::uint8_t channel, std::uint8_t programNumber)
virtual void handlePolyAftertouch (std::uint16_t portIndex, std::uint8_t channel, std::uint8_t note, std::uint8_t pressure)
virtual void handleChannelAftertouch (std::uint16_t portIndex, std::uint8_t channel, std::uint8_t pressure)
virtual void handlePitchWheel (std::uint16_t portIndex, std::uint8_t channel, double value)

Detailed Description

Interface for the plugin's audio processing functionality.

As detailed in the FX Plugin tutorial, users must implement this, ISharedState, IPluginEntry, and optionally IEditor, and register their subclasses with the framework to create an audio plugin. These will also be created if using the provided create.py script.

Encapsulates all things audio-thread related, and all functions either run on the audio thread, or are guaranteed not to be called while the audio thread is running.

You probably want your subclass to take a pointer to your subclass of ISharedState, for access to parameters, and the procToGui / guiToProc queues.

Constructor & Destructor Documentation

◆ ~IEngine()

virtual mostly_harmless::core::IEngine::~IEngine ( )
virtualdefaultnoexcept

Virtual destructor.

Member Function Documentation

◆ handleChannelAftertouch()

virtual void mostly_harmless::core::IEngine::handleChannelAftertouch ( std::uint16_t portIndex,
std::uint8_t channel,
std::uint8_t pressure )
inlinevirtual

Called if the plugin receives a (channel-wide) aftertouch event. In this case, all notes within a channel get the same pressure value. Not pure virtual, as this function isn't relevant if you haven't requested midi functionality. Called on the audio thread, in response to a channel aftertouch event.

Parameters
portIndexThe clap port index the event originated from.
channelThe midi channel the event was passed to
pressureThe pressure applied to this midi note

◆ handleControlChange()

virtual void mostly_harmless::core::IEngine::handleControlChange ( std::uint16_t portIndex,
std::uint8_t channel,
std::uint8_t controlNumber,
std::uint8_t data )
inlinevirtual

Called if the plugin receives a midi control change event - not pure virtual, as this function isn't relevant if you haven't requested midi functionality. Called on the audio thread, in response to a control change event. Some of the identifiers here are reserved for special controls (mod wheel etc) - we don't do any handling of this framework side, so have a google if you need this info!

Parameters
portIndexThe clap port index the event originated from.
channelThe midi channel the event was passed to
controlNumberThe midi control that was changed
dataThe data in the midi message - see the midi spec for interpreting this.

◆ handleNoteOff()

virtual void mostly_harmless::core::IEngine::handleNoteOff ( std::uint16_t portIndex,
std::uint8_t channel,
std::uint8_t note,
double velocity )
inlinevirtual

Called if the plugin receives a midi (or clap) note off event - not pure virtual, as this function isn't relevant if you haven't requested midi functionality. Called on the audio thread, in response to a noteOff event.

Parameters
portIndexThe clap port index the event originated from.
channelThe midi channel the event was passed to
noteThe 0-127 midi note that was turned off.
velocityThe 0-1 velocity of the note event

◆ handleNoteOn()

virtual void mostly_harmless::core::IEngine::handleNoteOn ( std::uint16_t portIndex,
std::uint8_t channel,
std::uint8_t note,
double velocity )
inlinevirtual

Called if the plugin receives a midi (or clap) note on event - not pure virtual, as this function isn't relevant if you haven't requested midi functionality. Called on the audio thread, in response to a noteOn event.

Parameters
portIndexThe clap port index the event originated from.
channelThe midi channel the event was passed to
noteThe 0-127 midi note that was turned on.
velocityThe 0-1 velocity of the note event

◆ handlePitchWheel()

virtual void mostly_harmless::core::IEngine::handlePitchWheel ( std::uint16_t portIndex,
std::uint8_t channel,
double value )
inlinevirtual

Called if the plugin receives a pitch wheel event - not pure virtual, as this function isn't relevant if you haven't requested midi functionality. Called on the audio thread, in response to a pitch wheel event.

Parameters
portIndexThe clap port index the event originated from.
channelThe midi channel the event was passed to
valueThe value, between -1.0 and 1.0

◆ handlePolyAftertouch()

virtual void mostly_harmless::core::IEngine::handlePolyAftertouch ( std::uint16_t portIndex,
std::uint8_t channel,
std::uint8_t note,
std::uint8_t pressure )
inlinevirtual

Called if the plugin receives a (polyphonic) aftertouch event (polyphonic in the sense that each note can have its own pressure data). Not pure virtual, as this function isn't relevant if you haven't requested midi functionality. Called on the audio thread, in response to a poly aftertouch event.

Parameters
portIndexThe clap port index the event originated from.
channelThe midi channel the event was passed to
noteThe midi note this aftertouch event applies to
pressureThe pressure applied to this midi note

◆ handleProgramChange()

virtual void mostly_harmless::core::IEngine::handleProgramChange ( std::uint16_t portIndex,
std::uint8_t channel,
std::uint8_t programNumber )
inlinevirtual

Called if the plugin receives a program change event - not pure virtual, as this function isn't relevant if you haven't requested midi functionality. Called on the audio thread, in response to a program change event.

Parameters
portIndexThe clap port index the event originated from.
channelThe midi channel the event was passed to
programNumberThe program number that was set

◆ initialise()

virtual void mostly_harmless::core::IEngine::initialise ( InitContext context)
pure virtualnoexcept

Called when the host is preparing to play. Any sample-rate-dependent resizing etc should be done here. Will probably not be called on the audio thread, but is guaranteed to not be called concurrently with the audio thread.

Parameters
contextAn InitContext containing various settings provided by the host.

◆ process()

virtual void mostly_harmless::core::IEngine::process ( ProcessContext context)
pure virtualnoexcept

The main audio callback function - any DSP processing should stem from this function. Called on the audio thread.

Parameters
contextA ProcessContext containing a non-owning view into the current buffer region, and an optional for transport info.

◆ reset()

virtual void mostly_harmless::core::IEngine::reset ( )
pure virtualnoexcept

Called to cleanup any resources that require cleaning up - use this to clear delay lines / temp buffers, etc etc.


The documentation for this class was generated from the following file: