2014-05-18 11:52:39 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2015-08-12 03:03:02 -04:00
|
|
|
// Copyright (C) 2015 F4EXB //
|
|
|
|
// written by Edouard Griffiths //
|
2014-05-18 11:52:39 -04:00
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef INCLUDE_DSPENGINE_H
|
|
|
|
#define INCLUDE_DSPENGINE_H
|
|
|
|
|
2015-10-14 22:05:19 -04:00
|
|
|
#include <QObject>
|
|
|
|
#include "dsp/dspdeviceengine.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
#include "audio/audiooutput.h"
|
|
|
|
#include "util/export.h"
|
2016-05-08 00:00:37 -04:00
|
|
|
#ifdef DSD_USE_SERIALDV
|
|
|
|
#include "dsp/dvserialengine.h"
|
|
|
|
#endif
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-10-14 22:05:19 -04:00
|
|
|
class DSPDeviceEngine;
|
2015-08-17 02:29:34 -04:00
|
|
|
class ThreadedSampleSink;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-10-14 22:05:19 -04:00
|
|
|
class SDRANGEL_API DSPEngine : public QObject {
|
2014-05-18 11:52:39 -04:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-10-14 22:05:19 -04:00
|
|
|
DSPEngine();
|
2014-05-18 11:52:39 -04:00
|
|
|
~DSPEngine();
|
|
|
|
|
2015-08-08 22:09:05 -04:00
|
|
|
static DSPEngine *instance();
|
|
|
|
|
2015-10-14 22:05:19 -04:00
|
|
|
MessageQueue* getInputMessageQueue();
|
|
|
|
MessageQueue* getOutputMessageQueue();
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-08-23 18:51:27 -04:00
|
|
|
uint getAudioSampleRate() const { return m_audioSampleRate; }
|
|
|
|
|
2015-10-14 22:05:19 -04:00
|
|
|
void start(); //!< Device engine(s) start
|
|
|
|
void stop(); //!< Device engine(s) stop
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-08-12 03:03:02 -04:00
|
|
|
bool initAcquisition(); //!< Initialize acquisition sequence
|
|
|
|
bool startAcquisition(); //!< Start acquisition sequence
|
|
|
|
void stopAcquistion(); //!< Stop acquisition sequence
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-10-03 17:59:02 -04:00
|
|
|
void setSource(SampleSource* source); //!< Set the sample source type
|
|
|
|
void setSourceSequence(int sequence); //!< Set the sample source sequence in type
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-08-12 03:03:02 -04:00
|
|
|
void addSink(SampleSink* sink); //!< Add a sample sink
|
|
|
|
void removeSink(SampleSink* sink); //!< Remove a sample sink
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-08-21 02:54:28 -04:00
|
|
|
void addThreadedSink(ThreadedSampleSink* sink); //!< Add a sample sink that will run on its own thread
|
|
|
|
void removeThreadedSink(ThreadedSampleSink* sink); //!< Remove a sample sink that runs on its own thread
|
2015-08-17 02:29:34 -04:00
|
|
|
|
2015-08-12 03:03:02 -04:00
|
|
|
void addAudioSink(AudioFifo* audioFifo); //!< Add the audio sink
|
|
|
|
void removeAudioSink(AudioFifo* audioFifo); //!< Remove the audio sink
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-10-14 22:05:19 -04:00
|
|
|
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection); //!< Configure DSP corrections
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-10-14 22:05:19 -04:00
|
|
|
DSPDeviceEngine::State state() const;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-10-14 22:05:19 -04:00
|
|
|
QString errorMessage(); //!< Return the current error message
|
2015-08-12 03:03:02 -04:00
|
|
|
QString sourceDeviceDescription(); //!< Return the source device description
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2016-05-08 00:00:37 -04:00
|
|
|
bool hasDVSerialSupport()
|
|
|
|
{
|
|
|
|
#ifdef DSD_USE_SERIALDV
|
|
|
|
return m_dvSerialSupport;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void setDVSerialSupport(bool support);
|
|
|
|
|
2016-05-08 01:02:31 -04:00
|
|
|
void pushMbeFrame(const unsigned char *mbeFrame, int mbeRateIndex, int mbeVolumeIndex, AudioFifo *audioFifo)
|
2016-05-08 00:00:37 -04:00
|
|
|
{
|
|
|
|
#ifdef DSD_USE_SERIALDV
|
2016-05-08 01:02:31 -04:00
|
|
|
m_dvSerialEngine.pushMbeFrame(mbeFrame, mbeRateIndex, mbeVolumeIndex, audioFifo);
|
2016-05-08 00:00:37 -04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
private:
|
2015-10-14 22:05:19 -04:00
|
|
|
DSPDeviceEngine *m_deviceEngine;
|
2015-08-19 21:38:31 -04:00
|
|
|
AudioOutput m_audioOutput;
|
2015-08-23 18:51:27 -04:00
|
|
|
uint m_audioSampleRate;
|
2016-05-08 00:00:37 -04:00
|
|
|
bool m_dvSerialSupport;
|
|
|
|
#ifdef DSD_USE_SERIALDV
|
|
|
|
DVSerialEngine m_dvSerialEngine;
|
|
|
|
#endif
|
2014-05-18 11:52:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_DSPENGINE_H
|