Commit graph portaudio/src
Author SHA1 Message Date
Dmitry Kostjuchenko
6a90e596b6
Merge pull request #325 from PortAudio/winrt
wasapi: Refactored device list creation, if faulty audio device is re…
2020-10-10 00:43:32 +03:00
dmitrykos
522f982158 wasapi: Refactored device list creation, if faulty audio device is reported as active by WASAPI then it will not break device list creation, silenced warnings when compiling for UWP platform. 2020-10-10 00:42:20 +03:00
Dmitry Kostjuchenko
3913a95a9b
Merge pull request #324 from PortAudio/winrt
wasapi: Replace tabs with 4-spaces to comply with PortAudio code styl…
2020-10-09 00:59:40 +03:00
dmitrykos
aa6ff975af wasapi: Replace tabs with 4-spaces to comply with PortAudio code style guidelines (http://github.com/PortAudio/portaudio/wiki/ImplementationStyleGuidelines). 2020-10-09 00:57:23 +03:00
Ross Bencina
19f638da5a wdmks: ensure that pins that failed creation by PinNew() are set to NULL. Note that PaUtil_AllocateMemory currently calls GlobalAlloc without the GMEM_ZEROINIT flag, so there was no guarantee that filter->pins[pinId] was zero. 2020-10-08 12:03:47 +11:00
dmitrykos
dcc2f7fa48 wasapi: Fix paInvalidSampleRate (and any other) error code is replaced with paInvalidDevice if audio client failed to be created due to some reason. 2020-10-03 23:21:11 +03:00
dmitrykos
697fcddce5 wasapi: Improve stability of playback in Polling Shared mode with a low host latency requsted (22 ms):
- Implement workaround for system timer coarse granularity causing underruns by using timeBeginPeriod/timeEndPeriod APIs inside the Event and Poll thread handlers.
- Update next sleep time of the Poll rendering loop dynamically depending on time taken for processing/rendering of audio data into the available host buffer to avoid underruns and fit processing time into periodic polling time slots.
- Add support for time slots logging in Poll mode if PA_WASAPI_LOG_TIME_SLOTS is defined. Fixed audible glitches by preloading the whole host buffer before stream is started.
- Fix audible glitches on stream start by preloading the whole host buffer before stream is started.
2020-10-03 22:55:36 +03:00
Svein Seldal
9ebe293dc5 Implement fix for glitching WASAPI playback #303 2020-09-27 18:28:19 +02:00
Ross Bencina
f828ad5fdc Merge branch 'alsa_uninitialized_dir_fixes' into 'master'
Fix additional cases of uninitialized dir variable in pa_linux_alsa.c

+1: Phil Burk

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7613051
2020-08-06 00:25:37 +00:00
Ross Bencina
b107f0853a Merge branch 'ticket_263_alsa_uninitialized_var_2' into 'master'
Fix uninitialized dir variable in pa_linux_alsa.c (Version 2)

+1: Ross Bencina, Phil Burk

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7612921
2020-08-06 00:23:46 +00:00
dmitrykos
799a6834a5 wasapi: Fixed OSVERSIONINFO initialization (patch provided by Carlo Bramini). 2020-03-26 20:05:53 +02:00
Ross Bencina
f269bf93e6 follow up fix related to 933b05c331 (ticket #263 uninitialized dir variable): fix the three other places where dir parameter wasn't set prior to entry to a snd_pcm_*_get_* function. There is some ambiguity about (a) whether this is intentional (i.e. use the rounding dir returned by previous *_get_* call, the PA source code does not indicate), and (b) whether it is meaningful (i.e. whether *_get_* functions actually use the value upon input -- the ALSA docs are not clear. regarding (a): I don't think it's intentional, i think it was just oversight. In any case thr risk is low: the underlying values of period_size, periods_max, periods_min, are all integer and should not be rounded, get_rate_min/get_rate_max are used only for debug reporting (I've set them to 0,0 for a minimal change from the current code, but -1,1 makes more sense). 2019-05-14 07:36:24 +10:00
Ross Bencina
933b05c331 fix uninitialized dir variable in pa_linux_alsa.c GropeDevice() by removing it. pass NULL as parameter to ALSA functions instead. see ticket #263. 2019-05-14 07:00:47 +10:00
Phil Burk
ab665735ad asio: remove unnecessary ASIO SDK files
These files should be obtained directly from Steinberg.
2019-04-26 09:43:52 -07:00
Dmitry Kostjuchenko
eb6b5e2598 Merge branch 'winrt' into 'master'
WASAPI: Add paWinWasapiAutoConvert flag, which sets AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY for Shared mode streams.

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7481081
2019-04-05 07:42:43 +00:00
dmitrykos
c40b969e1b wasapi: some cleanup of Jörn Heusipp's patch 2019-04-05 10:38:44 +03:00
Jörn Heusipp
aa0748a5b5 wasapi: Add paWinWasapiAutoConvert flag, which sets AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY for Shared mode streams.
AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM is required in order to allow for sample rates other than the system mixer configured sample rate. Otherwise, WASAPI is limited to a single system configured sample rate in Shared mode, which is a severe limitation compared to other APIs supported by PortAudio.
AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY is recommended to be used additionally.
See <https://docs.microsoft.com/en-us/windows/desktop/coreaudio/audclnt-streamflags-xxx-constants> for documentation.

GetClosestFormat is modified to exit early when paWinWasapiAutoConvert is set in Shared mode because we trust the WASAPI conversions to succeed.

We restrict these changes to Windows 7 (and later) because documentation does not clearly state the minimum required Windows version. Windows Vista was not available for testing.

This patch has been in production in OpenMPT (<https://openmpt.org/>) since version 1.27.01.00 (2017-09-27). PortAudio WASAPI Shared mode is the default output device type in OpenMPT for Windows 7 (and later) and also for Wine setups.
2019-04-05 10:02:17 +03:00
Dmitry Kostjuchenko
d7229de83b Merge branch 'winrt' into 'master'
WASAPI: Fix failing with unsupported format error if PaWasapiStreamCategory is other than default

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7376301
2019-04-05 06:53:39 +00:00
dmitrykos
d99940b26e wasapi: set IAudioClient2+ properties before GetClosestFormat() in order to avoid failing with unsupported format error if PaWasapiStreamCategory is other than default, for example eAudioCategorySpeech 2019-03-09 12:43:14 +02:00
Dmitry Kostjuchenko
7bfa11f463 Merge branch 'winrt' into 'master'
WASAPI: Improved audio output stability in Exclusive mode for some UAC2 DACs

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7327181
2019-02-23 21:04:57 +00:00
dmitrykos
96f81c0ec1 wasapi: Improved audio output stability in Exclusive mode for some UAC2 DACs with custom USB Audio driver by calculating buffer periodicity being equal (or almost equal) to the requested user frames (Capturing is excluded from this implementation as it has not yet been tested but can be included if tests show the improvement), cleanup/refactor some code to make it better readable 2019-02-23 23:02:38 +02:00
Dmitry Kostjuchenko
b7870b08f7 Merge branch 'winrt' into 'master'
WASAPI: new API PaWasapi_SetStreamStateHandler(), header cleanup and minor fix

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7129721
2018-12-24 12:22:35 +00:00
dmitrykos
83ab55b62d wasapi: new API PaWasapi_SetStreamStateHandler() to be able to catch WASAPI error inside the rendering thread loop (and handle it gracefully, for example restart the stream), protect from dangling pointer during device list update, cleanup header 2018-12-24 14:20:29 +02:00
Dmitry Kostjuchenko
dfd780389b Merge branch 'winrt' into 'master'
WASAPI: relax latency check in Exclusive mode when switching from Event to Poll mode

+1: Etienne Dechamps

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7097201
2018-12-12 21:39:57 +00:00
dmitrykos
7572245aec wasapi: relax check for a latency range when deciding to switch from Event to Poll mode to have 1-21 ms range fine tuneable, add check for a min period when correcting period for UAC1 devices to avoid failure to initialize audio client due to invalid period error 2018-12-12 23:29:44 +02:00
Dmitry Kostjuchenko
b22a83a600 Merge branch 'winrt' into 'master'
WASAPI: fix rare case when Shared Mode format obtained by PKEY_AudioEngine_DeviceFormat not accepted by WASAPI

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7085071
2018-12-10 08:52:59 +00:00
dmitrykos
d74ea7b610 wasapi: get channels count and sample rate from a mix format (IAudioClient::GetMixFormat) for a PaDeviceInfo to circumvent rare cases when WASAPI does not accept format provided PKEY_AudioEngine_DeviceFormat due to a wrong channel count (bug and solution reported by Etienne Dechamps (edechamps), discussion: http://app.assembla.com/spaces/portaudio/git/merge_requests/7024281), new PaWasapi_GetDeviceMixFormat API to get mix format provided by IAudioClient::GetMixFormat 2018-12-10 10:50:31 +02:00
Dmitry Kostjuchenko
0cdb346fdc Merge branch 'winrt' into 'master'
WASAPI: fixed MonoToStereo converter could write beyond the allowed memory region if sample format is packed 24-bit integer, fixed DEF file by adding missing WASAPI API

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6928491
2018-10-21 10:24:52 +00:00
dmitrykos
57b98d5a8c wasapi: fixed MonoToStereo converter could write beyond the allowed memory region if sample format is packed 24-bit integer, fixed DEF file by adding missing WASAPI API 2018-10-21 13:21:28 +03:00
Nicholas Appleton
ea11061b20 commit Rainer's work and make some minor modifications to the top-level cmakelists to make visual studio happy 2018-10-02 21:54:44 +10:00
dmitrykos
eb4a7d25dc wasapi: fixed callback not called for Input stream if 1 channel format is requested 2018-09-23 20:44:21 +03:00
dmitrykos
5dec767af1 wasapi: fixed crash on NULL 2018-09-10 23:09:44 +03:00
dmitrykos
fe2c8e1f42 wasapi: fixed input device can not be opened in Exclusive mode (regression of previous commit) 2018-09-10 22:55:27 +03:00
dmitrykos
c3fee03ff1 wasapi: support Exclusive mode on UWP (use new function PaWasapi_SetDefaultInterfaceId to set device's interface id to make Exclusive mode work);
- support for explicit 8.24 format (24-bit inside 32-bit container) by specifying paCustomFormat (see IMPORTANT notes in the header file);
 - new flag paWinWasapiExplicitSampleFormat to force explicit format and avoid fallback to a closest working;
 - new function PaWasapi_GetDeviceCurrentFormat to get device format of the opened stream;
 - support PaWasapi_ThreadPriorityXXX API on UWP to boot thread priority;
 - improved selection of the closest format in Exclusive mode.
2018-09-06 20:45:22 +03:00
dmitrykos
d7a4cb482d wasapi: fixed compilation error of PaWasapi_GetAudioClient() 2018-07-19 21:42:21 +03:00
Dmitry Kostjuchenko
64ad96ea3c Merge branch 'winrt' into 'master'
New PaWasapi_GetAudioClient() API and workaround to get real Windows version and thus use correct AudioClient interface version.

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6574173
2018-07-01 10:04:04 +00:00
dmitrykos
a802290e83 wasapi: new PaWasapi_GetAudioClient() API to get pointer to IAudioClient from PaStream, workaround to get real Windows version in order to be able to create correct version of IAudioClient interface (Windows 10 was reported as Windows 8 when using just GetVersion()) 2018-06-30 12:21:59 +03:00
Phil Burk
8dc6d59877 Merge branch 'ticket_275_pass_void' into 'master'
Add void argument to Pa_GetVersionInfo()

+1: Anonymous

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6415893
2018-05-26 04:49:10 +00:00
DaShun
c5e8f1dca7 Add asio lib. 2018-04-17 11:36:55 +08:00
dmitrykos
d3e65ce690 wasapi: correction to PaWasapi_UpdateDeviceList() API by making it unavailable by default unless PA_WASAPI_MAX_CONST_DEVICE_COUNT is explicitly defined 2018-04-02 22:15:49 +03:00
dmitrykos
eb62287494 wasapi: new WASAPI specific API PaWasapi_UpdateDeviceList() which allows to update WASAPI device list dynamically without a need to call Pa_Terminate() and then Pa_Initialize().
This new implementation overcomes current limitation of Pa_GetDeviceCount() API which gives constant device count by making WASAPI device list constant (32 devices by default) where 32 device slots can either be filled with a real device info or be empty for a future device changes.

Constant device list size can be altered by PA_WASAPI_MAX_CONST_DEVICE_COUNT define during a compile time. If PA_WASAPI_MAX_CONST_DEVICE_COUNT is set to 0 then PaWasapi_UpdateDeviceList() will be unavailable as well as dynamic device list update functionality.

This implementation also detects the audio device format change if user alters it via Windows Audio Controller GUI.

This implementation also makes WASAPI backend ready for a future implementation of device list updates via PortAudio public API. See internal PaError UpdateDeviceList().
2018-04-02 21:50:16 +03:00
dmitrykos
a525c38289 wasapi: fixed failure to initialize when Capture device is not provided by OS, silenced warnings in log functions 2018-01-10 20:58:14 +02:00
Ross Bencina
1bdcb9e413 Merge branch 'winrt' into 'master'
WASAPI: corrections for Windows 10 UWP

+1: Ross Bencina, Anonymous, Roland Winklmeier

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/4995123
2017-11-13 06:42:49 +00:00
dmitrykos
bc40f42cba wasapi: corrected GetWindowsVersion() to return Windows 10 (was max Windows 8)
wasapi: use IAudioClient3 for Windows 10 for best compatibility
wasapi: fix compilation when Windows 10 SDK (10.0.15063.0) is used by removing SignalObjectAndWait() definition which creates duplicates with the system defined SignalObjectAndWait() (since 10.0.15063.0 it is supported by the OS again)
2017-05-29 22:44:36 +03:00
Phil Burk
dde71d1114 pa_front.c: fix initializationCount_ in Pa_Terminate()
Was decrementing too soon and causing Pa_CloseStream() to fail.
See ticket #260
2016-10-23 14:50:01 -07:00
Ross Bencina
18b2ab2339 Fix for ticket #257: MinGW-w64: Inclusion of <winioctl.h> triggers multiple redefinition errors. 2016-10-02 20:34:04 +11:00
Ross Bencina
6dbb8a6d64 Merge branch 'bump_version' into 'master'
pa_front: bump version to 19.6.0 for release

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3873413
2016-09-25 05:49:16 +00:00
Phil Burk
3f7248cd00 pa_front: bumped to 19.6.0 2016-09-24 09:02:56 -07:00
Phil Burk
b69214bcb4 Merge branch 'ticket_252_nohang' into 'master'
pa_mac_core_blocking: fix hang when running stream stopped (fixed merge)

Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3829453
2016-09-24 16:01:14 +00:00
Phil Burk
339e875f42 pa_mac_core: fix whitespace and missing semicolon
It compiled without the semicolon because it was followed by a VDBUG,
which was followed by a semicolon. The VDBUG was disabled so its
semicolon finished the line above.
2016-09-24 08:53:28 -07:00