alsa:
- fixed seg.fault (caused by assertion) when using non-interleaved host i/o, now paNonInterleaved flag is provided to PaUtil_InitializeBufferProcessor to signal processor about host format being non-interleaved
jack:
- fixed assertion in PA processor logics by informing processor that host format is non-interleaved (using paNonInterleaved flag) in PaUtil_InitializeBufferProcessor
- fixed rare timeout on WaitCondition reported earlier by increasing timeout from 1 second to 10 minutes
wasapi:
- added functionality to enumerate jacks and their description
- added example which demonstrates jacks enumeration technique
Thanks Reid Bishop for providing the idea for this extended functionality and patch with implementation.
wasapi: - fixed occasional bug (affects Windows 7 mostly) which is related to stream start failure due to exceeding buffer size when preloading data for output stream in exclusive mode (thanks Ralph Irving for noticing and reporting this bug)
wasapi:
- reimplemented full-duplex processing to address changes to latency calculations (please note Exclusive mode due to some unknown reason will likely not be able to provide good audio quality yet)
- fixed Pa_GetStreamInfo for WASAPI device if stream is opened as full-duplex (thanks to Reid Bishop for pointing to the bug)
optimized PA processor for case when host and user buffer match by type and size, now host buffer pointer will be passed to user space directly, additional copying of audio input/output data is thus avoided.
asio: apply paNonInterleaved flag on host formats for callback mode (required for processor compatibility).
wasapi:
- fixed memory corruption if format is set to non-interlieved and mono <> stereo mini-mixer is used for to convert mono to stereo (conversion is done due to WASAPI limitation)
- made WASAPI fully passing patest_wire.c (full-duplex combinations) for shared and exclusive modes
- if WASAPI device failed to open due to unsupported format it will not crash top PA layer anymore
- improved full-duplex mode for shared/exclusive (although exclusive full-duplex mode still produces audio glitches due to difference in input/output device buffer size due to unknown WASAPI reason, with shared mode all is ok)
- exclusive mode will now work with 1 channel audio always, even if it is not supported by WASAPI natively (we use own mono <> stereo mini-mixer)
reverted changes from revisions 1516-1517 due to incorrectly made changes to processor's core which result in corrupted audio in some specific situations
wasapi:
- fixed Exclusive/Event mode if latency used exceeds 100ms resulting in bad audio
- fixed Exclusive mode if overall stream latency exceeds 1400-2000ms resulting in E_OUTOFMEMORY even under Vista, now PA WASAPI will gradually decrease overall latency until acceptable level
- applied device period aligning if period was corrected
- improved robustness of audio client creation
wasapi:
- reimplemented suggestedLatency and framesPerBuffer parameters in Pa_OpenStream call to opearate by the following formula - 'hostBufferFrames = userFramesPerBuffer + max(userFramesPerBuffer, (suggestedLatency * sampleRate))' as discussed on PA mailing-lists
- it is now possible to achieve 5.33ms latency in Polling & Exclusive mode (WOW64 or Native)
- Polling method for output will benefit from direct WASAPI buffer pointer exposure to a user space through a callback (no copying)
dmitrykos [Mon, 28 Jun 2010 21:35:04 +0000 (21:35 +0000)]
implemented optimization for NonAdaptingProcess processor: avoid copying of input/output from temp user buffer to host buffer by providing host buffer pointer directly to user, e.g. achieving processing of host buffer in place
dmitrykos [Mon, 28 Jun 2010 21:29:16 +0000 (21:29 +0000)]
wasapi:
- made framesPerBuffer and suggestedLatency behavior as per PA specification, e.g. framesPerBuffer set main device period, suggestedLatency is a surplus if not 0
- fixed bug with Input in situation when WASAPI operates in native not-WOW64 process and using event mechanism would provide less frames to a user callback than expected (due to the fact as WASAPI's audio client provides only 1 packet per GetBuffer call which)
dmitrykos [Mon, 28 Jun 2010 21:19:15 +0000 (21:19 +0000)]
alsa: reverted broken specification (by me) according device latency being not dependent on user buffer size, now framesPerBuffer parameter and suggestedLatency set overall stream latency
dmitrykos [Thu, 10 Jun 2010 09:09:19 +0000 (09:09 +0000)]
wasapi: fixed host-WASAPI related bug when selected 24-bit Input does not produce any audio, while 16 and 32-bits do, now if 24-bits selected by user (paInt24) PA WASAPI asks 32-bits (paFloat32) from WASAPI device and PA converters provide 24-bit data which is converted from 32-bit host buffer.
dmitrykos [Sun, 6 Jun 2010 17:36:33 +0000 (17:36 +0000)]
oss: fixed compile for systems missing 'pthread_cancel' series of functions, this allows to compile PortAudio under Android platform with OSS as audio host back-end
dmitrykos [Thu, 3 Jun 2010 20:09:33 +0000 (20:09 +0000)]
alsa:
- fixed latency setting dependence on user buffer size, now it is completely independent and user is able to set lowest possible/audible latency (approx. 3-4ms)
- fixed fixed min. latency for non-MMAPed devices, they do behave similar to MMAPed devices now without a limitation
dmitrykos [Tue, 1 Jun 2010 17:26:37 +0000 (17:26 +0000)]
wasapi:
- implemented support for full-duplex mode (it always uses polling(pull) WASAPI behavior, if latency <15msec needed then event interface must be done)
- fixed mono-to-stereo converter for input stream
- mono-to-stereo converter will also automatically operate in shared mode (if WASAPI driver does not support mono for output, or only stereo for input)
dmitrykos [Mon, 31 May 2010 09:46:49 +0000 (09:46 +0000)]
wasapi:
- implemented support of non-Interlieved buffers (paNonInterleaved) for WASAPI blocking interface for input and output
- blocking methods will now use PA sample converters
dmitrykos [Sun, 30 May 2010 22:14:00 +0000 (22:14 +0000)]
alsa:
- reverted buffer size (2048) hardcoding for non-MMAPed devices to avoid crash on wrong buffer size usage (whole area requires more work)
- optimized non-MMAPed device operation to avoid malloc(memset)/free usage on every processing call avoiding significant performance penalty
dmitrykos [Sun, 30 May 2010 07:28:41 +0000 (07:28 +0000)]
alsa:
- fixed deadlock in PaAlsaStream_WaitForFrames if device is paused, poll() results are now checked for 0 and if 64 times exceeded an error (paTimedOut) is returned
- removed hardcoded low-limit of latency for non-MMAPed devices, it is an obligation for user to set an acceptable/desired latency value
- tuned XRUN recovery sequence for MMAPed devices
dmitrykos [Mon, 17 May 2010 21:15:13 +0000 (21:15 +0000)]
wasapi:
- using WOW64 workaround (fall-back to a Poll-driven mode) for any WOW64 process regardless of Windows version due to report of same bug under Windows 7 x64
dmitrykos [Mon, 17 May 2010 18:37:00 +0000 (18:37 +0000)]
wasapi:
- fixed object (IAudioRenderClient/IAudioCaptureClient) leak if stream is stopped and restarted without closing
- improved IAudioClient event handle management on stream restart (not deleting/creating event handle but rather keeping it until stream is closed)
dmitrykos [Wed, 12 May 2010 18:08:45 +0000 (18:08 +0000)]
wasapi:
- fixed occasional crash-bug which may be caused by a lightweight application that starts stream, checks if stream is running and if not terminates the stream: WASAPI implementation wasn't taking such behavior into account and stream termination (with structure deallocation) could happen during a thread start causing a crash on bad pointer usage
- fixed Pa_IsStreamActive and similar not correctly reporting stopped stream if that was stopped from within a callback function (playback/capture) by returning paComplete
wasapi:
- new method PaWasapi_GetFramesPerHostBuffer which allows to get number of input/output frames per host (WASAPI) buffer, this method helps to find out maximal values for PaWasapiHostProcessorCallback
- documentation fixes
wasapi:
- added calling thread id checks to match Pa_Initialize/Pa_Uninitialize in the same calling thread, if not the case then console warning will be thrown and CoUninitialize will not be called (preferring leak over uninitializing user-side COM)
wasapi:
- fixed Windows 7/Server 2008 R2 and Future detection, this fixes minimal/maximal device periods correction
- added CO_E_NOTINITIALIZED to text errors with action to take for user in case it happens
wasapi:
- fixed crash in Pa_OpenStream call if WASAPI device did not open or something failed (happened on stream handle cleanup due to double attempt to free same pointer)
- improved the way WASAPI device is opening, such error as AUDCLNT_E_BUFFER_SIZE_ERROR which comes due to incorrectly small device period is fixed for Vista (and all other, including future) systems as well, latency will be corrected to device minimum (usually 3ms).
- if suggestedLatency is set to 0 in Pa_OpenStream call then WASAPI device will select device default latency (in Exclusive mode it is 10ms, in Shared 20ms)
- improved on-screen logging of WASAPI devices available during WASAPI initialization phase
fixed ASIO thiscall resolver for GCC 4.+: CALL_THISCALL_1_DOUBLE was failing due to strong optimization of GCC compiler, added EDX in clobbered register list to warn GCC that resolver uses it explicitly
wasapi:
- fixed AUDCLNT_E_INVALID_DEVICE_PERIOD under Windows 7 if latency is set to lower than minimal device period
- fixed AUDCLNT_E_INVALID_DEVICE_PERIOD under Windows 7 if latency for Exclusive mode is higher than 500ms, for Shared mode higher than 2000ms
dmitrykos [Thu, 25 Mar 2010 23:27:27 +0000 (23:27 +0000)]
wasapi:
- fixed int24 Mono to Stereo mixer (affects Mono streams starting in Exclusive mode)
pa_converters:
- avoid using 64-bit integer math for Int24_To_Float32 and Int24_To_Int32 under x64 Posix platforms (long is 64-bit there), now using explicit PaInt32 type
dmitrykos [Wed, 24 Mar 2010 19:08:38 +0000 (19:08 +0000)]
wasapi:
- fixed bug when Exclusive mode was wrongly opening Stereo stream if Mono stream was requested (note: WASAPI device usually does not support Mono in Exclusive mode), resulted in distorted sound
- implemented workaround for WASAPI limitation - in Exclusive mode Mono stream is not supported: now PA creates internal audio device in Stereo mode, and after callback call Mono data is mixed into Stereo output, this workaround is not supported for Blocking mode. all this is done transparent for user, automatically.
dmitrykos [Thu, 18 Mar 2010 11:26:47 +0000 (11:26 +0000)]
maccore: fixed MacOSX "Snow Leopard" 10.6+ deadlock on sample-rate change submitted by Olivier Tristan
and Stephane Letz with the following details:
"When using paMacCoreChangeDeviceParameters option of PaMacCore_SetupStreamInfo, if the sample rate used in PortAudio do not match the one on the hardware, it automatically switches the hardware samplerate. This functionality stopped working on 10.6 and was blocking the application when trying to change the hardware samplerate (infinite wait) It now works fine on 10.6 as it used to on previous OSX version."
dmitrykos [Sat, 13 Mar 2010 18:53:40 +0000 (18:53 +0000)]
wasapi: fixed extension functions: PaWasapi_GetDeviceDefaultFormat / PaWasapi_GetDeviceRole - device index was misinterpreted and as a result returning value was mismatched
dmitrykos [Wed, 10 Mar 2010 21:47:01 +0000 (21:47 +0000)]
implemented optional log output to Visual Studio Output window if PA_ENABLE_MSVC_DEBUG_OUTPUT is defined, this simplifies debugging of external process if Visual Studio is attached to process
dmitrykos [Tue, 9 Mar 2010 12:29:36 +0000 (12:29 +0000)]
wasapi:
- fixed configure.in to compile WASAPI module under MSYS
- fixed include name cases for case-sensitive build environments
- defined LPCGUID for some MinGW compilers which are missing it
- fixed strict-aliasing rules break on line of getting device EndpointFormFactor in case '-Wstrict-aliasing' is specified or corresponding GCC optimization flag is used
dmitrykos [Thu, 4 Mar 2010 11:02:06 +0000 (11:02 +0000)]
wasapi: fixed initialization stage of PaWasapi_Initialize() which was returning error if WASAPI wasn't found (for example under Windows XP), this was causing PA's whole initialization to fail completely
dmitrykos [Wed, 3 Mar 2010 22:57:16 +0000 (22:57 +0000)]
+++ wasapi:
- converted PA WASAPI module to pure C
- implemented compilation support for GCC [MinGW(32-bit)/MinGW64(64-bit)] compiler, special notes regarding MinGW compilation are included in 'readme.txt' file
dmitrykos [Tue, 2 Mar 2010 19:08:13 +0000 (19:08 +0000)]
+++ wasapi: corrected PaWasapi_Initialize() behavior in case of OS back-end failure: WASAPI will not be added to a list of available APIs now (instead of throwing error to InitializeHostApis() that causes PA initialization break), error is thrown only on low-memory condition (default behavior)
dmitrykos [Tue, 2 Mar 2010 17:42:36 +0000 (17:42 +0000)]
wasapi:
- removed dependency from strsafe.h
- fixed crash in InitializeHostApis() if PaWasapi_Initialize() failed due to internal WASAPI error (error code was returned as paNoError in such case)
dmitrykos [Fri, 26 Feb 2010 08:57:44 +0000 (08:57 +0000)]
+++ wasapi: Event-driven/Full-Duplex/Exclusive mode will be calling user-provided callbacks simultaneously when both input/output buffers are ready for IO
dmitrykos [Sat, 20 Feb 2010 12:03:57 +0000 (12:03 +0000)]
wasapi: improved paFramesPerBufferUnspecified handling in case device does not provide default period, paInvalidSampleRate will be returned if sampleRate parameter is 0 for Pa_IsFormatSupported/Pa_OpenStream
dmitrykos [Fri, 19 Feb 2010 11:16:01 +0000 (11:16 +0000)]
windows WASAPI fixes/improvements:
- fixed dependency of framesPerBuffer parameter in Pa_OpenStream and latency (now only latency setting affects device latency which is correct behavior);
- paFramesPerBufferUnspecified is now supported for Pa_OpenStream;
- sound distortion fixed for Shared mode if framesPerBuffer is lower than device limit and when latency was set to 0;
- fixed timeout for Exclusive mode due to buffer misalignment;
- improved precision of DAC/ADC time for running stream;
- avoided memory leaks on failure of Pa_OpenStream;
- NULL checks on stream pointer for all external methods;
- correct host buffer mode for paWinWasapiPolling mode to deliver fixed number of frames to user space;
- implemented workaround for Vista x64 WOW64 bug if Event-mode is used for Shared mode (due to incorrect Event signaling audio dropouts were happening): will fall back to safe Polling method automatically.
dmitrykos [Wed, 17 Feb 2010 10:11:40 +0000 (10:11 +0000)]
improved PaWasapi_ThreadPriorityBoost by providing enum PaWasapiThreadPriority with explicit thread priority values for convenience. it is possible to override default thread priority setting for Event/Poll-driven modes by specifying new flag paWinWasapiThreadPriority and setting priority value through PaWasapiStreamInfo::threadPriority member.
dmitrykos [Tue, 16 Feb 2010 11:18:52 +0000 (11:18 +0000)]
provided ability not to depend on ksguid.lib when using WDMKS as it may not be provided for x64 SDK by default, define PA_WDMKS_NO_KSGUID_LIB to use static declarations, x64 MSVC project corrected to define PA_WDMKS_NO_KSGUID_LIB for x64 compilations. added WASAPI symbols to portaudio.def.
dmitrykos [Tue, 16 Feb 2010 09:46:08 +0000 (09:46 +0000)]
finished WASAPI implementation:
- Callback/Blocking interface
- Playback/Capture
- Shared/Exclusive mode
to compile you must have installed recent Windows SDK(Vista SDK or higher) and min Visual Studio 2005 SP1. WASAPI is enabled by default, to disable you must define PA_NO_WASAPI prior compilation.
rossb [Tue, 2 Feb 2010 09:01:13 +0000 (09:01 +0000)]
Added code to PortAudio/DirectSound to use DX8 DirectSoundFullDuplexCreate API for full duplex streams where available. Define PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE in your project to enable this feature.
rossb [Sun, 24 Jan 2010 13:17:31 +0000 (13:17 +0000)]
implemented paPrimeOutputBuffersUsingStreamCallback for DirectSound (previously this was the default). invoke some buffer reset code to from StartStream (actually ClearOutputBuffer) instead of OpenStream which should give cleaner startup behavior if the stream is started and stopped multiple times. fixed leaks under error in InitOutputBuffer and fixed leak of primary buffer (previously was never released)
rossb [Sun, 24 Jan 2010 11:42:56 +0000 (11:42 +0000)]
reworked DirectSound stream completion to correctly flush the buffer processor and zero DS buffers when the callback returns paComplete or paAbort. resolves ticket #86. use test patest_stop_playout.c to verify.
rossb [Sun, 24 Jan 2010 09:20:23 +0000 (09:20 +0000)]
use a win32 Event object (aka condition variable) to signal timer process completio to Pa_StopStream in DirectSound implementation. resolves race condition when stopping direct sounds streams.
rossb [Wed, 9 Dec 2009 01:55:50 +0000 (01:55 +0000)]
derive ds output channel count from speaker configuration when pnpInterface is unavailable (eg wavemapper). Thanks to Dmitry Kostjuchenko for the patch.
rossb [Wed, 9 Dec 2009 01:31:44 +0000 (01:31 +0000)]
Fixed bug (when PAWIN_USE_WDMKS_DEVICE_INFO is defined) where wmme device channel count would be incorrect for default device resulting in distorted sound if user tries to open device with more channels than device can handle. Thanks to Dmitry Kostjuchenko for the patch.
rossb [Tue, 8 Dec 2009 09:40:09 +0000 (09:40 +0000)]
Update to Makefile.in and Configure.in from Stelios Bounanos: Pretty-print help strings, Support multiple APIs on win32 with mingw, Output a configuration summary at the end, Remove ASIO build configuration from OSX