mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Fix MIDI Quantization for internationalized Ardour.
Grid-settings are translatable, parsing a number from a translated string e.g. "Quart de temps" for "Beats/4" failed.
This commit is contained in:
parent
f85c320759
commit
013e3e84be
1 changed files with 15 additions and 9 deletions
|
|
@ -55,6 +55,13 @@ static const gchar *_grid_strings[] = {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const int _grid_beats[] = {
|
||||||
|
0,
|
||||||
|
128, 64, 32, 28, 24, 20, 16, 14,
|
||||||
|
12, 10, 8, 7, 6, 5, 4, 3, 2, 1,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
std::vector<std::string> QuantizeDialog::grid_strings;
|
std::vector<std::string> QuantizeDialog::grid_strings;
|
||||||
|
|
||||||
QuantizeDialog::QuantizeDialog (PublicEditor& e)
|
QuantizeDialog::QuantizeDialog (PublicEditor& e)
|
||||||
|
|
@ -137,7 +144,7 @@ QuantizeDialog::end_grid_size () const
|
||||||
double
|
double
|
||||||
QuantizeDialog::grid_size_to_musical_time (const string& txt) const
|
QuantizeDialog::grid_size_to_musical_time (const string& txt) const
|
||||||
{
|
{
|
||||||
if (txt == "main grid") {
|
if (txt == _("main grid")) {
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
Evoral::Beats b = editor.get_grid_type_as_beats (success, 0);
|
Evoral::Beats b = editor.get_grid_type_as_beats (success, 0);
|
||||||
|
|
@ -147,18 +154,17 @@ QuantizeDialog::grid_size_to_musical_time (const string& txt) const
|
||||||
return b.to_double();
|
return b.to_double();
|
||||||
}
|
}
|
||||||
|
|
||||||
string::size_type slash;
|
|
||||||
|
|
||||||
if ((slash = txt.find ('/')) != string::npos) {
|
double divisor = 1.0;
|
||||||
if (slash < txt.length() - 1) {
|
for (int i = 1; i < grid_strings.size(); ++i) {
|
||||||
double divisor = PBD::atof (txt.substr (slash+1));
|
if (txt == grid_strings[i]) {
|
||||||
if (divisor != 0.0) {
|
assert (_grid_beats[i] != 0);
|
||||||
return 1.0/divisor;
|
divisor = 1.0 / _grid_beats[i];
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1.0;
|
return divisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue