mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fix multiple warnings in VS 2015
This commit is contained in:
parent
8d92a77452
commit
359f6e29aa
7 changed files with 104 additions and 37 deletions
|
|
@ -333,7 +333,7 @@ struct AAXClasses
|
|||
{
|
||||
AudioProcessorEditor::ParameterControlHighlightInfo info;
|
||||
info.parameterIndex = getParamIndexFromID (paramID);
|
||||
info.isHighlighted = isHighlighted;
|
||||
info.isHighlighted = (isHighlighted != 0);
|
||||
info.suggestedColour = getColourFromHighlightEnum (colour);
|
||||
|
||||
component->pluginEditor->setControlHighlight (info);
|
||||
|
|
|
|||
|
|
@ -1374,8 +1374,8 @@ public:
|
|||
|
||||
void resized() override
|
||||
{
|
||||
if (Component* const editor = getChildComponent(0))
|
||||
editor->setBounds (getLocalBounds());
|
||||
if (Component* const editorChildComp = getChildComponent(0))
|
||||
editorChildComp->setBounds (getLocalBounds());
|
||||
|
||||
#if JUCE_MAC && ! JUCE_64BIT
|
||||
if (! wrapper.useNSView)
|
||||
|
|
|
|||
|
|
@ -204,11 +204,11 @@ public:
|
|||
toString128 (result, owner.getParameterText (paramIndex, 128));
|
||||
}
|
||||
|
||||
bool fromString (const Vst::TChar* text, Vst::ParamValue& valueNormalized) const override
|
||||
bool fromString (const Vst::TChar* text, Vst::ParamValue& outValueNormalized) const override
|
||||
{
|
||||
if (AudioProcessorParameter* p = owner.getParameters()[paramIndex])
|
||||
{
|
||||
valueNormalized = p->getValueForText (getStringFromVstTChars (text));
|
||||
outValueNormalized = p->getValueForText (getStringFromVstTChars (text));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -460,12 +460,12 @@ private:
|
|||
|
||||
tresult PLUGIN_API canResize() override { return kResultTrue; }
|
||||
|
||||
tresult PLUGIN_API checkSizeConstraint (ViewRect* rect) override
|
||||
tresult PLUGIN_API checkSizeConstraint (ViewRect* rectToCheck) override
|
||||
{
|
||||
if (rect != nullptr && component != nullptr)
|
||||
if (rectToCheck != nullptr && component != nullptr)
|
||||
{
|
||||
rect->right = rect->left + component->getWidth();
|
||||
rect->bottom = rect->top + component->getHeight();
|
||||
rectToCheck->right = rectToCheck->left + component->getWidth();
|
||||
rectToCheck->bottom = rectToCheck->top + component->getHeight();
|
||||
return kResultTrue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1690,11 +1690,11 @@ public:
|
|||
outputArrangements.add (getArrangementForBus (processor, false, i));
|
||||
}
|
||||
|
||||
void prepareToPlay (double sampleRate, int estimatedSamplesPerBlock) override
|
||||
void prepareToPlay (double newSampleRate, int estimatedSamplesPerBlock) override
|
||||
{
|
||||
// Avoid redundantly calling things like setActive, which can be a heavy-duty call for some plugins:
|
||||
if (isActive
|
||||
&& getSampleRate() == sampleRate
|
||||
&& getSampleRate() == newSampleRate
|
||||
&& getBlockSize() == estimatedSamplesPerBlock)
|
||||
return;
|
||||
|
||||
|
|
@ -1703,7 +1703,7 @@ public:
|
|||
ProcessSetup setup;
|
||||
setup.symbolicSampleSize = kSample32;
|
||||
setup.maxSamplesPerBlock = estimatedSamplesPerBlock;
|
||||
setup.sampleRate = sampleRate;
|
||||
setup.sampleRate = newSampleRate;
|
||||
setup.processMode = isNonRealtime() ? kOffline : kRealtime;
|
||||
|
||||
warnOnFailure (processor->setupProcessing (setup));
|
||||
|
|
@ -1736,7 +1736,7 @@ public:
|
|||
// Needed for having the same sample rate in processBlock(); some plugins need this!
|
||||
setPlayConfigDetails (getNumSingleDirectionChannelsFor (component, true, true),
|
||||
getNumSingleDirectionChannelsFor (component, false, true),
|
||||
sampleRate, estimatedSamplesPerBlock);
|
||||
newSampleRate, estimatedSamplesPerBlock);
|
||||
|
||||
setStateForAllBusses (true);
|
||||
|
||||
|
|
@ -1858,10 +1858,10 @@ public:
|
|||
{
|
||||
if (processor != nullptr)
|
||||
{
|
||||
const double sampleRate = getSampleRate();
|
||||
const double currentSampleRate = getSampleRate();
|
||||
|
||||
if (sampleRate > 0.0)
|
||||
return jlimit (0, 0x7fffffff, (int) processor->getTailSamples()) / sampleRate;
|
||||
if (currentSampleRate > 0.0)
|
||||
return jlimit (0, 0x7fffffff, (int) processor->getTailSamples()) / currentSampleRate;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
|
|
|
|||
|
|
@ -895,13 +895,13 @@ public:
|
|||
if (effect == nullptr)
|
||||
return 0.0;
|
||||
|
||||
const double sampleRate = getSampleRate();
|
||||
const double currentSampleRate = getSampleRate();
|
||||
|
||||
if (sampleRate <= 0)
|
||||
if (currentSampleRate <= 0)
|
||||
return 0.0;
|
||||
|
||||
VstIntPtr samples = dispatch (effGetTailSize, 0, 0, 0, 0);
|
||||
return samples / sampleRate;
|
||||
return samples / currentSampleRate;
|
||||
}
|
||||
|
||||
bool acceptsMidi() const override { return wantsMidiMessages; }
|
||||
|
|
@ -986,10 +986,10 @@ public:
|
|||
|
||||
if (initialised)
|
||||
{
|
||||
if (AudioPlayHead* const playHead = getPlayHead())
|
||||
if (AudioPlayHead* const currentPlayHead = getPlayHead())
|
||||
{
|
||||
AudioPlayHead::CurrentPositionInfo position;
|
||||
if (playHead->getCurrentPosition (position))
|
||||
if (currentPlayHead->getCurrentPosition (position))
|
||||
{
|
||||
|
||||
vstHostTime.samplePos = (double) position.timeInSamples;
|
||||
|
|
@ -2089,13 +2089,13 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
static bool reentrant = false;
|
||||
static bool reentrantGuard = false;
|
||||
|
||||
if (! reentrant)
|
||||
if (! reentrantGuard)
|
||||
{
|
||||
reentrant = true;
|
||||
reentrantGuard = true;
|
||||
plugin.dispatch (effEditIdle, 0, 0, 0, 0);
|
||||
reentrant = false;
|
||||
reentrantGuard = false;
|
||||
}
|
||||
|
||||
#if JUCE_LINUX
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ struct DefaultHashFunctions
|
|||
int generateHash (const String& key, const int upperLimit) const noexcept { return (int) (((uint32) key.hashCode()) % (uint32) upperLimit); }
|
||||
/** Generates a simple hash from a variant. */
|
||||
int generateHash (const var& key, const int upperLimit) const noexcept { return generateHash (key.toString(), upperLimit); }
|
||||
/** Generates a simple hash from a void ptr. */
|
||||
int generateHash (const void* key, const int upperLimit) const noexcept { return (int)(((pointer_sized_uint) key) % ((pointer_sized_uint) upperLimit)); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -256,6 +256,77 @@ private:
|
|||
template <typename Type> static Type juce_InterlockedDecrement64 (volatile Type* a) noexcept { jassertfalse; return --*a; }
|
||||
#define JUCE_64BIT_ATOMICS_UNAVAILABLE 1
|
||||
#endif
|
||||
|
||||
template <typename Type, std::size_t sizeOfType>
|
||||
struct WindowsInterlockedHelpersBase
|
||||
{};
|
||||
|
||||
template <typename Type>
|
||||
struct WindowsInterlockedHelpersBase<Type, 4>
|
||||
{
|
||||
static inline Type exchange(volatile Type* value, Type other) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedExchange (reinterpret_cast<volatile long*> (value), castTo (other)));
|
||||
}
|
||||
|
||||
static inline Type add(volatile Type* value, Type other) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedExchangeAdd (reinterpret_cast<volatile long*> (value), castTo (other)) + castTo (other));
|
||||
}
|
||||
|
||||
static inline Type inc(volatile Type* value) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedIncrement (reinterpret_cast<volatile long*> (value)));
|
||||
}
|
||||
|
||||
static inline Type dec(volatile Type* value) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedDecrement (reinterpret_cast<volatile long*> (value)));
|
||||
}
|
||||
|
||||
static inline Type cmp(volatile Type* value, Type other, Type comparand) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedCompareExchange (reinterpret_cast<volatile long*> (value), castTo (other), castTo (comparand)));
|
||||
}
|
||||
|
||||
static inline Type castFrom (long value) { union { long in; Type out; } u; u.in = value; return u.out; }
|
||||
static inline long castTo (Type value) { union { Type in; long out; } u; u.in = value; return u.out; }
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
struct WindowsInterlockedHelpersBase<Type, 8>
|
||||
{
|
||||
static inline Type exchange(volatile Type* value, Type other) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedExchange64 (reinterpret_cast<volatile __int64*> (value), castTo (other)));
|
||||
}
|
||||
|
||||
static inline Type add(volatile Type* value, Type other) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedExchangeAdd64 (reinterpret_cast<volatile __int64*> (value), castTo (other)) + castTo (other));
|
||||
}
|
||||
|
||||
static inline Type inc(volatile Type* value) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedIncrement64 (reinterpret_cast<volatile __int64*> (value)));
|
||||
}
|
||||
|
||||
static inline Type dec(volatile Type* value) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedDecrement64 (reinterpret_cast<volatile __int64*> (value)));
|
||||
}
|
||||
|
||||
static inline Type cmp(volatile Type* value, Type other, Type comparand) noexcept
|
||||
{
|
||||
return castFrom (juce_InterlockedCompareExchange64 (reinterpret_cast<volatile __int64*> (value), castTo (other), castTo (comparand)));
|
||||
}
|
||||
|
||||
static inline Type castFrom (__int64 value) { union { __int64 in; Type out; } u; u.in = value; return u.out; }
|
||||
static inline __int64 castTo (Type value) { union { Type in; __int64 out; } u; u.in = value; return u.out; }
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
struct WindowsInterlockedHelpers : WindowsInterlockedHelpersBase<Type, sizeof (Type)> {};
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -272,8 +343,7 @@ inline Type Atomic<Type>::get() const noexcept
|
|||
return sizeof (Type) == 4 ? castFrom32Bit ((int32) OSAtomicAdd32Barrier ((int32_t) 0, (JUCE_MAC_ATOMICS_VOLATILE int32_t*) &value))
|
||||
: castFrom64Bit ((int64) OSAtomicAdd64Barrier ((int64_t) 0, (JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value));
|
||||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? castFrom32Bit ((int32) juce_InterlockedExchangeAdd ((volatile long*) &value, (long) 0))
|
||||
: castFrom64Bit ((int64) juce_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) 0));
|
||||
return WindowsInterlockedHelpers<Type>::add (const_cast<volatile Type*> (&value), (Type) 0);
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_add_and_fetch ((volatile int32*) &value, 0))
|
||||
: castFrom64Bit ((int64) __sync_add_and_fetch ((volatile int64*) &value, 0));
|
||||
|
|
@ -288,8 +358,7 @@ inline Type Atomic<Type>::exchange (const Type newValue) noexcept
|
|||
while (! compareAndSetBool (newValue, currentVal)) { currentVal = value; }
|
||||
return currentVal;
|
||||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? castFrom32Bit ((int32) juce_InterlockedExchange ((volatile long*) &value, (long) castTo32Bit (newValue)))
|
||||
: castFrom64Bit ((int64) juce_InterlockedExchange64 ((volatile __int64*) &value, (__int64) castTo64Bit (newValue)));
|
||||
return WindowsInterlockedHelpers<Type>::exchange (&value, newValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -300,8 +369,7 @@ inline Type Atomic<Type>::operator+= (const Type amountToAdd) noexcept
|
|||
return sizeof (Type) == 4 ? (Type) OSAtomicAdd32Barrier ((int32_t) castTo32Bit (amountToAdd), (JUCE_MAC_ATOMICS_VOLATILE int32_t*) &value)
|
||||
: (Type) OSAtomicAdd64Barrier ((int64_t) amountToAdd, (JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
||||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? (Type) (juce_InterlockedExchangeAdd ((volatile long*) &value, (long) amountToAdd) + (long) amountToAdd)
|
||||
: (Type) (juce_InterlockedExchangeAdd64 ((volatile __int64*) &value, (__int64) amountToAdd) + (__int64) amountToAdd);
|
||||
return WindowsInterlockedHelpers<Type>::add (&value, amountToAdd);
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return (Type) __sync_add_and_fetch (&value, amountToAdd);
|
||||
#endif
|
||||
|
|
@ -320,8 +388,7 @@ inline Type Atomic<Type>::operator++() noexcept
|
|||
return sizeof (Type) == 4 ? (Type) OSAtomicIncrement32Barrier ((JUCE_MAC_ATOMICS_VOLATILE int32_t*) &value)
|
||||
: (Type) OSAtomicIncrement64Barrier ((JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
||||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? (Type) juce_InterlockedIncrement ((volatile long*) &value)
|
||||
: (Type) juce_InterlockedIncrement64 ((volatile __int64*) &value);
|
||||
return WindowsInterlockedHelpers<Type>::inc (&value);
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return sizeof (Type) == 4 ? (Type) __sync_add_and_fetch (&value, (Type) 1)
|
||||
: (Type) __sync_add_and_fetch ((int64_t*) &value, 1);
|
||||
|
|
@ -335,8 +402,7 @@ inline Type Atomic<Type>::operator--() noexcept
|
|||
return sizeof (Type) == 4 ? (Type) OSAtomicDecrement32Barrier ((JUCE_MAC_ATOMICS_VOLATILE int32_t*) &value)
|
||||
: (Type) OSAtomicDecrement64Barrier ((JUCE_MAC_ATOMICS_VOLATILE int64_t*) &value);
|
||||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? (Type) juce_InterlockedDecrement ((volatile long*) &value)
|
||||
: (Type) juce_InterlockedDecrement64 ((volatile __int64*) &value);
|
||||
return WindowsInterlockedHelpers<Type>::dec (&value);
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return sizeof (Type) == 4 ? (Type) __sync_add_and_fetch (&value, (Type) -1)
|
||||
: (Type) __sync_add_and_fetch ((int64_t*) &value, -1);
|
||||
|
|
@ -372,8 +438,7 @@ inline Type Atomic<Type>::compareAndSetValue (const Type newValue, const Type va
|
|||
}
|
||||
|
||||
#elif JUCE_ATOMICS_WINDOWS
|
||||
return sizeof (Type) == 4 ? castFrom32Bit ((int32) juce_InterlockedCompareExchange ((volatile long*) &value, (long) castTo32Bit (newValue), (long) castTo32Bit (valueToCompare)))
|
||||
: castFrom64Bit ((int64) juce_InterlockedCompareExchange64 ((volatile __int64*) &value, (__int64) castTo64Bit (newValue), (__int64) castTo64Bit (valueToCompare)));
|
||||
return WindowsInterlockedHelpers<Type>::cmp (&value, newValue, valueToCompare);
|
||||
#elif JUCE_ATOMICS_GCC
|
||||
return sizeof (Type) == 4 ? castFrom32Bit ((int32) __sync_val_compare_and_swap ((volatile int32*) &value, castTo32Bit (valueToCompare), castTo32Bit (newValue)))
|
||||
: castFrom64Bit ((int64) __sync_val_compare_and_swap ((volatile int64*) &value, castTo64Bit (valueToCompare), castTo64Bit (newValue)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue