Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/59-object-storage-pilot

Commit c2ac6784 authored by Leander Schulten's avatar Leander Schulten
Browse files

Fix last commit:

improve fileSelector inputfield in SettingsView.
Update Capture Windows Sound Output lib.
minor improvements
parent 60c30c84
......@@ -2,6 +2,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import "component"
Pane{
GridLayout{
......@@ -12,42 +13,26 @@ Pane{
Label{
text: "Settings file path:"
}
TextInputField{
text: Settings.jsonSettingsFilePath
onAccepted: Settings.jsonSettingsFilePath = text;
MouseArea{
anchors.fill: parent
onClicked: {
//fileDialog.folder = Settings.jsonSettingsFilePath;
fileDialog.open();
/*fileDialog.addSelection(Settings.jsonSettingsFilePath);
fileDialog.callback = function(file){
Settings.jsonSettingsFilePath = file;
};*/
}
}
TextFieldFileChooser{
Layout.fillWidth: true
folder: false
path: Settings.jsonSettingsFilePath
onPathChanged: {Settings.jsonSettingsFilePath = path;path = Settings.jsonSettingsFilePath;}
fileChooser: fileDialog
}
Label{
Layout.fillWidth: true
text: "Driver file path:"
}
TextInputField{
TextFieldFileChooser{
Layout.fillWidth: true
text: Settings.driverFilePath
onAccepted: Settings.driverFilePath = text;
MouseArea{
anchors.fill: parent
onClicked: {
fileDialog.folder = Settings.driverFilePath;
fileDialog.open();
fileDialog.addSelection(Settings.driverFilePath);
fileDialog.callback = function(file){
console.log(file);
Settings.driverFilePath = file;
};
}
}
folder: false
path: Settings.driverFilePath
onPathChanged: {Settings.driverFilePath = path;path = Settings.driverFilePath;}
fileChooser: fileDialog
}
Label{
text: "Update pause for dmx in ms:"
}
......@@ -59,87 +44,43 @@ Pane{
text: Settings.updatePauseInMs;
onAccepted: Settings.updatePauseInMs = text;
}
Label{
Layout.fillWidth: true
text: "Module Directory:"
}
TextInputField{
TextFieldFileChooser{
Layout.fillWidth: true
text: Settings.moduleDirPath
//onAccepted: Settings.moduleDirPath = text;
MouseArea{
anchors.fill: parent
onClicked: {
fileDialog.selectFolder = true;
fileDialog.selectMultiple = false;
fileDialog.folder = Settings.moduleDirPath;
fileDialog.open();
fileDialog.addSelection(Settings.moduleDirPath);
fileDialog.callback = function(file){
console.log(file);
Settings.moduleDirPath = file;
parent.text = file;
};
}
}
folder: true
path: Settings.moduleDirPath
onPathChanged: {Settings.moduleDirPath = path;path = Settings.moduleDirPath;}
fileChooser: fileDialog
}
Label{
Layout.fillWidth: true
text: "Compiler File Path:"
}
TextInputField{
TextFieldFileChooser{
Layout.fillWidth: true
text: Settings.compilerPath
onAccepted: Settings.compilerPath = text;
Button{
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: -5
anchors.bottomMargin: -5
anchors.bottom: parent.bottom
text: "File Chooser"
onClicked: {
fileDialog.selectFolder = false;
fileDialog.selectMultiple = false;
fileDialog.folder = Settings.compilerPath;
fileDialog.open();
fileDialog.addSelection(Settings.compilerPath);
fileDialog.callback = function(file){
console.log(file);
Settings.compilerPath = file;
};
}
}
folder: true
path: Settings.compilerPath
onPathChanged: {Settings.compilerPath = path;path = Settings.compilerPath;}
fileChooser: fileDialog
}
Label{
Layout.fillWidth: true
text: "Include Path:"
}
TextInputField{
TextFieldFileChooser{
Layout.fillWidth: true
text: Settings.includePath
onAccepted: Settings.includePath = text;
Button{
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: -5
anchors.bottomMargin: -5
anchors.bottom: parent.bottom
text: "File Chooser"
onClicked: {
fileDialog.selectFolder = true;
fileDialog.selectMultiple = false;
fileDialog.folder = Settings.includePath;
fileDialog.open();
fileDialog.addSelection(Settings.includePath);
fileDialog.callback = function(file){
console.log(file);
Settings.includePath = file;
};
}
}
folder: true
path: Settings.includePath
onPathChanged: {Settings.includePath = path;path = Settings.includePath;}
fileChooser: fileDialog
}
Label{
Layout.fillWidth: true
text: "Compiler Flags:"
......@@ -149,6 +90,7 @@ Pane{
text: Settings.compilerFlags
onAccepted: Settings.compilerFlags = text;
}
Label{
Layout.fillWidth: true
text: "Compiler Library Flags:"
......@@ -163,28 +105,12 @@ Pane{
Layout.fillWidth: true
text: "AudioCaptureLib:"
}
TextInputField{
TextFieldFileChooser{
Layout.fillWidth: true
text: Settings.audioCaptureFilePath
onAccepted: Settings.audioCaptureFilePath = text;
Button{
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: -5
anchors.bottomMargin: -5
anchors.bottom: parent.bottom
text: "File Chooser"
onClicked: {
fileDialog.selectFolder = false;
fileDialog.selectMultiple = false;
fileDialog.folder = Settings.audioCaptureFilePath;
fileDialog.open();
fileDialog.addSelection(Settings.audioCaptureFilePath);
fileDialog.callback = function(file){
Settings.audioCaptureFilePath = file;
};
}
}
folder: false
path: Settings.audioCaptureFilePath
onPathChanged: {Settings.audioCaptureFilePath = path;path = Settings.audioCaptureFilePath;}
fileChooser: fileDialog
}
}
FileDialog{
......
......@@ -54,6 +54,7 @@ void AudioCaptureManager::dataCallback(float* data, unsigned int frames, bool*do
}
bool AudioCaptureManager::startCapturing(QString filePathToCaptureLibrary){
stopCapturingAndWait();
typedef int (*capture)(void(*)(int),void(*)(float*,unsigned int, bool*)) ;
auto func = reinterpret_cast<capture>(QLibrary::resolve(filePathToCaptureLibrary,"captureAudio"));
if(func){
......
......@@ -36,6 +36,8 @@ private:
void dataCallback(float* data, unsigned int frames, bool*done);
public:
bool startCapturing(QString filePathToCaptureLibrary);
void stopCapturing(){run=false;}
void stopCapturingAndWait(){run=false;if(captureAudioThread.joinable())captureAudioThread.join();}
bool isCapturing(){return run;}
const std::array<float,2048>& getFFTOutput(){return fftoutput;}
public:
......
......@@ -160,6 +160,11 @@ int main(int argc, char *argv[])
settings.connect(&settings,&Settings::driverFilePathChanged,[&](){
Driver::loadAndStartDriver(settings.getDriverFilePath());
});
settings.connect(&settings,&Settings::audioCaptureFilePathChanged,[&](){
if(Audio::AudioCaptureManager::get().startCapturing(settings.getAudioCaptureFilePath())==false){
ErrorNotifier::get()->newError("Failed to load Audio Capture Library");
}
});
settings.connect(&settings,&Settings::updatePauseInMsChanged,[&](){
if(Driver::getCurrentDriver()){
Driver::getCurrentDriver()->setWaitTime(std::chrono::milliseconds(settings.getUpdatePauseInMs()));
......
......@@ -4,8 +4,6 @@ import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import custom.licht 1.0
import QtQuick.Dialogs 1.2
import "ControlPane"
ApplicationWindow {
visible: true
width: 900
......
......@@ -67,7 +67,7 @@ typedef Modules::Program* (*CreateProgramm)(unsigned int index);
ModuleManager::ModuleManager()
{
fftOutputView = Audio::AudioCaptureManager::get().getFFTOutput();
QObject::connect(&Audio::AudioCaptureManager::get(),&Audio::AudioCaptureManager::capturingStatusChanged,[this](){
captureStatusChangedConnection = QObject::connect(&Audio::AudioCaptureManager::get(),&Audio::AudioCaptureManager::capturingStatusChanged,[this](){
for(const auto & info : loadedLibraryMap){
if(info.second.supportAudioFunc){
info.second.supportAudioFunc(Audio::AudioCaptureManager::get().isCapturing());
......
......@@ -254,6 +254,7 @@ signals:
ConsumerModuleContainer consumer;
Controller controller_;
FFTOutputView<float> fftOutputView;
QMetaObject::Connection captureStatusChangedConnection;
private:
template<typename Type, typename String, typename Callback>
static void loadType(QLibrary & lib, ModuleContainer<detail::Entry<Type>> &c,String name, int libraryIdentifier, Callback = nullptr);
......@@ -262,7 +263,7 @@ signals:
public:
ModuleManager();
~ModuleManager(){for(auto m : modules)delete m;}
~ModuleManager(){for(auto m : modules)delete m;QObject::disconnect(captureStatusChangedConnection);}
/**
* @brief getFreeAbsoluteFilePathForModule if you have a new compiled module that is not loaded, you can get here a new free name.
* @note Important! If you use an old file name, maybe the old lib gets loaded, even when you delete the file
......
......@@ -22,13 +22,33 @@ class Settings : public QObject
Q_PROPERTY(unsigned int updatePauseInMs READ getUpdatePauseInMs WRITE setUpdatePauseInMs NOTIFY updatePauseInMsChanged)
public:
explicit Settings(QObject *parent = nullptr);
void setJsonSettingsFilePath(QString file){if(!QFile::exists(file))return;settings.setValue("jsonSettingsFilePath",file);emit jsonSettingsFilePathChanged();}
void setJsonSettingsFilePath(QString file){
if(file == getJsonSettingsFilePath())return;
if(QFile::exists(file)){
settings.setValue("jsonSettingsFilePath",file);
emit jsonSettingsFilePathChanged();
}
}
QString getJsonSettingsFilePath()const{return settings.value("jsonSettingsFilePath").toString();}
void setDriverFilePath(QString file){if(!QFile::exists(file))return;settings.setValue("driverFilePath",file);emit driverFilePathChanged();}
void setDriverFilePath(QString file){
if(file == getDriverFilePath())return;
if(QFile::exists(file)){
settings.setValue("driverFilePath",file);
emit driverFilePathChanged();
}
}
QString getDriverFilePath()const{return settings.value("driverFilePath").toString();}
void setAudioCaptureFilePath(QString file){if(!QFile::exists(file))return;settings.setValue("audioCaptureFilePath",file);emit audioCaptureFilePathChanged();}
void setAudioCaptureFilePath(QString file){
if(file == getAudioCaptureFilePath()){
return;
}
if(QFile::exists(file)){
settings.setValue("audioCaptureFilePath",file);
emit audioCaptureFilePathChanged();
}
}
QString getAudioCaptureFilePath()const{return settings.value("audioCaptureFilePath").toString();}
void setUpdatePauseInMs(unsigned int pause){settings.setValue("updatePauseInMs",pause);emit updatePauseInMsChanged();}
......
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