| 
   
    MIDI Control Surface library for Arduino 
   | 
 
 
 
 
Go to the documentation of this file.
    3 #include <AH/STL/utility> 
    5 #if defined(ESP32) || !defined(ARDUINO) 
   16     if (this->sourcePipe == 
nullptr) {
 
   17         source->connectSink(
this);
 
   18         this->sourcePipe = source;
 
   48     : sourcePipe(
std::exchange(other.sourcePipe, nullptr)) {
 
   61     if (other.hasSourcePipe()) {
 
   62         other.sourcePipe->disconnectSink();
 
   63         other.sourcePipe->connectSink(
this);
 
  101     : sinkPipe(
std::exchange(other.sinkPipe, nullptr)) {
 
  114     if (other.hasSinkPipe()) {
 
  115         other.sinkPipe->disconnectSource();
 
  116         other.sinkPipe->connectSource(
this);
 
  151     if (this->sink != 
nullptr) {
 
  152         FATAL_ERROR(
F(
"This pipe is already connected to a sink"), 0x9145);
 
  161     if (this->source != 
nullptr) {
 
  162         FATAL_ERROR(
F(
"This pipe is already connected to a source"), 0x9146);
 
  176         oldSink->connectSourcePipe(oldThroughIn);
 
  183         oldSource->connectSinkPipe(oldThroughOut);
 
  197 #if defined(ESP32) || !defined(ARDUINO) 
  198 static std::mutex pipe_exclusive_mutex;
 
  202 #if defined(ESP32) || !defined(ARDUINO) 
  203     std::lock_guard<std::mutex> lock_guard(pipe_exclusive_mutex);
 
  
void connectSinkPipe(MIDI_Pipe *sink)
Fully connect a sink pipe to this source.
 
Class that routes MIDI messages from a MIDI_Source to a MIDI_Sink.
 
virtual ~MIDI_Pipe()
Destructor.
 
Class that can send MIDI messages to a MIDI pipe.
 
A MIDI_Source that is not a MIDI_Pipe.
 
MIDI_Source()=default
Default constructor.
 
bool hasThroughOut() const
Check if this pipe has a "through" output that sends all incoming messages from the input (source) to...
 
void connectSource(MIDI_Source *source)
Set the source pointer to point to the given source.
 
bool hasSinkPipe() const
Check if this source is connected to a sink pipe.
 
bool isAvailableForWrite(cn_t cn) const
Check if any of the sinks or outputs of this chain of pipes are locked for the given cable number.
 
MIDI_Sink()=default
Default constructor.
 
void disconnectSource()
Set the source pointer to null.
 
#define BEGIN_CS_NAMESPACE
 
#define AH_DIAGNOSTIC_POP()
 
MIDI_Source & operator=(const MIDI_Source &)=delete
Copy assignment (copying not allowed).
 
virtual ~MIDI_Sink()
Destructor.
 
void disconnectSinkPipes()
Disconnect all sink pipes that this source sinks to (recursively).
 
void pipeMIDI(ChannelMessage msg)
Accept a MIDI message from the source, forward it to the "through" output if necessary,...
 
bool hasSourcePipe() const
Check if this sink is connected to a source pipe.
 
#define FATAL_ERROR(msg, errc)
Print the error message and error code, and stop the execution.
 
A MIDI_Sink that is not a MIDI_Pipe.
 
virtual void lockDownstream(cn_t cn, bool lock)
Base case for recursive lock function.
 
void lockUpstream(cn_t cn, bool lock)
Lock this pipe and all other pipes further upstream (following the path of the "trough" input).
 
void sourceMIDItoPipe(ChannelMessage)
Send a MIDI Channel Message.
 
void disconnectSourcePipes()
Disconnect all source pipes that sink to this sink (recursively).
 
void disconnectSinkPipesShallow()
Disconnect only the first pipe connected to this source.
 
void connectSourcePipe(MIDI_Pipe *source)
Fully connect a source pipe to this sink.
 
MIDI_Sink & operator=(const MIDI_Sink &)=delete
Copy assignment (copying not allowed).
 
bool hasSource() const
Check if this pipe is connected to a source.
 
void disconnectSourcePipesShallow()
Disconnect only the first pipe connected to this sink.
 
bool hasSink() const
Check if this pipe is connected to a sink.
 
void exclusive(cn_t cn, bool exclusive=true)
Enter or exit exclusive mode for the given cable number.
 
uint8_t cn_t
Data type for cable numbers.
 
bool disconnect(TrueMIDI_Source &source)
Disconnect the given source from this sink.
 
bool canWrite(cn_t cn) const
Check if this source can write to the sinks it connects to.
 
virtual ~MIDI_Source()
Destructor.
 
#define AH_DIAGNOSTIC_WERROR()
 
void disconnect()
Disconnect this pipe from all other pipes, sources and sinks.
 
Class that can receive MIDI messages from a MIDI pipe.
 
void disconnectSink()
Set the sink pointer to null.
 
bool disconnect(TrueMIDI_Sink &sink)
Disconnect the given sink from this source.
 
void connectSink(MIDI_Sink *sink)
Set the sink pointer to point to the given sink.
 
bool hasThroughIn() const
Check if this pipe has a "through" input that merges all messages from another pipe into the output (...
 
void exclusive(cn_t cn, bool exclusive=true)
Enter or exit exclusive mode for the given cable number.