Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
Redstart
Commits
edcef3c1
Commit
edcef3c1
authored
Nov 13, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Starting configuration load/store impl
parent
0c5073f1
Changes
4
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
edcef3c1
...
...
@@ -10,6 +10,7 @@ vista_use_package( ITAQtWidgets REQUIRED FIND_DEPENDENCIES )
vista_use_package
(
VABase REQUIRED FIND_DEPENDENCIES
)
vista_use_package
(
VANet REQUIRED FIND_DEPENDENCIES
)
vista_use_package
(
VACore REQUIRED FIND_DEPENDENCIES
)
vista_use_package
(
ITADataSources REQUIRED FIND_DEPENDENCIES
)
find_package
(
Qt5 REQUIRED COMPONENTS Core Gui Widgets
)
# no vista cmake find
...
...
src/RedstartWindow.cpp
View file @
edcef3c1
...
...
@@ -11,6 +11,8 @@
* --------------------------------------------------------------------------------------------
*/
#include
<QErrorMessage>
#include
"RedstartWindow.h"
#include
<ui_RedstartWindow.h>
...
...
@@ -18,18 +20,53 @@
#include
<VACore.h>
#include
<VANet.h>
#include
<ITAAsioInterface.h>
#include
<ITAException.h>
RedstartWindow
::
RedstartWindow
(
QWidget
*
pParent
)
:
QMainWindow
(
pParent
)
,
ui
(
new
Ui
::
RedstartWindow
)
,
m_pCoreInstance
(
NULL
)
,
m_pCoreInstance
(
NULL
)
{
ui
->
setupUi
(
this
);
LoadConfiguration
();
//connect( &m_qRenderTimer, SIGNAL( timeout() ), this, SLOT( Render() ) );
}
RedstartWindow
::~
RedstartWindow
()
{
StoreConfiguration
();
}
void
RedstartWindow
::
LoadConfiguration
()
{
RestoreWindowSize
();
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
);
if
(
!
bValOK
)
iAudioBackend
=
AudioBackend
::
ASIO
;
ui
->
comboBox_audio_driver
->
setCurrentIndex
(
iAudioBackend
);
if
(
iAudioBackend
==
AudioBackend
::
PORTAUDIO
)
PopulatePortaudioDevicesFromSettings
();
else
PopulateAsioDevicesFromSettings
();
}
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
()
);
}
void
RedstartWindow
::
on_actionQuit_triggered
()
...
...
@@ -40,22 +77,22 @@ void RedstartWindow::on_actionQuit_triggered()
void
RedstartWindow
::
on_pushButton_start_stop_clicked
()
{
ui
->
pushButton_start_stop
->
setEnabled
(
false
);
try
{
if
(
m_pCoreInstance
)
{
if
(
m_pCoreInstance
->
GetState
()
==
IVAInterface
::
VA_CORESTATE_READY
)
try
{
if
(
m_pCoreInstance
)
{
if
(
m_pCoreInstance
->
GetState
()
==
IVAInterface
::
VA_CORESTATE_READY
)
m_pCoreInstance
->
Finalize
();
delete
m_pCoreInstance
;
delete
m_pCoreInstance
;
m_pCoreInstance
=
nullptr
;
ui
->
statusBar
->
showMessage
(
"VA core has been stopped."
);
PostCoreStop
();
}
else
{
CVAStruct
oVAConfigArgs
;
}
else
{
CVAStruct
oVAConfigArgs
;
m_pCoreInstance
=
VACore
::
CreateCoreInstance
(
"../VACore/conf/VACore.ini"
);
m_pCoreInstance
->
Initialize
();
...
...
@@ -71,11 +108,11 @@ void RedstartWindow::on_pushButton_start_stop_clicked()
delete
m_pCoreInstance
;
m_pCoreInstance
=
NULL
;
}
}
}
catch
(
const
CVAException
&
ex
)
{
ui
->
statusBar
->
showMessage
(
QString
::
fromStdString
(
ex
.
ToString
()
)
);
}
}
catch
(
const
CVAException
&
ex
)
{
ui
->
statusBar
->
showMessage
(
QString
::
fromStdString
(
ex
.
ToString
()
)
);
}
ui
->
pushButton_start_stop
->
setEnabled
(
true
);
}
...
...
@@ -116,3 +153,78 @@ void RedstartWindow::PostCoreStop()
ui
->
groupBox_paths
->
setEnabled
(
false
);
ui
->
groupBox_macros
->
setEnabled
(
false
);
}
void
RedstartWindow
::
RestoreWindowSize
()
{
restoreGeometry
(
m_qSettings
.
value
(
"Redstart/gui/WindowGeometry"
).
toByteArray
()
);
restoreState
(
m_qSettings
.
value
(
"Redstart/gui/WindowState"
).
toByteArray
()
);
}
void
RedstartWindow
::
AcquireAsioDevices
()
{
try
{
ITAsioInitializeLibrary
();
long
lDrivers
=
ITAsioGetNumDrivers
();
if
(
lDrivers
<=
0
)
ITA_EXCEPT1
(
INVALID_PARAMETER
,
"No ASIO-compatibel drivers could be found on this system."
);
m_voAsioDevices
.
clear
();
for
(
long
i
=
0
;
i
<
lDrivers
;
i
++
)
{
CAudioDeviceSpecs
oDeviceSpecs
;
oDeviceSpecs
.
iDriverNumber
=
i
;
oDeviceSpecs
.
sName
=
ITAsioGetDriverName
(
i
);
try
{
ITAsioInitializeDriver
(
i
);
long
in
,
out
;
ITAsioGetChannels
(
&
in
,
&
out
);
oDeviceSpecs
.
iNumInputChannels
=
int
(
in
);
oDeviceSpecs
.
iNumInputChannels
=
int
(
out
);
m_voAsioDevices
.
push_back
(
oDeviceSpecs
);
ITAsioFinalizeDriver
();
oDeviceSpecs
.
bInitializable
=
true
;
}
catch
(
const
ITAException
&
)
{
oDeviceSpecs
.
bInitializable
=
false
;
continue
;
}
if
(
oDeviceSpecs
.
bInitializable
)
m_voAsioDevices
.
push_back
(
oDeviceSpecs
);
}
ITAsioFinalizeLibrary
();
}
catch
(
const
ITAException
&
e
)
{
QString
sErrorMessage
=
QString
(
"Error during ASIO device acquisition: %1"
).
arg
(
QString
::
fromStdString
(
e
.
ToString
()
)
);
QErrorMessage
oErrMsg
;
oErrMsg
.
showMessage
(
sErrorMessage
);
oErrMsg
.
exec
();
}
}
void
RedstartWindow
::
PopulateAsioDevicesFromSettings
()
{
}
void
RedstartWindow
::
AcquirePortaudioDevices
()
{
}
void
RedstartWindow
::
PopulatePortaudioDevicesFromSettings
()
{
}
src/RedstartWindow.h
View file @
edcef3c1
...
...
@@ -14,6 +14,7 @@
#define IW_REDSTART_WINDOW
#include
<QMainWindow>
#include
<QSettings>
#include
<ITAPortaudioInterface.h>
#ifdef WIN32
...
...
@@ -37,6 +38,27 @@ public:
explicit
RedstartWindow
(
QWidget
*
pParent
=
0
);
~
RedstartWindow
();
enum
AudioBackend
{
ASIO
=
0
,
PORTAUDIO
=
1
,
};
struct
CAudioDeviceSpecs
{
int
iDriverNumber
;
QString
sName
;
int
iNumInputChannels
;
int
iNumOutputChannels
;
bool
bInitializable
;
bool
bDefaultDevice
;
inline
CAudioDeviceSpecs
()
{
bDefaultDevice
=
false
;
};
};
private
slots
:
void
on_actionQuit_triggered
();
...
...
@@ -46,9 +68,27 @@ private:
void
PostCoreStart
();
void
PostCoreStop
();
void
RestoreWindowSize
();
private:
Ui
::
RedstartWindow
*
ui
;
IVAInterface
*
m_pCoreInstance
;
std
::
vector
<
QString
>
m_vsAudioBackends
;
std
::
vector
<
CAudioDeviceSpecs
>
m_voAsioDevices
;
std
::
vector
<
CAudioDeviceSpecs
>
m_voPortaudioDevices
;
QSettings
m_qSettings
;
void
LoadConfiguration
();
void
StoreConfiguration
();
void
AcquireAsioDevices
();
void
PopulateAsioDevicesFromSettings
();
void
AcquirePortaudioDevices
();
void
PopulatePortaudioDevicesFromSettings
();
};
#endif // IW_REDSTART_WINDOW
src/main.cpp
View file @
edcef3c1
...
...
@@ -12,6 +12,9 @@
*/
#include
<QApplication>
#include
<QCoreApplication>
#include
<QLocale>
#include
"RedstartWindow.h"
int
main
(
int
argc
,
char
*
argv
[]
)
...
...
@@ -23,6 +26,12 @@ int main( int argc, char* argv[] )
a
.
setApplicationName
(
"Redstart"
);
a
.
setApplicationDisplayName
(
"Redstart VA GUI"
);
QLocale
::
setDefault
(
QLocale
::
English
);
QIcon
icon
;
//icon.addFile( QStringLiteral( ":/res/Redstart_icon.png" ), QSize(), QIcon::Normal, QIcon::On );
a
.
setWindowIcon
(
icon
);
RedstartWindow
w
;
w
.
show
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment