From d406cacc5fd97eedbd9fdbc4e40a1c8d9be80810 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 5 Jan 2016 16:39:21 +0000 Subject: [PATCH] Avoided some deprecation warnings when building hosts on Windows --- .../Source/GraphEditorPanel.cpp | 19 +++++---- .../format_types/juce_VST3PluginFormat.cpp | 9 +++++ .../format_types/juce_VSTPluginFormat.cpp | 9 +++++ .../processors/juce_AudioProcessor.cpp | 39 +++++-------------- 4 files changed, 40 insertions(+), 36 deletions(-) diff --git a/examples/audio plugin host/Source/GraphEditorPanel.cpp b/examples/audio plugin host/Source/GraphEditorPanel.cpp index 7be63aaa86..af70cebacc 100644 --- a/examples/audio plugin host/Source/GraphEditorPanel.cpp +++ b/examples/audio plugin host/Source/GraphEditorPanel.cpp @@ -227,19 +227,24 @@ public: { String tip; - if (index_ == FilterGraph::midiChannelNumber) + if (index == FilterGraph::midiChannelNumber) { - tip = isInput ? "MIDI Input" : "MIDI Output"; + tip = isInput ? "MIDI Input" + : "MIDI Output"; } else { - if (isInput) - tip = node->getProcessor()->getInputChannelName (index_); - else - tip = node->getProcessor()->getOutputChannelName (index_); + const AudioProcessor::AudioBusArrangement& busArrangement = node->getProcessor()->busArrangement; + + const Array& buses = isInput ? busArrangement.inputBuses + : busArrangement.outputBuses; + + if (buses.size() > 0) + tip = AudioChannelSet::getChannelTypeName (buses.getReference(0).channels.getTypeOfChannel (index)); if (tip.isEmpty()) - tip = (isInput ? "Input " : "Output ") + String (index_ + 1); + tip = (isInput ? "Input " + : "Output ") + String (index + 1); } setTooltip (tip); diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index f8bd159306..a6f10a49aa 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -1576,6 +1576,11 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VST3PluginWindow) }; +#if JUCE_MSVC + #pragma warning (push) + #pragma warning (disable: 4996) // warning about overriding deprecated methods +#endif + //============================================================================== class VST3PluginInstance : public AudioPluginInstance { @@ -2451,6 +2456,10 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VST3PluginInstance) }; +#if JUCE_MSVC + #pragma warning (pop) +#endif + }; //============================================================================== diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 80581bfb0d..d7f30db30b 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -701,6 +701,11 @@ private: static const int defaultVSTSampleRateValue = 44100; static const int defaultVSTBlockSizeValue = 512; +#if JUCE_MSVC + #pragma warning (push) + #pragma warning (disable: 4996) // warning about overriding deprecated methods +#endif + //============================================================================== //============================================================================== class VSTPluginInstance : public AudioPluginInstance, @@ -2681,6 +2686,10 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VSTPluginWindow) }; +#if JUCE_MSVC + #pragma warning (pop) +#endif + //============================================================================== AudioProcessorEditor* VSTPluginInstance::createEditor() { diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp index 6f23bc500a..7abfd5ad13 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp @@ -401,47 +401,28 @@ bool AudioProcessor::supportsDoublePrecisionProcessing() const } //============================================================================== -const String AudioProcessor::getInputChannelName (int channelIndex) const +static String getChannelName (const Array& buses, int index) { - // this is deprecated! Assume the user wants the name of the channel index in the first input bus - if (busArrangement.outputBuses.size() > 0) - return AudioChannelSet::getChannelTypeName (busArrangement.inputBuses.getReference(0) - .channels.getTypeOfChannel (channelIndex)); - - return String(); + return buses.size() > 0 ? AudioChannelSet::getChannelTypeName (buses.getReference(0).channels.getTypeOfChannel (index)) + : String(); } -const String AudioProcessor::getOutputChannelName (int channelIndex) const +const String AudioProcessor::getInputChannelName (int index) const { return getChannelName (busArrangement.inputBuses, index); } +const String AudioProcessor::getOutputChannelName (int index) const { return getChannelName (busArrangement.outputBuses, index); } + +static bool isStereoPair (const Array& buses, int index) { - // this is deprecated! Assume the user wants the name of the channel index in the first output bus - if (busArrangement.outputBuses.size() > 0) - return AudioChannelSet::getChannelTypeName (busArrangement.outputBuses.getReference(0) - .channels.getTypeOfChannel (channelIndex)); - - return String(); -} - -bool AudioProcessor::isInputChannelStereoPair (int index) const -{ - const Array& buses = busArrangement.inputBuses; - return index < 2 && buses.size() > 0 && buses.getReference(0).channels == AudioChannelSet::stereo(); } -bool AudioProcessor::isOutputChannelStereoPair (int index) const -{ - const Array& buses = busArrangement.outputBuses; - - return index < 2 - && buses.size() > 0 - && buses.getReference(0).channels == AudioChannelSet::stereo(); -} +bool AudioProcessor::isInputChannelStereoPair (int index) const { return isStereoPair (busArrangement.inputBuses, index); } +bool AudioProcessor::isOutputChannelStereoPair (int index) const { return isStereoPair (busArrangement.outputBuses, index); } +//============================================================================== bool AudioProcessor::setPreferredBusArrangement (bool isInput, int busIndex, const AudioChannelSet& preferredSet) { - const int oldNumInputs = getTotalNumInputChannels(); const int oldNumOutputs = getTotalNumOutputChannels();