-
Notifications
You must be signed in to change notification settings - Fork 314
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
PulseAudio Portaudio HostAPI #336
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.
Hi @illuusio, I am glad that this project is revived.
Unfortunately building this with Ubuntu Bionic and cmake creates some minor warnings:
[ 94%] Building C object CMakeFiles/portaudio.dir/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c.o
/home/daniel/workspace/portaudio/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c: In function ‘PaPulseAudio_StreamPlaybackCb’:
/home/daniel/workspace/portaudio/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c:269:38: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
fprintf(stderr, "WANTED %d and got %d \n", numFrames, (length / l_ptrStream->outputFrameSize));
~^
%ld
/home/daniel/workspace/portaudio/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c:269:49: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
fprintf(stderr, "WANTED %d and got %d \n", numFrames, (length / l_ptrStream->outputFrameSize));
~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%ld
/home/daniel/workspace/portaudio/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c: In function ‘PaPulseAudio_StreamPlaybackCb’:
/home/daniel/workspace/portaudio/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c:269:38: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
fprintf(stderr, "WANTED %d and got %d \n", numFrames, (length / l_ptrStream->outputFrameSize));
~^
%ld
/home/daniel/workspace/portaudio/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c:269:49: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
fprintf(stderr, "WANTED %d and got %d \n", numFrames, (length / l_ptrStream->outputFrameSize));
~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%ld
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.
Some more comments regarding string length issues
dc91c44
to
fe515c5
Compare
Thanks @daschuer, |
eb4c661
to
1e4c936
Compare
Now everything which was in review is done. although I broke something as can't run 'patest_longsine' anymore which I have to investigate tomorrow. |
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 offering this PulseAudio implementation.
This is a major contribution to PortAudio.
I made note of some style issues.
https://github.com/PortAudio/portaudio/wiki/ImplementationStyleGuidelines
@philburk Thanks for review! I'll look that style guide through and fix issues on styling side. |
Hello,
I'm a bit confused (happens to me a lot 😉). Has the PulseAudio
interface API been merged and if so where? Admitted I have a lot to
learn about GitHub and need to spend some time learning it.
I'm am a bit anxious to start testing my application with the facilities
of the PulseAudio interface to Portaudio.
73,
Ron / W4MMP
…On 10/23/2020 05:34, Tuukka Pasanen wrote:
@philburk <https://github.com/philburk> Thanks for review! I'll look
that style guide through and fix issues on styling side.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#336 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACE6YTQCRQX6OWJWUELGVMTSMFE3XANCNFSM4SVXDYOA>.
|
No it's not merged yet it's still Pull Request state where contributors should look at it and find bugs/etc. You have to pull down my repo of Portaudio and compile it yourself. I try to provide drop-in binaries with it but I have to tune it little bit to fetch it from GIT so it will be more realtime. |
Hi,
OK, I managed to find the source with Pulseaudio support. I have
Pulseaudio installed on my RPi 4B and the source compiles fine. But I
do have one question before performing the "make install". Is there
anything special I need to supply to the ./configure script to support
Pulseaudio?
73,
Ron / W4MMP
…On 10/27/2020 04:40, Tuukka Pasanen wrote:
Hello, I'm a bit confused (happens to me a lot wink). Has the
PulseAudio interface API been merged and if so where? Admitted I
have a lot to learn about GitHub and need to spend some time
learning it.
No it's not merged yet it's still Pull Request state where
contributors should look at it and find bugs/etc. You have to pull
down my repo of Portaudio and compile it yourself. I try to provide
drop-in binaries with it but I have to tune it little bit to fetch it
from GIT so it will be more realtime.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#336 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACE6YTRYCRW3ERUFLGM6ITDSM2BPRANCNFSM4SVXDYOA>.
|
This is how I do it:
or if you have CMake installed then after getting into portaudio dir (Using scons it's not supported)
After that you have to manually (or if you are brave to use ./configure --prefix=/usr) copy libraries and include files for linking against them. If you were brave you just |
@daschuer Thanks again for review. I'm sort of time for couple of weeks but try to make progress on yours and code beautify |
f233f50
to
a768b14
Compare
Assigned to @illuusio -- we are awaiting style guide conformance. |
@RossBencina Sorry manual editing code styling is not my cup of tea in 2020 but now it should be styled. |
I tried using this with the Mixxx 2.3 branch. Unfortunately Mixxx freezes when pressing Apply in the Sound Hardware preferences. The freeze happens with every audio interface I tried, including my onboard interface, RME Babyface Pro, Native Instruments Kontrol S4 Mk3, and Allen & Heath Xone K2. The Mixxx log ends with:
I am using PulseAudio 13.99.2 on Fedora 33. |
Thank you for testing @Be-ing. It seems to be regression in name copying code that prevents PulseAudio to find source or sink because names are incorrect like yours in Debug 'Built-in Audio Analog Stere' should be 'Built-in Audio Analog Stereo' |
Ok no it should be fixed @Be-ing. Hopefully I didn't broke more. I have to compile Mixxx and test more roughly this week. |
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.
This is looking very good. Thanks for making these style changes.
Can we get a summary of test results by you and others?
It works now. Thank you @illuusio! This will be a big usability improvement for all PortAudio applications on Linux. |
@philburk is there anything left to do here or is this ready for merging? It would be great to have a PortAudio release soon with this new feature. |
This one is very close for merging @Be-ing from myside. I assume that there will be plenty of bugs after this is officially in and people start to use it more in production (or I don't know how many uses Linux anymore for desktop besides me..) but it's up to @philburk and @RossBencina when it's ready. |
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.
Some more comments.
cc5284b
to
23127e9
Compare
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.
Some more comments.
28edde1
to
de2aa50
Compare
State machine commenting was misleading. Add more specific comment and try explaing how isActive and isStopped works
Try to comment functions and code that someone who reads it have better clue what is going on and why some defaults are chosen
Refactor code and move every #define to header files. Also remove some old unneeded and unwanted stuff like unused stream latency variable which is not used as with pulseaudio latency is what you get. You can suggest but as documentation says you get or no not. Mostly you don't
Make sure that CI works as expected.
tlength should be set even when duplex playing. Add also PA_STREAM_ADJUST_LATENCY so pulseaudio server can adjust latencies when duplexing
Remove some unneeded code and variables as they just pollute code.
There is now 32 Frames Per Buffer default as it's fast enough and small enough to be easy to handle.
Honestly I'm no sure why this works! I probably should ask from ChatGPT but this commit makes Mono to Stereo work as expected. If Input and Output are mono then left channel is used which should be correct thing to do. if input is mono and output is stereo then it's converted to stereo output from mono. Please note! As I don't see usage for Input stereo to mono output I did not make that work. It should be fixed in some distant future if needed. It does not work in other HostAPI's as far as I read the code.. maybe AI would help
Rename variables that does not follow Portaudio naming scheme. Mostly all.
Manual intetation is fun and now it should be correct (tm)
b13c5a5
to
8a84e9f
Compare
This error handling should never happen but in real world it can happen. If someone unplugs USB then it just happened. also Cork streams before stopping for trying to prevent clicks in the end.
In my humble opinion this starts be ready to merge. As said there will be pain points but lot less than couple weeks ago. I'll try to find time to update things that @philburk find. |
Retested your variable renaming and indentation cleanup with my demos and tests, seems to be fine, no obvious breakage. |
@philburk : Could this be merged soon? I think all your review comments and all other comments have been addressed with the current code. Thanks. |
INCLUDES="$INCLUDES pa_jack.h" | ||
AC_DEFINE(PA_USE_JACK,1) | ||
fi | ||
|
||
if [[ "$have_pulse" = "yes" ] || [ "$have_jack" = "yes" ]] ; then | ||
OTHER_OBJS="$OTHER_OBJS src/common/pa_ringbuffer.o" | ||
INCLUDES="$INCLUDES pa_linux_pulseaudio.h" |
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.
This will add pa_linux_pulsaudio.h
even if only $have_jack
is yes. Is that what you want?
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.
This PR is merged now, but I'd still like to get clarification about whether this has the intended behavior please.
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.
Seems to be copy paste.. I'll make PR to solve this. I think it should be something like "$have_pulse" = "yes" ] && [ "$with_pulse" != "no"
or just merge it to one to rule them all if. I have to admit I use CMake so this was not tested very deeply.
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.
Now there is pull request with small fix to make it work. Jack and Pulseaudio needs ringbuffer so it's just merged together.
GitHub said there were changes requested but I could not find them. |
Thankyou and congratulations to @illuusio and everyone else who has contributed to this epic process! We're very happy to have PulseAudio support join the main PortAudio repository. |
Wow! Actually first code if from 2016 but as it was so slow from me to work on this and Pulseaudio is not very good fit to usage like this it took longer than I though but now.. it's done 👯 |
Adds support for PulseAudio API on Linux. For more information about Pulseaudio visit: https://www.freedesktop.org/wiki/Software/PulseAudio/ --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com>
* Preparation to start patching - TODOS and directory src/hostapi/Oboe * Added src/hostapi/oboe/README.md * Added include/pa_oboe.h and src/hostapi/oboe/pa_oboe.cpp * Added PA_USE_OBOE section to CMakeLists.txt * Added PA_USE_OBOE section to CMakeLists.txt * Heavily reworked CMake dependencies, added FindOboe.cmake, updated pa_oboe.cpp, more work needed * Included build_all_PaOboe.sh, more work needed on CMake * Included build_all_PaOboe.sh, more work needed on CMake * Update src/hostapi/oboe/README.md * bindings/cpp: CMake: support pkgconfig with RelWithDebInfo (PortAudio#822) bindings/cpp: add `RelWithDebInfo` to the configurations allowed to install portaudiocpp.pc, otherwise you won't have support for pkg-config when building a release package with separate debugging information. Besides that, RelWithDebInfo is identical to Release. * Fix MSVC warning C4018 signed/unsigned mismatch (PortAudio#821) See PortAudio#810 * Built shared library * Polished bits * mme: don't restrict the host buffer to 16-bit Currently, the MME Host API code only creates 16-bit integer MME buffers. All audio data provided by the user is therefore converted by PortAudio to and from 16-bit, regardless of the user buffer format. This basically makes it impossible to pass 24-bit audio through the MME Host API. If the user buffer format is not 16-bit, this also causes pointless conversions to take place, *even if the hardware is running at 16-bit*, because modern Windows versions (Vista+) convert the data to floating point behind the scenes before it is handed off to the hardware. This can lead to silly situations where 32-bit float samples from the user are (lossily) converted to 16-bit by PortAudio, then ended off to Windows via MME, only to be converted back to 32-bit float again, before finally being converted to the format the hardware device is configured to use. This can easily lead to two layers of 16-bit dithering (one from PortAudio, and one from Windows) being piled on top of each other, resulting in an elevated noise floor. This commit fixes this problem by configuring the MME buffers to use the same format as the user buffer. This should stop PortAudio from converting samples in all cases except paInt8, which is not supported by WAVEFORMATEX (only paUInt8 is). This is pretty much the same idea as PortAudio#774. The new code assumes that MME will accept whatever format we throw at it. I feel confident that this is always true on Vista+ regardless of hardware, because starting from Vista MME does not access hardware directly - it always goes through the Windows Audio Engine which supports all formats in both directions (I verified this using paloopback). On pre-Vista Windows, this should still work all the way back to Windows 98 SE, because MME goes through KMixer which supports all formats [1]. Nevertheless, it's difficult to be sure, so this code checks the Windows version it's running on and preserves the old behavior (i.e. always use Int16) on pre-Vista Windows. [1]: https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/background-of-non-pcm-support#waveout-api Fixes PortAudio#139 * Don't use absolute path when linking to macOS frameworks (PortAudio#829) fixes PortAudio#828 * Fixing old problems * Added some debug messages * added new build script * Added paOboe in the paHostApi array * Added paOboe in pa_unix_hostapis.c * Working patch * win: New PaWinUtil_GetOsVersion() function for getting Windows OS version. Refactored WASAPI, DS, MME and WDMKS host back-ends to use PaWinUtil_GetOsVersion() instead of direct OS API. * Ready for other users to compile/build * Updated oboe/Readme.md * Added sharing mode selection * Fixed minor issue with sharing mode selection * Removed references to KCTI * Fixed error callback, added performance mode autoselection * Minor change to CMakeLists, added low latency costant in pa_oboe.h * Deleted Build_PaOboe.sh * Ready to push (removed my paths to Oboe directory and Android NDK) * Update README.md * Update README.md * remove all alternative sample conversion code using lrintf in pa_converters.c (PortAudio#403) removes the code guarded by PA_USE_C99_LRINTF See PortAudio#390 * updated readme * fixed CMakeLists.txt * fixed FindOboe.cmake * Preparation to start patching - TODOS and directory src/hostapi/Oboe * Added src/hostapi/oboe/README.md * Added include/pa_oboe.h and src/hostapi/oboe/pa_oboe.cpp * Added PA_USE_OBOE section to CMakeLists.txt * Added PA_USE_OBOE section to CMakeLists.txt * Heavily reworked CMake dependencies, added FindOboe.cmake, updated pa_oboe.cpp, more work needed * Included build_all_PaOboe.sh, more work needed on CMake * Included build_all_PaOboe.sh, more work needed on CMake * Built shared library * Polished bits * Fixing old problems * Added some debug messages * added new build script * Added paOboe in the paHostApi array * Added paOboe in pa_unix_hostapis.c * Working patch * Ready for other users to compile/build * Updated oboe/Readme.md * Added sharing mode selection * Fixed minor issue with sharing mode selection * Removed references to KCTI * Fixed error callback, added performance mode autoselection * Minor change to CMakeLists, added low latency costant in pa_oboe.h * Deleted Build_PaOboe.sh * Ready to push (removed my paths to Oboe directory and Android NDK) * Update src/hostapi/oboe/README.md * Update README.md * Update README.md * updated readme * fixed CMakeLists.txt * fixed FindOboe.cmake * corrected oboe/Readme.md * Updated oboe/Readme.md * PulseAudio Portaudio HostAPI (PortAudio#336) Adds support for PulseAudio API on Linux. For more information about Pulseaudio visit: https://www.freedesktop.org/wiki/Software/PulseAudio/ --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com> * pulseaudio: Move Pulseaudio include in correct place when using autoconf (PortAudio#843) As Jack and Pulseaudio both needs Ringbuffer that include can be done in same place. In configure.in also Pulseaudio header file was included before it was sure that it was really needed. Commit makes sure that Pulseaudio include is available only if it's needed as it can cause failing in build if Pulseaudio develoment files are not available. * added .idea to gitignore * added .idea to gitignore * restored workflows directory * Minor fixes to FindOboe.cmake * Enhanced prebuilt libraries compatibility in FindOboe.cmake * Minor changes to Pa_Oboe/Readme and pa_oboe.cpp * Removed auto latency tuning in favor of simpler impleentation in pa_oboe.cpp * Set paFloat32 as default format in pa_oboe.cpp * Renamed most of the variables according to best coding practices. * Added separate callback class to fix the single-stream issue. * Modified OboeEngine accordingly * Adjusted the code in the rest of pa_oboe.cpp * Removed stop and close phases of OboeEngine::restartStream * Updated functions' description * minor description corrections * fixed all compiling errors generated by typos * Added OboeMediator class in place of OboeCallback, that mediates PortAudio C stream struct and the C++ OboeEngine class * Fixed allocation problem, working PaOboe implementation * Fix 'pulseaudioHostApi' use-after-free/null ptr deref in PaPulseAudio_Initialize (PortAudio#847) The call to PaPulseAudio_UnLock( pulseaudioHostApi->mainloop ) in error-label is performed on 'pulseaudioHostApi' after 'pulseaudioHostApi' has been freed by PaPulseAudio_Free and set to NULL. * wdmks: declare GUIDs with selectany attribute (PortAudio#846) * wdmks: declare GUIDs with selectany attribute Match the behavior of guiddef.h in both mingw and the Windows SDK headers. This prevents linking errors caused by multiply defined symbols when linking against certain Windows SDK libs (like dxguid.lib). * Make sure this works even if DECLSPEC_SELECTANY is not defined --------- Co-authored-by: Ross Bencina <rossb@audiomulch.com> * fixed README.md indenting * Removed .idea folder from repo * replaced 'g_' with 'paOboe_' in non-static global variables * replaced 'm_' prefix with 'm' prefix * fixed OboeEngine::tryStream as requested * PulseAudio Portaudio HostAPI (PortAudio#336) Adds support for PulseAudio API on Linux. For more information about Pulseaudio visit: https://www.freedesktop.org/wiki/Software/PulseAudio/ --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com> * pulseaudio: Move Pulseaudio include in correct place when using autoconf (PortAudio#843) As Jack and Pulseaudio both needs Ringbuffer that include can be done in same place. In configure.in also Pulseaudio header file was included before it was sure that it was really needed. Commit makes sure that Pulseaudio include is available only if it's needed as it can cause failing in build if Pulseaudio develoment files are not available. * restored workflows directory * Minor fixes to FindOboe.cmake * Enhanced prebuilt libraries compatibility in FindOboe.cmake * Minor changes to Pa_Oboe/Readme and pa_oboe.cpp * Removed auto latency tuning in favor of simpler impleentation in pa_oboe.cpp * Set paFloat32 as default format in pa_oboe.cpp * Renamed most of the variables according to best coding practices. * Added separate callback class to fix the single-stream issue. * Modified OboeEngine accordingly * Adjusted the code in the rest of pa_oboe.cpp * Removed stop and close phases of OboeEngine::restartStream * Updated functions' description * minor description corrections * fixed all compiling errors generated by typos * Added OboeMediator class in place of OboeCallback, that mediates PortAudio C stream struct and the C++ OboeEngine class * Fixed allocation problem, working PaOboe implementation * fixed README.md indenting * Removed .idea folder from repo * replaced 'g_' with 'paOboe_' in non-static global variables * replaced 'm_' prefix with 'm' prefix * fixed OboeEngine::tryStream as requested * Changed names to improve readability, i.e. OboeStream -> PaOboeStream * fixed all compiling errors generated by typos * Fixed minor problem with TryStream * fixed long line in FindOboe.cmake * fixed typos in pa_oboe.cpp * set to verbose some logs * Fixed minor problem with TryStream * fixed long line in FindOboe.cmake * fixed typos in pa_oboe.cpp * set to verbose some logs * Better handling of format in paOboe, removed junk code from CMakeLists * Improved readability of some variables * Removed '#include oboe/Oboe.h' from pa_oboe.h, and modified host api implementation accordingly * static cast fixes --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: Carlo Benfatti <benfatti@netresults.it> Co-authored-by: hopefulGiupplo <116260612+hopefulGiupplo@users.noreply.github.com> Co-authored-by: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> Co-authored-by: Etienne Dechamps <etienne@edechamps.fr> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: dmitrykos <dmitrykos@neutroncode.com> Co-authored-by: Ross Bencina <rossb@audiomulch.com> Co-authored-by: Tuukka Pasanen <pasanen.tuukka@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: Tuukka Pasanen <tuukka.pasanen@ilmi.fi> Co-authored-by: invertego <invertego@users.noreply.github.com>
* Preparation to start patching - TODOS and directory src/hostapi/Oboe * Added src/hostapi/oboe/README.md * Added include/pa_oboe.h and src/hostapi/oboe/pa_oboe.cpp * Added PA_USE_OBOE section to CMakeLists.txt * Added PA_USE_OBOE section to CMakeLists.txt * Heavily reworked CMake dependencies, added FindOboe.cmake, updated pa_oboe.cpp, more work needed * Included build_all_PaOboe.sh, more work needed on CMake * Included build_all_PaOboe.sh, more work needed on CMake * Update src/hostapi/oboe/README.md * bindings/cpp: CMake: support pkgconfig with RelWithDebInfo (PortAudio#822) bindings/cpp: add `RelWithDebInfo` to the configurations allowed to install portaudiocpp.pc, otherwise you won't have support for pkg-config when building a release package with separate debugging information. Besides that, RelWithDebInfo is identical to Release. * Fix MSVC warning C4018 signed/unsigned mismatch (PortAudio#821) See PortAudio#810 * Built shared library * Polished bits * mme: don't restrict the host buffer to 16-bit Currently, the MME Host API code only creates 16-bit integer MME buffers. All audio data provided by the user is therefore converted by PortAudio to and from 16-bit, regardless of the user buffer format. This basically makes it impossible to pass 24-bit audio through the MME Host API. If the user buffer format is not 16-bit, this also causes pointless conversions to take place, *even if the hardware is running at 16-bit*, because modern Windows versions (Vista+) convert the data to floating point behind the scenes before it is handed off to the hardware. This can lead to silly situations where 32-bit float samples from the user are (lossily) converted to 16-bit by PortAudio, then ended off to Windows via MME, only to be converted back to 32-bit float again, before finally being converted to the format the hardware device is configured to use. This can easily lead to two layers of 16-bit dithering (one from PortAudio, and one from Windows) being piled on top of each other, resulting in an elevated noise floor. This commit fixes this problem by configuring the MME buffers to use the same format as the user buffer. This should stop PortAudio from converting samples in all cases except paInt8, which is not supported by WAVEFORMATEX (only paUInt8 is). This is pretty much the same idea as The new code assumes that MME will accept whatever format we throw at it. I feel confident that this is always true on Vista+ regardless of hardware, because starting from Vista MME does not access hardware directly - it always goes through the Windows Audio Engine which supports all formats in both directions (I verified this using paloopback). On pre-Vista Windows, this should still work all the way back to Windows 98 SE, because MME goes through KMixer which supports all formats [1]. Nevertheless, it's difficult to be sure, so this code checks the Windows version it's running on and preserves the old behavior (i.e. always use Int16) on pre-Vista Windows. [1]: https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/background-of-non-pcm-support#waveout-api Fixes PortAudio#139 * Don't use absolute path when linking to macOS frameworks (PortAudio#829) fixes PortAudio#828 * Fixing old problems * Added some debug messages * added new build script * Added paOboe in the paHostApi array * Added paOboe in pa_unix_hostapis.c * Working patch * win: New PaWinUtil_GetOsVersion() function for getting Windows OS version. Refactored WASAPI, DS, MME and WDMKS host back-ends to use PaWinUtil_GetOsVersion() instead of direct OS API. * Ready for other users to compile/build * Updated oboe/Readme.md * Added sharing mode selection * Fixed minor issue with sharing mode selection * Removed references to KCTI * Fixed error callback, added performance mode autoselection * Minor change to CMakeLists, added low latency costant in pa_oboe.h * Deleted Build_PaOboe.sh * Ready to push (removed my paths to Oboe directory and Android NDK) * Update README.md * Update README.md * remove all alternative sample conversion code using lrintf in pa_converters.c (PortAudio#403) removes the code guarded by PA_USE_C99_LRINTF See PortAudio#390 * updated readme * fixed CMakeLists.txt * fixed FindOboe.cmake * Preparation to start patching - TODOS and directory src/hostapi/Oboe * Added src/hostapi/oboe/README.md * Added include/pa_oboe.h and src/hostapi/oboe/pa_oboe.cpp * Added PA_USE_OBOE section to CMakeLists.txt * Added PA_USE_OBOE section to CMakeLists.txt * Heavily reworked CMake dependencies, added FindOboe.cmake, updated pa_oboe.cpp, more work needed * Included build_all_PaOboe.sh, more work needed on CMake * Included build_all_PaOboe.sh, more work needed on CMake * Built shared library * Polished bits * Fixing old problems * Added some debug messages * added new build script * Added paOboe in the paHostApi array * Added paOboe in pa_unix_hostapis.c * Working patch * Ready for other users to compile/build * Updated oboe/Readme.md * Added sharing mode selection * Fixed minor issue with sharing mode selection * Removed references to KCTI * Fixed error callback, added performance mode autoselection * Minor change to CMakeLists, added low latency costant in pa_oboe.h * Deleted Build_PaOboe.sh * Ready to push (removed my paths to Oboe directory and Android NDK) * Update src/hostapi/oboe/README.md * Update README.md * Update README.md * updated readme * fixed CMakeLists.txt * fixed FindOboe.cmake * corrected oboe/Readme.md * Updated oboe/Readme.md * PulseAudio Portaudio HostAPI (PortAudio#336) Adds support for PulseAudio API on Linux. For more information about Pulseaudio visit: https://www.freedesktop.org/wiki/Software/PulseAudio/ --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com> * pulseaudio: Move Pulseaudio include in correct place when using autoconf (PortAudio#843) As Jack and Pulseaudio both needs Ringbuffer that include can be done in same place. In configure.in also Pulseaudio header file was included before it was sure that it was really needed. Commit makes sure that Pulseaudio include is available only if it's needed as it can cause failing in build if Pulseaudio develoment files are not available. * added .idea to gitignore * added .idea to gitignore * restored workflows directory * Minor fixes to FindOboe.cmake * Enhanced prebuilt libraries compatibility in FindOboe.cmake * Minor changes to Pa_Oboe/Readme and pa_oboe.cpp * Removed auto latency tuning in favor of simpler impleentation in pa_oboe.cpp * Set paFloat32 as default format in pa_oboe.cpp * Renamed most of the variables according to best coding practices. * Added separate callback class to fix the single-stream issue. * Modified OboeEngine accordingly * Adjusted the code in the rest of pa_oboe.cpp * Removed stop and close phases of OboeEngine::restartStream * Updated functions' description * minor description corrections * fixed all compiling errors generated by typos * Added OboeMediator class in place of OboeCallback, that mediates PortAudio C stream struct and the C++ OboeEngine class * Fixed allocation problem, working PaOboe implementation * Fix 'pulseaudioHostApi' use-after-free/null ptr deref in PaPulseAudio_Initialize (PortAudio#847) The call to PaPulseAudio_UnLock( pulseaudioHostApi->mainloop ) in error-label is performed on 'pulseaudioHostApi' after 'pulseaudioHostApi' has been freed by PaPulseAudio_Free and set to NULL. * wdmks: declare GUIDs with selectany attribute (PortAudio#846) * wdmks: declare GUIDs with selectany attribute Match the behavior of guiddef.h in both mingw and the Windows SDK headers. This prevents linking errors caused by multiply defined symbols when linking against certain Windows SDK libs (like dxguid.lib). * Make sure this works even if DECLSPEC_SELECTANY is not defined --------- Co-authored-by: Ross Bencina <rossb@audiomulch.com> * fixed README.md indenting * Removed .idea folder from repo * replaced 'g_' with 'paOboe_' in non-static global variables * replaced 'm_' prefix with 'm' prefix * fixed OboeEngine::tryStream as requested * PulseAudio Portaudio HostAPI (PortAudio#336) Adds support for PulseAudio API on Linux. For more information about Pulseaudio visit: https://www.freedesktop.org/wiki/Software/PulseAudio/ --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com> * pulseaudio: Move Pulseaudio include in correct place when using autoconf (PortAudio#843) As Jack and Pulseaudio both needs Ringbuffer that include can be done in same place. In configure.in also Pulseaudio header file was included before it was sure that it was really needed. Commit makes sure that Pulseaudio include is available only if it's needed as it can cause failing in build if Pulseaudio develoment files are not available. * restored workflows directory * Minor fixes to FindOboe.cmake * Enhanced prebuilt libraries compatibility in FindOboe.cmake * Minor changes to Pa_Oboe/Readme and pa_oboe.cpp * Removed auto latency tuning in favor of simpler impleentation in pa_oboe.cpp * Set paFloat32 as default format in pa_oboe.cpp * Renamed most of the variables according to best coding practices. * Added separate callback class to fix the single-stream issue. * Modified OboeEngine accordingly * Adjusted the code in the rest of pa_oboe.cpp * Removed stop and close phases of OboeEngine::restartStream * Updated functions' description * minor description corrections * fixed all compiling errors generated by typos * Added OboeMediator class in place of OboeCallback, that mediates PortAudio C stream struct and the C++ OboeEngine class * Fixed allocation problem, working PaOboe implementation * fixed README.md indenting * Removed .idea folder from repo * replaced 'g_' with 'paOboe_' in non-static global variables * replaced 'm_' prefix with 'm' prefix * fixed OboeEngine::tryStream as requested * Changed names to improve readability, i.e. OboeStream -> PaOboeStream * fixed all compiling errors generated by typos * Fixed minor problem with TryStream * fixed long line in FindOboe.cmake * fixed typos in pa_oboe.cpp * set to verbose some logs * Fixed minor problem with TryStream * fixed long line in FindOboe.cmake * fixed typos in pa_oboe.cpp * set to verbose some logs * Better handling of format in paOboe, removed junk code from CMakeLists * Improved readability of some variables * Removed '#include oboe/Oboe.h' from pa_oboe.h, and modified host api implementation accordingly * static cast fixes --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: Carlo Benfatti <benfatti@netresults.it> Co-authored-by: hopefulGiupplo <116260612+hopefulGiupplo@users.noreply.github.com> Co-authored-by: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> Co-authored-by: Etienne Dechamps <etienne@edechamps.fr> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: dmitrykos <dmitrykos@neutroncode.com> Co-authored-by: Ross Bencina <rossb@audiomulch.com> Co-authored-by: Tuukka Pasanen <pasanen.tuukka@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: Tuukka Pasanen <tuukka.pasanen@ilmi.fi> Co-authored-by: invertego <invertego@users.noreply.github.com>
* Preparation to start patching - TODOS and directory src/hostapi/Oboe * Added src/hostapi/oboe/README.md * Added include/pa_oboe.h and src/hostapi/oboe/pa_oboe.cpp * Added PA_USE_OBOE section to CMakeLists.txt * Added PA_USE_OBOE section to CMakeLists.txt * Heavily reworked CMake dependencies, added FindOboe.cmake, updated pa_oboe.cpp, more work needed * Included build_all_PaOboe.sh, more work needed on CMake * Included build_all_PaOboe.sh, more work needed on CMake * Update src/hostapi/oboe/README.md * bindings/cpp: CMake: support pkgconfig with RelWithDebInfo (PortAudio#822) bindings/cpp: add `RelWithDebInfo` to the configurations allowed to install portaudiocpp.pc, otherwise you won't have support for pkg-config when building a release package with separate debugging information. Besides that, RelWithDebInfo is identical to Release. * Fix MSVC warning C4018 signed/unsigned mismatch (PortAudio#821) See PortAudio#810 * Built shared library * Polished bits * mme: don't restrict the host buffer to 16-bit Currently, the MME Host API code only creates 16-bit integer MME buffers. All audio data provided by the user is therefore converted by PortAudio to and from 16-bit, regardless of the user buffer format. This basically makes it impossible to pass 24-bit audio through the MME Host API. If the user buffer format is not 16-bit, this also causes pointless conversions to take place, *even if the hardware is running at 16-bit*, because modern Windows versions (Vista+) convert the data to floating point behind the scenes before it is handed off to the hardware. This can lead to silly situations where 32-bit float samples from the user are (lossily) converted to 16-bit by PortAudio, then ended off to Windows via MME, only to be converted back to 32-bit float again, before finally being converted to the format the hardware device is configured to use. This can easily lead to two layers of 16-bit dithering (one from PortAudio, and one from Windows) being piled on top of each other, resulting in an elevated noise floor. This commit fixes this problem by configuring the MME buffers to use the same format as the user buffer. This should stop PortAudio from converting samples in all cases except paInt8, which is not supported by WAVEFORMATEX (only paUInt8 is). This is pretty much the same idea as The new code assumes that MME will accept whatever format we throw at it. I feel confident that this is always true on Vista+ regardless of hardware, because starting from Vista MME does not access hardware directly - it always goes through the Windows Audio Engine which supports all formats in both directions (I verified this using paloopback). On pre-Vista Windows, this should still work all the way back to Windows 98 SE, because MME goes through KMixer which supports all formats [1]. Nevertheless, it's difficult to be sure, so this code checks the Windows version it's running on and preserves the old behavior (i.e. always use Int16) on pre-Vista Windows. [1]: https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/background-of-non-pcm-support#waveout-api Fixes PortAudio#139 * Don't use absolute path when linking to macOS frameworks (PortAudio#829) fixes PortAudio#828 * Fixing old problems * Added some debug messages * added new build script * Added paOboe in the paHostApi array * Added paOboe in pa_unix_hostapis.c * Working patch * win: New PaWinUtil_GetOsVersion() function for getting Windows OS version. Refactored WASAPI, DS, MME and WDMKS host back-ends to use PaWinUtil_GetOsVersion() instead of direct OS API. * Ready for other users to compile/build * Updated oboe/Readme.md * Added sharing mode selection * Fixed minor issue with sharing mode selection * Removed references to KCTI * Fixed error callback, added performance mode autoselection * Minor change to CMakeLists, added low latency costant in pa_oboe.h * Deleted Build_PaOboe.sh * Ready to push (removed my paths to Oboe directory and Android NDK) * Update README.md * Update README.md * remove all alternative sample conversion code using lrintf in pa_converters.c (PortAudio#403) removes the code guarded by PA_USE_C99_LRINTF See PortAudio#390 * updated readme * fixed CMakeLists.txt * fixed FindOboe.cmake * Preparation to start patching - TODOS and directory src/hostapi/Oboe * Added src/hostapi/oboe/README.md * Added include/pa_oboe.h and src/hostapi/oboe/pa_oboe.cpp * Added PA_USE_OBOE section to CMakeLists.txt * Added PA_USE_OBOE section to CMakeLists.txt * Heavily reworked CMake dependencies, added FindOboe.cmake, updated pa_oboe.cpp, more work needed * Included build_all_PaOboe.sh, more work needed on CMake * Included build_all_PaOboe.sh, more work needed on CMake * Built shared library * Polished bits * Fixing old problems * Added some debug messages * added new build script * Added paOboe in the paHostApi array * Added paOboe in pa_unix_hostapis.c * Working patch * Ready for other users to compile/build * Updated oboe/Readme.md * Added sharing mode selection * Fixed minor issue with sharing mode selection * Removed references to KCTI * Fixed error callback, added performance mode autoselection * Minor change to CMakeLists, added low latency costant in pa_oboe.h * Deleted Build_PaOboe.sh * Ready to push (removed my paths to Oboe directory and Android NDK) * Update src/hostapi/oboe/README.md * Update README.md * Update README.md * updated readme * fixed CMakeLists.txt * fixed FindOboe.cmake * corrected oboe/Readme.md * Updated oboe/Readme.md * PulseAudio Portaudio HostAPI (PortAudio#336) Adds support for PulseAudio API on Linux. For more information about Pulseaudio visit: https://www.freedesktop.org/wiki/Software/PulseAudio/ --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com> * pulseaudio: Move Pulseaudio include in correct place when using autoconf (PortAudio#843) As Jack and Pulseaudio both needs Ringbuffer that include can be done in same place. In configure.in also Pulseaudio header file was included before it was sure that it was really needed. Commit makes sure that Pulseaudio include is available only if it's needed as it can cause failing in build if Pulseaudio develoment files are not available. * added .idea to gitignore * added .idea to gitignore * restored workflows directory * Minor fixes to FindOboe.cmake * Enhanced prebuilt libraries compatibility in FindOboe.cmake * Minor changes to Pa_Oboe/Readme and pa_oboe.cpp * Removed auto latency tuning in favor of simpler impleentation in pa_oboe.cpp * Set paFloat32 as default format in pa_oboe.cpp * Renamed most of the variables according to best coding practices. * Added separate callback class to fix the single-stream issue. * Modified OboeEngine accordingly * Adjusted the code in the rest of pa_oboe.cpp * Removed stop and close phases of OboeEngine::restartStream * Updated functions' description * minor description corrections * fixed all compiling errors generated by typos * Added OboeMediator class in place of OboeCallback, that mediates PortAudio C stream struct and the C++ OboeEngine class * Fixed allocation problem, working PaOboe implementation * Fix 'pulseaudioHostApi' use-after-free/null ptr deref in PaPulseAudio_Initialize (PortAudio#847) The call to PaPulseAudio_UnLock( pulseaudioHostApi->mainloop ) in error-label is performed on 'pulseaudioHostApi' after 'pulseaudioHostApi' has been freed by PaPulseAudio_Free and set to NULL. * wdmks: declare GUIDs with selectany attribute (PortAudio#846) * wdmks: declare GUIDs with selectany attribute Match the behavior of guiddef.h in both mingw and the Windows SDK headers. This prevents linking errors caused by multiply defined symbols when linking against certain Windows SDK libs (like dxguid.lib). * Make sure this works even if DECLSPEC_SELECTANY is not defined --------- Co-authored-by: Ross Bencina <rossb@audiomulch.com> * fixed README.md indenting * Removed .idea folder from repo * replaced 'g_' with 'paOboe_' in non-static global variables * replaced 'm_' prefix with 'm' prefix * fixed OboeEngine::tryStream as requested * PulseAudio Portaudio HostAPI (PortAudio#336) Adds support for PulseAudio API on Linux. For more information about Pulseaudio visit: https://www.freedesktop.org/wiki/Software/PulseAudio/ --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com> * pulseaudio: Move Pulseaudio include in correct place when using autoconf (PortAudio#843) As Jack and Pulseaudio both needs Ringbuffer that include can be done in same place. In configure.in also Pulseaudio header file was included before it was sure that it was really needed. Commit makes sure that Pulseaudio include is available only if it's needed as it can cause failing in build if Pulseaudio develoment files are not available. * restored workflows directory * Minor fixes to FindOboe.cmake * Enhanced prebuilt libraries compatibility in FindOboe.cmake * Minor changes to Pa_Oboe/Readme and pa_oboe.cpp * Removed auto latency tuning in favor of simpler impleentation in pa_oboe.cpp * Set paFloat32 as default format in pa_oboe.cpp * Renamed most of the variables according to best coding practices. * Added separate callback class to fix the single-stream issue. * Modified OboeEngine accordingly * Adjusted the code in the rest of pa_oboe.cpp * Removed stop and close phases of OboeEngine::restartStream * Updated functions' description * minor description corrections * fixed all compiling errors generated by typos * Added OboeMediator class in place of OboeCallback, that mediates PortAudio C stream struct and the C++ OboeEngine class * Fixed allocation problem, working PaOboe implementation * fixed README.md indenting * Removed .idea folder from repo * replaced 'g_' with 'paOboe_' in non-static global variables * replaced 'm_' prefix with 'm' prefix * fixed OboeEngine::tryStream as requested * Changed names to improve readability, i.e. OboeStream -> PaOboeStream * fixed all compiling errors generated by typos * Fixed minor problem with TryStream * fixed long line in FindOboe.cmake * fixed typos in pa_oboe.cpp * set to verbose some logs * Fixed minor problem with TryStream * fixed long line in FindOboe.cmake * fixed typos in pa_oboe.cpp * set to verbose some logs * Better handling of format in paOboe, removed junk code from CMakeLists * Improved readability of some variables * Removed '#include oboe/Oboe.h' from pa_oboe.h, and modified host api implementation accordingly * static cast fixes --------- Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: Carlo Benfatti <benfatti@netresults.it> Co-authored-by: hopefulGiupplo <116260612+hopefulGiupplo@users.noreply.github.com> Co-authored-by: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> Co-authored-by: Etienne Dechamps <etienne@edechamps.fr> Co-authored-by: Daniel Schürmann <daschuer@mixxx.org> Co-authored-by: dmitrykos <dmitrykos@neutroncode.com> Co-authored-by: Ross Bencina <rossb@audiomulch.com> Co-authored-by: Tuukka Pasanen <pasanen.tuukka@gmail.com> Co-authored-by: sqweek <sqweek@gmail.com> Co-authored-by: Mooneer Salem <mooneer@gmail.com> Co-authored-by: Be <be.0@gmx.com> Co-authored-by: Mario Kleiner <mario.kleiner.de@gmail.com> Co-authored-by: Tuukka Pasanen <tuukka.pasanen@ilmi.fi> Co-authored-by: invertego <invertego@users.noreply.github.com>
PulseAudio is a network-capable sound server program distributed via the freedesktop.org project. It runs mainly on Linux, various BSD distributions such as FreeBSD and OpenBSD, macOS, as well as Illumos distributions and the Solaris operating system. Microsoft Windows was previously supported via the MinGW toolchain (implementation of the GNU toolchain, which includes various tools such as GCC and binutils). The Windows port has not been updated since 2011, however.
PR provides clue for Portaudio with HostAPI.