Switched to PortAudio
This commit is contained in:
39
main.cpp
39
main.cpp
@ -8,9 +8,36 @@
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
|
||||
#include "portaudio.h"
|
||||
|
||||
#include "jsonconverters.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
namespace {
|
||||
template<typename T>
|
||||
class CleanupHelper
|
||||
{
|
||||
public:
|
||||
CleanupHelper(T &&callback) :
|
||||
m_callback{std::move(callback)}
|
||||
{}
|
||||
|
||||
~CleanupHelper()
|
||||
{
|
||||
m_callback();
|
||||
}
|
||||
|
||||
private:
|
||||
T m_callback;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
auto makeCleanupHelper(T &&callback)
|
||||
{
|
||||
return CleanupHelper<T>{std::move(callback)};
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
@ -23,6 +50,18 @@ int main(int argc, char *argv[])
|
||||
qDebug() << "sslLibraryVersionString" << QSslSocket::sslLibraryVersionString();
|
||||
qDebug() << "sslLibraryBuildVersionString" << QSslSocket::sslLibraryBuildVersionString();
|
||||
|
||||
if (PaError err = Pa_Initialize(); err != paNoError)
|
||||
{
|
||||
QMessageBox::warning({}, QApplication::translate("main", "Error initializing PortAudio!"), QApplication::translate("main", "Error initializing PortAudio!") + "\n\n" + Pa_GetErrorText(err));
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto helper0 = makeCleanupHelper([](){
|
||||
qDebug() << "helper0";
|
||||
if (PaError err = Pa_Terminate(); err != paNoError)
|
||||
fprintf(stderr, "Could not terminate PortAudio!\n");
|
||||
});
|
||||
|
||||
qSetMessagePattern("%{time dd.MM.yyyy HH:mm:ss.zzz} "
|
||||
"["
|
||||
"%{if-debug}D%{endif}"
|
||||
|
Reference in New Issue
Block a user