Browse Source

Hog mode in JackCoreAudioDriver (in progress).

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3673 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/v1.9.4
sletz 15 years ago
parent
commit
5bd1727ab6
2 changed files with 27 additions and 0 deletions
  1. +25
    -0
      macosx/coreaudio/JackCoreAudioDriver.cpp
  2. +2
    -0
      macosx/coreaudio/JackCoreAudioDriver.h

+ 25
- 0
macosx/coreaudio/JackCoreAudioDriver.cpp View File

@@ -1334,6 +1334,31 @@ int JackCoreAudioDriver::SetBufferSize(jack_nframes_t buffer_size)
return 0;
}


bool JackCoreAudioDriver::TakeHog(AudioDeviceID deviceID, bool isInput)
{
pid_t hog_pid;
OSStatus err;

UInt32 propSize = sizeof(hog_pid);
err = AudioDeviceGetProperty(deviceID, 0, isInput, kAudioDevicePropertyHogMode, &propSize, &hog_pid);
if (err) {
jack_error("Cannot read hog state...");
printError(err);
}

if (hog_pid != getpid()) {
hog_pid = getpid();
err = AudioDeviceSetProperty(deviceID, 0, 0, isInput, kAudioDevicePropertyHogMode, propSize, &hog_pid);
if (err != noErr) {
jack_error("Can't hog device = %d because it's being hogged by another program", deviceID);
return false;
}
}
return true;
}

} // end of namespace




+ 2
- 0
macosx/coreaudio/JackCoreAudioDriver.h View File

@@ -150,6 +150,8 @@ class JackCoreAudioDriver : public JackAudioDriver

int AddListeners();
void RemoveListeners();
bool TakeHog(AudioDeviceID deviceID, bool isInput);

public:



Loading…
Cancel
Save