|
LMMS
|
#include <AudioProcessorGraph.h>
Classes | |
| class | Node |
| struct | Connection |
| class | AudioGraphIOProcessor |
| struct | AudioProcessorGraphBufferHelpers |
Static Public Attributes | |
| static const uint | midiChannelIndex |
Private Member Functions | |
| void | processAudioAndCV (AudioSampleBuffer &audioBuffer, const AudioSampleBuffer &cvInBuffer, AudioSampleBuffer &cvOutBuffer, MidiBuffer &midiMessages) |
Private Attributes | |
| ReferenceCountedArray< Node > | nodes |
| OwnedArray< Connection > | connections |
| uint32 | lastNodeId |
| OwnedArray< MidiBuffer > | midiBuffers |
| Array< void * > | renderingOps |
| CarlaScopedPointer< AudioProcessorGraphBufferHelpers > | audioAndCVBuffers |
| MidiBuffer * | currentMidiInputBuffer |
| MidiBuffer | currentMidiOutputBuffer |
| bool | isPrepared |
| bool | needsReorder |
| CarlaRecursiveMutex | reorderMutex |
Friends | |
| class | AudioGraphIOProcessor |
Additional Inherited Members | |
| Public Types inherited from water::AudioProcessor | |
| enum | ChannelType { ChannelTypeAudio , ChannelTypeCV , ChannelTypeMIDI } |
| Protected Member Functions inherited from water::AudioProcessor | |
| AudioProcessor () | |
A type of AudioProcessor which plays back a graph of other AudioProcessors.
Use one of these objects if you want to wire-up a set of AudioProcessors and play back the result.
Processors can be added to the graph as "nodes" using addNode(), and once added, you can connect any of their input or output channels to other nodes using addConnection().
To play back a graph through an audio device, you might want to use an AudioProcessorPlayer object.
| water::AudioProcessorGraph::AudioProcessorGraph | ( | ) |
Creates an empty graph.
| water::AudioProcessorGraph::~AudioProcessorGraph | ( | ) |
Destructor. Any processor objects that have been added to the graph will also be deleted.
|
overridevirtual |
Returns true if the processor wants midi messages.
Implements water::AudioProcessor.
| bool water::AudioProcessorGraph::addConnection | ( | ChannelType | channelType, |
| uint32 | sourceNodeId, | ||
| uint | sourceChannelIndex, | ||
| uint32 | destNodeId, | ||
| uint | destChannelIndex ) |
Attempts to connect two specified channels of two nodes.
If this isn't allowed (e.g. because you're trying to connect a midi channel to an audio one or other such nonsense), then it'll return false.
| AudioProcessorGraph::Node * water::AudioProcessorGraph::addNode | ( | AudioProcessor * | newProcessor, |
| uint32 | nodeId = 0 ) |
Adds a node to the graph.
This creates a new node in the graph, for the specified processor. Once you have added a processor to the graph, the graph owns it and will delete it later when it is no longer needed.
The optional nodeId parameter lets you specify an ID to use for the node, but if the value is already in use, this new node will overwrite the old one.
If this succeeds, it returns a pointer to the newly-created node.
| void water::AudioProcessorGraph::buildRenderingSequence | ( | ) |
| bool water::AudioProcessorGraph::canConnect | ( | ChannelType | channelType, |
| uint32 | sourceNodeId, | ||
| uint | sourceChannelIndex, | ||
| uint32 | destNodeId, | ||
| uint | destChannelIndex ) const |
Returns true if it would be legal to connect the specified points.
| void water::AudioProcessorGraph::clear | ( | ) |
Deletes all nodes and connections from this graph. Any processor objects in the graph will be deleted.
| void water::AudioProcessorGraph::clearRenderingSequence | ( | ) |
| bool water::AudioProcessorGraph::disconnectNode | ( | uint32 | nodeId | ) |
Removes all connections from the specified node.
|
inline |
Returns a pointer to one of the connections in the graph.
| const AudioProcessorGraph::Connection * water::AudioProcessorGraph::getConnectionBetween | ( | ChannelType | channelType, |
| uint32 | sourceNodeId, | ||
| uint | sourceChannelIndex, | ||
| uint32 | destNodeId, | ||
| uint | destChannelIndex ) const |
Searches for a connection between some specified channels. If no such connection is found, this returns nullptr.
Returns the name of this processor.
Implements water::AudioProcessor.
Returns a pointer to one of the nodes in the graph. This will return nullptr if the index is out of range.
| AudioProcessorGraph::Node * water::AudioProcessorGraph::getNodeForId | ( | const uint32 | nodeId | ) | const |
Searches the graph for a node with the given ID number and returns it. If no such node was found, this returns nullptr.
|
inline |
Returns the number of connections in the graph.
|
inlinenoexcept |
Returns the number of nodes in the graph.
| const CarlaRecursiveMutex & water::AudioProcessorGraph::getReorderMutex | ( | ) | const |
| bool water::AudioProcessorGraph::isAnInputTo | ( | uint32 | possibleInputId, |
| uint32 | possibleDestinationId, | ||
| int | recursionCheck ) const |
| bool water::AudioProcessorGraph::isConnected | ( | uint32 | possibleSourceNodeId, |
| uint32 | possibleDestNodeId ) const |
Returns true if there is a connection between any of the channels of two specified nodes.
| bool water::AudioProcessorGraph::isConnectionLegal | ( | const Connection * | connection | ) | const |
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.
|
overridevirtual |
Called before playback starts, to let the filter prepare itself.
The sample rate is the target sample rate, and will remain constant until playback stops.
You can call getTotalNumInputChannels and getTotalNumOutputChannels or query the busLayout member variable to find out the number of channels your processBlock callback must process.
The maximumExpectedSamplesPerBlock value is a strong hint about the maximum number of samples that will be provided in each block. You may want to use this value to resize internal buffers. You should program defensively in case a buggy host exceeds this value. The actual block sizes that the host uses may be different each time the callback happens: completely variable block sizes can be expected from some hosts.
Implements water::AudioProcessor.
|
private |
|
overridevirtual |
Renders the next block.
When this method is called, the buffer contains a number of channels which is at least as great as the maximum number of input and output channels that this filter is using. It will be filled with the filter's input data and should be replaced with the filter's output.
So for example if your filter has a total of 2 input channels and 4 output channels, then the buffer will contain 4 channels, the first two being filled with the input data. Your filter should read these, do its processing, and replace the contents of all 4 channels with its output.
Or if your filter has a total of 5 inputs and 2 outputs, the buffer will have 5 channels, all filled with data, and your filter should overwrite the first 2 of these with its output. But be VERY careful not to write anything to the last 3 channels, as these might be mapped to memory that the host assumes is read-only!
If your plug-in has more than one input or output buses then the buffer passed to the processBlock methods will contain a bundle of all channels of each bus. Use AudiobusLayout::getBusBuffer to obtain an audio buffer for a particular bus.
Note that if you have more outputs than inputs, then only those channels that correspond to an input channel are guaranteed to contain sensible data - e.g. in the case of 2 inputs and 4 outputs, the first two channels contain the input, but the last two channels may contain garbage, so you should be careful not to let this pass through without being overwritten or cleared.
Also note that the buffer may have more channels than are strictly necessary, but you should only read/write from the ones that your filter is supposed to be using.
The number of samples in these buffers is NOT guaranteed to be the same for every callback, and may be more or less than the estimated value given to prepareToPlay(). Your code must be able to cope with variable-sized blocks, or you're going to get clicks and crashes!
Also note that some hosts will occasionally decide to pass a buffer containing zero samples, so make sure that your algorithm can deal with that!
If the filter is receiving a midi input, then the midiMessages array will be filled with the midi messages for this block. Each message's timestamp will indicate the message's time, as a number of samples from the start of the block.
Any messages left in the midi buffer when this method has finished are assumed to be the filter's midi output. This means that your filter should be careful to clear any incoming messages from the array if it doesn't want them to be passed-on.
Be very careful about what you do in this callback - it's going to be called by the audio thread, so any kind of interaction with the UI is absolutely out of the question. If you change a parameter in here and need to tell your UI to update itself, the best way is probably to inherit from a ChangeBroadcaster, let the UI components register as listeners, and then call sendChangeMessage() inside the processBlock() method to send out an asynchronous message. You could also use the AsyncUpdater class in a similar way.
Implements water::AudioProcessor.
|
overridevirtual |
Returns true if the processor produces midi messages.
Implements water::AudioProcessor.
|
overridevirtual |
Called after playback has stopped, to let the filter free up any resources it no longer needs.
Implements water::AudioProcessor.
| bool water::AudioProcessorGraph::removeConnection | ( | ChannelType | channelType, |
| uint32 | sourceNodeId, | ||
| uint | sourceChannelIndex, | ||
| uint32 | destNodeId, | ||
| uint | destChannelIndex ) |
Deletes any connection between two specified points. Returns true if a connection was actually deleted.
Deletes the connection with the specified index.
| bool water::AudioProcessorGraph::removeIllegalConnections | ( | ) |
Performs a sanity checks of all the connections.
This might be useful if some of the processors are doing things like changing their channel counts, which could render some connections obsolete.
| bool water::AudioProcessorGraph::removeNode | ( | Node * | node | ) |
Deletes a node within the graph which has the specified ID.
This will also delete any connections that are attached to this node.
| bool water::AudioProcessorGraph::removeNode | ( | uint32 | nodeId | ) |
Deletes a node within the graph which has the specified ID.
This will also delete any connections that are attached to this node.
| void water::AudioProcessorGraph::reorderNowIfNeeded | ( | ) |
|
overridevirtual |
A plugin can override this to be told when it should reset any playing voices.
The default implementation does nothing, but a host may call this to tell the plugin that it should stop any tails or sounds that have been left running.
Reimplemented from water::AudioProcessor.
|
overridevirtualnoexcept |
Called by the host to tell this processor whether it's being used in a non-realtime capacity for offline rendering or bouncing.
Reimplemented from water::AudioProcessor.
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
A special number that represents the midi channel of a node.
This is used as a channel index value if you want to refer to the midi input or output instead of an audio channel.
|
private |
|
private |
|
private |