Commit 17a5e843 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Merge branch 'master' of https://git.rwth-aachen.de/ita/Redstart

parents 5f919f55 365341d6
......@@ -26,7 +26,7 @@
#include <ITAException.h>
RedstartWindow::RedstartWindow( QWidget* pParent )
RedstartWindow::RedstartWindow( bool bFailSafeMode, bool bAutoStart, QWidget* pParent )
: QMainWindow( pParent )
, ui( new Ui::RedstartWindow )
, m_pCoreInstance( NULL )
......@@ -35,6 +35,9 @@ RedstartWindow::RedstartWindow( QWidget* pParent )
LoadConfiguration();
if( ( ui->checkBox_redstart_auto_start->isChecked() || bAutoStart ) && !bFailSafeMode )
on_pushButton_start_stop_clicked();
//connect( &m_qRenderTimer, SIGNAL( timeout() ), this, SLOT( Render() ) );
}
......@@ -50,8 +53,8 @@ void RedstartWindow::LoadConfiguration()
ui->comboBox_audio_driver->addItem( "ASIO" );
ui->comboBox_audio_driver->addItem( "Portaudio" );
bool bValOK = false;
int iAudioBackend = m_qSettings.value( "Redstart/audio/backend" ).toInt( &bValOK );
bool bValOK;
int iAudioBackend = m_qSettings.value( "Redstart/audio/backend_idx" ).toInt( &bValOK );
if( !bValOK )
iAudioBackend = AudioBackend::ASIO;
ui->comboBox_audio_driver->setCurrentIndex( iAudioBackend );
......@@ -61,6 +64,27 @@ void RedstartWindow::LoadConfiguration()
PopulatePortaudioDevicesFromSettings();
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 );
if( m_qSettings.contains( "Redstart/network/address" ) )
ui->lineEdit_redstart_network_address->setText( m_qSettings.value( "Redstart/network/address" ).toString() );
if( m_qSettings.contains( "Redstart/network/port" ) )
ui->lineEdit_redstart_network_address->setText( m_qSettings.value( "Redstart/network/port" ).toString() );
ui->checkBox_redstart_network_connect_as_client->setChecked( m_qSettings.value( "Redstart/network/client_mode" ).toBool() );
if( m_qSettings.contains( "Redstart/autostart" ) )
ui->checkBox_redstart_auto_start->setChecked( m_qSettings.value( "Redstart/autostart" ).toBool());
}
void RedstartWindow::StoreConfiguration()
......@@ -68,7 +92,20 @@ void RedstartWindow::StoreConfiguration()
m_qSettings.setValue( "Redstart/gui/WindowGeometry", saveGeometry() );
m_qSettings.setValue( "Redstart/gui/WindowState", saveState() );
m_qSettings.setValue( "Redstart/audio/backend", ui->comboBox_audio_driver->currentIndex() );
m_qSettings.setValue( "Redstart/audio/backend_idx", ui->comboBox_audio_driver->currentIndex() );
m_qSettings.setValue( "Redstart/audio/buffersize_idx", ui->comboBox_audio_iface_buffer_size->currentIndex() );
m_qSettings.setValue( "Redstart/audio/fs_idx", ui->comboBox_audio_iface_sampling_rate->currentIndex() );
m_qSettings.setValue( "Redstart/network/address", ui->lineEdit_redstart_network_address->text() );
bool bValOK;
int iPort = ui->lineEdit_redstart_network_address->text().toInt( &bValOK );
if( bValOK )
m_qSettings.setValue( "Redstart/network/port", iPort );
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() );
}
void RedstartWindow::on_actionQuit_triggered()
......@@ -115,6 +152,7 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
catch( const CVAException& ex )
{
ui->statusBar->showMessage( QString::fromStdString( ex.ToString() ) );
ui->checkBox_redstart_auto_start->setChecked( false );
}
ui->pushButton_start_stop->setEnabled( true );
}
......@@ -184,11 +222,11 @@ void RedstartWindow::AcquireAsioDevices()
{
ITAsioInitializeDriver( i );
long in, out;
long in = 0;
long out = 0;
ITAsioGetChannels( &in, &out );
oDeviceSpecs.iNumInputChannels = int( in );
oDeviceSpecs.iNumInputChannels = int( out );
m_voAudioDevices.push_back( oDeviceSpecs );
ITAsioFinalizeDriver();
......@@ -255,12 +293,12 @@ void RedstartWindow::on_pushButton_refresh_clicked()
PopulateAudioDevices();
}
void RedstartWindow::on_comboBox_audio_driver_currentIndexChanged(int iIndex)
void RedstartWindow::on_comboBox_audio_driver_currentIndexChanged( int iIndex )
{
PopulateAudioDevices();
}
void RedstartWindow::on_comboBox_audio_iface_device_currentIndexChanged(int index)
void RedstartWindow::on_comboBox_audio_iface_device_currentIndexChanged( int index )
{
}
......
......@@ -35,7 +35,7 @@ class RedstartWindow : public QMainWindow
Q_OBJECT
public:
explicit RedstartWindow( QWidget* pParent = 0 );
explicit RedstartWindow( bool bFailSafeMode = false, bool bAutoStart = false, QWidget* pParent = 0 );
~RedstartWindow();
enum AudioBackend
......@@ -44,6 +44,18 @@ public:
PORTAUDIO = 1,
};
enum AudioSamplingRate
{
FS_44kHz = 0,
FS_48kHz = 1,
FS_96kHz = 2,
};
enum AudioBufferSize
{
AUTO = 0
};
struct CAudioDeviceSpecs
{
int iDriverNumber;
......
......@@ -12,6 +12,7 @@
*/
#include <QApplication>
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QLocale>
......@@ -32,8 +33,25 @@ int main( int argc, char* argv[] )
//icon.addFile( QStringLiteral( ":/res/Redstart_icon.png" ), QSize(), QIcon::Normal, QIcon::On );
a.setWindowIcon( icon );
RedstartWindow w;
QCommandLineParser oCLIParser;
oCLIParser.setApplicationDescription( "Redstart helper" );
oCLIParser.addHelpOption();
oCLIParser.addVersionOption();
oCLIParser.addPositionalArgument( "session", QCoreApplication::translate( "main", "Redstart session or VA core configuration file path" ) );
QCommandLineOption bAutoStartVA( "a", QCoreApplication::translate( "main", "Autostart VA core" ) );
oCLIParser.addOption( bAutoStartVA );
QCommandLineOption oSafeModeOption( QStringList() << "s" << "safemode", QCoreApplication::translate( "main", "Run in safemode (override and disable autostart)" ) );
oCLIParser.addOption( oSafeModeOption );
oCLIParser.process( a );
bool bFailSafeMode = oCLIParser.isSet( oSafeModeOption );
bool bAutoStart = oCLIParser.isSet( bAutoStartVA );
RedstartWindow w( bFailSafeMode, bAutoStart );
w.show();
return a.exec();
};
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