From ca348c06d7c4be03acbd00b40b01c6ecaa2ef6a6 Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Sun, 11 Apr 2010 16:06:48 +0100 Subject: [PATCH] Minor SVG fix. Added manual reset option to WaitableEvent. Made AudioFilterStreamer update channel numbers when the audio device changes. --- build/win32/vc6/JUCE.dsp | 3 +- .../Standalone/juce_AudioFilterStreamer.cpp | 5 +++ juce_amalgamated.cpp | 35 ++++++++++++------- juce_amalgamated.h | 2 +- src/gui/graphics/drawables/juce_SVGParser.cpp | 3 ++ src/native/common/juce_posix_SharedCode.h | 14 +++++--- src/native/windows/juce_win32_Threads.cpp | 4 +-- src/threads/juce_WaitableEvent.h | 13 ++++--- 8 files changed, 53 insertions(+), 26 deletions(-) diff --git a/build/win32/vc6/JUCE.dsp b/build/win32/vc6/JUCE.dsp index 12cbe8c75a..18ce6ae4d1 100644 --- a/build/win32/vc6/JUCE.dsp +++ b/build/win32/vc6/JUCE.dsp @@ -65,8 +65,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "../../../bin/intermediate_win32/staticdebug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MDd /W3 /Gm /GR /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MDd /W3 /Gm /GR /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "_LIB" /FR /FD /GZ /Zm1024 /c # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe diff --git a/extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp b/extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp index af2689a4be..b2c750fead 100644 --- a/extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp +++ b/extras/audio plugins/wrapper/Standalone/juce_AudioFilterStreamer.cpp @@ -99,6 +99,11 @@ void AudioFilterStreamer::audioDeviceAboutToStart (AudioIODevice* device) { sampleRate = device->getCurrentSampleRate(); + filter.setPlayConfigDetails (device->getActiveInputChannels().countNumberOfSetBits(), + device->getActiveOutputChannels().countNumberOfSetBits(), + device->getCurrentSampleRate(), + device->getCurrentBufferSizeSamples()); + isPlaying = true; emptyBuffer.setSize (1 + filter.getNumOutputChannels(), diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 27c26b89c5..a4cf352b00 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -83556,7 +83556,10 @@ private: } if (lastCommandChar == 'M' || lastCommandChar == 'm') + { path.startNewSubPath (x, y); + lastCommandChar = 'l'; + } else path.lineTo (x, y); @@ -211484,8 +211487,8 @@ void CriticalSection::exit() const throw() LeaveCriticalSection ((CRITICAL_SECTION*) internal); } -WaitableEvent::WaitableEvent() throw() - : internal (CreateEvent (0, FALSE, FALSE, 0)) +WaitableEvent::WaitableEvent (const bool manualReset) throw() + : internal (CreateEvent (0, manualReset ? TRUE : FALSE, FALSE, 0)) { } @@ -227548,8 +227551,9 @@ void CriticalSection::exit() const throw() class WaitableEventImpl { public: - WaitableEventImpl() - : triggered (false) + WaitableEventImpl (const bool manualReset_) + : triggered (false), + manualReset (manualReset_) { pthread_cond_init (&condition, 0); pthread_mutex_init (&mutex, 0); @@ -227602,7 +227606,9 @@ public: } } - triggered = false; + if (! manualReset) + triggered = false; + pthread_mutex_unlock (&mutex); return true; } @@ -227626,13 +227632,14 @@ private: pthread_cond_t condition; pthread_mutex_t mutex; bool triggered; + const bool manualReset; WaitableEventImpl (const WaitableEventImpl&); WaitableEventImpl& operator= (const WaitableEventImpl&); }; -WaitableEvent::WaitableEvent() throw() - : internal (new WaitableEventImpl()) +WaitableEvent::WaitableEvent (const bool manualReset) throw() + : internal (new WaitableEventImpl (manualReset)) { } @@ -237595,8 +237602,9 @@ void CriticalSection::exit() const throw() class WaitableEventImpl { public: - WaitableEventImpl() - : triggered (false) + WaitableEventImpl (const bool manualReset_) + : triggered (false), + manualReset (manualReset_) { pthread_cond_init (&condition, 0); pthread_mutex_init (&mutex, 0); @@ -237649,7 +237657,9 @@ public: } } - triggered = false; + if (! manualReset) + triggered = false; + pthread_mutex_unlock (&mutex); return true; } @@ -237673,13 +237683,14 @@ private: pthread_cond_t condition; pthread_mutex_t mutex; bool triggered; + const bool manualReset; WaitableEventImpl (const WaitableEventImpl&); WaitableEventImpl& operator= (const WaitableEventImpl&); }; -WaitableEvent::WaitableEvent() throw() - : internal (new WaitableEventImpl()) +WaitableEvent::WaitableEvent (const bool manualReset) throw() + : internal (new WaitableEventImpl (manualReset)) { } diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 1c7fcccebc..cb1eee62b1 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -8811,7 +8811,7 @@ class JUCE_API WaitableEvent { public: - WaitableEvent() throw(); + WaitableEvent (bool manualReset = false) throw(); ~WaitableEvent() throw(); diff --git a/src/gui/graphics/drawables/juce_SVGParser.cpp b/src/gui/graphics/drawables/juce_SVGParser.cpp index 629018c8e5..9dd18c1a22 100644 --- a/src/gui/graphics/drawables/juce_SVGParser.cpp +++ b/src/gui/graphics/drawables/juce_SVGParser.cpp @@ -250,7 +250,10 @@ private: } if (lastCommandChar == 'M' || lastCommandChar == 'm') + { path.startNewSubPath (x, y); + lastCommandChar = 'l'; + } else path.lineTo (x, y); diff --git a/src/native/common/juce_posix_SharedCode.h b/src/native/common/juce_posix_SharedCode.h index a7539f1763..cad1cbd894 100644 --- a/src/native/common/juce_posix_SharedCode.h +++ b/src/native/common/juce_posix_SharedCode.h @@ -64,8 +64,9 @@ void CriticalSection::exit() const throw() class WaitableEventImpl { public: - WaitableEventImpl() - : triggered (false) + WaitableEventImpl (const bool manualReset_) + : triggered (false), + manualReset (manualReset_) { pthread_cond_init (&condition, 0); pthread_mutex_init (&mutex, 0); @@ -118,7 +119,9 @@ public: } } - triggered = false; + if (! manualReset) + triggered = false; + pthread_mutex_unlock (&mutex); return true; } @@ -142,13 +145,14 @@ private: pthread_cond_t condition; pthread_mutex_t mutex; bool triggered; + const bool manualReset; WaitableEventImpl (const WaitableEventImpl&); WaitableEventImpl& operator= (const WaitableEventImpl&); }; -WaitableEvent::WaitableEvent() throw() - : internal (new WaitableEventImpl()) +WaitableEvent::WaitableEvent (const bool manualReset) throw() + : internal (new WaitableEventImpl (manualReset)) { } diff --git a/src/native/windows/juce_win32_Threads.cpp b/src/native/windows/juce_win32_Threads.cpp index f7c9a14ddb..843f1e0a53 100644 --- a/src/native/windows/juce_win32_Threads.cpp +++ b/src/native/windows/juce_win32_Threads.cpp @@ -79,8 +79,8 @@ void CriticalSection::exit() const throw() } //============================================================================== -WaitableEvent::WaitableEvent() throw() - : internal (CreateEvent (0, FALSE, FALSE, 0)) +WaitableEvent::WaitableEvent (const bool manualReset) throw() + : internal (CreateEvent (0, manualReset ? TRUE : FALSE, FALSE, 0)) { } diff --git a/src/threads/juce_WaitableEvent.h b/src/threads/juce_WaitableEvent.h index e4e7b798e2..f761eccf38 100644 --- a/src/threads/juce_WaitableEvent.h +++ b/src/threads/juce_WaitableEvent.h @@ -41,8 +41,13 @@ class JUCE_API WaitableEvent { public: //============================================================================== - /** Creates a WaitableEvent object. */ - WaitableEvent() throw(); + /** Creates a WaitableEvent object. + + @param manualReset If this is false, the event will be reset automatically when the wait() + method is called. If manualReset is true, then once the event is signalled, + the only way to reset it will be by calling the reset() method. + */ + WaitableEvent (bool manualReset = false) throw(); /** Destructor. @@ -57,8 +62,8 @@ public: This will wait until the object's signal() method is called by another thread, or until the timeout expires. - After the event has been signalled, this method will return true and reset - the event. + After the event has been signalled, this method will return true and if manualReset + was set to false in the WaitableEvent's constructor, then the event will be reset. @param timeOutMilliseconds the maximum time to wait, in milliseconds. A negative value will cause it to wait forever.