Compare commits
3 Commits
f2345b6fe0
...
53236dd728
Author | SHA1 | Date | |
---|---|---|---|
53236dd728 | |||
e9013e1d0f | |||
50a0f40a0f |
@ -365,7 +365,11 @@ Editor::Editor ()
|
|||||||
, select_new_marker (false)
|
, select_new_marker (false)
|
||||||
, have_pending_keyboard_selection (false)
|
, have_pending_keyboard_selection (false)
|
||||||
, pending_keyboard_selection_start (0)
|
, pending_keyboard_selection_start (0)
|
||||||
|
#ifdef LIVETRAX
|
||||||
|
, _grid_type (GridTypeTimecode)
|
||||||
|
#else
|
||||||
, _grid_type (GridTypeBeat)
|
, _grid_type (GridTypeBeat)
|
||||||
|
#endif
|
||||||
, _snap_mode (SnapOff)
|
, _snap_mode (SnapOff)
|
||||||
, _draw_length (GridTypeNone)
|
, _draw_length (GridTypeNone)
|
||||||
, _draw_velocity (DRAW_VEL_AUTO)
|
, _draw_velocity (DRAW_VEL_AUTO)
|
||||||
@ -2482,6 +2486,9 @@ Editor::set_draw_channel_to (int c)
|
|||||||
void
|
void
|
||||||
Editor::set_grid_to (GridType gt)
|
Editor::set_grid_to (GridType gt)
|
||||||
{
|
{
|
||||||
|
#ifdef LIVETRAX
|
||||||
|
gt = GridTypeTimecode;
|
||||||
|
#endif
|
||||||
unsigned int grid_ind = (unsigned int)gt;
|
unsigned int grid_ind = (unsigned int)gt;
|
||||||
|
|
||||||
if (internal_editing() && UIConfiguration::instance().get_grid_follows_internal()) {
|
if (internal_editing() && UIConfiguration::instance().get_grid_follows_internal()) {
|
||||||
@ -2691,8 +2698,14 @@ Editor::set_state (const XMLNode& node, int version)
|
|||||||
set_snap_mode (_snap_mode);
|
set_snap_mode (_snap_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LIVETRAX
|
||||||
|
_grid_type = GridTypeTimecode;
|
||||||
|
internal_grid_type = GridTypeTimecode;
|
||||||
|
pre_internal_grid_type = GridTypeTimecode;
|
||||||
|
#else
|
||||||
node.get_property ("internal-grid-type", internal_grid_type);
|
node.get_property ("internal-grid-type", internal_grid_type);
|
||||||
node.get_property ("internal-snap-mode", internal_snap_mode);
|
node.get_property ("internal-snap-mode", internal_snap_mode);
|
||||||
|
#endif
|
||||||
node.get_property ("pre-internal-grid-type", pre_internal_grid_type);
|
node.get_property ("pre-internal-grid-type", pre_internal_grid_type);
|
||||||
node.get_property ("pre-internal-snap-mode", pre_internal_snap_mode);
|
node.get_property ("pre-internal-snap-mode", pre_internal_snap_mode);
|
||||||
|
|
||||||
|
@ -922,10 +922,12 @@ Editor::set_timecode_ruler_scale (samplepos_t lower, samplepos_t upper)
|
|||||||
timecode_ruler_scale = timecode_show_many_hours;
|
timecode_ruler_scale = timecode_show_many_hours;
|
||||||
timecode_mark_modulo = std::max ((samplecnt_t) 1, 1 + (hours_in_range / timecode_nmarks));
|
timecode_mark_modulo = std::max ((samplecnt_t) 1, 1 + (hours_in_range / timecode_nmarks));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timecode_mark_modulo = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t /*upper*/, gint /*maxchars*/)
|
Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, int64_t lower, int64_t upper, gint /*maxchars*/)
|
||||||
{
|
{
|
||||||
samplepos_t pos;
|
samplepos_t pos;
|
||||||
samplecnt_t spacer;
|
samplecnt_t spacer;
|
||||||
@ -944,146 +946,149 @@ Editor::metric_get_timecode (std::vector<ArdourCanvas::Ruler::Mark>& marks, int6
|
|||||||
lower = 0;
|
lower = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = (samplecnt_t) floor (lower);
|
pos = lower;
|
||||||
|
// Find timecode time of this sample (pos)
|
||||||
|
_session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
|
||||||
|
|
||||||
switch (timecode_ruler_scale) {
|
switch (timecode_ruler_scale) {
|
||||||
case timecode_show_bits:
|
case timecode_show_bits:
|
||||||
// Find timecode time of this sample (pos) with subframe accuracy
|
// Find timecode time of this sample (pos) with subframe accuracy
|
||||||
_session->sample_to_timecode(pos, timecode, true /* use_offset */, true /* use_subframes */);
|
|
||||||
for (n = 0; n < timecode_nmarks; n++) {
|
for (n = 0; n < timecode_nmarks; n++) {
|
||||||
_session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */);
|
_session->timecode_to_sample(timecode, pos, true /* use_offset */, true /* use_subframes */);
|
||||||
if ((timecode.subframes % timecode_mark_modulo) == 0) {
|
if (pos >= lower) {
|
||||||
if (timecode.subframes == 0) {
|
if ((timecode.subframes % timecode_mark_modulo) == 0) {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
if (timecode.subframes == 0) {
|
||||||
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
||||||
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||||
|
} else {
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Minor;
|
||||||
|
snprintf (buf, sizeof(buf), ".%02u", timecode.subframes);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Minor;
|
snprintf (buf, sizeof(buf)," ");
|
||||||
snprintf (buf, sizeof(buf), ".%02u", timecode.subframes);
|
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
||||||
}
|
}
|
||||||
} else {
|
mark.label = buf;
|
||||||
snprintf (buf, sizeof(buf)," ");
|
mark.position = pos;
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
marks.push_back (mark);
|
||||||
}
|
}
|
||||||
mark.label = buf;
|
|
||||||
mark.position = pos;
|
|
||||||
marks.push_back (mark);
|
|
||||||
// Increment subframes by one
|
// Increment subframes by one
|
||||||
Timecode::increment_subframes (timecode, _session->config.get_subframes_per_frame());
|
Timecode::increment_subframes (timecode, _session->config.get_subframes_per_frame());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case timecode_show_samples:
|
case timecode_show_samples:
|
||||||
// Find timecode time of this sample (pos)
|
|
||||||
_session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
|
|
||||||
// Go to next whole sample down
|
// Go to next whole sample down
|
||||||
Timecode::frames_floot (timecode);
|
Timecode::frames_floot (timecode);
|
||||||
for (n = 0; n < timecode_nmarks; n++) {
|
for (n = 0; n < timecode_nmarks; n++) {
|
||||||
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
||||||
if ((timecode.frames % timecode_mark_modulo) == 0) {
|
if (pos >= lower) {
|
||||||
if (timecode.frames == 0) {
|
if ((timecode.frames % timecode_mark_modulo) == 0) {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
if (timecode.frames == 0) {
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
||||||
|
} else {
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Minor;
|
||||||
|
}
|
||||||
|
mark.position = pos;
|
||||||
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||||
} else {
|
} else {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Minor;
|
snprintf (buf, sizeof(buf)," ");
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
||||||
|
mark.position = pos;
|
||||||
}
|
}
|
||||||
mark.position = pos;
|
mark.label = buf;
|
||||||
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
marks.push_back (mark);
|
||||||
} else {
|
|
||||||
snprintf (buf, sizeof(buf)," ");
|
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
|
||||||
mark.position = pos;
|
|
||||||
}
|
}
|
||||||
mark.label = buf;
|
|
||||||
marks.push_back (mark);
|
|
||||||
Timecode::increment (timecode, _session->config.get_subframes_per_frame());
|
Timecode::increment (timecode, _session->config.get_subframes_per_frame());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case timecode_show_seconds:
|
case timecode_show_seconds:
|
||||||
// Find timecode time of this sample (pos)
|
|
||||||
_session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
|
|
||||||
// Go to next whole second down
|
// Go to next whole second down
|
||||||
Timecode::seconds_floor (timecode);
|
Timecode::seconds_floor (timecode);
|
||||||
for (n = 0; n < timecode_nmarks; n++) {
|
for (n = 0; n < timecode_nmarks; n++) {
|
||||||
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
||||||
if ((timecode.seconds % timecode_mark_modulo) == 0) {
|
if (pos >= lower) {
|
||||||
if (timecode.seconds == 0) {
|
if ((timecode.seconds % timecode_mark_modulo) == 0) {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
if (timecode.seconds == 0) {
|
||||||
mark.position = pos;
|
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
||||||
|
mark.position = pos;
|
||||||
|
} else {
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Minor;
|
||||||
|
mark.position = pos;
|
||||||
|
}
|
||||||
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||||
} else {
|
} else {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Minor;
|
snprintf (buf, sizeof(buf)," ");
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
||||||
mark.position = pos;
|
mark.position = pos;
|
||||||
}
|
}
|
||||||
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
mark.label = buf;
|
||||||
} else {
|
marks.push_back (mark);
|
||||||
snprintf (buf, sizeof(buf)," ");
|
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
|
||||||
mark.position = pos;
|
|
||||||
}
|
}
|
||||||
mark.label = buf;
|
|
||||||
marks.push_back (mark);
|
|
||||||
Timecode::increment_seconds (timecode, _session->config.get_subframes_per_frame());
|
Timecode::increment_seconds (timecode, _session->config.get_subframes_per_frame());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case timecode_show_minutes:
|
case timecode_show_minutes:
|
||||||
//Find timecode time of this sample (pos)
|
|
||||||
_session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
|
|
||||||
// Go to next whole minute down
|
// Go to next whole minute down
|
||||||
Timecode::minutes_floor (timecode);
|
Timecode::minutes_floor (timecode);
|
||||||
for (n = 0; n < timecode_nmarks; n++) {
|
for (n = 0; n < timecode_nmarks; n++) {
|
||||||
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
||||||
if ((timecode.minutes % timecode_mark_modulo) == 0) {
|
if (pos >= lower) {
|
||||||
if (timecode.minutes == 0) {
|
if ((timecode.minutes % timecode_mark_modulo) == 0) {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
if (timecode.minutes == 0) {
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
||||||
|
} else {
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Minor;
|
||||||
|
}
|
||||||
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||||
} else {
|
} else {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Minor;
|
snprintf (buf, sizeof(buf)," ");
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
||||||
}
|
}
|
||||||
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
mark.label = buf;
|
||||||
} else {
|
mark.position = pos;
|
||||||
snprintf (buf, sizeof(buf)," ");
|
marks.push_back (mark);
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
|
||||||
}
|
}
|
||||||
mark.label = buf;
|
|
||||||
mark.position = pos;
|
|
||||||
marks.push_back (mark);
|
|
||||||
Timecode::increment_minutes (timecode, _session->config.get_subframes_per_frame());
|
Timecode::increment_minutes (timecode, _session->config.get_subframes_per_frame());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case timecode_show_hours:
|
case timecode_show_hours:
|
||||||
// Find timecode time of this sample (pos)
|
|
||||||
_session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
|
|
||||||
// Go to next whole hour down
|
// Go to next whole hour down
|
||||||
Timecode::hours_floor (timecode);
|
Timecode::hours_floor (timecode);
|
||||||
for (n = 0; n < timecode_nmarks; n++) {
|
for (n = 0; n < timecode_nmarks; n++) {
|
||||||
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
||||||
if ((timecode.hours % timecode_mark_modulo) == 0) {
|
if (pos >= lower) {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
if ((timecode.hours % timecode_mark_modulo) == 0) {
|
||||||
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
||||||
} else {
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||||
snprintf (buf, sizeof(buf)," ");
|
} else {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
snprintf (buf, sizeof(buf)," ");
|
||||||
|
mark.style = ArdourCanvas::Ruler::Mark::Micro;
|
||||||
|
}
|
||||||
|
mark.label = buf;
|
||||||
|
mark.position = pos;
|
||||||
|
marks.push_back (mark);
|
||||||
}
|
}
|
||||||
mark.label = buf;
|
|
||||||
mark.position = pos;
|
|
||||||
marks.push_back (mark);
|
|
||||||
Timecode::increment_hours (timecode, _session->config.get_subframes_per_frame());
|
Timecode::increment_hours (timecode, _session->config.get_subframes_per_frame());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case timecode_show_many_hours:
|
case timecode_show_many_hours:
|
||||||
// Find timecode time of this sample (pos)
|
|
||||||
_session->sample_to_timecode (pos, timecode, true /* use_offset */, false /* use_subframes */);
|
|
||||||
// Go to next whole hour down
|
// Go to next whole hour down
|
||||||
Timecode::hours_floor (timecode);
|
Timecode::hours_floor (timecode);
|
||||||
|
|
||||||
for (n = 0; n < timecode_nmarks;) {
|
for (n = 0; n < timecode_nmarks;) {
|
||||||
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
_session->timecode_to_sample (timecode, pos, true /* use_offset */, false /* use_subframes */);
|
||||||
if ((timecode.hours % timecode_mark_modulo) == 0) {
|
if (pos >= lower) {
|
||||||
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
if ((timecode.hours % timecode_mark_modulo) == 0) {
|
||||||
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
mark.style = ArdourCanvas::Ruler::Mark::Major;
|
||||||
mark.label = buf;
|
snprintf (buf, sizeof(buf), "%s%02u:%02u:%02u:%02u", timecode.negative ? "-" : "", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||||
mark.position = pos;
|
mark.label = buf;
|
||||||
marks.push_back (mark);
|
mark.position = pos;
|
||||||
++n;
|
marks.push_back (mark);
|
||||||
|
++n;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* can't use Timecode::increment_hours() here because we may be traversing thousands of hours
|
/* can't use Timecode::increment_hours() here because we may be traversing thousands of hours
|
||||||
* and doing it 1 hour at a time is just stupid (and slow).
|
* and doing it 1 hour at a time is just stupid (and slow).
|
||||||
|
Loading…
Reference in New Issue
Block a user