show timing offsets using reduced musical ratios
which begs the question about the step size for timing adjustments
This commit is contained in:
parent
0731b045e1
commit
5803b30c47
@ -20,6 +20,8 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
|
#include <boost/math/common_factor.hpp>
|
||||||
|
|
||||||
#include "pbd/compose.h"
|
#include "pbd/compose.h"
|
||||||
#include "pbd/i18n.h"
|
#include "pbd/i18n.h"
|
||||||
|
|
||||||
@ -789,10 +791,18 @@ StepView::view_mode_changed ()
|
|||||||
{
|
{
|
||||||
/* this should leave the text to the last text-displaying mode */
|
/* this should leave the text to the last text-displaying mode */
|
||||||
|
|
||||||
if (_seq.mode() == SequencerGrid::Octave) {
|
switch (_seq.mode()) {
|
||||||
|
case SequencerGrid::Octave:
|
||||||
set_octave_text ();
|
set_octave_text ();
|
||||||
} else if (_seq.mode() == SequencerGrid::Group) {
|
break;
|
||||||
|
case SequencerGrid::Group:
|
||||||
set_group_text ();
|
set_group_text ();
|
||||||
|
break;
|
||||||
|
case SequencerGrid::Timing:
|
||||||
|
set_timing_text ();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
text->hide ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -822,11 +832,38 @@ StepView::set_octave_text ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
StepView::set_timing_text ()
|
||||||
|
{
|
||||||
|
if (!_step.velocity()) {
|
||||||
|
text->hide ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_step.offset() == Temporal::Beats()) {
|
||||||
|
text->set (X_("0"));
|
||||||
|
} else {
|
||||||
|
const int64_t gcd = boost::math::gcd (_step.offset().to_ticks(), int64_t (1920));
|
||||||
|
const int64_t n = _step.offset().to_ticks() / gcd;
|
||||||
|
const int64_t d = 1920 / gcd;
|
||||||
|
text->set (string_compose ("%1/%2", n, d));
|
||||||
|
text->show ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text->self_visible()) {
|
||||||
|
const double w = text->width();
|
||||||
|
const double h = text->height();
|
||||||
|
text->set_position (Duple (_step_dimen/2 - (w/2), _step_dimen/2 - (h/2)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepView::step_changed (PropertyChange const &)
|
StepView::step_changed (PropertyChange const &)
|
||||||
{
|
{
|
||||||
if (_seq.mode() == SequencerGrid::Octave) {
|
if (_seq.mode() == SequencerGrid::Octave) {
|
||||||
set_octave_text ();
|
set_octave_text ();
|
||||||
|
} else if (_seq.mode() == SequencerGrid::Timing) {
|
||||||
|
set_timing_text ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_step.velocity()) {
|
if (_step.velocity()) {
|
||||||
|
@ -123,7 +123,8 @@ class StepView : public ArdourCanvas::Rectangle, public sigc::trackable {
|
|||||||
|
|
||||||
void set_octave_text ();
|
void set_octave_text ();
|
||||||
void set_group_text ();
|
void set_group_text ();
|
||||||
|
void set_timing_text ();
|
||||||
|
|
||||||
static Gtkmm2ext::Color on_fill_color;
|
static Gtkmm2ext::Color on_fill_color;
|
||||||
static Gtkmm2ext::Color off_fill_color;
|
static Gtkmm2ext::Color off_fill_color;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user