mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Minor additions to linux midi, AudioProcessorGraph, URL.
This commit is contained in:
parent
427941e8c3
commit
aa6c2203d5
7 changed files with 124 additions and 78 deletions
|
|
@ -1141,26 +1141,26 @@ bool AudioProcessorGraph::disconnectNode (const uint32 nodeId)
|
|||
return doneAnything;
|
||||
}
|
||||
|
||||
bool AudioProcessorGraph::isConnectionLegal (Connection* const c) const
|
||||
{
|
||||
const Node* const source = getNodeForId (c->sourceNodeId);
|
||||
const Node* const dest = getNodeForId (c->destNodeId);
|
||||
|
||||
return source != nullptr
|
||||
&& dest != nullptr
|
||||
&& (c->sourceChannelIndex != midiChannelIndex ? isPositiveAndBelow (c->sourceChannelIndex, source->processor->getNumOutputChannels())
|
||||
: source->processor->producesMidi())
|
||||
&& (c->destChannelIndex != midiChannelIndex ? isPositiveAndBelow (c->destChannelIndex, dest->processor->getNumInputChannels())
|
||||
: dest->processor->acceptsMidi());
|
||||
}
|
||||
|
||||
bool AudioProcessorGraph::removeIllegalConnections()
|
||||
{
|
||||
bool doneAnything = false;
|
||||
|
||||
for (int i = connections.size(); --i >= 0;)
|
||||
{
|
||||
const Connection* const c = connections.getUnchecked(i);
|
||||
|
||||
const Node* const source = getNodeForId (c->sourceNodeId);
|
||||
const Node* const dest = getNodeForId (c->destNodeId);
|
||||
|
||||
if (source == nullptr || dest == nullptr
|
||||
|| (c->sourceChannelIndex != midiChannelIndex
|
||||
&& ! isPositiveAndBelow (c->sourceChannelIndex, source->processor->getNumOutputChannels()))
|
||||
|| (c->sourceChannelIndex == midiChannelIndex
|
||||
&& ! source->processor->producesMidi())
|
||||
|| (c->destChannelIndex != midiChannelIndex
|
||||
&& ! isPositiveAndBelow (c->destChannelIndex, dest->processor->getNumInputChannels()))
|
||||
|| (c->destChannelIndex == midiChannelIndex
|
||||
&& ! dest->processor->acceptsMidi()))
|
||||
if (! isConnectionLegal (connections.getUnchecked(i)))
|
||||
{
|
||||
removeConnection (i);
|
||||
doneAnything = true;
|
||||
|
|
|
|||
|
|
@ -245,6 +245,13 @@ public:
|
|||
*/
|
||||
bool disconnectNode (uint32 nodeId);
|
||||
|
||||
/** Returns true if the given connection's channel numbers map on to valid
|
||||
channels at each end.
|
||||
Even if a connection is valid when created, its status could change if
|
||||
a node changes its channel config.
|
||||
*/
|
||||
bool isConnectionLegal (Connection* connection) const;
|
||||
|
||||
/** Performs a sanity checks of all the connections.
|
||||
|
||||
This might be useful if some of the processors are doing things like changing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue