mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-20 06:38:48 -04:00
Remove user adjustable audio buffer sizes from Settings
Fixed buffer sizes are used. Rx use s 3456 x 1st downsample rate x 5 audio frames of buffer space. On Windows this means that each chunk (periodSize()) delivered from the audio stream is our initial DSP processing chunk size, thus matching audio buffer latency exactly with WSJT-X's own front end latency. This should result in optimal resilience to high system loads that might starve the soundcard ADC of buffers to fill and case dropped audio frames. For Tx a buffer sufficient for 1 s of audio is used at present, on Windows the period size will be set to 1/40 of that which gives reasonably low latency and plenty of resilience to high system loads that might starve the soundcard DAC of audio frames to render. Note that a 1 s buffer will make the "Pwr" slider slow to respond, we may have to reduce the Tx audio buffer size if this is seen as a problem.
This commit is contained in:
@@ -242,8 +242,6 @@ namespace
|
||||
// Magic numbers for file validation
|
||||
constexpr quint32 qrg_magic {0xadbccbdb};
|
||||
constexpr quint32 qrg_version {100}; // M.mm
|
||||
|
||||
constexpr int default_audio_buffer_size = 10;
|
||||
}
|
||||
|
||||
|
||||
@@ -648,10 +646,8 @@ private:
|
||||
|
||||
QAudioDeviceInfo audio_input_device_;
|
||||
AudioDevice::Channel audio_input_channel_;
|
||||
int audio_input_buffer_size_;
|
||||
QAudioDeviceInfo audio_output_device_;
|
||||
AudioDevice::Channel audio_output_channel_;
|
||||
int audio_output_buffer_size_;
|
||||
|
||||
friend class Configuration;
|
||||
};
|
||||
@@ -681,10 +677,8 @@ bool Configuration::is_active () const {return m_->isVisible ();}
|
||||
|
||||
QAudioDeviceInfo const& Configuration::audio_input_device () const {return m_->audio_input_device_;}
|
||||
AudioDevice::Channel Configuration::audio_input_channel () const {return m_->audio_input_channel_;}
|
||||
int Configuration::audio_input_buffer_size () const {return m_->audio_input_buffer_size_ * 1024;}
|
||||
QAudioDeviceInfo const& Configuration::audio_output_device () const {return m_->audio_output_device_;}
|
||||
AudioDevice::Channel Configuration::audio_output_channel () const {return m_->audio_output_channel_;}
|
||||
int Configuration::audio_output_buffer_size () const {return m_->audio_output_buffer_size_ * 1024;}
|
||||
bool Configuration::restart_audio_input () const {return m_->restart_sound_input_device_;}
|
||||
bool Configuration::restart_audio_output () const {return m_->restart_sound_output_device_;}
|
||||
auto Configuration::type_2_msg_gen () const -> Type2MsgGen {return m_->type_2_msg_gen_;}
|
||||
@@ -978,8 +972,6 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
|
||||
, transceiver_command_number_ {0}
|
||||
, degrade_ {0.} // initialize to zero each run, not
|
||||
// saved in settings
|
||||
, audio_input_buffer_size_ {default_audio_buffer_size}
|
||||
, audio_output_buffer_size_ {default_audio_buffer_size}
|
||||
{
|
||||
ui_->setupUi (this);
|
||||
|
||||
@@ -1242,9 +1234,7 @@ void Configuration::impl::initialize_models ()
|
||||
update_audio_channels (ui_->sound_output_combo_box, ui_->sound_output_combo_box->currentIndex (), ui_->sound_output_channel_combo_box, true);
|
||||
|
||||
ui_->sound_input_channel_combo_box->setCurrentIndex (audio_input_channel_);
|
||||
ui_->audio_ip_buffer_spin_box->setValue (audio_input_buffer_size_);
|
||||
ui_->sound_output_channel_combo_box->setCurrentIndex (audio_output_channel_);
|
||||
ui_->audio_op_buffer_spin_box->setValue (audio_output_buffer_size_);
|
||||
|
||||
ui_->save_path_display_label->setText (save_directory_.absolutePath ());
|
||||
ui_->azel_path_display_label->setText (azel_directory_.absolutePath ());
|
||||
@@ -1430,10 +1420,6 @@ void Configuration::impl::read_settings ()
|
||||
audio_input_channel_ = AudioDevice::fromString (settings_->value ("AudioInputChannel", "Mono").toString ());
|
||||
audio_output_channel_ = AudioDevice::fromString (settings_->value ("AudioOutputChannel", "Mono").toString ());
|
||||
|
||||
// retrieve audio buffer size values
|
||||
audio_input_buffer_size_ = settings_->value ("AudioInputBufferSize", default_audio_buffer_size).toInt ();
|
||||
audio_output_buffer_size_ = settings_->value ("AudioOutputBufferSize", default_audio_buffer_size).toInt ();
|
||||
|
||||
type_2_msg_gen_ = settings_->value ("Type2MsgGen", QVariant::fromValue (Configuration::type_2_msg_3_full)).value<Configuration::Type2MsgGen> ();
|
||||
|
||||
monitor_off_at_startup_ = settings_->value ("MonitorOFF", false).toBool ();
|
||||
@@ -1558,8 +1544,6 @@ void Configuration::impl::write_settings ()
|
||||
settings_->setValue ("SoundOutName", audio_output_device_.deviceName ());
|
||||
settings_->setValue ("AudioInputChannel", AudioDevice::toString (audio_input_channel_));
|
||||
settings_->setValue ("AudioOutputChannel", AudioDevice::toString (audio_output_channel_));
|
||||
settings_->setValue ("AudioInputBufferSize", audio_input_buffer_size_);
|
||||
settings_->setValue ("AudioOutputBufferSize", audio_output_buffer_size_);
|
||||
settings_->setValue ("Type2MsgGen", QVariant::fromValue (type_2_msg_gen_));
|
||||
settings_->setValue ("MonitorOFF", monitor_off_at_startup_);
|
||||
settings_->setValue ("MonitorLastUsed", monitor_last_used_);
|
||||
@@ -1988,17 +1972,6 @@ void Configuration::impl::accept ()
|
||||
}
|
||||
Q_ASSERT (audio_output_channel_ <= AudioDevice::Both);
|
||||
|
||||
if (audio_input_buffer_size_ != ui_->audio_ip_buffer_spin_box->value ())
|
||||
{
|
||||
audio_input_buffer_size_ = ui_->audio_ip_buffer_spin_box->value ();
|
||||
restart_sound_input_device_ = true;
|
||||
}
|
||||
if (audio_output_buffer_size_ != ui_->audio_op_buffer_spin_box->value ())
|
||||
{
|
||||
audio_output_buffer_size_ = ui_->audio_op_buffer_spin_box->value ();
|
||||
restart_sound_output_device_ = true;
|
||||
}
|
||||
|
||||
my_callsign_ = ui_->callsign_line_edit->text ();
|
||||
my_grid_ = ui_->grid_line_edit->text ();
|
||||
FD_exchange_= ui_->Field_Day_Exchange->text ().toUpper ();
|
||||
|
||||
Reference in New Issue
Block a user