mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
use rational number for step durations
This commit is contained in:
parent
25f67e3f16
commit
e1d82bce04
2 changed files with 8 additions and 7 deletions
|
|
@ -512,7 +512,8 @@ StepView::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>
|
||||||
context->rectangle (origin.x + 2, origin.y + (_step_dimen - height - 2), _step_dimen - 4, height);
|
context->rectangle (origin.x + 2, origin.y + (_step_dimen - height - 2), _step_dimen - 4, height);
|
||||||
context->fill ();
|
context->fill ();
|
||||||
} else if (_seq.mode() == SequencerGrid::Duration) {
|
} else if (_seq.mode() == SequencerGrid::Duration) {
|
||||||
const double height = (_step_dimen - 4) * (_step.duration());
|
const Step::DurationRatio d (_step.duration());
|
||||||
|
const double height = ((_step_dimen - 4.0) * d.numerator()) / d.denominator();
|
||||||
const Duple origin = item_to_window (Duple (0, 0));
|
const Duple origin = item_to_window (Duple (0, 0));
|
||||||
context->rectangle (origin.x + 2, origin.y + (_step_dimen - height - 2), _step_dimen - 4, height);
|
context->rectangle (origin.x + 2, origin.y + (_step_dimen - height - 2), _step_dimen - 4, height);
|
||||||
context->fill ();
|
context->fill ();
|
||||||
|
|
@ -594,8 +595,8 @@ StepView::scroll_event (GdkEventScroll* ev)
|
||||||
cerr << "adjust velocity by " << amt << endl;
|
cerr << "adjust velocity by " << amt << endl;
|
||||||
adjust_step_velocity (amt);
|
adjust_step_velocity (amt);
|
||||||
} else if (_seq.mode() == SequencerGrid::Duration) {
|
} else if (_seq.mode() == SequencerGrid::Duration) {
|
||||||
cerr << "adjust velocity by " << amt << endl;
|
cerr << "adjust duration by " << Step::DurationRatio (amt, 32) << endl;
|
||||||
adjust_step_duration (amt/32.0); /* adjust by 1/32 of the sequencer step size */
|
adjust_step_duration (Step::DurationRatio (amt, 32)); /* adjust by 1/32 of the sequencer step size */
|
||||||
} else if (_seq.mode() == SequencerGrid::Octave) {
|
} else if (_seq.mode() == SequencerGrid::Octave) {
|
||||||
adjust_step_octave (amt);
|
adjust_step_octave (amt);
|
||||||
} else if (_seq.mode() == SequencerGrid::Group) {
|
} else if (_seq.mode() == SequencerGrid::Group) {
|
||||||
|
|
@ -623,7 +624,7 @@ StepView::adjust_step_octave (int amt)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StepView::adjust_step_duration (double amt)
|
StepView::adjust_step_duration (Step::DurationRatio const & amt)
|
||||||
{
|
{
|
||||||
_step.adjust_duration (amt);
|
_step.adjust_duration (amt);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@
|
||||||
#include "canvas/canvas.h"
|
#include "canvas/canvas.h"
|
||||||
#include "canvas/rectangle.h"
|
#include "canvas/rectangle.h"
|
||||||
|
|
||||||
|
#include "ardour/step_sequencer.h"
|
||||||
|
|
||||||
#include "widgets/ardour_button.h"
|
#include "widgets/ardour_button.h"
|
||||||
#include "widgets/ardour_dropdown.h"
|
#include "widgets/ardour_dropdown.h"
|
||||||
#include "ardour_dialog.h"
|
#include "ardour_dialog.h"
|
||||||
|
|
@ -59,8 +61,6 @@ class Widget;
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class BeatBox;
|
class BeatBox;
|
||||||
class Step;
|
|
||||||
class StepSequencer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SequencerGrid;
|
class SequencerGrid;
|
||||||
|
|
@ -88,7 +88,7 @@ class StepView : public ArdourCanvas::Rectangle, public sigc::trackable {
|
||||||
|
|
||||||
void adjust_step_pitch (int amt);
|
void adjust_step_pitch (int amt);
|
||||||
void adjust_step_velocity (int amt);
|
void adjust_step_velocity (int amt);
|
||||||
void adjust_step_duration (double);
|
void adjust_step_duration (ARDOUR::Step::DurationRatio const &);
|
||||||
void adjust_step_octave (int amt);
|
void adjust_step_octave (int amt);
|
||||||
|
|
||||||
void step_changed (PBD::PropertyChange const &);
|
void step_changed (PBD::PropertyChange const &);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue