mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-03-16 23:45:59 +08:00
ggwave : add default samples per frame
This commit is contained in:
@@ -227,7 +227,7 @@ bool GGWave_init(
|
||||
g_ggWave = new GGWave(
|
||||
g_obtainedSpecIn.freq,
|
||||
g_obtainedSpecOut.freq,
|
||||
1024,
|
||||
GGWave::kDefaultSamplesPerFrame,
|
||||
sampleSizeBytesIn,
|
||||
sampleSizeBytesOut);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
class GGWave {
|
||||
public:
|
||||
static constexpr auto kBaseSampleRate = 48000.0;
|
||||
static constexpr auto kDefaultSamplesPerFrame = 1024;
|
||||
static constexpr auto kMaxSamplesPerFrame = 1024;
|
||||
static constexpr auto kMaxDataBits = 256;
|
||||
static constexpr auto kMaxDataSize = 256;
|
||||
@@ -54,6 +55,7 @@ public:
|
||||
int samplesPerFrame,
|
||||
int sampleSizeBytesIn,
|
||||
int sampleSizeBytesOut);
|
||||
|
||||
~GGWave();
|
||||
|
||||
bool init(int textLength, const char * stext, const TxProtocol & aProtocol, const int volume);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <chrono>
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -163,6 +164,10 @@ GGWave::GGWave(
|
||||
m_outputBlock(kMaxSamplesPerFrame),
|
||||
m_outputBlock16(kMaxRecordedFrames*kMaxSamplesPerFrame)
|
||||
{
|
||||
if (samplesPerFrame > kMaxSamplesPerFrame) {
|
||||
throw std::runtime_error("Invalid samples per frame");
|
||||
}
|
||||
|
||||
init(0, "", getDefultTxProtocol(), 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user