Memory JS8

This commit is contained in:
Jordan Sherer 2019-11-03 13:58:34 -05:00
parent 4fc50629e6
commit c72857aa76
2 changed files with 10 additions and 9 deletions

View File

@ -95,8 +95,8 @@ int main(int argc, char *argv[])
Radio::register_types (); Radio::register_types ();
register_types (); register_types ();
// Multiple instances communicate with jt9 via this // Multiple instances communicate with the decoder via this shared memory segment
QSharedMemory mem_jt9; QSharedMemory mem_js8;
QApplication a(argc, argv); QApplication a(argc, argv);
try try
@ -294,21 +294,21 @@ int main(int argc, char *argv[])
// Create and initialize shared memory segment // Create and initialize shared memory segment
// Multiple instances: use rig_name as shared memory key // Multiple instances: use rig_name as shared memory key
mem_jt9.setKey(a.applicationName ()); mem_js8.setKey(a.applicationName ());
if(!mem_jt9.attach()) { if(!mem_js8.attach()) {
std::cerr << QString("memory attach error: %1").arg(mem_jt9.error()).toLocal8Bit ().data () << std::endl; std::cerr << QString("memory attach error: %1").arg(mem_js8.error()).toLocal8Bit ().data () << std::endl;
if (!mem_jt9.create(sizeof(struct dec_data))) { if (!mem_js8.create(sizeof(struct dec_data))) {
splash.hide (); splash.hide ();
std::cerr << QString("memory create error: %1").arg(mem_jt9.error()).toLocal8Bit ().data () << std::endl; std::cerr << QString("memory create error: %1").arg(mem_js8.error()).toLocal8Bit ().data () << std::endl;
MessageBox::critical_message (nullptr, a.translate ("main", "Shared memory error"), MessageBox::critical_message (nullptr, a.translate ("main", "Shared memory error"),
a.translate ("main", "Unable to create shared memory segment")); a.translate ("main", "Unable to create shared memory segment"));
throw std::runtime_error {"Shared memory error"}; throw std::runtime_error {"Shared memory error"};
} }
} }
memset(mem_jt9.data(),0,sizeof(struct dec_data)); //Zero all decoding params in shared memory memset(mem_js8.data(),0,sizeof(struct dec_data)); //Zero all decoding params in shared memory
unsigned downSampleFactor; unsigned downSampleFactor;
{ {
@ -328,7 +328,7 @@ int main(int argc, char *argv[])
} }
// run the application UI // run the application UI
MainWindow w(temp_dir, multiple, &multi_settings, &mem_jt9, downSampleFactor, &splash); MainWindow w(temp_dir, multiple, &multi_settings, &mem_js8, downSampleFactor, &splash);
w.show(); w.show();
//splash.raise (); //splash.raise ();
QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit())); QObject::connect (&a, SIGNAL (lastWindowClosed()), &a, SLOT (quit()));

View File

@ -877,6 +877,7 @@ private:
QDateTime m_dateTimeLastTX; QDateTime m_dateTimeLastTX;
QSharedMemory *mem_js8; QSharedMemory *mem_js8;
LogBook m_logBook; LogBook m_logBook;
QString m_QSOText; QString m_QSOText;
unsigned m_msAudioOutputBuffered; unsigned m_msAudioOutputBuffered;