MCPcopy Create free account
hub / github.com/LabSound/LabSound / AudioHardwareInput

Class AudioHardwareInput

include/LabSound/core/AudioSourceProvider.h:34–58  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
34class AudioHardwareInput : public AudioSourceProvider
35{
36 AudioBus m_sourceBus;
37
38public:
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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected