@@ -55,6 +55,7 @@ BEGIN_JUCE_NAMESPACE | |||||
#include "../../../src/juce_core/io/files/juce_FileOutputStream.h" | #include "../../../src/juce_core/io/files/juce_FileOutputStream.h" | ||||
#include "../../../src/juce_core/basics/juce_SystemStats.h" | #include "../../../src/juce_core/basics/juce_SystemStats.h" | ||||
#include "../../../src/juce_core/basics/juce_Time.h" | #include "../../../src/juce_core/basics/juce_Time.h" | ||||
#include "../../../src/juce_core/basics/juce_Random.h" | |||||
#include "../../../src/juce_core/io/network/juce_URL.h" | #include "../../../src/juce_core/io/network/juce_URL.h" | ||||
#include "../../../src/juce_core/io/files/juce_NamedPipe.h" | #include "../../../src/juce_core/io/files/juce_NamedPipe.h" | ||||
#include "../../../src/juce_core/threads/juce_InterProcessLock.h" | #include "../../../src/juce_core/threads/juce_InterProcessLock.h" | ||||
@@ -124,22 +124,21 @@ public: | |||||
delete inputDevice; | delete inputDevice; | ||||
} | } | ||||
void setTempBufferSize (const int numChannels, const int numSamples) | |||||
void allocateTempBuffers() | |||||
{ | { | ||||
const int tempBufSize = bufferSize + 4; | |||||
juce_free (audioBuffer); | juce_free (audioBuffer); | ||||
audioBuffer = (float*) juce_calloc (32 + numChannels * numSamples * sizeof (float)); | |||||
audioBuffer = (float*) juce_calloc ((numInputChans + numOutputChans) * tempBufSize * sizeof (float)); | |||||
zeromem (tempInputBuffers, sizeof (tempInputBuffers)); | zeromem (tempInputBuffers, sizeof (tempInputBuffers)); | ||||
zeromem (tempOutputBuffers, sizeof (tempOutputBuffers)); | zeromem (tempOutputBuffers, sizeof (tempOutputBuffers)); | ||||
int count = 0; | |||||
int i; | |||||
int i, count = 0; | |||||
for (i = 0; i < numInputChans; ++i) | for (i = 0; i < numInputChans; ++i) | ||||
tempInputBuffers[i] = audioBuffer + count++ * numSamples; | |||||
tempInputBuffers[i] = audioBuffer + count++ * tempBufSize; | |||||
for (i = 0; i < numOutputChans; ++i) | for (i = 0; i < numOutputChans; ++i) | ||||
tempOutputBuffers[i] = audioBuffer + count++ * numSamples; | |||||
tempOutputBuffers[i] = audioBuffer + count++ * tempBufSize; | |||||
} | } | ||||
// returns the number of actual available channels | // returns the number of actual available channels | ||||
@@ -218,9 +217,7 @@ public: | |||||
if (OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyBufferFrameSize, &size, &framesPerBuf))) | if (OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyBufferFrameSize, &size, &framesPerBuf))) | ||||
{ | { | ||||
bufferSize = framesPerBuf; | bufferSize = framesPerBuf; | ||||
if (bufferSize > 0) | |||||
setTempBufferSize (numInputChans + numOutputChans, bufferSize); | |||||
allocateTempBuffers(); | |||||
} | } | ||||
bufferSizes.clear(); | bufferSizes.clear(); | ||||
@@ -611,6 +608,11 @@ public: | |||||
{ | { | ||||
jassert (inputDevice->bufferSize == bufferSize); | jassert (inputDevice->bufferSize == bufferSize); | ||||
// Sometimes the two linked devices seem to get their callbacks in | |||||
// parallel, so we need to lock both devices to stop the input data being | |||||
// changed while inside our callback.. | |||||
const ScopedLock sl (inputDevice->callbackLock); | |||||
callback->audioDeviceIOCallback ((const float**) inputDevice->tempInputBuffers, | callback->audioDeviceIOCallback ((const float**) inputDevice->tempInputBuffers, | ||||
inputDevice->numInputChans, | inputDevice->numInputChans, | ||||
tempOutputBuffers, | tempOutputBuffers, | ||||
@@ -116,9 +116,16 @@ make it easier to update to the latest code. | |||||
DAE.lib, DigiExt.lib, DSI.lib, PlugInLib.lib. | DAE.lib, DigiExt.lib, DSI.lib, PlugInLib.lib. | ||||
- In XCode: After installing the Digidesign SDK, make sure you've run the config_SDK_for_Mac | - In XCode: After installing the Digidesign SDK, make sure you've run the config_SDK_for_Mac | ||||
command in the SDK's root directory. This sets up some of the tools that it needs. | command in the SDK's root directory. This sets up some of the tools that it needs. | ||||
- In XCode: If you're using the Digi files CommonDebugSettings.xcconfig and CommonReleaseSettings.xcconfig, | |||||
then you'll probably have to remove the "-x c++" option from their OTHER_CFLAGS setting, because | |||||
that prevents it compiling obj-C. Also, you might need to comment-out the GCC_PREFIX_HEADER setting, | |||||
unless you can persuade precompiled headers to work (I've never managed to get them working myself..) | |||||
You'll also probably want to add a "MacBag" setting to these files, rather than putting it into | |||||
your project - e.g. "MacBag = /Users/jules/SDKs/PT_80_SDK/MacBag" | |||||
----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ||||
Choosing the formats to build | Choosing the formats to build | ||||
============================= | ============================= | ||||
@@ -267204,6 +267204,7 @@ NSRect NSViewComponentPeer::constrainRect (NSRect r) | |||||
current.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - current.origin.y - current.size.height; | current.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - current.origin.y - current.size.height; | ||||
r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - r.origin.y - r.size.height; | r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - r.origin.y - r.size.height; | ||||
int x = (int) r.origin.x; | int x = (int) r.origin.x; | ||||
int y = (int) r.origin.y; | int y = (int) r.origin.y; | ||||
int w = (int) r.size.width; | int w = (int) r.size.width; | ||||
@@ -270883,22 +270884,21 @@ public: | |||||
delete inputDevice; | delete inputDevice; | ||||
} | } | ||||
void setTempBufferSize (const int numChannels, const int numSamples) | |||||
void allocateTempBuffers() | |||||
{ | { | ||||
const int tempBufSize = bufferSize + 4; | |||||
juce_free (audioBuffer); | juce_free (audioBuffer); | ||||
audioBuffer = (float*) juce_calloc (32 + numChannels * numSamples * sizeof (float)); | |||||
audioBuffer = (float*) juce_calloc ((numInputChans + numOutputChans) * tempBufSize * sizeof (float)); | |||||
zeromem (tempInputBuffers, sizeof (tempInputBuffers)); | zeromem (tempInputBuffers, sizeof (tempInputBuffers)); | ||||
zeromem (tempOutputBuffers, sizeof (tempOutputBuffers)); | zeromem (tempOutputBuffers, sizeof (tempOutputBuffers)); | ||||
int count = 0; | |||||
int i; | |||||
int i, count = 0; | |||||
for (i = 0; i < numInputChans; ++i) | for (i = 0; i < numInputChans; ++i) | ||||
tempInputBuffers[i] = audioBuffer + count++ * numSamples; | |||||
tempInputBuffers[i] = audioBuffer + count++ * tempBufSize; | |||||
for (i = 0; i < numOutputChans; ++i) | for (i = 0; i < numOutputChans; ++i) | ||||
tempOutputBuffers[i] = audioBuffer + count++ * numSamples; | |||||
tempOutputBuffers[i] = audioBuffer + count++ * tempBufSize; | |||||
} | } | ||||
// returns the number of actual available channels | // returns the number of actual available channels | ||||
@@ -270977,9 +270977,7 @@ public: | |||||
if (OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyBufferFrameSize, &size, &framesPerBuf))) | if (OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyBufferFrameSize, &size, &framesPerBuf))) | ||||
{ | { | ||||
bufferSize = framesPerBuf; | bufferSize = framesPerBuf; | ||||
if (bufferSize > 0) | |||||
setTempBufferSize (numInputChans + numOutputChans, bufferSize); | |||||
allocateTempBuffers(); | |||||
} | } | ||||
bufferSizes.clear(); | bufferSizes.clear(); | ||||
@@ -271368,6 +271366,11 @@ public: | |||||
{ | { | ||||
jassert (inputDevice->bufferSize == bufferSize); | jassert (inputDevice->bufferSize == bufferSize); | ||||
// Sometimes the two linked devices seem to get their callbacks in | |||||
// parallel, so we need to lock both devices to stop the input data being | |||||
// changed while inside our callback.. | |||||
const ScopedLock sl (inputDevice->callbackLock); | |||||
callback->audioDeviceIOCallback ((const float**) inputDevice->tempInputBuffers, | callback->audioDeviceIOCallback ((const float**) inputDevice->tempInputBuffers, | ||||
inputDevice->numInputChans, | inputDevice->numInputChans, | ||||
tempOutputBuffers, | tempOutputBuffers, | ||||