mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-12 14:37:21 +03:00
move to new cspot
This commit is contained in:
40
components/spotify/cspot/bell/main/audio-dsp/include/Gain.h
Normal file
40
components/spotify/cspot/bell/main/audio-dsp/include/Gain.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <mutex>
|
||||
#include <iostream>
|
||||
|
||||
#include "AudioTransform.h"
|
||||
|
||||
namespace bell
|
||||
{
|
||||
class Gain : public bell::AudioTransform
|
||||
{
|
||||
private:
|
||||
float gainFactor = 1.0f;
|
||||
|
||||
std::vector<int> channels;
|
||||
|
||||
public:
|
||||
Gain();
|
||||
~Gain() {};
|
||||
|
||||
float gainDb = 0.0;
|
||||
|
||||
void configure(std::vector<int> channels, float gainDB);
|
||||
|
||||
std::unique_ptr<StreamInfo> process(std::unique_ptr<StreamInfo> data) override;
|
||||
|
||||
void reconfigure() override {
|
||||
std::scoped_lock lock(this->accessMutex);
|
||||
float gain = config->getFloat("gain");
|
||||
this->channels = config->getChannels();
|
||||
|
||||
if (gainDb == gain) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->configure(channels, gain);
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user