2017-09-26 23:25:55 -04:00
|
|
|
// Copyright (c) Charles J. Cliffe
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "AudioSinkThread.h"
|
|
|
|
#include "AudioFile.h"
|
2018-01-13 05:50:08 -05:00
|
|
|
#include "Timer.h"
|
2017-09-26 23:25:55 -04:00
|
|
|
|
|
|
|
class AudioSinkFileThread : public AudioSinkThread {
|
|
|
|
|
|
|
|
public:
|
|
|
|
AudioSinkFileThread();
|
2021-04-04 22:13:31 -04:00
|
|
|
~AudioSinkFileThread() override;
|
2017-09-26 23:25:55 -04:00
|
|
|
|
2018-01-13 05:50:08 -05:00
|
|
|
enum SquelchOption {
|
|
|
|
SQUELCH_RECORD_SILENCE = 0, // default value, record as a user would hear it.
|
|
|
|
SQUELCH_SKIP_SILENCE = 1, // skip below-squelch level.
|
|
|
|
SQUELCH_RECORD_ALWAYS = 2, // record irrespective of the squelch level.
|
|
|
|
SQUELCH_RECORD_MAX
|
|
|
|
};
|
|
|
|
|
2021-04-04 22:13:31 -04:00
|
|
|
void sink(AudioThreadInputPtr input) override;
|
|
|
|
void inputChanged(AudioThreadInput oldProps, AudioThreadInputPtr newProps) override;
|
2017-09-26 23:25:55 -04:00
|
|
|
|
2017-10-09 20:07:40 -04:00
|
|
|
void setAudioFileHandler(AudioFile *output);
|
2017-09-26 23:25:55 -04:00
|
|
|
|
2018-01-13 05:50:08 -05:00
|
|
|
void setAudioFileNameBase(const std::string& baseName);
|
|
|
|
|
|
|
|
//Squelch
|
|
|
|
void setSquelchOption(int squelchOptEnumValue);
|
|
|
|
|
|
|
|
// Time limit
|
|
|
|
void setFileTimeLimit(int nbSeconds);
|
|
|
|
|
2017-09-26 23:25:55 -04:00
|
|
|
protected:
|
2018-01-13 05:50:08 -05:00
|
|
|
|
|
|
|
std::string fileNameBase;
|
|
|
|
|
2017-10-09 20:07:40 -04:00
|
|
|
AudioFile *audioFileHandler = nullptr;
|
2017-09-26 23:25:55 -04:00
|
|
|
|
2018-01-13 05:50:08 -05:00
|
|
|
SquelchOption squelchOption = SQUELCH_RECORD_SILENCE;
|
|
|
|
int fileTimeLimit = 0;
|
|
|
|
|
|
|
|
int fileTimeDurationSeconds = -1;
|
|
|
|
|
|
|
|
Timer durationMeasurement;
|
|
|
|
|
2017-09-26 23:25:55 -04:00
|
|
|
};
|
|
|
|
|