audio-algo-river/audio/algo/river/Suppressor.hpp

95 lines
2.8 KiB
C++
Raw Normal View History

2015-04-24 21:22:56 +02:00
/** @file
* @author Edouard DUPIN
* @author Fatima MARFOUQ
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
2015-04-24 21:22:56 +02:00
*/
#pragma once
2015-04-24 21:22:56 +02:00
2016-10-02 20:49:48 +02:00
#include <etk/types.hpp>
2017-09-26 15:57:44 +02:00
#include <echrono/Steady.hpp>
2016-10-02 20:49:48 +02:00
#include <audio/format.hpp>
#include <ememory/memory.hpp>
2015-04-24 21:22:56 +02:00
namespace audio {
namespace algo {
namespace river {
class SupressorPrivate;
/**
* @brief Supressor is a simple Algo that remove data from the microphone when the speaker is active.
*/
class Supressor {
public:
/**
* @brief Constructor
*/
Supressor();
/**
* @brief Destructor
*/
virtual ~Supressor();
public:
/**
* @brief Reset algorithm
*/
virtual void reset();
/**
* @brief Initialize the Algorithm
* @param[in] _nbChannel Number of channel in the stream.
* @param[in] _sampleRate Sample rate.
* @param[in] _format Input/output data format.
*/
virtual void init(int8_t _nbChannel, float _sampleRate, enum audio::format _format = audio::format_float);
/**
* @brief Get list of format suported in input.
* @return list of supported format
*/
2017-08-28 00:07:53 +02:00
virtual etk::Vector<enum audio::format> getSupportedFormat();
2015-04-24 21:22:56 +02:00
/**
* @brief Get list of algorithm format suported. No format convertion.
* @return list of supported format
*/
2017-08-28 00:07:53 +02:00
virtual etk::Vector<enum audio::format> getNativeSupportedFormat();
2015-04-24 21:22:56 +02:00
/**
* @brief Main input algo process.
* @param[in,out] _output Output data.
* @param[in] _input Input data.
* @param[in] _inputFeedback Input feedback data (all time MONO).
* @param[in] _nbChunk Number of chunk in the input buffer.
* @param[in] _nbChannel Number of channel in the stream.
*/
virtual void process(void* _output, const void* _input, const void* _inputFeedback, size_t _nbChunk);
protected:
2016-07-19 21:43:58 +02:00
ememory::SharedPtr<SupressorPrivate> m_private; // private data.
2015-04-24 21:22:56 +02:00
public: // parameter area:
/**
* @brief Set the algo attaque time.
* @param[in] _time Time of the attaque gain.
*/
2017-09-26 15:57:44 +02:00
virtual void setAttaqueTime(echrono::microseconds _time);
2015-04-24 21:22:56 +02:00
/**
* @brief Set the algo release time.
* @param[in] _time Time of the release gain.
*/
2017-09-26 15:57:44 +02:00
virtual void setReleaseTime(echrono::microseconds _time);
2015-04-24 21:22:56 +02:00
/**
* @brief Set the minimum Gain.
* @param[in] _gain dB gain to apply for minimum.
*/
virtual void setMinimumGain(float _gain);
/**
* @brief Set the threashold Gain.
* @param[in] _gain dB gain to start removing data.
*/
virtual void setThreshold(float _gain);
/**
* @brief Set the delay befor releasing time.
* @param[in] _time Time of the dalay release.
*/
2017-09-26 15:57:44 +02:00
virtual void setReleaseDelay(echrono::microseconds _time);
2015-04-24 21:22:56 +02:00
};
}
}
}