![]() |
Mema
Memory Matrix — multi-channel audio matrix monitor and router
|
Core audio processor — owns the AudioDeviceManager, routing matrix, plugin host, and IPC server. More...
#include <MemaProcessor.h>
Inheritance diagram for Mema::MemaProcessor:
Collaboration diagram for Mema::MemaProcessor:Public Member Functions | |
| MemaProcessor (XmlElement *stateXml) | |
| Constructs the processor, optionally restoring state from XML. | |
| ~MemaProcessor () | |
| void | addInputListener (ProcessorDataAnalyzer::Listener *listener) |
| Registers a listener to receive input-channel level/spectrum data from the input analyzer. | |
| void | removeInputListener (ProcessorDataAnalyzer::Listener *listener) |
| Unregisters a previously added input analyzer listener. | |
| void | addOutputListener (ProcessorDataAnalyzer::Listener *listener) |
| Registers a listener to receive output-channel level/spectrum data from the output analyzer. | |
| void | removeOutputListener (ProcessorDataAnalyzer::Listener *listener) |
| Unregisters a previously added output analyzer listener. | |
| void | addInputCommander (MemaInputCommander *commander) |
| Adds an input commander and immediately pushes the current mute states to it. | |
| void | initializeInputCommander (MemaInputCommander *commander) |
| Pushes the current input mute states to a commander that was already registered. | |
| void | removeInputCommander (MemaInputCommander *commander) |
| Removes a previously registered input commander. | |
| void | addOutputCommander (MemaOutputCommander *commander) |
| Adds an output commander and immediately pushes the current mute states to it. | |
| void | initializeOutputCommander (MemaOutputCommander *commander) |
| Pushes the current output mute states to an already-registered commander. | |
| void | removeOutputCommander (MemaOutputCommander *comander) |
| Removes a previously registered output commander. | |
| void | addCrosspointCommander (MemaCrosspointCommander *commander) |
| Adds a crosspoint commander and immediately pushes the full crosspoint state to it. | |
| void | initializeCrosspointCommander (MemaCrosspointCommander *commander) |
| Pushes the current crosspoint enable/gain matrix to an already-registered commander. | |
| void | removeCrosspointCommander (MemaCrosspointCommander *comander) |
| Removes a previously registered crosspoint commander. | |
| void | addPluginCommander (MemaPluginCommander *commander) |
| Adds a plugin commander and immediately pushes the current parameter infos and values. | |
| void | initializePluginCommander (MemaPluginCommander *commander) |
| Pushes the current plugin parameter descriptors and values to an already-registered commander. | |
| void | removePluginCommander (MemaPluginCommander *commander) |
| Removes a previously registered plugin commander. | |
| void | updateCommanders () |
| Forces all registered commanders to re-synchronise with the current processor state. | |
| bool | getInputMuteState (std::uint16_t channelNumber) |
| Returns the mute state of a specific input channel. | |
| void | setInputMuteState (std::uint16_t channelNumber, bool muted, MemaChannelCommander *sender=nullptr, int userId=-1) |
| Sets the mute state of an input channel and notifies all commanders except the sender. | |
| bool | getMatrixCrosspointEnabledValue (std::uint16_t inputNumber, std::uint16_t outputNumber) |
| Returns whether a specific crosspoint node is enabled (routing active). | |
| void | setMatrixCrosspointEnabledValue (std::uint16_t inputNumber, std::uint16_t outputNumber, bool enabled, MemaChannelCommander *sender=nullptr, int userId=-1) |
| Enables or disables a crosspoint routing node. | |
| float | getMatrixCrosspointFactorValue (std::uint16_t inputNumber, std::uint16_t outputNumber) |
| Returns the linear gain factor of a crosspoint node. | |
| void | setMatrixCrosspointFactorValue (std::uint16_t inputNumber, std::uint16_t outputNumber, float factor, MemaChannelCommander *sender=nullptr, int userId=-1) |
| Sets the linear gain factor of a crosspoint node. | |
| float | getPluginParameterValue (std::uint16_t pluginParameterIndex) const |
| Returns the current normalised value of a hosted plugin parameter. | |
| void | setPluginParameterValue (std::uint16_t pluginParameterIndex, std::string id, float normalizedValue, MemaPluginCommander *sender=nullptr, int userId=-1) |
| Sets a hosted plugin parameter to a normalised value. | |
| bool | getOutputMuteState (std::uint16_t channelNumber) |
| Returns the mute state of a specific output channel. | |
| void | setOutputMuteState (std::uint16_t channelNumber, bool muted, MemaChannelCommander *sender=nullptr, int userId=-1) |
| Sets the mute state of an output channel and notifies all commanders except the sender. | |
| void | setChannelCounts (std::uint16_t inputChannelCount, std::uint16_t outputChannelCount) |
| Resizes all internal routing structures for a new input/output channel count. | |
| bool | setPlugin (const juce::PluginDescription &pluginDescription) |
| Loads and instantiates a plugin from the given description. | |
| juce::PluginDescription | getPluginDescription () |
| Returns the JUCE description of the currently loaded plugin. | |
| void | setPluginEnabledState (bool enabled) |
| Enables or disables plugin processing without unloading the plugin instance. | |
| bool | isPluginEnabled () |
Returns true when a plugin is loaded and its processing is enabled. | |
| void | setPluginPrePostState (bool post) |
| Selects whether the plugin processes audio before or after the crosspoint matrix. | |
| bool | isPluginPost () |
Returns true when the plugin is inserted post-matrix. | |
| void | clearPlugin () |
| Unloads the hosted plugin, closes its editor window, and resets all plugin commander state. | |
| void | openPluginEditor () |
Opens (or raises) the plugin's editor UI in a floating ResizeableWindowWithTitleBarAndCloseCallback window. | |
| void | closePluginEditor (bool deleteEditorWindow=true) |
| Closes the plugin editor window. | |
| std::vector< PluginParameterInfo > & | getPluginParameterInfos () |
| Returns a mutable reference to the loaded plugin's parameter descriptor list. | |
| void | setPluginParameterRemoteControlInfos (int pluginParameterIndex, bool remoteControllable, ParameterControlType type, int steps) |
| Marks a plugin parameter as remotely controllable (or not) and sets its control widget type. | |
| bool | isPluginParameterRemoteControllable (int parameterIndex) |
Returns true if the given parameter is flagged as remotely controllable. | |
| juce::AudioProcessorParameter * | getPluginParameter (int parameterIndex) const |
Returns a pointer to the underlying JUCE AudioProcessorParameter at the given index. | |
| AudioDeviceManager * | getDeviceManager () |
| Returns a raw pointer to the JUCE AudioDeviceManager. Used by the audio-setup UI component. | |
| std::map< int, std::pair< double, bool > > | getNetworkHealth () |
| Returns per-client network health metrics. | |
| JUCEAppBasics::SessionServiceTopology | getDiscoveredServicesTopology () |
Returns the most recent multicast service topology snapshot from ServiceTopologyManager. | |
| const String | getName () const override |
| Returns the processor name ("Mema"). | |
| void | prepareToPlay (double sampleRate, int maximumExpectedSamplesPerBlock) override |
| Called by the JUCE audio engine before playback starts. | |
| void | releaseResources () override |
| Called when playback stops; releases audio processing resources. | |
| void | processBlock (AudioBuffer< float > &buffer, MidiBuffer &midiMessages) override |
Standard JUCE AudioProcessor entry point — not used for live audio. | |
| double | getTailLengthSeconds () const override |
| bool | acceptsMidi () const override |
| bool | producesMidi () const override |
| AudioProcessorEditor * | createEditor () override |
| bool | hasEditor () const override |
| int | getNumPrograms () override |
| int | getCurrentProgram () override |
| void | setCurrentProgram (int index) override |
| const String | getProgramName (int index) override |
| void | changeProgramName (int index, const String &newName) override |
| void | getStateInformation (juce::MemoryBlock &destData) override |
| void | setStateInformation (const void *data, int sizeInBytes) override |
| void | audioDeviceIOCallbackWithContext (const float *const *inputChannelData, int numInputChannels, float *const *outputChannelData, int numOutputChannels, int numSamples, const AudioIODeviceCallbackContext &context) override |
| Hot audio callback — implements the complete Mema signal chain. | |
| void | audioDeviceAboutToStart (AudioIODevice *device) override |
| Called when the audio device is about to start streaming. | |
| void | audioDeviceStopped () override |
| Called when the audio device stops; notifies analyzers to clear their state. | |
| void | changeListenerCallback (ChangeBroadcaster *source) override |
Receives notifications from the AudioDeviceManager when the device configuration changes. | |
| void | handleMessage (const Message &message) override |
| Dispatches JUCE messages posted to the message thread. | |
| void | parameterValueChanged (int parameterIndex, float newValue) override |
| Called by the hosted plugin when a parameter value changes. | |
| void | parameterGestureChanged (int parameterIndex, bool gestureIsStarting) override |
| Called by the hosted plugin when a gesture (e.g. mouse drag) starts or ends. | |
| std::unique_ptr< XmlElement > | createStateXml () override |
| Serialises the current processor state (mutes, crosspoints, plugin settings) to XML. | |
| bool | setStateXml (XmlElement *stateXml) override |
Restores the processor state from a previously serialised <PROCESSORCONFIG> XmlElement. | |
| void | environmentChanged () |
Called when the OS look-and-feel or palette changes; broadcasts EnvironmentParametersMessage to all connected clients. | |
| void | triggerIOUpdate () |
| Forces a full re-broadcast of device parameters and routing state to all connected clients. | |
| void | setTrafficTypesForConnectionId (const std::vector< SerializableMessage::SerializableMessageType > &trafficTypes, int connectionId) |
| Updates the set of message types a specific TCP client has subscribed to receive. | |
| bool | isTimedConfigurationDumpPending () |
Returns true when a deferred XML configuration dump has been scheduled. | |
| void | setTimedConfigurationDumpPending () |
| Schedules a deferred XML configuration dump (called on state change to avoid excessive disk I/O). | |
| void | resetTimedConfigurationDumpPending () |
| Clears the deferred dump flag after the dump has been performed. | |
| void | initializeCtrlValuesToUnity () |
| Resets all crosspoint gains to 1.0 (unity) and enables all crosspoints. Used when creating a default configuration. | |
Public Attributes | |
| std::function< void(const juce::PluginDescription &)> | onPluginSet |
| Invoked on the message thread after a new plugin has been successfully loaded. | |
| std::function< void(int pluginParameterIndex, float newValue)> | onPluginParameterChanged |
| Fired (on the message thread) when a hosted plugin parameter value changes; receives the zero-based index and new normalised value. | |
| std::function< void()> | onPluginParameterInfosChanged |
| Fired when the set of exposed plugin parameters changes (plugin load/unload or controllability settings change). | |
Static Public Attributes | |
| static constexpr int | s_maxChannelCount = 64 |
| Maximum number of input or output channels supported by the routing matrix. | |
| static constexpr int | s_maxNumSamples = 1024 |
| Maximum audio block size in samples. | |
| static constexpr int | s_minInputsCount = 1 |
| Minimum number of input channels (always at least 1). | |
| static constexpr int | s_minOutputsCount = 1 |
| Minimum number of output channels (always at least 1). | |
Protected Member Functions | |
| void | initializeCtrlValues (int inputCount, int outputCount) |
| void | initializeCtrlValuesToUnity (int inputCount, int outputCount) |
Core audio processor — owns the AudioDeviceManager, routing matrix, plugin host, and IPC server.
MemaProcessor is the heart of the Mema tool. It owns and coordinates all subsystems:
UI components that need to read or write routing state register themselves as commanders:
MemaInputCommander / MemaOutputCommander — for per-channel mute control.MemaCrosspointCommander — for crosspoint enable/gain control.MemaPluginCommander — for plugin parameter control.Each set* method accepts an optional sender commander and userId. When a change originates from a network client (Mema.Re), the userId carries the client's connection-id so that the update is echoed to all other clients but not reflected back to the originator.
InterprocessConnectionServerImpl listens on port 55668. On connect, MemaProcessor sends:
EnvironmentParametersMessage — current palette style.AnalyzerParametersMessage — current sample rate and block size.ReinitIOCountMessage — current input/output channel counts.ControlParametersMessage — full routing-matrix state snapshot.PluginParameterInfosMessage — plugin name + parameter descriptors (if a plugin is loaded).Audio data is only streamed to clients that have subscribed via DataTrafficTypeSelectionMessage.
audioDeviceIOCallbackWithContext() runs on the audio thread; protected by m_audioDeviceIOCallbackLock.m_pluginProcessingLock.handleMessage() runs on the JUCE message thread.parameterValueChanged() runs on whichever thread the plugin calls it from; posted to the message thread.ControlParametersMessage data to the commander pattern. Definition at line 150 of file MemaProcessor.h.
| Mema::MemaProcessor::MemaProcessor | ( | XmlElement * | stateXml | ) |
Constructs the processor, optionally restoring state from XML.
| stateXml | Pointer to a previously serialised <PROCESSORCONFIG> XML element, or nullptr to start with default (unity gain) crosspoint values. |
Definition at line 147 of file MemaProcessor.cpp.
References addCrosspointCommander(), addInputCommander(), addOutputCommander(), addPluginCommander(), Mema::ServiceData::getBroadcastPort(), Mema::ServiceData::getConnectionPort(), Mema::ServiceData::getMasterServiceTypeUID(), Mema::ServiceData::getServiceTypeUIDBase(), Mema::SerializableMessage::initFromMemoryBlock(), isTimedConfigurationDumpPending(), Mema::InterprocessConnectionImpl::onConnectionLost, resetTimedConfigurationDumpPending(), s_maxChannelCount, s_maxNumSamples, and setStateXml().
| Mema::MemaProcessor::~MemaProcessor | ( | ) |
Definition at line 260 of file MemaProcessor.cpp.
References isTimedConfigurationDumpPending(), resetTimedConfigurationDumpPending(), and s_maxChannelCount.
|
override |
Definition at line 1531 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::addCrosspointCommander | ( | MemaCrosspointCommander * | commander | ) |
Adds a crosspoint commander and immediately pushes the full crosspoint state to it.
| commander | The commander to register. |
Definition at line 696 of file MemaProcessor.cpp.
References initializeCrosspointCommander(), Mema::MemaCrosspointCommander::setCrosspointEnabledChangeCallback(), Mema::MemaCrosspointCommander::setCrosspointFactorChangeCallback(), setMatrixCrosspointEnabledValue(), and setMatrixCrosspointFactorValue().
Referenced by MemaProcessor().
| void Mema::MemaProcessor::addInputCommander | ( | MemaInputCommander * | commander | ) |
Adds an input commander and immediately pushes the current mute states to it.
| commander | The commander to register. Ownership stays with the caller. |
Definition at line 628 of file MemaProcessor.cpp.
References initializeInputCommander(), Mema::MemaInputCommander::setInputMuteChangeCallback(), and setInputMuteState().
Referenced by MemaProcessor().
| void Mema::MemaProcessor::addInputListener | ( | ProcessorDataAnalyzer::Listener * | listener | ) |
Registers a listener to receive input-channel level/spectrum data from the input analyzer.
| listener | The listener to add; must remain valid until removeInputListener() is called. |
Definition at line 604 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::addOutputCommander | ( | MemaOutputCommander * | commander | ) |
Adds an output commander and immediately pushes the current mute states to it.
| commander | The commander to register. |
Definition at line 662 of file MemaProcessor.cpp.
References initializeOutputCommander(), Mema::MemaOutputCommander::setOutputMuteChangeCallback(), and setOutputMuteState().
Referenced by MemaProcessor().
| void Mema::MemaProcessor::addOutputListener | ( | ProcessorDataAnalyzer::Listener * | listener | ) |
Registers a listener to receive output-channel level/spectrum data from the output analyzer.
| listener | The listener to add. |
Definition at line 616 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::addPluginCommander | ( | MemaPluginCommander * | commander | ) |
Adds a plugin commander and immediately pushes the current parameter infos and values.
| commander | The commander to register. |
Definition at line 755 of file MemaProcessor.cpp.
References initializePluginCommander(), setPluginParameterValue(), and Mema::MemaPluginCommander::setPluginParameterValueChangeCallback().
Referenced by MemaProcessor().
|
override |
Called when the audio device is about to start streaming.
Broadcasts AnalyzerParametersMessage and ReinitIOCountMessage to all connected clients.
| device | The audio device that is starting. |
Definition at line 1639 of file MemaProcessor.cpp.
References prepareToPlay(), and setChannelCounts().
|
override |
Hot audio callback — implements the complete Mema signal chain.
This method runs on the dedicated audio thread at every audio device block:
m_processorChannels.ProcessorDataAnalyzer instances.AudioInputBufferMessage / AudioOutputBufferMessage to subscribed clients. m_audioDeviceIOCallbackLock to prevent concurrent plugin load/unload. Definition at line 1594 of file MemaProcessor.cpp.
References processBlock(), and s_maxChannelCount.
|
override |
Called when the audio device stops; notifies analyzers to clear their state.
Definition at line 1657 of file MemaProcessor.cpp.
References releaseResources().
|
override |
Receives notifications from the AudioDeviceManager when the device configuration changes.
| source | The broadcaster that posted the change. |
Definition at line 1662 of file MemaProcessor.cpp.
References setTimedConfigurationDumpPending().
|
override |
Definition at line 1577 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::clearPlugin | ( | ) |
Unloads the hosted plugin, closes its editor window, and resets all plugin commander state.
Definition at line 1065 of file MemaProcessor.cpp.
References closePluginEditor(), onPluginSet, and setPluginEnabledState().
| void Mema::MemaProcessor::closePluginEditor | ( | bool | deleteEditorWindow = true | ) |
Closes the plugin editor window.
| deleteEditorWindow | If true, also deletes the window object; pass false when the window is closing itself. |
Definition at line 1098 of file MemaProcessor.cpp.
Referenced by clearPlugin(), openPluginEditor(), and setPlugin().
|
override |
Definition at line 1541 of file MemaProcessor.cpp.
References initializeCtrlValuesToUnity().
|
override |
Serialises the current processor state (mutes, crosspoints, plugin settings) to XML.
<PROCESSORCONFIG> XmlElement, or nullptr on failure. Definition at line 281 of file MemaProcessor.cpp.
References Mema::MemaAppConfiguration::CONTROLLABLE, Mema::MemaAppConfiguration::CROSSPOINTGAINS, Mema::MemaAppConfiguration::DEVCONFIG, Mema::MemaAppConfiguration::ENABLED, Mema::MemaAppConfiguration::getAttributeName(), getPluginParameterInfos(), Mema::MemaAppConfiguration::getTagName(), Mema::MemaAppConfiguration::IDX, Mema::MemaAppConfiguration::INPUTMUTES, isPluginParameterRemoteControllable(), Mema::MemaAppConfiguration::OUTPUTMUTES, Mema::MemaAppConfiguration::PLUGINCONFIG, Mema::MemaAppConfiguration::PLUGINPARAM, Mema::MemaAppConfiguration::POST, and Mema::MemaAppConfiguration::PROCESSORCONFIG.
| void Mema::MemaProcessor::environmentChanged | ( | ) |
Called when the OS look-and-feel or palette changes; broadcasts EnvironmentParametersMessage to all connected clients.
Definition at line 589 of file MemaProcessor.cpp.
|
override |
Definition at line 1561 of file MemaProcessor.cpp.
| AudioDeviceManager * Mema::MemaProcessor::getDeviceManager | ( | ) |
Returns a raw pointer to the JUCE AudioDeviceManager. Used by the audio-setup UI component.
Definition at line 1207 of file MemaProcessor.cpp.
| JUCEAppBasics::SessionServiceTopology Mema::MemaProcessor::getDiscoveredServicesTopology | ( | ) |
Returns the most recent multicast service topology snapshot from ServiceTopologyManager.
Definition at line 1223 of file MemaProcessor.cpp.
| bool Mema::MemaProcessor::getInputMuteState | ( | std::uint16_t | channelNumber | ) |
Returns the mute state of a specific input channel.
| channelNumber | 1-based input channel index. |
true if the channel is muted (audio is silenced before the crosspoint matrix). Definition at line 812 of file MemaProcessor.cpp.
| bool Mema::MemaProcessor::getMatrixCrosspointEnabledValue | ( | std::uint16_t | inputNumber, |
| std::uint16_t | outputNumber | ||
| ) |
Returns whether a specific crosspoint node is enabled (routing active).
| inputNumber | 1-based input channel index. |
| outputNumber | 1-based output channel index. |
true if the crosspoint is enabled and audio flows from that input to that output. Definition at line 837 of file MemaProcessor.cpp.
| float Mema::MemaProcessor::getMatrixCrosspointFactorValue | ( | std::uint16_t | inputNumber, |
| std::uint16_t | outputNumber | ||
| ) |
Returns the linear gain factor of a crosspoint node.
| inputNumber | 1-based input channel index. |
| outputNumber | 1-based output channel index. |
Definition at line 876 of file MemaProcessor.cpp.
|
override |
Returns the processor name ("Mema").
Definition at line 1232 of file MemaProcessor.cpp.
| std::map< int, std::pair< double, bool > > Mema::MemaProcessor::getNetworkHealth | ( | ) |
Returns per-client network health metrics.
MemaUIComponent to update the network health bar. Definition at line 1215 of file MemaProcessor.cpp.
|
override |
Definition at line 1556 of file MemaProcessor.cpp.
| bool Mema::MemaProcessor::getOutputMuteState | ( | std::uint16_t | channelNumber | ) |
Returns the mute state of a specific output channel.
| channelNumber | 1-based output channel index. |
true if the channel is muted (audio is silenced after the crosspoint matrix). Definition at line 915 of file MemaProcessor.cpp.
| juce::PluginDescription Mema::MemaProcessor::getPluginDescription | ( | ) |
Returns the JUCE description of the currently loaded plugin.
Definition at line 1025 of file MemaProcessor.cpp.
| juce::AudioProcessorParameter * Mema::MemaProcessor::getPluginParameter | ( | int | parameterIndex | ) | const |
Returns a pointer to the underlying JUCE AudioProcessorParameter at the given index.
| parameterIndex | Zero-based index. |
nullptr if no plugin is loaded or the index is out of range. Definition at line 1192 of file MemaProcessor.cpp.
Referenced by setStateXml().
| std::vector< PluginParameterInfo > & Mema::MemaProcessor::getPluginParameterInfos | ( | ) |
Returns a mutable reference to the loaded plugin's parameter descriptor list.
Definition at line 1106 of file MemaProcessor.cpp.
Referenced by createStateXml(), parameterValueChanged(), and setStateXml().
| float Mema::MemaProcessor::getPluginParameterValue | ( | std::uint16_t | pluginParameterIndex | ) | const |
Returns the current normalised value of a hosted plugin parameter.
| pluginParameterIndex | Zero-based parameter index within the plugin's parameter list. |
Definition at line 1146 of file MemaProcessor.cpp.
|
override |
Definition at line 1571 of file MemaProcessor.cpp.
|
override |
Definition at line 1583 of file MemaProcessor.cpp.
|
override |
Definition at line 1526 of file MemaProcessor.cpp.
|
override |
Dispatches JUCE messages posted to the message thread.
Handles:
ControlParametersMessage — applies remote mute/crosspoint changes from Mema.Re.PluginParameterValueMessage — applies a single remote plugin parameter change.PluginParameterInfosChangedMessage — broadcasts updated parameter descriptors to clients. | message | The message to handle. |
Definition at line 1350 of file MemaProcessor.cpp.
References initializeCtrlValues(), Mema::AudioBufferMessage::Input, Mema::SerializableMessage::None, onPluginParameterInfosChanged, Mema::AudioBufferMessage::Output, setInputMuteState(), setMatrixCrosspointEnabledValue(), setMatrixCrosspointFactorValue(), setOutputMuteState(), setPluginParameterValue(), and setTrafficTypesForConnectionId().
|
override |
Definition at line 1551 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::initializeCrosspointCommander | ( | MemaCrosspointCommander * | commander | ) |
Pushes the current crosspoint enable/gain matrix to an already-registered commander.
| commander | The commander to initialise. |
Definition at line 711 of file MemaProcessor.cpp.
References Mema::MemaCrosspointCommander::setCrosspointEnabledValue(), and Mema::MemaCrosspointCommander::setCrosspointFactorValue().
Referenced by addCrosspointCommander(), and updateCommanders().
|
protected |
Definition at line 1668 of file MemaProcessor.cpp.
References Mema::PluginParameterInfo::parametersToInfos(), s_minInputsCount, and s_minOutputsCount.
Referenced by handleMessage().
| void Mema::MemaProcessor::initializeCtrlValuesToUnity | ( | ) |
Resets all crosspoint gains to 1.0 (unity) and enables all crosspoints. Used when creating a default configuration.
Definition at line 1747 of file MemaProcessor.cpp.
References initializeCtrlValuesToUnity().
Referenced by createEditor(), and initializeCtrlValuesToUnity().
|
protected |
Definition at line 1719 of file MemaProcessor.cpp.
References s_minInputsCount, s_minOutputsCount, setInputMuteState(), setMatrixCrosspointEnabledValue(), setMatrixCrosspointFactorValue(), and setOutputMuteState().
| void Mema::MemaProcessor::initializeInputCommander | ( | MemaInputCommander * | commander | ) |
Pushes the current input mute states to a commander that was already registered.
Called after a commander has been constructed and wired up but needs its initial state (e.g. after a configuration reload).
| commander | The already-registered commander to initialise. |
Definition at line 642 of file MemaProcessor.cpp.
References Mema::MemaInputCommander::setInputMute().
Referenced by addInputCommander(), and updateCommanders().
| void Mema::MemaProcessor::initializeOutputCommander | ( | MemaOutputCommander * | commander | ) |
Pushes the current output mute states to an already-registered commander.
| commander | The commander to initialise. |
Definition at line 676 of file MemaProcessor.cpp.
References Mema::MemaOutputCommander::setOutputMute().
Referenced by addOutputCommander(), and updateCommanders().
| void Mema::MemaProcessor::initializePluginCommander | ( | MemaPluginCommander * | commander | ) |
Pushes the current plugin parameter descriptors and values to an already-registered commander.
| commander | The commander to initialise. |
Definition at line 769 of file MemaProcessor.cpp.
Referenced by addPluginCommander(), and updateCommanders().
| bool Mema::MemaProcessor::isPluginEnabled | ( | ) |
Returns true when a plugin is loaded and its processing is enabled.
Definition at line 1044 of file MemaProcessor.cpp.
| bool Mema::MemaProcessor::isPluginParameterRemoteControllable | ( | int | parameterIndex | ) |
Returns true if the given parameter is flagged as remotely controllable.
| parameterIndex | Zero-based parameter index. |
Definition at line 1138 of file MemaProcessor.cpp.
Referenced by createStateXml().
| bool Mema::MemaProcessor::isPluginPost | ( | ) |
Returns true when the plugin is inserted post-matrix.
Definition at line 1060 of file MemaProcessor.cpp.
|
inline |
Returns true when a deferred XML configuration dump has been scheduled.
Definition at line 520 of file MemaProcessor.h.
Referenced by MemaProcessor(), and ~MemaProcessor().
| void Mema::MemaProcessor::openPluginEditor | ( | ) |
Opens (or raises) the plugin's editor UI in a floating ResizeableWindowWithTitleBarAndCloseCallback window.
Definition at line 1082 of file MemaProcessor.cpp.
References closePluginEditor().
|
override |
Called by the hosted plugin when a gesture (e.g. mouse drag) starts or ends.
| parameterIndex | Zero-based parameter index. |
| gestureIsStarting | true when the gesture begins. |
Definition at line 1504 of file MemaProcessor.cpp.
|
override |
Called by the hosted plugin when a parameter value changes.
Posts a message to the JUCE message thread so that onPluginParameterChanged is always fired on the UI thread.
| parameterIndex | Zero-based index of the changed parameter. |
| newValue | New normalised value in [0, 1]. |
Definition at line 1489 of file MemaProcessor.cpp.
References getPluginParameterInfos().
|
override |
Called by the JUCE audio engine before playback starts.
Broadcasts AnalyzerParametersMessage to all connected clients with the new sample rate and block size.
| sampleRate | New sample rate in Hz. |
| maximumExpectedSamplesPerBlock | Maximum number of samples per processBlock() call. |
Definition at line 1237 of file MemaProcessor.cpp.
Referenced by audioDeviceAboutToStart().
|
override |
Standard JUCE AudioProcessor entry point — not used for live audio.
MemaProcessor drives audio through audioDeviceIOCallbackWithContext() directly, not via the AudioProcessor plugin host path. This override satisfies the interface contract but is otherwise a no-op.
Definition at line 1271 of file MemaProcessor.cpp.
References s_minInputsCount, and s_minOutputsCount.
Referenced by audioDeviceIOCallbackWithContext().
|
override |
Definition at line 1536 of file MemaProcessor.cpp.
|
override |
Called when playback stops; releases audio processing resources.
Definition at line 1256 of file MemaProcessor.cpp.
Referenced by audioDeviceStopped().
| void Mema::MemaProcessor::removeCrosspointCommander | ( | MemaCrosspointCommander * | comander | ) |
Removes a previously registered crosspoint commander.
| comander | The commander to remove. |
Definition at line 745 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::removeInputCommander | ( | MemaInputCommander * | commander | ) |
Removes a previously registered input commander.
| commander | The commander to remove. |
Definition at line 652 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::removeInputListener | ( | ProcessorDataAnalyzer::Listener * | listener | ) |
Unregisters a previously added input analyzer listener.
| listener | The listener to remove. |
Definition at line 610 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::removeOutputCommander | ( | MemaOutputCommander * | comander | ) |
Removes a previously registered output commander.
| comander | The commander to remove. |
Definition at line 686 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::removeOutputListener | ( | ProcessorDataAnalyzer::Listener * | listener | ) |
Unregisters a previously added output analyzer listener.
| listener | The listener to remove. |
Definition at line 622 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::removePluginCommander | ( | MemaPluginCommander * | commander | ) |
Removes a previously registered plugin commander.
| commander | The commander to remove. |
Definition at line 779 of file MemaProcessor.cpp.
|
inline |
Clears the deferred dump flag after the dump has been performed.
Definition at line 524 of file MemaProcessor.h.
Referenced by MemaProcessor(), and ~MemaProcessor().
| void Mema::MemaProcessor::setChannelCounts | ( | std::uint16_t | inputChannelCount, |
| std::uint16_t | outputChannelCount | ||
| ) |
Resizes all internal routing structures for a new input/output channel count.
Called when the audio device reports a change in its channel layout. Reinitialises m_matrixCrosspointStates, m_matrixCrosspointValues, mute maps, and the commander lists, then broadcasts a ReinitIOCountMessage to all connected clients.
| inputChannelCount | New number of active input channels. |
| outputChannelCount | New number of active output channels. |
Definition at line 940 of file MemaProcessor.cpp.
Referenced by audioDeviceAboutToStart().
|
override |
Definition at line 1566 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::setInputMuteState | ( | std::uint16_t | channelNumber, |
| bool | muted, | ||
| MemaChannelCommander * | sender = nullptr, |
||
| int | userId = -1 |
||
| ) |
Sets the mute state of an input channel and notifies all commanders except the sender.
| channelNumber | 1-based input channel index. |
| muted | true to mute, false to unmute. |
| sender | The commander that triggered the change, or nullptr if the change is internal. The sender is skipped when broadcasting the update to other commanders. |
| userId | Connection-id of the originating TCP client, used for echo-suppression (-1 = local). |
Definition at line 819 of file MemaProcessor.cpp.
References setTimedConfigurationDumpPending().
Referenced by addInputCommander(), handleMessage(), and initializeCtrlValuesToUnity().
| void Mema::MemaProcessor::setMatrixCrosspointEnabledValue | ( | std::uint16_t | inputNumber, |
| std::uint16_t | outputNumber, | ||
| bool | enabled, | ||
| MemaChannelCommander * | sender = nullptr, |
||
| int | userId = -1 |
||
| ) |
Enables or disables a crosspoint routing node.
| inputNumber | 1-based input channel index. |
| outputNumber | 1-based output channel index. |
| enabled | true to route audio, false to silence the node. |
| sender | Commander that triggered the change, or nullptr. |
| userId | Originating TCP client connection-id for echo-suppression (-1 = local). |
Definition at line 850 of file MemaProcessor.cpp.
References setTimedConfigurationDumpPending().
Referenced by addCrosspointCommander(), handleMessage(), and initializeCtrlValuesToUnity().
| void Mema::MemaProcessor::setMatrixCrosspointFactorValue | ( | std::uint16_t | inputNumber, |
| std::uint16_t | outputNumber, | ||
| float | factor, | ||
| MemaChannelCommander * | sender = nullptr, |
||
| int | userId = -1 |
||
| ) |
Sets the linear gain factor of a crosspoint node.
| inputNumber | 1-based input channel index. |
| outputNumber | 1-based output channel index. |
| factor | Linear gain in [0, 1]. |
| sender | Commander that triggered the change, or nullptr. |
| userId | Originating TCP client connection-id for echo-suppression (-1 = local). |
Definition at line 889 of file MemaProcessor.cpp.
References setTimedConfigurationDumpPending().
Referenced by addCrosspointCommander(), handleMessage(), and initializeCtrlValuesToUnity().
| void Mema::MemaProcessor::setOutputMuteState | ( | std::uint16_t | channelNumber, |
| bool | muted, | ||
| MemaChannelCommander * | sender = nullptr, |
||
| int | userId = -1 |
||
| ) |
Sets the mute state of an output channel and notifies all commanders except the sender.
| channelNumber | 1-based output channel index. |
| muted | true to mute, false to unmute. |
| sender | Commander that triggered the change, or nullptr. |
| userId | Originating TCP client connection-id for echo-suppression (-1 = local). |
Definition at line 922 of file MemaProcessor.cpp.
References setTimedConfigurationDumpPending().
Referenced by addOutputCommander(), handleMessage(), and initializeCtrlValuesToUnity().
| bool Mema::MemaProcessor::setPlugin | ( | const juce::PluginDescription & | pluginDescription | ) |
Loads and instantiates a plugin from the given description.
Scans the system for the matching plugin binary, creates an AudioPluginInstance, prepares it for playback, and registers MemaProcessor as a parameter listener. Triggers onPluginSet on success and broadcasts a PluginParameterInfosMessage.
| pluginDescription | The JUCE plugin description (obtained from a plugin scan). |
true on success, false if the plugin could not be loaded. Definition at line 964 of file MemaProcessor.cpp.
References closePluginEditor(), Mema::PluginParameterInfo::fromAudioProcessorParameter(), and onPluginSet.
Referenced by setStateXml().
| void Mema::MemaProcessor::setPluginEnabledState | ( | bool | enabled | ) |
Enables or disables plugin processing without unloading the plugin instance.
| enabled | Pass true to enable, false to bypass. |
Definition at line 1033 of file MemaProcessor.cpp.
Referenced by clearPlugin(), and setStateXml().
| void Mema::MemaProcessor::setPluginParameterRemoteControlInfos | ( | int | pluginParameterIndex, |
| bool | remoteControllable, | ||
| ParameterControlType | type, | ||
| int | steps | ||
| ) |
Marks a plugin parameter as remotely controllable (or not) and sets its control widget type.
| pluginParameterIndex | Zero-based parameter index. |
| remoteControllable | true to expose this parameter in Mema.Re's plugin control panel. |
| type | Control widget type (Continuous slider, Discrete combo box, or Toggle button). |
| steps | Number of discrete steps for Discrete type parameters. |
Definition at line 1111 of file MemaProcessor.cpp.
Referenced by setStateXml().
| void Mema::MemaProcessor::setPluginParameterValue | ( | std::uint16_t | pluginParameterIndex, |
| std::string | id, | ||
| float | normalizedValue, | ||
| MemaPluginCommander * | sender = nullptr, |
||
| int | userId = -1 |
||
| ) |
Sets a hosted plugin parameter to a normalised value.
| pluginParameterIndex | Zero-based parameter index. |
| id | Stable string ID used for cross-session safety. |
| normalizedValue | Normalised value in [0, 1]. |
| sender | Commander that triggered the change, or nullptr. |
| userId | Originating TCP client connection-id for echo-suppression (-1 = local). |
Definition at line 1161 of file MemaProcessor.cpp.
References setTimedConfigurationDumpPending().
Referenced by addPluginCommander(), and handleMessage().
| void Mema::MemaProcessor::setPluginPrePostState | ( | bool | post | ) |
Selects whether the plugin processes audio before or after the crosspoint matrix.
| post | true = post-matrix (plugin sees the fully routed mix); false = pre-matrix (plugin processes raw inputs). |
Definition at line 1049 of file MemaProcessor.cpp.
Referenced by setStateXml().
|
override |
Definition at line 1588 of file MemaProcessor.cpp.
|
override |
Restores the processor state from a previously serialised <PROCESSORCONFIG> XmlElement.
| stateXml | Pointer to the XML element. |
true on success. Definition at line 349 of file MemaProcessor.cpp.
References Mema::MemaAppConfiguration::CONTROLLABLE, Mema::MemaAppConfiguration::CROSSPOINTGAINS, Mema::MemaAppConfiguration::DEVCONFIG, Mema::MemaAppConfiguration::ENABLED, Mema::PluginParameterInfo::fromString(), Mema::MemaAppConfiguration::getAttributeName(), getPluginParameter(), getPluginParameterInfos(), Mema::MemaAppConfiguration::getTagName(), Mema::MemaAppConfiguration::IDX, Mema::MemaAppConfiguration::INPUTMUTES, Mema::MemaAppConfiguration::OUTPUTMUTES, Mema::MemaAppConfiguration::PLUGINCONFIG, Mema::MemaAppConfiguration::PLUGINPARAM, Mema::MemaAppConfiguration::POST, Mema::MemaAppConfiguration::PROCESSORCONFIG, s_maxChannelCount, setPlugin(), setPluginEnabledState(), setPluginParameterRemoteControlInfos(), and setPluginPrePostState().
Referenced by MemaProcessor().
|
inline |
Schedules a deferred XML configuration dump (called on state change to avoid excessive disk I/O).
Definition at line 522 of file MemaProcessor.h.
Referenced by changeListenerCallback(), setInputMuteState(), setMatrixCrosspointEnabledValue(), setMatrixCrosspointFactorValue(), setOutputMuteState(), and setPluginParameterValue().
| void Mema::MemaProcessor::setTrafficTypesForConnectionId | ( | const std::vector< SerializableMessage::SerializableMessageType > & | trafficTypes, |
| int | connectionId | ||
| ) |
Updates the set of message types a specific TCP client has subscribed to receive.
Called by InterprocessConnectionServerImpl when a DataTrafficTypeSelectionMessage arrives from a client. Only message types listed in trafficTypes will subsequently be forwarded to that connection.
| trafficTypes | The complete subscription list replacing any previous subscription. |
| connectionId | The unique ID of the TCP client connection. |
Definition at line 1752 of file MemaProcessor.cpp.
Referenced by handleMessage().
| void Mema::MemaProcessor::triggerIOUpdate | ( | ) |
Forces a full re-broadcast of device parameters and routing state to all connected clients.
Sends AnalyzerParametersMessage, ReinitIOCountMessage, ControlParametersMessage, and (if applicable) PluginParameterInfosMessage to every connected TCP client. Called after a device reconfiguration or configuration reload.
Definition at line 599 of file MemaProcessor.cpp.
| void Mema::MemaProcessor::updateCommanders | ( | ) |
Forces all registered commanders to re-synchronise with the current processor state.
Definition at line 789 of file MemaProcessor.cpp.
References initializeCrosspointCommander(), initializeInputCommander(), initializeOutputCommander(), and initializePluginCommander().
| std::function<void(int pluginParameterIndex, float newValue)> Mema::MemaProcessor::onPluginParameterChanged |
Fired (on the message thread) when a hosted plugin parameter value changes; receives the zero-based index and new normalised value.
Definition at line 368 of file MemaProcessor.h.
| std::function<void()> Mema::MemaProcessor::onPluginParameterInfosChanged |
Fired when the set of exposed plugin parameters changes (plugin load/unload or controllability settings change).
Definition at line 369 of file MemaProcessor.h.
Referenced by handleMessage().
| std::function<void(const juce::PluginDescription&)> Mema::MemaProcessor::onPluginSet |
Invoked on the message thread after a new plugin has been successfully loaded.
Definition at line 352 of file MemaProcessor.h.
Referenced by clearPlugin(), and setPlugin().
|
staticconstexpr |
Maximum number of input or output channels supported by the routing matrix.
Definition at line 512 of file MemaProcessor.h.
Referenced by audioDeviceIOCallbackWithContext(), Mema::Mema::Mema(), MemaProcessor(), setStateXml(), and ~MemaProcessor().
|
staticconstexpr |
Maximum audio block size in samples.
Definition at line 513 of file MemaProcessor.h.
Referenced by MemaProcessor().
|
staticconstexpr |
Minimum number of input channels (always at least 1).
Definition at line 515 of file MemaProcessor.h.
Referenced by initializeCtrlValues(), initializeCtrlValuesToUnity(), Mema::Mema::Mema(), and processBlock().
|
staticconstexpr |
Minimum number of output channels (always at least 1).
Definition at line 516 of file MemaProcessor.h.
Referenced by initializeCtrlValues(), initializeCtrlValuesToUnity(), Mema::Mema::Mema(), and processBlock().