From: Paul Davis Date: Fri, 17 Sep 2010 16:24:22 +0000 (+0000) Subject: megaopus commit: (1) add __STD_(LIMIT|FORMAT)_MACROS to command line flags for cc... X-Git-Tag: 3.0-alpha5~1473 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=10bdce85a0e7381d1b5db38e3640600c6fd3ec79;p=ardour.git megaopus commit: (1) add __STD_(LIMIT|FORMAT)_MACROS to command line flags for cc and c++ builds, remove them from source (2) add new Property::midi_data used by MidiRegion to signal that its (MIDI) contents have changed (3) massive switch from nframes_t to framepos_t/framecnt_t including removal of ARDOUR::max_frames (replaced by ARDOUR::max_frame{pos,cnt} (lots more to do but this set was driven by changes to the Diskstream API to use framepos_t git-svn-id: svn://localhost/ardour2/branches/3.0@7791 d708f5d6-7413-0410-9779-e7cbd77b26cf --- diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 09964ecb5a..608e50466e 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1007,11 +1007,11 @@ ARDOUR_UI::update_disk_space() return; } - nframes_t frames = _session->available_capture_duration(); + framecnt_t frames = _session->available_capture_duration(); char buf[64]; nframes_t fr = _session->frame_rate(); - if (frames == max_frames) { + if (frames == max_framecnt) { strcpy (buf, _("Disk: 24hrs+")); } else { rec_enabled_streams = 0; diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index be1bb97713..7e3cf19ca5 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -1493,7 +1493,7 @@ AudioClock::timecode_frame_from_display () const } Timecode::Time timecode; - nframes_t sample; + framepos_t sample; timecode.hours = atoi (hours_label.get_text()); timecode.minutes = atoi (minutes_label.get_text()); @@ -1516,12 +1516,12 @@ AudioClock::timecode_frame_from_display () const // Testcode for timecode<->sample conversions (P.S.) Timecode::Time timecode1; - nframes_t sample1; - nframes_t oldsample = 0; + framepos_t sample1; + framepos_t oldsample = 0; Timecode::Time timecode2; - nframes_t sample_increment; + framecnt_t sample_increment; - sample_increment = (long)rint(_session->frame_rate() / _session->timecode_frames_per_second); + sample_increment = (framecnt_t)rint(_session->frame_rate() / _session->timecode_frames_per_second); #ifdef Timecode_SAMPLE_TEST_1 // Test 1: use_offset = false, use_subframes = false diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 880f0aa3e8..e674fd4fff 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -65,7 +65,7 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv , alist (al) , _parent_group (parent) , _time_converter (converter ? (*converter) : default_converter) - , _maximum_time (max_frames) + , _maximum_time (max_framepos) { points_visible = false; update_pending = false; @@ -565,13 +565,13 @@ AutomationLine::string_to_fraction (string const & s) const bool AutomationLine::invalid_point (ALPoints& p, uint32_t index) { - return p[index].x == max_frames && p[index].y == DBL_MAX; + return p[index].x == max_framepos && p[index].y == DBL_MAX; } void AutomationLine::invalidate_point (ALPoints& p, uint32_t index) { - p[index].x = max_frames; + p[index].x = max_framepos; p[index].y = DBL_MAX; } @@ -1343,7 +1343,7 @@ AutomationLine::set_maximum_time (framepos_t t) pair AutomationLine::get_point_x_range () const { - pair r (max_frames, 0); + pair r (max_framepos, 0); for (AutomationList::const_iterator i = the_list()->begin(); i != the_list()->end(); ++i) { r.first = min (r.first, _time_converter.to ((*i)->when) + _time_converter.origin_b ()); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index b3d9fabdb2..c134c4190c 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -904,8 +904,8 @@ Editor::control_scroll (float fraction) if ((fraction < 0.0f) && (*_control_scroll_target < (nframes64_t) fabs(step))) { *_control_scroll_target = 0; - } else if ((fraction > 0.0f) && (max_frames - *_control_scroll_target < step)) { - *_control_scroll_target = max_frames - (current_page_frames()*2); // allow room for slop in where the PH is on the screen + } else if ((fraction > 0.0f) && (max_framepos - *_control_scroll_target < step)) { + *_control_scroll_target = max_framepos - (current_page_frames()*2); // allow room for slop in where the PH is on the screen } else { *_control_scroll_target += (nframes64_t) floor (step); } @@ -2865,11 +2865,11 @@ Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark) _session->locations()->marks_either_side (start, before, after); - if (before == max_frames) { + if (before == max_framepos) { start = after; - } else if (after == max_frames) { + } else if (after == max_framepos) { start = before; - } else if (before != max_frames && after != max_frames) { + } else if (before != max_framepos && after != max_framepos) { /* have before and after */ if ((start - before) < (after - start)) { start = before; @@ -4506,7 +4506,7 @@ Editor::set_frames_per_unit (double fpu) of frames into an 800 pixel wide space. */ - if (max_frames / fpu < 800.0) { + if (max_framepos / fpu < 800.0) { return; } @@ -4804,7 +4804,7 @@ Editor::get_regions_after (RegionSelection& rs, nframes64_t where, const TrackVi if ((tr = rtv->track()) && ((pl = tr->playlist()))) { Playlist::RegionList* regions = pl->regions_touched ( - (nframes64_t) floor ( (double)where * tr->speed()), max_frames); + (framepos_t) floor ( (double)where * tr->speed()), max_framepos); for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) { diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 52850644be..004c4a3fd2 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -554,7 +554,7 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert) } if (_drags->current_pointer_frame() > rightmost_frame && allow_horiz) { - if (rightmost_frame < max_frames) { + if (rightmost_frame < max_framepos) { autoscroll_x = 1; startit = true; } @@ -586,8 +586,8 @@ Editor::_autoscroll_canvas (void *arg) bool Editor::autoscroll_canvas () { - nframes64_t new_frame; - nframes64_t limit = max_frames - current_page_frames(); + framepos_t new_frame; + framepos_t limit = max_framepos - current_page_frames(); GdkEventMotion ev; double new_pixel; double target_pixel; diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 9b688adc45..eb37d11282 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -127,10 +127,10 @@ Editor::track_canvas_scroll (GdkEventScroll* ev) case GDK_SCROLL_RIGHT: xdelta = (current_page_frames() / 8); - if (max_frames - xdelta > leftmost_frame) { + if (max_framepos - xdelta > leftmost_frame) { reset_x_origin (leftmost_frame + xdelta); } else { - reset_x_origin (max_frames - current_page_frames()); + reset_x_origin (max_framepos - current_page_frames()); } break; diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 14b0bd83d3..87d7b6a1a9 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -452,7 +452,7 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, framepos_t* pending_r *pending_region_position = _last_frame_position; } - if (*pending_region_position > max_frames - _primary->region()->length()) { + if (*pending_region_position > max_framepos - _primary->region()->length()) { *pending_region_position = _last_frame_position; } @@ -2307,7 +2307,7 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) e = max (_marker->position(), e); s = min (s, e); e = max (s, e); - if (e < max_frames) { + if (e < max_framepos) { ++e; } _editor->session()->locations()->find_all_between (s, e, ll, Location::Flags (0)); @@ -3508,11 +3508,11 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred) _editor->session()->locations()->marks_either_side (grab_frame(), start, end); - if (end == max_frames) { + if (end == max_framepos) { end = _editor->session()->current_end_frame (); } - if (start == max_frames) { + if (start == max_framepos) { start = _editor->session()->current_start_frame (); } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index ae97d5c38f..8e486aa6cc 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -870,7 +870,7 @@ Editor::marker_menu_range_to_next () nframes64_t end; _session->locations()->marks_either_side (marker->position(), start, end); - if (end != max_frames) { + if (end != max_framepos) { string range_name = l->name(); range_name += "-range"; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 159df414a9..5d678da798 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -351,20 +351,20 @@ Editor::nudge_forward (bool next, bool force_playhead) if (next) { distance = next_distance; } - if (max_frames - distance > loc->start() + loc->length()) { + if (max_framepos - distance > loc->start() + loc->length()) { loc->set_start (loc->start() + distance); } else { - loc->set_start (max_frames - loc->length()); + loc->set_start (max_framepos - loc->length()); } } else { distance = get_nudge_distance (loc->end(), next_distance); if (next) { distance = next_distance; } - if (max_frames - distance > loc->end()) { + if (max_framepos - distance > loc->end()) { loc->set_end (loc->end() + distance); } else { - loc->set_end (max_frames); + loc->set_end (max_framepos); } } XMLNode& after (loc->get_state()); @@ -597,7 +597,7 @@ Editor::build_region_boundary_cache () while (pos < _session->current_end_frame() && !at_end) { framepos_t rpos; - framepos_t lpos = max_frames; + framepos_t lpos = max_framepos; for (vector::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) { @@ -670,7 +670,7 @@ boost::shared_ptr Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack) { TrackViewList::iterator i; - nframes64_t closest = max_frames; + framepos_t closest = max_framepos; boost::shared_ptr ret; framepos_t rpos = 0; @@ -732,7 +732,7 @@ Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, Trac framepos_t Editor::find_next_region_boundary (framepos_t pos, int32_t dir, const TrackViewList& tracks) { - framecnt_t distance = max_frames; + framecnt_t distance = max_framepos; framepos_t current_nearest = -1; for (TrackViewList::const_iterator i = tracks.begin(); i != tracks.end(); ++i) { @@ -1183,18 +1183,18 @@ Editor::selected_marker_to_selection_end () void Editor::scroll_playhead (bool forward) { - nframes64_t pos = playhead_cursor->current_frame; - nframes64_t delta = (nframes64_t) floor (current_page_frames() / 0.8); + framepos_t pos = playhead_cursor->current_frame; + framecnt_t delta = (framecnt_t) floor (current_page_frames() / 0.8); if (forward) { - if (pos == max_frames) { + if (pos == max_framepos) { return; } - if (pos < max_frames - delta) { + if (pos < max_framepos - delta) { pos += delta ; } else { - pos = max_frames; + pos = max_framepos; } } else { @@ -1428,8 +1428,8 @@ Editor::scroll_forward (float pages) } } - if (max_frames - cnt < leftmost_frame) { - frame = max_frames - cnt; + if (max_framepos - cnt < leftmost_frame) { + frame = max_framepos - cnt; } else { frame = leftmost_frame + cnt; } @@ -1584,8 +1584,8 @@ Editor::temporal_zoom (gdouble fpu) if (l < 0) { leftmost_after_zoom = 0; - } else if (l > max_frames) { - leftmost_after_zoom = max_frames - new_page_size; + } else if (l > max_framepos) { + leftmost_after_zoom = max_framepos - new_page_size; } else { leftmost_after_zoom = (nframes64_t) l; } @@ -1610,8 +1610,8 @@ Editor::temporal_zoom (gdouble fpu) if (l < 0) { leftmost_after_zoom = 0; - } else if (l > max_frames) { - leftmost_after_zoom = max_frames - new_page_size; + } else if (l > max_framepos) { + leftmost_after_zoom = max_framepos - new_page_size; } else { leftmost_after_zoom = (nframes64_t) l; } @@ -1629,8 +1629,8 @@ Editor::temporal_zoom (gdouble fpu) if (l < 0) { leftmost_after_zoom = 0; - } else if (l > max_frames) { - leftmost_after_zoom = max_frames - new_page_size; + } else if (l > max_framepos) { + leftmost_after_zoom = max_framepos - new_page_size; } else { leftmost_after_zoom = (nframes64_t) l; } @@ -1651,9 +1651,8 @@ Editor::temporal_zoom (gdouble fpu) void Editor::temporal_zoom_region (bool both_axes) { - - nframes64_t start = max_frames; - nframes64_t end = 0; + framepos_t start = max_framepos; + framepos_t end = 0; RegionSelection rs; set tracks; @@ -1701,10 +1700,10 @@ Editor::temporal_zoom_region (bool both_axes) start = 0; } - if (max_frames - extra_samples > end) { + if (max_framepos - extra_samples > end) { end += extra_samples; } else { - end = max_frames; + end = max_framepos; } if (both_axes) { @@ -2566,8 +2565,8 @@ Editor::play_edit_range () void Editor::play_selected_region () { - nframes64_t start = max_frames; - nframes64_t end = 0; + framepos_t start = max_framepos; + framepos_t end = 0; RegionSelection rs; get_regions_for_action (rs); @@ -3058,10 +3057,10 @@ Editor::crop_region_to (nframes64_t start, nframes64_t end) */ the_start = max (the_start, (nframes64_t) region->position()); - if (max_frames - the_start < region->length()) { + if (max_framepos - the_start < region->length()) { the_end = the_start + region->length() - 1; } else { - the_end = max_frames; + the_end = max_framepos; } the_end = min (end, the_end); cnt = the_end - the_start + 1; @@ -4091,7 +4090,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs) vector pmap; - nframes64_t first_position = max_frames; + framepos_t first_position = max_framepos; typedef set > FreezeList; FreezeList freezelist; @@ -4284,7 +4283,7 @@ Editor::paste_internal (nframes64_t position, float times) } } - if (position == max_frames) { + if (position == max_framepos) { position = get_preferred_edit_position(); } @@ -5712,8 +5711,8 @@ Editor::set_loop_from_edit_range (bool play) void Editor::set_loop_from_region (bool play) { - nframes64_t start = max_frames; - nframes64_t end = 0; + framepos_t start = max_framepos; + framepos_t end = 0; RegionSelection rs; @@ -5773,8 +5772,8 @@ Editor::set_punch_from_edit_range () void Editor::set_punch_from_region () { - nframes64_t start = max_frames; - nframes64_t end = 0; + framepos_t start = max_framepos; + framepos_t end = 0; RegionSelection rs; @@ -6341,8 +6340,8 @@ void Editor::playhead_forward_to_grid () { if (!_session) return; - nframes64_t pos = playhead_cursor->current_frame; - if (pos < max_frames - 1) { + framepos_t pos = playhead_cursor->current_frame; + if (pos < max_framepos - 1) { pos += 2; snap_to_internal (pos, 1, false); _session->request_locate (pos); diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 758be0f6c9..6c789f25d9 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -195,10 +195,10 @@ Editor::ruler_scroll (GdkEventScroll* event) case GDK_SCROLL_RIGHT: xdelta = (current_page_frames() / 2); - if (max_frames - xdelta > leftmost_frame) { + if (max_framepos - xdelta > leftmost_frame) { reset_x_origin (leftmost_frame + xdelta); } else { - reset_x_origin (max_frames - current_page_frames()); + reset_x_origin (max_framepos - current_page_frames()); } handled = true; break; @@ -977,8 +977,8 @@ Editor::set_timecode_ruler_scale (gdouble lower, gdouble upper) gint Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/) { - nframes_t pos; - nframes64_t spacer; + framepos_t pos; + framecnt_t spacer; Timecode::Time timecode; gchar buf[16]; gint n; @@ -987,7 +987,7 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble return 0; } - if (lower > (spacer = (nframes64_t)(128 * Editor::get_current_zoom ()))) { + if (lower > (spacer = (framecnt_t)(128 * Editor::get_current_zoom ()))) { lower = lower - spacer; } else { lower = 0; diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 806efaa66a..19166750cc 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -586,14 +586,14 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op, } else if (op == Selection::Extend) { list results; - nframes64_t last_frame; - nframes64_t first_frame; + framepos_t last_frame; + framepos_t first_frame; bool same_track = false; /* 1. find the last selected regionview in the track that was clicked in */ last_frame = 0; - first_frame = max_frames; + first_frame = max_framepos; for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) { if (&(*x)->get_time_axis_view() == &clicked_regionview->get_time_axis_view()) { @@ -988,7 +988,7 @@ Editor::select_all_in_track (Selection::Operation op) return; } - clicked_routeview->get_selectables (0, max_frames, 0, DBL_MAX, touched); + clicked_routeview->get_selectables (0, max_framepos, 0, DBL_MAX, touched); switch (op) { case Selection::Toggle: @@ -1015,7 +1015,7 @@ Editor::select_all (Selection::Operation op) if ((*iter)->hidden()) { continue; } - (*iter)->get_selectables (0, max_frames, 0, DBL_MAX, touched); + (*iter)->get_selectables (0, max_framepos, 0, DBL_MAX, touched); } begin_reversible_command (_("select all")); switch (op) { diff --git a/gtk2_ardour/marker_selection.h b/gtk2_ardour/marker_selection.h index d2aacceacf..eea0a3a77d 100644 --- a/gtk2_ardour/marker_selection.h +++ b/gtk2_ardour/marker_selection.h @@ -26,7 +26,7 @@ struct MarkerSelection : public std::list { - void range (nframes64_t& start, nframes64_t& end); + void range (ARDOUR::framepos_t& start, ARDOUR::framepos_t& end); }; #endif /* __ardour_gtk_marker_selection_h__ */ diff --git a/gtk2_ardour/marker_time_axis_view.cc b/gtk2_ardour/marker_time_axis_view.cc index c4fa4bc4c8..c901f9ba52 100644 --- a/gtk2_ardour/marker_time_axis_view.cc +++ b/gtk2_ardour/marker_time_axis_view.cc @@ -57,7 +57,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv) canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group); canvas_rect->property_x1() = 0.0; canvas_rect->property_y1() = 0.0; - canvas_rect->property_x2() = max_frames; + canvas_rect->property_x2() = max_framepos; canvas_rect->property_y2() = (double)20; canvas_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerTrack.get(); canvas_rect->property_fill_color_rgba() = stream_base_color; diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 505380cc25..9f2d859597 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -2610,11 +2610,12 @@ MidiRegionView::nudge_notes (bool forward) /* use grid */ - nframes64_t next_pos = ref_point; + framepos_t next_pos = ref_point; if (forward) { - /* XXX need check on max_frames, but that needs max_frames64 or something */ - next_pos += 1; + if (max_framepos - 1 < next_pos) { + next_pos += 1; + } } else { if (next_pos == 0) { return; diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 3bd46959de..fad87ee642 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -75,7 +75,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv) _note_lines->property_x1() = 0; _note_lines->property_y1() = 0; - _note_lines->property_x2() = trackview().editor().frame_to_pixel (max_frames); + _note_lines->property_x2() = trackview().editor().frame_to_pixel (max_framepos); _note_lines->property_y2() = 0; _note_lines->signal_event().connect(sigc::bind( diff --git a/gtk2_ardour/region_selection.cc b/gtk2_ardour/region_selection.cc index c10888a086..16f89e5eab 100644 --- a/gtk2_ardour/region_selection.cc +++ b/gtk2_ardour/region_selection.cc @@ -174,7 +174,7 @@ RegionSelection::remove (RegionView* rv) /* reset current start */ - nframes_t ref = max_frames; + framepos_t ref = max_framepos; for (RegionSelection::iterator i = begin (); i != end(); ++i) { if (region->first_frame() < ref) { diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index c9304d19cc..d947fbeb15 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -18,7 +18,6 @@ */ #include -#define __STDC_FORMAT_MACROS #include #include diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 886dffb651..63ece47e6a 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -1004,9 +1004,9 @@ Selection::add (const list& m) } void -MarkerSelection::range (nframes64_t& s, nframes64_t& e) +MarkerSelection::range (framepos_t& s, framepos_t& e) { - s = max_frames; + s = max_framepos; e = 0; for (MarkerSelection::iterator i = begin(); i != end(); ++i) { diff --git a/gtk2_ardour/strip_silence_dialog.cc b/gtk2_ardour/strip_silence_dialog.cc index 55429dc3da..936c071290 100644 --- a/gtk2_ardour/strip_silence_dialog.cc +++ b/gtk2_ardour/strip_silence_dialog.cc @@ -488,9 +488,9 @@ StripSilenceDialog::update_stats (const SilenceResult& res) } max_silence = 0; - min_silence = max_frames; + min_silence = max_framepos; max_audible = 0; - min_audible = max_frames; + min_audible = max_framepos; SilenceResult::const_iterator cur; diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 9e52275733..118f4033a6 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -146,7 +146,7 @@ TimeAxisViewItem::init ( name_connected = false; fill_opacity = 60; position_locked = false; - max_item_duration = ARDOUR::max_frames; + max_item_duration = ARDOUR::max_framepos; min_item_duration = 0; show_vestigial = true; visibility = vis; diff --git a/gtk2_ardour/time_selection.cc b/gtk2_ardour/time_selection.cc index 185c7e1eea..064e654cff 100644 --- a/gtk2_ardour/time_selection.cc +++ b/gtk2_ardour/time_selection.cc @@ -68,14 +68,14 @@ TimeSelection::consolidate () return changed; } -nframes_t +framepos_t TimeSelection::start () { if (empty()) { return 0; } - nframes_t first = max_frames; + framepos_t first = max_framepos; for (std::list::iterator i = begin(); i != end(); ++i) { if ((*i).start < first) { @@ -85,10 +85,10 @@ TimeSelection::start () return first; } -nframes_t +framepos_t TimeSelection::end_frame () { - nframes_t last = 0; + framepos_t last = 0; /* XXX make this work like RegionSelection: no linear search needed */ @@ -100,7 +100,7 @@ TimeSelection::end_frame () return last; } -nframes_t +framecnt_t TimeSelection::length() { return end_frame() - start() + 1; diff --git a/gtk2_ardour/time_selection.h b/gtk2_ardour/time_selection.h index f93f40c21e..61e635e8be 100644 --- a/gtk2_ardour/time_selection.h +++ b/gtk2_ardour/time_selection.h @@ -32,9 +32,9 @@ class TimeSelection : public std::list public: ARDOUR::AudioRange& operator[](uint32_t); - nframes_t start(); - nframes_t end_frame(); - nframes_t length(); + ARDOUR::framepos_t start(); + ARDOUR::framepos_t end_frame(); + ARDOUR::framepos_t length(); bool consolidate (); }; diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 02dc3ee150..1e94602839 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -46,7 +46,6 @@ namespace ARDOUR { class AudioEngine; - static const nframes_t max_frames = JACK_MAX_FRAMES; extern PBD::Signal1 BootMessage; int init (bool with_vst, bool try_optimization); diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index 7b7cdd7e3f..4106602b63 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -162,22 +162,22 @@ class AudioDiskstream : public Diskstream void set_pending_overwrite(bool); int overwrite_existing_buffers (); void set_block_size (nframes_t); - int internal_playback_seek (nframes_t distance); - int can_internal_playback_seek (nframes_t distance); + int internal_playback_seek (framecnt_t distance); + int can_internal_playback_seek (framecnt_t distance); int rename_write_sources (); std::list > steal_write_sources(); void reset_write_sources (bool, bool force = false); void non_realtime_input_change (); - void non_realtime_locate (nframes_t location); + void non_realtime_locate (framepos_t location); protected: friend class Auditioner; - int seek (nframes_t which_sample, bool complete_refill = false); + int seek (framepos_t which_sample, bool complete_refill = false); protected: friend class AudioTrack; - int process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler); + int process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler); bool commit (nframes_t nframes); private: @@ -233,12 +233,12 @@ class AudioDiskstream : public Diskstream int do_refill_with_alloc (); int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, - nframes_t& start, nframes_t cnt, - ChannelInfo* channel_info, int channel, bool reversed); + framepos_t& start, nframes_t cnt, + ChannelInfo* channel_info, int channel, bool reversed); void finish_capture (bool rec_monitors_input, boost::shared_ptr); void transport_stopped_wallclock (struct tm&, time_t, bool abort); - void transport_looped (nframes_t transport_frame); + void transport_looped (framepos_t transport_frame); void init (); @@ -254,7 +254,7 @@ class AudioDiskstream : public Diskstream int use_pending_capture_data (XMLNode& node); void get_input_sources (); - void prepare_record_status(nframes_t capture_start_frame); + void prepare_record_status(framepos_t capture_start_frame); void set_align_style_from_io(); void setup_destructive_playlist (); void use_destructive_playlist (); diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 3aef900630..bd3d223fc1 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -64,7 +64,7 @@ public: virtual void clear_capture_marks() {} virtual bool one_of_several_channels () const { return false; } - virtual int update_header (sframes_t when, struct tm&, time_t) = 0; + virtual int update_header (framepos_t when, struct tm&, time_t) = 0; virtual int flush_header () = 0; void mark_streaming_write_completed (); diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index 33a493b040..649c57c3ca 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -37,7 +37,7 @@ class CoreAudioSource : public AudioFileSource { void set_path (const std::string& p); float sample_rate() const; - int update_header (sframes_t when, struct tm&, time_t); + int update_header (framepos_t when, struct tm&, time_t); int flush_header () {return 0;}; void set_header_timeline_position () {}; diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 716cc13063..240448a78b 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -101,7 +101,7 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual void punch_out() {} void non_realtime_set_speed (); - virtual void non_realtime_locate (nframes_t /*location*/) {}; + virtual void non_realtime_locate (framepos_t /*location*/) {}; virtual void playlist_modified (); boost::shared_ptr playlist () { return _playlist; } @@ -110,10 +110,10 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual int use_new_playlist () = 0; virtual int use_copy_playlist () = 0; - nframes_t current_capture_start() const { return capture_start_frame; } - nframes_t current_capture_end() const { return capture_start_frame + capture_captured; } - nframes_t get_capture_start_frame (uint32_t n=0); - nframes_t get_captured_frames (uint32_t n=0); + framepos_t current_capture_start() const { return capture_start_frame; } + framepos_t current_capture_end() const { return capture_start_frame + capture_captured; } + framepos_t get_capture_start_frame (uint32_t n=0); + framecnt_t get_captured_frames (uint32_t n=0); ChanCount n_channels() { return _n_channels; } @@ -169,8 +169,8 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual void set_pending_overwrite (bool) = 0; virtual int overwrite_existing_buffers () = 0; - virtual int internal_playback_seek (nframes_t distance) = 0; - virtual int can_internal_playback_seek (nframes_t distance) = 0; + virtual int internal_playback_seek (framecnt_t distance) = 0; + virtual int can_internal_playback_seek (framecnt_t distance) = 0; virtual int rename_write_sources () = 0; virtual void reset_write_sources (bool, bool force = false) = 0; virtual void non_realtime_input_change () = 0; @@ -180,12 +180,12 @@ class Diskstream : public SessionObject, public PublicDiskstream protected: friend class Auditioner; - virtual int seek (nframes_t which_sample, bool complete_refill = false) = 0; + virtual int seek (framepos_t which_sample, bool complete_refill = false) = 0; protected: friend class Track; - virtual int process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) = 0; + virtual int process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) = 0; virtual bool commit (nframes_t nframes) = 0; //private: @@ -197,7 +197,7 @@ class Diskstream : public SessionObject, public PublicDiskstream struct CaptureTransition { TransitionType type; - nframes_t capture_val; ///< The start or end file frame position + framepos_t capture_val; ///< The start or end file frame position }; /* The two central butler operations */ @@ -211,11 +211,11 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual void playlist_ranges_moved (std::list< Evoral::RangeMove > const &, bool); virtual void transport_stopped_wallclock (struct tm&, time_t, bool abort) = 0; - virtual void transport_looped (nframes_t transport_frame) = 0; + virtual void transport_looped (framepos_t transport_frame) = 0; struct CaptureInfo { - uint32_t start; - uint32_t frames; + framepos_t start; + framecnt_t frames; }; virtual int use_new_write_source (uint32_t n=0) = 0; @@ -230,14 +230,14 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual int use_pending_capture_data (XMLNode& node) = 0; - virtual void check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record); - virtual void prepare_record_status (nframes_t /*capture_start_frame*/) {} + virtual void check_record_status (framepos_t transport_frame, nframes_t nframes, bool can_record); + virtual void prepare_record_status (framepos_t /*capture_start_frame*/) {} virtual void set_align_style_from_io() {} virtual void setup_destructive_playlist () {} virtual void use_destructive_playlist () {} virtual void prepare_to_stop (framepos_t pos); - void calculate_record_range(OverlapType ot, sframes_t transport_frame, nframes_t nframes, + void calculate_record_range(OverlapType ot, framepos_t transport_frame, framecnt_t nframes, nframes_t& rec_nframes, nframes_t& rec_offset); static nframes_t disk_io_chunk_frames; @@ -260,20 +260,20 @@ class Diskstream : public SessionObject, public PublicDiskstream bool _seek_required; bool force_refill; - nframes_t capture_start_frame; - nframes_t capture_captured; + framepos_t capture_start_frame; + framecnt_t capture_captured; bool was_recording; nframes_t adjust_capture_position; nframes_t _capture_offset; nframes_t _roll_delay; - nframes_t first_recordable_frame; - nframes_t last_recordable_frame; + framepos_t first_recordable_frame; + framepos_t last_recordable_frame; int last_possibly_recording; AlignStyle _alignment_style; bool _scrubbing; bool _slaved; Location* loop_location; - nframes_t overwrite_frame; + framepos_t overwrite_frame; off_t overwrite_offset; bool _pending_overwrite; bool overwrite_queued; @@ -284,9 +284,9 @@ class Diskstream : public SessionObject, public PublicDiskstream double _speed; double _target_speed; - nframes_t file_frame; - nframes_t playback_sample; - nframes_t playback_distance; + framepos_t file_frame; + framepos_t playback_sample; + framecnt_t playback_distance; uint32_t _read_data_count; uint32_t _write_data_count; @@ -297,9 +297,9 @@ class Diskstream : public SessionObject, public PublicDiskstream Glib::Mutex state_lock; - nframes_t scrub_start; - nframes_t scrub_buffer_size; - nframes_t scrub_offset; + framepos_t scrub_start; + nframes_t scrub_buffer_size; + nframes_t scrub_offset; PBD::ScopedConnectionList playlist_connections; diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index 69c762823b..49a7525dc7 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -62,7 +62,7 @@ class MidiDiskstream : public Diskstream float playback_buffer_load() const; float capture_buffer_load() const; - void get_playback(MidiBuffer& dst, nframes_t start, nframes_t end); + void get_playback(MidiBuffer& dst, framepos_t start, framepos_t end); void set_record_enabled (bool yn); @@ -119,23 +119,23 @@ class MidiDiskstream : public Diskstream void set_pending_overwrite(bool); int overwrite_existing_buffers (); void set_block_size (nframes_t); - int internal_playback_seek (nframes_t distance); - int can_internal_playback_seek (nframes_t distance); + int internal_playback_seek (framecnt_t distance); + int can_internal_playback_seek (framecnt_t distance); int rename_write_sources (); std::list > steal_write_sources(); void reset_write_sources (bool, bool force = false); void non_realtime_input_change (); - void non_realtime_locate (nframes_t location); + void non_realtime_locate (framepos_t location); static void set_readahead_frames(nframes_t frames_ahead) { midi_readahead = frames_ahead; } protected: - int seek (nframes_t which_sample, bool complete_refill = false); + int seek (framepos_t which_sample, bool complete_refill = false); protected: friend class MidiTrack; - int process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler); + int process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler); bool commit (nframes_t nframes); static nframes_t midi_readahead; @@ -147,11 +147,11 @@ class MidiDiskstream : public Diskstream int do_refill_with_alloc(); - int read (nframes_t& start, nframes_t cnt, bool reversed); + int read (framepos_t& start, nframes_t cnt, bool reversed); void finish_capture (bool rec_monitors_input); void transport_stopped_wallclock (struct tm&, time_t, bool abort); - void transport_looped (nframes_t transport_frame); + void transport_looped (framepos_t transport_frame); void init (); diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index 0b62809fc3..a7a5fb3a82 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -35,6 +35,16 @@ class XMLNode; +namespace ARDOUR { + namespace Properties { + /* this is pseudo-property: nothing has this as an actual + property, but it allows us to signal changes to the + MidiModel used by the MidiRegion + */ + extern PBD::PropertyDescriptor midi_data; + } +} + namespace ARDOUR { class Route; @@ -48,6 +58,8 @@ template class MidiRingBuffer; class MidiRegion : public Region { public: + static void make_property_quarks (); + ~MidiRegion(); boost::shared_ptr clone (); @@ -109,6 +121,8 @@ class MidiRegion : public Region NoteMode mode = Sustained, MidiStateTracker* tracker = 0) const; + void register_properties (); + void recompute_at_start (); void recompute_at_end (); @@ -117,10 +131,12 @@ class MidiRegion : public Region void switch_source(boost::shared_ptr source); void model_changed (); void model_automation_state_changed (Evoral::Parameter const &); + void model_contents_changed (); std::set _filtered_parameters; ///< parameters that we ask our source not to return when reading PBD::ScopedConnection _model_connection; PBD::ScopedConnection _source_connection; + PBD::ScopedConnection _model_contents_connection; }; } /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/public_diskstream.h b/libs/ardour/ardour/public_diskstream.h index e0cf9ef7fa..de6b3dcb55 100755 --- a/libs/ardour/ardour/public_diskstream.h +++ b/libs/ardour/ardour/public_diskstream.h @@ -46,17 +46,17 @@ public: virtual uint32_t read_data_count() const = 0; virtual uint32_t write_data_count() const = 0; virtual void set_pending_overwrite (bool) = 0; - virtual int seek (nframes_t, bool complete_refill = false) = 0; + virtual int seek (framepos_t, bool complete_refill = false) = 0; virtual bool hidden () const = 0; - virtual int can_internal_playback_seek (nframes_t) = 0; - virtual int internal_playback_seek (nframes_t) = 0; + virtual int can_internal_playback_seek (framepos_t) = 0; + virtual int internal_playback_seek (framepos_t) = 0; virtual void non_realtime_input_change () = 0; - virtual void non_realtime_locate (nframes_t) = 0; + virtual void non_realtime_locate (framepos_t) = 0; virtual void non_realtime_set_speed () = 0; virtual int overwrite_existing_buffers () = 0; - virtual nframes_t get_captured_frames (uint32_t n = 0) = 0; + virtual framecnt_t get_captured_frames (uint32_t n = 0) = 0; virtual int set_loop (Location *) = 0; - virtual void transport_looped (nframes_t) = 0; + virtual void transport_looped (framepos_t) = 0; virtual bool realtime_set_speed (double, bool) = 0; virtual void transport_stopped_wallclock (struct tm &, time_t, bool) = 0; virtual bool pending_overwrite () const = 0; @@ -64,10 +64,10 @@ public: virtual void prepare_to_stop (framepos_t) = 0; virtual void set_slaved (bool) = 0; virtual ChanCount n_channels () = 0; - virtual nframes_t get_capture_start_frame (uint32_t n = 0) = 0; + virtual framepos_t get_capture_start_frame (uint32_t n = 0) = 0; virtual AlignStyle alignment_style () const = 0; - virtual nframes_t current_capture_start () const = 0; - virtual nframes_t current_capture_end () const = 0; + virtual framepos_t current_capture_start () const = 0; + virtual framepos_t current_capture_end () const = 0; virtual void playlist_modified () = 0; virtual int use_playlist (boost::shared_ptr) = 0; virtual void set_align_style (AlignStyle) = 0; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index db7a59b76d..315ad887ae 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -311,9 +311,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi int wipe (); - std::pair get_extent () const; - nframes_t current_end_frame () const; - nframes_t current_start_frame () const; + std::pair get_extent () const; + framepos_t current_end_frame () const; + framepos_t current_start_frame () const; /// "actual" sample rate of session, set by current audioengine rate, pullup/down etc. nframes_t frame_rate() const { return _current_frame_rate; } /// "native" sample rate of session, regardless of current audioengine rate, pullup/down etc @@ -447,14 +447,14 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void sync_time_vars(); void bbt_time (nframes_t when, BBT_Time&); - void timecode_to_sample(Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes) const; - void sample_to_timecode(nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; + void timecode_to_sample(Timecode::Time& timecode, framepos_t& sample, bool use_offset, bool use_subframes) const; + void sample_to_timecode(framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; void timecode_time (Timecode::Time &); void timecode_time (nframes_t when, Timecode::Time&); void timecode_time_subframes (nframes_t when, Timecode::Time&); void timecode_duration (nframes_t, Timecode::Time&) const; - void timecode_duration_string (char *, nframes_t) const; + void timecode_duration_string (char *, framecnt_t) const; void set_timecode_offset (nframes_t); nframes_t timecode_offset () const { return _timecode_offset; } @@ -629,7 +629,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi /* s/w "RAID" management */ - nframes_t available_capture_duration(); + framecnt_t available_capture_duration(); /* I/O bundles */ @@ -1048,15 +1048,15 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void enable_record (); - void increment_transport_position (uint32_t val) { - if (max_frames - val < _transport_frame) { - _transport_frame = max_frames; + void increment_transport_position (framecnt_t val) { + if (max_framepos - val < _transport_frame) { + _transport_frame = max_framepos; } else { _transport_frame += val; } } - void decrement_transport_position (uint32_t val) { + void decrement_transport_position (framecnt_t val) { if (val < _transport_frame) { _transport_frame -= val; } else { diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h index 23128c4025..d24aa9d136 100644 --- a/libs/ardour/ardour/silentfilesource.h +++ b/libs/ardour/ardour/silentfilesource.h @@ -27,7 +27,7 @@ namespace ARDOUR { class SilentFileSource : public AudioFileSource { public: - int update_header (sframes_t /*when*/, struct tm&, time_t) { return 0; } + int update_header (framepos_t /*when*/, struct tm&, time_t) { return 0; } int flush_header () { return 0; } float sample_rate () const { return _sample_rate; } diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index d2b0e49c45..111564cc23 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -249,13 +249,13 @@ class MTC_Slave : public Slave { static const int frame_tolerance; SafeTime current; - nframes_t mtc_frame; /* current time */ - nframes_t last_inbound_frame; /* when we got it; audio clocked */ + framepos_t mtc_frame; /* current time */ + framepos_t last_inbound_frame; /* when we got it; audio clocked */ MIDI::byte last_mtc_fps_byte; - nframes64_t window_begin; - nframes64_t window_end; - nframes64_t last_mtc_timestamp; - nframes64_t last_mtc_frame; + framepos_t window_begin; + framepos_t window_end; + framepos_t last_mtc_timestamp; + framepos_t last_mtc_frame; bool did_reset_tc_format; TimecodeFormat saved_tc_format; size_t speed_accumulator_size; diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 59dd603236..06e329a74b 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -44,7 +44,7 @@ class SndFileSource : public AudioFileSource { ~SndFileSource (); float sample_rate () const; - int update_header (sframes_t when, struct tm&, time_t); + int update_header (framepos_t when, struct tm&, time_t); int flush_header (); nframes64_t natural_position () const; diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index c32b96ae97..14d0de5f4d 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -41,7 +41,7 @@ class SourceFactory { static boost::shared_ptr create (Session&, const XMLNode& node, bool async = false); static boost::shared_ptr createSilent (Session&, const XMLNode& node, - nframes_t nframes, float sample_rate); + framecnt_t nframes, float sample_rate); static boost::shared_ptr createReadable (DataType type, Session&, const std::string& path, diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index dfdc409659..38d36ea5d0 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -114,17 +114,17 @@ class Track : public Route, public PublicDiskstream uint32_t read_data_count() const; uint32_t write_data_count() const; void set_pending_overwrite (bool); - int seek (nframes_t, bool complete_refill = false); + int seek (framepos_t, bool complete_refill = false); bool hidden () const; - int can_internal_playback_seek (nframes_t); - int internal_playback_seek (nframes_t); + int can_internal_playback_seek (framepos_t); + int internal_playback_seek (framepos_t); void non_realtime_input_change (); - void non_realtime_locate (nframes_t); + void non_realtime_locate (framepos_t); void non_realtime_set_speed (); int overwrite_existing_buffers (); - nframes_t get_captured_frames (uint32_t n = 0); + framecnt_t get_captured_frames (uint32_t n = 0); int set_loop (Location *); - void transport_looped (nframes_t); + void transport_looped (framepos_t); bool realtime_set_speed (double, bool); void transport_stopped_wallclock (struct tm &, time_t, bool); bool pending_overwrite () const; @@ -132,10 +132,10 @@ class Track : public Route, public PublicDiskstream void prepare_to_stop (framepos_t); void set_slaved (bool); ChanCount n_channels (); - nframes_t get_capture_start_frame (uint32_t n = 0); + framepos_t get_capture_start_frame (uint32_t n = 0); AlignStyle alignment_style () const; - nframes_t current_capture_start () const; - nframes_t current_capture_end () const; + framepos_t current_capture_start () const; + framepos_t current_capture_end () const; void playlist_modified (); int use_playlist (boost::shared_ptr); void set_align_style (AlignStyle); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 435cf8d416..f91b67bb5a 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -20,14 +20,11 @@ #ifndef __ardour_types_h__ #define __ardour_types_h__ -#ifndef __STDC_FORMAT_MACROS -#define __STDC_FORMAT_MACROS /* PRI; C++ requires explicit requesting of these */ -#endif - #include #include #include #include +#include #include #include @@ -58,12 +55,6 @@ namespace ARDOUR { typedef uint32_t nframes_t; typedef int64_t nframes64_t; - - /** "Session frames", frames relative to the session timeline. - * Everything related to transport position etc. should be of this type. - * We might want to make this a compile time option for 32-bitters who - * don't want to pay for extremely long session times they don't need... - */ typedef int64_t sframes_t; typedef int64_t framepos_t; /* any offset from a framepos_t, measured in audio frames */ @@ -71,6 +62,9 @@ namespace ARDOUR { /* any count of audio frames */ typedef int64_t framecnt_t; + static const framepos_t max_framepos = INT64_MAX; + static const framecnt_t max_framecnt = INT64_MAX; + struct IOChange { enum Type { diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index f4e7ac8e9c..f8bd4f698f 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -204,19 +204,19 @@ AudioDiskstream::non_realtime_input_change () /* now refill channel buffers */ if (speed() != 1.0f || speed() != -1.0f) { - seek ((nframes_t) (_session.transport_frame() * (double) speed())); + seek ((framepos_t) (_session.transport_frame() * (double) speed())); } else { seek (_session.transport_frame()); } } void -AudioDiskstream::non_realtime_locate (nframes_t location) +AudioDiskstream::non_realtime_locate (framepos_t location) { /* now refill channel buffers */ if (speed() != 1.0f || speed() != -1.0f) { - seek ((nframes_t) (location * (double) speed())); + seek ((framepos_t) (location * (double) speed())); } else { seek (location); } @@ -347,7 +347,7 @@ AudioDiskstream::setup_destructive_playlist () PropertyList plist; plist.add (Properties::name, _name.val()); plist.add (Properties::start, 0); - plist.add (Properties::length, max_frames - max_frames - srcs.front()->natural_position()); + plist.add (Properties::length, max_framepos - (max_framepos - srcs.front()->natural_position())); boost::shared_ptr region (RegionFactory::create (srcs, plist)); _playlist->add_region (region, srcs.front()->natural_position()); @@ -377,7 +377,7 @@ AudioDiskstream::use_destructive_playlist () /* be sure to stretch the region out to the maximum length */ - region->set_length (max_frames - region->position(), this); + region->set_length (max_framepos - region->position(), this); uint32_t n; ChannelList::iterator chan; @@ -397,7 +397,7 @@ AudioDiskstream::use_destructive_playlist () } void -AudioDiskstream::prepare_record_status(nframes_t capture_start_frame) +AudioDiskstream::prepare_record_status(framepos_t capture_start_frame) { if (recordable() && destructive()) { boost::shared_ptr c = channels.reader(); @@ -421,7 +421,7 @@ AudioDiskstream::prepare_record_status(nframes_t capture_start_frame) } int -AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) +AudioDiskstream::process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) { uint32_t n; boost::shared_ptr c = channels.reader(); @@ -470,7 +470,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can // and last_recordable_frame < first_recordable_frame if (last_recordable_frame < first_recordable_frame) { - last_recordable_frame = max_frames; + last_recordable_frame = max_framepos; } OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes); @@ -759,7 +759,7 @@ AudioDiskstream::overwrite_existing_buffers () size--; uint32_t n=0; - nframes_t start; + framepos_t start; for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan, ++n) { @@ -808,7 +808,7 @@ AudioDiskstream::overwrite_existing_buffers () } int -AudioDiskstream::seek (nframes_t frame, bool complete_refill) +AudioDiskstream::seek (framepos_t frame, bool complete_refill) { uint32_t n; int ret = -1; @@ -841,13 +841,13 @@ AudioDiskstream::seek (nframes_t frame, bool complete_refill) } int -AudioDiskstream::can_internal_playback_seek (nframes_t distance) +AudioDiskstream::can_internal_playback_seek (framecnt_t distance) { ChannelList::iterator chan; boost::shared_ptr c = channels.reader(); for (chan = c->begin(); chan != c->end(); ++chan) { - if ((*chan)->playback_buf->read_space() < distance) { + if ((*chan)->playback_buf->read_space() < (size_t) distance) { return false; } } @@ -855,7 +855,7 @@ AudioDiskstream::can_internal_playback_seek (nframes_t distance) } int -AudioDiskstream::internal_playback_seek (nframes_t distance) +AudioDiskstream::internal_playback_seek (framecnt_t distance) { ChannelList::iterator chan; boost::shared_ptr c = channels.reader(); @@ -871,13 +871,14 @@ AudioDiskstream::internal_playback_seek (nframes_t distance) } int -AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, nframes_t& start, nframes_t cnt, +AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, + framepos_t& start, nframes_t cnt, ChannelInfo* /*channel_info*/, int channel, bool reversed) { nframes_t this_read = 0; bool reloop = false; - nframes_t loop_end = 0; - nframes_t loop_start = 0; + framepos_t loop_end = 0; + framepos_t loop_start = 0; nframes_t offset = 0; Location *loc = 0; @@ -885,7 +886,7 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, if (!reversed) { - nframes_t loop_length = 0; + framecnt_t loop_length = 0; /* Make the use of a Location atomic for this read operation. @@ -1082,7 +1083,7 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) } else { - if (file_frame == max_frames) { + if (file_frame == max_framepos) { /* at end: nothing to do but fill with silence */ @@ -1099,19 +1100,19 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) return 0; } - if (file_frame > max_frames - total_space) { + if (file_frame > max_framepos - total_space) { /* to close to the end: read what we can, and zero fill the rest */ - zero_fill = total_space - (max_frames - file_frame); - total_space = max_frames - file_frame; + zero_fill = total_space - (max_framepos - file_frame); + total_space = max_framepos - file_frame; } else { zero_fill = 0; } } - nframes_t file_frame_tmp = 0; + framepos_t file_frame_tmp = 0; for (chan_n = 0, i = c->begin(); i != c->end(); ++i, ++chan_n) { @@ -1527,7 +1528,7 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo } void -AudioDiskstream::transport_looped (nframes_t transport_frame) +AudioDiskstream::transport_looped (framepos_t transport_frame) { if (was_recording) { // all we need to do is finish this capture, with modified capture length @@ -1552,7 +1553,7 @@ AudioDiskstream::transport_looped (nframes_t transport_frame) // no latency adjustment or capture offset needs to be made, as that already happened the first time capture_start_frame = transport_frame; first_recordable_frame = transport_frame; // mild lie - last_recordable_frame = max_frames; + last_recordable_frame = max_framepos; was_recording = true; if (recordable() && destructive()) { @@ -1581,8 +1582,8 @@ void AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr c) { was_recording = false; - first_recordable_frame = max_frames; - last_recordable_frame = max_frames; + first_recordable_frame = max_framepos; + last_recordable_frame = max_framepos; if (capture_captured == 0) { return; @@ -1627,7 +1628,7 @@ AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr< capture_captured = 0; /* now we've finished a capture, reset first_recordable_frame for next time */ - first_recordable_frame = max_frames; + first_recordable_frame = max_framepos; } void @@ -2147,13 +2148,13 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) boost::shared_ptr fs; boost::shared_ptr first_fs; SourceList pending_sources; - nframes_t position; + framepos_t position; if ((prop = node.property (X_("at"))) == 0) { return -1; } - if (sscanf (prop->value().c_str(), "%" PRIu32, &position) != 1) { + if (sscanf (prop->value().c_str(), "%" PRIu64, &position) != 1) { return -1; } diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index bfdd9acd26..7a3c279705 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -76,7 +76,7 @@ AudioEngine::AudioEngine (string client_name, string session_uuid) _running = false; _has_run = false; last_monitor_check = 0; - monitor_check_interval = max_frames; + monitor_check_interval = INT32_MAX; _processed_frames = 0; _usecs_per_cycle = 0; _jack = 0; @@ -463,8 +463,8 @@ AudioEngine::process_callback (nframes_t nframes) /* handle wrap around of total frames counter */ - if (max_frames - _processed_frames < nframes) { - next_processed_frames = nframes - (max_frames - _processed_frames); + if (max_framepos - _processed_frames < nframes) { + next_processed_frames = nframes - (max_framepos - _processed_frames); } else { next_processed_frames = _processed_frames + nframes; } diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc index 6878069398..6627409bd0 100644 --- a/libs/ardour/coreaudiosource.cc +++ b/libs/ardour/coreaudiosource.cc @@ -218,7 +218,7 @@ CoreAudioSource::sample_rate() const } int -CoreAudioSource::update_header (sframes_t when, struct tm&, time_t) +CoreAudioSource::update_header (framepos_t when, struct tm&, time_t) { return 0; } diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 0a79aec613..179cf2b2a9 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -87,8 +87,8 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag) , adjust_capture_position (0) , _capture_offset (0) , _roll_delay (0) - , first_recordable_frame (max_frames) - , last_recordable_frame (max_frames) + , first_recordable_frame (max_framepos) + , last_recordable_frame (max_framepos) , last_possibly_recording (0) , _alignment_style (ExistingMaterial) , _scrubbing (false) @@ -134,8 +134,8 @@ Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/) , adjust_capture_position (0) , _capture_offset (0) , _roll_delay (0) - , first_recordable_frame (max_frames) - , last_recordable_frame (max_frames) + , first_recordable_frame (max_framepos) + , last_recordable_frame (max_framepos) , last_possibly_recording (0) , _alignment_style (ExistingMaterial) , _scrubbing (false) @@ -213,7 +213,7 @@ Diskstream::non_realtime_set_speed () if (_seek_required) { if (speed() != 1.0f || speed() != -1.0f) { - seek ((nframes_t) (_session.transport_frame() * (double) speed()), true); + seek ((framepos_t) (_session.transport_frame() * (double) speed()), true); } else { seek (_session.transport_frame(), true); @@ -237,7 +237,7 @@ Diskstream::realtime_set_speed (double sp, bool global) if (new_speed != _actual_speed) { nframes_t required_wrap_size = (nframes_t) floor (_session.get_block_size() * - fabs (new_speed)) + 1; + fabs (new_speed)) + 1; if (required_wrap_size > wrap_buffer_size) { _buffer_reallocation_required = true; @@ -297,7 +297,7 @@ Diskstream::set_loop (Location *location) return 0; } -ARDOUR::nframes_t +ARDOUR::framepos_t Diskstream::get_capture_start_frame (uint32_t n) { Glib::Mutex::Lock lm (capture_info_lock); @@ -310,7 +310,7 @@ Diskstream::get_capture_start_frame (uint32_t n) } } -ARDOUR::nframes_t +ARDOUR::framecnt_t Diskstream::get_captured_frames (uint32_t n) { Glib::Mutex::Lock lm (capture_info_lock); @@ -506,7 +506,7 @@ Diskstream::move_processor_automation (boost::weak_ptr p, list< Evora } void -Diskstream::check_record_status (nframes_t transport_frame, nframes_t /*nframes*/, bool can_record) +Diskstream::check_record_status (framepos_t transport_frame, nframes_t /*nframes*/, bool can_record) { int possibly_recording; int rolling; @@ -536,7 +536,7 @@ Diskstream::check_record_status (nframes_t transport_frame, nframes_t /*nframes* /* we transitioned to recording. lets see if its transport based or a punch */ first_recordable_frame = transport_frame + _capture_offset; - last_recordable_frame = max_frames; + last_recordable_frame = max_framepos; capture_start_frame = transport_frame; if (change & transport_rolling) { @@ -633,7 +633,7 @@ Diskstream::route_going_away () } void -Diskstream::calculate_record_range(OverlapType ot, sframes_t transport_frame, nframes_t nframes, +Diskstream::calculate_record_range(OverlapType ot, framepos_t transport_frame, framecnt_t nframes, nframes_t& rec_nframes, nframes_t& rec_offset) { switch (ot) { diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index ddf95b1649..ad6fd1859d 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -901,13 +901,13 @@ Locations::first_location_after (nframes64_t frame, bool include_special_ranges) * side of a frame. Note that if frame is exactly on a `mark', that mark will not be considered for returning * as before/after. * @param frame Frame to look for. - * @param before Filled in with the position of the last `mark' before `frame' (or max_frames if none exists) - * @param after Filled in with the position of the next `mark' after `frame' (or max_frames if none exists) + * @param before Filled in with the position of the last `mark' before `frame' (or max_framepos if none exists) + * @param after Filled in with the position of the next `mark' after `frame' (or max_framepos if none exists) */ void Locations::marks_either_side (nframes64_t const frame, nframes64_t& before, nframes64_t& after) const { - before = after = max_frames; + before = after = max_framepos; LocationList locs; diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 8b7d4a3d4a..e916fef263 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -143,7 +143,7 @@ MidiDiskstream::~MidiDiskstream () void -MidiDiskstream::non_realtime_locate (nframes_t position) +MidiDiskstream::non_realtime_locate (framepos_t position) { if (_write_source) { _write_source->set_timeline_position (position); @@ -192,7 +192,7 @@ MidiDiskstream::non_realtime_input_change () /* now refill channel buffers */ if (speed() != 1.0f || speed() != -1.0f) { - seek ((nframes_t) (_session.transport_frame() * (double) speed())); + seek ((framepos_t) (_session.transport_frame() * (double) speed())); } else { seek (_session.transport_frame()); @@ -488,7 +488,7 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) #endif int -MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) +MidiDiskstream::process (framepos_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler) { int ret = -1; nframes_t rec_offset = 0; @@ -619,7 +619,7 @@ MidiDiskstream::set_pending_overwrite (bool yn) int MidiDiskstream::overwrite_existing_buffers () { - //read(overwrite_frame, disk_io_chunk_frames, false); + read (overwrite_frame, disk_io_chunk_frames, false); overwrite_queued = false; _pending_overwrite = false; @@ -627,7 +627,7 @@ MidiDiskstream::overwrite_existing_buffers () } int -MidiDiskstream::seek (nframes_t frame, bool complete_refill) +MidiDiskstream::seek (framepos_t frame, bool complete_refill) { Glib::Mutex::Lock lm (state_lock); int ret = -1; @@ -650,7 +650,7 @@ MidiDiskstream::seek (nframes_t frame, bool complete_refill) } int -MidiDiskstream::can_internal_playback_seek (nframes_t distance) +MidiDiskstream::can_internal_playback_seek (framecnt_t distance) { uint32_t frames_read = g_atomic_int_get(&_frames_read_from_ringbuffer); uint32_t frames_written = g_atomic_int_get(&_frames_written_to_ringbuffer); @@ -658,7 +658,7 @@ MidiDiskstream::can_internal_playback_seek (nframes_t distance) } int -MidiDiskstream::internal_playback_seek (nframes_t distance) +MidiDiskstream::internal_playback_seek (framecnt_t distance) { first_recordable_frame += distance; playback_sample += distance; @@ -668,17 +668,17 @@ MidiDiskstream::internal_playback_seek (nframes_t distance) /** @a start is set to the new frame position (TIME) read up to */ int -MidiDiskstream::read (nframes_t& start, nframes_t dur, bool reversed) +MidiDiskstream::read (framepos_t& start, nframes_t dur, bool reversed) { nframes_t this_read = 0; bool reloop = false; - nframes_t loop_end = 0; - nframes_t loop_start = 0; + framepos_t loop_end = 0; + framepos_t loop_start = 0; Location *loc = 0; if (!reversed) { - nframes_t loop_length = 0; + framecnt_t loop_length = 0; /* Make the use of a Location atomic for this read operation. @@ -749,7 +749,7 @@ MidiDiskstream::read (nframes_t& start, nframes_t dur, bool reversed) if (reloop) { // Synthesize LoopEvent here, because the next events // written will have non-monotonic timestamps. - _playback_buf->write(loop_end - 1, LoopEventType, sizeof (nframes_t), (uint8_t *) &loop_start); + _playback_buf->write(loop_end - 1, LoopEventType, sizeof (framepos_t), (uint8_t *) &loop_start); cout << "Pushing LoopEvent ts=" << loop_end-1 << " start+this_read " << start+this_read << endl; @@ -788,13 +788,13 @@ MidiDiskstream::do_refill () } /* at end: nothing to do */ - if (file_frame == max_frames) { + if (file_frame == max_framepos) { return 0; } // At this point we... assert(_playback_buf->write_space() > 0); // ... have something to write to, and - assert(file_frame <= max_frames); // ... something to write + assert(file_frame <= max_framepos); // ... something to write // now calculate how much time is in the ringbuffer. // and lets write as much as we need to get this to be midi_readahead; @@ -810,7 +810,7 @@ MidiDiskstream::do_refill () //cout << "MDS read for midi_readahead " << to_read << " rb_contains: " // << frames_written - frames_read << endl; - to_read = min(to_read, (max_frames - file_frame)); + to_read = (nframes_t) min ((framecnt_t) to_read, (framecnt_t) (max_framepos - file_frame)); if (read (file_frame, to_read, reversed)) { ret = -1; @@ -1061,7 +1061,7 @@ MidiDiskstream::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen } void -MidiDiskstream::transport_looped (nframes_t transport_frame) +MidiDiskstream::transport_looped (framepos_t transport_frame) { if (was_recording) { @@ -1084,7 +1084,7 @@ MidiDiskstream::transport_looped (nframes_t transport_frame) // no latency adjustment or capture offset needs to be made, as that already happened the first time capture_start_frame = transport_frame; first_recordable_frame = transport_frame; // mild lie - last_recordable_frame = max_frames; + last_recordable_frame = max_framepos; was_recording = true; } } @@ -1463,7 +1463,7 @@ MidiDiskstream::use_pending_capture_data (XMLNode& /*node*/) * so that an event at \a start has time = 0 */ void -MidiDiskstream::get_playback (MidiBuffer& dst, nframes_t start, nframes_t end) +MidiDiskstream::get_playback (MidiBuffer& dst, framepos_t start, framepos_t end) { dst.clear(); assert(dst.size() == 0); diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index c93993aef8..e0d451d31b 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -380,8 +380,6 @@ MidiModel::DiffCommand::marshal_note(const NotePtr note) { XMLNode* xml_note = new XMLNode("note"); - cerr << "Marshalling note: " << *note << endl; - { ostringstream id_str(ios::ate); id_str << int(note->id()); diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index 6f5dee979a..0fd32ebddd 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -425,13 +425,10 @@ MidiPlaylist::region_changed (const PBD::PropertyChange& what_changed, boost::sh return false; } - // Feeling rather uninterested today, but thanks for the heads up anyway! - PBD::PropertyChange our_interests; + our_interests.add (Properties::midi_data); - bool parent_wants_notify; - - parent_wants_notify = Playlist::region_changed (what_changed, region); + bool parent_wants_notify = Playlist::region_changed (what_changed, region); if (parent_wants_notify || what_changed.contains (our_interests)) { notify_contents_changed (); diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index ae93a77445..ffb5217137 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -47,10 +47,31 @@ using namespace std; using namespace ARDOUR; using namespace PBD; +namespace ARDOUR { + namespace Properties { + PBD::PropertyDescriptor midi_data; + } +} + +void +MidiRegion::make_property_quarks () +{ + Properties::midi_data.property_id = g_quark_from_static_string (X_("midi-data")); + DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for midi-data = %1\n", Properties::midi_data.property_id)); +} + +void +MidiRegion::register_properties () +{ + /* none yet, but its only a matter of time */ +} + /* Basic MidiRegion constructor (many channels) */ MidiRegion::MidiRegion (const SourceList& srcs) : Region (srcs) { + register_properties (); + // midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1)); midi_source(0)->ModelChanged.connect_same_thread (_source_connection, boost::bind (&MidiRegion::model_changed, this)); model_changed (); @@ -62,6 +83,8 @@ MidiRegion::MidiRegion (const SourceList& srcs) MidiRegion::MidiRegion (boost::shared_ptr other, frameoffset_t offset, bool offset_relative) : Region (other, offset, offset_relative) { + register_properties (); + assert(_name.val().find("/") == string::npos); // midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1)); midi_source(0)->ModelChanged.connect_same_thread (_source_connection, boost::bind (&MidiRegion::model_changed, this)); @@ -155,13 +178,14 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, Evoral::EventSink& boost::shared_ptr src = midi_source(chan_n); src->set_note_mode(mode); - - /*cerr << "MR read @ " << position << " * " << to_read - << " _position = " << _position - << " _start = " << _start - << " offset = " << output_buffer_position - << " intoffset = " << internal_offset - << endl;*/ + + /* + cerr << "MR read @ " << position << " * " << to_read + << " _position = " << _position + << " _start = " << _start + << " intoffset = " << internal_offset + << endl; + */ /* This call reads events from a source and writes them to `dst' timed in session frames */ @@ -281,6 +305,15 @@ MidiRegion::model_changed () midi_source()->AutomationStateChanged.connect_same_thread ( _model_connection, boost::bind (&MidiRegion::model_automation_state_changed, this, _1) ); + + model()->ContentsChanged.connect_same_thread ( + _model_contents_connection, boost::bind (&MidiRegion::model_contents_changed, this)); +} + +void +MidiRegion::model_contents_changed () +{ + send_change (PropertyChange (Properties::midi_data)); } void diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index a67bb7481d..354341de24 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -123,7 +123,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, nframes_t now) Timecode::Time timecode; TimecodeFormat tc_format; bool reset_tc = true; - nframes64_t window_root = -1; + framepos_t window_root = -1; DEBUG_TRACE (DEBUG::MTC, string_compose ("full mtc time known at %1, full ? %2\n", now, was_full)); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 87ed1ca03b..334b3f163d 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -17,9 +17,7 @@ */ -#define __STDC_LIMIT_MACROS #include - #include #include #include @@ -1501,8 +1499,8 @@ Playlist::core_splice (framepos_t at, framecnt_t distance, boost::shared_ptrposition() + distance; if (new_pos < 0) { new_pos = 0; - } else if (new_pos >= max_frames - (*i)->length()) { - new_pos = max_frames - (*i)->length(); + } else if (new_pos >= max_framepos - (*i)->length()) { + new_pos = max_framepos - (*i)->length(); } (*i)->set_position (new_pos, this); @@ -1985,7 +1983,7 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir) { RegionLock rlock (this); boost::shared_ptr ret; - framepos_t closest = max_frames; + framepos_t closest = max_framepos; bool end_iter = false; @@ -2046,7 +2044,7 @@ Playlist::find_next_region_boundary (framepos_t frame, int dir) { RegionLock rlock (this); - framepos_t closest = max_frames; + framepos_t closest = max_framepos; framepos_t ret = -1; if (dir > 0) { @@ -2320,7 +2318,7 @@ Playlist::get_extent () const pair Playlist::_get_extent () const { - pair ext (max_frames, 0); + pair ext (max_framepos, 0); for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) { pair const e ((*i)->position(), (*i)->position() + (*i)->length()); @@ -2670,8 +2668,8 @@ Playlist::nudge_after (framepos_t start, framecnt_t distance, bool forwards) if (forwards) { - if ((*i)->last_frame() > max_frames - distance) { - new_pos = max_frames - (*i)->length(); + if ((*i)->last_frame() > max_framepos - distance) { + new_pos = max_framepos - (*i)->length(); } else { new_pos = (*i)->position() + distance; } diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 9a54139d09..13576ff11a 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -452,7 +452,7 @@ Region::set_length (framecnt_t len, void */*src*/) length impossible. */ - if (max_frames - len < _position) { + if (max_framepos - len < _position) { return; } @@ -602,9 +602,9 @@ Region::set_position_internal (framepos_t pos, bool allow_bbt_recompute) XXX is this the right thing to do? */ - if (max_frames - _length < _position) { + if (max_framepos - _length < _position) { _last_length = _length; - _length = max_frames - _position; + _length = max_framepos - _position; } if (allow_bbt_recompute) { @@ -667,8 +667,8 @@ Region::nudge_position (frameoffset_t n, void* /*src*/) _last_position = _position; if (n > 0) { - if (_position > max_frames - n) { - _position = max_frames; + if (_position > max_framepos - n) { + _position = max_framepos; } else { _position += n; } @@ -735,8 +735,8 @@ Region::trim_start (framepos_t new_position, void */*src*/) if (start_shift > 0) { - if (_start > max_frames - start_shift) { - new_start = max_frames; + if (_start > max_framepos - start_shift) { + new_start = max_framepos; } else { new_start = _start + start_shift; } @@ -895,8 +895,8 @@ Region::trim_to_internal (framepos_t position, framecnt_t length, void */*src*/) if (start_shift > 0) { - if (_start > max_frames - start_shift) { - new_start = max_frames; + if (_start > max_framepos - start_shift) { + new_start = max_framepos; } else { new_start = _start + start_shift; } @@ -1077,7 +1077,7 @@ Region::adjust_to_sync (framepos_t pos) const pos = 0; } } else { - if (max_frames - pos > offset) { + if (max_framepos - pos > offset) { pos += offset; } } diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index a8b0d436d6..d8e862573f 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -17,7 +17,6 @@ */ -#define __STDC_FORMAT_MACROS #include #include "pbd/error.h" diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc index 9dbdad33d4..629216da39 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -17,7 +17,6 @@ */ -#define __STDC_FORMAT_MACROS #include #include diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index f68da4adb2..682bb541f5 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -17,7 +17,6 @@ */ -#define __STDC_LIMIT_MACROS #include #include @@ -2491,11 +2490,11 @@ Session::update_session_range_location_marker () return; } - pair const ext = get_extent (); + pair const ext = get_extent (); if (_session_range_location == 0) { /* we don't have a session range yet; use this one (provided it is valid) */ - if (ext.first != max_frames) { + if (ext.first != max_framepos) { add_session_range_location (ext.first, ext.second); } } else { @@ -2514,12 +2513,12 @@ Session::update_session_range_location_marker () } /** @return Extent of the session's contents; if the session is empty, the first value of - * the pair will equal max_frames. + * the pair will equal max_framepos. */ -pair +pair Session::get_extent () const { - pair ext (max_frames, 0); + pair ext (max_framepos, 0); boost::shared_ptr rl = routes.reader (); for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { @@ -3189,7 +3188,7 @@ Session::graph_reordered () } } -nframes_t +framecnt_t Session::available_capture_duration () { float sample_bytes_on_disk = 4.0; // keep gcc happy @@ -3217,11 +3216,11 @@ Session::available_capture_duration () double scale = 4096.0 / sample_bytes_on_disk; - if (_total_free_4k_blocks * scale > (double) max_frames) { - return max_frames; + if (_total_free_4k_blocks * scale > (double) max_framecnt) { + return max_framecnt; } - - return (nframes_t) floor (_total_free_4k_blocks * scale); + + return (framecnt_t) floor (_total_free_4k_blocks * scale); } void @@ -3974,13 +3973,13 @@ Session::goto_start () } } -nframes_t +framepos_t Session::current_start_frame () const { return _session_range_location ? _session_range_location->start() : 0; } -nframes_t +framepos_t Session::current_end_frame () const { return _session_range_location ? _session_range_location->end() : 0; diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 2ce3310f47..c5efb1f3f8 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -270,7 +270,7 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc) return; } - nframes_t target_frame; + framepos_t target_frame; Timecode::Time timecode; timecode.hours = mmc_tc[0] & 0xf; @@ -283,8 +283,8 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc) // Also takes timecode offset into account: timecode_to_sample( timecode, target_frame, true /* use_offset */, false /* use_subframes */ ); - if (target_frame > max_frames) { - target_frame = max_frames; + if (target_frame > max_framepos) { + target_frame = max_framepos; } /* Some (all?) MTC/MMC devices do not send a full MTC frame diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 596f656fbc..342ae5c8a8 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -233,11 +233,11 @@ Session::get_track_statistics () void Session::process_with_events (nframes_t nframes) { - SessionEvent* ev; + SessionEvent* ev; nframes_t this_nframes; - nframes_t end_frame; + framepos_t end_frame; bool session_needs_butler = false; - nframes_t stop_limit; + framepos_t stop_limit; framecnt_t frames_moved; /* make sure the auditioner is silent */ @@ -316,13 +316,13 @@ Session::process_with_events (nframes_t nframes) } if (actively_recording()) { - stop_limit = max_frames; + stop_limit = max_framepos; } else { if (Config->get_stop_at_session_end()) { stop_limit = current_end_frame(); } else { - stop_limit = max_frames; + stop_limit = max_framepos; } } @@ -722,16 +722,16 @@ Session::follow_slave_silently (nframes_t nframes, float slave_speed) } else { increment_transport_position (frames_moved); } - - nframes_t stop_limit; + + framepos_t stop_limit; if (actively_recording()) { - stop_limit = max_frames; + stop_limit = max_framepos; } else { if (Config->get_stop_at_session_end()) { stop_limit = current_end_frame(); } else { - stop_limit = max_frames; + stop_limit = max_framepos; } } @@ -743,7 +743,7 @@ void Session::process_without_events (nframes_t nframes) { bool session_needs_butler = false; - nframes_t stop_limit; + framepos_t stop_limit; framecnt_t frames_moved; if (!process_can_proceed()) { @@ -767,12 +767,12 @@ Session::process_without_events (nframes_t nframes) } if (actively_recording()) { - stop_limit = max_frames; + stop_limit = max_framepos; } else { if (Config->get_stop_at_session_end()) { stop_limit = current_end_frame(); } else { - stop_limit = max_frames; + stop_limit = max_framepos; } } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 9290f673cf..097fd2a116 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1100,7 +1100,7 @@ Session::state(bool full_state) // with the default start and end, and get the state for that. Locations loc (*this); Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange); - range->set (max_frames, 0); + range->set (max_framepos, 0); loc.add (range); node->add_child_nocopy (loc.get_state()); } @@ -1877,7 +1877,7 @@ Session::load_sources (const XMLNode& node) } } catch (MissingSource& err) { warning << _("A sound file is missing. It will be replaced by silence.") << endmsg; - source = SourceFactory::createSilent (*this, **niter, max_frames, _current_frame_rate); + source = SourceFactory::createSilent (*this, **niter, max_framecnt, _current_frame_rate); } } diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index 7fb5b677ea..f7511b398d 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -205,7 +205,7 @@ Session::set_timecode_offset_negative (bool neg) } void -Session::timecode_to_sample( Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes ) const +Session::timecode_to_sample( Timecode::Time& timecode, framepos_t& sample, bool use_offset, bool use_subframes ) const { if (timecode.drop) { @@ -297,9 +297,9 @@ Session::timecode_to_sample( Timecode::Time& timecode, nframes_t& sample, bool u void -Session::sample_to_timecode( nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes ) const +Session::sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes ) const { - nframes_t offset_sample; + framepos_t offset_sample; if (!use_offset) { offset_sample = sample; @@ -430,7 +430,7 @@ Session::timecode_duration (nframes_t when, Timecode::Time& timecode) const } void -Session::timecode_duration_string (char* buf, nframes_t when) const +Session::timecode_duration_string (char* buf, framepos_t when) const { Timecode::Time timecode; diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 1cc8edd708..a183d26b84 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -487,7 +487,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, framecnt_t cnt) } int -SndFileSource::update_header (sframes_t when, struct tm& now, time_t tnow) +SndFileSource::update_header (framepos_t when, struct tm& now, time_t tnow) { set_timeline_position (when); @@ -818,7 +818,7 @@ SndFileSource::setup_standard_crossfades (Session const & s, nframes_t rate) } void -SndFileSource::set_timeline_position (int64_t pos) +SndFileSource::set_timeline_position (framepos_t pos) { // destructive track timeline postion does not change // except at instantion or when header_position_offset diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 357dbbadf8..d09bf05c6e 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -121,7 +121,7 @@ SourceFactory::setup_peakfile (boost::shared_ptr s, bool async) } boost::shared_ptr -SourceFactory::createSilent (Session& s, const XMLNode& node, nframes_t nframes, float sr) +SourceFactory::createSilent (Session& s, const XMLNode& node, framecnt_t nframes, float sr) { Source* src = new SilentFileSource (s, node, nframes, sr); // boost_debug_shared_ptr_mark_interesting (src, "Source"); diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 2e7290b77a..ff1f6f78ed 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -480,9 +480,9 @@ Track::set_pending_overwrite (bool o) } int -Track::seek (nframes_t s, bool complete_refill) +Track::seek (framepos_t p, bool complete_refill) { - return _diskstream->seek (s, complete_refill); + return _diskstream->seek (p, complete_refill); } bool @@ -492,15 +492,15 @@ Track::hidden () const } int -Track::can_internal_playback_seek (nframes_t d) +Track::can_internal_playback_seek (framepos_t p) { - return _diskstream->can_internal_playback_seek (d); + return _diskstream->can_internal_playback_seek (p); } int -Track::internal_playback_seek (nframes_t d) +Track::internal_playback_seek (framepos_t p) { - return _diskstream->internal_playback_seek (d); + return _diskstream->internal_playback_seek (p); } void @@ -510,7 +510,7 @@ Track::non_realtime_input_change () } void -Track::non_realtime_locate (nframes_t p) +Track::non_realtime_locate (framepos_t p) { _diskstream->non_realtime_locate (p); } @@ -527,7 +527,7 @@ Track::overwrite_existing_buffers () return _diskstream->overwrite_existing_buffers (); } -nframes_t +framecnt_t Track::get_captured_frames (uint32_t n) { return _diskstream->get_captured_frames (n); @@ -540,9 +540,9 @@ Track::set_loop (Location* l) } void -Track::transport_looped (nframes_t f) +Track::transport_looped (framepos_t p) { - _diskstream->transport_looped (f); + _diskstream->transport_looped (p); } bool @@ -587,7 +587,7 @@ Track::n_channels () return _diskstream->n_channels (); } -nframes_t +framepos_t Track::get_capture_start_frame (uint32_t n) { return _diskstream->get_capture_start_frame (n); @@ -599,13 +599,13 @@ Track::alignment_style () const return _diskstream->alignment_style (); } -nframes_t +framepos_t Track::current_capture_start () const { return _diskstream->current_capture_start (); } -nframes_t +framepos_t Track::current_capture_end () const { return _diskstream->current_capture_end (); diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 2bea3b529c..3d00b6283f 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -285,13 +285,13 @@ BasicUI::timecode_time (nframes_t where, Timecode::Time& timecode) } void -BasicUI::timecode_to_sample (Timecode::Time& timecode, nframes_t& sample, bool use_offset, bool use_subframes) const +BasicUI::timecode_to_sample (Timecode::Time& timecode, int64_t& sample, bool use_offset, bool use_subframes) const { session->timecode_to_sample (*((Timecode::Time*)&timecode), sample, use_offset, use_subframes); } void -BasicUI::sample_to_timecode (nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const +BasicUI::sample_to_timecode (int64_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const { session->sample_to_timecode (sample, *((Timecode::Time*)&timecode), use_offset, use_subframes); } diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h index f1bfcaa87c..7e25ea8a90 100644 --- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h +++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h @@ -22,6 +22,8 @@ #define __ardour_basic_ui_h__ #include +#include + #include "pbd/signals.h" #include @@ -78,8 +80,8 @@ class BasicUI { jack_nframes_t timecode_frames_per_hour (); void timecode_time (jack_nframes_t where, Timecode::Time&); - void timecode_to_sample (Timecode::Time& timecode, jack_nframes_t& sample, bool use_offset, bool use_subframes) const; - void sample_to_timecode (jack_nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; + void timecode_to_sample (Timecode::Time& timecode, int64_t& sample, bool use_offset, bool use_subframes) const; + void sample_to_timecode (int64_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; protected: BasicUI (); diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 72827e9fc9..6dda801ad6 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -24,7 +24,6 @@ #include #include -#define __STDC_FORMAT_MACROS #include #include #include diff --git a/wscript b/wscript index 6241181f63..7a3a41a3b7 100644 --- a/wscript +++ b/wscript @@ -310,6 +310,10 @@ def set_compiler_flags (conf,opt): conf.env.append_value('CCFLAGS', [ '-D_FILE_OFFSET_BITS=64', '-D_FILE_OFFSET_BITS=64' ]) conf.env.append_value('CXXFLAGS', [ '-D_LARGEFILE64_SOURCE', '-D_LARGEFILE_SOURCE' ]) conf.env.append_value('CXXFLAGS', [ '-D_FILE_OFFSET_BITS=64', '-D_FILE_OFFSET_BITS=64' ]) + + conf.env.append_value('CXXFLAGS', [ '-D__STDC_LIMIT_MACROS', '-D__STDC_LIMIT_MACROS' ]) + conf.env.append_value('CXXFLAGS', [ '-D__STDC_FORMAT_MACROS', '-D__STDC_FORMAT_MACROS' ]) + if opt.nls: conf.env.append_value('CXXFLAGS', '-DENABLE_NLS') conf.env.append_value('CCFLAGS', '-DENABLE_NLS')