Use PBD::to_string to convert period count in EngineControl class
authorTim Mayberry <mojofunk@gmail.com>
Tue, 6 Sep 2016 11:56:08 +0000 (21:56 +1000)
committerTim Mayberry <mojofunk@gmail.com>
Tue, 18 Apr 2017 23:36:59 +0000 (09:36 +1000)
The functionality is the same so might as well use it.

gtk2_ardour/engine_dialog.cc

index b144019ece6b39511c56d08924d157bf15b7345a..98463b783c93a0cd6505edd333027c5038419dc9 100644 (file)
@@ -1482,13 +1482,13 @@ EngineControl::set_nperiods_popdown_strings ()
        }
 
        for (vector<uint32_t>::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()));