Skip to content

Commit

Permalink
bump to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
danryu committed Aug 5, 2022
1 parent 5441d97 commit 46504e4
Show file tree
Hide file tree
Showing 9 changed files with 225 additions and 71 deletions.
20 changes: 10 additions & 10 deletions src/flexasio/FlexASIO/control_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,43 +66,43 @@ namespace flexasio {

UniqueHKEY OpenFlexAsioGuiInstallRegistryKey() {
HKEY registryKey;
const auto regOpenKeyError = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Fabrikat\\FlexASIOGUI\\Install", {}, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &registryKey);
if (regOpenKeyError != ERROR_SUCCESS) throw std::runtime_error("Unable to open FlexASIOGUI registry key: " + GetWindowsErrorString(regOpenKeyError));
const auto regOpenKeyError = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\KoordASIO\\Install", {}, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &registryKey);
if (regOpenKeyError != ERROR_SUCCESS) throw std::runtime_error("Unable to open KoordASIOSetup registry key: " + GetWindowsErrorString(regOpenKeyError));
return UniqueHKEY(registryKey);
}

std::wstring GetFlexAsioGuiInstallDirectory() {
Log() << "Attempting to open FlexASIOGUI install registry key";
Log() << "Attempting to open KoordASIOSetup install registry key";
const auto installRegistryKey = OpenFlexAsioGuiInstallRegistryKey();

Log() << "Attempting to query FlexASIOGUI install path registry value";
Log() << "Attempting to query KoordASIOSetup install path registry value";
return GetStringRegistryValue(installRegistryKey.get(), L"InstallPath");
}

void OpenFlexAsioGui(HWND windowHandle) {
const auto installDirectory = GetFlexAsioGuiInstallDirectory();
Log() << "FlexASIOGUI install directory: " << ConvertToUTF8(installDirectory);
Log() << "KoordASIOSetup install directory: " << ConvertToUTF8(installDirectory);

Execute(windowHandle, installDirectory + L"\\FlexASIOGUI.exe");
Execute(windowHandle, installDirectory + L"\\KoordASIOSetup.exe");
}

void OpenConfigurationDocs(HWND windowHandle) {
Execute(windowHandle, std::wstring(L"/~https://github.com/dechamps/FlexASIO/blob/") + ConvertFromUTF8(::dechamps_CMakeUtils_gitDescription) + L"/CONFIGURATION.md");
Execute(windowHandle, std::wstring(L"/~https://github.com/koord-live/KoordASIO/blob/") + ConvertFromUTF8(::dechamps_CMakeUtils_gitDescription) + L"/CONFIGURATION.md");
}

}

void OpenControlPanel(HWND windowHandle) {
Log() << "Attempting to open FlexASIO GUI";
Log() << "Attempting to open KoordASIOSetup";
try {
OpenFlexAsioGui(windowHandle);
return;
}
catch (const std::exception& exception) {
Log() << "Unable to open FlexASIO GUI: " << ::dechamps_cpputil::GetNestedExceptionMessage(exception);
Log() << "Unable to open KoordASIOSetup: " << ::dechamps_cpputil::GetNestedExceptionMessage(exception);
}
catch (...) {
Log() << "Unable to open FlexASIO GUI due to unknown exception";
Log() << "Unable to open KoordASIOSetup due to unknown exception";
}

Log() << "Attempting to open configuration docs";
Expand Down
Binary file modified src/kdasioconfig/images/Fader BTN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/kdasioconfig/images/Koord Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
110 changes: 108 additions & 2 deletions src/kdasioconfig/kdasioconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include "toml.h"
#include <QDebug>
#include <QProcess>
#include <QDialog>
#include <QTextBrowser>
#include <QColor>
#include <QDesktopServices>

KdASIOConfigBase::KdASIOConfigBase(QWidget *parent)
: QMainWindow(parent)
Expand All @@ -29,9 +33,20 @@ KdASIOConfig::KdASIOConfig(QWidget *parent)
connect(outputAudioSettButton, &QPushButton::pressed, this, &KdASIOConfig::outputAudioSettClicked);
connect(bufferSizeSlider, &QSlider::valueChanged, this, &KdASIOConfig::bufferSizeChanged);
connect(bufferSizeSlider, &QSlider::valueChanged, this, &KdASIOConfig::bufferSizeDisplayChange);
// info buttons
connect(inputInfoButton, &QPushButton::pressed, this, &KdASIOConfig::inputInfoClicked);
connect(outputInfoButton, &QPushButton::pressed, this, &KdASIOConfig::outputInfoClicked);
connect(renderInfoButton, &QPushButton::pressed, this, &KdASIOConfig::renderInfoClicked);
connect(bufferInfoButton, &QPushButton::pressed, this, &KdASIOConfig::bufferInfoClicked);
// connect footer buttons
connect(koordLiveButton, &QPushButton::pressed, this, &KdASIOConfig::koordLiveClicked);
connect(githubButton, &QPushButton::pressed, this, &KdASIOConfig::githubClicked);

// bufferSizeDisplay->setStyleSheet("background-color: black");

koordLiveButton->setCursor(Qt::PointingHandCursor);
githubButton->setCursor(Qt::PointingHandCursor);

// populate input device choices
inputDeviceBox->clear();
const auto input_devices = m_devices->audioInputs();
Expand Down Expand Up @@ -191,6 +206,7 @@ void KdASIOConfig::bufferSizeChanged(int idx)
// THUS avoiding lots of spurious intermediate updates on buffer changes
bufferSize = bufferSizes[idx];
bufferSizeSlider->setValue(idx);
latencyLabel->setText(QString::number(double(bufferSize) / 48, 'f', 2));
writeTomlFile();
}

