Commit Graph

65 Commits

Author SHA1 Message Date
Anonymous Maarten
40f9fd854f test: use SDL_HINT_(AUDIO,VIDEO)_DRIVER macro 2024-07-11 23:37:11 +02:00
Ryan C. Gordon
16e7fdc4f2 audio: Add channel remapping to SDL_AudioSpec and SDL_AudioStream.
Fixes #8367.
2024-07-03 14:38:33 -04:00
Ryan C. Gordon
38f0214e8a audio: Refer to audio devices to "playback" and "recording".
Fixes #9619.
2024-06-15 01:08:12 -04:00
Anonymous Maarten
a919774fe4 Build with -Wfloat-conversion + fix all warnings 2024-06-03 21:33:29 +00:00
Ryan C. Gordon
e23257307e Introduce formal policy for APIs that return strings.
This declares that any `const char *` returned from SDL is owned by SDL, and
promises to be valid _at least_ until the next time the event queue runs, or
SDL_Quit() is called, even if the thing that owns the string gets destroyed
or changed before then.

This is noted in the headers as "the SDL_GetStringRule", so this will both be
greppable to find a detailed explaination in docs/README-strings.md and
wikiheaders will automatically turn it into a link we can point at the
appropriate documentation.

Fixes #9902.

(and several FIXMEs, both known and yet-undocumented.)
2024-06-03 14:20:49 -04:00
Brick
edaab8ad9f Refactored audio conversion to reduce copying
More of the logic has been moved into SDL_AudioQueue,
allowing data to be converted directly from the input buffer.
2024-04-15 11:47:18 -10:00
Brick
ae57b0c9d8 Randomly split the data in audio_resampleLoss
This helps ensure correct resampling across track boundaries
2024-04-15 11:47:18 -10:00
Brick
8f6f9cadc4 Rewrote audio resampler using cubic filter interpolation
This allows using a much smaller (1.5 KB) lookup table, in exchange for a small amount of extra work per frame.

The extra work (a few extra loads/mul/adds) is negligible, and can execute in parallel.
The reduction in cache misses almost certainly outweighs any added cost.

The table is generated at runtime, and takes less than 0.02ms on my computer.
2024-04-15 11:47:18 -10:00
Anonymous Maarten
f59dbf6a12 cmake: add -Wimplicit-fallthrough warning 2024-03-18 20:34:50 +01:00
Sam Lantinga
9989f92eee Fixed warning C4245: 'initializing': conversion from 'int' to 'SDL_AudioDeviceID', signed/unsigned mismatch 2024-02-03 11:49:15 -08:00
Sam Lantinga
ccae9c1ef6 Only initialize audio drivers that have been requested
If testautomation is running with only a specific audio driver enabled, we shouldn't try to open other ones, as they might fail.

Fixes https://github.com/libsdl-org/SDL/issues/8797

(cherry picked from commit 4c11307a4e)
2024-01-08 14:35:42 -08:00
Ryan C. Gordon
c53843a961 docs: Remove Doxygen \brief tags.
Doxygen and the wiki bridge don't need them; they'll both just use the first
line/sentence instead.

Fixes #8446.
2023-11-06 10:26:06 -05:00
Sam Lantinga
c552cc6847 We don't require the audio system to be initialized for audio format conversion
This is helpful for tools pipelines where audio devices are never used.
2023-10-11 09:23:23 -07:00
Brick
a62e62f97a Refactored SDL_audiocvt.c 2023-09-17 13:13:23 -07:00
Brick
f2ca9a615b Added SDL_AUDIO_FRAMESIZE 2023-09-05 17:56:58 -07:00
Brick
53122593f8 Added SDL_AUDIO_BYTESIZE 2023-09-05 17:56:58 -07:00
Sam Lantinga
3a932141e4 Restore audio format binary compatibility with SDL 2.0 2023-09-04 10:16:53 -07:00
Sam Lantinga
233789b0d1 Audio types have the same naming convention as other SDL endian types, e.g. [S|U][BITS][LE|BE]
Native endian types have no LE/BE suffix
2023-09-04 09:48:44 -07:00
Brick
47bcb078f5 Fixed some incorrect SDL_AUDIO_F32 uses 2023-09-04 07:46:18 -07:00
Brick
2833f2e7b5 Fixed OOB access in audio_convertAccuracy test 2023-09-04 07:46:18 -07:00
Brick
28b28bd8f4 Added audio_formatChange test 2023-09-01 14:38:45 -04:00
Brick
ea68bb8027 Add some additional checks to audio_convertAudio 2023-08-27 13:08:15 -07:00
Brick
b1d63be538 Fixed audio_resampleLoss test 2023-08-27 13:08:15 -07:00
Brick
958b3cfaea Tweaked and enabled audio_convertAudio test 2023-08-25 08:43:56 -04:00
Brick
7dbb9b65b1 audio_convertAccuracy: Shuffle the data in case of a bad SIMD implementation 2023-08-25 08:43:56 -04:00
Brick
f6a4080ff5 audio_resampleLoss: Add support for multiple channels 2023-08-25 08:43:56 -04:00
Brick
4f894e748e audio_resampleLoss: SDL_GetAudioStreamData now returns the correct length 2023-08-25 08:43:56 -04:00
Brick
e6c878824c Fixed ResampleAudio interpolation factor calculation 2023-08-22 08:34:22 -04:00
Brick
4983638630 Misc audio tweaks/cleanup 2023-08-21 16:02:54 -04:00
Brick
b9541b9eab Improved ResampleAudio
* filterindex2 was off-by-one
* Generate ResamplerFilter using doubles
* Transpose ResamplerFilter to improve access patterns
2023-08-21 16:02:54 -04:00
Brick
cdaa19869d Track offset within the current sample when resampling 2023-08-21 16:02:54 -04:00
Brick
300d1ec3ed Added audio_convertAccuracy test 2023-08-14 15:07:18 -04:00
Brick
32cecc2eac Fixed assertion in audio_convertAudio 2023-08-14 15:07:18 -04:00
Ryan C. Gordon
54af687210 testautomation_audio.c: Patched to compile. :/ 2023-07-30 11:56:40 -04:00
Ryan C. Gordon
5e82090662 testautomation_audio.c: Apparently we aren't updating test code for C99 atm. 2023-07-30 11:56:40 -04:00
Ryan C. Gordon
00ed6f8827 test: Fixed compiler warnings for unused vars. 2023-07-30 11:56:08 -04:00
Ryan C. Gordon
11dfc4d737 test: Update testautomation_audio for SDL3 audio API. 2023-07-30 11:56:00 -04:00
Brick
079ae065f1 Added SDL prefix AUDIO_* constants 2023-05-02 08:09:06 -07:00
Anonymous Maarten
11c70406c3 testautomation_audio: fix -Wimplicit-fallthrough warning 2023-03-28 16:59:27 +00:00
Qrox
71c80c478a Uses integer arithmetics in SDL_ResampleAudio
- Revert resampler workaround
- Avoids precision loss caused by large floating point numbers
- Adds unit test to test the signal-to-noise ratio and maximum error of resampler
- Code cleanup
2023-03-09 22:12:03 -08:00
Sylvain
c963f02571 More fix warnings about static function and prototype 2023-03-08 16:14:09 +01:00
Sylvain
ac3fd00018 testautomation_pixels/audio: use SDL_arraysize and fix warnings 2023-03-01 22:15:45 +01:00
Ozkan Sezer
6fc32491c7 testautomation_audio.c: use SDL_arraysize for g_numAudioFormats. 2023-03-01 22:56:56 +03:00
Ozkan Sezer
8d8b3d3a9a fix testautomation_audio.c after commit f48d0cc 2023-03-01 18:37:56 +03:00
Ryan C. Gordon
f48d0cc164 audio: Remove AUDIO_U16* support.
It wasn't heavily used, and you can't use memset to silence a U16 buffer.

Fixes #7380.
2023-03-01 10:26:01 -05:00
Anonymous Maarten
08bcee8570 test: don't use wiki urls for documentation comments
Also make consistent use of \ as documentation escape character.
2023-02-02 00:49:09 +01:00
Sylvain
6ad51558d4 Update testaudiostream_audio.c 2023-01-22 11:31:30 -05:00
Sylvain
93e2903ac5 Add SDL_PlayAudioDevice() to play audio. Remove pause_on param from SDL_PauseAudioDevice() 2023-01-06 09:15:39 -08:00
Sylvain
2d7f8d7d51 Remove legacy SDL_Audio functions that acts on device id == 1 2023-01-05 09:40:06 -05:00
Sylvain Becker
d7d3c22dbf Remove more reserved identifiers (#6925) 2022-12-29 13:58:16 -08:00