mirror of
https://github.com/ggerganov/ggwave.git
synced 2026-04-21 05:36:33 +08:00
wip : proper recording length
This commit is contained in:
@@ -22,7 +22,7 @@ public:
|
|||||||
static constexpr auto kMaxDataSize = 256;
|
static constexpr auto kMaxDataSize = 256;
|
||||||
static constexpr auto kMaxLength = 140;
|
static constexpr auto kMaxLength = 140;
|
||||||
static constexpr auto kMaxSpectrumHistory = 4;
|
static constexpr auto kMaxSpectrumHistory = 4;
|
||||||
static constexpr auto kMaxRecordedFrames = 64*10;
|
static constexpr auto kMaxRecordedFrames = 1024;
|
||||||
static constexpr auto kDefaultFixedLength = 82;
|
static constexpr auto kDefaultFixedLength = 82;
|
||||||
|
|
||||||
struct TxProtocol {
|
struct TxProtocol {
|
||||||
|
|||||||
@@ -418,6 +418,7 @@ void GGWave::receive(const CBDequeueAudio & CBDequeueAudio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (analyzingData) {
|
if (analyzingData) {
|
||||||
|
printf("Analyzing captured data ..\n");
|
||||||
auto tStart = std::chrono::high_resolution_clock::now();
|
auto tStart = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
const int stepsPerFrame = 16;
|
const int stepsPerFrame = 16;
|
||||||
@@ -565,9 +566,9 @@ void GGWave::receive(const CBDequeueAudio & CBDequeueAudio) {
|
|||||||
rxData.fill(0);
|
rxData.fill(0);
|
||||||
receivingData = true;
|
receivingData = true;
|
||||||
if (txMode == TxMode::FixedLength) {
|
if (txMode == TxMode::FixedLength) {
|
||||||
recvDuration_frames = nMarkerFrames + nPostMarkerFrames + maxFramesPerTx()*((kDefaultFixedLength + maxECCBytesPerTx())/minBytesPerTx() + 1);
|
recvDuration_frames = 2*nMarkerFrames + nPostMarkerFrames + maxFramesPerTx()*((kDefaultFixedLength + maxECCBytesPerTx())/minBytesPerTx() + 1);
|
||||||
} else {
|
} else {
|
||||||
recvDuration_frames = nMarkerFrames + nPostMarkerFrames + maxFramesPerTx()*((kMaxLength + ::getECCBytesForLength(kMaxLength))/minBytesPerTx() + 1);
|
recvDuration_frames = 2*nMarkerFrames + nPostMarkerFrames + maxFramesPerTx()*((kMaxLength + ::getECCBytesForLength(kMaxLength))/minBytesPerTx() + 1);
|
||||||
}
|
}
|
||||||
framesToRecord = recvDuration_frames;
|
framesToRecord = recvDuration_frames;
|
||||||
framesLeftToRecord = recvDuration_frames;
|
framesLeftToRecord = recvDuration_frames;
|
||||||
@@ -587,7 +588,7 @@ void GGWave::receive(const CBDequeueAudio & CBDequeueAudio) {
|
|||||||
|
|
||||||
if (isEnded && framesToRecord > 1) {
|
if (isEnded && framesToRecord > 1) {
|
||||||
std::time_t timestamp = std::time(nullptr);
|
std::time_t timestamp = std::time(nullptr);
|
||||||
printf("%sReceived end marker\n", std::asctime(std::localtime(×tamp)));
|
printf("%sReceived end marker. Frames left = %d\n", std::asctime(std::localtime(×tamp)), framesLeftToRecord);
|
||||||
recvDuration_frames -= framesLeftToRecord - 1;
|
recvDuration_frames -= framesLeftToRecord - 1;
|
||||||
framesLeftToRecord = 1;
|
framesLeftToRecord = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user