From e5686cb21f2e57b766bd1da53284e7ae171501bb Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 7 Dec 2020 10:40:52 +0000 Subject: [PATCH 1/3] Minor documentation clarification --- Darwin/ReadMe.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Darwin/ReadMe.txt b/Darwin/ReadMe.txt index 283aa1025..78c092ca4 100644 --- a/Darwin/ReadMe.txt +++ b/Darwin/ReadMe.txt @@ -34,10 +34,9 @@ Double-click on the wsjtx-...-Darwin.dmg file you have downloaded from K1JT's we Now open a Terminal window by going to Applications->Utilities and clicking on Terminal. Along with this ReadMe file there is a file: sysctl.conf which must be copied to a -system area by typing these two lines in the Terminal window and then pressing the Return key -after each line. +system area by typing this line in the Terminal window and then pressing the Return key. - sudo cp /Volumes/WSJT-X/sysctl.conf /etc + sudo cp /Volumes/WSJT-X/sysctl.conf /etc you will be asked for your normal password because authorisation is needed to copy this file. (Your password will not be echoed but press the Return key when completed.) @@ -45,7 +44,7 @@ Now re-boot your Mac. This is necessary to install the changes. After the reboot you should re-open the Terminal window as before and you can check that the change has been made by typing: - sysctl -a | grep sysv.shm + sysctl -a | grep sysv.shm If shmmax is not shown as 104857600 then contact me since WSJT-X will fail to load with an error message: "Unable to create shared memory segment". From cefc8e26452375c2188976f1ee6c079721cd38ab Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 7 Dec 2020 10:41:33 +0000 Subject: [PATCH 2/3] Use the system localized short date format for Log QSO dialog dates This brings these fields into line with other QSO start and end date/time fields elsewhere in the user interface. Note that time entry and edit fields use a fixed hh:mm:ss 24-hour clock format consistent with UTC usage and of suitable accuracy for logging QSOs. --- widgets/logqso.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/widgets/logqso.cpp b/widgets/logqso.cpp index 7a74b86cf..f49274494 100644 --- a/widgets/logqso.cpp +++ b/widgets/logqso.cpp @@ -1,5 +1,6 @@ #include "logqso.h" +#include #include #include #include @@ -61,6 +62,9 @@ LogQSO::LogQSO(QString const& programTitle, QSettings * settings ui->comboBoxPropMode->addItem (prop_mode.name_, prop_mode.id_); } loadSettings (); + auto date_time_format = QLocale {}.dateFormat (QLocale::ShortFormat) + " hh:mm:ss"; + ui->start_date_time->setDisplayFormat (date_time_format); + ui->end_date_time->setDisplayFormat (date_time_format); ui->grid->setValidator (new MaidenheadLocatorValidator {this}); } From 60792182ad9c9771139c128a8114f4ba1edabf56 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 7 Dec 2020 20:34:56 +0000 Subject: [PATCH 3/3] Environment variables to set audio buffer sizes and fix Windows Rx timing The two environment variables: WSJT_RX_AUDIO_BUFFER_FRAMES WSJT_TX_AUDIO_BUFFER_FRAMES each can be defined to an integer number which will be used as the suggested audio buffer size for Rx and Tx respectively. Not setting the variable or setting it to zero or less will cause the default buffer size to be used, which should be a good choice for most, if not all, systems. --- Audio/soundin.cpp | 11 +++++------ Audio/soundout.cpp | 2 +- widgets/mainwindow.cpp | 11 +++++++---- widgets/mainwindow.h | 1 + 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Audio/soundin.cpp b/Audio/soundin.cpp index 581f1a92f..53a29799c 100644 --- a/Audio/soundin.cpp +++ b/Audio/soundin.cpp @@ -88,17 +88,16 @@ void SoundInput::start(QAudioDeviceInfo const& device, int framesPerBuffer, Audi //qDebug () << "SoundIn default buffer size (bytes):" << m_stream->bufferSize () << "period size:" << m_stream->periodSize (); // the Windows MME version of QAudioInput uses 1/5 of the buffer // size for period size other platforms seem to optimize themselves -#if defined (Q_OS_WIN) - m_stream->setBufferSize (m_stream->format ().bytesForFrames (framesPerBuffer * 5)); -#else - Q_UNUSED (framesPerBuffer); -#endif + if (framesPerBuffer > 0) + { + m_stream->setBufferSize (m_stream->format ().bytesForFrames (framesPerBuffer)); + } if (m_sink->initialize (QIODevice::WriteOnly, channel)) { m_stream->start (sink); checkStream (); cummulative_lost_usec_ = -1; - //qDebug () << "SoundIn selected buffer size (bytes):" << m_stream->bufferSize () << "peirod size:" << m_stream->periodSize (); + LOG_DEBUG ("Selected buffer size (bytes): " << m_stream->bufferSize () << " period size: " << m_stream->periodSize ()); } else { diff --git a/Audio/soundout.cpp b/Audio/soundout.cpp index 7f38447ac..f3ec3dce3 100644 --- a/Audio/soundout.cpp +++ b/Audio/soundout.cpp @@ -111,7 +111,7 @@ void SoundOutput::restart (QIODevice * source) } m_stream->setCategory ("production"); m_stream->start (source); - LOG_INFO ("Selected buffer size (bytes): " << m_stream->bufferSize () << " period size: " << m_stream->periodSize ()); + LOG_DEBUG ("Selected buffer size (bytes): " << m_stream->bufferSize () << " period size: " << m_stream->periodSize ()); } void SoundOutput::suspend () diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 8ce3e29cb..a24065d60 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -211,7 +211,7 @@ namespace QRegularExpression grid_regexp {"\\A(?![Rr]{2}73)[A-Ra-r]{2}[0-9]{2}([A-Xa-x]{2}){0,1}\\z"}; auto quint32_max = std::numeric_limits::max (); constexpr int N_WIDGETS {36}; - constexpr int rx_chunk_size {3456}; // audio samples at 12000 Hz + constexpr int default_rx_audio_buffer_frames {-1}; // lets Qt decide constexpr int default_tx_audio_buffer_frames {-1}; // lets Qt decide bool message_is_73 (int type, QStringList const& msg_parts) @@ -265,6 +265,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_soundInput {new SoundInput}, m_modulator {new Modulator {TX_SAMPLE_RATE, NTMAX}}, m_soundOutput {new SoundOutput}, + m_rx_audio_buffer_frames {0}, m_tx_audio_buffer_frames {0}, m_msErase {0}, m_secBandChanged {0}, @@ -457,7 +458,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_soundInput->moveToThread (&m_audioThread); m_detector->moveToThread (&m_audioThread); bool ok; - auto buffer_size = env.value ("WSJT_TX_AUDIO_BUFFER_FRAMES", "0").toInt (&ok); + auto buffer_size = env.value ("WSJT_RX_AUDIO_BUFFER_FRAMES", "0").toInt (&ok); + m_rx_audio_buffer_frames = ok && buffer_size ? buffer_size : default_rx_audio_buffer_frames; + buffer_size = env.value ("WSJT_TX_AUDIO_BUFFER_FRAMES", "0").toInt (&ok); m_tx_audio_buffer_frames = ok && buffer_size ? buffer_size : default_tx_audio_buffer_frames; // hook up sound output stream slots & signals and disposal @@ -939,7 +942,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, if (!m_config.audio_input_device ().isNull ()) { Q_EMIT startAudioInputStream (m_config.audio_input_device () - , rx_chunk_size * m_downSampleFactor + , m_rx_audio_buffer_frames , m_detector, m_downSampleFactor, m_config.audio_input_channel ()); } if (!m_config.audio_output_device ().isNull ()) @@ -1851,7 +1854,7 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog if(m_config.restart_audio_input () && !m_config.audio_input_device ().isNull ()) { Q_EMIT startAudioInputStream (m_config.audio_input_device () - , rx_chunk_size * m_downSampleFactor + , m_rx_audio_buffer_frames , m_detector, m_downSampleFactor , m_config.audio_input_channel ()); } diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 878e9c6c3..7dfbf8a7e 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -404,6 +404,7 @@ private: SoundInput * m_soundInput; Modulator * m_modulator; SoundOutput * m_soundOutput; + int m_rx_audio_buffer_frames; int m_tx_audio_buffer_frames; QThread m_audioThread;