@@ -33,13 +33,11 @@ | |||
//============================================================================== | |||
class BouncingBallComp : public Component, | |||
public AsyncUpdater | |||
class BouncingBallComp : public Component | |||
{ | |||
float x, y, size, dx, dy, w, h, parentWidth, parentHeight; | |||
float innerX, innerY; | |||
Colour colour; | |||
CriticalSection lock; | |||
Thread::ThreadID threadId; | |||
public: | |||
@@ -88,25 +86,8 @@ public: | |||
parentHeight = getParentHeight() - size; | |||
} | |||
void handleAsyncUpdate() | |||
{ | |||
const ScopedLock sl (lock); | |||
setBounds (((int) x) - 2, | |||
((int) y) - 2, | |||
((int) size) + 4, | |||
((int) size) + 4); | |||
innerX = x - getX(); | |||
innerY = y - getY(); | |||
repaint(); | |||
} | |||
void moveBall() | |||
{ | |||
const ScopedLock sl (lock); | |||
threadId = Thread::getCurrentThreadId(); // this is so the component can print the thread ID inside the ball | |||
x += dx; | |||
@@ -124,10 +105,15 @@ public: | |||
if (y > parentHeight) | |||
dy = -fabsf (dy); | |||
// this is called on a background thread, so we don't want to call | |||
// any UI code from here - instead we'll trigger an event that will update | |||
// the component's position later. This is a safe way to avoid deadlocks | |||
triggerAsyncUpdate(); | |||
setBounds (((int) x) - 2, | |||
((int) y) - 2, | |||
((int) size) + 4, | |||
((int) size) + 4); | |||
innerX = x - getX(); | |||
innerY = y - getY(); | |||
repaint(); | |||
} | |||
juce_UseDebuggingNewOperator | |||
@@ -166,10 +152,18 @@ public: | |||
// called, so we should check it often, and exit as soon as it gets flagged. | |||
while (! threadShouldExit()) | |||
{ | |||
moveBall(); | |||
// sleep a bit so the threads don't all grind the CPU to a halt.. | |||
wait (interval); | |||
// because this is a background thread, we mustn't do any UI work without | |||
// first grabbing a MessageManagerLock.. | |||
const MessageManagerLock mml (Thread::getCurrentThread()); | |||
if (! mml.lockWasGained()) // if something is trying to kill this job, the lock | |||
return; // will fail, in which case we'd better return.. | |||
// now we've got the UI thread locked, we can mess about with the components | |||
moveBall(); | |||
} | |||
} | |||
@@ -196,9 +190,18 @@ public: | |||
// this is the code that runs this job. It'll be repeatedly called until we return | |||
// jobHasFinished instead of jobNeedsRunningAgain. | |||
moveBall(); | |||
Thread::sleep (30); | |||
// because this is a background thread, we mustn't do any UI work without | |||
// first grabbing a MessageManagerLock.. | |||
const MessageManagerLock mml (this); | |||
// before moving the ball, we need to check whether the lock was actually gained, because | |||
// if something is trying to stop this job, it will have failed.. | |||
if (mml.lockWasGained()) | |||
moveBall(); | |||
return jobNeedsRunningAgain; | |||
} | |||
@@ -37088,7 +37088,6 @@ MessageManagerLock::~MessageManagerLock() throw() | |||
} | |||
END_JUCE_NAMESPACE | |||
/********* End of inlined file: juce_MessageManager.cpp *********/ | |||
/********* Start of inlined file: juce_MultiTimer.cpp *********/ | |||
@@ -45353,6 +45352,9 @@ void Slider::lookAndFeelChanged() | |||
decButton->setRepeatSpeed (300, 100, 20); | |||
decButton->addMouseListener (incButton, false); | |||
} | |||
incButton->setTooltip (getTooltip()); | |||
decButton->setTooltip (getTooltip()); | |||
} | |||
setComponentEffect (lf.getSliderEffect()); | |||
@@ -36131,13 +36131,11 @@ private: | |||
/********* End of inlined file: juce_PluginListComponent.h *********/ | |||
#endif | |||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
/********* Start of inlined file: juce_FlacAudioFormat.h *********/ | |||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
#define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__ | |||
#if JUCE_USE_FLAC || defined (DOXYGEN) | |||
/********* Start of inlined file: juce_WavAudioFormat.h *********/ | |||
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__ | |||
#define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__ | |||
/********* Start of inlined file: juce_AudioFormat.h *********/ | |||
#ifndef __JUCE_AUDIOFORMAT_JUCEHEADER__ | |||
@@ -36413,52 +36411,6 @@ private: | |||
#endif // __JUCE_AUDIOFORMAT_JUCEHEADER__ | |||
/********* End of inlined file: juce_AudioFormat.h *********/ | |||
/** | |||
Reads and writes the lossless-compression FLAC audio format. | |||
To compile this, you'll need to set the JUCE_USE_FLAC flag in juce_Config.h, | |||
and make sure your include search path and library search path are set up to find | |||
the FLAC header files and static libraries. | |||
@see AudioFormat | |||
*/ | |||
class JUCE_API FlacAudioFormat : public AudioFormat | |||
{ | |||
public: | |||
FlacAudioFormat(); | |||
~FlacAudioFormat(); | |||
const Array <int> getPossibleSampleRates(); | |||
const Array <int> getPossibleBitDepths(); | |||
bool canDoStereo(); | |||
bool canDoMono(); | |||
bool isCompressed(); | |||
AudioFormatReader* createReaderFor (InputStream* sourceStream, | |||
const bool deleteStreamIfOpeningFails); | |||
AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo, | |||
double sampleRateToUse, | |||
unsigned int numberOfChannels, | |||
int bitsPerSample, | |||
const StringPairArray& metadataValues, | |||
int qualityOptionIndex); | |||
juce_UseDebuggingNewOperator | |||
}; | |||
#endif | |||
#endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
/********* End of inlined file: juce_FlacAudioFormat.h *********/ | |||
#endif | |||
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__ | |||
/********* Start of inlined file: juce_WavAudioFormat.h *********/ | |||
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__ | |||
#define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__ | |||
/** | |||
Reads and Writes WAV format audio files. | |||
@@ -36574,6 +36526,52 @@ public: | |||
#endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__ | |||
/********* End of inlined file: juce_WavAudioFormat.h *********/ | |||
#endif | |||
#ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
/********* Start of inlined file: juce_AiffAudioFormat.h *********/ | |||
#ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
#define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
/** | |||
Reads and Writes AIFF format audio files. | |||
@see AudioFormat | |||
*/ | |||
class JUCE_API AiffAudioFormat : public AudioFormat | |||
{ | |||
public: | |||
/** Creates an format object. */ | |||
AiffAudioFormat(); | |||
/** Destructor. */ | |||
~AiffAudioFormat(); | |||
const Array <int> getPossibleSampleRates(); | |||
const Array <int> getPossibleBitDepths(); | |||
bool canDoStereo(); | |||
bool canDoMono(); | |||
#if JUCE_MAC | |||
bool canHandleFile (const File& fileToTest); | |||
#endif | |||
AudioFormatReader* createReaderFor (InputStream* sourceStream, | |||
const bool deleteStreamIfOpeningFails); | |||
AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo, | |||
double sampleRateToUse, | |||
unsigned int numberOfChannels, | |||
int bitsPerSample, | |||
const StringPairArray& metadataValues, | |||
int qualityOptionIndex); | |||
juce_UseDebuggingNewOperator | |||
}; | |||
#endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
/********* End of inlined file: juce_AiffAudioFormat.h *********/ | |||
#endif | |||
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__ | |||
@@ -36682,52 +36680,6 @@ public: | |||
#endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__ | |||
/********* End of inlined file: juce_QuickTimeAudioFormat.h *********/ | |||
#endif | |||
#ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
/********* Start of inlined file: juce_AiffAudioFormat.h *********/ | |||
#ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
#define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
/** | |||
Reads and Writes AIFF format audio files. | |||
@see AudioFormat | |||
*/ | |||
class JUCE_API AiffAudioFormat : public AudioFormat | |||
{ | |||
public: | |||
/** Creates an format object. */ | |||
AiffAudioFormat(); | |||
/** Destructor. */ | |||
~AiffAudioFormat(); | |||
const Array <int> getPossibleSampleRates(); | |||
const Array <int> getPossibleBitDepths(); | |||
bool canDoStereo(); | |||
bool canDoMono(); | |||
#if JUCE_MAC | |||
bool canHandleFile (const File& fileToTest); | |||
#endif | |||
AudioFormatReader* createReaderFor (InputStream* sourceStream, | |||
const bool deleteStreamIfOpeningFails); | |||
AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo, | |||
double sampleRateToUse, | |||
unsigned int numberOfChannels, | |||
int bitsPerSample, | |||
const StringPairArray& metadataValues, | |||
int qualityOptionIndex); | |||
juce_UseDebuggingNewOperator | |||
}; | |||
#endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
/********* End of inlined file: juce_AiffAudioFormat.h *********/ | |||
#endif | |||
#ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__ | |||
@@ -37377,6 +37329,54 @@ private: | |||
#endif // __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__ | |||
/********* End of inlined file: juce_AudioThumbnailCache.h *********/ | |||
#endif | |||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
/********* Start of inlined file: juce_FlacAudioFormat.h *********/ | |||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
#define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
#if JUCE_USE_FLAC || defined (DOXYGEN) | |||
/** | |||
Reads and writes the lossless-compression FLAC audio format. | |||
To compile this, you'll need to set the JUCE_USE_FLAC flag in juce_Config.h, | |||
and make sure your include search path and library search path are set up to find | |||
the FLAC header files and static libraries. | |||
@see AudioFormat | |||
*/ | |||
class JUCE_API FlacAudioFormat : public AudioFormat | |||
{ | |||
public: | |||
FlacAudioFormat(); | |||
~FlacAudioFormat(); | |||
const Array <int> getPossibleSampleRates(); | |||
const Array <int> getPossibleBitDepths(); | |||
bool canDoStereo(); | |||
bool canDoMono(); | |||
bool isCompressed(); | |||
AudioFormatReader* createReaderFor (InputStream* sourceStream, | |||
const bool deleteStreamIfOpeningFails); | |||
AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo, | |||
double sampleRateToUse, | |||
unsigned int numberOfChannels, | |||
int bitsPerSample, | |||
const StringPairArray& metadataValues, | |||
int qualityOptionIndex); | |||
juce_UseDebuggingNewOperator | |||
}; | |||
#endif | |||
#endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
/********* End of inlined file: juce_FlacAudioFormat.h *********/ | |||
#endif | |||
#ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__ | |||
@@ -38212,9 +38212,6 @@ private: | |||
#endif | |||
#ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__ | |||
#endif | |||
#ifndef __JUCE_SOLIDCOLOURBRUSH_JUCEHEADER__ | |||
#endif | |||
#ifndef __JUCE_BRUSH_JUCEHEADER__ | |||
@@ -38740,6 +38737,9 @@ private: | |||
#endif // __JUCE_IMAGEBRUSH_JUCEHEADER__ | |||
/********* End of inlined file: juce_ImageBrush.h *********/ | |||
#endif | |||
#ifndef __JUCE_SOLIDCOLOURBRUSH_JUCEHEADER__ | |||
#endif | |||
#ifndef __JUCE_COLOUR_JUCEHEADER__ | |||
@@ -197,21 +197,18 @@ | |||
#ifndef __JUCE_PLUGINLISTCOMPONENT_JUCEHEADER__ | |||
#include "juce_appframework/audio/plugins/juce_PluginListComponent.h" | |||
#endif | |||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
#include "juce_appframework/audio/audio_file_formats/juce_FlacAudioFormat.h" | |||
#endif | |||
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__ | |||
#include "juce_appframework/audio/audio_file_formats/juce_WavAudioFormat.h" | |||
#endif | |||
#ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
#include "juce_appframework/audio/audio_file_formats/juce_AiffAudioFormat.h" | |||
#endif | |||
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__ | |||
#include "juce_appframework/audio/audio_file_formats/juce_OggVorbisAudioFormat.h" | |||
#endif | |||
#ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__ | |||
#include "juce_appframework/audio/audio_file_formats/juce_QuickTimeAudioFormat.h" | |||
#endif | |||
#ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__ | |||
#include "juce_appframework/audio/audio_file_formats/juce_AiffAudioFormat.h" | |||
#endif | |||
#ifndef __JUCE_AUDIOCDBURNER_JUCEHEADER__ | |||
#include "juce_appframework/audio/audio_file_formats/juce_AudioCDBurner.h" | |||
#endif | |||
@@ -239,6 +236,9 @@ | |||
#ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__ | |||
#include "juce_appframework/audio/audio_file_formats/juce_AudioThumbnailCache.h" | |||
#endif | |||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
#include "juce_appframework/audio/audio_file_formats/juce_FlacAudioFormat.h" | |||
#endif | |||
#ifndef __JUCE_INTERPROCESSCONNECTIONSERVER_JUCEHEADER__ | |||
#include "juce_appframework/events/juce_InterprocessConnectionServer.h" | |||
#endif | |||
@@ -284,9 +284,6 @@ | |||
#ifndef __JUCE_INTERPROCESSCONNECTION_JUCEHEADER__ | |||
#include "juce_appframework/events/juce_InterprocessConnection.h" | |||
#endif | |||
#ifndef __JUCE_SOLIDCOLOURBRUSH_JUCEHEADER__ | |||
#include "juce_appframework/gui/graphics/brushes/juce_SolidColourBrush.h" | |||
#endif | |||
#ifndef __JUCE_BRUSH_JUCEHEADER__ | |||
#include "juce_appframework/gui/graphics/brushes/juce_Brush.h" | |||
#endif | |||
@@ -296,6 +293,9 @@ | |||
#ifndef __JUCE_IMAGEBRUSH_JUCEHEADER__ | |||
#include "juce_appframework/gui/graphics/brushes/juce_ImageBrush.h" | |||
#endif | |||
#ifndef __JUCE_SOLIDCOLOURBRUSH_JUCEHEADER__ | |||
#include "juce_appframework/gui/graphics/brushes/juce_SolidColourBrush.h" | |||
#endif | |||
#ifndef __JUCE_COLOUR_JUCEHEADER__ | |||
#include "juce_appframework/gui/graphics/colour/juce_Colour.h" | |||
#endif | |||
@@ -32,9 +32,9 @@ | |||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
#define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__ | |||
#if JUCE_USE_FLAC || defined (DOXYGEN) | |||
#include "juce_AudioFormat.h" // (must keep this outside the conditional define) | |||
#include "juce_AudioFormat.h" | |||
#if JUCE_USE_FLAC || defined (DOXYGEN) | |||
//============================================================================== | |||
@@ -32,9 +32,9 @@ | |||
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__ | |||
#define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__ | |||
#if JUCE_USE_OGGVORBIS || defined (DOXYGEN) | |||
#include "juce_AudioFormat.h" // (must keep this outside the conditional define) | |||
#include "juce_AudioFormat.h" | |||
#if JUCE_USE_OGGVORBIS || defined (DOXYGEN) | |||
//============================================================================== | |||
@@ -384,6 +384,9 @@ void Slider::lookAndFeelChanged() | |||
decButton->setRepeatSpeed (300, 100, 20); | |||
decButton->addMouseListener (incButton, false); | |||
} | |||
incButton->setTooltip (getTooltip()); | |||
decButton->setTooltip (getTooltip()); | |||
} | |||
setComponentEffect (lf.getSliderEffect()); | |||