Commit graph

599 commits

Author SHA1 Message Date
dmitrykos
e540964ffc wasapi: - fixed frames preloading for buffer mode - paUtilFixedHostBufferSize 2010-07-20 21:01:07 +00:00
dmitrykos
3ba45b5966 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) 2010-07-20 19:01:17 +00:00
dmitrykos
f6d6f4e955 wasapi:
- fixed usage of uninitialized variable (Input)
2010-07-15 23:27:21 +00:00
rossb
a0eb0545a5 added pragma to auto-link winmm.lib when compiling with msvc 2010-07-14 06:45:25 +00:00
dmitrykos
a243ad431c 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)
2010-07-12 18:41:05 +00:00
dmitrykos
1c289f924e 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).
2010-07-10 17:41:25 +00:00
dmitrykos
231eb48512 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)
2010-07-09 23:57:51 +00:00
dmitrykos
dbbd94da2c reverted changes from revisions 1516-1517 due to incorrectly made changes to processor's core which result in corrupted audio in some specific situations 2010-07-09 17:53:52 +00:00
dmitrykos
f7ee62732e 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
2010-07-08 21:03:08 +00:00
dmitrykos
0a4cf33379 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)
2010-07-06 07:28:48 +00:00
dmitrykos
a612dd6ac6 fixed processor optimization from previous release for non-interleaved host buffers case (for example ASIO) 2010-06-29 20:58:15 +00:00
dmitrykos
4b4a9b5b79 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 2010-06-28 21:35:04 +00:00
dmitrykos
87d4873e95 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)
2010-06-28 21:29:16 +00:00
dmitrykos
71e6e5f6a5 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 2010-06-28 21:19:15 +00:00
dmitrykos
fd47a09808 wasapi: fixed very rare bug causing a dead looping if WASAPI input stream is being aborted 2010-06-22 19:53:00 +00:00
dmitrykos
5444956b5c wasapi: fixed full-duplex failure (when host sample types differ) due to incorrect check made on I/O host buffer sizes 2010-06-10 09:45:54 +00:00
dmitrykos
23aed33a71 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. 2010-06-10 09:09:19 +00:00
dmitrykos
509e9cc3e1 unix: fixed compile failure due to warning about unused variable when compilation takes place with -Werror switch 2010-06-10 08:05:29 +00:00
dmitrykos
01f740b882 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 2010-06-06 17:36:33 +00:00
dmitrykos
c8414a679e 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
2010-06-03 20:09:33 +00:00
dmitrykos
d2568e4ae7 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)
2010-06-01 17:26:37 +00:00
dmitrykos
d031474d95 alsa: - if polling loop is timed out (paTimedOut) PaAlsaStream_WaitForFrames will not report any frames available 2010-06-01 12:45:09 +00:00
dmitrykos
3e700ec6d2 wasapi:
- implemented support of non-Interlieved buffers (paNonInterleaved) for WASAPI blocking interface for input and output
 - blocking methods will now use PA sample converters
2010-05-31 09:46:49 +00:00
dmitrykos
ddfac9891b alsa: - releasing memory of non-MMAPed buffer on stream closure by Pa_CloseStream 2010-05-31 06:00:16 +00:00
dmitrykos
770a597583 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
2010-05-30 22:14:00 +00:00
dmitrykos
768ce2169e 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
2010-05-30 07:28:41 +00:00
dmitrykos
b565ab5bdd fixed compile for DirectSound implementation under MSYS, missing DSSPEAKER_7POINT1_SURROUND define 2010-05-20 17:28:23 +00:00
dmitrykos
9bb962b93b wasapi:
- re-enabled Event-driven mode for Windows 7 x64 platform if application runs as WOW64 process
2010-05-18 17:23:56 +00:00
dmitrykos
876f5f777c wasapi:
- fixed Event-driven mode, broken in 1496 rev.
2010-05-18 15:02:41 +00:00
dmitrykos
a6485e63cf 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
2010-05-17 21:15:13 +00:00
dmitrykos
e7bf9ce49d 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)
2010-05-17 18:37:00 +00:00
dmitrykos
083b34a10f 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
2010-05-12 18:08:45 +00:00
dmitrykos
6421f964d7 corrected comments to Int24_To_Int16_Dither 2010-04-17 07:43:00 +00:00
dmitrykos
bd2bfe985e implemented 'Int24_To_Int16_Dither' converter to allow 24-bit audio be played (before was silence for WMME and DirectSound) 2010-04-16 19:08:00 +00:00
dmitrykos
50986ea63b 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
2010-04-16 08:31:19 +00:00
dmitrykos
43146e690e 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)
2010-04-15 17:44:13 +00:00
dmitrykos
8186129234 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
2010-04-15 17:15:14 +00:00
dmitrykos
14d09847a3 wasapi:
- improved device buffer alignment calculation allowing to set as precise device latency as possible
2010-04-12 21:15:50 +00:00
dmitrykos
7d037383bc 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
2010-04-12 20:55:34 +00:00
dmitrykos
0b75c266df 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 2010-04-11 16:13:46 +00:00
dmitrykos
94c7f9a355 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
2010-04-11 16:04:21 +00:00
dmitrykos
6afe78328f excluded x86-64 platform from ASIO 'thiscall' resolver as x64 ABI does not have 'thiscall' calling convention anymore 2010-04-07 21:07:55 +00:00
dmitrykos
d714962621 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
2010-03-25 23:27:27 +00:00
dmitrykos
14a79e0e89 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.
2010-03-24 19:08:38 +00:00
dmitrykos
4f26695b77 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."
2010-03-18 11:26:47 +00:00
dmitrykos
4ba123be9a wasapi: small corrections to improve CoInitialize/CoUninitialize sequence (taken from DS implementation) 2010-03-17 10:37:29 +00:00
dmitrykos
5cf34acdbd updated 'configure' file, many thanks to Stelios Bounanos for generating it 2010-03-16 12:23:13 +00:00
dmitrykos
bf5addedfe wasapi: removed excessive argument checks in stream management functions 2010-03-14 17:25:48 +00:00
dmitrykos
f65b1391e5 wasapi: improved parameter checks for blocking API 2010-03-13 19:13:06 +00:00
dmitrykos
1657fc17d6 wasapi: fixed extension functions: PaWasapi_GetDeviceDefaultFormat / PaWasapi_GetDeviceRole - device index was misinterpreted and as a result returning value was mismatched 2010-03-13 18:53:40 +00:00