mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-22 09:31:10 -05:00
AM Modulator: audio input (mic) basic support
This commit is contained in:
parent
4c3db01409
commit
c5f1acdcf1
@ -34,15 +34,14 @@ From version 2 SDRangel can integrate more than one hardware device running conc
|
||||
|
||||
Transmission or signal generation support for eligible devices (BladeRF and HackRF) is progressively introduced with the following roadmap:
|
||||
|
||||
- Phase 1: version 2.2.0: generation to file (File Sink) with AM modulator with simple sine modulation. Fixed sample rate of 48 kS/s (no effective interpolation)
|
||||
- Phase 2: version 2.2.x: full baseband interpolation chain: in AM modulator and Up Channelizer.
|
||||
- Phase 1: version 2.2.0: generation to file (File Sink) with AM modulator with simple sine modulation. Fixed sample rate of 48 kS/s (no effective interpolation)
|
||||
- Phase 2: version 2.2.2: full baseband interpolation chain: in AM modulator and Up Channelizer.
|
||||
- 2.3.0: SDRplay came into play ...
|
||||
- Phase 3a: version 2.3.1: Improve AM modulator with audio file input
|
||||
- Phase 3b: version 2.3.x: Improve AM modulator with audio input (Mic) support
|
||||
- Phase 3: version 2.3.1: Improve AM modulator with audio file input and audio input (Mic) support
|
||||
- Phase 4a: version 2.4.0: FM modulator
|
||||
- Phase 4b: version 2.4.x: WFM modulator
|
||||
- Phase 4c: version 2.4.x: SSB modulator
|
||||
- phase 5: version 3.0.0: BladeRF and HackRF support including final interpolation stage.
|
||||
- phase 5: version 3.0.0: BladeRF and HackRF support including final interpolation stage.
|
||||
|
||||
<h2>Airspy</h2>
|
||||
|
||||
|
@ -35,6 +35,7 @@ MESSAGE_CLASS_DEFINITION(AMMod::MsgReportFileSourceStreamTiming, Message)
|
||||
|
||||
|
||||
AMMod::AMMod() :
|
||||
m_audioFifo(4, 48000),
|
||||
m_settingsMutex(QMutex::Recursive),
|
||||
m_fileSize(0),
|
||||
m_recordLength(0),
|
||||
@ -52,28 +53,31 @@ AMMod::AMMod() :
|
||||
|
||||
apply();
|
||||
|
||||
m_audioBuffer.resize(1<<14);
|
||||
m_audioBufferFill = 0;
|
||||
//m_audioBuffer.resize(1<<14);
|
||||
//m_audioBufferFill = 0;
|
||||
|
||||
m_movingAverage.resize(16, 0);
|
||||
m_volumeAGC.resize(4096, 0.003, 0);
|
||||
m_magsq = 0.0;
|
||||
|
||||
m_toneNco.setFreq(1000.0, m_config.m_audioSampleRate);
|
||||
DSPEngine::instance()->addAudioSource(&m_audioFifo);
|
||||
}
|
||||
|
||||
AMMod::~AMMod()
|
||||
{
|
||||
DSPEngine::instance()->removeAudioSource(&m_audioFifo);
|
||||
}
|
||||
|
||||
void AMMod::configure(MessageQueue* messageQueue,
|
||||
Real rfBandwidth,
|
||||
Real afBandwidth,
|
||||
float modFactor,
|
||||
int volumeTenths,
|
||||
bool audioMute,
|
||||
bool playLoop)
|
||||
{
|
||||
Message* cmd = MsgConfigureAMMod::create(rfBandwidth, afBandwidth, modFactor, audioMute, playLoop);
|
||||
Message* cmd = MsgConfigureAMMod::create(rfBandwidth, afBandwidth, modFactor, volumeTenths, audioMute, playLoop);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
|
||||
@ -124,6 +128,8 @@ void AMMod::pull(Sample& sample)
|
||||
|
||||
void AMMod::pullAF(Real& sample)
|
||||
{
|
||||
int16_t audioSample[2];
|
||||
|
||||
switch (m_afInput)
|
||||
{
|
||||
case AMModInputTone:
|
||||
@ -158,7 +164,8 @@ void AMMod::pullAF(Real& sample)
|
||||
}
|
||||
break;
|
||||
case AMModInputAudio:
|
||||
sample = 0.0f; // TODO
|
||||
m_audioFifo.read(reinterpret_cast<quint8*>(audioSample), 1, 10);
|
||||
sample = ((audioSample[0] + audioSample[1]) * m_running.m_volumeFactor) / 6553600.0f;
|
||||
break;
|
||||
case AMModInputNone:
|
||||
default:
|
||||
@ -205,6 +212,7 @@ bool AMMod::handleMessage(const Message& cmd)
|
||||
m_config.m_rfBandwidth = cfg.getRFBandwidth();
|
||||
m_config.m_afBandwidth = cfg.getAFBandwidth();
|
||||
m_config.m_modFactor = cfg.getModFactor();
|
||||
m_config.m_volumeFactor = cfg.getVolumeFactor();
|
||||
m_config.m_audioMute = cfg.getAudioMute();
|
||||
m_config.m_playLoop = cfg.getPlayLoop();
|
||||
|
||||
@ -214,6 +222,7 @@ bool AMMod::handleMessage(const Message& cmd)
|
||||
<< " m_rfBandwidth: " << m_config.m_rfBandwidth
|
||||
<< " m_afBandwidth: " << m_config.m_afBandwidth
|
||||
<< " m_modFactor: " << m_config.m_modFactor
|
||||
<< " m_volumeFactor: " << m_config.m_volumeFactor
|
||||
<< " m_audioMute: " << m_config.m_audioMute
|
||||
<< " m_playLoop: " << m_config.m_playLoop;
|
||||
|
||||
@ -298,6 +307,7 @@ void AMMod::apply()
|
||||
m_running.m_rfBandwidth = m_config.m_rfBandwidth;
|
||||
m_running.m_afBandwidth = m_config.m_afBandwidth;
|
||||
m_running.m_modFactor = m_config.m_modFactor;
|
||||
m_running.m_volumeFactor = m_config.m_volumeFactor;
|
||||
m_running.m_audioSampleRate = m_config.m_audioSampleRate;
|
||||
m_running.m_audioMute = m_config.m_audioMute;
|
||||
m_running.m_playLoop = m_config.m_playLoop;
|
||||
|
@ -174,7 +174,7 @@ public:
|
||||
AMMod();
|
||||
~AMMod();
|
||||
|
||||
void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, float modFactor, bool audioMute, bool playLoop);
|
||||
void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, float modFactor, int volumeFactor, bool audioMute, bool playLoop);
|
||||
|
||||
virtual void pull(Sample& sample);
|
||||
virtual void start();
|
||||
@ -192,26 +192,29 @@ private:
|
||||
Real getRFBandwidth() const { return m_rfBandwidth; }
|
||||
Real getAFBandwidth() const { return m_afBandwidth; }
|
||||
float getModFactor() const { return m_modFactor; }
|
||||
int getVolumeFactor() const { return m_volumeFactor; }
|
||||
bool getAudioMute() const { return m_audioMute; }
|
||||
bool getPlayLoop() const { return m_playLoop; }
|
||||
|
||||
static MsgConfigureAMMod* create(Real rfBandwidth, Real afBandwidth, float modFactor, bool audioMute, bool playLoop)
|
||||
static MsgConfigureAMMod* create(Real rfBandwidth, Real afBandwidth, float modFactor, int volumeFactor, bool audioMute, bool playLoop)
|
||||
{
|
||||
return new MsgConfigureAMMod(rfBandwidth, afBandwidth, modFactor, audioMute, playLoop);
|
||||
return new MsgConfigureAMMod(rfBandwidth, afBandwidth, modFactor, volumeFactor, audioMute, playLoop);
|
||||
}
|
||||
|
||||
private:
|
||||
Real m_rfBandwidth;
|
||||
Real m_afBandwidth;
|
||||
float m_modFactor;
|
||||
int m_volumeFactor;
|
||||
bool m_audioMute;
|
||||
bool m_playLoop;
|
||||
|
||||
MsgConfigureAMMod(Real rfBandwidth, Real afBandwidth, float modFactor, bool audioMute, bool playLoop) :
|
||||
MsgConfigureAMMod(Real rfBandwidth, Real afBandwidth, float modFactor, int volumeFactor, bool audioMute, bool playLoop) :
|
||||
Message(),
|
||||
m_rfBandwidth(rfBandwidth),
|
||||
m_afBandwidth(afBandwidth),
|
||||
m_modFactor(modFactor),
|
||||
m_volumeFactor(volumeFactor),
|
||||
m_audioMute(audioMute),
|
||||
m_playLoop(playLoop)
|
||||
{ }
|
||||
@ -236,6 +239,7 @@ private:
|
||||
Real m_rfBandwidth;
|
||||
Real m_afBandwidth;
|
||||
float m_modFactor;
|
||||
int m_volumeFactor;
|
||||
quint32 m_audioSampleRate;
|
||||
bool m_audioMute;
|
||||
bool m_playLoop;
|
||||
@ -246,6 +250,7 @@ private:
|
||||
m_rfBandwidth(-1),
|
||||
m_afBandwidth(-1),
|
||||
m_modFactor(0.2f),
|
||||
m_volumeFactor(20),
|
||||
m_audioSampleRate(0),
|
||||
m_audioMute(false),
|
||||
m_playLoop(false)
|
||||
@ -270,8 +275,8 @@ private:
|
||||
MovingAverage<Real> m_movingAverage;
|
||||
SimpleAGC m_volumeAGC;
|
||||
|
||||
AudioVector m_audioBuffer;
|
||||
uint m_audioBufferFill;
|
||||
//AudioVector m_audioBuffer;
|
||||
//uint m_audioBufferFill;
|
||||
|
||||
AudioFifo m_audioFifo;
|
||||
SampleVector m_sampleBuffer;
|
||||
|
@ -77,6 +77,7 @@ void AMModGUI::resetToDefaults()
|
||||
ui->rfBW->setValue(6);
|
||||
ui->afBW->setValue(3);
|
||||
ui->modPercent->setValue(20);
|
||||
ui->micVolume->setValue(50);
|
||||
ui->deltaFrequency->setValue(0);
|
||||
|
||||
blockApplySettings(false);
|
||||
@ -219,6 +220,12 @@ void AMModGUI::on_modPercent_valueChanged(int value)
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void AMModGUI::on_micVolume_valueChanged(int value)
|
||||
{
|
||||
ui->micVolumeText->setText(QString("%1").arg(value));
|
||||
applySettings();
|
||||
}
|
||||
|
||||
void AMModGUI::on_audioMute_toggled(bool checked)
|
||||
{
|
||||
applySettings();
|
||||
@ -391,6 +398,7 @@ void AMModGUI::applySettings()
|
||||
m_rfBW[ui->rfBW->value()],
|
||||
ui->afBW->value() * 1000.0,
|
||||
ui->modPercent->value() / 100.0f,
|
||||
ui->micVolume->value(),
|
||||
ui->audioMute->isChecked(),
|
||||
ui->playLoop->isChecked());
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ private slots:
|
||||
void on_rfBW_valueChanged(int value);
|
||||
void on_afBW_valueChanged(int value);
|
||||
void on_modPercent_valueChanged(int value);
|
||||
void on_micVolume_valueChanged(int value);
|
||||
void on_audioMute_toggled(bool checked);
|
||||
void on_tone_toggled(bool checked);
|
||||
void on_mic_toggled(bool checked);
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>261</width>
|
||||
<height>180</height>
|
||||
<width>266</width>
|
||||
<height>190</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -27,7 +27,7 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>241</width>
|
||||
<width>251</width>
|
||||
<height>161</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -38,16 +38,7 @@
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -276,6 +267,18 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="modPercent">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Modulation percentage</string>
|
||||
</property>
|
||||
@ -297,7 +300,7 @@
|
||||
<widget class="QLabel" name="modPercentText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -309,6 +312,57 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="micVolume">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Audio input volume</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="micVolumeText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Audio input volume level</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>50</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -266,13 +266,14 @@ void FileSinkGui::on_startStop_toggled(bool checked)
|
||||
{
|
||||
qDebug("FileSinkGui::on_startStop_toggled: device start failed");
|
||||
}
|
||||
// DSPEngine::instance()->startAudio(); // TODO: activate when audio input is available
|
||||
|
||||
DSPEngine::instance()->startAudioInput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopGeneration();
|
||||
// DSPEngine::instance()->stopAudio(); // TODO: activate when audio input is available
|
||||
DSPEngine::instance()->stopAudioInput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,13 +351,13 @@ void AirspyGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,13 +358,13 @@ void BladerfGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,13 +428,13 @@ void FCDProGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,13 +292,13 @@ void FCDProPlusGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,13 +221,13 @@ void FileSourceGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,13 +334,13 @@ void HackRFGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,13 +318,13 @@ void RTLSDRGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,13 +589,13 @@ void SDRdaemonGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,13 +547,13 @@ void SDRdaemonFECGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,13 +453,13 @@ void SDRPlayGui::on_startStop_toggled(bool checked)
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
DSPEngine::instance()->startAudioOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
DSPEngine::instance()->stopAudioOutput();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ bool AudioInput::start(int device, int rate)
|
||||
|
||||
m_audioInput = new QAudioInput(devInfo, m_audioFormat);
|
||||
|
||||
QIODevice::open(QIODevice::ReadOnly);
|
||||
QIODevice::open(QIODevice::ReadWrite);
|
||||
|
||||
m_audioInput->start(this);
|
||||
|
||||
|
@ -26,7 +26,8 @@
|
||||
DSPEngine::DSPEngine() :
|
||||
m_deviceSourceEnginesUIDSequence(0),
|
||||
m_deviceSinkEnginesUIDSequence(0),
|
||||
m_audioSampleRate(48000) // Use default output device at 48 kHz
|
||||
m_audioOutputSampleRate(48000), // Use default output device at 48 kHz
|
||||
m_audioInputSampleRate(48000) // Use default input device at 48 kHz
|
||||
{
|
||||
m_dvSerialSupport = false;
|
||||
}
|
||||
@ -86,28 +87,50 @@ void DSPEngine::removeLastDeviceSinkEngine()
|
||||
}
|
||||
}
|
||||
|
||||
void DSPEngine::startAudio()
|
||||
void DSPEngine::startAudioOutput()
|
||||
{
|
||||
m_audioOutput.start(-1, m_audioSampleRate);
|
||||
m_audioSampleRate = m_audioOutput.getRate(); // update with actual rate
|
||||
m_audioOutput.start(-1, m_audioOutputSampleRate);
|
||||
m_audioOutputSampleRate = m_audioOutput.getRate(); // update with actual rate
|
||||
}
|
||||
|
||||
void DSPEngine::stopAudio()
|
||||
void DSPEngine::stopAudioOutput()
|
||||
{
|
||||
m_audioOutput.stop();
|
||||
}
|
||||
|
||||
void DSPEngine::startAudioImmediate()
|
||||
void DSPEngine::startAudioOutputImmediate()
|
||||
{
|
||||
m_audioOutput.start(-1, m_audioSampleRate);
|
||||
m_audioSampleRate = m_audioOutput.getRate(); // update with actual rate
|
||||
m_audioOutput.start(-1, m_audioOutputSampleRate);
|
||||
m_audioOutputSampleRate = m_audioOutput.getRate(); // update with actual rate
|
||||
}
|
||||
|
||||
void DSPEngine::stopAudioImmediate()
|
||||
void DSPEngine::stopAudioOutputImmediate()
|
||||
{
|
||||
m_audioOutput.stop();
|
||||
}
|
||||
|
||||
void DSPEngine::startAudioInput()
|
||||
{
|
||||
m_audioInput.start(-1, m_audioInputSampleRate);
|
||||
m_audioInputSampleRate = m_audioInput.getRate(); // update with actual rate
|
||||
}
|
||||
|
||||
void DSPEngine::stopAudioInput()
|
||||
{
|
||||
m_audioInput.stop();
|
||||
}
|
||||
|
||||
void DSPEngine::startAudioInputImmediate()
|
||||
{
|
||||
m_audioInput.start(-1, m_audioInputSampleRate);
|
||||
m_audioInputSampleRate = m_audioInput.getRate(); // update with actual rate
|
||||
}
|
||||
|
||||
void DSPEngine::stopAudioInputImmediate()
|
||||
{
|
||||
m_audioInput.stop();
|
||||
}
|
||||
|
||||
void DSPEngine::addAudioSink(AudioFifo* audioFifo)
|
||||
{
|
||||
qDebug("DSPEngine::addAudioSink");
|
||||
@ -120,6 +143,18 @@ void DSPEngine::removeAudioSink(AudioFifo* audioFifo)
|
||||
m_audioOutput.removeFifo(audioFifo);
|
||||
}
|
||||
|
||||
void DSPEngine::addAudioSource(AudioFifo* audioFifo)
|
||||
{
|
||||
qDebug("DSPEngine::addAudioSource");
|
||||
m_audioInput.addFifo(audioFifo);
|
||||
}
|
||||
|
||||
void DSPEngine::removeAudioSource(AudioFifo* audioFifo)
|
||||
{
|
||||
qDebug("DSPEngine::removeAudioSource");
|
||||
m_audioInput.removeFifo(audioFifo);
|
||||
}
|
||||
|
||||
DSPDeviceSourceEngine *DSPEngine::getDeviceSourceEngineByUID(uint uid)
|
||||
{
|
||||
std::vector<DSPDeviceSourceEngine*>::iterator it = m_deviceSourceEngines.begin();
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <QObject>
|
||||
#include <vector>
|
||||
#include "audio/audiooutput.h"
|
||||
#include "audio/audioinput.h"
|
||||
#include "util/export.h"
|
||||
#ifdef DSD_USE_SERIALDV
|
||||
#include "dsp/dvserialengine.h"
|
||||
@ -37,7 +38,7 @@ public:
|
||||
|
||||
static DSPEngine *instance();
|
||||
|
||||
uint getAudioSampleRate() const { return m_audioSampleRate; }
|
||||
uint getAudioSampleRate() const { return m_audioOutputSampleRate; }
|
||||
|
||||
DSPDeviceSourceEngine *addDeviceSourceEngine();
|
||||
void removeLastDeviceSourceEngine();
|
||||
@ -45,10 +46,15 @@ public:
|
||||
DSPDeviceSinkEngine *addDeviceSinkEngine();
|
||||
void removeLastDeviceSinkEngine();
|
||||
|
||||
void startAudio();
|
||||
void stopAudio();
|
||||
void startAudioImmediate();
|
||||
void stopAudioImmediate();
|
||||
void startAudioOutput();
|
||||
void stopAudioOutput();
|
||||
void startAudioOutputImmediate();
|
||||
void stopAudioOutputImmediate();
|
||||
|
||||
void startAudioInput();
|
||||
void stopAudioInput();
|
||||
void startAudioInputImmediate();
|
||||
void stopAudioInputImmediate();
|
||||
|
||||
DSPDeviceSourceEngine *getDeviceSourceEngineByIndex(uint deviceIndex) { return m_deviceSourceEngines[deviceIndex]; }
|
||||
DSPDeviceSourceEngine *getDeviceSourceEngineByUID(uint uid);
|
||||
@ -59,6 +65,9 @@ public:
|
||||
void addAudioSink(AudioFifo* audioFifo); //!< Add the audio sink
|
||||
void removeAudioSink(AudioFifo* audioFifo); //!< Remove the audio sink
|
||||
|
||||
void addAudioSource(AudioFifo* audioFifo); //!< Add an audio source
|
||||
void removeAudioSource(AudioFifo* audioFifo); //!< Remove an audio source
|
||||
|
||||
// Serial DV methods:
|
||||
|
||||
bool hasDVSerialSupport()
|
||||
@ -92,7 +101,9 @@ private:
|
||||
std::vector<DSPDeviceSinkEngine*> m_deviceSinkEngines;
|
||||
uint m_deviceSinkEnginesUIDSequence;
|
||||
AudioOutput m_audioOutput;
|
||||
uint m_audioSampleRate;
|
||||
AudioInput m_audioInput;
|
||||
uint m_audioOutputSampleRate;
|
||||
uint m_audioInputSampleRate;
|
||||
bool m_dvSerialSupport;
|
||||
#ifdef DSD_USE_SERIALDV
|
||||
DVSerialEngine m_dvSerialEngine;
|
||||
|
Loading…
Reference in New Issue
Block a user