LCOV - code coverage report
Current view: top level - Tools - MuteSoloBufferFilter.cpp (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 28 28 100.0 %
Date: 2021-02-18 20:07:22 Functions: 8 8 100.0 %

          Line data    Source code
       1             : /**
       2             :  * \file MuteSoloBufferFilter.cpp
       3             :  */
       4             : 
       5             : #include "MuteSoloBufferFilter.h"
       6             : #include <ATK/Core/Utilities.h>
       7             : 
       8             : #include <cmath>
       9             : #include <complex>
      10             : #include <cstdint>
      11             : 
      12             : namespace ATK
      13             : {
      14             :   template<typename DataType_>
      15          12 :   MuteSoloBufferFilter<DataType_>::MuteSoloBufferFilter(gsl::index nb_channels)
      16          12 :   :Parent(nb_channels, nb_channels), mute_statuses(nb_channels), solo_statuses(nb_channels)
      17             :   {
      18          12 :   }
      19             :   
      20             :   template<typename DataType_>
      21           8 :   void MuteSoloBufferFilter<DataType_>::process_impl(gsl::index size) const
      22             :   {
      23          37 :     for(gsl::index channel = 0; channel < nb_input_ports; ++channel)
      24             :     {
      25          29 :       const DataType* ATK_RESTRICT input = converted_inputs[channel];
      26          29 :       DataType* ATK_RESTRICT output = outputs[channel];
      27          29 :       if(mute_statuses[channel] || (any_solo && !solo_statuses[channel]))
      28             :       {
      29       10250 :         for(gsl::index i = 0; i < size; ++i)
      30             :         {
      31       10240 :           output[i] = 0;
      32             :         }
      33             :       }
      34             :       else
      35             :       {
      36       19475 :         for(gsl::index i = 0; i < size; ++i)
      37             :         {
      38       19456 :           output[i] = input[i];
      39             :         }
      40             :       }
      41             :     }
      42           8 :   }
      43             : 
      44             :   template<typename DataType_>
      45           5 :   void MuteSoloBufferFilter<DataType_>::set_mute(gsl::index channel, bool mute)
      46             :   {
      47           5 :     mute_statuses[channel] = mute;
      48           5 :   }
      49             :   
      50             :   template<typename DataType_>
      51           2 :   bool MuteSoloBufferFilter<DataType_>::get_mute(gsl::index channel) const
      52             :   {
      53           2 :     return mute_statuses[channel];
      54             :   }
      55             :   
      56             :   template<typename DataType_>
      57           7 :   void MuteSoloBufferFilter<DataType_>::set_solo(gsl::index channel, bool solo)
      58             :   {
      59           7 :     solo_statuses[channel] = solo;
      60           7 :     any_solo = solo_statuses.any();
      61           7 :   }
      62             :   
      63             :   template<typename DataType_>
      64           2 :   bool MuteSoloBufferFilter<DataType_>::get_solo(gsl::index channel) const
      65             :   {
      66           2 :     return solo_statuses[channel];
      67             :   }
      68             : 
      69             :   template<typename DataType_>
      70           1 :   void MuteSoloBufferFilter<DataType_>::set_nb_input_ports(gsl::index nb_ports)
      71             :   {
      72           1 :     throw ATK::RuntimeError("Can't change number of ports in this filter");
      73             :   }
      74             :   
      75             :   template<typename DataType_>
      76           1 :   void MuteSoloBufferFilter<DataType_>::set_nb_output_ports(gsl::index nb_ports)
      77             :   {
      78           1 :     throw ATK::RuntimeError("Can't change number of ports in this filter");
      79             :   }
      80             : 
      81             : #if ATK_ENABLE_INSTANTIATION
      82             :   template class MuteSoloBufferFilter<std::int16_t>;
      83             :   template class MuteSoloBufferFilter<std::int32_t>;
      84             :   template class MuteSoloBufferFilter<std::int64_t>;
      85             :   template class MuteSoloBufferFilter<float>;
      86             :   template class MuteSoloBufferFilter<std::complex<float>>;
      87             :   template class MuteSoloBufferFilter<std::complex<double>>;
      88             : #endif
      89             :   template class MuteSoloBufferFilter<double>;
      90             : }

Generated by: LCOV version TK-3.3.0-4-gdba42eea