Post

Replies

Boosts

Views

Activity

io buffer sizes for audio driver based on IOUserAudioDevice
Dear Sirs, I've written an audio driver based on IOUserAudioDevice. In my IOOperationHandler I can receive and send the audio samples as expected. Is there any way to configure the number of samples transferred in each call? Currently it seem to be around 512 samples per call, which relates to 10.7 millisecs when operating on 48 kHz samplerate. I'd like to achieve something like 48 or 96 samples per call. I did some experiments and tried calls to SetOutputLatency() etc. but so far I didn't find the right way to change the in_io_buffer_frame_size in the callback. I'd like to do this as smaller buffer sizes would allow lower latencies for the subsequent audio processing. Thanks and best regards, Johannes
3
0
535
Jul ’24
How can I optimize SwiftUI CPU load on frequent updates
Dear Sirs, I'm writing an audio application that should show up to 128 horizontal peakmeters (width for each is about 150, height is 8) stacked inside a ScrollViewReader. For the actual value of the peakmeter I have a binding to a CGFloat value. The peakmeter works as expected and is refreshing correct. For testing I added a timer to my swift application that is firing every 0.05 secs, meaning I want to show 20 values per second. Inside the timer func I'm just creating random CGFloat values in range of 0...1 for the bound values. The peakmeters refresh and flicker as expected but I can see a CPU load of 40-50% in the activity monitor on my MacBook Air with Apple M2 even when compiled in release mode. I think this is quite high and I'd like to reduce this CPU load. Should this be possible? I.e. I thought about blocking the refresh until I've set all values? How could this be done and would it help? What else could I do? Thanks and best regards, JFreyberger
1
0
629
May ’24
Save/Restore properties on reboot in audio driver based on AudioDriverKit
Dear Sirs, when writing an AudioServerPlugin I can use the hosts WriteToStorage/CopyFromStorage functions to save and restore custom properties on restarting the machine. Are there corresponding functions for an audio driver based on AudioDriverKit? What would be the recommended way to save and restore properties so that they are available again after a reboot in an audio driver based on AudioDriverKit? Thanks and best regards, Johannes
1
0
557
Feb ’24
NSLock broken when using optimize speed in XCode Swift?
Dear Sirs, I've written a SwiftUI application in XCode where I'm using multiple threads which are synchronized by using NSLock and NSRecursiveLock. This works in Debug mode and in Release mode as long as I don't use the Swift Compiler - Code Generation -> Optimization Level -O for "Optimize for Speed". This is unfortunately the default setting but it results in multiple threads accessing the same piece of code which is encapsulated inside a NSLock. Is this an intended behaviour? Thanks and best regards, Johannes
6
0
907
Feb ’24
AudioDriverKit IOUserAudioIOOperationWriteEnd avoid for input loopback
Dear Sirs, I've written an audio driver based on AudioDriverKit. In my audio callback function I'm receiving calls with io operation IOUserAudioIOOperationWriteEnd and IOUserAudioIOOperationBeginRead as expected which means I see IOUserAudioIOOperationWriteEnd operations during a playback in an application like VLC or the browser and I see IOUserAudioIOOperationBeginRead when recording in Audacity etc.. But when I open the SystemSettings and goto Sound and I select my driver as input I also see calls with IOUserAudioIOOperationWriteEnd which seem to be the just read input data. I can also watch this when starting up Teams. I think the purpose is to add the (mic) input also to the output so you have the chance to listen to yourself. Nevertheless I'd like to fully avoid this but I don't see a way to distinguish between the playback audio data and the input audio data inside this callback. How could I do this? Or even better is there a switch which would completely switch off these callbacks which forward the input to the output? Thanks and best regards, Johannes
2
0
688
Feb ’24
Read user defined network interface names
Hi, I have a C++ application on OSX that normally works on systems with multiple network interfaces and I'd like to offer a dialog to the users to select the appropriate NIC for the different tasks. It would be fine to show the users the name they assigned to the NIC inside the system settings but I don't know how to read these names. I tried to use SCNetworkInterfaceGetLocalizedDisplayName() but that only gives me the name before I entered my own user defined name (something like "USB 10/100/1000 LAN"). Is there a way to read the user defined name of each NIC? Thanks and best regards, Johannes
3
0
777
Dec ’23
Get Callstacks and demangle C++
Dear Sirs, while it's quite clear that I'll try to write applications that do not crash unfortunately this can happen. In this case I'd like to write a detailed crash report including callstacks for all threads to my logfiles even from Release builds on the customers machine. So I started to do some tests with backtrace and backtrace_symbols and this already seems to solve a lot. Nevertheless I don't really get as close to the error report shown by the MacOS error report as I'd have hoped. I have a problem with demangling the C++ objects and I cannot get the line numbers. So something which looks like this in the Apple MacOS error report: 5 MyCrashTestApp 0x10445f150 CZMQConnection::CFnCalledWorkerThread::Thread() + 132 (ZMQConnection.cpp:1128) looks like this in my callstack: 5 MyCrashTestApp 0x000000010445f150 _ZN14CZMQConnection21CFnCalledWorkerThread6ThreadEv + 132 I tried different ways of demangling with calls to abi::__cxa_demangle() and dladdr() beforehand but so far the output didn't change and the filename and line numbers are completely missing. How can I achieve an output like the one of the Apple MacOS error report including the filenames and line numbers and will this also work on customers machines? How do i have to configure my C++ XCode project for this? Thanks and best regards, Johannes
2
0
971
Oct ’23
No Eligible Profiles matching macOS platform
Dear Sirs, for quite a while I cannot sucessfully invoke "Download Profile ..." anymore inside my XCode macOS project in the Signing section. Nevertheless I can create the profile manually in my developer account and download the provisioning profile to my machine and then invoke "Import Profile ...". That works correct. But also the Identifier is not added anymore automatically to my developer account when I create a new project in XCode. Both things worked correct at the beginning but it could be it got broken after some OS or XCode update. I tried to find logs showing the communication between XCode and my developer account as I think there could be some mismatch somewhere but so far I didn't find anything useful. Although I can do all the things manually it would be nice to have it working again and any hint would be appreciated. Thanks and best regards, Johannes
0
0
547
Oct ’23
Sign a DriverKit based Dext for distribution
Dear Sirs, I've written a Swift App, a C++ application and a Driver Extension using DriverKit and AudioDriverKit. As it works on my development machine now I'd like to give it to some other users and so I'm trying to make a Release Build. I've created a Signing Certificate for "Apple Distribution" which I can use for my Swift App and the C++ application which also both use "com.apple.developer.driverkit.userclient-access". I've been given this entitlement and the "Distribution Support" is for "Development, Ad hoc, App Store, Developer ID". For my Driver Extension I'm using the entitlements "com.apple.developer.driverkit" and "com.apple.developer.driverkit.family.audio" which I've also been given and which show the identical "Distribution Support". But when I try to use my Signing Certificate XCode refuses to use the provisioning profile for the Dext and says "Xcode 14 and later requires a DriverKit development profile enabled for iOS and macOS. Visit the developer website to create or download a DriverKit profile." On the other hand I have to use the same Signing Certificate for my Swift App that embeds the Dext and the Dext itself. How can I create a Signing Certificate for Release mode that works for both, the Swift App and the Dext? Thanks and best regards, Johannes
2
0
907
Oct ’23
Add icon to DEXT based on AudioDriverKit
Dear Sirs, I'd like to add an icon to my audio driver based on AudioDriverKit. This icon should show up left of my audio device in the audio devices dialog. For an Audio Server Plugin I managed to do this using the property kAudioDevicePropertyIcon and CFBundleCopyResourceURL(...) but how would you do this with AudioDriverKit? Should I use IOUserAudioCustomProperty or IOUserAudioControl and how would I refer to the Bundle? Is there an example available somewhere? Thanks and best regards, Johannes
6
0
939
Sep ’23
AudioServerPlugInHostRef WriteToStorage and CopyFromStorage after reboot
Dear Sirs, I'm trying to find a way to save and restore some settings of an Audio Server Plugin so that they will be available again after a reboot. I came across the functions WriteToStorage and CopyFromStorage which seem to work correct but after a reboot my settings seem to be gone. Am I doing something wrong and normally this storage should survive a reboot or is this not the intended way to have persistent settings. What would be the recommended way if I want to use these settings right from the start before and user mode app is started? Thanks and best regards, Johannes
1
0
733
Sep ’23
Restore dext settings on startup
Dear Sirs, I've written a driver extension that can be configured through a user mode application. Now when the system reboots I'd like to start the dext again with the latest configuration right from the beginning and before the user mode applications is started (if it is started at all). What is the recommended way to do this and is there an example available? Should I do this using configuration files and through a special file API inside the dext or is there a kind of registry, or should I use sysctl variables and sysctlbyname? Thanks and best regards, Johannes
0
0
579
Sep ’23
Entitlements for a virtual audio driver including IOUserClient
Dear Sirs, I’d like to write a virtual audio driver that also exchanges data with a application and thus probably also offers a driver extension using IOUserClient. My first implementation was based on the sample https://developer.apple.com/documentation/audiodriverkit/creating_an_audio_device_driver and everything works fine and as expected on my development machine and I can install/uninstall the dext from within my application. But I had to learn that I will not be given the required entitlement com.apple.developer.driverkit.family.audio as AudioDriverKit seems to be not intended to be used for virtual drivers. So I found out that this sample should be used as starting point for virtual audio drivers: https://developer.apple.com/documentation/coreaudio/creating_an_audio_server_driver_plug-in. But this sample does not include a dext offering the IOUserClient interface which I think I need. The next sample I found was https://developer.apple.com/documentation/coreaudio/building_an_audio_server_plug-in_and_driver_extension . This doesn’t use AudioDriverKit and it includes IOUserClient so it seems to be a good start. Nevertheless it also requires some entitlements which are com.apple.developer.driverkit and com.apple.developer.driverkit.transport.usb. The client also probably needs the entitlement com.apple.developer.driverkit.userclient-access. Would I be given these entitlements for a pure virtual audio driver and why would I need com.apple.developer.driverkit.transport.usb? And is there a chance that AudioDriverKit will also be opened for virtual drivers as it seems to be a much more modern approach and doesn’t require a reboot for installing? Thanks and best regards, Johannes
3
0
1.2k
Aug ’23
SimpleAudioDriver sample, cannot install dext
Hi, I'm a little newbie on MacOS but did audio development for many years on other systems. Now I started some development on MacOS and tried to get this SimpleAudioDriver sample running. Compilation works fine and when I try to install the dext I'm prompted for my credentials. Afterwards "systemextensionsctl list" shows the dext as enabled and active but the SimpleAudio device is not shown in the "Audio MIDI Setup" and the SimpleAudioDriverApp says the extension is not running. I already tried various things from "csrutil disable" to "systemextensionsctl developer on" to "sudo nvram boot-args=-arm64e_preview_abi" My console log shows error entries like this: Error occurred while handling request "DextLaunch(arguments: Optional(["Check In Token": 18447, "Driver Extension Server Tag": 4294973749, "CFBundleIdentifier": de.bebetterorganized.dev.SimpleAudio.Driver, "DriverKit Reslide Shared Cache": 0, "Driver Extension Server Name": de.bebetterorganized.dev.SimpleAudio.Driver, "kOSBundleDextUniqueIdentifier": <3eb592b5 11e19191 027e272f 7fc6f5cc f24eaa62 367de83c 2fc697b5 4db10ed7>]))": Error Domain=NSPOSIXErrorDomain Code=8 "Exec format error" Now I'm not sure whether my extension is not loaded at all or whether it's just not detected as audio device and not connectable for any reason. I'm trying all these things on a MacBook Air with Apple M2 CPU, MacOS 13.2.1 and XCode Version 14.2 (14C18), MacOS Any hint would be appreciated, thanks a lot, Johannes
7
0
1.8k
Mar ’23