From 6d9f896b3362af0514df090870737afcdaab7224 Mon Sep 17 00:00:00 2001 From: "Edson W. R. Pereira" Date: Sat, 13 Apr 2013 15:22:12 +0000 Subject: [PATCH] Moved Portaudio initialization to the main function. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3165 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- main.cpp | 8 ++++++++ mainwindow.cpp | 16 ---------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/main.cpp b/main.cpp index a28f1c686..0fd573ae5 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "mainwindow.h" QSharedMemory mem_jt9("mem_jt9"); @@ -33,6 +34,13 @@ int main(int argc, char *argv[]) } memset(to,0,size); //Zero all decoding params in shared memory + //Initialize Portaudio + PaError paerr=Pa_Initialize(); + if(paerr!=paNoError) { + QMessageBox::critical( 0, "Error", "Unable to initialize PortAudio."); + exit(1); + } + MainWindow w(&mem_jt9); w.show(); return a.exec(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 2f6793064..a0ec732ce 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -193,23 +193,7 @@ MainWindow::MainWindow(QSharedMemory *shdmem, QWidget *parent) : } #endif mem_jt9 = shdmem; - /* - if(!mem_jt9.attach()) { - if (!mem_jt9.create(sizeof(jt9com_))) { - msgBox("Unable to create shared memory segment."); - } - } - char *to = (char*)mem_jt9.data(); - int size=sizeof(jt9com_); - if(jt9com_.newdat==0) { - } - memset(to,0,size); //Zero all decoding params in shared memory -*/ - PaError paerr=Pa_Initialize(); //Initialize Portaudio - if(paerr!=paNoError) { - msgBox("Unable to initialize PortAudio."); - } readSettings(); //Restore user's setup params if(m_dFreq.length()<=1) { m_dFreq.clear();