summaryrefslogtreecommitdiff
path: root/libs/ardour/region.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-06-14 03:21:52 +1000
committernick_m <mainsbridge@gmail.com>2016-07-10 02:18:36 +1000
commit2d5238d87581bc0ff9dcaaa8aad9e255b5d9c370 (patch)
tree0b6d271f2b8a6284004d28f613b5cc9afdda53ca /libs/ardour/region.cc
parent0d050de94e3ae5a1a0dc36114df1995b042f3b80 (diff)
Make some musical operations on music-locked regions operate in beats.
- use exact beats to determine frame position. - see comments in tempo.cc for more. - this hasn't been done for split yet, but dragging and trimming are supported.
Diffstat (limited to 'libs/ardour/region.cc')
-rw-r--r--libs/ardour/region.cc48
1 files changed, 27 insertions, 21 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index ba18cbc62d..5fb5b30014 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -570,13 +570,19 @@ Region::update_after_tempo_map_change (bool send)
}
void
-Region::set_position (framepos_t pos)
+Region::set_position (framepos_t pos, int32_t sub_num)
{
if (!can_move()) {
return;
}
- set_position_internal (pos, true);
+ if (sub_num == 0) {
+ set_position_internal (pos, true);
+ } else {
+ double beat = _session.tempo_map().exact_beat_at_frame (pos, sub_num);
+ _beat = beat;
+ set_position_internal (pos, false);
+ }
/* do this even if the position is the same. this helps out
a GUI that has moved its representation already.
@@ -738,7 +744,7 @@ Region::set_start (framepos_t pos)
}
void
-Region::move_start (frameoffset_t distance)
+Region::move_start (frameoffset_t distance, const int32_t& sub_num)
{
if (locked() || position_locked() || video_locked()) {
return;
@@ -774,7 +780,7 @@ Region::move_start (frameoffset_t distance)
return;
}
- set_start_internal (new_start);
+ set_start_internal (new_start, sub_num);
_whole_file = false;
first_edit ();
@@ -783,25 +789,25 @@ Region::move_start (frameoffset_t distance)
}
void
-Region::trim_front (framepos_t new_position)
+Region::trim_front (framepos_t new_position, const int32_t& sub_num)
{
- modify_front (new_position, false);
+ modify_front (new_position, false, sub_num);
}
void
-Region::cut_front (framepos_t new_position)
+Region::cut_front (framepos_t new_position, const int32_t& sub_num)
{
- modify_front (new_position, true);
+ modify_front (new_position, true, sub_num);
}
void
-Region::cut_end (framepos_t new_endpoint)
+Region::cut_end (framepos_t new_endpoint, const int32_t& sub_num)
{
- modify_end (new_endpoint, true);
+ modify_end (new_endpoint, true, sub_num);
}
void
-Region::modify_front (framepos_t new_position, bool reset_fade)
+Region::modify_front (framepos_t new_position, bool reset_fade, const int32_t& sub_num)
{
if (locked()) {
return;
@@ -831,7 +837,7 @@ Region::modify_front (framepos_t new_position, bool reset_fade)
newlen = _length + (_position - new_position);
}
- trim_to_internal (new_position, newlen);
+ trim_to_internal (new_position, newlen, sub_num);
if (reset_fade) {
_right_of_split = true;
@@ -846,14 +852,14 @@ Region::modify_front (framepos_t new_position, bool reset_fade)
}
void
-Region::modify_end (framepos_t new_endpoint, bool reset_fade)
+Region::modify_end (framepos_t new_endpoint, bool reset_fade, const int32_t& sub_num)
{
if (locked()) {
return;
}
if (new_endpoint > _position) {
- trim_to_internal (_position, new_endpoint - _position);
+ trim_to_internal (_position, new_endpoint - _position, sub_num);
if (reset_fade) {
_left_of_split = true;
}
@@ -868,19 +874,19 @@ Region::modify_end (framepos_t new_endpoint, bool reset_fade)
*/
void
-Region::trim_end (framepos_t new_endpoint)
+Region::trim_end (framepos_t new_endpoint, const int32_t& sub_num)
{
- modify_end (new_endpoint, false);
+ modify_end (new_endpoint, false, sub_num);
}
void
-Region::trim_to (framepos_t position, framecnt_t length)
+Region::trim_to (framepos_t position, framecnt_t length, const int32_t& sub_num)
{
if (locked()) {
return;
}
- trim_to_internal (position, length);
+ trim_to_internal (position, length, sub_num);
if (!property_changes_suspended()) {
recompute_at_start ();
@@ -889,7 +895,7 @@ Region::trim_to (framepos_t position, framecnt_t length)
}
void
-Region::trim_to_internal (framepos_t position, framecnt_t length)
+Region::trim_to_internal (framepos_t position, framecnt_t length, const int32_t& sub_num)
{
framepos_t new_start;
@@ -926,7 +932,7 @@ Region::trim_to_internal (framepos_t position, framecnt_t length)
PropertyChange what_changed;
if (_start != new_start) {
- set_start_internal (new_start);
+ set_start_internal (new_start, sub_num);
what_changed.add (Properties::start);
}
@@ -1845,7 +1851,7 @@ Region::post_set (const PropertyChange& pc)
}
void
-Region::set_start_internal (framecnt_t s)
+Region::set_start_internal (framecnt_t s, const int32_t& sub_num)
{
_start = s;
}