AudioNodeOutput represents a single output for an AudioNode. It may be connected to one or more AudioNodeInputs.
| 20 | // AudioNodeOutput represents a single output for an AudioNode. |
| 21 | // It may be connected to one or more AudioNodeInputs. |
| 22 | class AudioNodeOutput |
| 23 | { |
| 24 | public: |
| 25 | // It's OK to pass 0 for numberOfChannels in which case setNumberOfChannels() must be called later on. |
| 26 | AudioNodeOutput(AudioNode * audioNode, int numberOfChannels, int processingSizeInFrames = AudioNode::ProcessingSizeInFrames); |
| 27 | AudioNodeOutput(AudioNode * audioNode, char const*const name, int numberOfChannels, int processingSizeInFrames = AudioNode::ProcessingSizeInFrames); |
| 28 | virtual ~AudioNodeOutput(); |
| 29 | |
| 30 | // Can be called from any thread. |
| 31 | AudioNode * sourceNode() const { return m_sourceNode; } |
| 32 | |
| 33 | // Causes our AudioNode to process if it hasn't already for this render quantum. |
| 34 | // It returns the bus containing the processed audio for this output, returning inPlaceBus if in-place processing was possible. |
| 35 | // Called from context's audio thread. |
| 36 | AudioBus * pull(ContextRenderLock &, AudioBus * inPlaceBus, int bufferSize); |
| 37 | |
| 38 | // bus() will contain the rendered audio after pull() is called for each rendering time quantum. |
| 39 | AudioBus * bus(ContextRenderLock &) const; |
| 40 | |
| 41 | // renderingFanOutCount() is the number of AudioNodeInputs that we're connected to during rendering. |
| 42 | // Unlike fanOutCount() it will not change during the course of a render quantum. |
| 43 | int renderingFanOutCount() const; |
| 44 | |
| 45 | // renderingParamFanOutCount() is the number of AudioParams that we're connected to during rendering. |
| 46 | // Unlike paramFanOutCount() it will not change during the course of a render quantum. |
| 47 | int renderingParamFanOutCount() const; |
| 48 | |
| 49 | void setNumberOfChannels(ContextRenderLock &, int); |
| 50 | int numberOfChannels() const { return m_numberOfChannels; } |
| 51 | bool isChannelCountKnown() const { return numberOfChannels() > 0; } |
| 52 | |
| 53 | bool isConnected() { return fanOutCount() > 0 || paramFanOutCount() > 0; } |
| 54 | |
| 55 | // updateRenderingState() is called in the audio thread at the start or end of the render quantum to handle any recent changes to the graph state. |
| 56 | void updateRenderingState(ContextRenderLock &); |
| 57 | |
| 58 | const std::string& name() const { return m_name; } |
| 59 | |
| 60 | // Must be called within the context's graph lock. |
| 61 | static void disconnectAll(ContextGraphLock &, std::shared_ptr<AudioNodeOutput>); |
| 62 | static void disconnectAllInputs(ContextGraphLock &, std::shared_ptr<AudioNodeOutput>); |
| 63 | static void disconnectAllParams(ContextGraphLock &, std::shared_ptr<AudioNodeOutput>); |
| 64 | |
| 65 | private: |
| 66 | AudioNode * m_sourceNode; |
| 67 | |
| 68 | friend class AudioNodeInput; |
| 69 | friend class AudioParam; |
| 70 | |
| 71 | // These are called from AudioNodeInput. |
| 72 | // They must be called with the context's graph lock. |
| 73 | void addInput(ContextGraphLock & g, std::shared_ptr<AudioNodeInput>); |
| 74 | void removeInput(ContextGraphLock & g, std::shared_ptr<AudioNodeInput>); |
| 75 | void addParam(ContextGraphLock & g, std::shared_ptr<AudioParam>); |
| 76 | void removeParam(ContextGraphLock & g, std::shared_ptr<AudioParam>); |
| 77 | |
| 78 | // fanOutCount() is the number of AudioNodeInputs that we're connected to. |
| 79 | // This method should not be called in audio thread rendering code, instead renderingFanOutCount() should be used. |
nothing calls this directly
no outgoing calls
no test coverage detected