-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CoreAudio add support for new HAL API for applications that target Mac OS X >= 10.5 #356
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for this Mac OS update. This will make a lot of people happy.
I see that you also cleaned up a lot of trailing white space. That's great. But unfortunately they obscure the relevant changes. Would it be possible to resubmit this pull request without the white space commit? We can do those as a later pull request. Generally it is best to separate style or format changes from real code changes.
Then we can do the detailed code review.
You are welcome Phil! |
I checked out this fork. and got these errors: libtool: compile: gcc -c -std=c99 -O2 -Wall -pedantic -pipe -fPIC -DNDEBUG -DPA_LITTLE_ENDIAN -I./include -I./src/common -I./src/os/unix -Wno-deprecated -Werror -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.4 -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DPACKAGE_URL="" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=8 -DHAVE_CLOCK_GETTIME=1 -DHAVE_NANOSLEEP=1 -DPA_USE_COREAUDIO=1 src/hostapi/coreaudio/pa_mac_core_utilities.c -fno-common -DPIC -o src/hostapi/coreaudio/.libs/pa_mac_core_utilities.o |
Thanks John. With your changes I can now compile using "-mmacosx-version-min=10.4". I ran pa_devs, paex_sine, paex_record, paqa_devs, paqa_errs, paqa_latency and they passed OK. |
The latest stable PortAudio uses a deprecated API which has been removed on macOS 11. PortAudio/portaudio#356 PortAudio/portaudio#218
The latest stable PortAudio uses a deprecated API which has been removed on macOS 11. PortAudio/portaudio#356 PortAudio/portaudio#218
The latest stable PortAudio uses a deprecated API which has been removed on macOS 11. PortAudio/portaudio#356 PortAudio/portaudio#218
The latest stable PortAudio uses a deprecated API which has been removed on macOS 11. PortAudio/portaudio#356 PortAudio/portaudio#218
Thanks for this. I haven't finished reviewing it but I just want to write down some notes here while I remember:
I'll explain more later, and perhaps Phil and I can advise for how to improve things. |
The latest stable PortAudio uses a deprecated API which has been removed on macOS 11. PortAudio/portaudio#356 PortAudio/portaudio#218
About #ifdefs and duplication of code: |
I am writing this comment on a 9 year old Macbook Air stuck on macOS 10.13 because Apple won't let me update it to a newer OS. macOS 10.04 was released in 2005. So I say, yes, drop the legacy API. Probably very few machines are running it anymore and probably lots of other libraries used in any recent application wouldn't be able to run on them. |
@philburk @RossBencina would you be okay with removing the old API now? |
I tried to find statistics for the current share of machines running 10.4 and it is off the bottom of the chart for everything I could find. I imagine that people running 10.4 would not expect newly built apps to still run on their machine. For a new apps built today, even if PortAudio supported 10.4, the app would probably use other APIs that do not run on on 10.4. 10.4 came out in 2005 and machines built in 2005 probably upgraded to later versions. So I think it is reasonable to drop support for 10.4 and to just note that if people want to support 10.4 then they can use an old stable release or a snapshot. |
I agree to dropping support for 10.4. If we can support 10.6 and later that is good enough. That said, the newer API is kinda sucky compared to the old one, so perhaps keeping the wrapper functions in this patch still makes sense? |
Further to my earlier comments: This may no longer be relevant, but our naming conventions are documented here: https://github.com/PortAudio/portaudio/wiki/ImplementationStyleGuidelines With respect to the added functions prefixed The preprocessor symbol naming convention does not appear to be clearly documented but in this case I'd say |
Thank you all for commenting. I've just dropped support for Tiger and also renamed all helper functions to PaMacCore_. |
The code looks great. Thanks for making all these changes. But bad news... I followed the instructions above to try the new code:
bin/paex_sine works OK
bin/patest_wire has a similar failure If I switch back to the master branch then they work fine. |
+1 awaiting for this merge. (REF: spatialaudio/python-sounddevice#299) |
I propose making a new release as soon as this is merged. |
@RossBencina is there anything left to do here? |
Similarly waiting for this merge and release! |
ping @RossBencina this critical bug fix has been sitting for over two weeks |
Awesome this was merged. Does this being merged mean that it's available via something like |
I will update vcpkg as soon as the new release is made. |
Is there somewhere I track progress towards new release? I'm grateful that folks are working on this. I'm blocked until a new release a cut. |
You can |
I found vcpkg at https://vcpkg.readthedocs.io/en/latest/And PortAudio at: https://github.com/microsoft/vcpkg/tree/master/ports/portaudio
Does that grab the current HEAD from GitHub? Or the old head from Assembla? |
HEAD from GitHub. I used that command to get this fix on my host. |
This pull request addresses item #218 by using the new CoreAudio APIs while keeping compatibility with
applications that need to use the old APIs!
This is done with the following check
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
#define PA_NEW_HAL 1
#else
#define PA_NEW_HAL 0
#endif
which checks if the application targets Mac OSX >= 10.5, so applications targeting Mac OS X 10.4 will use the old API.
I tried to make the changes as minimal as possible by introducing wrapper functions and #ifdefs
for two reasons:
a) easier review
b) compatibility with old API