LCOV - code coverage report
Current view: top level - src/audio/backend - jack_backend.h (source / functions) Coverage Total Hit
Test: merged.info Lines: 66.7 % 6 4
Test Date: 2026-06-07 15:51:50 Functions: 66.7 % 6 4

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include "audio/backend/i_audio_backend.h"
       4              : 
       5              : #ifdef WITH_JACK
       6              : #include <jack/jack.h>
       7              : #endif
       8              : 
       9              : namespace Amplitron {
      10              : 
      11              : class JackBackend : public IAudioBackend {
      12              :    public:
      13              :     JackBackend();
      14              :     ~JackBackend() override;
      15              : 
      16              :     bool initialize(IAudioEngine* engine) override;
      17              :     void shutdown() override;
      18              :     bool start() override;
      19              :     void stop() override;
      20              : 
      21              :     std::vector<AudioDeviceInfo> get_input_devices() const override;
      22              :     std::vector<AudioDeviceInfo> get_output_devices() const override;
      23              : 
      24              :     bool set_input_device(int device_index) override;
      25              :     bool set_output_device(int device_index) override;
      26              : 
      27              :     std::string get_input_device_name() const override;
      28              :     std::string get_output_device_name() const override;
      29              : 
      30              :     int get_sample_rate() const override;
      31              :     int get_buffer_size() const override;
      32              : 
      33            0 :     int get_input_device() const override { return 0; }
      34            0 :     int get_output_device() const override { return 0; }
      35              : 
      36              : #ifdef WITH_JACK
      37            1 :     jack_client_t* get_client() const { return client_; }
      38            1 :     jack_port_t* get_in_port() const { return in_port_; }
      39            1 :     jack_port_t* get_out_port() const { return out_port_; }
      40            2 :     IAudioEngine* get_engine() const { return engine_; }
      41              : #endif
      42              : 
      43              :    private:
      44              :     IAudioEngine* engine_ = nullptr;
      45              :     bool initialized_ = false;
      46              :     bool running_ = false;
      47              : 
      48              : #ifdef WITH_JACK
      49              :     jack_client_t* client_ = nullptr;
      50              :     jack_port_t* in_port_ = nullptr;
      51              :     jack_port_t* out_port_ = nullptr;
      52              :     bool ports_registered_ = false;
      53              : #endif
      54              : };
      55              : 
      56              : }  // namespace Amplitron
        

Generated by: LCOV version 2.0-1