Commit 526e2109 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Audio device stored in settings now

parent 6c8d0ba1
......@@ -41,6 +41,12 @@ RedstartWindow::RedstartWindow( bool bFailSafeMode, bool bAutoStart, bool bSkipC
ui->comboBox_audio_driver->addItem( "ASIO" );
ui->comboBox_audio_driver->addItem( "Portaudio" );
ui->comboBox_audio_iface_sampling_rate->addItem( "44.1 kHz", AudioSamplingRate::FS_44kHz );
ui->comboBox_audio_iface_sampling_rate->addItem( "48 kHz", AudioSamplingRate::FS_48kHz );
//ui->comboBox_audio_iface_sampling_rate->addItem( "96 kHz", AudioSamplingRate::FS_96kHz );
ui->comboBox_audio_iface_buffer_size->addItem( "AUTO", AudioBufferSize::AUTO );
if( !bSkipConfig )
LoadConfiguration();
......@@ -84,14 +90,10 @@ void RedstartWindow::LoadConfiguration()
else
PopulateAsioDevicesFromSettings();
ui->comboBox_audio_iface_buffer_size->addItem( "AUTO", AudioBufferSize::AUTO );
const int iBufferSizeIndex = m_qSettings.value( "Redstart/audio/buffersize_idx" ).toInt( &bValOK );
if( bValOK && iBufferSizeIndex < ui->comboBox_audio_iface_buffer_size->count() )
ui->comboBox_audio_iface_buffer_size->setCurrentIndex( iBufferSizeIndex );
ui->comboBox_audio_iface_sampling_rate->addItem( "44.1 kHz", AudioSamplingRate::FS_44kHz );
ui->comboBox_audio_iface_sampling_rate->addItem( "48 kHz", AudioSamplingRate::FS_48kHz );
//ui->comboBox_audio_iface_sampling_rate->addItem( "96 kHz", AudioSamplingRate::FS_96kHz );
const int iSamplingRateIndex = m_qSettings.value( "Redstart/audio/fs_idx" ).toInt( &bValOK );
if( bValOK && iSamplingRateIndex < ui->comboBox_audio_iface_sampling_rate->count() )
ui->comboBox_audio_iface_sampling_rate->setCurrentIndex( iSamplingRateIndex );
......@@ -104,6 +106,14 @@ void RedstartWindow::LoadConfiguration()
if( m_qSettings.contains( "Redstart/autostart" ) )
ui->checkBox_redstart_auto_start->setChecked( m_qSettings.value( "Redstart/autostart" ).toBool() );
QVariantList voAudioDevices;
voAudioDevices = m_qSettings.value( "Redstart/audio/devicelist" ).toList();
for( const QVariant oAudioDevice : voAudioDevices )
m_voAudioDevices.push_back( CAudioDeviceSpecs( oAudioDevice.toHash() ) );
PopulateAudioDevices();
}
void RedstartWindow::StoreConfiguration()
......@@ -125,6 +135,12 @@ void RedstartWindow::StoreConfiguration()
m_qSettings.setValue( "Redstart/network/client_mode", ui->checkBox_redstart_network_connect_as_client->isChecked() );
m_qSettings.setValue( "Redstart/autostart", ui->checkBox_redstart_auto_start->isChecked() );
QVariantList voAudioDevices;
for( const CAudioDeviceSpecs& oDevice : m_voAudioDevices )
voAudioDevices.push_back( oDevice.asHash() );
m_qSettings.setValue( "Redstart/audio/devicelist", voAudioDevices );
}
void RedstartWindow::on_actionQuit_triggered()
......
......@@ -15,6 +15,7 @@
#include <QMainWindow>
#include <QSettings>
#include <QStringList>
#include <ITAPortaudioInterface.h>
#ifdef WIN32
......@@ -23,6 +24,7 @@
#include <ITAJACKInterface.h>
#endif
class IVAInterface;
class IVANetClient;
class IVANetServer;
......@@ -70,8 +72,39 @@ public:
inline CAudioDeviceSpecs()
{
bDefaultDevice = false;
int iDriverNumber = -1;
int iNumInputChannels = -1;
int iNumOutputChannels = -1;
bool bInitializable = false;
bool bDefaultDevice = false;
int iBackend = -1;
};
inline CAudioDeviceSpecs( const QVariantHash& oHash )
: CAudioDeviceSpecs()
{
iDriverNumber = oHash[ "DriverNumber" ].toInt();
sName = oHash[ "Name" ].toString();
iNumInputChannels = oHash[ "NumInputChannels" ].toInt();
iNumOutputChannels = oHash[ "NumOutputChannels" ].toInt();
bInitializable = oHash[ "Initializable" ].toBool();
bDefaultDevice = oHash[ "DefaultDevice" ].toBool();
iBackend = oHash[ "Backend" ].toInt();
};
inline QVariantHash asHash() const
{
QVariantHash oHash;
oHash[ "DriverNumber" ] = iDriverNumber;
oHash[ "Name" ] = sName;
oHash[ "NumInputChannels" ] = iNumInputChannels;
oHash[ "NumOutputChannels" ] = iNumOutputChannels;
oHash[ "Initializable" ] = bInitializable;
oHash[ "DefaultDevice" ] = bDefaultDevice;
oHash[ "Backend" ] = iBackend;
return oHash;
};
};
private slots:
......@@ -110,7 +143,6 @@ private:
IVANetClient* m_pVANetClient;
IVANetServer* m_pVANetServer;
std::vector< QString > m_vsAudioBackends;
std::vector< CAudioDeviceSpecs > m_voAudioDevices;
QSettings m_qSettings;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment