LCOV - code coverage report
Current view: top level - src/audio/engine - audio_engine_api.cpp (source / functions) Coverage Total Hit
Test: merged.info Lines: 81.8 % 44 36
Test Date: 2026-06-07 15:51:50 Functions: 92.9 % 14 13

            Line data    Source code
       1              : #include <algorithm>
       2              : #include <cstring>
       3              : 
       4              : #include "audio/engine/analyzer_capture.h"
       5              : #include "audio/engine/audio_engine.h"
       6              : 
       7              : namespace Amplitron {
       8              : 
       9          285 : void AudioEngine::set_input_gain(float gain) {
      10          285 :     command_dispatcher_.push_input_gain(gain);
      11          285 :     input_gain_.store(gain, std::memory_order_relaxed);
      12          285 : }
      13              : 
      14          237 : void AudioEngine::set_output_gain(float gain) {
      15          237 :     command_dispatcher_.push_output_gain(gain);
      16          237 :     output_gain_.store(gain, std::memory_order_relaxed);
      17          237 : }
      18              : 
      19           15 : void AudioEngine::toggle_metronome() { metronome_->toggle(); }
      20              : 
      21           18 : void AudioEngine::set_metronome_bpm(int bpm) { metronome_->set_bpm(bpm); }
      22              : 
      23           12 : void AudioEngine::set_metronome_volume(float volume) { metronome_->set_volume(volume); }
      24              : 
      25           30 : void AudioEngine::push_param_change(int effect_index, int param_index, float value) {
      26           30 :     command_dispatcher_.push_param_change(effect_index, param_index, value);
      27           30 : }
      28              : 
      29           21 : void AudioEngine::push_effect_enabled(int effect_index, float enabled) {
      30           21 :     command_dispatcher_.push_effect_enabled(effect_index, enabled);
      31           21 : }
      32              : 
      33            6 : void AudioEngine::push_effect_mix(int effect_index, float mix) {
      34            6 :     command_dispatcher_.push_effect_mix(effect_index, mix);
      35            6 : }
      36              : 
      37            0 : void AudioEngine::push_mixer_gain_change(int node_id, int pin_index, float gain) {
      38            0 :     command_dispatcher_.push_mixer_gain_change(node_id, pin_index, gain);
      39            0 : }
      40              : 
      41            9 : int AudioEngine::get_suggested_buffer_size() const {
      42            9 :     float load = cpu_load_.load(std::memory_order_relaxed);
      43            9 :     int current = buffer_size_;
      44              : 
      45            9 :     if (load > 0.80f) {
      46            0 :         if (current < MAX_BUFFER_SIZE) {
      47            0 :             return std::min(current * 2, MAX_BUFFER_SIZE);
      48              :         }
      49            0 :     }
      50            9 :     if (load < 0.30f) {
      51            9 :         if (current > MIN_BUFFER_SIZE) {
      52           12 :             return std::max(current / 2, MIN_BUFFER_SIZE);
      53              :         }
      54            0 :     }
      55            0 :     return current;
      56            3 : }
      57              : 
      58           12 : void AudioEngine::set_analyzer_enabled(bool enabled) {
      59           12 :     analyzer_capture_->set_analyzer_enabled(enabled);
      60           12 : }
      61              : 
      62           15 : bool AudioEngine::is_analyzer_enabled() const { return analyzer_capture_->is_analyzer_enabled(); }
      63              : 
      64            3 : uint64_t AudioEngine::get_analyzer_sequence() const {
      65            3 :     return analyzer_capture_->get_analyzer_sequence();
      66              : }
      67              : 
      68           18 : bool AudioEngine::copy_analyzer_snapshot(float* input_dest, float* output_dest,
      69              :                                          int sample_count) const {
      70           18 :     return analyzer_capture_->copy_analyzer_snapshot(input_dest, output_dest, sample_count);
      71              : }
      72              : 
      73              : }  // namespace Amplitron
        

Generated by: LCOV version 2.0-1