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