1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Minor fixes for audio device removal notifications, win32 midi and threading.

This commit is contained in:
Julian Storer 2011-06-28 15:23:53 +01:00
parent 1e91e7586a
commit 18c9aa8e62
8 changed files with 42 additions and 44 deletions

View file

@ -59,6 +59,10 @@
#undef JUCE_BUILD_GUI
#endif
#ifndef JUCE_NAMESPACE
#define JUCE_NAMESPACE juce
#endif
//==============================================================================
#if JUCE_BUILD_NATIVE || JUCE_BUILD_CORE || (JUCE_BUILD_MISC && (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_AU))
#if JUCE_WINDOWS

View file

@ -31,14 +31,6 @@
This file contains macros that enable/disable various JUCE features.
*/
//=============================================================================
/** The name of the namespace that all Juce classes and functions will be
put inside. If this is not defined, no namespace will be used.
*/
#ifndef JUCE_NAMESPACE
#define JUCE_NAMESPACE juce
#endif
//=============================================================================
/** JUCE_FORCE_DEBUG: Normally, JUCE_DEBUG is set to 1 or 0 based on compiler and
project settings, but if you define this value, you can override this to force

View file

@ -206,13 +206,6 @@
This file contains macros that enable/disable various JUCE features.
*/
/** The name of the namespace that all Juce classes and functions will be
put inside. If this is not defined, no namespace will be used.
*/
#ifndef JUCE_NAMESPACE
#define JUCE_NAMESPACE juce
#endif
/** JUCE_FORCE_DEBUG: Normally, JUCE_DEBUG is set to 1 or 0 based on compiler and
project settings, but if you define this value, you can override this to force
it to be true or false.
@ -507,6 +500,10 @@
#undef JUCE_BUILD_GUI
#endif
#ifndef JUCE_NAMESPACE
#define JUCE_NAMESPACE juce
#endif
//==============================================================================
#if JUCE_BUILD_NATIVE || JUCE_BUILD_CORE || (JUCE_BUILD_MISC && (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_AU))
#if JUCE_WINDOWS
@ -17396,7 +17393,7 @@ void Thread::signalThreadShouldExit()
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());
jassert (getThreadId() != getCurrentThreadId() || getCurrentThreadId() == 0);
const int sleepMsPerIteration = 5;
int count = timeOutMilliseconds / sleepMsPerIteration;
@ -247258,7 +247255,7 @@ void MessageManager::doPlatformSpecificShutdown()
OleUninitialize();
}
class DeviceChangeDetector // (Used by various audio classes)
class DeviceChangeDetector : private Timer // (Used by various audio classes)
{
public:
DeviceChangeDetector (const wchar_t* const name)
@ -247283,11 +247280,18 @@ private:
|| wParam == 0x8004 /*DBT_DEVICEREMOVECOMPLETE*/
|| wParam == 0x0007 /*DBT_DEVNODES_CHANGED*/))
{
((DeviceChangeDetector*) GetWindowLongPtr (h, GWLP_USERDATA))->systemDeviceChanged();
// We'll pause before sending a message, because on device removal, the OS hasn't always updated
// its device lists correctly at this point. This also helps avoid repeated callbacks.
((DeviceChangeDetector*) GetWindowLongPtr (h, GWLP_USERDATA))->startTimer (500);
}
return DefWindowProc (h, message, wParam, lParam);
}
void timerCallback()
{
systemDeviceChanged();
}
};
#endif
@ -256396,7 +256400,7 @@ public:
void handleSysEx (MIDIHDR* const hdr, const uint32 timeStamp)
{
if (isStarted)
if (isStarted && hdr->dwBytesRecorded > 0)
{
concatenator.pushMidiData (hdr->lpData, hdr->dwBytesRecorded, convertTimeStamp (timeStamp), input, callback);
writeFinishedBlocks();

View file

@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 3
#define JUCE_BUILDNUMBER 4
/** Current Juce version number.
@ -254,13 +254,6 @@ namespace JuceDummyNamespace {}
This file contains macros that enable/disable various JUCE features.
*/
/** The name of the namespace that all Juce classes and functions will be
put inside. If this is not defined, no namespace will be used.
*/
#ifndef JUCE_NAMESPACE
#define JUCE_NAMESPACE juce
#endif
/** JUCE_FORCE_DEBUG: Normally, JUCE_DEBUG is set to 1 or 0 based on compiler and
project settings, but if you define this value, you can override this to force
it to be true or false.
@ -535,14 +528,13 @@ namespace JuceDummyNamespace {}
/*** End of inlined file: juce_Config.h ***/
#ifdef JUCE_NAMESPACE
#define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
#define END_JUCE_NAMESPACE }
#else
#define BEGIN_JUCE_NAMESPACE
#define END_JUCE_NAMESPACE
#ifndef JUCE_NAMESPACE
#define JUCE_NAMESPACE juce
#endif
#define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
#define END_JUCE_NAMESPACE }
/*** Start of inlined file: juce_PlatformDefs.h ***/
#ifndef __JUCE_PLATFORMDEFS_JUCEHEADER__

View file

@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 3
#define JUCE_BUILDNUMBER 4
/** Current Juce version number.
@ -52,14 +52,13 @@
#include "../../juce_Config.h"
//==============================================================================
#ifdef JUCE_NAMESPACE
#define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
#define END_JUCE_NAMESPACE }
#else
#define BEGIN_JUCE_NAMESPACE
#define END_JUCE_NAMESPACE
#ifndef JUCE_NAMESPACE
#define JUCE_NAMESPACE juce
#endif
#define BEGIN_JUCE_NAMESPACE namespace JUCE_NAMESPACE {
#define END_JUCE_NAMESPACE }
//==============================================================================
#include "juce_PlatformDefs.h"

View file

@ -345,7 +345,7 @@ void MessageManager::doPlatformSpecificShutdown()
}
//==============================================================================
class DeviceChangeDetector // (Used by various audio classes)
class DeviceChangeDetector : private Timer // (Used by various audio classes)
{
public:
DeviceChangeDetector (const wchar_t* const name)
@ -370,11 +370,18 @@ private:
|| wParam == 0x8004 /*DBT_DEVICEREMOVECOMPLETE*/
|| wParam == 0x0007 /*DBT_DEVNODES_CHANGED*/))
{
((DeviceChangeDetector*) GetWindowLongPtr (h, GWLP_USERDATA))->systemDeviceChanged();
// We'll pause before sending a message, because on device removal, the OS hasn't always updated
// its device lists correctly at this point. This also helps avoid repeated callbacks.
((DeviceChangeDetector*) GetWindowLongPtr (h, GWLP_USERDATA))->startTimer (500);
}
return DefWindowProc (h, message, wParam, lParam);
}
void timerCallback()
{
systemDeviceChanged();
}
};
#endif

View file

@ -73,7 +73,7 @@ public:
void handleSysEx (MIDIHDR* const hdr, const uint32 timeStamp)
{
if (isStarted)
if (isStarted && hdr->dwBytesRecorded > 0)
{
concatenator.pushMidiData (hdr->lpData, hdr->dwBytesRecorded, convertTimeStamp (timeStamp), input, callback);
writeFinishedBlocks();

View file

@ -225,7 +225,7 @@ void Thread::signalThreadShouldExit()
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());
jassert (getThreadId() != getCurrentThreadId() || getCurrentThreadId() == 0);
const int sleepMsPerIteration = 5;
int count = timeOutMilliseconds / sleepMsPerIteration;