1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-13 03:41:47 -05:00

File source debugging interim state #1

This commit is contained in:
f4exb 2015-08-03 09:25:38 +02:00
parent f9029e8572
commit fb167dad70
3 changed files with 16 additions and 3 deletions

View File

@ -170,12 +170,16 @@ bool FileSourceInput::handleMessage(Message* message)
bool FileSourceInput::applySettings(const GeneralSettings& generalSettings, const Settings& settings, bool force)
{
QMutexLocker mutexLocker(&m_mutex);
bool wasRunning = false;
if((m_settings.m_fileName != settings.m_fileName) || force) {
m_settings.m_fileName = settings.m_fileName;
if (m_fileSourceThread != 0) {
m_fileSourceThread->stopWork();
wasRunning = m_fileSourceThread->isRunning();
if (wasRunning) {
m_fileSourceThread->stopWork();
}
}
if (m_ifstream.is_open()) {
@ -186,10 +190,16 @@ bool FileSourceInput::applySettings(const GeneralSettings& generalSettings, cons
if (m_fileSourceThread != 0) {
m_fileSourceThread->setSamplerate(m_sampleRate);
if (wasRunning) {
m_fileSourceThread->startWork();
}
}
std::cerr << "FileSourceInput: center freq: " << m_generalSettings.m_centerFrequency << " Hz"
<< " file name: " << settings.m_fileName.toStdString() << std::endl;
std::cerr << "FileSourceInput::applySettings:"
<< " file name: " << settings.m_fileName.toStdString()
<< " center freq: " << m_centerFrequency << " Hz"
<< " sample rate: " << m_sampleRate
<< " Unix timestamp: " << m_startingTimeStamp << std::endl;
}
return true;

View File

@ -47,6 +47,7 @@ FileSourceThread::~FileSourceThread()
void FileSourceThread::startWork()
{
std::cerr << "FileSourceThread::startWork" << std::endl;
m_startWaitMutex.lock();
start();
while(!m_running)
@ -56,6 +57,7 @@ void FileSourceThread::startWork()
void FileSourceThread::stopWork()
{
std::cerr << "FileSourceThread::stopWork" << std::endl;
m_running = false;
wait();
}

View File

@ -39,6 +39,7 @@ public:
void startWork();
void stopWork();
void setSamplerate(int samplerate);
bool isRunning() const { return m_running; }
void connectTimer(const QTimer& timer);