audacia/lib-src/portaudio-v19/qa/paqa_devs.c

372 lines
14 KiB
C
Raw Normal View History

2010-01-24 09:19:39 +00:00
/** @file paqa_devs.c
2013-02-27 01:33:15 +00:00
@ingroup qa_src
2010-01-24 09:19:39 +00:00
@brief Self Testing Quality Assurance app for PortAudio
Try to open each device and run through all the
2013-02-27 01:33:15 +00:00
possible configurations. This test does not verify
that the configuration works well. It just verifies
that it does not crash. It requires a human to listen to
the outputs.
2010-01-24 09:19:39 +00:00
@author Phil Burk http://www.softsynth.com
Pieter adapted to V19 API. Test now relies heavily on
Pa_IsFormatSupported(). Uses same 'standard' sample rates
as in test pa_devs.c.
*/
/*
Update to upstream commit 3ebfacc commit c5d2c51bd6fe354d0ee1119ba932bfebd3ebfacc Merge: eb6b5e2 ab66573 Author: Phil Burk <burkphil@gmail.com> Date: Fri Apr 26 16:48:28 2019 +0000 Merge branch 'removeasio' into 'master' asio: remove unnecessary ASIO SDK files +1: Phil Burk Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7559751 commit ab665735ad887dbfb7fdc6b4cbbec90d2124f011 Author: Phil Burk <philburk@mobileer.com> Date: Fri Apr 26 09:43:52 2019 -0700 asio: remove unnecessary ASIO SDK files These files should be obtained directly from Steinberg. commit eb6b5e259850e067ed66698e084c248e0cd13f30 Merge: d7229de c40b969 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Fri Apr 5 07:42:43 2019 +0000 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 commit c40b969e1b5fc555d5876c466b39d463ae2a1c1d Author: dmitrykos <dmitrykos@neutroncode.com> Date: Fri Apr 5 10:38:44 2019 +0300 wasapi: some cleanup of Jörn Heusipp's patch commit aa0748a5b59491ba2cfa9943825653cde6e1f748 Author: Jörn Heusipp <osmanx@problemloesungsmaschine.de> Date: Mon Apr 1 09:05:18 2019 +0200 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. commit d7229de83beba7392c7195de653d517d8e57d35d Merge: 7bfa11f d99940b Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Fri Apr 5 06:53:39 2019 +0000 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 commit d99940b26eb6a48d1a069b3195a50d06badabb46 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Sat Mar 9 12:43:14 2019 +0200 wasapi: set IAudioClient2+ properties before GetClosestFormat() in order to avoid failing with unsupported format error if PaWasapiStreamCategory is other than default, for example eAudioCategorySpeech commit 7bfa11f463cfa943aced5ea2f3542f5307417afb Merge: b7870b0 96f81c0 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Sat Feb 23 21:04:57 2019 +0000 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 commit 96f81c0ec1f7bd50f29d7298d927bfeb503ac0f3 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Sat Feb 23 23:02:38 2019 +0200 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 commit b7870b08f770c1e84b754e662c08b6942ff7d021 Merge: 76e31c2 83ab55b Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Mon Dec 24 12:22:35 2018 +0000 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 commit 83ab55b62d707c11d18238b1928e0297d67e4767 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Mon Dec 24 14:20:29 2018 +0200 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 commit 76e31c2a24eebfa95a704f711dd707a2635af77e Merge: dfd7803 95e86c3 Author: Etienne Dechamps <etienne@edechamps.fr> Date: Sat Dec 15 15:06:22 2018 +0000 Merge branch 'winbuild' into 'master' Improvements to CMake build system on Windows Merged-on: https://assembla.com/code/portaudio/git/merge_requests/7040151 commit 95e86c307b9cd20180f3c1f52853c3424ce62ae5 Author: Etienne Dechamps <etienne@edechamps.fr> Date: Sun Nov 25 12:16:21 2018 +0000 Install pa_win_waveformat.h with MME, DirectSound and WASAPI. pa_win_wmme.h, pa_win_ds.h and pa_win_wasapi.h all include pa_win_waveformat.h. If the latter is not installed, none of these headers are usable. commit 0baa1e2e31f37bac2883ea59e50b76037271426d Author: Etienne Dechamps <etienne@edechamps.fr> Date: Sun Nov 25 10:28:56 2018 +0000 Treat DirectSound just like any other standard Windows SDK library. Currently the CMake build system goes through complicated logic to find the DirectX SDK. This is completely unnecessary, because modern versions of the Windows SDK include dsound.h and dsound.lib in the standard paths, so it can be treated just like the other Windows OS libraries and we can safely assume it is available. This commit simplifies the logic and will allow the vcpkg portaudio port to align with portaudio stream, by getting rid of this patch: https://github.com/Microsoft/vcpkg/blob/95f9ce56f32618cceda97d54af16e3d6c57fc4b3/ports/portaudio/find_dsound.patch I have verified that PortAudio CMake still builds with this commit with the following toolchains: - Windows Visual Studio 2017 native CMake support - mingw-w64 on Windows (msys2) - mingw-w64 cross-compiling from Debian Unstable commit dfd780389b235e7553df8d115f0875d63abe7ccd Merge: b22a83a 7572245 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Wed Dec 12 21:39:57 2018 +0000 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 commit 7572245aec09a7c3fc4cbd1c8e83b8c4667d1162 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Wed Dec 12 23:29:44 2018 +0200 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 commit b22a83a6006237071d7439e0f196e55d6f3e6651 Merge: 0cdb346 d74ea7b Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Mon Dec 10 08:52:59 2018 +0000 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 commit d74ea7b610a6ae54582eb59c5d1b4c56a8e5e31b Author: dmitrykos <dmitrykos@neutroncode.com> Date: Mon Dec 10 10:50:31 2018 +0200 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 commit 0cdb346fdca725cfc98da5cbe2d079096f91b624 Merge: 05994e0 57b98d5 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Sun Oct 21 10:24:52 2018 +0000 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 commit 57b98d5a8cebf8d5205a2654fd2d1a69d21c8955 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Sun Oct 21 13:21:28 2018 +0300 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 commit 05994e022de42ea91d6b895764e05a70b36ac223 Merge: 4f6fd67 3651636 Author: Nicholas Appleton <nick@appletonaudio.com> Date: Sun Oct 21 04:14:22 2018 +0000 Merge branch 'cmake_mingw_additions' into 'master' commit Rainer's work and make some minor modifications to the top-level cmakelists to make visual studio happy Merged-on: https://assembla.com/code/portaudio/git/merge_requests/4858113 commit 365163674b8de5d3f0cffc38b303a5958c0665ec Author: Nick Appleton <nick@appletonaudio.com> Date: Fri Oct 12 22:43:17 2018 +1100 update cmake documentation commit 294881a1b94ffe31dccd2111c28a3eaf7fd91d23 Author: Nicholas Appleton <nick@appletonaudio.com> Date: Thu Oct 4 20:09:08 2018 +1000 fix typo commit 495b303bbdabe49e1f6475db410e35588a1d4ea4 Merge: d3e0009 396c189 Author: Nick Appleton <nick@appletonaudio.com> Date: Tue Oct 2 21:55:27 2018 +1000 Merge branch 'cmake_mingw_additions' of https://git.assembla.com/portaudio into cmake_mingw_additions commit d3e00091c73d5784268909246259cd3fdf254d90 Author: Nick Appleton <nick@appletonaudio.com> Date: Tue Oct 2 21:53:41 2018 +1000 create and install cmake export targets to make it easier for people to include portaudio in larger projects: commit ea11061b20f637f8f707a4a225d37ff58ab54dc0 Author: Nicholas Appleton <nick@appletonaudio.com> Date: Sun Apr 30 22:04:34 2017 +1000 commit Rainer's work and make some minor modifications to the top-level cmakelists to make visual studio happy commit 396c189c01382f2fddc20c1e534100ce7282aca4 Author: Nick Appleton <nick@appletonaudio.com> Date: Tue Oct 2 21:53:41 2018 +1000 create and install cmake export targets to make it easier for people to include portaudio in larger projects: commit 4f6fd67c3f5321f07b7bead8ce9ab727ce6805e6 Merge: c0d2397 eb4a7d2 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Sun Sep 23 17:46:21 2018 +0000 Merge branch 'winrt' into 'master' WASAPI: Fixed callback not called for Input stream if 1 channel format is requested. Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6838604 commit eb4a7d25dc15504ae3b4464bea36c1d8f3f51a86 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Sun Sep 23 20:44:21 2018 +0300 wasapi: fixed callback not called for Input stream if 1 channel format is requested commit c0d239712d9afcd4b7ad58b6e1ba97a1d789d9eb Merge: b2f6d82 5dec767 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Mon Sep 10 20:11:25 2018 +0000 Merge branch 'winrt' into 'master' WASAPI: Fixed crash on NULL. Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6794444 commit 5dec767af1c35d1eb1422b51b477d7a0b18acdf3 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Mon Sep 10 23:09:44 2018 +0300 wasapi: fixed crash on NULL commit b2f6d82342f7f3b2f7a659b3a181c4bf092610aa Merge: 9a8922d fe2c8e1 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Mon Sep 10 19:57:42 2018 +0000 Merge branch 'winrt' into 'master' WASAPI: Fixed input device can not be opened in Exclusive mode (regression of previous commit). Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6794374 commit fe2c8e1f421df4f868d27b587eb90d1b74578fc5 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Mon Sep 10 22:55:27 2018 +0300 wasapi: fixed input device can not be opened in Exclusive mode (regression of previous commit) commit 9a8922da23342abb54a5c5fa09ac46d938e5d794 Merge: 8a8078a c3fee03 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Thu Sep 6 17:52:14 2018 +0000 Merge branch 'winrt' into 'master' WASAPI: Support for Exclusive mode on UWP, private API extension, fixes. Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6785374 commit c3fee03ff143feca50dcbc53b89670f251bbce24 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Thu Sep 6 20:45:22 2018 +0300 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. commit 8a8078a9ba873a00282e2dcc12c50e9f27f6cd88 Merge: 69d1b1e 6e3f6b7 Author: Phil Burk <burkphil@gmail.com> Date: Sun Aug 19 21:16:00 2018 +0000 Merge branch 'ticket_274_xcode' into 'master' configure: support SDK 10.13 in XCode fixed #274 +1: Ryan Ollos Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6183813 commit 69d1b1e3cc817ab3a594ac66fec3b8f5d2feab31 Merge: 64ad96e d7a4cb4 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Thu Jul 19 18:47:52 2018 +0000 Merge branch 'winrt' into 'master' WASAPI: Fixed compilation error of PaWasapi_GetAudioClient(). Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6638133 commit d7a4cb482dc7470c1863bd0ff973ca2c6aefb70c Author: dmitrykos <dmitrykos@neutroncode.com> Date: Thu Jul 19 21:42:21 2018 +0300 wasapi: fixed compilation error of PaWasapi_GetAudioClient() commit 64ad96ea3cf1853619d4827c049d87fe746bb584 Merge: 8dc6d59 a802290 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Sun Jul 1 10:04:03 2018 +0000 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 commit a802290e831cd8959801fcb1e634a5d28c0ea30d Author: dmitrykos <dmitrykos@neutroncode.com> Date: Sat Jun 30 12:21:59 2018 +0300 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()) commit 8dc6d59877f2d102065871c3ef3020f3b98fd6b1 Author: Phil Burk <burkphil@gmail.com> Date: Sat May 26 04:49:10 2018 +0000 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 commit c5e8f1dca7f2d1b9c3d5c92a3f6f174870c303d8 Author: DaShun <dashun.c@tc-gaming.com> Date: Tue Apr 17 11:36:55 2018 +0800 Add asio lib. commit 3215043f0dfcac9d1728a03086170d3dbe5984a3 Merge: 9923e1d d3e65ce Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Mon Apr 2 19:16:18 2018 +0000 Merge branch 'winrt' into 'master' 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() Merged-on: https://assembla.com/code/portaudio/git/merge_requests/6241053 commit d3e65ce690c2cd55fd9d5df5a509d549eff17c1c Author: dmitrykos <dmitrykos@neutroncode.com> Date: Mon Apr 2 22:15:49 2018 +0300 wasapi: correction to PaWasapi_UpdateDeviceList() API by making it unavailable by default unless PA_WASAPI_MAX_CONST_DEVICE_COUNT is explicitly defined commit 9923e1dc318c57bb5d01c7d3a751b126ad4300c5 Merge: 1bdcb9e eb62287 Author: Dmitry Kostjuchenko <dmitrykos@neutroncode.com> Date: Mon Apr 2 18:55:13 2018 +0000 Merge branch 'winrt' into 'master' WinRT: fixed failure to initialize WASAPI when Capture device is not provided by OS, and additional minor corrections. Merged-on: https://assembla.com/code/portaudio/git/merge_requests/5913713 commit eb622874941be95ba27842f4373c6801092b2adb Author: dmitrykos <dmitrykos@neutroncode.com> Date: Mon Apr 2 21:50:16 2018 +0300 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(). commit 6e3f6b702f382905e3905682e7adaedf7e58958f Author: Phil Burk <philburk@mobileer.com> Date: Sun Mar 18 15:30:01 2018 -0700 configure: support SDK 10.13 in XCode Updated configure.in then ran autoconf to regenerate the configure script. Fixes #274 commit a525c38289b8c98554952caae792c2d1794d589c Author: dmitrykos <dmitrykos@neutroncode.com> Date: Wed Jan 10 20:58:14 2018 +0200 wasapi: fixed failure to initialize when Capture device is not provided by OS, silenced warnings in log functions commit 1bdcb9e41357ec76d8cf73f9ef278202a3ea1e3b Merge: a1f61a9 bc40f42 Author: Ross Bencina <rossb@audiomulch.com> Date: Mon Nov 13 06:42:49 2017 +0000 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 commit bc40f42cba713db3349bb1120b5d3475dd45e37e Author: dmitrykos <dmitrykos@neutroncode.com> Date: Mon May 29 22:44:36 2017 +0300 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) commit 72e319ad044e879a2cfe84d5929e9d7fb9ce7664 Author: Nicholas Appleton <nick@appletonaudio.com> Date: Sun Apr 30 22:04:34 2017 +1000 commit Rainer's work and make some minor modifications to the top-level cmakelists to make visual studio happy commit a1f61a9a2cb74d11cfe743d72763850aa246a092 Author: Nicholas Appleton <nick@appletonaudio.com> Date: Sun Jan 15 21:30:35 2017 +1100 fix a tragic typo I made which prevented WASAPI being included with the CMake support. commit 396fe4b6699ae929d3a685b3ef8a7e97396139a4 Merge: 49d0634 dde71d1 Author: Phil Burk <burkphil@gmail.com> Date: Mon Oct 24 16:10:12 2016 +0000 Merge branch 'ticket_260_terminate' into 'master' pa_front.c: fix initializationCount_ in Pa_Terminate() +1: Ross Bencina Merged-on: https://assembla.com/code/portaudio/git/merge_requests/4012103 commit dde71d1114813f2e9a34e7b80a05e04a33c948b3 Author: Phil Burk <philburk@mobileer.com> Date: Sun Oct 23 14:50:01 2016 -0700 pa_front.c: fix initializationCount_ in Pa_Terminate() Was decrementing too soon and causing Pa_CloseStream() to fail. See ticket #260 commit 49d063418936d5edb70797b24f5ab7f00b3e5660 Merge: 037f18a e0947b7 Author: Ross Bencina <rossb@audiomulch.com> Date: Mon Oct 10 00:56:01 2016 +0000 Merge branch 'cmake_mingw_fixes' into 'master' CMakedLists.txt: Replicate the library dependencies in the configure script +1: Ross Bencina Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3915533 commit 037f18a2e4a2551847194c37a7d09f693a4d3652 Merge: 82773fe 18b2ab2 Author: Ross Bencina <rossb@audiomulch.com> Date: Tue Oct 4 12:59:26 2016 +0000 Merge branch '257-wdmks-winioctl-include' into 'master' Fix for ticket #257: MinGW-w64: Inclusion of <winioctl.h> triggers multiple redefinition errors. +1: Phil Burk Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3915493 commit e0947b7d6a910315db989945177c99ed8f4c6ab7 Author: Nicholas Appleton <nick@appletonaudio.com> Date: Sun Oct 2 21:50:42 2016 +1100 replicate the library dependencies in the configure script commit 18b2ab2339b37616f969961fea3503f406c31f93 Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Oct 2 20:34:04 2016 +1100 Fix for ticket #257: MinGW-w64: Inclusion of <winioctl.h> triggers multiple redefinition errors. commit 82773feed7dc832d97c854a04cd1edf22b8eb9f5 Merge: 03eabbf f275c76 Author: Phil Burk <burkphil@gmail.com> Date: Tue Sep 27 15:49:46 2016 +0000 Merge branch 'ticket_256_numchannels' into 'master' paex_read_write_wire: fix crossed initialization +1: Ross Bencina Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3888083 commit f275c76ca96b17313af446902e4a5c98f4b38559 Author: Phil Burk <philburk@mobileer.com> Date: Mon Sep 26 15:42:38 2016 -0700 paex_read_write_wire: fix crossed initialization MinGW complained. Fixes ticket #256 commit 03eabbf9cd12cba407194712d48dbe7458b80b1e Merge: fcc15ae 2c0aed9 Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Sep 25 08:07:52 2016 +0000 Merge branch 'rb-doxygen-tweaks' into 'master' Doxygen documentation: Fix Front Page formatting, fix broken links, link to MinGW build instructions on Wiki Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3876603 commit fcc15ae0538572ed30d0e6237bf8b8a53cc51bdc Merge: 6dbb8a6 12f9673 Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Sep 25 08:07:41 2016 +0000 Merge branch 'rb-document-api-version' into 'master' Document API Version Availability (e.g. `Available as of 19.5.0`). Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3881793 commit 12f967356ba0c6f03c471daba533cc44c7210d32 Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Sep 25 17:55:12 2016 +1000 Added `Available as of version 19.6.0` doc comments for new wasapi host-api-specific APIs. commit e50b31bd406f51438513921b7daf0c950999f778 Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Sep 25 17:49:15 2016 +1000 Update doxygen comments for WDM/KS to indicate that new APIs are available in 19.5.0 commit d940dcb8b86c9bd88d7026ab3637e95bbf5310cb Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Sep 25 17:34:16 2016 +1000 Fix formatting of version API doxygen comments in portaudio.h. Add additional documentation details, see also, and version information (e.g. `Available as of 19.5.0`). commit 6dbb8a6d644453b426b6f8bb4d984b63bf894bfb Merge: 3765e90 3f7248c Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Sep 25 05:49:16 2016 +0000 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 commit 3765e908c24b8163e86c450924655237b010030c Merge: b69214b 0c10cb6 Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Sep 25 05:48:45 2016 +0000 Merge branch 'cmake_updates' into 'master' Update PortAudio CMake Support +1: Ross Bencina Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3751483 commit 3f7248cd00f1f37d6c738751b249720f102f1d97 Author: Phil Burk <philburk@mobileer.com> Date: Sat Sep 24 09:02:56 2016 -0700 pa_front: bumped to 19.6.0 commit b69214bcb421798a9e8ff585060b7421063f1211 Merge: 5044381 339e875 Author: Phil Burk <burkphil@gmail.com> Date: Sat Sep 24 16:01:14 2016 +0000 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 commit 339e875f42727b759bf167fa0820e099bbd2fb93 Author: Phil Burk <philburk@mobileer.com> Date: Sat Sep 24 08:53:28 2016 -0700 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. commit 50443810682ff72f3a8f4d1cf1ead0a68b028af1 Merge: 8b7f390 c2326aa Author: Ross Bencina <rossb@audiomulch.com> Date: Sat Sep 24 06:25:06 2016 +0000 Merge branch 'rb-version-doc-comment-cleanup' into 'master' Updated doc comments in portaudio.h to reflect that versionControlRevision is now a git revision hash +1: Phil Burk, Ross Bencina Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3877593 commit c2326aa8f0ddb71307c414f15a674750720f743e Author: Ross Bencina <rossb@audiomulch.com> Date: Fri Sep 23 21:10:21 2016 +1000 updated doc comments to reflect that versionControlRevision is now a git revision hash commit 2c0aed9d8f98eb5206c49c8337c28752217feaab Author: Ross Bencina <rossb@audiomulch.com> Date: Fri Sep 23 18:49:00 2016 +1000 Doxygen document tweaks: * Link to our Wiki for latest MinGW build information. * Fix for latest doxygen: non-displaying links on main page (add space before <br>). * Remove broken link to java binding docs (not compiled). * Update link to mailing list. commit b2f937523723982519607d558b95d40860526efa Author: Phil Burk <philburk@mobileer.com> Date: Thu Sep 22 09:29:36 2016 -0700 pa_front: bump version to 19.5.1 for release commit cacc5dc4ba848ce1aabed425ef9f465cd9e0babb Author: Phil Burk <philburk@mobileer.com> Date: Thu Sep 22 09:05:38 2016 -0700 pa_mac_core: use MAX(inputFrames,outputFrames) Double-check whether the stream does ouput before draining the buffer. commit 8b7f390907f09787f58e94445066f21c77ffcde6 Merge: 52bd2af 1cf10aa Author: Ross Bencina <rossb@audiomulch.com> Date: Thu Sep 22 12:12:47 2016 +0000 Merge branch 'remove-microsoft-include-files' into 'master' Remove Microsoft copyright include files from src/hostapi/wasapi/mingw-include +1: Phil Burk, Ross Bencina Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3848293 commit a38df79293e937e1cdb8b99b20c615894aa73859 Author: Phil Burk <philburk@mobileer.com> Date: Wed Sep 21 15:46:30 2016 -0700 pa_mac_core_blocking: Fix timeout. Change alignment of comment. commit 1cf10aa43f78679889948f05b00a9a2ca878abd8 Author: Ross Bencina <rossb@audiomulch.com> Date: Sat Sep 17 18:21:52 2016 +1000 remove Microsoft copyright include files from src/hostapi/wasapi/mingw-include commit 52bd2afb1ddca18ba76bb35c4088c1208edf3f6f Merge: 05da7a8 f17d549 Author: Phil Burk <burkphil@gmail.com> Date: Fri Sep 16 15:50:33 2016 +0000 Merge branch 'ticket_251_alsacancel' into 'master' pa_linux_alsa: fix hang in callback caused by abort +1: Phil Burk Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3834073 commit 0c10cb6c0cd2b34ff35d8e5fb011ca7481c20a2a Author: Nick Appleton <nick@appletonaudio.com> Date: Thu Sep 15 22:52:44 2016 +1000 address all problems picked up by cmakelint except for line-length related comments. don't use min() in paex_record_file as it is a macro specific to windows. commit 1389dee5f6414eaea5c02fc6865e8fab6beba08e Author: Nicholas Appleton <nick@appletonaudio.com> Date: Thu Sep 15 22:18:12 2016 +1000 get examples compiling with CMake on Windows again commit f17d549093a9653285f81ff5a14f4a41d395fbce Author: Phil Burk <philburk@mobileer.com> Date: Wed Sep 14 08:50:33 2016 -0700 pa_linux_alsa: fix hang in callback caused by abort The author of this patch is Alan Horstmann. Fixes ticket #251 commit 0bc7cf94651c9174462505a2a6fbd783f728bcf0 Author: Phil Burk <philburk@mobileer.com> Date: Sat Aug 27 13:53:10 2016 -0700 pa_mac_core_blocking: fix hang when running stream stopped One thread was filling the buffer while another thread was waiting for it to be empty. Add thread safety warnings. Fix ticket #252 commit 2251a120263fd37d96986e7fa2c5d3b665343878 Author: Nicholas Appleton <nick@appletonaudio.com> Date: Tue Sep 13 22:16:55 2016 +1000 undo whitespace change to pa_win_wasapi.c and fix a CMake grumbling about an unmatched ENDIF() closing expression commit 0fc163720c8c70325a83ae4477f7df6ab26f4fff Author: Nicholas Appleton <nick@appletonaudio.com> Date: Tue Sep 13 22:04:31 2016 +1000 supply pkg-config version via setting in CMakeLists.txt - allow installation when using MinGW commit dc568d54a8cbbe0d0b90ff6d34b79a5cc14652a8 Author: Nicholas Appleton <nick@appletonaudio.com> Date: Tue Sep 13 21:55:31 2016 +1000 only build x86 plain converters in Visual Studio due because of assembly syntax. add library dependencies for asio to get MinGW builds linking. disable WASAPI when using MinGW as I cannot get it to work. commit 05da7a854db5e28794311a7ea4f394cbce2cd0e4 Merge: 9e2cf27 e1d4ec6 Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Sep 11 17:38:12 2016 +0000 Merge branch 'winrt' into 'master' Correction to WASAPI host API implementation for WinRT platform Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3772573 commit 9e2cf27ca73a8ded92baeb0005c7311b6db7224e Merge: d0d5020 fc5de75 Author: Phil Burk <burkphil@gmail.com> Date: Sat Sep 10 17:16:19 2016 +0000 Merge branch 'ticket_248_gitrevision' into 'master' PA_GIT_REVISION: new scripts to replace SVN revision +1: Ross Bencina Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3790093 commit fc5de750f84cc43f23016f08751554c4273589a0 Author: Phil Burk <philburk@mobileer.com> Date: Fri Sep 9 09:06:27 2016 -0700 Remove version printing from paex_sine.c commit a553478d71f24bff6e0a72db66fc68e9a5b5847a Author: Phil Burk <philburk@mobileer.com> Date: Mon Sep 5 17:03:27 2016 -0700 PA_GIT_REVISION: new scripts to replace SVN revision update_gitrevision.sh should be run before building on Mac or Linux. commit e1d4ec666443ab16c25f06268ec4f86584463ca6 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Thu Sep 1 09:00:38 2016 +0300 wasapi: made ActivateAudioInterface_WINRT more universal in terms of getting other audio interfaces, for example IAudioEndpointVolume commit d0d5020ddfc1155e2782b203079dde1a9301c077 Merge: 0648f7e 037e260 Author: Ross Bencina <rossb@audiomulch.com> Date: Thu Sep 1 00:36:17 2016 +0000 Merge branch 'rb-fix-pa-front-c99isms' into 'master' Don't use C99 designated initializer syntax it's not C89 compatible +1: Phil Burk Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3747023 commit 72dd5db968c95200beab2c44cbaa1e9e44ea7782 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Mon Aug 29 09:54:49 2016 +0300 wasapi: return E_NOINTERFACE in PaActivateAudioInterfaceCompletionHandler::QueryInterface, use C-style API for calling interface functions (in order to be unified with the rest of WASAPI code) commit 0648f7e63b2c7039a5830c8ef8a142b2695e93d4 Merge: 7edc5cb 319b192 Author: Ross Bencina <rossb@audiomulch.com> Date: Sun Aug 28 00:14:32 2016 +0000 Merge branch 'winrt' into 'master' WASAPI: ported to WinRT (UWP) platform, compatibility fixes to compile PortAudio as Windows Store library +1: Phil Burk, Ross Bencina Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3643753 commit cdbc78e54f1103cf9abceaed676cee763c9e83da Author: Nicholas Appleton <nick@appletonaudio.com> Date: Sat Aug 27 10:43:42 2016 +1000 change the compiler flags into a compiler definitions list as we never modify the flags - add some documentation commit 983a853635cdd550ebc83386df47ab6f6afbd695 Author: Nicholas Appleton <nick@appletonaudio.com> Date: Sat Aug 27 09:52:57 2016 +1000 move changes to cmake lists made in my personal github space into the assembla branch. I will work in here from this point. commit 319b19203aca10c0f241faf2ff89ec300c3aba4c Author: dmitrykos <dmitrykos@neutroncode.com> Date: Fri Aug 26 22:31:45 2016 +0300 wasapi: replaced InterlockedCompareExchange with InterlockedOr and added clarifying comment why Interlocked API is used commit 037e260d64ed982638333beb572303ed9be588fa Author: Ross Bencina <rossb@audiomulch.com> Date: Fri Aug 26 19:42:09 2016 +1000 comment out C99 designated initializer syntax for versionInfo_ initializer. not C89 compatible commit fce3367c2393fcc241fca45b7f0a73fc0c549ad1 Author: Ross Bencina <rossb@audiomulch.com> Date: Fri Aug 26 19:33:31 2016 +1000 remove trailing whitespace from end of lines commit dae0d7f8e7e91940d4327b7a0c5e4a6abad328ed Author: dmitrykos <dmitrykos@neutroncode.com> Date: Fri Aug 26 09:43:50 2016 +0300 wasapi: reverted the usage of Interlocked APIs for PaWasapiStream::running commit 46bce3c39fac3c747e41adb89607b4487b047f18 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Wed Aug 24 22:04:17 2016 +0300 wasapi: use InterlockedXXX APIs to secure inter-thread r/w access to variables to avoid possible deadlocks or logic corruption commit ef449bb5bff4fb8d8219984d515628469b65dc3e Author: dmitrykos <dmitrykos@neutroncode.com> Date: Sun Aug 14 19:01:20 2016 +0300 wasapi: more cleanup - normalized WIN32_WINRT to PA_WINRT, removed excessive declarations from SignalObjectAndWait, ActivateAudioInterfaceCompletionHandler set of functions commit 326549c55ee09bcb3cd95540d870540aefc43c3d Author: dmitrykos <dmitrykos@neutroncode.com> Date: Sun Aug 14 10:52:36 2016 +0300 wasapi: use Windows common Sleep() API instead of PA_Sleep() use GetTickCount64() API which is awailable for Windows Store app instead of _ftime_s() remove WAVEFORMAT and WAVEFORMATEX declaration and use the corresponding Windows include file instead commit 26c0dc4458d7e3acd24c948f5e8355cf3d0ecba3 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Mon Aug 8 21:09:15 2016 +0300 wasapi: code cleanup, removed compiler warnings commit 2e7545f17fc7f0ed4a85d0ae21361f091e607cc0 Author: dmitrykos <dmitrykos@neutroncode.com> Date: Wed Aug 3 22:39:41 2016 +0300 wasapi: ported to WinRT (UWP) os: compatibility fixes for compilation of PortAudio as Windows Store library (only WASAPI hostapi is compatible with Windows Store APIs) commit 7edc5cb655810c6eb5e57c2b2bdbd24a760abf2c Merge: e111b3a cf4ef2c Author: Phil Burk <burkphil@gmail.com> Date: Wed Aug 3 00:53:41 2016 +0000 Merge branch 'loopback' into 'master' Loopback: fix warnings that prevent compilation Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3604853 commit cf4ef2ce1907e71179facb4107769df70cf8559e Author: Phil Burk <philburk@mobileer.com> Date: Tue Jul 26 19:10:23 2016 -0700 Loopback: fix warnings that prevent compilation Add newline in biquad_filter.c Add integer assert with tolerance. commit e111b3a269ae69c8c083ca4a2a3e3d66828d9ddc Merge: 21d185f e89441f Author: Phil Burk <burkphil@gmail.com> Date: Sun May 29 19:22:24 2016 +0000 Merge branch 'ticket_229' into 'master' Fix assert when reading or writing with non-power of 2 channels. fixed #229 Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3299213 commit e89441f968ca36bdf487454122fef9bbb2c72a36 Author: Phil Burk <philburk@mobileer.com> Date: Sat May 21 17:31:53 2016 -0700 Restore paqa_devs commit 36a6c92caac08319443254d13a10b89616777039 Author: Phil Burk <philburk@mobileer.com> Date: Sat May 21 17:30:21 2016 -0700 Revert paqa_devs commit 315309f60e8f77531a4e2d14d52b3fc46ee8196f Author: Phil Burk <philburk@mobileer.com> Date: Sat May 21 17:25:18 2016 -0700 Mac: test adjustable number of channels. commit 110043f84225aa12750d299152addd295184619c Author: Phil Burk <philburk@mobileer.com> Date: Wed May 18 21:41:01 2016 -0700 Fix assert when reading or writing with non-power of 2 channels. commit 21d185f815949b0258b49f743478a82f68f3e2d5 Merge: 89d1761 ed463ba Author: Phil Burk <burkphil@gmail.com> Date: Thu May 19 05:20:42 2016 +0000 Merge branch 'fixeol' into 'master' Add .gitattributes to fix EOL Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3299183 commit ed463ba658e593602a0aed549336bb0ecadc59d7 Author: Phil Burk <philburk@mobileer.com> Date: Wed May 18 22:13:20 2016 -0700 Normalize all the line endings commit b99790cb7ca69b1fce5b1abf33f69e712e2de9f8 Author: Phil Burk <philburk@mobileer.com> Date: Wed May 18 22:05:13 2016 -0700 Add .gitattributes to fix EOL commit 89d176178b1e23e32d34b504fd60e1276e3a57fc Merge: 06ff140 e18ea33 Author: Phil Burk <burkphil@gmail.com> Date: Wed May 18 03:42:26 2016 +0000 Merge branch 'noassert' into 'master' pa_mac_core: stop stream instead of asserting Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3218623 commit e18ea33d22837ee13bff5280a26df41a327e1535 Author: Phil Burk <philburk@mobileer.com> Date: Mon May 16 22:30:28 2016 -0700 pa_mac_core.c: Removed some comments. Cleaned up logic. commit 06ff140a61c5841b78f022c72472827e54fc9f18 Merge: 6c11a00 cc1908f Author: Phil Burk <burkphil@gmail.com> Date: Tue May 3 01:26:54 2016 +0000 Merge branch 'testgit2' into 'master' test git changesets Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3221493 commit cc1908fafb6fe43d73bfd533d77caa6690ceb3d8 Author: Phil Burk <philburk@mobileer.com> Date: Mon May 2 09:13:22 2016 -0700 Another change and commit to the same branch commit 274a2899111f096464b954a162c5f212bb44254e Author: Phil Burk <philburk@mobileer.com> Date: Mon May 2 09:12:05 2016 -0700 test git changesets commit 09588cc5d6f62571d540048fee5e8a4346441fe4 Author: Phil Burk <philburk@mobileer.com> Date: Sun May 1 18:08:38 2016 -0700 pa_mac_core: stop stream instead of asserting Bug: 158 commit 6c11a007c590b8dbab5f2846f4aca88939ee32ad Merge: a68bacd 83891bf Author: Phil Burk <burkphil@gmail.com> Date: Sun May 1 22:42:50 2016 +0000 Merge branch 'ignorebin' into 'master' gitignore: add more files from configure and make Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3218493 commit 83891bff3f341a356bc440d6456765fdbcf36f5d Author: Phil Burk <philburk@mobileer.com> Date: Sun May 1 15:39:03 2016 -0700 gitignore: add more files from configure and make commit a68bacd2cf98569ee2b6d58ae945818ddd8b7090 Merge: 13b2159 faff433 Author: Phil Burk <burkphil@gmail.com> Date: Sun May 1 19:59:13 2016 +0000 Merge branch 'ignore' into 'master' Add .gitignore for C++ Merged-on: https://assembla.com/code/portaudio/git/merge_requests/3218363 commit faff433ba62673567a23a2cb8d19b791a9eeead1 Author: Phil Burk <philburk@mobileer.com> Date: Sun May 1 12:54:03 2016 -0700 Add .gitignore for C++ commit 13b21598210ced77d5b147ed6db6804bcfba7947 Author: philburk <philburk@0f58301d-fd10-0410-b4af-bbb618454e57> Date: Sun Apr 10 18:12:03 2016 +0000 patest_out_underflow: cleanup Replace some tabs. Print overflow under stress. Prevent accidental overrange of phases array.
2019-12-15 08:30:56 +00:00
* $Id$
2010-01-24 09:19:39 +00:00
*
* This program uses the PortAudio Portable Audio Library.
* For more information see: http://www.portaudio.com
* Copyright (c) 1999-2000 Ross Bencina and Phil Burk
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* Any person wishing to distribute modifications to the Software is
* requested to send the modifications to the original developer so that
* they can be incorporated into the canonical version. It is also
* requested that these non-binding requests be included along with the
* license above.
*/
#include <stdio.h>
#include <math.h>
#include "portaudio.h"
#include "pa_trace.h"
/****************************************** Definitions ***********/
#define MODE_INPUT (0)
#define MODE_OUTPUT (1)
Update portaudio to r1910 which brings in these changes: ------------------------------------------------------------------------ r1910 | gineera | 2013-09-07 05:14:52 -0500 (Sat, 07 Sep 2013) | 1 line paqa_devs: limit max number of channels tested (to 4); add a fixed decimal format to the timestamp printout. ------------------------------------------------------------------------ r1909 | rbencina | 2013-08-28 19:36:56 -0500 (Wed, 28 Aug 2013) | 1 line pa_mac_core.c line 664 fixed incorrect memset size (was using sizeof(ptr) not sizeof(struct type) ------------------------------------------------------------------------ r1908 | gineera | 2013-08-27 12:14:51 -0500 (Tue, 27 Aug 2013) | 1 line Alsa: Add function to prevent duplicate parts in the visible pa device name string, that occur when the pcm-device name starts with the card name (since they are both used). Achieved by trimming the pcm-device string beginning. ------------------------------------------------------------------------ r1907 | gineera | 2013-08-22 17:01:17 -0500 (Thu, 22 Aug 2013) | 1 line Alsa: Fix memory leak as nonMmapBuffers were not freed (since change to realloc). Clean out corresponding dead code chunk. ------------------------------------------------------------------------ r1906 | gineera | 2013-08-22 14:43:07 -0500 (Thu, 22 Aug 2013) | 1 line Alsa: Rename some variables in pa_linux_alsa where the meaning is mis-leading or wrong in the Alsa context. Also tweak one debug message and a few typos. ------------------------------------------------------------------------ r1897 | gineera | 2013-08-13 15:37:04 -0500 (Tue, 13 Aug 2013) | 1 line Alsa: Fix handling of poll descriptors in PaAlsaStream_WaitForFrames(). Otherwise if capture signals before playback a duplex stream could poll the wrong descriptor, causing a loop (reported by Alexander Kartashov). ------------------------------------------------------------------------ r1896 | rbencina | 2013-08-06 03:26:55 -0500 (Tue, 06 Aug 2013) | 1 line fixed bug that was causing memory corruption in PA/ALSA when host sample format was lager than user format. e.g. using 16 bit output with a sound card that used 24 bit buffers. the incorrect input zeroer was being used. Thanks to Anders Tornvig for identifying the problem ------------------------------------------------------------------------ r1895 | rbencina | 2013-07-24 10:37:15 -0500 (Wed, 24 Jul 2013) | 1 line fixed doxygen markup for a few line breaks in the tutorial ------------------------------------------------------------------------ r1894 | gineera | 2013-06-08 14:30:41 -0500 (Sat, 08 Jun 2013) | 1 line OSS: revise default latency reporting: previous fixed values could not actually be achieved with OSS power-of-2 sizes. Instead try a configuration and correctly report the default latency based on one less than the number of fragments; also fix the stream component 'bufSz' calculation. ------------------------------------------------------------------------ r1893 | gineera | 2013-06-08 14:12:25 -0500 (Sat, 08 Jun 2013) | 1 line Alsa: revise latency use and calculations, since the latency should be equivalent to one Alsa period less than the Alsa ringbuffer (was based on the whole). Also fixes failure if zero latency was specified. ------------------------------------------------------------------------ r1892 | gineera | 2013-05-30 06:30:28 -0500 (Thu, 30 May 2013) | 1 line qa-latency: fix printout typos; re-enable checks of default high vs low latency - but allow them to be equal; remove rogue tab. ------------------------------------------------------------------------ r1891 | rbencina | 2013-05-05 09:00:02 -0500 (Sun, 05 May 2013) | 1 line added code to print error result from Pa_Initialize() in pa_devs.c example ------------------------------------------------------------------------ r1890 | rbencina | 2013-05-01 20:06:01 -0500 (Wed, 01 May 2013) | 1 line factored out InitPaDeviceInfoFromAsioDriver function. skip device rather than failing entire init process if a single ASIO driver returns an error during init. This was happening with MOTU devices if the device wasn't present. See ticket #221 ------------------------------------------------------------------------ r1889 | rbencina | 2013-04-07 09:15:24 -0500 (Sun, 07 Apr 2013) | 1 line move static variables into x86 section so they don't generate warnings when trying to build on 64 bit ------------------------------------------------------------------------ r1888 | rbencina | 2013-04-07 05:20:18 -0500 (Sun, 07 Apr 2013) | 1 line configure.in fix from Leland '[Portaudio] Small patch to fix Mac build' march 4
2013-09-23 21:27:50 +00:00
#define MAX_TEST_CHANNELS 4
2010-01-24 09:19:39 +00:00
typedef struct PaQaData
{
unsigned long framesLeft;
int numChannels;
int bytesPerSample;
int mode;
short sawPhase;
PaSampleFormat format;
}
PaQaData;
/****************************************** Prototypes ***********/
static void TestDevices( int mode );
static void TestFormats( int mode, PaDeviceIndex deviceID, double sampleRate,
int numChannels );
static int TestAdvance( int mode, PaDeviceIndex deviceID, double sampleRate,
int numChannels, PaSampleFormat format );
static int QaCallback( const void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void *userData );
/****************************************** Globals ***********/
static int gNumPassed = 0;
static int gNumFailed = 0;
/****************************************** Macros ***********/
/* Print ERROR if it fails. Tally success or failure. */
/* Odd do-while wrapper seems to be needed for some compilers. */
#define EXPECT(_exp) \
do \
{ \
if ((_exp)) {\
/* printf("SUCCESS for %s\n", #_exp ); */ \
gNumPassed++; \
} \
else { \
printf("ERROR - 0x%x - %s for %s\n", result, \
((result == 0) ? "-" : Pa_GetErrorText(result)), \
#_exp ); \
gNumFailed++; \
goto error; \
} \
} while(0)
/*******************************************************************/
/* This routine will be called by the PortAudio engine when audio is needed.
** It may be called at interrupt level on some machines so don't do anything
** that could mess up the system like calling malloc() or free().
*/
static int QaCallback( const void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void *userData )
{
unsigned long i;
short phase;
PaQaData *data = (PaQaData *) userData;
(void) inputBuffer;
2013-02-27 01:33:15 +00:00
/* Play simple sawtooth wave. */
2010-01-24 09:19:39 +00:00
if( data->mode == MODE_OUTPUT )
{
phase = data->sawPhase;
switch( data->format )
{
case paFloat32:
{
float *out = (float *) outputBuffer;
for( i=0; i<framesPerBuffer; i++ )
{
phase += 0x123;
*out++ = (float) (phase * (1.0 / 32768.0));
if( data->numChannels == 2 )
{
*out++ = (float) (phase * (1.0 / 32768.0));
}
}
}
break;
case paInt32:
{
int *out = (int *) outputBuffer;
for( i=0; i<framesPerBuffer; i++ )
{
phase += 0x123;
*out++ = ((int) phase ) << 16;
if( data->numChannels == 2 )
{
*out++ = ((int) phase ) << 16;
}
}
}
break;
2013-02-27 01:33:15 +00:00
2010-01-24 09:19:39 +00:00
case paInt16:
{
short *out = (short *) outputBuffer;
for( i=0; i<framesPerBuffer; i++ )
{
phase += 0x123;
*out++ = phase;
if( data->numChannels == 2 )
{
*out++ = phase;
}
}
}
break;
default:
{
unsigned char *out = (unsigned char *) outputBuffer;
unsigned long numBytes = framesPerBuffer * data->numChannels * data->bytesPerSample;
for( i=0; i<numBytes; i++ )
{
*out++ = 0;
}
}
break;
}
data->sawPhase = phase;
}
/* Are we through yet? */
if( data->framesLeft > framesPerBuffer )
{
PaUtil_AddTraceMessage("QaCallback: running. framesLeft", data->framesLeft );
data->framesLeft -= framesPerBuffer;
return 0;
}
else
{
PaUtil_AddTraceMessage("QaCallback: DONE! framesLeft", data->framesLeft );
data->framesLeft = 0;
return 1;
}
}
/*******************************************************************/
int main(void);
int main(void)
{
PaError result;
EXPECT( ((result=Pa_Initialize()) == 0) );
printf("Test OUTPUT ---------------\n");
TestDevices( MODE_OUTPUT );
printf("Test INPUT ---------------\n");
TestDevices( MODE_INPUT );
error:
Pa_Terminate();
printf("QA Report: %d passed, %d failed.\n", gNumPassed, gNumFailed );
2013-02-27 01:33:15 +00:00
return (gNumFailed > 0) ? 1 : 0;
2010-01-24 09:19:39 +00:00
}
/*******************************************************************
* Try each output device, through its full range of capabilities. */
static void TestDevices( int mode )
{
int id, jc, i;
int maxChannels;
const PaDeviceInfo *pdi;
static double standardSampleRates[] = { 8000.0, 9600.0, 11025.0, 12000.0,
16000.0, 22050.0, 24000.0,
32000.0, 44100.0, 48000.0,
88200.0, 96000.0,
-1.0 }; /* Negative terminated list. */
int numDevices = Pa_GetDeviceCount();
for( id=0; id<numDevices; id++ ) /* Iterate through all devices. */
{
pdi = Pa_GetDeviceInfo( id );
/* Try 1 to maxChannels on each device. */
maxChannels = (( mode == MODE_INPUT ) ? pdi->maxInputChannels : pdi->maxOutputChannels);
Update portaudio to r1910 which brings in these changes: ------------------------------------------------------------------------ r1910 | gineera | 2013-09-07 05:14:52 -0500 (Sat, 07 Sep 2013) | 1 line paqa_devs: limit max number of channels tested (to 4); add a fixed decimal format to the timestamp printout. ------------------------------------------------------------------------ r1909 | rbencina | 2013-08-28 19:36:56 -0500 (Wed, 28 Aug 2013) | 1 line pa_mac_core.c line 664 fixed incorrect memset size (was using sizeof(ptr) not sizeof(struct type) ------------------------------------------------------------------------ r1908 | gineera | 2013-08-27 12:14:51 -0500 (Tue, 27 Aug 2013) | 1 line Alsa: Add function to prevent duplicate parts in the visible pa device name string, that occur when the pcm-device name starts with the card name (since they are both used). Achieved by trimming the pcm-device string beginning. ------------------------------------------------------------------------ r1907 | gineera | 2013-08-22 17:01:17 -0500 (Thu, 22 Aug 2013) | 1 line Alsa: Fix memory leak as nonMmapBuffers were not freed (since change to realloc). Clean out corresponding dead code chunk. ------------------------------------------------------------------------ r1906 | gineera | 2013-08-22 14:43:07 -0500 (Thu, 22 Aug 2013) | 1 line Alsa: Rename some variables in pa_linux_alsa where the meaning is mis-leading or wrong in the Alsa context. Also tweak one debug message and a few typos. ------------------------------------------------------------------------ r1897 | gineera | 2013-08-13 15:37:04 -0500 (Tue, 13 Aug 2013) | 1 line Alsa: Fix handling of poll descriptors in PaAlsaStream_WaitForFrames(). Otherwise if capture signals before playback a duplex stream could poll the wrong descriptor, causing a loop (reported by Alexander Kartashov). ------------------------------------------------------------------------ r1896 | rbencina | 2013-08-06 03:26:55 -0500 (Tue, 06 Aug 2013) | 1 line fixed bug that was causing memory corruption in PA/ALSA when host sample format was lager than user format. e.g. using 16 bit output with a sound card that used 24 bit buffers. the incorrect input zeroer was being used. Thanks to Anders Tornvig for identifying the problem ------------------------------------------------------------------------ r1895 | rbencina | 2013-07-24 10:37:15 -0500 (Wed, 24 Jul 2013) | 1 line fixed doxygen markup for a few line breaks in the tutorial ------------------------------------------------------------------------ r1894 | gineera | 2013-06-08 14:30:41 -0500 (Sat, 08 Jun 2013) | 1 line OSS: revise default latency reporting: previous fixed values could not actually be achieved with OSS power-of-2 sizes. Instead try a configuration and correctly report the default latency based on one less than the number of fragments; also fix the stream component 'bufSz' calculation. ------------------------------------------------------------------------ r1893 | gineera | 2013-06-08 14:12:25 -0500 (Sat, 08 Jun 2013) | 1 line Alsa: revise latency use and calculations, since the latency should be equivalent to one Alsa period less than the Alsa ringbuffer (was based on the whole). Also fixes failure if zero latency was specified. ------------------------------------------------------------------------ r1892 | gineera | 2013-05-30 06:30:28 -0500 (Thu, 30 May 2013) | 1 line qa-latency: fix printout typos; re-enable checks of default high vs low latency - but allow them to be equal; remove rogue tab. ------------------------------------------------------------------------ r1891 | rbencina | 2013-05-05 09:00:02 -0500 (Sun, 05 May 2013) | 1 line added code to print error result from Pa_Initialize() in pa_devs.c example ------------------------------------------------------------------------ r1890 | rbencina | 2013-05-01 20:06:01 -0500 (Wed, 01 May 2013) | 1 line factored out InitPaDeviceInfoFromAsioDriver function. skip device rather than failing entire init process if a single ASIO driver returns an error during init. This was happening with MOTU devices if the device wasn't present. See ticket #221 ------------------------------------------------------------------------ r1889 | rbencina | 2013-04-07 09:15:24 -0500 (Sun, 07 Apr 2013) | 1 line move static variables into x86 section so they don't generate warnings when trying to build on 64 bit ------------------------------------------------------------------------ r1888 | rbencina | 2013-04-07 05:20:18 -0500 (Sun, 07 Apr 2013) | 1 line configure.in fix from Leland '[Portaudio] Small patch to fix Mac build' march 4
2013-09-23 21:27:50 +00:00
if( maxChannels > MAX_TEST_CHANNELS )
maxChannels = MAX_TEST_CHANNELS;
2010-01-24 09:19:39 +00:00
for( jc=1; jc<=maxChannels; jc++ )
{
2013-02-27 01:33:15 +00:00
printf("\n========================================================================\n");
printf(" Device = %s\n", pdi->name );
printf("========================================================================\n");
2010-01-24 09:19:39 +00:00
/* Try each standard sample rate. */
for( i=0; standardSampleRates[i] > 0; i++ )
{
TestFormats( mode, (PaDeviceIndex)id, standardSampleRates[i], jc );
}
}
}
}
/*******************************************************************/
static void TestFormats( int mode, PaDeviceIndex deviceID, double sampleRate,
int numChannels )
{
TestAdvance( mode, deviceID, sampleRate, numChannels, paFloat32 );
TestAdvance( mode, deviceID, sampleRate, numChannels, paInt16 );
TestAdvance( mode, deviceID, sampleRate, numChannels, paInt32 );
/* TestAdvance( mode, deviceID, sampleRate, numChannels, paInt24 ); */
}
/*******************************************************************/
static int TestAdvance( int mode, PaDeviceIndex deviceID, double sampleRate,
int numChannels, PaSampleFormat format )
{
PaStreamParameters inputParameters, outputParameters, *ipp, *opp;
PaStream *stream = NULL;
PaError result = paNoError;
PaQaData myData;
#define FRAMES_PER_BUFFER (64)
2013-02-27 01:33:15 +00:00
const int kNumSeconds = 100;
2010-01-24 09:19:39 +00:00
/* Setup data for synthesis thread. */
2013-02-27 01:33:15 +00:00
myData.framesLeft = (unsigned long) (sampleRate * kNumSeconds);
2010-01-24 09:19:39 +00:00
myData.numChannels = numChannels;
myData.mode = mode;
myData.format = format;
switch( format )
{
case paFloat32:
case paInt32:
case paInt24:
myData.bytesPerSample = 4;
break;
/* case paPackedInt24:
myData.bytesPerSample = 3;
break; */
default:
myData.bytesPerSample = 2;
break;
}
if( mode == MODE_INPUT )
{
inputParameters.device = deviceID;
inputParameters.channelCount = numChannels;
inputParameters.sampleFormat = format;
inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency;
inputParameters.hostApiSpecificStreamInfo = NULL;
ipp = &inputParameters;
}
else
2013-02-27 01:33:15 +00:00
{
ipp = NULL;
}
if( mode == MODE_OUTPUT )
2010-01-24 09:19:39 +00:00
{
outputParameters.device = deviceID;
outputParameters.channelCount = numChannels;
outputParameters.sampleFormat = format;
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
outputParameters.hostApiSpecificStreamInfo = NULL;
opp = &outputParameters;
}
else
2013-02-27 01:33:15 +00:00
{
opp = NULL;
}
2010-01-24 09:19:39 +00:00
if(paFormatIsSupported == Pa_IsFormatSupported( ipp, opp, sampleRate ))
{
printf("------ TestAdvance: %s, device = %d, rate = %g, numChannels = %d, format = %lu -------\n",
( mode == MODE_INPUT ) ? "INPUT" : "OUTPUT",
deviceID, sampleRate, numChannels, (unsigned long)format);
EXPECT( ((result = Pa_OpenStream( &stream,
ipp,
opp,
sampleRate,
FRAMES_PER_BUFFER,
paClipOff, /* we won't output out of range samples so don't bother clipping them */
QaCallback,
&myData ) ) == 0) );
if( stream )
{
PaTime oldStamp, newStamp;
unsigned long oldFrames;
int minDelay = ( mode == MODE_INPUT ) ? 1000 : 400;
/* Was:
int minNumBuffers = Pa_GetMinNumBuffers( FRAMES_PER_BUFFER, sampleRate );
int msec = (int) ((minNumBuffers * 3 * 1000.0 * FRAMES_PER_BUFFER) / sampleRate);
*/
int msec = (int)( 3.0 *
(( mode == MODE_INPUT ) ? inputParameters.suggestedLatency : outputParameters.suggestedLatency ));
if( msec < minDelay ) msec = minDelay;
printf("msec = %d\n", msec); /**/
EXPECT( ((result=Pa_StartStream( stream )) == 0) );
/* Check to make sure PortAudio is advancing timeStamp. */
oldStamp = Pa_GetStreamTime(stream);
Pa_Sleep(msec);
newStamp = Pa_GetStreamTime(stream);
Update portaudio to r1910 which brings in these changes: ------------------------------------------------------------------------ r1910 | gineera | 2013-09-07 05:14:52 -0500 (Sat, 07 Sep 2013) | 1 line paqa_devs: limit max number of channels tested (to 4); add a fixed decimal format to the timestamp printout. ------------------------------------------------------------------------ r1909 | rbencina | 2013-08-28 19:36:56 -0500 (Wed, 28 Aug 2013) | 1 line pa_mac_core.c line 664 fixed incorrect memset size (was using sizeof(ptr) not sizeof(struct type) ------------------------------------------------------------------------ r1908 | gineera | 2013-08-27 12:14:51 -0500 (Tue, 27 Aug 2013) | 1 line Alsa: Add function to prevent duplicate parts in the visible pa device name string, that occur when the pcm-device name starts with the card name (since they are both used). Achieved by trimming the pcm-device string beginning. ------------------------------------------------------------------------ r1907 | gineera | 2013-08-22 17:01:17 -0500 (Thu, 22 Aug 2013) | 1 line Alsa: Fix memory leak as nonMmapBuffers were not freed (since change to realloc). Clean out corresponding dead code chunk. ------------------------------------------------------------------------ r1906 | gineera | 2013-08-22 14:43:07 -0500 (Thu, 22 Aug 2013) | 1 line Alsa: Rename some variables in pa_linux_alsa where the meaning is mis-leading or wrong in the Alsa context. Also tweak one debug message and a few typos. ------------------------------------------------------------------------ r1897 | gineera | 2013-08-13 15:37:04 -0500 (Tue, 13 Aug 2013) | 1 line Alsa: Fix handling of poll descriptors in PaAlsaStream_WaitForFrames(). Otherwise if capture signals before playback a duplex stream could poll the wrong descriptor, causing a loop (reported by Alexander Kartashov). ------------------------------------------------------------------------ r1896 | rbencina | 2013-08-06 03:26:55 -0500 (Tue, 06 Aug 2013) | 1 line fixed bug that was causing memory corruption in PA/ALSA when host sample format was lager than user format. e.g. using 16 bit output with a sound card that used 24 bit buffers. the incorrect input zeroer was being used. Thanks to Anders Tornvig for identifying the problem ------------------------------------------------------------------------ r1895 | rbencina | 2013-07-24 10:37:15 -0500 (Wed, 24 Jul 2013) | 1 line fixed doxygen markup for a few line breaks in the tutorial ------------------------------------------------------------------------ r1894 | gineera | 2013-06-08 14:30:41 -0500 (Sat, 08 Jun 2013) | 1 line OSS: revise default latency reporting: previous fixed values could not actually be achieved with OSS power-of-2 sizes. Instead try a configuration and correctly report the default latency based on one less than the number of fragments; also fix the stream component 'bufSz' calculation. ------------------------------------------------------------------------ r1893 | gineera | 2013-06-08 14:12:25 -0500 (Sat, 08 Jun 2013) | 1 line Alsa: revise latency use and calculations, since the latency should be equivalent to one Alsa period less than the Alsa ringbuffer (was based on the whole). Also fixes failure if zero latency was specified. ------------------------------------------------------------------------ r1892 | gineera | 2013-05-30 06:30:28 -0500 (Thu, 30 May 2013) | 1 line qa-latency: fix printout typos; re-enable checks of default high vs low latency - but allow them to be equal; remove rogue tab. ------------------------------------------------------------------------ r1891 | rbencina | 2013-05-05 09:00:02 -0500 (Sun, 05 May 2013) | 1 line added code to print error result from Pa_Initialize() in pa_devs.c example ------------------------------------------------------------------------ r1890 | rbencina | 2013-05-01 20:06:01 -0500 (Wed, 01 May 2013) | 1 line factored out InitPaDeviceInfoFromAsioDriver function. skip device rather than failing entire init process if a single ASIO driver returns an error during init. This was happening with MOTU devices if the device wasn't present. See ticket #221 ------------------------------------------------------------------------ r1889 | rbencina | 2013-04-07 09:15:24 -0500 (Sun, 07 Apr 2013) | 1 line move static variables into x86 section so they don't generate warnings when trying to build on 64 bit ------------------------------------------------------------------------ r1888 | rbencina | 2013-04-07 05:20:18 -0500 (Sun, 07 Apr 2013) | 1 line configure.in fix from Leland '[Portaudio] Small patch to fix Mac build' march 4
2013-09-23 21:27:50 +00:00
printf("oldStamp = %9.6f, newStamp = %9.6f\n", oldStamp, newStamp ); /**/
2010-01-24 09:19:39 +00:00
EXPECT( (oldStamp < newStamp) );
/* Check to make sure callback is decrementing framesLeft. */
oldFrames = myData.framesLeft;
Pa_Sleep(msec);
printf("oldFrames = %lu, myData.framesLeft = %lu\n", oldFrames, myData.framesLeft ); /**/
EXPECT( (oldFrames > myData.framesLeft) );
EXPECT( ((result=Pa_CloseStream( stream )) == 0) );
stream = NULL;
}
}
2013-02-27 01:33:15 +00:00
return 0;
2010-01-24 09:19:39 +00:00
error:
if( stream != NULL ) Pa_CloseStream( stream );
2013-02-27 01:33:15 +00:00
return -1;
2010-01-24 09:19:39 +00:00
}