Browse Source

Minor code style tidy-ups

tags/2021-05-28
jules 8 years ago
parent
commit
c587d4b495
10 changed files with 31 additions and 30 deletions
  1. +1
    -1
      modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp
  2. +2
    -2
      modules/juce_audio_plugin_client/AAX/juce_AAX_Modifier_Injector.h
  3. +4
    -3
      modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp
  4. +2
    -2
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  5. +3
    -3
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
  6. +1
    -1
      modules/juce_audio_processors/format_types/juce_AU_Shared.h
  7. +8
    -7
      modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp
  8. +5
    -6
      modules/juce_audio_processors/processors/juce_AudioProcessor.cpp
  9. +2
    -2
      modules/juce_audio_processors/processors/juce_AudioProcessor.h
  10. +3
    -3
      modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp

+ 1
- 1
modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp View File

@@ -162,7 +162,7 @@ bool BufferingAudioSource::waitForNextAudioBlockReady (const AudioSourceChannelI
if (! isLooping() && nextPlayPos > getTotalLength()) if (! isLooping() && nextPlayPos > getTotalLength())
return true; return true;
const uint32 endTime = Time::getMillisecondCounter () + timeout;
const uint32 endTime = Time::getMillisecondCounter() + timeout;
uint32 now = Time::getMillisecondCounter(); uint32 now = Time::getMillisecondCounter();
while (now < endTime) while (now < endTime)


+ 2
- 2
modules/juce_audio_plugin_client/AAX/juce_AAX_Modifier_Injector.h View File

@@ -34,8 +34,8 @@ struct ModifierKeyProvider
struct ModifierKeyReceiver struct ModifierKeyReceiver
{ {
virtual ~ModifierKeyReceiver() {} virtual ~ModifierKeyReceiver() {}
virtual void setModifierKeyProvider (ModifierKeyProvider* provider) = 0;
virtual void removeModifierKeyProvider () = 0;
virtual void setModifierKeyProvider (ModifierKeyProvider*) = 0;
virtual void removeModifierKeyProvider() = 0;
}; };
#endif #endif

+ 4
- 3
modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp View File

@@ -529,13 +529,14 @@ namespace AAXClasses
}; };
static void AAX_CALLBACK algorithmProcessCallback (JUCEAlgorithmContext* const instancesBegin[], const void* const instancesEnd); static void AAX_CALLBACK algorithmProcessCallback (JUCEAlgorithmContext* const instancesBegin[], const void* const instancesEnd);
//============================================================================== //==============================================================================
class JuceAAX_Processor : public AAX_CEffectParameters, class JuceAAX_Processor : public AAX_CEffectParameters,
public juce::AudioPlayHead, public juce::AudioPlayHead,
public AudioProcessorListener public AudioProcessorListener
{ {
public: public:
JuceAAX_Processor ()
JuceAAX_Processor()
: pluginInstance (createPluginFilterOfType (AudioProcessor::wrapperType_AAX)), : pluginInstance (createPluginFilterOfType (AudioProcessor::wrapperType_AAX)),
isPrepared (false), isPrepared (false),
sampleRate (0), lastBufferSize (1024), maxBufferSize (1024) sampleRate (0), lastBufferSize (1024), maxBufferSize (1024)
@@ -551,7 +552,7 @@ namespace AAXClasses
static AAX_CEffectParameters* AAX_CALLBACK Create() static AAX_CEffectParameters* AAX_CALLBACK Create()
{ {
PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AAX; PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AAX;
return new JuceAAX_Processor ();
return new JuceAAX_Processor();
} }
AAX_Result Uninitialize() override AAX_Result Uninitialize() override
@@ -629,7 +630,7 @@ namespace AAXClasses
juce::MemoryBlock& tempFilterData = getTemporaryChunkMemory(); juce::MemoryBlock& tempFilterData = getTemporaryChunkMemory();
if (tempFilterData.getSize() == 0) if (tempFilterData.getSize() == 0)
return 20700 /*AAX_ERROR_PLUGIN_API_INVALID_THREAD*/;
return 20700; // AAX_ERROR_PLUGIN_API_INVALID_THREAD
oChunk->fSize = (int32_t) tempFilterData.getSize(); oChunk->fSize = (int32_t) tempFilterData.getSize();
tempFilterData.copyTo (oChunk->fData, 0, tempFilterData.getSize()); tempFilterData.copyTo (oChunk->fData, 0, tempFilterData.getSize());


+ 2
- 2
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -1472,8 +1472,8 @@ private:
} }
else else
{ {
maxTotalIns = numInputBuses > 0 ? filter->getBus (true, 0)->getMaxSupportedChannels () : 0;
maxTotalOuts = numOutputBuses > 0 ? filter->getBus (false, 0)->getMaxSupportedChannels () : 0;
maxTotalIns = numInputBuses > 0 ? filter->getBus (true, 0)->getMaxSupportedChannels() : 0;
maxTotalOuts = numOutputBuses > 0 ? filter->getBus (false, 0)->getMaxSupportedChannels() : 0;
} }
#endif #endif
} }


