mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed some problems with audio formats not correctly clearing their buffers; Rewrote the CoreAudio functions to avoid deprecated functions.
This commit is contained in:
parent
d48a742061
commit
3954631795
10 changed files with 3342 additions and 3122 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -18036,7 +18036,16 @@ public:
|
|||
bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
|
||||
int64 startSampleInFile, int numSamples)
|
||||
{
|
||||
numSamples = (int) jmin ((int64) numSamples, lengthInSamples - startSampleInFile);
|
||||
const int64 samplesAvailable = lengthInSamples - startSampleInFile;
|
||||
|
||||
if (samplesAvailable < numSamples)
|
||||
{
|
||||
for (int i = numDestChannels; --i >= 0;)
|
||||
if (destSamples[i] != 0)
|
||||
zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * numSamples);
|
||||
|
||||
numSamples = (int) samplesAvailable;
|
||||
}
|
||||
|
||||
if (numSamples <= 0)
|
||||
return true;
|
||||
|
|
@ -20941,7 +20950,16 @@ public:
|
|||
bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
|
||||
int64 startSampleInFile, int numSamples)
|
||||
{
|
||||
numSamples = (int) jmin ((int64) numSamples, lengthInSamples - startSampleInFile);
|
||||
const int64 samplesAvailable = lengthInSamples - startSampleInFile;
|
||||
|
||||
if (samplesAvailable < numSamples)
|
||||
{
|
||||
for (int i = numDestChannels; --i >= 0;)
|
||||
if (destSamples[i] != 0)
|
||||
zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * numSamples);
|
||||
|
||||
numSamples = (int) samplesAvailable;
|
||||
}
|
||||
|
||||
if (numSamples <= 0)
|
||||
return true;
|
||||
|
|
@ -22315,20 +22333,20 @@ bool BufferingAudioSource::readNextBufferChunk()
|
|||
if (bufferIndexStart < bufferIndexEnd)
|
||||
{
|
||||
readBufferSection (sectionToReadStart,
|
||||
sectionToReadEnd - sectionToReadStart,
|
||||
bufferIndexStart);
|
||||
sectionToReadEnd - sectionToReadStart,
|
||||
bufferIndexStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int initialSize = buffer.getNumSamples() - bufferIndexStart;
|
||||
|
||||
readBufferSection (sectionToReadStart,
|
||||
initialSize,
|
||||
bufferIndexStart);
|
||||
initialSize,
|
||||
bufferIndexStart);
|
||||
|
||||
readBufferSection (sectionToReadStart + initialSize,
|
||||
(sectionToReadEnd - sectionToReadStart) - initialSize,
|
||||
0);
|
||||
(sectionToReadEnd - sectionToReadStart) - initialSize,
|
||||
0);
|
||||
}
|
||||
|
||||
const ScopedLock sl2 (bufferStartPosLock);
|
||||
|
|
@ -68714,6 +68732,12 @@ void AudioDeviceSelectorComponent::resized()
|
|||
midiOutputSelector->setBounds (lx, y, w, h);
|
||||
}
|
||||
|
||||
void AudioDeviceSelectorComponent::childBoundsChanged (Component* child)
|
||||
{
|
||||
if (child == audioDeviceSettingsComp)
|
||||
resized();
|
||||
}
|
||||
|
||||
void AudioDeviceSelectorComponent::buttonClicked (Button*)
|
||||
{
|
||||
AudioIODevice* const device = deviceManager.getCurrentAudioDevice();
|
||||
|
|
@ -263161,21 +263185,23 @@ public:
|
|||
{
|
||||
updateDetailsFromDevice();
|
||||
|
||||
AudioDeviceAddPropertyListener (deviceID,
|
||||
kAudioPropertyWildcardChannel,
|
||||
kAudioPropertyWildcardSection,
|
||||
kAudioPropertyWildcardPropertyID,
|
||||
deviceListenerProc, this);
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioObjectPropertySelectorWildcard;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementWildcard;
|
||||
|
||||
AudioObjectAddPropertyListener (deviceID, &pa, deviceListenerProc, this);
|
||||
}
|
||||
}
|
||||
|
||||
~CoreAudioInternal()
|
||||
{
|
||||
AudioDeviceRemovePropertyListener (deviceID,
|
||||
kAudioPropertyWildcardChannel,
|
||||
kAudioPropertyWildcardSection,
|
||||
kAudioPropertyWildcardPropertyID,
|
||||
deviceListenerProc);
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioObjectPropertySelectorWildcard;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementWildcard;
|
||||
|
||||
AudioObjectRemovePropertyListener (deviceID, &pa, deviceListenerProc, this);
|
||||
|
||||
stop (false);
|
||||
|
||||
|
|
@ -263212,11 +263238,16 @@ public:
|
|||
int chanNum = 0;
|
||||
UInt32 size;
|
||||
|
||||
if (OK (AudioDeviceGetPropertyInfo (deviceID, 0, input, kAudioDevicePropertyStreamConfiguration, &size, 0)))
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyStreamConfiguration;
|
||||
pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if (OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size)))
|
||||
{
|
||||
AudioBufferList* const bufList = (AudioBufferList*) juce_calloc (size);
|
||||
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, input, kAudioDevicePropertyStreamConfiguration, &size, bufList)))
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, bufList)))
|
||||
{
|
||||
const int numStreams = bufList->mNumberBuffers;
|
||||
|
||||
|
|
@ -263232,9 +263263,10 @@ public:
|
|||
uint8 channelName [256];
|
||||
zerostruct (channelName);
|
||||
UInt32 nameSize = sizeof (channelName);
|
||||
UInt32 channelNum = chanNum + 1;
|
||||
pa.mSelector = kAudioDevicePropertyChannelName;
|
||||
|
||||
if (AudioDeviceGetProperty (deviceID, chanNum + 1, input, kAudioDevicePropertyChannelName,
|
||||
&nameSize, &channelName) == noErr)
|
||||
if (AudioObjectGetPropertyData (deviceID, &pa, sizeof (channelNum), &channelNum, &nameSize, channelName) == noErr)
|
||||
name = String::fromUTF8 (channelName, nameSize);
|
||||
}
|
||||
|
||||
|
|
@ -263289,13 +263321,20 @@ public:
|
|||
|
||||
Float64 sr;
|
||||
UInt32 size = sizeof (Float64);
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyNominalSampleRate, &size, &sr)))
|
||||
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyNominalSampleRate;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, &sr)))
|
||||
sampleRate = sr;
|
||||
|
||||
UInt32 framesPerBuf;
|
||||
size = sizeof (framesPerBuf);
|
||||
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyBufferFrameSize, &size, &framesPerBuf)))
|
||||
pa.mSelector = kAudioDevicePropertyBufferFrameSize;
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, &framesPerBuf)))
|
||||
{
|
||||
bufferSize = framesPerBuf;
|
||||
allocateTempBuffers();
|
||||
|
|
@ -263303,11 +263342,13 @@ public:
|
|||
|
||||
bufferSizes.clear();
|
||||
|
||||
if (OK (AudioDeviceGetPropertyInfo (deviceID, 0, false, kAudioDevicePropertyBufferFrameSizeRange, &size, 0)))
|
||||
pa.mSelector = kAudioDevicePropertyBufferFrameSizeRange;
|
||||
|
||||
if (OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size)))
|
||||
{
|
||||
AudioValueRange* ranges = (AudioValueRange*) juce_calloc (size);
|
||||
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyBufferFrameSizeRange, &size, ranges)))
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, ranges)))
|
||||
{
|
||||
bufferSizes.add ((int) ranges[0].mMinimum);
|
||||
|
||||
|
|
@ -263337,11 +263378,13 @@ public:
|
|||
const double possibleRates[] = { 44100.0, 48000.0, 88200.0, 96000.0, 176400.0, 192000.0 };
|
||||
String rates;
|
||||
|
||||
if (OK (AudioDeviceGetPropertyInfo (deviceID, 0, false, kAudioDevicePropertyAvailableNominalSampleRates, &size, 0)))
|
||||
pa.mSelector = kAudioDevicePropertyAvailableNominalSampleRates;
|
||||
|
||||
if (OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size)))
|
||||
{
|
||||
AudioValueRange* ranges = (AudioValueRange*) juce_calloc (size);
|
||||
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyAvailableNominalSampleRates, &size, ranges)))
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, ranges)))
|
||||
{
|
||||
for (int i = 0; i < numElementsInArray (possibleRates); ++i)
|
||||
{
|
||||
|
|
@ -263373,11 +263416,17 @@ public:
|
|||
inputLatency = 0;
|
||||
outputLatency = 0;
|
||||
UInt32 lat;
|
||||
size = sizeof (UInt32);
|
||||
if (AudioDeviceGetProperty (deviceID, 0, true, kAudioDevicePropertyLatency, &size, &lat) == noErr)
|
||||
size = sizeof (lat);
|
||||
pa.mSelector = kAudioDevicePropertyLatency;
|
||||
pa.mScope = kAudioDevicePropertyScopeInput;
|
||||
//if (AudioDeviceGetProperty (deviceID, 0, true, kAudioDevicePropertyLatency, &size, &lat) == noErr)
|
||||
if (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, &lat) == noErr)
|
||||
inputLatency = (int) lat;
|
||||
|
||||
if (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyLatency, &size, &lat) == noErr)
|
||||
pa.mScope = kAudioDevicePropertyScopeOutput;
|
||||
size = sizeof (lat);
|
||||
|
||||
if (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, &lat) == noErr)
|
||||
outputLatency = (int) lat;
|
||||
|
||||
log (T("lat: ") + String (inputLatency) + T(" ") + String (outputLatency));
|
||||
|
|
@ -263416,7 +263465,13 @@ public:
|
|||
avt.mOutputDataSize = 256;
|
||||
|
||||
UInt32 transSize = sizeof (avt);
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, input, kAudioDevicePropertyDataSourceNameForID, &transSize, &avt)))
|
||||
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyDataSourceNameForID;
|
||||
pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &transSize, &avt)))
|
||||
{
|
||||
DBG (buffer);
|
||||
s.add (buffer);
|
||||
|
|
@ -263432,13 +263487,17 @@ public:
|
|||
int getCurrentSourceIndex (bool input) const
|
||||
{
|
||||
OSType currentSourceID = 0;
|
||||
UInt32 size = 0;
|
||||
UInt32 size = sizeof (currentSourceID);
|
||||
int result = -1;
|
||||
|
||||
if (deviceID != 0
|
||||
&& OK (AudioDeviceGetPropertyInfo (deviceID, 0, input, kAudioDevicePropertyDataSource, &size, 0)))
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyDataSource;
|
||||
pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if (deviceID != 0)
|
||||
{
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, input, kAudioDevicePropertyDataSource, &size, ¤tSourceID)))
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, ¤tSourceID)))
|
||||
{
|
||||
int num = 0;
|
||||
OSType* const types = getAllDataSourcesForDevice (deviceID, input, num);
|
||||
|
|
@ -263473,8 +263532,14 @@ public:
|
|||
{
|
||||
if (((unsigned int) index) < (unsigned int) num)
|
||||
{
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyDataSource;
|
||||
pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
OSType typeId = types[index];
|
||||
AudioDeviceSetProperty (deviceID, 0, 0, input, kAudioDevicePropertyDataSource, sizeof (typeId), &typeId);
|
||||
|
||||
OK (AudioObjectSetPropertyData (deviceID, &pa, 0, 0, sizeof (typeId), &typeId));
|
||||
}
|
||||
|
||||
juce_free (types);
|
||||
|
|
@ -263511,15 +263576,20 @@ public:
|
|||
// set sample rate
|
||||
Float64 sr = newSampleRate;
|
||||
UInt32 size = sizeof (sr);
|
||||
OK (AudioDeviceSetProperty (deviceID, 0, 0, false, kAudioDevicePropertyNominalSampleRate, size, &sr));
|
||||
OK (AudioDeviceSetProperty (deviceID, 0, 0, true, kAudioDevicePropertyNominalSampleRate, size, &sr));
|
||||
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyNominalSampleRate;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
OK (AudioObjectSetPropertyData (deviceID, &pa, 0, 0, size, &sr));
|
||||
|
||||
// change buffer size
|
||||
UInt32 framesPerBuf = bufferSizeSamples;
|
||||
size = sizeof (framesPerBuf);
|
||||
|
||||
OK (AudioDeviceSetProperty (deviceID, 0, 0, false, kAudioDevicePropertyBufferFrameSize, size, &framesPerBuf));
|
||||
OK (AudioDeviceSetProperty (deviceID, 0, 0, true, kAudioDevicePropertyBufferFrameSize, size, &framesPerBuf));
|
||||
pa.mSelector = kAudioDevicePropertyBufferFrameSize;
|
||||
OK (AudioObjectSetPropertyData (deviceID, &pa, 0, 0, size, &framesPerBuf));
|
||||
|
||||
// wait for the changes to happen (on some devices)
|
||||
int i = 30;
|
||||
|
|
@ -263626,7 +263696,14 @@ public:
|
|||
|
||||
UInt32 running = 0;
|
||||
UInt32 size = sizeof (running);
|
||||
OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyDeviceIsRunning, &size, &running));
|
||||
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyDeviceIsRunning;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, &running));
|
||||
|
||||
if (running == 0)
|
||||
break;
|
||||
}
|
||||
|
|
@ -263774,13 +263851,18 @@ public:
|
|||
UInt32 size = 0;
|
||||
CoreAudioInternal* result = 0;
|
||||
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyRelatedDevices;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if (deviceID != 0
|
||||
&& AudioDeviceGetPropertyInfo (deviceID, 0, false, kAudioDevicePropertyRelatedDevices, &size, 0) == noErr
|
||||
&& AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size) == noErr
|
||||
&& size > 0)
|
||||
{
|
||||
AudioDeviceID* devs = (AudioDeviceID*) juce_calloc (size);
|
||||
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, false, kAudioDevicePropertyRelatedDevices, &size, devs)))
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, devs)))
|
||||
{
|
||||
for (unsigned int i = 0; i < size / sizeof (AudioDeviceID); ++i)
|
||||
{
|
||||
|
|
@ -263864,15 +263946,11 @@ private:
|
|||
return noErr;
|
||||
}
|
||||
|
||||
static OSStatus deviceListenerProc (AudioDeviceID inDevice,
|
||||
UInt32 inLine,
|
||||
Boolean isInput,
|
||||
AudioDevicePropertyID inPropertyID,
|
||||
void* inClientData)
|
||||
static OSStatus deviceListenerProc (AudioDeviceID /*inDevice*/, UInt32 /*inLine*/, const AudioObjectPropertyAddress* pa, void* inClientData)
|
||||
{
|
||||
CoreAudioInternal* const intern = (CoreAudioInternal*) inClientData;
|
||||
|
||||
switch (inPropertyID)
|
||||
switch (pa->mSelector)
|
||||
{
|
||||
case kAudioDevicePropertyBufferSize:
|
||||
case kAudioDevicePropertyBufferFrameSize:
|
||||
|
|
@ -263900,12 +263978,17 @@ private:
|
|||
UInt32 size = 0;
|
||||
num = 0;
|
||||
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyDataSources;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if (deviceID != 0
|
||||
&& OK (AudioDeviceGetPropertyInfo (deviceID, 0, input, kAudioDevicePropertyDataSources, &size, 0)))
|
||||
&& OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size)))
|
||||
{
|
||||
types = (OSType*) juce_calloc (size);
|
||||
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, input, kAudioDevicePropertyDataSources, &size, types)))
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, types)))
|
||||
{
|
||||
num = size / sizeof (OSType);
|
||||
}
|
||||
|
|
@ -263975,14 +264058,22 @@ public:
|
|||
|
||||
internal = device;
|
||||
|
||||
AudioHardwareAddPropertyListener (kAudioPropertyWildcardPropertyID,
|
||||
hardwareListenerProc, internal);
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioObjectPropertySelectorWildcard;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementWildcard;
|
||||
|
||||
AudioObjectAddPropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal);
|
||||
}
|
||||
|
||||
~CoreAudioIODevice()
|
||||
{
|
||||
AudioHardwareRemovePropertyListener (kAudioPropertyWildcardPropertyID,
|
||||
hardwareListenerProc);
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioObjectPropertySelectorWildcard;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementWildcard;
|
||||
|
||||
AudioObjectRemovePropertyListener (kAudioObjectSystemObject, &pa, hardwareListenerProc, internal);
|
||||
|
||||
delete internal;
|
||||
}
|
||||
|
|
@ -264156,11 +264247,11 @@ private:
|
|||
bool isOpen_, isStarted;
|
||||
String lastError;
|
||||
|
||||
static OSStatus hardwareListenerProc (AudioHardwarePropertyID inPropertyID, void* inClientData)
|
||||
static OSStatus hardwareListenerProc (AudioDeviceID /*inDevice*/, UInt32 /*inLine*/, const AudioObjectPropertyAddress* pa, void* inClientData)
|
||||
{
|
||||
CoreAudioInternal* const intern = (CoreAudioInternal*) inClientData;
|
||||
|
||||
switch (inPropertyID)
|
||||
switch (pa->mSelector)
|
||||
{
|
||||
case kAudioHardwarePropertyDevices:
|
||||
intern->deviceDetailsChanged();
|
||||
|
|
@ -264203,19 +264294,27 @@ public:
|
|||
outputIds.clear();
|
||||
|
||||
UInt32 size;
|
||||
if (OK (AudioHardwareGetPropertyInfo (kAudioHardwarePropertyDevices, &size, 0)))
|
||||
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioHardwarePropertyDevices;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if (OK (AudioObjectGetPropertyDataSize (kAudioObjectSystemObject, &pa, 0, 0, &size)))
|
||||
{
|
||||
AudioDeviceID* const devs = (AudioDeviceID*) juce_calloc (size);
|
||||
|
||||
if (OK (AudioHardwareGetProperty (kAudioHardwarePropertyDevices, &size, devs)))
|
||||
if (OK (AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, 0, 0, &size, devs)))
|
||||
{
|
||||
static bool alreadyLogged = false;
|
||||
const int num = size / sizeof (AudioDeviceID);
|
||||
for (int i = 0; i < num; ++i)
|
||||
{
|
||||
char name[1024];
|
||||
char name [1024];
|
||||
size = sizeof (name);
|
||||
if (OK (AudioDeviceGetProperty (devs[i], 0, false, kAudioDevicePropertyDeviceName, &size, name)))
|
||||
pa.mSelector = kAudioDevicePropertyDeviceName;
|
||||
|
||||
if (OK (AudioObjectGetPropertyData (devs[i], &pa, 0, 0, &size, name)))
|
||||
{
|
||||
const String nameString (String::fromUTF8 ((const uint8*) name, strlen (name)));
|
||||
|
||||
|
|
@ -264268,9 +264367,13 @@ public:
|
|||
|
||||
// if they're asking for any input channels at all, use the default input, so we
|
||||
// get the built-in mic rather than the built-in output with no inputs..
|
||||
if (AudioHardwareGetProperty (forInput ? kAudioHardwarePropertyDefaultInputDevice
|
||||
: kAudioHardwarePropertyDefaultOutputDevice,
|
||||
&size, &deviceID) == noErr)
|
||||
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = forInput ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice;
|
||||
pa.mScope = kAudioObjectPropertyScopeWildcard;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if (AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, 0, 0, &size, &deviceID) == noErr)
|
||||
{
|
||||
if (forInput)
|
||||
{
|
||||
|
|
@ -264338,11 +264441,16 @@ private:
|
|||
int total = 0;
|
||||
UInt32 size;
|
||||
|
||||
if (OK (AudioDeviceGetPropertyInfo (deviceID, 0, input, kAudioDevicePropertyStreamConfiguration, &size, 0)))
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mSelector = kAudioDevicePropertyStreamConfiguration;
|
||||
pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
|
||||
if (OK (AudioObjectGetPropertyDataSize (deviceID, &pa, 0, 0, &size)))
|
||||
{
|
||||
AudioBufferList* const bufList = (AudioBufferList*) juce_calloc (size);
|
||||
|
||||
if (OK (AudioDeviceGetProperty (deviceID, 0, input, kAudioDevicePropertyStreamConfiguration, &size, bufList)))
|
||||
if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, bufList)))
|
||||
{
|
||||
const int numStreams = bufList->mNumberBuffers;
|
||||
|
||||
|
|
|
|||
1000
juce_amalgamated.h
1000
juce_amalgamated.h
File diff suppressed because it is too large
Load diff
|
|
@ -155,7 +155,16 @@ public:
|
|||
bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
|
||||
int64 startSampleInFile, int numSamples)
|
||||
{
|
||||
numSamples = (int) jmin ((int64) numSamples, lengthInSamples - startSampleInFile);
|
||||
const int64 samplesAvailable = lengthInSamples - startSampleInFile;
|
||||
|
||||
if (samplesAvailable < numSamples)
|
||||
{
|
||||
for (int i = numDestChannels; --i >= 0;)
|
||||
if (destSamples[i] != 0)
|
||||
zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * numSamples);
|
||||
|
||||
numSamples = (int) samplesAvailable;
|
||||
}
|
||||
|
||||
if (numSamples <= 0)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -307,7 +307,16 @@ public:
|
|||
bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
|
||||
int64 startSampleInFile, int numSamples)
|
||||
{
|
||||
numSamples = (int) jmin ((int64) numSamples, lengthInSamples - startSampleInFile);
|
||||
const int64 samplesAvailable = lengthInSamples - startSampleInFile;
|
||||
|
||||
if (samplesAvailable < numSamples)
|
||||
{
|
||||
for (int i = numDestChannels; --i >= 0;)
|
||||
if (destSamples[i] != 0)
|
||||
zeromem (destSamples[i] + startOffsetInDestBuffer, sizeof (int) * numSamples);
|
||||
|
||||
numSamples = (int) samplesAvailable;
|
||||
}
|
||||
|
||||
if (numSamples <= 0)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -318,20 +318,20 @@ bool BufferingAudioSource::readNextBufferChunk()
|
|||
if (bufferIndexStart < bufferIndexEnd)
|
||||
{
|
||||
readBufferSection (sectionToReadStart,
|
||||
sectionToReadEnd - sectionToReadStart,
|
||||
bufferIndexStart);
|
||||
sectionToReadEnd - sectionToReadStart,
|
||||
bufferIndexStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int initialSize = buffer.getNumSamples() - bufferIndexStart;
|
||||
|
||||
readBufferSection (sectionToReadStart,
|
||||
initialSize,
|
||||
bufferIndexStart);
|
||||
initialSize,
|
||||
bufferIndexStart);
|
||||
|
||||
readBufferSection (sectionToReadStart + initialSize,
|
||||
(sectionToReadEnd - sectionToReadStart) - initialSize,
|
||||
0);
|
||||
(sectionToReadEnd - sectionToReadStart) - initialSize,
|
||||
0);
|
||||
}
|
||||
|
||||
const ScopedLock sl2 (bufferStartPosLock);
|
||||
|
|
|
|||
|
|
@ -1054,6 +1054,12 @@ void AudioDeviceSelectorComponent::resized()
|
|||
midiOutputSelector->setBounds (lx, y, w, h);
|
||||
}
|
||||
|
||||
void AudioDeviceSelectorComponent::childBoundsChanged (Component* child)
|
||||
{
|
||||
if (child == audioDeviceSettingsComp)
|
||||
resized();
|
||||
}
|
||||
|
||||
void AudioDeviceSelectorComponent::buttonClicked (Button*)
|
||||
{
|
||||
AudioIODevice* const device = deviceManager.getCurrentAudioDevice();
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ public:
|
|||
void buttonClicked (Button*);
|
||||
/** @internal */
|
||||
void changeListenerCallback (void*);
|
||||
/** @internal */
|
||||
void childBoundsChanged (Component*);
|
||||
|
||||
//==============================================================================
|
||||
juce_UseDebuggingNewOperator
|
||||
|
|
|
|||
|
|
@ -119,12 +119,12 @@
|
|||
#ifndef __JUCE_POSITIONABLEAUDIOSOURCE_JUCEHEADER__
|
||||
#include "audio/audio_sources/juce_PositionableAudioSource.h"
|
||||
#endif
|
||||
#ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
|
||||
#include "audio/audio_sources/juce_ResamplingAudioSource.h"
|
||||
#endif
|
||||
#ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
|
||||
#include "audio/audio_sources/juce_ToneGeneratorAudioSource.h"
|
||||
#endif
|
||||
#ifndef __JUCE_RESAMPLINGAUDIOSOURCE_JUCEHEADER__
|
||||
#include "audio/audio_sources/juce_ResamplingAudioSource.h"
|
||||
#endif
|
||||
#ifndef __JUCE_AUDIODEVICEMANAGER_JUCEHEADER__
|
||||
#include "audio/devices/juce_AudioDeviceManager.h"
|
||||
#endif
|
||||
|
|
@ -206,12 +206,12 @@
|
|||
#ifndef __JUCE_AUDIOTHUMBNAILCACHE_JUCEHEADER__
|
||||
#include "audio/audio_file_formats/juce_AudioThumbnailCache.h"
|
||||
#endif
|
||||
#ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
|
||||
#include "audio/audio_file_formats/juce_AudioSubsectionReader.h"
|
||||
#endif
|
||||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
|
||||
#include "audio/audio_file_formats/juce_FlacAudioFormat.h"
|
||||
#endif
|
||||
#ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
|
||||
#include "audio/audio_file_formats/juce_AudioSubsectionReader.h"
|
||||
#endif
|
||||
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
|
||||
#include "audio/audio_file_formats/juce_WavAudioFormat.h"
|
||||
#endif
|
||||
|
|
@ -680,24 +680,24 @@
|
|||
#ifndef __JUCE_BUBBLECOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_BubbleComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_BubbleMessageComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_COLOURSELECTOR_JUCEHEADER__
|
||||
#include "gui/components/special/juce_ColourSelector.h"
|
||||
#endif
|
||||
#ifndef __JUCE_BUBBLEMESSAGECOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_BubbleMessageComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_DROPSHADOWER_JUCEHEADER__
|
||||
#include "gui/components/special/juce_DropShadower.h"
|
||||
#endif
|
||||
#ifndef __JUCE_MAGNIFIERCOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_MagnifierComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_MidiKeyboardComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_NSVIEWCOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_NSViewComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_MIDIKEYBOARDCOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_MidiKeyboardComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_OPENGLCOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_OpenGLComponent.h"
|
||||
#endif
|
||||
|
|
@ -707,12 +707,12 @@
|
|||
#ifndef __JUCE_QUICKTIMEMOVIECOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_QuickTimeMovieComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_SystemTrayIconComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_WEBBROWSERCOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_WebBrowserComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_SYSTEMTRAYICONCOMPONENT_JUCEHEADER__
|
||||
#include "gui/components/special/juce_SystemTrayIconComponent.h"
|
||||
#endif
|
||||
#ifndef __JUCE_LOOKANDFEEL_JUCEHEADER__
|
||||
#include "gui/components/lookandfeel/juce_LookAndFeel.h"
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue