|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Static utility for Mid/Side stereo encoding and decoding. More...
#include <MidSide.h>
Static Public Member Functions | |
| static constexpr void | encodeSample (T &left_mid, T &right_side) noexcept |
| Encodes a single sample frame from Left/Right to Mid/Side in-place. | |
| static constexpr void | decodeSample (T &mid_left, T &side_right) noexcept |
| Decodes a single sample frame from Mid/Side to Left/Right in-place. | |
| static void | encode (AudioBufferView< T > buffer) noexcept |
| Encodes an entire stereo buffer from Left/Right to Mid/Side. | |
| static void | decode (AudioBufferView< T > buffer) noexcept |
| Decodes an entire stereo buffer from Mid/Side back to Left/Right. | |
Static utility for Mid/Side stereo encoding and decoding.
Buffers with fewer than two channels are left untouched (release-safe no-op); channels beyond the first two are ignored.
| T | Sample type (float or double). |
|
inlinestaticnoexcept |
Decodes an entire stereo buffer from Mid/Side back to Left/Right.
L = M + S R = M - S
| buffer | Stereo buffer (2 channels, containing M/S). Modified in-place. Fewer than 2 channels: no-op. |
|
inlinestaticconstexprnoexcept |
|
inlinestaticnoexcept |
Encodes an entire stereo buffer from Left/Right to Mid/Side.
M = (L + R) * 0.5 S = (L - R) * 0.5
The 0.5 scaling preserves peak amplitude (unity round-trip gain) and avoids clipping when summing highly correlated signals.
| buffer | Stereo buffer (2 channels). Modified in-place. Fewer than 2 channels: no-op. |
|
inlinestaticconstexprnoexcept |
Encodes a single sample frame from Left/Right to Mid/Side in-place.
Useful for interleaving M/S processing inside a custom DSP loop to maintain L1/L2 cache locality and avoid multi-pass buffer traversals. Bit-identical to encode() applied to the same frame.
| left_mid | Reference to the left sample (becomes mid). |
| right_side | Reference to the right sample (becomes side). |