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

New audio devices dialog and handling: use selected audio devices

This commit is contained in:
f4exb 2017-01-06 16:04:32 +01:00
parent 49fba5b103
commit 58b90c7914
3 changed files with 13 additions and 5 deletions

View File

@ -27,7 +27,9 @@ DSPEngine::DSPEngine() :
m_deviceSourceEnginesUIDSequence(0),
m_deviceSinkEnginesUIDSequence(0),
m_audioOutputSampleRate(48000), // Use default output device at 48 kHz
m_audioInputSampleRate(48000) // Use default input device at 48 kHz
m_audioInputSampleRate(48000), // Use default input device at 48 kHz
m_audioInputDeviceIndex(-1), // default device
m_audioOutputDeviceIndex(-1) // default device
{
m_dvSerialSupport = false;
}
@ -90,7 +92,7 @@ void DSPEngine::removeLastDeviceSinkEngine()
void DSPEngine::startAudioOutput()
{
m_audioOutput.start(-1, m_audioOutputSampleRate);
m_audioOutput.start(m_audioOutputDeviceIndex, m_audioOutputSampleRate);
m_audioOutputSampleRate = m_audioOutput.getRate(); // update with actual rate
}
@ -101,7 +103,7 @@ void DSPEngine::stopAudioOutput()
void DSPEngine::startAudioOutputImmediate()
{
m_audioOutput.start(-1, m_audioOutputSampleRate);
m_audioOutput.start(m_audioOutputDeviceIndex, m_audioOutputSampleRate);
m_audioOutputSampleRate = m_audioOutput.getRate(); // update with actual rate
}
@ -112,7 +114,7 @@ void DSPEngine::stopAudioOutputImmediate()
void DSPEngine::startAudioInput()
{
m_audioInput.start(-1, m_audioInputSampleRate);
m_audioInput.start(m_audioInputDeviceIndex, m_audioInputSampleRate);
m_audioInputSampleRate = m_audioInput.getRate(); // update with actual rate
}
@ -123,7 +125,7 @@ void DSPEngine::stopAudioInput()
void DSPEngine::startAudioInputImmediate()
{
m_audioInput.start(-1, m_audioInputSampleRate);
m_audioInput.start(m_audioInputDeviceIndex, m_audioInputSampleRate);
m_audioInputSampleRate = m_audioInput.getRate(); // update with actual rate
}

View File

@ -50,12 +50,14 @@ public:
void stopAudioOutput();
void startAudioOutputImmediate();
void stopAudioOutputImmediate();
void setAudioOutputDeviceIndex(int index) { m_audioOutputDeviceIndex = index; }
void startAudioInput();
void stopAudioInput();
void startAudioInputImmediate();
void stopAudioInputImmediate();
void setAudioInputVolume(float volume) { m_audioInput.setVolume(volume); }
void setAudioInputDeviceIndex(int index) { m_audioInputDeviceIndex = index; }
DSPDeviceSourceEngine *getDeviceSourceEngineByIndex(uint deviceIndex) { return m_deviceSourceEngines[deviceIndex]; }
DSPDeviceSourceEngine *getDeviceSourceEngineByUID(uint uid);
@ -105,6 +107,8 @@ private:
AudioInput m_audioInput;
uint m_audioOutputSampleRate;
uint m_audioInputSampleRate;
int m_audioInputDeviceIndex;
int m_audioOutputDeviceIndex;
bool m_dvSerialSupport;
#ifdef DSD_USE_SERIALDV
DVSerialEngine m_dvSerialEngine;

View File

@ -740,6 +740,8 @@ void MainWindow::on_action_Audio_triggered()
AudioDialog audioDialog(m_audioDeviceInfo, this);
audioDialog.exec();
m_dspEngine->setAudioInputVolume(m_audioDeviceInfo->getInputVolume());
m_dspEngine->setAudioInputDeviceIndex(m_audioDeviceInfo->getInputDeviceIndex());
m_dspEngine->setAudioOutputDeviceIndex(m_audioDeviceInfo->getOutputDeviceIndex());
}
void MainWindow::on_action_My_Position_triggered()