561 Commits

Author SHA1 Message Date
Frank Praznik
0b34f18045 audio: pipewire: Don't double free properties on init failure
The context and stream creation functions will destroy the passed properties object on failure, so no need to do it manually.

The pw_properties_free() function pointer is no longer needed, so it can be removed.
2022-01-30 23:23:03 -05:00
pionere
a5c610b0a3 revert 'Changed to use 0xFE instead of 0xFF for better sound quality.' 2022-01-28 20:40:19 -05:00
pionere
a70bb259c7 drop handle parameter of OpenDevice 2022-01-28 20:40:19 -05:00
pionere
47ddb04e17 cleanup/sync the main loop of *_OpenDevice functions to pick audio format II. 2022-01-28 20:40:19 -05:00
pionere
2eafe4340c cleanup/sync the main loop of *_OpenDevice functions to pick audio format 2022-01-28 20:40:19 -05:00
pionere
3939ef72f8 cleanup SDL_GetAudioDeviceSpec
- drop unnecessary hascapture check
- call SDL_InvalidParamError and return -1 in case the index is out of range
- do not zfill SDL_AudioSpec
- adjust documentation to reflect the behavior
2022-01-28 20:40:19 -05:00
pionere
113109f839 cleanup SDL_GetAudioDeviceName
- drop unnecessary hascapture check
- call SDL_InvalidParamError in case the index is out of range
2022-01-28 20:40:19 -05:00
pionere
f91211eb17 cleanup WASAPI_PrepDevice
- reorganize the loop which checks for the right wave-format
- use the return value of UpdateAudioStream
- ensure SetError is called in SDL_NewAudioStream
2022-01-28 20:40:19 -05:00
pionere
c9e8d1573a re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory II. 2022-01-28 20:40:19 -05:00
pionere
1043dd8c0d adjust handling of iscapture
- drop iscapture parameter of OpenDevice
- use SDL_bool for iscapture
2022-01-28 20:40:19 -05:00
pionere
60deadba59 re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory 2022-01-28 20:40:19 -05:00
pionere
ebdd536676 use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError 2022-01-28 20:40:19 -05:00
pionere
4a17612bff get rid of BeginLoopIteration 2022-01-28 20:40:19 -05:00
pionere
0770c5829c get rid of PrepareToClose 2022-01-28 20:40:19 -05:00
Ryan C. Gordon
e0236c02ce audio: Removed an unnecessary commented-out line. 2022-01-28 20:40:19 -05:00
pionere
0dda8a7f4c cleanup init functions of audio
- use SDL_bool if possible
- assume NULL/SDL_FALSE filled impl
- skip zfill of current_audio at the beginning of SDL_AudioInit (done before the init() calls)
2022-01-28 20:40:19 -05:00
pionere
6fcfcc3d6f get rid of SkipMixerLock 2022-01-28 20:40:19 -05:00
pionere
bf66720a4d fix mixing of U16 audio 2022-01-28 20:40:19 -05:00
pionere
905e2e22ef cleanup of SDL_MixAudioFormat 2022-01-28 20:40:19 -05:00
Frank Praznik
b3984df1c6 audio: pipewire: Use client config files instead of module names
Pipewire, as of 0.3.22, uses client config files to load modules instead of explicitly specifying them (PW_KEY_CONTEXT_PROFILE_MODULES is deprecated).  Use the new method to load the realtime module to boost the audio thread priority.
2022-01-19 14:20:19 -05:00
Ryan C. Gordon
5d07c03613
psp: Force channels to stereo if user requested anything other than mono.
Before it would only clamp to stereo if it also had to resample, which would
fail if the app specified 44100Hz and surround sound.
2022-01-09 08:13:34 -05:00
Francisco Javier Trujillo Mata
f3255df9c0 Improve audio compatibility in PSP. Now it supports more formats and frequencies 2022-01-05 19:15:41 -05:00
Sam Lantinga
120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
e
d0de4c625a Android: fixes build NDK 21d 2021-12-31 11:12:21 -08:00
thfrwn
2b6b69fb12 fix assertion failure in sndio audio caused by the recent hotplugging support 2021-12-13 11:26:35 -08:00
Ozkan Sezer
9409642e08 fix some warnings from vita builds (missing includes)
also some tidy-up to whitespace.
2021-12-07 21:24:24 +03:00
Ozkan Sezer
00014dc2ac fix some warnings from psp builds (missing includes.) 2021-12-07 18:47:10 +03:00
ALittleDruid
2f0edc2906 IAudioClient::SetEventHandle Parameter eventHandle Should not be NULL 2021-12-06 09:02:31 -08:00
Ryan C. Gordon
d713a68071
pulseaudio: wait until at least 1/8th (!) of the mixbuffer is available.
This is to workaround systems where we hang in playback because the buffer
does not report the space for whatever reason. The system will instead block
in PlayDevice, which always immediately follows WaitDevice in modern times
so this works out, and it seems to keep the device moving forward.

For a future revision, we are either going to clean this up more properly,
or attempt to move to PulseAudio's pa_stream_set_write_callback() API, but
this will do for SDL 2.0.18.

Reference #4387 for discussion and further information.
2021-11-25 22:32:40 -05:00
Sylvain
2004aaf3bb SDL_wave: use SDL_free 2021-11-22 08:38:46 -08:00
Sylvain
155db97d14 Remove 'malloc' from comment 2021-11-22 08:38:46 -08:00
Sylvain
38cfe25bc5 Remove 'malloc' from comment 2021-11-22 08:38:46 -08:00
Sylvain
8fb19d212e Vita: unneeded include 2021-11-22 08:38:46 -08:00
Sylvain
e702a4e520 PSP: un needed include 2021-11-22 08:38:46 -08:00
Sylvain
d31251b014 use SDL's functions version inplace of libc version 2021-11-22 08:38:46 -08:00
Sylvain
a0cb079a42
Fixed bug #4982 - Failed to open audio_device on OpenSLES / Android 5.x with freq 96khz+ 2021-11-21 15:45:08 +01:00
Sylvain
b6e8651ae9
Audio 6.1 should be allowed now (see #4974) 2021-11-20 15:31:21 +01:00
Sylvain
5be8a22113 Add audio conversion from/to 61 2021-11-17 16:04:54 -08:00
Sylvain
b649314d62
Add comment to audio clipping (see bug #4104) 2021-11-15 13:43:40 +01:00
Ozkan Sezer
5c067906ba wasapi: AvSetMmThreadCharacteristicsW takes an LPCWSTR param, not LPWSTR 2021-11-15 00:55:04 +03:00
Ozkan Sezer
be7b663c2c audio/winmm/SDL_winmm.c (SetMMerror): constify. 2021-11-14 02:30:56 +03:00
Cameron Gutman
c8061ed2d1 alsa: Fix possible uninitialized string 2021-11-13 10:33:37 -06:00
Cameron Gutman
704edf6323 audio: Fix crash calling SDL_OpenAudio() after SDL_AudioInit() fails
The SDL_WasInit() checks don't work when using SDL_AudioInit() directly,
which is exactly what audio_initOpenCloseQuitAudio() in testautomation
does.
2021-11-12 17:07:22 -06:00
Cameron Gutman
78013aeef9 alsa: Fix use-after-free when reinitializing 2021-11-12 16:57:24 -06:00
Sam Lantinga
c2dd50a9a0 Fixed whitespace 2021-11-12 08:28:02 -08:00
Misa
3bf7994fe2 Add and use SDL_FALLTHROUGH for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Clang before Clang 10 and GCC before GCC 7 have problems with using
__attribute__ as a sole statement and warn about a "declaration not
declaring anything", so fall back to using the /* fallthrough */ comment
if we are using those older compiler versions.

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-12 07:26:14 +03:00
Sam Lantinga
abc12a832c Revert "Add and use SDL_FALLTHROUGH for fallthroughs"
This reverts commit 66a08aa3914a98667f212e79b4f0b9453203d656.

This causes problems with older compilers:
https://github.com/libsdl-org/SDL/pull/4791#issuecomment-966630997
2021-11-11 15:58:44 -08:00
Misa
66a08aa391 Add and use SDL_FALLTHROUGH for fallthroughs
Case fallthrough warnings can be suppressed using the __fallthrough__
compiler attribute. Unfortunately, not all compilers have this
attribute, or even have __has_attribute to check if they have the
__fallthrough__ attribute. [[fallthrough]] is also available in C++17
and the next C2x, but not everyone uses C++17 or C2x.

So define the SDL_FALLTHROUGH macro to deal with those problems - if we
are using C++17 or C2x, it expands to [[fallthrough]]; else if the
compiler has __has_attribute and has the __fallthrough__ attribute, then
it expands to __attribute__((__fallthrough__)); else it expands to an
empty statement, with a /* fallthrough */ comment (it's a do {} while
(0) statement, because users of this macro need to use a semicolon,
because [[fallthrough]] and __attribute__((__fallthrough__)) require a
semicolon).

Applications using SDL are also free to use this macro (because it is
defined in begin_code.h).

All existing /* fallthrough */ comments have been replaced with this
macro. Some of them were unnecessary because they were the last case in
a switch; using SDL_FALLTHROUGH in those cases would result in a compile
error on compilers that support __fallthrough__, for having a
__attribute__((__fallthrough__)) statement that didn't immediately
precede a case label.
2021-11-11 07:23:25 -08:00
Sam Lantinga
6d5edfa733 Fixed crash on Android 8, due to bugs in AAudio implementation 2021-11-02 15:59:26 -07:00
Cameron Gutman
c97c46877f core: Convert SDL_IOReady()'s 2nd parameter to flags 2021-10-30 21:23:45 -07:00