Posts

Post not yet marked as solved
0 Replies
175 Views
Hello, Is it possible to request the current status of Do-not-Disturb under macOS? Thank you for the help in advance!
Posted Last updated
.
Post not yet marked as solved
0 Replies
529 Views
Hello, I used kAudioDevicePropertyDeviceIsRunningSomewhere to check if an internal or external microphone is being used. My code works well for the internal microphone, and for microphones which are connected using a cable. External microphones which are connected using bluetooth are not reporting their status. The status is always requested successfully, but it is always reported as inactive. Main relevant parts in my code : static inline AudioObjectPropertyAddress makeGlobalPropertyAddress(AudioObjectPropertySelector selector) { AudioObjectPropertyAddress address = { selector, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster, }; return address; } static BOOL getBoolProperty(AudioDeviceID deviceID, AudioObjectPropertySelector selector) { AudioObjectPropertyAddress const address = makeGlobalPropertyAddress(selector); UInt32 prop; UInt32 propSize = sizeof(prop); OSStatus const status = AudioObjectGetPropertyData(deviceID, &address, 0, NULL, &propSize, &prop); if (status != noErr) { return 0; //this line never gets executed in my tests. The call above always succeeds, but it always gives back "false" status. } return static_cast<BOOL>(prop == 1); } ... __block BOOL microphoneActive = NO; iterateThroughAllInputDevices(^(AudioObjectID object, BOOL *stop) { if (getBoolProperty(object, kAudioDevicePropertyDeviceIsRunningSomewhere) != 0) { microphoneActive = YES; *stop = YES; } }); What could cause this and how could it be fixed? Thank you for your help in advance!
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.8k Views
I have a macOS app, which detects if a camera is being used via the kCMIOHardwarePropertyDevices : typedef void (^DeviceIterator)(CMIOObjectID cameraObject, BOOL *stop); static void iterateThroughAllInputDevices(DeviceIterator deviceIterator) { // Check the number of devices. CMIOObjectPropertyAddress address = makeGlobalPropertyAddress(kCMIOHardwarePropertyDevices); UInt32 devicesDataSize; auto status = CMIOObjectGetPropertyDataSize(kCMIOObjectSystemObject, &address, 0, nil, &devicesDataSize); if (isError(status)) { return; } // Get the devices. UInt32 devicesDataUsed; int count = devicesDataSize / sizeof(CMIOObjectID); if (!count) { LOG_INFO("video device list is empty"); return; } I am using virtual machines for my automated end-to-end tests (which tests are written in Python). These Virtual Machines don't have a Camera device available, so I quickly wrote a macOS Camera Extension (based on the "Create camera extensions with Core Media IO" WWDC session ) in hope that it could act like a real camera. Unfortunately this Virtual Camera is not being detected by the code above. I am getting the video device list is empty message. How could I create a virtual (software) camera that would be listed by the API above?
Posted Last updated
.