X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fquantize_dialog.cc;h=b29e9f32613757e857c899ea163f11ee51034d5b;hb=84aedbb532c46054f200d7312334da7c17776b8e;hp=98514326d5e9b6ef7c7a7ea081ef4a8a930876ac;hpb=23e7cf10191270d70357ccf0ed9294f020c7b7ab;p=ardour.git diff --git a/gtk2_ardour/quantize_dialog.cc b/gtk2_ardour/quantize_dialog.cc index 98514326d5..b29e9f3261 100644 --- a/gtk2_ardour/quantize_dialog.cc +++ b/gtk2_ardour/quantize_dialog.cc @@ -25,7 +25,7 @@ #include "quantize_dialog.h" #include "public_editor.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace Gtk; @@ -33,16 +33,35 @@ using namespace Gtkmm2ext; using namespace ARDOUR; static const gchar *_grid_strings[] = { - N_("main grid"), - N_("Beats/128"), - N_("Beats/64"), - N_("Beats/32"), - N_("Beats/16"), - N_("Beats/8"), - N_("Beats/4"), - N_("Beats/3"), - N_("Beats/2"), - N_("Beats"), + N_("Main Grid"), + N_("1/4 Note"), + N_("1/8 Note"), + N_("1/16 Note"), + N_("1/32 Note"), + N_("1/64 Note"), + N_("1/128 Note"), + + N_("1/3 (8th triplet)"), + N_("1/6 (16th triplet)"), + N_("1/12 (32nd triplet)"), + + N_("1/5 (8th quintuplet)"), + N_("1/10 (16th quintuplet)"), + N_("1/20 (32nd quintuplet)"), + + N_("1/7 (8th septuplet)"), + N_("1/14 (16th septuplet)"), + N_("1/28 (32nd septuplet)"), + + 0 +}; + +static const int _grid_beats[] = { + 0, + 1, 2, 4, 8, 16, 32, + 3, 6, 12, + 5, 10, 20, + 7, 14, 28, 0 }; @@ -103,7 +122,7 @@ QuantizeDialog::QuantizeDialog (PublicEditor& e) snap_end_button.set_active (false); get_vbox()->pack_start (*table); - show_all (); + get_vbox()->show_all (); add_button (Stock::CANCEL, RESPONSE_CANCEL); add_button (_("Quantize"), RESPONSE_OK); @@ -122,43 +141,33 @@ QuantizeDialog::start_grid_size () const double QuantizeDialog::end_grid_size () const { - return grid_size_to_musical_time (start_grid_combo.get_active_text ()); + return grid_size_to_musical_time (end_grid_combo.get_active_text ()); } double QuantizeDialog::grid_size_to_musical_time (const string& txt) const { - if (txt == "main grid") { + if ( txt == _grid_strings[0] ) { //"Main Grid" bool success; - Evoral::MusicalTime b = editor.get_grid_type_as_beats (success, 0); + Temporal::Beats b = editor.get_grid_type_as_beats (success, 0); if (!success) { return 1.0; } - return (double) b; + return b.to_double(); } - if (txt == _("Beats/128")) { - return 1.0/128.0; - } else if (txt == _("Beats/64")) { - return 1.0/64.0; - } else if (txt == _("Beats/32")) { - return 1.0/32.0; - } else if (txt == _("Beats/16")) { - return 1.0/16.0; - } if (txt == _("Beats/8")) { - return 1.0/8.0; - } else if (txt == _("Beats/4")) { - return 1.0/4.0; - } else if (txt == _("Beats/3")) { - return 1.0/3.0; - } else if (txt == _("Beats/2")) { - return 1.0/2.0; - } else if (txt == _("Beats")) { - return 1.0; + + double divisor = 1.0; + for (size_t i = 1; i < grid_strings.size(); ++i) { + if (txt == grid_strings[i]) { + assert (_grid_beats[i] != 0); + divisor = 1.0 / _grid_beats[i]; + break; + } } - return 1.0; + return divisor; } float