Merge branch 'wfserver'

merge-requests/9/merge
Roeland Jansen 2022-05-24 11:18:41 +02:00
commit b4f379d52d
2 zmienionych plików z 16 dodań i 2 usunięć

Wyświetl plik

@ -33,7 +33,7 @@ bool debugMode=false;
Q_UNUSED(sig)
qDebug() << "Exiting via SIGNAL";
if (w!=Q_NULLPTR) w->deleteLater();
qApp->quit();
QCoreApplication::quit();
#ifdef Q_OS_WIN
return true;
@ -177,6 +177,8 @@ int main(int argc, char *argv[])
SetConsoleCtrlHandler((PHANDLER_ROUTINE)cleanup, TRUE);
#else
signal(SIGINT, cleanup);
signal(SIGTERM, cleanup);
signal(SIGKILL, cleanup);
#endif
w = new servermain(serialPortCL, hostCL, settingsFile);
#else

Wyświetl plik

@ -6,6 +6,7 @@
#include <objbase.h>
#endif
#define RT_EXCEPTION
rtHandler::rtHandler(QObject* parent)
{
@ -16,13 +17,17 @@ rtHandler::~rtHandler()
{
if (isInitialized) {
#ifdef RT_EXCEPTION
try {
#endif
audio->abortStream();
audio->closeStream();
#ifdef RT_EXCEPTION
}
catch (RtAudioError& e) {
qInfo(logAudio()) << "Error closing stream:" << aParams.deviceId << ":" << QString::fromStdString(e.getMessage());
}
#endif
delete audio;
}
@ -87,14 +92,17 @@ bool rtHandler::init(audioSetup setup)
}
aParams.firstChannel = 0;
#ifdef RT_EXCEPTION
try {
#endif
info = audio->getDeviceInfo(aParams.deviceId);
#ifdef RT_EXCEPTION
}
catch (RtAudioError e) {
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "Device exception:" << aParams.deviceId << ":" << QString::fromStdString(e.getMessage());
goto errorHandler;
}
#endif
if (info.probed)
{
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << QString::fromStdString(info.name) << "(" << aParams.deviceId << ") successfully probed";
@ -190,7 +198,9 @@ bool rtHandler::init(audioSetup setup)
// Per channel chunk size.
this->chunkSize = (outFormat.bytesForDuration(setup.blockSize * 1000) / (outFormat.sampleSize()/8) / outFormat.channelCount());
#ifdef RT_EXCEPTION
try {
#endif
if (setup.isinput) {
audio->openStream(NULL, &aParams, sampleFormat, outFormat.sampleRate(), &this->chunkSize, &staticWrite, this, &options);
emit setupConverter(outFormat, inFormat, 7, setup.resampleQuality);
@ -205,12 +215,14 @@ bool rtHandler::init(audioSetup setup)
isInitialized = true;
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "device successfully opened";
qInfo(logAudio()) << (setup.isinput ? "Input" : "Output") << "detected latency:" << audio->getStreamLatency();
#ifdef RT_EXCEPTION
}
catch (RtAudioError& e) {
qInfo(logAudio()) << "Error opening:" << QString::fromStdString(e.getMessage());
// Try again?
goto errorHandler;
}
#endif
}
else
{