Tuner display

This commit is contained in:
Robin Davies
2022-07-05 09:33:37 -04:00
parent 95e5cd1301
commit 2133403f7e
10 changed files with 426 additions and 260 deletions
+20 -17
View File
@@ -20,11 +20,15 @@
#pragma once
#include <cstdint>
#include "json.hpp"
#include "AudioConfig.hpp"
namespace pipedal {
namespace pipedal
{
// Jack Daemon configuration.
class JackServerSettings {
class JackServerSettings
{
bool valid_ = false;
bool isJackAudio_ = JACK_HOST ? true : false;
bool rebootRequired_ = false;
std::string alsaDevice_;
uint64_t sampleRate_ = 0;
@@ -33,20 +37,21 @@ namespace pipedal {
public:
JackServerSettings();
JackServerSettings(const std::string alsaDevice, uint64_t sampleRate, uint32_t bufferSize, uint32_t numberOfBuffers)
: valid_(true),
alsaDevice_(alsaDevice),
sampleRate_(sampleRate),
bufferSize_(bufferSize),
numberOfBuffers_(numberOfBuffers)
JackServerSettings(
const std::string alsaInputDevice,
uint64_t sampleRate, uint32_t bufferSize, uint32_t numberOfBuffers)
: valid_(true),
alsaDevice_(alsaInputDevice),
sampleRate_(sampleRate),
bufferSize_(bufferSize),
numberOfBuffers_(numberOfBuffers)
{
}
uint64_t GetSampleRate() const { return sampleRate_; }
uint32_t GetBufferSize() const { return bufferSize_; }
uint32_t GetNumberOfBuffers() const { return numberOfBuffers_; }
const std::string&GetAlsaDevice() const { return alsaDevice_; }
const std::string &GetAlsaInputDevice() const { return alsaDevice_; }
void ReadJackConfiguration();
@@ -56,22 +61,20 @@ namespace pipedal {
{
this->valid_ = true;
this->rebootRequired_ = true;
this->sampleRate_ = sampleRate; this->bufferSize_ = bufferSize; this->numberOfBuffers_ = numberOfBuffers;
this->sampleRate_ = sampleRate;
this->bufferSize_ = bufferSize;
this->numberOfBuffers_ = numberOfBuffers;
}
void Write(); // requires root perms.
void SetRebootRequired(bool value)
{
rebootRequired_ = value;
}
bool Equals(const JackServerSettings&other)
bool Equals(const JackServerSettings &other)
{
return this->sampleRate_ == other.sampleRate_
&& this->bufferSize_ == other.bufferSize_
&& this->numberOfBuffers_ == other.numberOfBuffers_;
return this->alsaDevice_ == other.alsaDevice_ && this->sampleRate_ == other.sampleRate_ && this->bufferSize_ == other.bufferSize_ && this->numberOfBuffers_ == other.numberOfBuffers_;
}
DECLARE_JSON_MAP(JackServerSettings);
};
} // namespace