hi, I’d like to pass in a plugin to AudioBuffer what comes from DeviceCallback:
My plugin is designed to be of type input or output and the purpose is to stream audio from another an AudioDevice chosen with an AudioDeviceManager:
So the question is: how to fill audioBuffer from callback inputChannelData if it’s of type input and fill from audioBuffer outputChannelData? I need an iterator that is incremented in callback until samplesBlock*numChannel?
class DeviceCallback : public juce::AudioIODeviceCallback
{
public:
DeviceCallback(DevicemanagerinpluginAudioProcessor& processor) : audioDeviceProcessor(processor) {}
~DeviceCallback() {}
void audioDeviceIOCallbackWithContext (const float *const *inputChannelData, int numInputChannels, float *const *outputChannelData, int numOutputChannels, int numSamples, const juce::AudioIODeviceCallbackContext &context) override
{
if (audioDeviceProcessor.inOrOut == DevicemanagerinpluginAudioProcessor::Type::input)
{
// Here I want to fill BufferToPass of audioDeviceProcessor
// with inputChannelData and numInputChannels
} else {
// Here I want to get from BufferToPass data to fill
// outputChannelData and numOutputChannels
}
}
void audioDeviceAboutToStart (juce::AudioIODevice *device) override
{
audioDeviceProcessor.suspendProcessing(false); //?
}
void audioDeviceStopped () override
{
audioDeviceProcessor.suspendProcessing(true); //?
}
void audioDeviceError (const juce::String &errorMessage) override
{
audioDeviceProcessor.suspendProcessing(true); //?
}
private:
DevicemanagerinpluginAudioProcessor& audioDeviceProcessor;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DeviceCallback)
};
Is it a correct approach? up to now I can send audio data in output (sometimes I can listen some glitches, maybe because processBlocks are not in sync?) but not audio data in input and I don’t know why when I close my app (basically an AudioProcessorGraph) it takes a lot of time to shutdown…
any help is really appreciated, I really urgently need to make this work…
Here the gui of two plugin types to clarify purposes:
Ok after some tests I noticed that input meter of my plugin doesn’t show me nothing, so the problem is that AudioDeviceManager in input is not capturing nothing … But The thing is stranger … If I open the audioDeviceSelectorComponent of the standaloneApp that host my plugin (the basic standalone app given by juce) I can notice that Audio in input is not captured (for any device type and any channel active) … stranger and stranger … If I chose another audioDevice type in input in the combobox name is not updated, while the “active output channels” yes. If I change the input device type both combobox of device type are changed show input device type name and the “active output channels” shows me the channels of the last audio device available (while “active input channels” are right)… In demorunner or audioPluginHost the behaviour of audioDeviceSelectorComponent is right, but if I create another plugin app from scratch the behaviour is the same I expose above… this really goes me mad…