AudioHardwareInput allows us to expose an AudioSourceProvider for local/live audio input. If there is local/live audio input, we call set() with the audio input data every render quantum. `set()` is called in ... which is one or two frames above the actual hardware io.
| 32 | // If there is local/live audio input, we call set() with the audio input data every render quantum. |
| 33 | // `set()` is called in ... which is one or two frames above the actual hardware io. |
| 34 | class AudioHardwareInput : public AudioSourceProvider |
| 35 | { |
| 36 | AudioBus m_sourceBus; |
| 37 | |
| 38 | public: |
| 39 | AudioHardwareInput(int channelCount) |
| 40 | : m_sourceBus(channelCount, AudioNode::ProcessingSizeInFrames) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | virtual ~AudioHardwareInput() {} |
| 45 | |
| 46 | void set(AudioBus * bus) |
| 47 | { |
| 48 | if (bus) m_sourceBus.copyFrom(*bus); |
| 49 | } |
| 50 | |
| 51 | // Satisfy the AudioSourceProvider interface |
| 52 | virtual void provideInput(AudioBus * destinationBus, int bufferSize) |
| 53 | { |
| 54 | bool isGood = destinationBus && destinationBus->length() == bufferSize && m_sourceBus.length() == bufferSize; |
| 55 | //ASSERT(isGood); |
| 56 | if (isGood) destinationBus->copyFrom(m_sourceBus); |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | } // lab |
| 61 |
nothing calls this directly
no outgoing calls
no test coverage detected