Line data Source code
1 : /** 2 : * \file MuteSoloBufferFilter.h 3 : */ 4 : 5 : #ifndef ATK_TOOLS_MUTESOLOBUFFERFILTER_H 6 : #define ATK_TOOLS_MUTESOLOBUFFERFILTER_H 7 : 8 : #include <ATK/Core/TypedBaseFilter.h> 9 : #include <ATK/Tools/config.h> 10 : 11 : #include <boost/dynamic_bitset.hpp> 12 : 13 : namespace ATK 14 : { 15 : /// Buffers input signals 16 : /** 17 : * Class that buffers input signal and allows mute/solo operations 18 : */ 19 : template<typename DataType_> 20 : class ATK_TOOLS_EXPORT MuteSoloBufferFilter final : public TypedBaseFilter<DataType_> 21 : { 22 : protected: 23 : /// Simplify parent calls 24 : using Parent = TypedBaseFilter<DataType_>; 25 : using typename Parent::DataType; 26 : using Parent::converted_inputs; 27 : using Parent::outputs; 28 : using Parent::nb_input_ports; 29 : using Parent::nb_output_ports; 30 : 31 : public: 32 : /*! 33 : * @brief Constructor 34 : * @param nb_channels is the number of input and output channels 35 : */ 36 : explicit MuteSoloBufferFilter(gsl::index nb_channels = 1); 37 : /// Destructor 38 12 : ~MuteSoloBufferFilter() override = default; 39 : 40 : /// Mutes/unmutes a given channel (outputs 0) 41 : void set_mute(gsl::index channel, bool mute); 42 : /// Returns the mute status of a channel 43 : bool get_mute(gsl::index channel) const; 44 : /// Soloes/unsoloes a given channel (outputs 0 on the other non soloed channels) 45 : void set_solo(gsl::index channel, bool solo); 46 : /// Returns the solo status of a channel 47 : bool get_solo(gsl::index channel) const; 48 : 49 : void set_nb_input_ports(gsl::index nb_ports) final; 50 : void set_nb_output_ports(gsl::index nb_ports) final; 51 : 52 : protected: 53 : void process_impl(gsl::index size) const final; 54 : 55 : private: 56 : boost::dynamic_bitset<> mute_statuses; 57 : boost::dynamic_bitset<> solo_statuses; 58 : bool any_solo = false; 59 : }; 60 : } 61 : 62 : #endif