1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-17 23:28:50 -05:00

DSD Demod: DV Serial support: popup message to list devices when enabling

This commit is contained in:
f4exb 2016-05-09 18:17:53 +02:00
parent 84479fdbcc
commit 15a583e8a9
5 changed files with 50 additions and 1 deletions

View File

@ -79,6 +79,13 @@ public:
void setDVSerialSupport(bool support);
void getDVSerialNames(std::vector<std::string>& deviceNames)
{
#ifdef DSD_USE_SERIALDV
m_dvSerialEngine.getDevicesNames(deviceNames);
#endif
}
void pushMbeFrame(const unsigned char *mbeFrame, int mbeRateIndex, int mbeVolumeIndex, AudioFifo *audioFifo)
{
#ifdef DSD_USE_SERIALDV

View File

@ -233,6 +233,17 @@ void DVSerialEngine::release()
m_controllers.clear();
}
void DVSerialEngine::getDevicesNames(std::vector<std::string>& deviceNames)
{
std::vector<DVSerialController>::iterator it = m_controllers.begin();
while (it != m_controllers.end())
{
deviceNames.push_back(it->device);
++it;
}
}
void DVSerialEngine::pushMbeFrame(const unsigned char *mbeFrame, int mbeRateIndex, int mbeVolumeIndex, AudioFifo *audioFifo)
{
std::vector<DVSerialController>::iterator it = m_controllers.begin();

View File

@ -38,6 +38,8 @@ public:
void release();
int getNbDevices() const { return m_controllers.size(); }
void getDevicesNames(std::vector<std::string>& devicesNames);
void pushMbeFrame(const unsigned char *mbeFrame, int mbeRateIndex, int mbeVolumeIndex, AudioFifo *audioFifo);
private:

View File

@ -76,7 +76,7 @@ void DVSerialWorker::handleInputMessages()
if (MsgMbeDecode::match(*message))
{
MsgMbeDecode *decodeMsg = (MsgMbeDecode *) message;
int dBVolume = (decodeMsg->getVolumeIndex() - 50) / 4;
int dBVolume = (decodeMsg->getVolumeIndex() - 50) / 2;
if (m_dvController.decode(m_dvAudioSamples, decodeMsg->getMbeFrame(), decodeMsg->getMbeRate(), dBVolume))
{

View File

@ -23,6 +23,7 @@
#include <QFileInfo>
#include <QFileDialog>
#include <QTextStream>
#include <QMessageBox>
#include "mainwindow.h"
#include "ui_mainwindow.h"
@ -690,6 +691,34 @@ void MainWindow::on_action_Audio_triggered()
void MainWindow::on_action_DV_Serial_triggered(bool checked)
{
m_dspEngine->setDVSerialSupport(checked);
if (checked)
{
std::vector<std::string> deviceNames;
m_dspEngine->getDVSerialNames(deviceNames);
if (deviceNames.size() == 0)
{
QMessageBox::information(this, tr("Message"), tr("No DV serial devices found"));
}
else
{
std::vector<std::string>::iterator it = deviceNames.begin();
std::string deviceNamesStr = "DV Serial devices found: ";
while (it != deviceNames.end())
{
if (it != deviceNames.begin()) {
deviceNamesStr += ",";
}
deviceNamesStr += *it;
++it;
}
QMessageBox::information(this, tr("Message"), tr(deviceNamesStr.c_str()));
}
}
}
void MainWindow::on_sampleSource_currentIndexChanged(int index)