upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)

This commit is contained in:
Alex Birch
2019-06-22 20:41:38 +01:00
parent d22c2cd4fa
commit 9ee566b251
1140 changed files with 67534 additions and 105952 deletions

View File

@ -104,7 +104,6 @@ public:
private:
//==============================================================================
class ActiveProcess;
friend struct ContainerDeletePolicy<ActiveProcess>;
std::unique_ptr<ActiveProcess> activeProcess;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcess)

View File

@ -90,13 +90,13 @@ public:
//==============================================================================
/** Provides the type of scoped lock to use with a CriticalSection. */
typedef GenericScopedLock <CriticalSection> ScopedLockType;
using ScopedLockType = GenericScopedLock<CriticalSection>;
/** Provides the type of scoped unlocker to use with a CriticalSection. */
typedef GenericScopedUnlock <CriticalSection> ScopedUnlockType;
using ScopedUnlockType = GenericScopedUnlock<CriticalSection>;
/** Provides the type of scoped try-locker to use with a CriticalSection. */
typedef GenericScopedTryLock <CriticalSection> ScopedTryLockType;
using ScopedTryLockType = GenericScopedTryLock<CriticalSection>;
private:
@ -133,8 +133,8 @@ private:
class JUCE_API DummyCriticalSection
{
public:
inline DummyCriticalSection() noexcept {}
inline ~DummyCriticalSection() noexcept {}
inline DummyCriticalSection() = default;
inline ~DummyCriticalSection() = default;
inline void enter() const noexcept {}
inline bool tryEnter() const noexcept { return true; }
@ -148,7 +148,7 @@ public:
};
/** A dummy scoped-unlocker type to use with a dummy critical section. */
typedef ScopedLockType ScopedUnlockType;
using ScopedUnlockType = ScopedLockType;
private:
JUCE_DECLARE_NON_COPYABLE (DummyCriticalSection)
@ -183,7 +183,7 @@ private:
@see CriticalSection, ScopedUnlock
*/
typedef CriticalSection::ScopedLockType ScopedLock;
using ScopedLock = CriticalSection::ScopedLockType;
//==============================================================================
/**
@ -223,7 +223,7 @@ typedef CriticalSection::ScopedLockType ScopedLock;
@see CriticalSection, ScopedLock
*/
typedef CriticalSection::ScopedUnlockType ScopedUnlock;
using ScopedUnlock = CriticalSection::ScopedUnlockType;
//==============================================================================
/**
@ -257,6 +257,6 @@ typedef CriticalSection::ScopedUnlockType ScopedUnlock;
@see CriticalSection::tryEnter, ScopedLock, ScopedUnlock, ScopedReadLock
*/
typedef CriticalSection::ScopedTryLockType ScopedTryLock;
using ScopedTryLock = CriticalSection::ScopedTryLockType;
} // namespace juce

View File

@ -38,7 +38,7 @@ public:
/** Creates an unopened DynamicLibrary object.
Call open() to actually open one.
*/
DynamicLibrary() noexcept {}
DynamicLibrary() = default;
/**
*/

View File

@ -94,8 +94,6 @@ public:
private:
struct Pimpl;
friend struct Pimpl;
friend struct ContainerDeletePolicy<Pimpl>;
std::unique_ptr<Pimpl> pimpl;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HighResolutionTimer)

View File

@ -110,7 +110,6 @@ public:
private:
//==============================================================================
class Pimpl;
friend struct ContainerDeletePolicy<Pimpl>;
std::unique_ptr<Pimpl> pimpl;
CriticalSection lock;

View File

@ -24,9 +24,6 @@ namespace juce
{
ReadWriteLock::ReadWriteLock() noexcept
: numWaitingWriters (0),
numWriters (0),
writerThreadId (0)
{
readerThreads.ensureStorageAllocated (16);
}
@ -141,7 +138,7 @@ void ReadWriteLock::exitWrite() const noexcept
if (--numWriters == 0)
{
writerThreadId = 0;
writerThreadId = {};
waitEvent.signal();
}
}

View File

@ -127,8 +127,8 @@ private:
//==============================================================================
SpinLock accessLock;
WaitableEvent waitEvent;
mutable int numWaitingWriters, numWriters;
mutable Thread::ThreadID writerThreadId;
mutable int numWaitingWriters = 0, numWriters = 0;
mutable Thread::ThreadID writerThreadId = {};
struct ThreadRecursionCount
{

View File

@ -41,8 +41,8 @@ namespace juce
class JUCE_API SpinLock
{
public:
inline SpinLock() noexcept {}
inline ~SpinLock() noexcept {}
inline SpinLock() = default;
inline ~SpinLock() = default;
/** Acquires the lock.
This will block until the lock has been successfully acquired by this thread.
@ -70,10 +70,10 @@ public:
//==============================================================================
/** Provides the type of scoped lock to use for locking a SpinLock. */
typedef GenericScopedLock <SpinLock> ScopedLockType;
using ScopedLockType = GenericScopedLock<SpinLock>;
/** Provides the type of scoped unlocker to use with a SpinLock. */
typedef GenericScopedUnlock <SpinLock> ScopedUnlockType;
using ScopedUnlockType = GenericScopedUnlock<SpinLock>;
private:
//==============================================================================

View File

@ -195,7 +195,7 @@ bool Thread::currentThreadShouldExit()
bool Thread::waitForThreadToExit (const int timeOutMilliseconds) const
{
// Doh! So how exactly do you expect this thread to wait for itself to stop??
jassert (getThreadId() != getCurrentThreadId() || getCurrentThreadId() == 0);
jassert (getThreadId() != getCurrentThreadId() || getCurrentThreadId() == ThreadID());
auto timeoutEnd = Time::getMillisecondCounter() + (uint32) timeOutMilliseconds;
@ -236,7 +236,7 @@ bool Thread::stopThread (const int timeOutMilliseconds)
killThread();
threadHandle = nullptr;
threadId = 0;
threadId = {};
return false;
}
}
@ -288,7 +288,7 @@ bool Thread::setPriority (int newPriority)
bool Thread::setCurrentThreadPriority (const int newPriority)
{
return setThreadPriority (0, newPriority);
return setThreadPriority ({}, newPriority);
}
void Thread::setAffinityMask (const uint32 newAffinityMask)

View File

@ -105,7 +105,7 @@ public:
the stopThread method will wait for a given time-period for this to
happen.
If the thread is stuck and fails to respond after the time-out, it gets
If the thread is stuck and fails to respond after the timeout, it gets
forcibly killed, which is a very bad thing to happen, as it could still
be holding locks, etc. which are needed by other parts of your program.
@ -120,10 +120,12 @@ public:
//==============================================================================
/** Invokes a lambda or function on its own thread.
This will spin up a Thread object which calls the function and then exits.
Bear in mind that starting and stopping a thread can be a fairly heavyweight
operation, so you might prefer to use a ThreadPool if you're kicking off a lot
of short background tasks.
Also note that using an anonymous thread makes it very difficult to interrupt
the function when you need to stop it, e.g. when your app quits. So it's up to
you to deal with situations where the function may fail to stop in time.
@ -143,8 +145,7 @@ public:
this method, to interrupt any waits that might be in progress, and allow it
to reach a point where it can exit.
@see threadShouldExit
@see waitForThreadToExit
@see threadShouldExit, waitForThreadToExit
*/
void signalThreadShouldExit();
@ -179,7 +180,7 @@ public:
class JUCE_API Listener
{
public:
virtual ~Listener() {}
virtual ~Listener() = default;
/** Called if Thread::signalThreadShouldExit was called.
@see Thread::threadShouldExit, Thread::addListener, Thread::removeListener
@ -189,6 +190,7 @@ public:
/** Add a listener to this thread which will receive a callback when
signalThreadShouldExit was called on this thread.
@see signalThreadShouldExit, removeListener
*/
void addListener (Listener*);
@ -223,11 +225,11 @@ public:
};
/** Changes the thread's priority.
May return false if for some reason the priority can't be changed.
@param priority the new priority, in the range 0 (lowest) to 10 (highest). A priority
of 5 is normal.
@see realtimeAudioPriority
*/
bool setPriority (int priority);
@ -252,25 +254,35 @@ public:
void setAffinityMask (uint32 affinityMask);
/** Changes the affinity mask for the caller thread.
This will change the affinity mask for the thread that calls this static method.
@see setAffinityMask
*/
static void JUCE_CALLTYPE setCurrentThreadAffinityMask (uint32 affinityMask);
//==============================================================================
// this can be called from any thread that needs to pause..
/** Suspends the execution of the current thread until the specified timeout period
has elapsed (note that this may not be exact).
The timeout period must not be negative and whilst sleeping the thread cannot
be woken up so it should only be used for short periods of time and when other
methods such as using a WaitableEvent or CriticalSection are not possible.
*/
static void JUCE_CALLTYPE sleep (int milliseconds);
/** Yields the calling thread's current time-slot. */
/** Yields the current thread's CPU time-slot and allows a new thread to run.
If there are no other threads of equal or higher priority currently running then
this will return immediately and the current thread will continue to run.
*/
static void JUCE_CALLTYPE yield();
//==============================================================================
/** Makes the thread wait for a notification.
/** Suspends the execution of this thread until either the specified timeout period
has elapsed, or another thread calls the notify() method to wake it up.
This puts the thread to sleep until either the timeout period expires, or
another thread calls the notify() method to wake it up.
A negative time-out value means that the method will wait indefinitely.
A negative timeout value means that the method will wait indefinitely.
@returns true if the event has been signalled, false if the timeout expires.
*/
@ -286,9 +298,10 @@ public:
//==============================================================================
/** A value type used for thread IDs.
@see getCurrentThreadId(), getThreadId()
*/
typedef void* ThreadID;
using ThreadID = void*;
/** Returns an id that identifies the caller thread.
@ -307,23 +320,65 @@ public:
static Thread* JUCE_CALLTYPE getCurrentThread();
/** Returns the ID of this thread.
That means the ID of this thread object - not of the thread that's calling the method.
This can change when the thread is started and stopped, and will be invalid if the
thread's not actually running.
@see getCurrentThreadId
*/
ThreadID getThreadId() const noexcept;
/** Returns the name of the thread.
This is the name that gets set in the constructor.
*/
/** Returns the name of the thread. This is the name that gets set in the constructor. */
const String& getThreadName() const noexcept { return threadName; }
/** Changes the name of the caller thread.
Different OSes may place different length or content limits on this name.
*/
static void JUCE_CALLTYPE setCurrentThreadName (const String& newThreadName);
#if JUCE_ANDROID || defined (DOXYGEN)
//==============================================================================
/** Initialises the JUCE subsystem for projects not created by the Projucer
On Android, JUCE needs to be initialised once before it is used. The Projucer
will automatically generate the necessary java code to do this. However, if
you are using JUCE without the Projucer or are creating a library made with
JUCE intended for use in non-JUCE apks, then you must call this method
manually once on apk startup.
You can call this method from C++ or directly from java by calling the
following java method:
@code
com.roli.juce.Java.initialiseJUCE (myContext);
@endcode
Note that the above java method is only available in Android Studio projects
created by the Projucer. If you need to call this from another type of project
then you need to add the following java file to
your project:
@code
package com.roli.juce;
public class Java
{
static { System.loadLibrary ("juce_jni"); }
public native static void initialiseJUCE (Context context);
}
@endcode
@param jniEnv this is a pointer to JNI's JNIEnv variable. Any callback
from Java into C++ will have this passed in as it's first
parameter.
@param jContext this is a jobject referring to your app/service/receiver/
provider's Context. JUCE needs this for many of it's internal
functions.
*/
static void initialiseJUCE (void* jniEnv, void* jContext);
#endif
private:
//==============================================================================

View File

@ -48,9 +48,7 @@ class ThreadLocalValue
{
public:
/** */
ThreadLocalValue() noexcept
{
}
ThreadLocalValue() = default;
/** Destructor.
When this object is deleted, all the value objects for all threads will be deleted.

View File

@ -90,7 +90,7 @@ ThreadPoolJob* ThreadPoolJob::getCurrentThreadPoolJob()
}
//==============================================================================
ThreadPool::ThreadPool (const int numThreads, size_t threadStackSize)
ThreadPool::ThreadPool (int numThreads, size_t threadStackSize)
{
jassert (numThreads > 0); // not much point having a pool without any threads!
@ -126,7 +126,7 @@ void ThreadPool::stopThreads()
t->stopThread (500);
}
void ThreadPool::addJob (ThreadPoolJob* const job, const bool deleteJobWhenFinished)
void ThreadPool::addJob (ThreadPoolJob* job, bool deleteJobWhenFinished)
{
jassert (job != nullptr);
jassert (job->pool == nullptr);
@ -190,13 +190,13 @@ ThreadPoolJob* ThreadPool::getJob (int index) const noexcept
return jobs [index];
}
bool ThreadPool::contains (const ThreadPoolJob* const job) const noexcept
bool ThreadPool::contains (const ThreadPoolJob* job) const noexcept
{
const ScopedLock sl (lock);
return jobs.contains (const_cast<ThreadPoolJob*> (job));
}
bool ThreadPool::isJobRunning (const ThreadPoolJob* const job) const noexcept
bool ThreadPool::isJobRunning (const ThreadPoolJob* job) const noexcept
{
const ScopedLock sl (lock);
return jobs.contains (const_cast<ThreadPoolJob*> (job)) && job->isActive;
@ -212,7 +212,7 @@ void ThreadPool::moveJobToFront (const ThreadPoolJob* job) noexcept
jobs.move (index, 0);
}
bool ThreadPool::waitForJobToFinish (const ThreadPoolJob* const job, const int timeOutMs) const
bool ThreadPool::waitForJobToFinish (const ThreadPoolJob* job, int timeOutMs) const
{
if (job != nullptr)
{
@ -230,9 +230,7 @@ bool ThreadPool::waitForJobToFinish (const ThreadPoolJob* const job, const int t
return true;
}
bool ThreadPool::removeJob (ThreadPoolJob* const job,
const bool interruptIfRunning,
const int timeOutMs)
bool ThreadPool::removeJob (ThreadPoolJob* job, bool interruptIfRunning, int timeOutMs)
{
bool dontWait = true;
OwnedArray<ThreadPoolJob> deletionList;
@ -261,8 +259,8 @@ bool ThreadPool::removeJob (ThreadPoolJob* const job,
return dontWait || waitForJobToFinish (job, timeOutMs);
}
bool ThreadPool::removeAllJobs (const bool interruptRunningJobs, const int timeOutMs,
ThreadPool::JobSelector* const selectedJobsToRemove)
bool ThreadPool::removeAllJobs (bool interruptRunningJobs, int timeOutMs,
ThreadPool::JobSelector* selectedJobsToRemove)
{
Array<ThreadPoolJob*> jobsToWaitFor;
@ -319,7 +317,7 @@ bool ThreadPool::removeAllJobs (const bool interruptRunningJobs, const int timeO
return true;
}
StringArray ThreadPool::getNamesOfAllJobs (const bool onlyReturnActiveJobs) const
StringArray ThreadPool::getNamesOfAllJobs (bool onlyReturnActiveJobs) const
{
StringArray s;
const ScopedLock sl (lock);
@ -331,7 +329,7 @@ StringArray ThreadPool::getNamesOfAllJobs (const bool onlyReturnActiveJobs) cons
return s;
}
bool ThreadPool::setThreadPriorities (const int newPriority)
bool ThreadPool::setThreadPriorities (int newPriority)
{
bool ok = true;
@ -421,7 +419,7 @@ bool ThreadPool::runNextJob (ThreadPoolThread& thread)
return false;
}
void ThreadPool::addToDeleteList (OwnedArray<ThreadPoolJob>& deletionList, ThreadPoolJob* const job) const
void ThreadPool::addToDeleteList (OwnedArray<ThreadPoolJob>& deletionList, ThreadPoolJob* job) const
{
job->shouldStop = true;
job->pool = nullptr;

View File

@ -134,7 +134,7 @@ private:
friend class ThreadPool;
String jobName;
ThreadPool* pool = nullptr;
bool shouldStop = false, isActive = false, shouldBeDeleted = false;
std::atomic<bool> shouldStop { false }, isActive { false }, shouldBeDeleted { false };
ListenerList<Thread::Listener, Array<Thread::Listener*, CriticalSection>> listeners;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ThreadPoolJob)
@ -191,7 +191,7 @@ public:
class JUCE_API JobSelector
{
public:
virtual ~JobSelector() {}
virtual ~JobSelector() = default;
/** Should return true if the specified thread matches your criteria for whatever
operation that this object is being used for.
@ -322,8 +322,6 @@ private:
struct ThreadPoolThread;
friend class ThreadPoolJob;
friend struct ThreadPoolThread;
friend struct ContainerDeletePolicy<ThreadPoolThread>;
OwnedArray<ThreadPoolThread> threads;
CriticalSection lock;

View File

@ -44,7 +44,7 @@ class JUCE_API TimeSliceClient
{
public:
/** Destructor. */
virtual ~TimeSliceClient() {}
virtual ~TimeSliceClient() = default;
/** Called back by a TimeSliceThread.
@ -98,7 +98,7 @@ public:
should always call stopThread() with a decent timeout before deleting,
to avoid the thread being forcibly killed (which is a Bad Thing).
*/
~TimeSliceThread();
~TimeSliceThread() override;
//==============================================================================
/** Adds a client to the list.

View File

@ -27,9 +27,8 @@ namespace juce
/**
Allows threads to wait for events triggered by other threads.
A thread can call wait() on a WaitableObject, and this will suspend the
calling thread until another thread wakes it up by calling the signal()
method.
A thread can call WaitableEvent::wait() to suspend the calling thread until
another thread wakes it up by calling the WaitableEvent::signal() method.
@tags{Core}
*/