Commit Graph

63 Commits

Author SHA1 Message Date
Martin Pulec
9a738c906c add acap/fluidsynth
To replace sdl3_mixer that does no longer support MIDI playback, thus
unusable for our use case.

- song1 needs to be static included potentially from 2 compilation units -
this and sdl_mixer
2025-08-27 09:00:19 +02:00
Ben Roeder
a62fe80c3f Fix spelling errors throughout codebase
Corrected various spelling mistakes in comments, documentation, and
variable names across the project. Changes include:
- Documentation files (CONTRIBUTING.md, README.md, etc.)
- Source code comments in C/C++ files
- Function parameter names and descriptions

No functional changes were made.
2025-06-01 18:03:40 +01:00
Martin Pulec
ab25c2d1fc audio volume format: delimiting '/' unformatted
it very slightly helps readibility
2024-09-13 15:35:44 +02:00
Martin Pulec
86e218f40a audio/utils: improved including 2024-09-13 15:35:44 +02:00
Martin Pulec
6aed0ee771 audio: unify volume statistics formatting 2024-09-13 15:35:42 +02:00
Martin Pulec
f53204dd3c audio/utils: use static_assert for endianness
Use static_assert to ensure little endian instead of the preprocessor
checks - if the those macros are not defined by the compiler, the check
will be eliminated. If other complier is used, write this more
generically.
2024-08-14 15:37:22 +02:00
Martin Pulec
50812bba34 replacing PACKAGE_BUGREPORT with bug_msg
Where the PACKAGE_BUGREPORT is the only used item from config.h,
use bug_msg(), which can be then removed.

Improved bug_msg() to allow printf-like fomat + arguments.
2024-08-14 15:26:12 +02:00
Martin Piatka
1260f9727f audio/utils: Fix leak
Coverity CID 466491
2024-07-16 12:26:05 +02:00
Martin Piatka
8d7f878fba audio: Move channel_map struct to utils 2024-07-15 16:13:25 +02:00
Martin Piatka
bcba7c0056 audio/utils: Add remux_and_mix_channel() 2024-07-15 16:13:25 +02:00
Martin Pulec
40a7d04ec1 unit_evaluate[_dbl]: added endptr param 2023-11-29 15:27:32 +01:00
Martin Pulec
63fc94e294 lavc audio: refactor a bit
factored out input data processing to a separate function
2023-10-16 16:19:56 +02:00
Martin Pulec
04610b4357 format_to_out_bps: document
document that the functions accept value in i32 container but unscaled
2023-10-10 11:15:22 +02:00
Martin Piatka
8a9639ec7e Partial Revert "audio: simplified samples storing/loading"
The loading of samples with negative value was not working properly
because of sign expansion. The storing works fine, because samples are
only ever written with the same or less BPS.

This reverts commit 586c3fc585.
2023-10-09 14:14:46 +02:00
Martin Pulec
241840480d audio utils: get rid of rare functions 2023-09-18 15:36:57 +02:00
Martin Pulec
586c3fc585 audio: simplified samples storing/loading 2023-09-18 14:27:42 +02:00
Martin Pulec
d621284222 interleaved2noninterleaved_float: handle BPS 1
handle 1 byte case, which is unsigned and thus mus be handled separately

\+ divide the other cases with -INT32_MIN instead of INT32_MAX, to avoid
value < -1.0 if the sample value is INT32_MIN (but as the computation is
done in floats, both values will likely to be rounded to the same number)
2023-09-08 16:15:05 +02:00
Martin Pulec
356be2d0e5 audio: small improvements 2023-09-08 15:25:25 +02:00
Martin Pulec
fa60441fde display file: make other audio compress working
Make working compressions other than Opus, taking sample format other
than S16 (interleaved).

Accept also S16P and FLTP (needed for AAC, MP3, Vorbis).

\+ also process stereo input (as currently only mono are accepted)
2023-09-07 16:07:44 +02:00
Martin Pulec
fd3c7afe8f removed short_int2float
- not used
- in documentation there was incorrectly stated that in and out can
overlap; perhaps a C&P from int2float doc because it doesn' seem to be
true - first written float overrides second read short so on
2023-09-06 14:39:49 +02:00
Martin Pulec
97de457eaf audio cap.: limit user given values
Limit user-specified sampling rate and channel count to values defined
by pixel format.
2023-08-07 16:38:02 +02:00
Martin Pulec
be4f6434ec audio capture format: accept shortened options 2023-08-07 14:21:52 +02:00
Martin Piatka
b257c72d99 audio utils: calculate_rms() for audio_frame 2022-11-29 12:53:24 +01:00
Martin Pulec
762216f579 split setting audio capture format from parsing
Since it was seting global variables, the advantage is also that
set_audio_capture_format is now simplier.
2022-10-18 08:23:19 +02:00
Martin Pulec
a672e61311 audio testcard: moved to C 2022-10-10 12:00:42 +02:00
Martin Piatka
b71c4e633d audio/utils: Add missing include for std::clamp() 2022-07-29 13:03:25 +02:00
Martin Pulec
6729a8a1ad audio: use const audio_frame 2022-05-25 17:09:42 +02:00
Martin Piatka
ef0806da14 audio dithering: Fix some problems
* Replace bit shift with integer division - Shifting doesn't behave
nicely for negative numbers, for example -2 >> 8 equals -1. This
introduces distortion

* Use rounding from 0.5 up - Truncating introduces distortion, because
the interval of numbers that round to 0 is disproportionaly big (-1, 1).

* Replace random number generation with a faster algorithm

With all theese changes, the code is also a bit faster.
2022-02-09 12:04:05 +01:00
Martin Pulec
505e648b8a chage_bps2: small fixes
- if in/out bps matches, use memcpy
- static assert implementation-defined behavior we depend on
  (right-shifting negative LHS)
2022-02-08 08:37:32 +01:00
Martin Pulec
5d1a5dc1ad audio utils: option to disable dithering
In special cases (eg. 8-bit audio), user may want to opt out from
dithering because the artifacts may be more acceptable than the noise.
2022-02-08 08:37:32 +01:00
Martin Pulec
c9c1152dec simplify flow in change_bps() 2022-02-08 08:37:29 +01:00
Martin Piatka
0230ed201d audio/utils: change_bps: add dithering
By reducing bit-depth of audio, quantization noise is introduced. If the
bit depth is reduced by consistent rounding (either always down, always
up, or always to nearest) the quantization noise is correlated with the
input signal and percieved as distortion. Adding a small amount of noise
to the input signal before reducing the bit-depth causes random
rounding, which makes the noise uncorrelated and uniformly spread
through the whole spectrum.
2022-01-13 11:54:46 +01:00
Martin Pulec
1b3b27eb7c Updated copyright dates for modified files 2021-11-08 15:43:14 +01:00
Martin Pulec
c35083fa91 Suppress clang warnings 2021-09-08 08:25:10 +02:00
Martin Pulec
8f557a97d6 Replaced audio/audio.h with audio/types.h includes
audio/audio.h should not be used as a catch-all header for audio.
2021-08-11 15:58:58 +02:00
Martin Pulec
e6515ed4ad audio conversions: fixed const casts 2021-08-10 08:44:05 +02:00
Martin Pulec
aea78bc1b9 format_from_in_bps, format_to_out_bps - improved
Use the templated loaders for format_from_in_bps and format_to_out_bps.
2021-08-06 14:55:41 +02:00
Martin Pulec
53770ce327 Audio utils: improved prototypes + docu 2021-08-06 11:12:17 +02:00
Martin Pulec
4f9a69d4f0 calculate_rms: improved and polished
Rewrite using the new templates to avoid custom code and increase
performance.
2021-08-06 11:06:48 +02:00
Martin Pulec
4dce7d3a87 get_avg_volume: improved performance 2021-08-05 08:53:11 +02:00
Martin Piatka
9d440a15e3 audio_utils: float2int: clamp input to valid range
This avoids pops and buzzing caused by integer overflow when the input
sample falls outside of the range [-1.0, 1.0] (I encountered this when
using jack capture).
2021-04-06 16:43:28 +02:00
Martin Pulec
04e1f472bd Pipe: support for audio 2020-05-20 16:20:08 +02:00
Martin Pulec
27edf9ad71 Fixes 2019-12-04 13:28:02 +01:00
Martin Pulec
cad9f18fff File cap.: use audo_frame::dispose
Use audo_frame::dispose and remove double buffering for audio.
2019-10-24 08:36:55 +02:00
Martin Pulec
ffec41208f Added initial file input 2019-10-23 09:54:49 +02:00
Martin Pulec
8a45c78314 Fixed warnings
- added (const char *) attribute to param_u union to avoid casting away
  const warnings
- added also (const void *) and (volatile void *) for the rest
- there was a typo in computing requested_mtu causing violating sequence
  point evaluation order
- alsa_get_pcm_state_name: added attribute unused
- audio/utils.cpp: different signdness
- audio/utils.cpp: different signdness
- split capture filter: useless dispose_frame
- video_compress: not copying whole string (with strncpy)
2019-06-14 08:55:07 +02:00
Martin Pulec
315749bbe5 RTP: fix sending of RFC-compilant OPUS stream
RTP timestamp was incorrectly computed from data_len/bps which confused VLC.

+ some cleanup
2018-10-18 16:27:42 +02:00
Martin Pulec
a7830d3bc2 Fixed few warnings 2018-07-24 09:38:47 +02:00
Martin Pulec
5b3488ff8b Audio: compute RMS - fixed
Fixed incorrectly computed normalized value of sample (depending on char
signedness).
2017-10-11 14:09:35 +02:00
Martin Pulec
54d45ba489 Audio: move audio types in separate header/src 2015-08-31 11:11:04 +02:00