Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
Mema::ControlParametersMessage Class Reference

Full routing-matrix state snapshot exchanged bidirectionally between Mema and Mema.Re. More...

#include <MemaMessages.h>

+ Inheritance diagram for Mema::ControlParametersMessage:
+ Collaboration diagram for Mema::ControlParametersMessage:

Public Member Functions

 ControlParametersMessage ()=default
 
 ControlParametersMessage (const std::map< std::uint16_t, bool > &inputMuteStates, const std::map< std::uint16_t, bool > &outputMuteStates, const std::map< std::uint16_t, std::map< std::uint16_t, bool > > &crosspointStates, const std::map< std::uint16_t, std::map< std::uint16_t, float > > &crosspointValues)
 
 ControlParametersMessage (const juce::MemoryBlock &blob)
 
 ~ControlParametersMessage ()=default
 
const std::map< std::uint16_t, bool > & getInputMuteStates () const
 Returns the per-input mute states (channel index → muted).
 
const std::map< std::uint16_t, bool > & getOutputMuteStates () const
 Returns the per-output mute states (channel index → muted).
 
const std::map< std::uint16_t, std::map< std::uint16_t, bool > > & getCrosspointStates () const
 Returns the crosspoint enable matrix (input index → output index → enabled).
 
const std::map< std::uint16_t, std::map< std::uint16_t, float > > & getCrosspointValues () const
 Returns the crosspoint gain matrix (input index → output index → linear gain [0, 1]).
 
- Public Member Functions inherited from Mema::SerializableMessage
 SerializableMessage ()=default
 
virtual ~SerializableMessage ()=default
 
void setId (int id)
 Tags the message with a connection-id used for echo-suppression on the server.
 
int getId () const
 Returns the connection-id tag, or -1 if not set.
 
bool hasUserId () const
 Returns true when a non-default connection-id has been assigned.
 
const SerializableMessageType getType () const
 Returns the concrete message type discriminator.
 
juce::MemoryBlock getSerializedMessage () const
 Serialises the message to a MemoryBlock ready to send over the socket.
 

Protected Member Functions

juce::MemoryBlock createSerializedContent (size_t &contentSize) const override
 Subclass hook — produces the type-specific payload bytes (everything after the type discriminator).
 
- Protected Member Functions inherited from Mema::SerializableMessage
std::uint32_t ReadUint32 (const char *buffer)
 Reads a big-endian uint32 from buffer.
 
std::uint16_t ReadUint16 (const char *buffer)
 Reads a big-endian uint16 from buffer.
 

Additional Inherited Members

- Public Types inherited from Mema::SerializableMessage
enum  SerializableMessageType {
  None = 0 ,
  EnvironmentParameters ,
  AnalyzerParameters ,
  ReinitIOCount ,
  AudioInputBuffer ,
  AudioOutputBuffer ,
  DataTrafficTypeSelection ,
  ControlParameters ,
  PluginParameterInfos ,
  PluginParameterValue
}
 
- Static Public Member Functions inherited from Mema::SerializableMessage
static SerializableMessageinitFromMemoryBlock (const juce::MemoryBlock &blob)
 Deserialises a raw TCP frame into the correct concrete SerializableMessage subclass.
 
static void freeMessageData (SerializableMessage *message)
 Type-correctly destroys a SerializableMessage* returned by initFromMemoryBlock().
 
- Protected Attributes inherited from Mema::SerializableMessage
SerializableMessageType m_type = SerializableMessageType::None
 Type discriminator stored in the first 4 bytes of every serialised frame.
 
int m_userId = -1
 Optional connection-id tag for echo-suppression (-1 = not set).
 

Detailed Description

Full routing-matrix state snapshot exchanged bidirectionally between Mema and Mema.Re.

This message is the primary vehicle for remote control in the Mema tool suite:

Mema → Mema.Re (on connect): MemaProcessor sends the current complete state immediately after a Mema.Re client connects and subscribes. This initialises the Mema.Re UI to match the live server state without requiring the user to manually synchronise.

Mema.Re → Mema (on user interaction): Whenever the user changes a mute, crosspoint enable, or crosspoint gain in Mema.Re, the MemaReComponent serialises the full updated state into a new ControlParametersMessage and sends it via onMessageReadyToSend. MemaProcessor::handleMessage() unpacks it and applies each changed value, then echoes the updated state to all other connected clients (echo-suppression via m_userId).

Wire payload:

  • uint16 inputMuteCount + (uint16 channel + bool muted) × N
  • uint16 outputMuteCount + (uint16 channel + bool muted) × M
  • uint16 crosspointStateCount + (uint16 in + uint16 out + bool enabled) × (N×M)
  • uint16 crosspointValueCount + (uint16 in + uint16 out + float gain) × (N×M)
Note
Channel indices are 1-based and match the indices used by MemaInputCommander / MemaOutputCommander / MemaCrosspointCommander.
See also
MemaProcessor::handleMessage()
MemaReComponent::handleMessage()

Definition at line 626 of file MemaMessages.h.

Constructor & Destructor Documentation

◆ ControlParametersMessage() [1/3]

Mema::ControlParametersMessage::ControlParametersMessage ( )
default

◆ ControlParametersMessage() [2/3]

Mema::ControlParametersMessage::ControlParametersMessage ( const std::map< std::uint16_t, bool > &  inputMuteStates,
const std::map< std::uint16_t, bool > &  outputMuteStates,
const std::map< std::uint16_t, std::map< std::uint16_t, bool > > &  crosspointStates,
const std::map< std::uint16_t, std::map< std::uint16_t, float > > &  crosspointValues 
)
inline

◆ ControlParametersMessage() [3/3]

Mema::ControlParametersMessage::ControlParametersMessage ( const juce::MemoryBlock &  blob)
inline

◆ ~ControlParametersMessage()

Mema::ControlParametersMessage::~ControlParametersMessage ( )
default

Member Function Documentation

◆ createSerializedContent()

juce::MemoryBlock Mema::ControlParametersMessage::createSerializedContent ( size_t &  contentSize) const
inlineoverrideprotectedvirtual

Subclass hook — produces the type-specific payload bytes (everything after the type discriminator).

Parameters
contentSizeSet by the implementation to the byte count of the returned block.
Returns
A MemoryBlock containing only the payload (no type prefix).

Implements Mema::SerializableMessage.

Definition at line 745 of file MemaMessages.h.

◆ getCrosspointStates()

const std::map< std::uint16_t, std::map< std::uint16_t, bool > > & Mema::ControlParametersMessage::getCrosspointStates ( ) const
inline

Returns the crosspoint enable matrix (input index → output index → enabled).

Definition at line 740 of file MemaMessages.h.

◆ getCrosspointValues()

const std::map< std::uint16_t, std::map< std::uint16_t, float > > & Mema::ControlParametersMessage::getCrosspointValues ( ) const
inline

Returns the crosspoint gain matrix (input index → output index → linear gain [0, 1]).

Definition at line 742 of file MemaMessages.h.

◆ getInputMuteStates()

const std::map< std::uint16_t, bool > & Mema::ControlParametersMessage::getInputMuteStates ( ) const
inline

Returns the per-input mute states (channel index → muted).

Definition at line 736 of file MemaMessages.h.

◆ getOutputMuteStates()

const std::map< std::uint16_t, bool > & Mema::ControlParametersMessage::getOutputMuteStates ( ) const
inline

Returns the per-output mute states (channel index → muted).

Definition at line 738 of file MemaMessages.h.


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