2424
2525// adaptation of WAVSourceAVX2 to support CPUs without AVX2
2626// see comments of WAVSourceAVX2
27+ // FIXME: this specialization should be removed.
28+ // The only CPUs with FMA3 but not AVX2 are ancient AMD chips that prefer SSE code anyway.
2729void WAVSourceAVX::tick_spectrum ([[maybe_unused]] float seconds)
2830{
2931 // std::lock_guard lock(m_mtx); // now locked in tick()
@@ -114,7 +116,7 @@ void WAVSourceAVX::tick_spectrum([[maybe_unused]] float seconds)
114116 constexpr auto shuffle_mask_r = 0 | (2 << 2 ) | (0 << 4 ) | (2 << 6 );
115117 constexpr auto shuffle_mask_i = 1 | (3 << 2 ) | (1 << 4 ) | (3 << 6 );
116118 const auto mag_coefficient = _mm256_set1_ps (2 .0f / m_window_sum);
117- const auto g = _mm256_set1_ps (m_gravity );
119+ const auto g = _mm256_set1_ps (get_gravity (seconds) );
118120 const auto g2 = _mm256_sub_ps (_mm256_set1_ps (1.0 ), g);
119121 const bool slope = m_slope > 0 .0f ;
120122 for (size_t i = 0 ; i < outsz; i += step)
@@ -138,7 +140,7 @@ void WAVSourceAVX::tick_spectrum([[maybe_unused]] float seconds)
138140 if (slope)
139141 mag = _mm256_mul_ps (mag, _mm256_load_ps (&m_slope_modifiers[i]));
140142
141- if (m_tsmoothing == TSmoothingMode::EXPONENTIAL )
143+ if (m_tsmoothing != TSmoothingMode::NONE )
142144 {
143145 auto oldval = _mm256_load_ps (&m_tsmooth_buf[channel][i]);
144146 if (m_fast_peaks)
@@ -280,9 +282,9 @@ void WAVSourceAVX::tick_meter([[maybe_unused]] float seconds)
280282 out = horizontal_max (_mm256_max_ps (max1, max2));
281283 }
282284
283- if (m_tsmoothing == TSmoothingMode::EXPONENTIAL )
285+ if (m_tsmoothing != TSmoothingMode::NONE )
284286 {
285- const auto g = m_gravity ;
287+ const auto g = get_gravity (seconds) ;
286288 const auto g2 = 1 .0f - g;
287289 if (!m_fast_peaks || (out <= m_meter_buf[channel]))
288290 out = (g * m_meter_buf[channel]) + (g2 * out);
0 commit comments