mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Audio i/o: Took the safety offset into account when calculating latency in CoreAudio
This commit is contained in:
parent
4400db5969
commit
f6b3bddf74
1 changed files with 10 additions and 4 deletions
|
|
@ -352,14 +352,20 @@ public:
|
|||
|
||||
int getLatencyFromDevice (AudioObjectPropertyScope scope) const
|
||||
{
|
||||
UInt32 lat = 0;
|
||||
UInt32 size = sizeof (lat);
|
||||
UInt32 latency = 0;
|
||||
UInt32 size = sizeof (latency);
|
||||
AudioObjectPropertyAddress pa;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
pa.mSelector = kAudioDevicePropertyLatency;
|
||||
pa.mScope = scope;
|
||||
AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &lat);
|
||||
return (int) lat;
|
||||
AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &latency);
|
||||
|
||||
UInt32 safetyOffset = 0;
|
||||
size = sizeof (safetyOffset);
|
||||
pa.mSelector = kAudioDevicePropertySafetyOffset;
|
||||
AudioObjectGetPropertyData (deviceID, &pa, 0, nullptr, &size, &safetyOffset);
|
||||
|
||||
return (int) (latency + safetyOffset);
|
||||
}
|
||||
|
||||
int getBitDepthFromDevice (AudioObjectPropertyScope scope) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue