2 * Copyright (c) 2005 Boris Mikhaylov
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 /* Normal crossfeed levels */
38 /* Easy crossfeed levels */
43 DefaultCLevel
= HighECLevel
47 int level
{}; /* Crossfeed level */
48 int srate
{}; /* Sample rate (Hz) */
50 /* Lowpass IIR filter coefficients */
54 /* Highboost IIR filter coefficients */
59 /* Buffer of filter history
60 * [0] - first channel, [1] - second channel
62 struct t_last_sample
{
66 std::array
<t_last_sample
,2> history
{};
68 /* Clear buffers and set new coefficients with new crossfeed level and
70 * level - crossfeed level of *Level enum values.
71 * srate - sample rate by Hz.
73 void set_params(int level
, int srate
);
75 /* Return current crossfeed level value */
76 [[nodiscard
]] auto get_level() const noexcept
-> int { return level
; }
78 /* Return current sample rate value */
79 [[nodiscard
]] auto get_srate() const noexcept
-> int { return srate
; }
84 void cross_feed(float *Left
, float *Right
, std::size_t SamplesToDo
);
89 #endif /* CORE_BS2B_H */