+ 3
- 3
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -632,14 +632,14 @@ private:
parameterToMidiControllerOffset = static_cast<Vst::ParamID> (usingManagedParameter ? paramMidiControllerOffset parameterToMidiControllerOffset = static_cast<Vst::ParamID> (usingManagedParameter ? paramMidiControllerOffset
: parameters.getParameterCount()); : parameters.getParameterCount());
initialiseMidiControllerMappings ();
initialiseMidiControllerMappings();
#endif #endif
audioProcessorChanged (pluginInstance); audioProcessorChanged (pluginInstance);
} }
} }
void initialiseMidiControllerMappings ()
void initialiseMidiControllerMappings()
{ {
for (int c = 0, p = 0; c < numMIDIChannels; ++c) for (int c = 0, p = 0; c < numMIDIChannels; ++c)
{ {
@@ -1942,7 +1942,7 @@ private:
processParameterChanges (*data.inputParameterChanges); processParameterChanges (*data.inputParameterChanges);
#if JUCE_DEBUG && ! JucePlugin_ProducesMidiOutput #if JUCE_DEBUG && ! JucePlugin_ProducesMidiOutput
const int numMidiEventsComingIn = midiBuffer.getNumEvents ();
const int numMidiEventsComingIn = midiBuffer.getNumEvents();
#endif #endif
if (pluginInstance->isSuspended()) if (pluginInstance->isSuspended())


+ 1
- 1
modules/juce_audio_processors/format_types/juce_AU_Shared.h View File

@@ -363,7 +363,7 @@ struct AudioUnitHelpers
HeapBlock<int>& layoutMapStorage = isInput ? inputLayoutMapStorage : outputLayoutMapStorage; HeapBlock<int>& layoutMapStorage = isInput ? inputLayoutMapStorage : outputLayoutMapStorage;
int**& layoutMap = isInput ? inputLayoutMap : outputLayoutMap; int**& layoutMap = isInput ? inputLayoutMap : outputLayoutMap;
const int totalInChannels = processor.getTotalNumInputChannels ();
const int totalInChannels = processor.getTotalNumInputChannels();
const int totalOutChannels = processor.getTotalNumOutputChannels(); const int totalOutChannels = processor.getTotalNumOutputChannels();
layoutMapPtrStorage.calloc (static_cast<size_t> (numBuses)); layoutMapPtrStorage.calloc (static_cast<size_t> (numBuses));


+ 8
- 7
modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -361,7 +361,7 @@ class VST3HostContext : public Vst::IComponentHandler, // From VST V3.0.0
public Vst::IUnitHandler public Vst::IUnitHandler
{ {
public: public:
VST3HostContext () : plugin (nullptr)
VST3HostContext() : plugin (nullptr)
{ {
appName = File::getSpecialLocation (File::currentApplicationFile).getFileNameWithoutExtension(); appName = File::getSpecialLocation (File::currentApplicationFile).getFileNameWithoutExtension();
attributeList = new AttributeList (this); attributeList = new AttributeList (this);
@@ -1627,7 +1627,7 @@ struct VST3ComponentHolder
} }
// transfers ownership to the plugin instance! // transfers ownership to the plugin instance!
AudioPluginInstance* createPluginInstance ();
AudioPluginInstance* createPluginInstance();
bool fetchController (ComSmartPtr<Vst::IEditController>& editController) bool fetchController (ComSmartPtr<Vst::IEditController>& editController)
{ {
@@ -2364,7 +2364,7 @@ public:
struct ParamValueQueue : public Vst::IParamValueQueue struct ParamValueQueue : public Vst::IParamValueQueue
{ {
ParamValueQueue () : paramID (static_cast<Vst::ParamID> (-1))
ParamValueQueue() : paramID (static_cast<Vst::ParamID> (-1))
{ {
points.ensureStorageAllocated (1024); points.ensureStorageAllocated (1024);
} }
@@ -2686,7 +2686,7 @@ private:
return paramInfo; return paramInfo;
} }
void syncProgramNames ()
void syncProgramNames()
{ {
programNames.clear(); programNames.clear();
@@ -2767,12 +2767,13 @@ private:
}; };
//============================================================================== //==============================================================================
AudioPluginInstance* VST3Classes::VST3ComponentHolder::createPluginInstance ()
AudioPluginInstance* VST3Classes::VST3ComponentHolder::createPluginInstance()
{ {
if (! initialise()) return nullptr;
if (! initialise())
return nullptr;
VST3PluginInstance* plugin = new VST3PluginInstance (this); VST3PluginInstance* plugin = new VST3PluginInstance (this);
host->setPlugin (plugin); host->setPlugin (plugin);
return plugin; return plugin;
} }


+ 5
- 6
modules/juce_audio_processors/processors/juce_AudioProcessor.cpp View File

@@ -224,7 +224,7 @@ bool AudioProcessor::setChannelLayoutOfBus (bool isInputBus, int busIdx, const A
return false; return false;
} }
bool AudioProcessor::enableAllBuses ()
bool AudioProcessor::enableAllBuses()
{ {
BusesLayout layouts; BusesLayout layouts;
const int numInputs = getBusCount (true); const int numInputs = getBusCount (true);
@@ -382,7 +382,7 @@ void AudioProcessor::setPlayConfigDetails (const int newNumIns,
success &= setChannelLayoutOfBus (false, 0, AudioChannelSet::canonicalChannelSet (newNumOuts)); success &= setChannelLayoutOfBus (false, 0, AudioChannelSet::canonicalChannelSet (newNumOuts));
// if the user is using this method then they do not want any side-buses or aux outputs // if the user is using this method then they do not want any side-buses or aux outputs
success &= disableNonMainBuses ();
success &= disableNonMainBuses();
jassert (success); jassert (success);
// the processor may not support this arrangement at all // the processor may not support this arrangement at all
@@ -840,15 +840,14 @@ bool AudioProcessor::containsLayout (const BusesLayout& layouts, const Array<InO
if (layouts.inputBuses.size() > 1 || layouts.outputBuses.size() > 1) if (layouts.inputBuses.size() > 1 || layouts.outputBuses.size() > 1)
return false; return false;
const InOutChannelPair mainLayout
( static_cast<int16> (layouts.getNumChannels (true, 0)),
static_cast<int16> (layouts.getNumChannels (false, 0)) );
const InOutChannelPair mainLayout (static_cast<int16> (layouts.getNumChannels (true, 0)),
static_cast<int16> (layouts.getNumChannels (false, 0)));
return channelLayouts.contains (mainLayout); return channelLayouts.contains (mainLayout);
} }
//============================================================================== //==============================================================================
bool AudioProcessor::disableNonMainBuses ()
bool AudioProcessor::disableNonMainBuses()
{ {
BusesLayout layouts = getBusesLayout(); BusesLayout layouts = getBusesLayout();


+ 2
- 2
modules/juce_audio_processors/processors/juce_AudioProcessor.h View File

@@ -602,7 +602,7 @@ public:
bool enableAllBuses(); bool enableAllBuses();
/** Disables all non-main buses (aux and sidechains). */ /** Disables all non-main buses (aux and sidechains). */
bool disableNonMainBuses ();
bool disableNonMainBuses();
//============================================================================== //==============================================================================
/** Returns the position of a bus's channels within the processBlock buffer. /** Returns the position of a bus's channels within the processBlock buffer.
@@ -1452,7 +1452,7 @@ private:
{ {
int16 inChannels, outChannels; int16 inChannels, outChannels;
InOutChannelPair () noexcept : inChannels (0), outChannels (0) {}
InOutChannelPair() noexcept : inChannels (0), outChannels (0) {}
InOutChannelPair (short inCh, short outCh) noexcept : inChannels (inCh), outChannels (outCh) {} InOutChannelPair (short inCh, short outCh) noexcept : inChannels (inCh), outChannels (outCh) {}
InOutChannelPair (const InOutChannelPair& o) noexcept : inChannels (o.inChannels), outChannels (o.outChannels) {} InOutChannelPair (const InOutChannelPair& o) noexcept : inChannels (o.inChannels), outChannels (o.outChannels) {}
InOutChannelPair (const short (&config)[2]) noexcept : inChannels (config[0]), outChannels (config[1]) {} InOutChannelPair (const short (&config)[2]) noexcept : inChannels (config[0]), outChannels (config[1]) {}


+ 3
- 3
modules/juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp View File

@@ -66,12 +66,12 @@ struct AudioProcessorValueTreeState::Parameter : public AudioProcessorParamete
: AudioProcessorParameter::getText (v, length); : AudioProcessorParameter::getText (v, length);
} }
int getNumSteps () const override
int getNumSteps() const override
{ {
if (range.interval > 0) if (range.interval > 0)
return (static_cast<int> ((range.end - range.start) / range.interval) + 1); return (static_cast<int> ((range.end - range.start) / range.interval) + 1);
else
return AudioProcessor::getDefaultNumParameterSteps ();
return AudioProcessor::getDefaultNumParameterSteps();
} }
void setValue (float newValue) override void setValue (float newValue) override


Loading…
Cancel
Save