mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Tx ph.1: Added FileSink (2) compiles. Added plugin/samplesink in all builds
This commit is contained in:
parent
6c82c36958
commit
fbb816ebdf
@ -2,3 +2,4 @@ project(plugins)
|
||||
|
||||
add_subdirectory(channelrx)
|
||||
add_subdirectory(samplesource)
|
||||
add_subdirectory(samplesink)
|
||||
|
4
plugins/samplesink/CMakeLists.txt
Normal file
4
plugins/samplesink/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
project(samplesink)
|
||||
|
||||
add_subdirectory(filesink)
|
||||
|
@ -47,7 +47,6 @@ FileSinkGui::FileSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent) :
|
||||
m_startingTimeStamp(0),
|
||||
m_samplesCount(0),
|
||||
m_tickCount(0),
|
||||
m_enableNavTime(false),
|
||||
m_lastEngineState((DSPDeviceSinkEngine::State)-1)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -234,16 +233,16 @@ void FileSinkGui::updateStatus()
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
case DSPDeviceSourceEngine::StNotStarted:
|
||||
case DSPDeviceSinkEngine::StNotStarted:
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StIdle:
|
||||
case DSPDeviceSinkEngine::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StRunning:
|
||||
case DSPDeviceSinkEngine::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StError:
|
||||
case DSPDeviceSinkEngine::StError:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
|
||||
QMessageBox::information(this, tr("Message"), m_deviceAPI->errorMessage());
|
||||
break;
|
||||
@ -283,16 +282,12 @@ void FileSinkGui::configureFileName()
|
||||
|
||||
void FileSinkGui::updateWithGeneration()
|
||||
{
|
||||
ui->play->setEnabled(m_generation);
|
||||
ui->play->setChecked(m_generation);
|
||||
ui->showFileDialog->setEnabled(!m_generation);
|
||||
}
|
||||
|
||||
void FileSinkGui::updateWithStreamData()
|
||||
{
|
||||
ui->centerFrequency->setValue(m_centerFrequency/1000);
|
||||
ui->sampleRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
|
||||
ui->play->setEnabled(m_generation);
|
||||
}
|
||||
|
||||
void FileSinkGui::updateWithStreamTime()
|
||||
|
@ -27,7 +27,7 @@ class DeviceSinkAPI;
|
||||
class DeviceSampleSink;
|
||||
|
||||
namespace Ui {
|
||||
class FileSourceGui;
|
||||
class FileSinkGui;
|
||||
}
|
||||
|
||||
class FileSinkGui : public QWidget, public PluginGUI {
|
||||
@ -49,7 +49,7 @@ public:
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
private:
|
||||
Ui::FileSourceGui* ui;
|
||||
Ui::FileSinkGui* ui;
|
||||
|
||||
DeviceSinkAPI* m_deviceAPI;
|
||||
FileSinkOutput::Settings m_settings;
|
||||
|
@ -30,7 +30,6 @@
|
||||
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkName, Message)
|
||||
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkWork, Message)
|
||||
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkSeek, Message)
|
||||
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgConfigureFileSinkStreamTiming, Message)
|
||||
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgReportFileSinkGeneration, Message)
|
||||
MESSAGE_CLASS_DEFINITION(FileSinkOutput::MsgReportFileSinkStreamData, Message)
|
||||
@ -74,12 +73,11 @@ bool FileSinkOutput::Settings::deserialize(const QByteArray& data)
|
||||
|
||||
FileSinkOutput::FileSinkOutput(const QTimer& masterTimer) :
|
||||
m_settings(),
|
||||
m_fileSourceThread(0),
|
||||
m_fileSinkThread(0),
|
||||
m_deviceDescription(),
|
||||
m_fileName("..."),
|
||||
m_sampleRate(0),
|
||||
m_centerFrequency(0),
|
||||
m_recordLength(0),
|
||||
m_startingTimeStamp(0),
|
||||
m_masterTimer(masterTimer)
|
||||
{
|
||||
@ -126,15 +124,15 @@ bool FileSinkOutput::start(int device)
|
||||
|
||||
//openFileStream();
|
||||
|
||||
if((m_fileSourceThread = new FileSinkThread(&m_ifstream, &m_sampleFifo)) == 0) {
|
||||
if((m_fileSinkThread = new FileSinkThread(&m_ofstream, &m_sampleSourceFifo)) == 0) {
|
||||
qFatal("out of memory");
|
||||
stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fileSourceThread->setSamplerate(m_sampleRate);
|
||||
m_fileSourceThread->connectTimer(m_masterTimer);
|
||||
m_fileSourceThread->startWork();
|
||||
m_fileSinkThread->setSamplerate(m_sampleRate);
|
||||
m_fileSinkThread->connectTimer(m_masterTimer);
|
||||
m_fileSinkThread->startWork();
|
||||
m_deviceDescription = "FileSink";
|
||||
|
||||
mutexLocker.unlock();
|
||||
@ -152,11 +150,11 @@ void FileSinkOutput::stop()
|
||||
qDebug() << "FileSourceInput::stop";
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if(m_fileSourceThread != 0)
|
||||
if(m_fileSinkThread != 0)
|
||||
{
|
||||
m_fileSourceThread->stopWork();
|
||||
delete m_fileSourceThread;
|
||||
m_fileSourceThread = 0;
|
||||
m_fileSinkThread->stopWork();
|
||||
delete m_fileSinkThread;
|
||||
m_fileSinkThread = 0;
|
||||
}
|
||||
|
||||
m_deviceDescription.clear();
|
||||
@ -199,11 +197,11 @@ bool FileSinkOutput::handleMessage(const Message& message)
|
||||
MsgConfigureFileSinkWork& conf = (MsgConfigureFileSinkWork&) message;
|
||||
bool working = conf.isWorking();
|
||||
|
||||
if (m_fileSourceThread != 0)
|
||||
if (m_fileSinkThread != 0)
|
||||
{
|
||||
if (working)
|
||||
{
|
||||
m_fileSourceThread->startWork();
|
||||
m_fileSinkThread->startWork();
|
||||
/*
|
||||
MsgReportFileSourceStreamTiming *report =
|
||||
MsgReportFileSourceStreamTiming::create(m_fileSourceThread->getSamplesCount());
|
||||
@ -211,27 +209,19 @@ bool FileSinkOutput::handleMessage(const Message& message)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fileSourceThread->stopWork();
|
||||
m_fileSinkThread->stopWork();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureFileSinkSeek::match(message))
|
||||
{
|
||||
MsgConfigureFileSinkSeek& conf = (MsgConfigureFileSinkSeek&) message;
|
||||
int seekPercentage = conf.getPercentage();
|
||||
seekFileStream(seekPercentage);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureFileSinkStreamTiming::match(message))
|
||||
{
|
||||
MsgReportFileSinkStreamTiming *report;
|
||||
|
||||
if (m_fileSourceThread != 0)
|
||||
if (m_fileSinkThread != 0)
|
||||
{
|
||||
report = MsgReportFileSinkStreamTiming::create(m_fileSourceThread->getSamplesCount());
|
||||
report = MsgReportFileSinkStreamTiming::create(m_fileSinkThread->getSamplesCount());
|
||||
getOutputMessageQueueToGUI()->push(report);
|
||||
}
|
||||
|
||||
|
@ -114,26 +114,6 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgConfigureFileSinkSeek : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
int getPercentage() const { return m_seekPercentage; }
|
||||
|
||||
static MsgConfigureFileSinkSeek* create(int seekPercentage)
|
||||
{
|
||||
return new MsgConfigureFileSinkSeek(seekPercentage);
|
||||
}
|
||||
|
||||
protected:
|
||||
int m_seekPercentage; //!< percentage of seek position from the beginning 0..100
|
||||
|
||||
MsgConfigureFileSinkSeek(int seekPercentage) :
|
||||
Message(),
|
||||
m_seekPercentage(seekPercentage)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgReportFileSinkGeneration : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
@ -222,7 +202,7 @@ private:
|
||||
QMutex m_mutex;
|
||||
Settings m_settings;
|
||||
std::ofstream m_ofstream;
|
||||
FileSinkThread* m_fileSourceThread;
|
||||
FileSinkThread* m_fileSinkThread;
|
||||
QString m_deviceDescription;
|
||||
QString m_fileName;
|
||||
int m_sampleRate;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "dsp/samplesourcefifo.h"
|
||||
#include "filesinkthread.h"
|
||||
|
||||
FileSinkThread::FileSinkThread(std::ofstream *samplesStream, SampleSinkFifo* sampleFifo, QObject* parent) :
|
||||
FileSinkThread::FileSinkThread(std::ofstream *samplesStream, SampleSourceFifo* sampleFifo, QObject* parent) :
|
||||
QThread(parent),
|
||||
m_running(false),
|
||||
m_ofstream(samplesStream),
|
||||
@ -30,6 +30,7 @@ FileSinkThread::FileSinkThread(std::ofstream *samplesStream, SampleSinkFifo* sam
|
||||
m_bufsize(0),
|
||||
m_samplesChunkSize(0),
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_samplesCount(0),
|
||||
m_samplerate(0),
|
||||
m_throttlems(FILESINK_THROTTLE_MS),
|
||||
m_throttleToggle(false)
|
||||
@ -129,6 +130,7 @@ void FileSinkThread::tick()
|
||||
SampleVector::iterator beginRead;
|
||||
|
||||
m_sampleFifo->read(beginRead, m_samplesChunkSize);
|
||||
m_ofstream->write(reinterpret_cast<char*>(*beginRead), m_samplesChunkSize*4);
|
||||
m_ofstream->write(reinterpret_cast<char*>(&(*beginRead)), m_samplesChunkSize*4);
|
||||
m_samplesCount += m_samplesChunkSize;
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ public:
|
||||
void setSamplerate(int samplerate);
|
||||
void setBuffer(std::size_t chunksize);
|
||||
bool isRunning() const { return m_running; }
|
||||
std::size_t getSamplesCount() const { return m_samplesCount; }
|
||||
void setSamplesCount(int samplesCount) { m_samplesCount = samplesCount; }
|
||||
|
||||
void connectTimer(const QTimer& timer);
|
||||
|
||||
@ -57,6 +59,7 @@ private:
|
||||
std::size_t m_bufsize;
|
||||
std::size_t m_samplesChunkSize;
|
||||
SampleSourceFifo* m_sampleFifo;
|
||||
std::size_t m_samplesCount;
|
||||
|
||||
int m_samplerate;
|
||||
int m_throttlems;
|
||||
|
@ -15,6 +15,7 @@ SUBDIRS += plugins/samplesource/sdrdaemon
|
||||
#SUBDIRS += plugins/samplesource/rtlsdr
|
||||
#SUBDIRS += plugins/samplesource/hackrf
|
||||
#SUBDIRS += plugins/samplesource/airspy
|
||||
SUBDIRS += plugins/samplesink/filesink
|
||||
SUBDIRS += plugins/channel/chanalyzer
|
||||
SUBDIRS += plugins/channel/demodam
|
||||
SUBDIRS += plugins/channel/demodbfm
|
||||
|
@ -15,6 +15,7 @@ SUBDIRS += plugins/samplesource/sdrdaemon
|
||||
SUBDIRS += plugins/samplesource/rtlsdr
|
||||
SUBDIRS += plugins/samplesource/hackrf
|
||||
SUBDIRS += plugins/samplesource/airspy
|
||||
SUBDIRS += plugins/samplesink/filesink
|
||||
SUBDIRS += plugins/channelrx/chanalyzer
|
||||
SUBDIRS += plugins/channelrx/demodam
|
||||
SUBDIRS += plugins/channelrx/demodbfm
|
||||
|
@ -25,6 +25,7 @@ SUBDIRS += plugins/samplesource/rtlsdr
|
||||
SUBDIRS += plugins/samplesource/hackrf
|
||||
SUBDIRS += plugins/samplesource/airspy
|
||||
SUBDIRS += plugins/samplesource/bladerf
|
||||
SUBDIRS += plugins/samplesink/filesink
|
||||
SUBDIRS += plugins/channelrx/chanalyzer
|
||||
SUBDIRS += plugins/channelrx/demodam
|
||||
SUBDIRS += plugins/channelrx/demodbfm
|
||||
|
@ -14,6 +14,7 @@ copy %libusbdir%\dll\libusb-1.0.dll %2
|
||||
mkdir %2\plugins
|
||||
mkdir %2\plugins\channelrx
|
||||
mkdir %2\plugins\samplesource
|
||||
mkdir %2\plugins\samplesink
|
||||
copy plugins\channelrx\chanalyzer\%1\chanalyzer.dll %2\plugins\channelrx
|
||||
copy plugins\channelrx\demodam\%1\demodam.dll %2\plugins\channelrx
|
||||
copy plugins\channelrx\demodbfm\%1\demodbfm.dll %2\plugins\channelrx
|
||||
@ -29,3 +30,4 @@ copy plugins\samplesource\rtlsdr\%1\inputrtlsdr.dll %2\plugins\samplesource
|
||||
copy plugins\samplesource\hackrf\%1\inputhackrf.dll %2\plugins\samplesource
|
||||
copy plugins\samplesource\airspy\%1\inputairspy.dll %2\plugins\samplesource
|
||||
copy plugins\samplesource\bladerf\%1\inputbladerf.dll %2\plugins\samplesource
|
||||
copy plugins\samplesink\filesink\%1\outputfilesink.dll %2\plugins\samplesink
|
||||
|
@ -27,6 +27,7 @@ copy %libusbdir%\dll\libusb-1.0.dll %2
|
||||
mkdir %2\plugins
|
||||
mkdir %2\plugins\channelrx
|
||||
mkdir %2\plugins\samplesource
|
||||
mkdir %2\plugins\samplesink
|
||||
copy plugins\channelrx\chanalyzer\%1\chanalyzer.dll %2\plugins\channelrx
|
||||
copy plugins\channelrx\demodam\%1\demodam.dll %2\plugins\channelrx
|
||||
copy plugins\channelrx\demodbfm\%1\demodbfm.dll %2\plugins\channelrx
|
||||
@ -44,3 +45,4 @@ copy plugins\samplesource\rtlsdr\%1\inputrtlsdr.dll %2\plugins\samplesource
|
||||
copy plugins\samplesource\hackrf\%1\inputhackrf.dll %2\plugins\samplesource
|
||||
copy plugins\samplesource\airspy\%1\inputairspy.dll %2\plugins\samplesource
|
||||
copy plugins\samplesource\bladerf\%1\inputbladerf.dll %2\plugins\samplesource
|
||||
copy plugins\samplesink\filesink\%1\outputfilesink.dll %2\plugins\samplesink
|
||||
|
Loading…
Reference in New Issue
Block a user