From ab30f45bbaf589d3dfeba7c4507ac0be9fd2002e Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Tue, 6 Sep 2016 21:56:08 +1000 Subject: [PATCH] Use PBD::to_string to convert period count in EngineControl class The functionality is the same so might as well use it. --- gtk2_ardour/engine_dialog.cc | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index b144019ece..98463b783c 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -1482,13 +1482,13 @@ EngineControl::set_nperiods_popdown_strings () } for (vector::const_iterator x = np.begin(); x != np.end(); ++x) { - s.push_back (nperiods_as_string (*x)); + s.push_back (to_string (*x)); } set_popdown_strings (nperiods_combo, s); if (!s.empty()) { - set_active_text_if_present (nperiods_combo, nperiods_as_string (backend->period_size())); // XXX + set_active_text_if_present (nperiods_combo, to_string (backend->period_size())); // XXX } update_sensitivity (); @@ -1611,15 +1611,6 @@ EngineControl::bufsize_as_string (uint32_t sz) return string_compose (P_("%1 sample", "%1 samples", sz), to_string(sz)); } -string -EngineControl::nperiods_as_string (uint32_t np) -{ - char buf[8]; - snprintf (buf, sizeof (buf), "%u", np); - return buf; -} - - void EngineControl::sample_rate_changed () { @@ -1886,7 +1877,7 @@ EngineControl::maybe_display_saved_state () } set_active_text_if_present (buffer_size_combo, bufsize_as_string (state->buffer_size)); - set_active_text_if_present (nperiods_combo, nperiods_as_string (state->n_periods)); + set_active_text_if_present (nperiods_combo, to_string(state->n_periods)); /* call this explicitly because we're ignoring changes to the controls at this point. */ @@ -2203,7 +2194,7 @@ EngineControl::set_current_state (const State& state) sample_rate_combo.set_active_text (rate_as_string (state->sample_rate)); } set_active_text_if_present (buffer_size_combo, bufsize_as_string (state->buffer_size)); - set_active_text_if_present (nperiods_combo, nperiods_as_string (state->n_periods)); + set_active_text_if_present (nperiods_combo, to_string (state->n_periods)); input_latency.set_value (state->input_latency); output_latency.set_value (state->output_latency); midi_option_combo.set_active_text (state->midi_option); @@ -3041,7 +3032,7 @@ EngineControl::engine_running () sample_rate_combo.set_active_text (rate_as_string (backend->sample_rate())); if (backend->can_set_period_size ()) { - set_active_text_if_present (nperiods_combo, nperiods_as_string (backend->period_size())); + set_active_text_if_present (nperiods_combo, to_string (backend->period_size())); } connect_disconnect_button.set_label (string_compose (_("Disconnect from %1"), backend->name()));