diff --git a/modules/foleys_dsp_magic/Nodes/foleys_BuiltinNodes.cpp b/modules/foleys_dsp_magic/Nodes/foleys_BuiltinNodes.cpp index 575eccb4..44b0c786 100644 --- a/modules/foleys_dsp_magic/Nodes/foleys_BuiltinNodes.cpp +++ b/modules/foleys_dsp_magic/Nodes/foleys_BuiltinNodes.cpp @@ -17,7 +17,7 @@ AudioInput::AudioInput (DspProgram& program, const juce::ValueTree& node) : DspN void AudioInput::setAudioBuffer (float* const* data, int numChannels, int numSamples) { if (auto* output = getOutput (ConnectionType::Audio, 0)) - output->setAudioBlock (juce::dsp::AudioBlock (data, numChannels, numSamples)); + output->setAudioBlock (juce::dsp::AudioBlock (data, static_cast (numChannels), static_cast (numSamples))); } // ================================================================================ @@ -43,10 +43,10 @@ void AudioOutput::process ([[maybe_unused]] int numSamples) auto audio = source->getAudio(); for (int ch = 0; ch < std::min (buffer.getNumChannels(), static_cast (audio.getNumChannels())); ++ch) - if (buffer.getWritePointer (ch) != audio.getChannelPointer (ch)) - buffer.copyFrom (ch, 0, source->getAudio().getChannelPointer (ch), buffer.getNumSamples()); + if (buffer.getWritePointer (ch) != audio.getChannelPointer (static_cast (ch))) + buffer.copyFrom (ch, 0, source->getAudio().getChannelPointer (static_cast (ch)), buffer.getNumSamples()); - for (int ch = audio.getNumChannels(); ch < buffer.getNumChannels(); ++ch) + for (int ch = static_cast (audio.getNumChannels()); ch < buffer.getNumChannels(); ++ch) buffer.clear (ch, 0, buffer.getNumSamples()); } @@ -59,7 +59,7 @@ void ParameterInput::process ([[maybe_unused]] int numSamples) { for (size_t i = 0; i < parameters.size(); ++i) { - if (auto* parameterOutput = getOutput (ConnectionType::Parameter, i)) + if (auto* parameterOutput = getOutput (ConnectionType::Parameter, static_cast (i))) { auto* parameter = parameters[i]; parameterOutput->setStaticValue (parameter->convertFrom0to1 (parameter->getValue())); diff --git a/modules/foleys_dsp_magic/Nodes/foleys_Gain.cpp b/modules/foleys_dsp_magic/Nodes/foleys_Gain.cpp index b3fcb6a3..60c10109 100644 --- a/modules/foleys_dsp_magic/Nodes/foleys_Gain.cpp +++ b/modules/foleys_dsp_magic/Nodes/foleys_Gain.cpp @@ -12,6 +12,7 @@ Gain::Gain (DspProgram& program, const juce::ValueTree& config) : DspNode (progr { addAudioInput (TRANS ("Audio In")); addParameterInput (TRANS ("Gain")); + addParameterInput (TRANS ("DC")); addAudioOutput (TRANS ("Audio Out")); } @@ -25,12 +26,12 @@ void Gain::process ([[maybe_unused]] int numSamples) audioOutput->setAudioBlock ({}); - if (auto* input = getAudioInputs().front().getOutput()) + if (auto* input = getConnectedOutput (ConnectionType::Audio, 0)) audioOutput->setAudioBlock (input->getAudio()); else return; - if (auto* gain = getParameterInputs().front().getOutput()) + if (auto* gain = getConnectedOutput (ConnectionType::Parameter, 0)) { gain->multiply (audioOutput->getAudio(), 0.0f, 1.0f); } diff --git a/modules/foleys_dsp_magic/Nodes/foleys_Oscilloscope.cpp b/modules/foleys_dsp_magic/Nodes/foleys_Oscilloscope.cpp index 7908bf71..a75d75b2 100644 --- a/modules/foleys_dsp_magic/Nodes/foleys_Oscilloscope.cpp +++ b/modules/foleys_dsp_magic/Nodes/foleys_Oscilloscope.cpp @@ -12,6 +12,8 @@ Oscilloscope::Oscilloscope (DspProgram& program, const juce::ValueTree& config) addAudioInput (TRANS ("Audio In")); addAudioOutput (TRANS ("Audio Out")); + addParameterInput (TRANS ("Parameter Input")); + auto& state = program.getMagicProcessorState(); scope = state.getObjectWithType (getName()); @@ -37,21 +39,25 @@ void Oscilloscope::process ([[maybe_unused]] int numSamples) if (!scope) return; - if (auto* output = getConnectedOutput (ConnectionType::Audio, 0)) - { - auto audio = output->getAudio(); - if (audio.getNumSamples() == 0) - return; + auto* source = getConnectedOutput (ConnectionType::Audio, 0); + if (!source) + source = getConnectedOutput (ConnectionType::Parameter, 0); + + if (!source) + return; + + auto audio = source->getAudio(); + if (audio.getNumSamples() == 0) + return; - float* pointers[audio.getNumChannels()]; - for (size_t c = 0; c < audio.getNumChannels(); ++c) - pointers[c] = audio.getChannelPointer (c); + float* pointers[audio.getNumChannels()]; + for (size_t c = 0; c < audio.getNumChannels(); ++c) + pointers[c] = audio.getChannelPointer (c); - juce::AudioBuffer proxy (pointers, static_cast (audio.getNumChannels()), static_cast (audio.getNumSamples())); - scope->pushSamples (proxy); + juce::AudioBuffer proxy (pointers, static_cast (audio.getNumChannels()), static_cast (audio.getNumSamples())); + scope->pushSamples (proxy); - audioOutput->setAudioBlock (audio); - } + audioOutput->setAudioBlock (audio); }