MIDI Control Surface library for Arduino
|
Go to the documentation of this file.
4 #include <AH/STL/utility>
7 #include <Settings/NamespaceSettings.hpp>
85 void connectSourcePipe(
MIDI_Pipe *source);
87 void disconnectSourcePipes();
97 MIDI_Pipe *getSourcePipe() {
return sourcePipe; }
114 void disconnectSourcePipesShallow();
556 template <
size_t N,
class Pipe = MIDI_Pipe>
574 template <
size_t N,
class Pipe>
577 return source >> pipe_fact.
getNext();
580 template <
size_t N,
class Pipe>
583 return pipe_fact.
getNext() >> sink;
586 template <
size_t N,
class Pipe>
589 return sink << pipe_fact.
getNext();
592 template <
size_t N,
class Pipe>
595 return pipe_fact.
getNext() << source;
602 return pipe_fact.
getNext() | sinksource;
609 return sinksource | pipe_fact.
getNext();
void connectSinkPipe(MIDI_Pipe *sink)
Fully connect a sink pipe to this source.
bool isLocked(cn_t cn) const
Check if this pipe is locked for a given cable number.
void sourceMIDItoSink(SysExMessage msg)
Send the given MIDI message to the sink of this pipe.
void pipeMIDI(RealTimeMessage msg)
Accept a MIDI message from the source, forward it to the "through" output if necessary,...
Class that routes MIDI messages from a MIDI_Source to a MIDI_Sink.
virtual void mapForwardMIDI(RealTimeMessage msg)
Function that maps, edits or filters MIDI messages, and then forwards them to the sink of the pipe.
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.
MIDI_Source(const MIDI_Source &)=delete
Copy constructor (copying not allowed).
void sinkMIDIfromPipe(SysExMessage msg) override
Accept an incoming MIDI System Exclusive message.
MIDI_Sink * getFinalSink() override
Get the sink this pipe eventually sinks to, following the chain recursively.
bool hasThroughOut() const
Check if this pipe has a "through" output that sends all incoming messages from the input (source) to...
MIDI_Pipe()=default
Default constructor.
void connectSource(MIDI_Source *source)
Set the source pointer to point to the given source.
MIDI_Source * getSource()
virtual void sinkMIDIfromPipe(RealTimeMessage)=0
Accept an incoming MIDI Real-Time message.
bool hasSinkPipe() const
Check if this source is connected to a sink pipe.
void sourceMIDItoSink(ChannelMessage msg)
Send the given MIDI message to the sink of this 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.
virtual MIDI_Sink * getFinalSink()
Base case for recursive function.
MIDI_Sink()=default
Default constructor.
Class that produces multiple MIDI_Pipes.
void disconnectSource()
Set the source pointer to null.
void sourceMIDItoSink(RealTimeMessage msg)
Send the given MIDI message to the sink of this pipe.
void sinkMIDIfromPipe(ChannelMessage msg) override
Accept an incoming MIDI Channel message.
const Pipe & operator[](size_t i) const
#define BEGIN_CS_NAMESPACE
void sinkMIDIfromPipe(RealTimeMessage msg) override
Accept an incoming MIDI Real-Time message.
#define AH_DIAGNOSTIC_POP()
MIDI_Source & operator=(const MIDI_Source &)=delete
Copy assignment (copying not allowed).
void disconnectSinkPipes()
Disconnect all sink pipes that this source sinks to (recursively).
void set(uint8_t bitIndex)
Set the value of the given bit to 1.
MIDI_Pipe & operator=(const MIDI_Pipe &)=delete
Copy assignment (copying not allowed).
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.
void lockDownstream(cn_t cn, bool lock) override
Lock this pipe and all other pipes further downstream (following the path of the sink).
MIDI_Pipe & operator=(MIDI_Pipe &&)=delete
Move assignment.
bool get(uint8_t bitIndex) const
Get the value of the given bit.
MIDI_Pipe(MIDI_Pipe &&)=delete
Move constructor.
A MIDI_Sink that is not a MIDI_Pipe.
virtual void mapForwardMIDI(SysExMessage msg)
Function that maps, edits or filters MIDI messages, and then forwards them to the sink of the pipe.
A struct that is both a TrueMIDI_Sink and a TrueMIDI_Source.
virtual void sinkMIDIfromPipe(ChannelMessage)=0
Accept an incoming MIDI Channel message.
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).
MIDI_Pipe * getThroughOut()
void pipeMIDI(SysExMessage msg)
Accept a MIDI message from the source, forward it to the "through" output if necessary,...
void sourceMIDItoPipe(ChannelMessage)
Send a MIDI Channel Message.
void disconnectSinkPipesShallow()
Disconnect only the first pipe connected to this source.
Pipe & operator[](size_t i)
virtual void sinkMIDIfromPipe(SysExMessage)=0
Accept an incoming MIDI System Exclusive message.
TrueMIDI_SinkSource & operator|(BidirectionalMIDI_Pipe &pipe, TrueMIDI_SinkSource &sinksource)
Connect a pipe to a sink+source (pipe | source+sink).
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.
bool hasSink() const
Check if this pipe is connected to a sink.
virtual void mapForwardMIDI(ChannelMessage msg)
Function that maps, edits or filters MIDI messages, and then forwards them to the sink of the pipe.
void exclusive(cn_t cn, bool exclusive=true)
Enter or exit exclusive mode for the given cable number.
virtual MIDI_Source * getInitialSource()
Base case for recursive function.
uint8_t cn_t
Data type for cable numbers.
bool disconnect(TrueMIDI_Sink &sink)
Disconnect the given sink from this pipe.
bool canWrite(cn_t cn) const
Check if this source can write to the sinks it connects to.
MIDI_Pipe & operator>>(TrueMIDI_Source &source, MIDI_Pipe &pipe)
Connect a source to a pipe (source >> pipe).
virtual ~MIDI_Source()
Destructor.
#define AH_DIAGNOSTIC_WERROR()
void disconnect()
Disconnect this pipe from all other pipes, sources and sinks.
MIDI_Pipe(const MIDI_Pipe &)=delete
Copy constructor (copying not allowed).
Class that can receive MIDI messages from a MIDI pipe.
void disconnectSink()
Set the sink pointer to null.
MIDI_Source * getInitialSource() override
Get the original source that sources to this pipe, following the chain recursively.
bool disconnect(TrueMIDI_Sink &sink)
Disconnect the given sink from this source.
bool disconnect(TrueMIDI_Source &source)
Disconnect the given source from this pipe.
Print & operator<<(Print &os, Quaternion e)
Printing.
MIDI_Pipe * getThroughIn()
void connectSink(MIDI_Sink *sink)
Set the sink pointer to point to the given sink.
std::pair< MIDI_Pipe, MIDI_Pipe > BidirectionalMIDI_Pipe
A bidirectional pipe consists of two unidirectional pipes.
void lockSelf(cn_t cn, bool lock)
Lock this pipe, so sources cannot send messages through it.
bool hasThroughIn() const
Check if this pipe has a "through" input that merges all messages from another pipe into the output (...
MIDI_Sink(const MIDI_Sink &)=delete
Copy constructor (copying not allowed).
void exclusive(cn_t cn, bool exclusive=true)
Enter or exit exclusive mode for the given cable number.