- /* now we know these values are ok, so force-set them */
- int const s = set_start (start, true, allow_bbt_recompute);
- int const e = set_end (end, true, allow_bbt_recompute);
+ bool start_change = false;
+ bool end_change = false;
+
+ if (is_mark()) {
+
+ if (_start != s) {
+ _start = s;
+ _end = s;
+
+ if (allow_bbt_recompute) {
+ recompute_bbt_from_frames ();
+ }
+
+ start_change = true;
+ end_change = true;
+ }
+
+ assert (_start >= 0);
+ assert (_end >= 0);
+
+ } else {
+
+ /* range locations must exceed a minimum duration */
+ if (e - s < Config->get_range_location_minimum()) {
+ return -1;
+ }
+
+ if (s != _start) {
+
+ framepos_t const old = _start;
+ _start = s;
+
+ if (allow_bbt_recompute) {
+ recompute_bbt_from_frames ();
+ }
+
+ start_change = true;
+
+ if (is_session_range ()) {
+ Session::StartTimeChanged (old); /* EMIT SIGNAL */
+ AudioFileSource::set_header_position_offset (s);
+ }
+ }
+
+
+ if (e != _end) {
+
+ framepos_t const old = _end;
+ _end = e;
+
+ if (allow_bbt_recompute) {
+ recompute_bbt_from_frames ();
+ }
+
+ end_change = true;
+
+ if (is_session_range()) {
+ Session::EndTimeChanged (old); /* EMIT SIGNAL */
+ }
+ }
+
+ assert (_end >= 0);
+ }
+
+ if (start_change) {
+ start_changed(this); /* EMIT SIGNAL */
+ StartChanged(); /* EMIT SIGNAL */
+ }
+
+ if (end_change) {
+ end_changed(this); /* EMIT SIGNAL */
+ EndChanged(); /* EMIT SIGNAL */
+ }