diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 7bfe1fe374..6888d2dd3b 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -81078,7 +81078,7 @@ bool DrawablePath::readXml (const XmlElement& xml) const String jointStyle (xml.getStringAttribute (T("jointStyle"), String::empty)); const String endStyle (xml.getStringAttribute (T("capStyle"), String::empty)); - strokeType = PathStrokeType (xml.getDoubleAttribute (T("strokeWidth"), 0.0), + strokeType = PathStrokeType ((float) xml.getDoubleAttribute (T("strokeWidth"), 0.0), jointStyle.equalsIgnoreCase (T("curved")) ? PathStrokeType::curved : (jointStyle.equalsIgnoreCase (T("bevel")) ? PathStrokeType::beveled : PathStrokeType::mitered), @@ -246804,17 +246804,15 @@ class WASAPIAudioIODevice : public AudioIODevice, { public: WASAPIAudioIODevice (const String& deviceName, - const int outputDeviceIndex_, const String& outputDeviceId_, - const int inputDeviceIndex_, const String& inputDeviceId_) + const String& outputDeviceId_, + const String& inputDeviceId_) : AudioIODevice (deviceName, "Windows Audio"), Thread ("Juce WASAPI"), isOpen_ (false), isStarted (false), outputDevice (0), - outputDeviceIndex (outputDeviceIndex_), outputDeviceId (outputDeviceId_), inputDevice (0), - inputDeviceIndex (inputDeviceIndex_), inputDeviceId (inputDeviceId_), currentBufferSizeSamples (0), currentSampleRate (0), @@ -246867,12 +246865,10 @@ public: int n = 64; for (int i = 0; i < 40; ++i) { - if (n >= minBufferSize && ! bufferSizes.contains (n)) + if (n >= minBufferSize && n <= 2048 && ! bufferSizes.contains (n)) bufferSizes.addSorted (comparator, n); - n += (n < 512) ? 32 - : ((n < 1024) ? 64 - : ((n < 2048) ? 128 : 256)); + n += (n < 512) ? 32 : (n < 1024 ? 64 : 128); } return true; @@ -246940,20 +246936,28 @@ public: return lastError; } + if (inputDevice != 0) + ResetEvent (inputDevice->clientEvent); + if (outputDevice != 0) + ResetEvent (outputDevice->clientEvent); + + startThread (8); + Thread::sleep (5); + if (inputDevice != 0 && inputDevice->client != 0) { + latencyIn = inputDevice->latencySamples + inputDevice->actualBufferSize + inputDevice->minBufferSize; HRESULT hr = inputDevice->client->Start(); logFailure (hr); //xxx handle this } if (outputDevice != 0 && outputDevice->client != 0) { + latencyOut = outputDevice->latencySamples + outputDevice->actualBufferSize + outputDevice->minBufferSize; HRESULT hr = outputDevice->client->Start(); logFailure (hr); //xxx handle this } - startThread (8); - isOpen_ = true; return lastError; } @@ -247079,7 +247083,6 @@ public: juce_UseDebuggingNewOperator - int outputDeviceIndex, inputDeviceIndex; String outputDeviceId, inputDeviceId; String lastError; @@ -247229,7 +247232,7 @@ public: jassert (hasScanned); // need to call scanForDevices() before doing this return wantInputNames ? inputDeviceNames - : outputDeviceNames; + : outputDeviceNames; } int getDefaultDeviceIndex (const bool /*forInput*/) const @@ -247241,9 +247244,9 @@ public: int getIndexOfDevice (AudioIODevice* device, const bool asInput) const { jassert (hasScanned); // need to call scanForDevices() before doing this - WASAPIAudioIODevice* const d = dynamic_cast (device); - return (d == 0) ? -1 : (asInput ? d->inputDeviceIndex : d->outputDeviceIndex); + return d == 0 ? -1 : (asInput ? inputDeviceIds.indexOf (d->inputDeviceId) + : outputDeviceIds.indexOf (d->outputDeviceId)); } bool hasSeparateInputsAndOutputs() const { return true; } @@ -247262,8 +247265,8 @@ public: { d = new WASAPIAudioIODevice (outputDeviceName.isNotEmpty() ? outputDeviceName : inputDeviceName, - outputIndex, outputDeviceIds [outputIndex], - inputIndex, inputDeviceIds [inputIndex]); + outputDeviceIds [outputIndex], + inputDeviceIds [inputIndex]); if (! d->initialise()) deleteAndZero (d); @@ -257711,9 +257714,15 @@ bool juce_copyFile (const String& src, const String& dst) throw() NSFileManager* fm = [NSFileManager defaultManager]; return [fm fileExistsAtPath: juceStringToNS (src)] +#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + && [fm copyItemAtPath: juceStringToNS (src) + toPath: juceStringToNS (dst) + error: nil]; +#else && [fm copyPath: juceStringToNS (src) toPath: juceStringToNS (dst) handler: nil]; +#endif } const StringArray juce_getFileSystemRoots() throw() @@ -258260,7 +258269,9 @@ void Desktop::setMousePosition (int x, int y) throw() // this rubbish needs to be done around the warp call, to avoid causing a // bizarre glitch.. CGAssociateMouseAndMouseCursorPosition (false); +#if (! defined (MAC_OS_X_VERSION_10_6)) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 CGSetLocalEventsSuppressionInterval (0); +#endif CGPoint pos = { x, y }; CGWarpMouseCursorPosition (pos); @@ -258325,8 +258336,13 @@ void Desktop::setScreenSaverEnabled (const bool isEnabled) throw() { if (screenSaverDisablerID == 0) { - IOPMAssertionCreate (kIOPMAssertionTypeNoIdleSleep, - kIOPMAssertionLevelOn, &screenSaverDisablerID); +#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, + CFSTR ("Juce"), &screenSaverDisablerID); +#else + IOPMAssertionCreate (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, + &screenSaverDisablerID); +#endif } } } @@ -258479,7 +258495,11 @@ END_JUCE_NAMESPACE #define JuceNSWindow MakeObjCClassName(JuceNSWindow) +#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +@interface JuceNSWindow : NSWindow +#else @interface JuceNSWindow : NSWindow +#endif { @private NSViewComponentPeer* owner; @@ -260793,7 +260813,11 @@ using namespace JUCE_NAMESPACE; #define JuceMenuCallback MakeObjCClassName(JuceMenuCallback) +#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +@interface JuceMenuCallback : NSObject +#else @interface JuceMenuCallback : NSObject +#endif { JuceMainMenuHandler* owner; } @@ -261270,7 +261294,11 @@ using namespace JUCE_NAMESPACE; #define JuceFileChooserDelegate MakeObjCClassName(JuceFileChooserDelegate) +#if defined (MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +@interface JuceFileChooserDelegate : NSObject +#else @interface JuceFileChooserDelegate : NSObject +#endif { StringArray* filters; } diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 3aeb930bc2..7290465a97 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -37216,7 +37216,9 @@ public: /** Creates an audio thumbnail. @param sourceSamplesPerThumbnailSample when creating a stored, low-res version - of the audio data, this is the scale at which it should be done + of the audio data, this is the scale at which it should be done. (This + number is the number of original samples that will be averaged for each + low-res sample) @param formatManagerToUse the audio format manager that is used to open the file @param cacheToUse an instance of an AudioThumbnailCache - this provides a background thread and storage that is used to by the thumbnail, and the cache @@ -37261,7 +37263,7 @@ public: */ int getNumChannels() const throw(); - /** Returns the length of the audio file. + /** Returns the length of the audio file, in seconds. */ double getTotalLength() const throw(); @@ -37277,8 +37279,8 @@ public: */ void drawChannel (Graphics& g, int x, int y, int w, int h, - double startTime, - double endTime, + double startTimeSeconds, + double endTimeSeconds, int channelNum, const float verticalZoomFactor); diff --git a/src/native/windows/juce_win32_WASAPI.cpp b/src/native/windows/juce_win32_WASAPI.cpp index ca3bc202cc..007a5f9961 100644 --- a/src/native/windows/juce_win32_WASAPI.cpp +++ b/src/native/windows/juce_win32_WASAPI.cpp @@ -557,17 +557,15 @@ class WASAPIAudioIODevice : public AudioIODevice, { public: WASAPIAudioIODevice (const String& deviceName, - const int outputDeviceIndex_, const String& outputDeviceId_, - const int inputDeviceIndex_, const String& inputDeviceId_) + const String& outputDeviceId_, + const String& inputDeviceId_) : AudioIODevice (deviceName, "Windows Audio"), Thread ("Juce WASAPI"), isOpen_ (false), isStarted (false), outputDevice (0), - outputDeviceIndex (outputDeviceIndex_), outputDeviceId (outputDeviceId_), inputDevice (0), - inputDeviceIndex (inputDeviceIndex_), inputDeviceId (inputDeviceId_), currentBufferSizeSamples (0), currentSampleRate (0), @@ -620,12 +618,10 @@ public: int n = 64; for (int i = 0; i < 40; ++i) { - if (n >= minBufferSize && ! bufferSizes.contains (n)) + if (n >= minBufferSize && n <= 2048 && ! bufferSizes.contains (n)) bufferSizes.addSorted (comparator, n); - n += (n < 512) ? 32 - : ((n < 1024) ? 64 - : ((n < 2048) ? 128 : 256)); + n += (n < 512) ? 32 : (n < 1024 ? 64 : 128); } return true; @@ -694,20 +690,28 @@ public: return lastError; } + if (inputDevice != 0) + ResetEvent (inputDevice->clientEvent); + if (outputDevice != 0) + ResetEvent (outputDevice->clientEvent); + + startThread (8); + Thread::sleep (5); + if (inputDevice != 0 && inputDevice->client != 0) { + latencyIn = inputDevice->latencySamples + inputDevice->actualBufferSize + inputDevice->minBufferSize; HRESULT hr = inputDevice->client->Start(); logFailure (hr); //xxx handle this } if (outputDevice != 0 && outputDevice->client != 0) { + latencyOut = outputDevice->latencySamples + outputDevice->actualBufferSize + outputDevice->minBufferSize; HRESULT hr = outputDevice->client->Start(); logFailure (hr); //xxx handle this } - startThread (8); - isOpen_ = true; return lastError; } @@ -835,7 +839,6 @@ public: juce_UseDebuggingNewOperator //============================================================================== - int outputDeviceIndex, inputDeviceIndex; String outputDeviceId, inputDeviceId; String lastError; @@ -990,7 +993,7 @@ public: jassert (hasScanned); // need to call scanForDevices() before doing this return wantInputNames ? inputDeviceNames - : outputDeviceNames; + : outputDeviceNames; } int getDefaultDeviceIndex (const bool /*forInput*/) const @@ -1002,9 +1005,9 @@ public: int getIndexOfDevice (AudioIODevice* device, const bool asInput) const { jassert (hasScanned); // need to call scanForDevices() before doing this - WASAPIAudioIODevice* const d = dynamic_cast (device); - return (d == 0) ? -1 : (asInput ? d->inputDeviceIndex : d->outputDeviceIndex); + return d == 0 ? -1 : (asInput ? inputDeviceIds.indexOf (d->inputDeviceId) + : outputDeviceIds.indexOf (d->outputDeviceId)); } bool hasSeparateInputsAndOutputs() const { return true; } @@ -1023,8 +1026,8 @@ public: { d = new WASAPIAudioIODevice (outputDeviceName.isNotEmpty() ? outputDeviceName : inputDeviceName, - outputIndex, outputDeviceIds [outputIndex], - inputIndex, inputDeviceIds [inputIndex]); + outputDeviceIds [outputIndex], + inputDeviceIds [inputIndex]); if (! d->initialise()) deleteAndZero (d);