Expand Down Expand Up @@ -252,12 +268,102 @@ void KdASIOConfig::inputAudioSettClicked()
{
// open Windows audio input settings control panel
QProcess *myProcess = new QProcess(this);
myProcess->startDetached(inputAudioSettPath);
myProcess->startDetached("control", QStringList() << inputAudioSettPath);
}

void KdASIOConfig::outputAudioSettClicked()
{
// open Windows audio output settings control panel
QProcess *myProcess = new QProcess(this);
myProcess->startDetached(outputAudioSettPath);
myProcess->startDetached("control", QStringList() << outputAudioSettPath);
}


void KdASIOConfig::inputInfoClicked()
{
QDialog *qd = new QDialog(this);
QLabel *qlab = new QLabel();
QString inputInfoText = "<b>" +
tr ( "AUDIO INPUT DEVICE - Tips" ) +
"</b> " +
"<br>" + "<br>" +
"Choose your Audio Input Device here, eg your microphone. " +
"<br>" + "<br>" +
"Click the tool button to go to Windows audio control panel and configure.";
qlab->setText(inputInfoText);
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(qlab);
qd->setLayout(layout);
qd->setPalette(QPalette("#1d1f21"));
qd->show();
}

void KdASIOConfig::outputInfoClicked()
{
QDialog *qd = new QDialog(this);
QLabel *qlab = new QLabel();
QString outputInfoText = "<b>" +
tr ( "AUDIO OUTPUT DEVICE - Tips" ) +
"</b> " +
"<br>" + "<br>" +
"Choose your Audio Output Device here, eg your headphones. " +
"<br>" + "<br>" +
"Click the tool button to go to Windows audio control panel and configure.";
qlab->setText(outputInfoText);
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(qlab);
qd->setLayout(layout);
qd->setPalette(QPalette("#1d1f21"));
qd->show();
}

void KdASIOConfig::renderInfoClicked()
{
QDialog *qd = new QDialog(this);
QLabel *qlab = new QLabel();
QString renderInfoText = "<b>" +
tr ( "RENDERING MODE - Tips" ) +
"</b> " +
"<br>" + "<br>" +
"Choose between Shared and Exclusive modes, provided by the WASAPI Windows audio system." +
"<br>" + "<br>" +
"Shared Mode: mix ASIO with regular Windows audio." +
"<br>" + "<br>" +
"Exclusive Mode: lowest latency, locks out access from other audio applications."
;
qlab->setText(renderInfoText);
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(qlab);
qd->setLayout(layout);
qd->setPalette(QPalette("#1d1f21"));
qd->show();
}

void KdASIOConfig::bufferInfoClicked()
{
QDialog *qd = new QDialog(this);
QLabel *qlab = new QLabel();
QString inputInfoText = "<b>" +
tr ( "BUFFER SIZE - Tips" ) +
"</b> " +
"<br>" + "<br>" +
"Select the size of the ASIO Buffer, by the number of samples. " +
"<br>" + "<br>" +
"A lower size may cause glitches in your sound, while higher size causes higher latency.";
qlab->setText(inputInfoText);
QVBoxLayout *layout = new QVBoxLayout();
layout->addWidget(qlab);
qd->setLayout(layout);
qd->setPalette(QPalette("#1d1f21"));
qd->show();
}

void KdASIOConfig::koordLiveClicked()
{
QDesktopServices::openUrl(QUrl("https://koord.live", QUrl::TolerantMode));
}

void KdASIOConfig::githubClicked()
{
QDesktopServices::openUrl(QUrl("/~https://github.com/koord-live/KoordASIO/releases", QUrl::TolerantMode));
}
10 changes: 8 additions & 2 deletions src/kdasioconfig/kdasioconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class KdASIOConfig : public KdASIOConfigBase
QString outputDeviceName;
QString inputDeviceName;
QString fullpath = QDir::homePath() + "/.KoordASIO-builtin.toml";
QString inputAudioSettPath = "control mmsys.cpl,,1";
QString outputAudioSettPath = "control mmsys.cpl";
QString inputAudioSettPath = "mmsys.cpl,,1";
QString outputAudioSettPath = "mmsys.cpl";
QList<int> bufferSizes = { 32, 64, 128, 256, 512, 1024, 2048 };

private slots:
Expand All @@ -105,6 +105,12 @@ private slots:
void setValuesFromToml(std::ifstream *ifs, toml::ParseResult *pr);
void inputAudioSettClicked();
void outputAudioSettClicked();
void inputInfoClicked();
void outputInfoClicked();
void renderInfoClicked();
void bufferInfoClicked();
void koordLiveClicked();
void githubClicked();
};

#endif
Expand Down
Loading

0 comments on commit 46504e4

Please sign in to comment.