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
This commit is contained in:
Paul Davis 2010-09-17 16:24:22 +00:00
parent e84c3fe555
commit 10bdce85a0
63 changed files with 384 additions and 347 deletions

View file

@ -1007,11 +1007,11 @@ ARDOUR_UI::update_disk_space()
return; return;
} }
nframes_t frames = _session->available_capture_duration(); framecnt_t frames = _session->available_capture_duration();
char buf[64]; char buf[64];
nframes_t fr = _session->frame_rate(); nframes_t fr = _session->frame_rate();
if (frames == max_frames) { if (frames == max_framecnt) {
strcpy (buf, _("Disk: 24hrs+")); strcpy (buf, _("Disk: 24hrs+"));
} else { } else {
rec_enabled_streams = 0; rec_enabled_streams = 0;

View file

@ -1493,7 +1493,7 @@ AudioClock::timecode_frame_from_display () const
} }
Timecode::Time timecode; Timecode::Time timecode;
nframes_t sample; framepos_t sample;
timecode.hours = atoi (hours_label.get_text()); timecode.hours = atoi (hours_label.get_text());
timecode.minutes = atoi (minutes_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.) // Testcode for timecode<->sample conversions (P.S.)
Timecode::Time timecode1; Timecode::Time timecode1;
nframes_t sample1; framepos_t sample1;
nframes_t oldsample = 0; framepos_t oldsample = 0;
Timecode::Time timecode2; 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 #ifdef Timecode_SAMPLE_TEST_1
// Test 1: use_offset = false, use_subframes = false // Test 1: use_offset = false, use_subframes = false

View file

@ -65,7 +65,7 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv
, alist (al) , alist (al)
, _parent_group (parent) , _parent_group (parent)
, _time_converter (converter ? (*converter) : default_converter) , _time_converter (converter ? (*converter) : default_converter)
, _maximum_time (max_frames) , _maximum_time (max_framepos)
{ {
points_visible = false; points_visible = false;
update_pending = false; update_pending = false;
@ -565,13 +565,13 @@ AutomationLine::string_to_fraction (string const & s) const
bool bool
AutomationLine::invalid_point (ALPoints& p, uint32_t index) 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 void
AutomationLine::invalidate_point (ALPoints& p, uint32_t index) AutomationLine::invalidate_point (ALPoints& p, uint32_t index)
{ {
p[index].x = max_frames; p[index].x = max_framepos;
p[index].y = DBL_MAX; p[index].y = DBL_MAX;
} }
@ -1343,7 +1343,7 @@ AutomationLine::set_maximum_time (framepos_t t)
pair<framepos_t, framepos_t> pair<framepos_t, framepos_t>
AutomationLine::get_point_x_range () const AutomationLine::get_point_x_range () const
{ {
pair<framepos_t, framepos_t> r (max_frames, 0); pair<framepos_t, framepos_t> r (max_framepos, 0);
for (AutomationList::const_iterator i = the_list()->begin(); i != the_list()->end(); ++i) { 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 ()); r.first = min (r.first, _time_converter.to ((*i)->when) + _time_converter.origin_b ());

View file

@ -904,8 +904,8 @@ Editor::control_scroll (float fraction)
if ((fraction < 0.0f) && (*_control_scroll_target < (nframes64_t) fabs(step))) { if ((fraction < 0.0f) && (*_control_scroll_target < (nframes64_t) fabs(step))) {
*_control_scroll_target = 0; *_control_scroll_target = 0;
} else if ((fraction > 0.0f) && (max_frames - *_control_scroll_target < step)) { } else if ((fraction > 0.0f) && (max_framepos - *_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 *_control_scroll_target = max_framepos - (current_page_frames()*2); // allow room for slop in where the PH is on the screen
} else { } else {
*_control_scroll_target += (nframes64_t) floor (step); *_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); _session->locations()->marks_either_side (start, before, after);
if (before == max_frames) { if (before == max_framepos) {
start = after; start = after;
} else if (after == max_frames) { } else if (after == max_framepos) {
start = before; start = before;
} else if (before != max_frames && after != max_frames) { } else if (before != max_framepos && after != max_framepos) {
/* have before and after */ /* have before and after */
if ((start - before) < (after - start)) { if ((start - before) < (after - start)) {
start = before; start = before;
@ -4506,7 +4506,7 @@ Editor::set_frames_per_unit (double fpu)
of frames into an 800 pixel wide space. of frames into an 800 pixel wide space.
*/ */
if (max_frames / fpu < 800.0) { if (max_framepos / fpu < 800.0) {
return; return;
} }
@ -4804,7 +4804,7 @@ Editor::get_regions_after (RegionSelection& rs, nframes64_t where, const TrackVi
if ((tr = rtv->track()) && ((pl = tr->playlist()))) { if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
Playlist::RegionList* regions = pl->regions_touched ( 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) { for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {

View file

@ -554,7 +554,7 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert)
} }
if (_drags->current_pointer_frame() > rightmost_frame && allow_horiz) { if (_drags->current_pointer_frame() > rightmost_frame && allow_horiz) {
if (rightmost_frame < max_frames) { if (rightmost_frame < max_framepos) {
autoscroll_x = 1; autoscroll_x = 1;
startit = true; startit = true;
} }
@ -586,8 +586,8 @@ Editor::_autoscroll_canvas (void *arg)
bool bool
Editor::autoscroll_canvas () Editor::autoscroll_canvas ()
{ {
nframes64_t new_frame; framepos_t new_frame;
nframes64_t limit = max_frames - current_page_frames(); framepos_t limit = max_framepos - current_page_frames();
GdkEventMotion ev; GdkEventMotion ev;
double new_pixel; double new_pixel;
double target_pixel; double target_pixel;

View file

@ -127,10 +127,10 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
case GDK_SCROLL_RIGHT: case GDK_SCROLL_RIGHT:
xdelta = (current_page_frames() / 8); xdelta = (current_page_frames() / 8);
if (max_frames - xdelta > leftmost_frame) { if (max_framepos - xdelta > leftmost_frame) {
reset_x_origin (leftmost_frame + xdelta); reset_x_origin (leftmost_frame + xdelta);
} else { } else {
reset_x_origin (max_frames - current_page_frames()); reset_x_origin (max_framepos - current_page_frames());
} }
break; break;

View file

@ -452,7 +452,7 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, framepos_t* pending_r
*pending_region_position = _last_frame_position; *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; *pending_region_position = _last_frame_position;
} }
@ -2307,7 +2307,7 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
e = max (_marker->position(), e); e = max (_marker->position(), e);
s = min (s, e); s = min (s, e);
e = max (s, e); e = max (s, e);
if (e < max_frames) { if (e < max_framepos) {
++e; ++e;
} }
_editor->session()->locations()->find_all_between (s, e, ll, Location::Flags (0)); _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); _editor->session()->locations()->marks_either_side (grab_frame(), start, end);
if (end == max_frames) { if (end == max_framepos) {
end = _editor->session()->current_end_frame (); end = _editor->session()->current_end_frame ();
} }
if (start == max_frames) { if (start == max_framepos) {
start = _editor->session()->current_start_frame (); start = _editor->session()->current_start_frame ();
} }

View file

@ -870,7 +870,7 @@ Editor::marker_menu_range_to_next ()
nframes64_t end; nframes64_t end;
_session->locations()->marks_either_side (marker->position(), start, end); _session->locations()->marks_either_side (marker->position(), start, end);
if (end != max_frames) { if (end != max_framepos) {
string range_name = l->name(); string range_name = l->name();
range_name += "-range"; range_name += "-range";

View file

@ -351,20 +351,20 @@ Editor::nudge_forward (bool next, bool force_playhead)
if (next) { if (next) {
distance = next_distance; 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); loc->set_start (loc->start() + distance);
} else { } else {
loc->set_start (max_frames - loc->length()); loc->set_start (max_framepos - loc->length());
} }
} else { } else {
distance = get_nudge_distance (loc->end(), next_distance); distance = get_nudge_distance (loc->end(), next_distance);
if (next) { if (next) {
distance = next_distance; distance = next_distance;
} }
if (max_frames - distance > loc->end()) { if (max_framepos - distance > loc->end()) {
loc->set_end (loc->end() + distance); loc->set_end (loc->end() + distance);
} else { } else {
loc->set_end (max_frames); loc->set_end (max_framepos);
} }
} }
XMLNode& after (loc->get_state()); XMLNode& after (loc->get_state());
@ -597,7 +597,7 @@ Editor::build_region_boundary_cache ()
while (pos < _session->current_end_frame() && !at_end) { while (pos < _session->current_end_frame() && !at_end) {
framepos_t rpos; framepos_t rpos;
framepos_t lpos = max_frames; framepos_t lpos = max_framepos;
for (vector<RegionPoint>::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) { for (vector<RegionPoint>::iterator p = interesting_points.begin(); p != interesting_points.end(); ++p) {
@ -670,7 +670,7 @@ boost::shared_ptr<Region>
Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack) Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, TrackViewList& tracks, TimeAxisView **ontrack)
{ {
TrackViewList::iterator i; TrackViewList::iterator i;
nframes64_t closest = max_frames; framepos_t closest = max_framepos;
boost::shared_ptr<Region> ret; boost::shared_ptr<Region> ret;
framepos_t rpos = 0; framepos_t rpos = 0;
@ -732,7 +732,7 @@ Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, Trac
framepos_t framepos_t
Editor::find_next_region_boundary (framepos_t pos, int32_t dir, const TrackViewList& tracks) 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; framepos_t current_nearest = -1;
for (TrackViewList::const_iterator i = tracks.begin(); i != tracks.end(); ++i) { for (TrackViewList::const_iterator i = tracks.begin(); i != tracks.end(); ++i) {
@ -1183,18 +1183,18 @@ Editor::selected_marker_to_selection_end ()
void void
Editor::scroll_playhead (bool forward) Editor::scroll_playhead (bool forward)
{ {
nframes64_t pos = playhead_cursor->current_frame; framepos_t pos = playhead_cursor->current_frame;
nframes64_t delta = (nframes64_t) floor (current_page_frames() / 0.8); framecnt_t delta = (framecnt_t) floor (current_page_frames() / 0.8);
if (forward) { if (forward) {
if (pos == max_frames) { if (pos == max_framepos) {
return; return;
} }
if (pos < max_frames - delta) { if (pos < max_framepos - delta) {
pos += delta ; pos += delta ;
} else { } else {
pos = max_frames; pos = max_framepos;
} }
} else { } else {
@ -1428,8 +1428,8 @@ Editor::scroll_forward (float pages)
} }
} }
if (max_frames - cnt < leftmost_frame) { if (max_framepos - cnt < leftmost_frame) {
frame = max_frames - cnt; frame = max_framepos - cnt;
} else { } else {
frame = leftmost_frame + cnt; frame = leftmost_frame + cnt;
} }
@ -1584,8 +1584,8 @@ Editor::temporal_zoom (gdouble fpu)
if (l < 0) { if (l < 0) {
leftmost_after_zoom = 0; leftmost_after_zoom = 0;
} else if (l > max_frames) { } else if (l > max_framepos) {
leftmost_after_zoom = max_frames - new_page_size; leftmost_after_zoom = max_framepos - new_page_size;
} else { } else {
leftmost_after_zoom = (nframes64_t) l; leftmost_after_zoom = (nframes64_t) l;
} }
@ -1610,8 +1610,8 @@ Editor::temporal_zoom (gdouble fpu)
if (l < 0) { if (l < 0) {
leftmost_after_zoom = 0; leftmost_after_zoom = 0;
} else if (l > max_frames) { } else if (l > max_framepos) {
leftmost_after_zoom = max_frames - new_page_size; leftmost_after_zoom = max_framepos - new_page_size;
} else { } else {
leftmost_after_zoom = (nframes64_t) l; leftmost_after_zoom = (nframes64_t) l;
} }
@ -1629,8 +1629,8 @@ Editor::temporal_zoom (gdouble fpu)
if (l < 0) { if (l < 0) {
leftmost_after_zoom = 0; leftmost_after_zoom = 0;
} else if (l > max_frames) { } else if (l > max_framepos) {
leftmost_after_zoom = max_frames - new_page_size; leftmost_after_zoom = max_framepos - new_page_size;
} else { } else {
leftmost_after_zoom = (nframes64_t) l; leftmost_after_zoom = (nframes64_t) l;
} }
@ -1651,9 +1651,8 @@ Editor::temporal_zoom (gdouble fpu)
void void
Editor::temporal_zoom_region (bool both_axes) Editor::temporal_zoom_region (bool both_axes)
{ {
framepos_t start = max_framepos;
nframes64_t start = max_frames; framepos_t end = 0;
nframes64_t end = 0;
RegionSelection rs; RegionSelection rs;
set<TimeAxisView*> tracks; set<TimeAxisView*> tracks;
@ -1701,10 +1700,10 @@ Editor::temporal_zoom_region (bool both_axes)
start = 0; start = 0;
} }
if (max_frames - extra_samples > end) { if (max_framepos - extra_samples > end) {
end += extra_samples; end += extra_samples;
} else { } else {
end = max_frames; end = max_framepos;
} }
if (both_axes) { if (both_axes) {
@ -2566,8 +2565,8 @@ Editor::play_edit_range ()
void void
Editor::play_selected_region () Editor::play_selected_region ()
{ {
nframes64_t start = max_frames; framepos_t start = max_framepos;
nframes64_t end = 0; framepos_t end = 0;
RegionSelection rs; RegionSelection rs;
get_regions_for_action (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()); 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; the_end = the_start + region->length() - 1;
} else { } else {
the_end = max_frames; the_end = max_framepos;
} }
the_end = min (end, the_end); the_end = min (end, the_end);
cnt = the_end - the_start + 1; cnt = the_end - the_start + 1;
@ -4091,7 +4090,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
vector<PlaylistMapping> pmap; vector<PlaylistMapping> pmap;
nframes64_t first_position = max_frames; framepos_t first_position = max_framepos;
typedef set<boost::shared_ptr<Playlist> > FreezeList; typedef set<boost::shared_ptr<Playlist> > FreezeList;
FreezeList 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(); position = get_preferred_edit_position();
} }
@ -5712,8 +5711,8 @@ Editor::set_loop_from_edit_range (bool play)
void void
Editor::set_loop_from_region (bool play) Editor::set_loop_from_region (bool play)
{ {
nframes64_t start = max_frames; framepos_t start = max_framepos;
nframes64_t end = 0; framepos_t end = 0;
RegionSelection rs; RegionSelection rs;
@ -5773,8 +5772,8 @@ Editor::set_punch_from_edit_range ()
void void
Editor::set_punch_from_region () Editor::set_punch_from_region ()
{ {
nframes64_t start = max_frames; framepos_t start = max_framepos;
nframes64_t end = 0; framepos_t end = 0;
RegionSelection rs; RegionSelection rs;
@ -6341,8 +6340,8 @@ void
Editor::playhead_forward_to_grid () Editor::playhead_forward_to_grid ()
{ {
if (!_session) return; if (!_session) return;
nframes64_t pos = playhead_cursor->current_frame; framepos_t pos = playhead_cursor->current_frame;
if (pos < max_frames - 1) { if (pos < max_framepos - 1) {
pos += 2; pos += 2;
snap_to_internal (pos, 1, false); snap_to_internal (pos, 1, false);
_session->request_locate (pos); _session->request_locate (pos);

View file

@ -195,10 +195,10 @@ Editor::ruler_scroll (GdkEventScroll* event)
case GDK_SCROLL_RIGHT: case GDK_SCROLL_RIGHT:
xdelta = (current_page_frames() / 2); xdelta = (current_page_frames() / 2);
if (max_frames - xdelta > leftmost_frame) { if (max_framepos - xdelta > leftmost_frame) {
reset_x_origin (leftmost_frame + xdelta); reset_x_origin (leftmost_frame + xdelta);
} else { } else {
reset_x_origin (max_frames - current_page_frames()); reset_x_origin (max_framepos - current_page_frames());
} }
handled = true; handled = true;
break; break;
@ -977,8 +977,8 @@ Editor::set_timecode_ruler_scale (gdouble lower, gdouble upper)
gint gint
Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/) Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upper*/, gint /*maxchars*/)
{ {
nframes_t pos; framepos_t pos;
nframes64_t spacer; framecnt_t spacer;
Timecode::Time timecode; Timecode::Time timecode;
gchar buf[16]; gchar buf[16];
gint n; gint n;
@ -987,7 +987,7 @@ Editor::metric_get_timecode (GtkCustomRulerMark **marks, gdouble lower, gdouble
return 0; 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; lower = lower - spacer;
} else { } else {
lower = 0; lower = 0;

View file

@ -586,14 +586,14 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op,
} else if (op == Selection::Extend) { } else if (op == Selection::Extend) {
list<Selectable*> results; list<Selectable*> results;
nframes64_t last_frame; framepos_t last_frame;
nframes64_t first_frame; framepos_t first_frame;
bool same_track = false; bool same_track = false;
/* 1. find the last selected regionview in the track that was clicked in */ /* 1. find the last selected regionview in the track that was clicked in */
last_frame = 0; last_frame = 0;
first_frame = max_frames; first_frame = max_framepos;
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) { for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
if (&(*x)->get_time_axis_view() == &clicked_regionview->get_time_axis_view()) { 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; 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) { switch (op) {
case Selection::Toggle: case Selection::Toggle:
@ -1015,7 +1015,7 @@ Editor::select_all (Selection::Operation op)
if ((*iter)->hidden()) { if ((*iter)->hidden()) {
continue; 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")); begin_reversible_command (_("select all"));
switch (op) { switch (op) {

View file

@ -26,7 +26,7 @@
struct MarkerSelection : public std::list<Marker*> struct MarkerSelection : public std::list<Marker*>
{ {
void range (nframes64_t& start, nframes64_t& end); void range (ARDOUR::framepos_t& start, ARDOUR::framepos_t& end);
}; };
#endif /* __ardour_gtk_marker_selection_h__ */ #endif /* __ardour_gtk_marker_selection_h__ */

View file

@ -57,7 +57,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group); canvas_rect = new ArdourCanvas::SimpleRect (*canvas_group);
canvas_rect->property_x1() = 0.0; canvas_rect->property_x1() = 0.0;
canvas_rect->property_y1() = 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_y2() = (double)20;
canvas_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerTrack.get(); canvas_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_MarkerTrack.get();
canvas_rect->property_fill_color_rgba() = stream_base_color; canvas_rect->property_fill_color_rgba() = stream_base_color;

View file

@ -2610,11 +2610,12 @@ MidiRegionView::nudge_notes (bool forward)
/* use grid */ /* use grid */
nframes64_t next_pos = ref_point; framepos_t next_pos = ref_point;
if (forward) { if (forward) {
/* XXX need check on max_frames, but that needs max_frames64 or something */ if (max_framepos - 1 < next_pos) {
next_pos += 1; next_pos += 1;
}
} else { } else {
if (next_pos == 0) { if (next_pos == 0) {
return; return;

View file

@ -75,7 +75,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv)
_note_lines->property_x1() = 0; _note_lines->property_x1() = 0;
_note_lines->property_y1() = 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->property_y2() = 0;
_note_lines->signal_event().connect(sigc::bind( _note_lines->signal_event().connect(sigc::bind(

View file

@ -174,7 +174,7 @@ RegionSelection::remove (RegionView* rv)
/* reset current start */ /* reset current start */
nframes_t ref = max_frames; framepos_t ref = max_framepos;
for (RegionSelection::iterator i = begin (); i != end(); ++i) { for (RegionSelection::iterator i = begin (); i != end(); ++i) {
if (region->first_frame() < ref) { if (region->first_frame() < ref) {

View file

@ -18,7 +18,6 @@
*/ */
#include <algorithm> #include <algorithm>
#define __STDC_FORMAT_MACROS
#include <inttypes.h> #include <inttypes.h>
#include <glibmm/thread.h> #include <glibmm/thread.h>

View file

@ -1004,9 +1004,9 @@ Selection::add (const list<Marker*>& m)
} }
void 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; e = 0;
for (MarkerSelection::iterator i = begin(); i != end(); ++i) { for (MarkerSelection::iterator i = begin(); i != end(); ++i) {

View file

@ -488,9 +488,9 @@ StripSilenceDialog::update_stats (const SilenceResult& res)
} }
max_silence = 0; max_silence = 0;
min_silence = max_frames; min_silence = max_framepos;
max_audible = 0; max_audible = 0;
min_audible = max_frames; min_audible = max_framepos;
SilenceResult::const_iterator cur; SilenceResult::const_iterator cur;

View file

@ -146,7 +146,7 @@ TimeAxisViewItem::init (
name_connected = false; name_connected = false;
fill_opacity = 60; fill_opacity = 60;
position_locked = false; position_locked = false;
max_item_duration = ARDOUR::max_frames; max_item_duration = ARDOUR::max_framepos;
min_item_duration = 0; min_item_duration = 0;
show_vestigial = true; show_vestigial = true;
visibility = vis; visibility = vis;

View file

@ -68,14 +68,14 @@ TimeSelection::consolidate ()
return changed; return changed;
} }
nframes_t framepos_t
TimeSelection::start () TimeSelection::start ()
{ {
if (empty()) { if (empty()) {
return 0; return 0;
} }
nframes_t first = max_frames; framepos_t first = max_framepos;
for (std::list<AudioRange>::iterator i = begin(); i != end(); ++i) { for (std::list<AudioRange>::iterator i = begin(); i != end(); ++i) {
if ((*i).start < first) { if ((*i).start < first) {
@ -85,10 +85,10 @@ TimeSelection::start ()
return first; return first;
} }
nframes_t framepos_t
TimeSelection::end_frame () TimeSelection::end_frame ()
{ {
nframes_t last = 0; framepos_t last = 0;
/* XXX make this work like RegionSelection: no linear search needed */ /* XXX make this work like RegionSelection: no linear search needed */
@ -100,7 +100,7 @@ TimeSelection::end_frame ()
return last; return last;
} }
nframes_t framecnt_t
TimeSelection::length() TimeSelection::length()
{ {
return end_frame() - start() + 1; return end_frame() - start() + 1;

View file

@ -32,9 +32,9 @@ class TimeSelection : public std::list<ARDOUR::AudioRange>
public: public:
ARDOUR::AudioRange& operator[](uint32_t); ARDOUR::AudioRange& operator[](uint32_t);
nframes_t start(); ARDOUR::framepos_t start();
nframes_t end_frame(); ARDOUR::framepos_t end_frame();
nframes_t length(); ARDOUR::framepos_t length();
bool consolidate (); bool consolidate ();
}; };

View file

@ -46,7 +46,6 @@ namespace ARDOUR {
class AudioEngine; class AudioEngine;
static const nframes_t max_frames = JACK_MAX_FRAMES;
extern PBD::Signal1<void,std::string> BootMessage; extern PBD::Signal1<void,std::string> BootMessage;
int init (bool with_vst, bool try_optimization); int init (bool with_vst, bool try_optimization);

View file

@ -162,22 +162,22 @@ class AudioDiskstream : public Diskstream
void set_pending_overwrite(bool); void set_pending_overwrite(bool);
int overwrite_existing_buffers (); int overwrite_existing_buffers ();
void set_block_size (nframes_t); void set_block_size (nframes_t);
int internal_playback_seek (nframes_t distance); int internal_playback_seek (framecnt_t distance);
int can_internal_playback_seek (nframes_t distance); int can_internal_playback_seek (framecnt_t distance);
int rename_write_sources (); int rename_write_sources ();
std::list<boost::shared_ptr<Source> > steal_write_sources(); std::list<boost::shared_ptr<Source> > steal_write_sources();
void reset_write_sources (bool, bool force = false); void reset_write_sources (bool, bool force = false);
void non_realtime_input_change (); void non_realtime_input_change ();
void non_realtime_locate (nframes_t location); void non_realtime_locate (framepos_t location);
protected: protected:
friend class Auditioner; friend class Auditioner;
int seek (nframes_t which_sample, bool complete_refill = false); int seek (framepos_t which_sample, bool complete_refill = false);
protected: protected:
friend class AudioTrack; 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); bool commit (nframes_t nframes);
private: private:
@ -233,12 +233,12 @@ class AudioDiskstream : public Diskstream
int do_refill_with_alloc (); int do_refill_with_alloc ();
int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
nframes_t& start, nframes_t cnt, framepos_t& start, nframes_t cnt,
ChannelInfo* channel_info, int channel, bool reversed); ChannelInfo* channel_info, int channel, bool reversed);
void finish_capture (bool rec_monitors_input, boost::shared_ptr<ChannelList>); void finish_capture (bool rec_monitors_input, boost::shared_ptr<ChannelList>);
void transport_stopped_wallclock (struct tm&, time_t, bool abort); 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 (); void init ();
@ -254,7 +254,7 @@ class AudioDiskstream : public Diskstream
int use_pending_capture_data (XMLNode& node); int use_pending_capture_data (XMLNode& node);
void get_input_sources (); 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 set_align_style_from_io();
void setup_destructive_playlist (); void setup_destructive_playlist ();
void use_destructive_playlist (); void use_destructive_playlist ();

View file

@ -64,7 +64,7 @@ public:
virtual void clear_capture_marks() {} virtual void clear_capture_marks() {}
virtual bool one_of_several_channels () const { return false; } 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; virtual int flush_header () = 0;
void mark_streaming_write_completed (); void mark_streaming_write_completed ();

View file

@ -37,7 +37,7 @@ class CoreAudioSource : public AudioFileSource {
void set_path (const std::string& p); void set_path (const std::string& p);
float sample_rate() const; 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;}; int flush_header () {return 0;};
void set_header_timeline_position () {}; void set_header_timeline_position () {};

View file

@ -101,7 +101,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
virtual void punch_out() {} virtual void punch_out() {}
void non_realtime_set_speed (); 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 (); virtual void playlist_modified ();
boost::shared_ptr<Playlist> playlist () { return _playlist; } boost::shared_ptr<Playlist> playlist () { return _playlist; }
@ -110,10 +110,10 @@ class Diskstream : public SessionObject, public PublicDiskstream
virtual int use_new_playlist () = 0; virtual int use_new_playlist () = 0;
virtual int use_copy_playlist () = 0; virtual int use_copy_playlist () = 0;
nframes_t current_capture_start() const { return capture_start_frame; } framepos_t current_capture_start() const { return capture_start_frame; }
nframes_t current_capture_end() const { return capture_start_frame + capture_captured; } framepos_t current_capture_end() const { return capture_start_frame + capture_captured; }
nframes_t get_capture_start_frame (uint32_t n=0); framepos_t get_capture_start_frame (uint32_t n=0);
nframes_t get_captured_frames (uint32_t n=0); framecnt_t get_captured_frames (uint32_t n=0);
ChanCount n_channels() { return _n_channels; } ChanCount n_channels() { return _n_channels; }
@ -169,8 +169,8 @@ class Diskstream : public SessionObject, public PublicDiskstream
virtual void set_pending_overwrite (bool) = 0; virtual void set_pending_overwrite (bool) = 0;
virtual int overwrite_existing_buffers () = 0; virtual int overwrite_existing_buffers () = 0;
virtual int internal_playback_seek (nframes_t distance) = 0; virtual int internal_playback_seek (framecnt_t distance) = 0;
virtual int can_internal_playback_seek (nframes_t distance) = 0; virtual int can_internal_playback_seek (framecnt_t distance) = 0;
virtual int rename_write_sources () = 0; virtual int rename_write_sources () = 0;
virtual void reset_write_sources (bool, bool force = false) = 0; virtual void reset_write_sources (bool, bool force = false) = 0;
virtual void non_realtime_input_change () = 0; virtual void non_realtime_input_change () = 0;
@ -180,12 +180,12 @@ class Diskstream : public SessionObject, public PublicDiskstream
protected: protected:
friend class Auditioner; 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: protected:
friend class Track; 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; virtual bool commit (nframes_t nframes) = 0;
//private: //private:
@ -197,7 +197,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
struct CaptureTransition { struct CaptureTransition {
TransitionType type; 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 */ /* The two central butler operations */
@ -211,11 +211,11 @@ class Diskstream : public SessionObject, public PublicDiskstream
virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool); virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool);
virtual void transport_stopped_wallclock (struct tm&, time_t, bool abort) = 0; 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 { struct CaptureInfo {
uint32_t start; framepos_t start;
uint32_t frames; framecnt_t frames;
}; };
virtual int use_new_write_source (uint32_t n=0) = 0; 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 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 check_record_status (framepos_t transport_frame, nframes_t nframes, bool can_record);
virtual void prepare_record_status (nframes_t /*capture_start_frame*/) {} virtual void prepare_record_status (framepos_t /*capture_start_frame*/) {}
virtual void set_align_style_from_io() {} virtual void set_align_style_from_io() {}
virtual void setup_destructive_playlist () {} virtual void setup_destructive_playlist () {}
virtual void use_destructive_playlist () {} virtual void use_destructive_playlist () {}
virtual void prepare_to_stop (framepos_t pos); 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); nframes_t& rec_nframes, nframes_t& rec_offset);
static nframes_t disk_io_chunk_frames; static nframes_t disk_io_chunk_frames;
@ -260,20 +260,20 @@ class Diskstream : public SessionObject, public PublicDiskstream
bool _seek_required; bool _seek_required;
bool force_refill; bool force_refill;
nframes_t capture_start_frame; framepos_t capture_start_frame;
nframes_t capture_captured; framecnt_t capture_captured;
bool was_recording; bool was_recording;
nframes_t adjust_capture_position; nframes_t adjust_capture_position;
nframes_t _capture_offset; nframes_t _capture_offset;
nframes_t _roll_delay; nframes_t _roll_delay;
nframes_t first_recordable_frame; framepos_t first_recordable_frame;
nframes_t last_recordable_frame; framepos_t last_recordable_frame;
int last_possibly_recording; int last_possibly_recording;
AlignStyle _alignment_style; AlignStyle _alignment_style;
bool _scrubbing; bool _scrubbing;
bool _slaved; bool _slaved;
Location* loop_location; Location* loop_location;
nframes_t overwrite_frame; framepos_t overwrite_frame;
off_t overwrite_offset; off_t overwrite_offset;
bool _pending_overwrite; bool _pending_overwrite;
bool overwrite_queued; bool overwrite_queued;
@ -284,9 +284,9 @@ class Diskstream : public SessionObject, public PublicDiskstream
double _speed; double _speed;
double _target_speed; double _target_speed;
nframes_t file_frame; framepos_t file_frame;
nframes_t playback_sample; framepos_t playback_sample;
nframes_t playback_distance; framecnt_t playback_distance;
uint32_t _read_data_count; uint32_t _read_data_count;
uint32_t _write_data_count; uint32_t _write_data_count;
@ -297,7 +297,7 @@ class Diskstream : public SessionObject, public PublicDiskstream
Glib::Mutex state_lock; Glib::Mutex state_lock;
nframes_t scrub_start; framepos_t scrub_start;
nframes_t scrub_buffer_size; nframes_t scrub_buffer_size;
nframes_t scrub_offset; nframes_t scrub_offset;

View file

@ -62,7 +62,7 @@ class MidiDiskstream : public Diskstream
float playback_buffer_load() const; float playback_buffer_load() const;
float capture_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); void set_record_enabled (bool yn);
@ -119,23 +119,23 @@ class MidiDiskstream : public Diskstream
void set_pending_overwrite(bool); void set_pending_overwrite(bool);
int overwrite_existing_buffers (); int overwrite_existing_buffers ();
void set_block_size (nframes_t); void set_block_size (nframes_t);
int internal_playback_seek (nframes_t distance); int internal_playback_seek (framecnt_t distance);
int can_internal_playback_seek (nframes_t distance); int can_internal_playback_seek (framecnt_t distance);
int rename_write_sources (); int rename_write_sources ();
std::list<boost::shared_ptr<Source> > steal_write_sources(); std::list<boost::shared_ptr<Source> > steal_write_sources();
void reset_write_sources (bool, bool force = false); void reset_write_sources (bool, bool force = false);
void non_realtime_input_change (); 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; } static void set_readahead_frames(nframes_t frames_ahead) { midi_readahead = frames_ahead; }
protected: protected:
int seek (nframes_t which_sample, bool complete_refill = false); int seek (framepos_t which_sample, bool complete_refill = false);
protected: protected:
friend class MidiTrack; 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); bool commit (nframes_t nframes);
static nframes_t midi_readahead; static nframes_t midi_readahead;
@ -147,11 +147,11 @@ class MidiDiskstream : public Diskstream
int do_refill_with_alloc(); 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 finish_capture (bool rec_monitors_input);
void transport_stopped_wallclock (struct tm&, time_t, bool abort); 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 (); void init ();

View file

@ -35,6 +35,16 @@
class XMLNode; 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<void*> midi_data;
}
}
namespace ARDOUR { namespace ARDOUR {
class Route; class Route;
@ -48,6 +58,8 @@ template<typename T> class MidiRingBuffer;
class MidiRegion : public Region class MidiRegion : public Region
{ {
public: public:
static void make_property_quarks ();
~MidiRegion(); ~MidiRegion();
boost::shared_ptr<MidiRegion> clone (); boost::shared_ptr<MidiRegion> clone ();
@ -109,6 +121,8 @@ class MidiRegion : public Region
NoteMode mode = Sustained, NoteMode mode = Sustained,
MidiStateTracker* tracker = 0) const; MidiStateTracker* tracker = 0) const;
void register_properties ();
void recompute_at_start (); void recompute_at_start ();
void recompute_at_end (); void recompute_at_end ();
@ -117,10 +131,12 @@ class MidiRegion : public Region
void switch_source(boost::shared_ptr<Source> source); void switch_source(boost::shared_ptr<Source> source);
void model_changed (); void model_changed ();
void model_automation_state_changed (Evoral::Parameter const &); void model_automation_state_changed (Evoral::Parameter const &);
void model_contents_changed ();
std::set<Evoral::Parameter> _filtered_parameters; ///< parameters that we ask our source not to return when reading std::set<Evoral::Parameter> _filtered_parameters; ///< parameters that we ask our source not to return when reading
PBD::ScopedConnection _model_connection; PBD::ScopedConnection _model_connection;
PBD::ScopedConnection _source_connection; PBD::ScopedConnection _source_connection;
PBD::ScopedConnection _model_contents_connection;
}; };
} /* namespace ARDOUR */ } /* namespace ARDOUR */

View file

@ -46,17 +46,17 @@ public:
virtual uint32_t read_data_count() const = 0; virtual uint32_t read_data_count() const = 0;
virtual uint32_t write_data_count() const = 0; virtual uint32_t write_data_count() const = 0;
virtual void set_pending_overwrite (bool) = 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 bool hidden () const = 0;
virtual int can_internal_playback_seek (nframes_t) = 0; virtual int can_internal_playback_seek (framepos_t) = 0;
virtual int internal_playback_seek (nframes_t) = 0; virtual int internal_playback_seek (framepos_t) = 0;
virtual void non_realtime_input_change () = 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 void non_realtime_set_speed () = 0;
virtual int overwrite_existing_buffers () = 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 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 bool realtime_set_speed (double, bool) = 0;
virtual void transport_stopped_wallclock (struct tm &, time_t, bool) = 0; virtual void transport_stopped_wallclock (struct tm &, time_t, bool) = 0;
virtual bool pending_overwrite () const = 0; virtual bool pending_overwrite () const = 0;
@ -64,10 +64,10 @@ public:
virtual void prepare_to_stop (framepos_t) = 0; virtual void prepare_to_stop (framepos_t) = 0;
virtual void set_slaved (bool) = 0; virtual void set_slaved (bool) = 0;
virtual ChanCount n_channels () = 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 AlignStyle alignment_style () const = 0;
virtual nframes_t current_capture_start () const = 0; virtual framepos_t current_capture_start () const = 0;
virtual nframes_t current_capture_end () const = 0; virtual framepos_t current_capture_end () const = 0;
virtual void playlist_modified () = 0; virtual void playlist_modified () = 0;
virtual int use_playlist (boost::shared_ptr<Playlist>) = 0; virtual int use_playlist (boost::shared_ptr<Playlist>) = 0;
virtual void set_align_style (AlignStyle) = 0; virtual void set_align_style (AlignStyle) = 0;

View file

@ -311,9 +311,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
int wipe (); int wipe ();
std::pair<nframes_t, nframes_t> get_extent () const; std::pair<framepos_t, framepos_t> get_extent () const;
nframes_t current_end_frame () const; framepos_t current_end_frame () const;
nframes_t current_start_frame () const; framepos_t current_start_frame () const;
/// "actual" sample rate of session, set by current audioengine rate, pullup/down etc. /// "actual" sample rate of session, set by current audioengine rate, pullup/down etc.
nframes_t frame_rate() const { return _current_frame_rate; } nframes_t frame_rate() const { return _current_frame_rate; }
/// "native" sample rate of session, regardless of current audioengine rate, pullup/down etc /// "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 sync_time_vars();
void bbt_time (nframes_t when, BBT_Time&); 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 timecode_to_sample(Timecode::Time& timecode, framepos_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 sample_to_timecode(framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
void timecode_time (Timecode::Time &); void timecode_time (Timecode::Time &);
void timecode_time (nframes_t when, Timecode::Time&); void timecode_time (nframes_t when, Timecode::Time&);
void timecode_time_subframes (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 (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); void set_timecode_offset (nframes_t);
nframes_t timecode_offset () const { return _timecode_offset; } nframes_t timecode_offset () const { return _timecode_offset; }
@ -629,7 +629,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/* s/w "RAID" management */ /* s/w "RAID" management */
nframes_t available_capture_duration(); framecnt_t available_capture_duration();
/* I/O bundles */ /* I/O bundles */
@ -1048,15 +1048,15 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void enable_record (); void enable_record ();
void increment_transport_position (uint32_t val) { void increment_transport_position (framecnt_t val) {
if (max_frames - val < _transport_frame) { if (max_framepos - val < _transport_frame) {
_transport_frame = max_frames; _transport_frame = max_framepos;
} else { } else {
_transport_frame += val; _transport_frame += val;
} }
} }
void decrement_transport_position (uint32_t val) { void decrement_transport_position (framecnt_t val) {
if (val < _transport_frame) { if (val < _transport_frame) {
_transport_frame -= val; _transport_frame -= val;
} else { } else {

View file

@ -27,7 +27,7 @@ namespace ARDOUR {
class SilentFileSource : public AudioFileSource { class SilentFileSource : public AudioFileSource {
public: 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; } int flush_header () { return 0; }
float sample_rate () const { return _sample_rate; } float sample_rate () const { return _sample_rate; }

View file

@ -249,13 +249,13 @@ class MTC_Slave : public Slave {
static const int frame_tolerance; static const int frame_tolerance;
SafeTime current; SafeTime current;
nframes_t mtc_frame; /* current time */ framepos_t mtc_frame; /* current time */
nframes_t last_inbound_frame; /* when we got it; audio clocked */ framepos_t last_inbound_frame; /* when we got it; audio clocked */
MIDI::byte last_mtc_fps_byte; MIDI::byte last_mtc_fps_byte;
nframes64_t window_begin; framepos_t window_begin;
nframes64_t window_end; framepos_t window_end;
nframes64_t last_mtc_timestamp; framepos_t last_mtc_timestamp;
nframes64_t last_mtc_frame; framepos_t last_mtc_frame;
bool did_reset_tc_format; bool did_reset_tc_format;
TimecodeFormat saved_tc_format; TimecodeFormat saved_tc_format;
size_t speed_accumulator_size; size_t speed_accumulator_size;

View file

@ -44,7 +44,7 @@ class SndFileSource : public AudioFileSource {
~SndFileSource (); ~SndFileSource ();
float sample_rate () const; 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 (); int flush_header ();
nframes64_t natural_position () const; nframes64_t natural_position () const;

View file

@ -41,7 +41,7 @@ class SourceFactory {
static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false); static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false);
static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node, static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node,
nframes_t nframes, float sample_rate); framecnt_t nframes, float sample_rate);
static boost::shared_ptr<Source> createReadable (DataType type, Session&, static boost::shared_ptr<Source> createReadable (DataType type, Session&,
const std::string& path, const std::string& path,

View file

@ -114,17 +114,17 @@ class Track : public Route, public PublicDiskstream
uint32_t read_data_count() const; uint32_t read_data_count() const;
uint32_t write_data_count() const; uint32_t write_data_count() const;
void set_pending_overwrite (bool); void set_pending_overwrite (bool);
int seek (nframes_t, bool complete_refill = false); int seek (framepos_t, bool complete_refill = false);
bool hidden () const; bool hidden () const;
int can_internal_playback_seek (nframes_t); int can_internal_playback_seek (framepos_t);
int internal_playback_seek (nframes_t); int internal_playback_seek (framepos_t);
void non_realtime_input_change (); void non_realtime_input_change ();
void non_realtime_locate (nframes_t); void non_realtime_locate (framepos_t);
void non_realtime_set_speed (); void non_realtime_set_speed ();
int overwrite_existing_buffers (); 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 *); int set_loop (Location *);
void transport_looped (nframes_t); void transport_looped (framepos_t);
bool realtime_set_speed (double, bool); bool realtime_set_speed (double, bool);
void transport_stopped_wallclock (struct tm &, time_t, bool); void transport_stopped_wallclock (struct tm &, time_t, bool);
bool pending_overwrite () const; bool pending_overwrite () const;
@ -132,10 +132,10 @@ class Track : public Route, public PublicDiskstream
void prepare_to_stop (framepos_t); void prepare_to_stop (framepos_t);
void set_slaved (bool); void set_slaved (bool);
ChanCount n_channels (); 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; AlignStyle alignment_style () const;
nframes_t current_capture_start () const; framepos_t current_capture_start () const;
nframes_t current_capture_end () const; framepos_t current_capture_end () const;
void playlist_modified (); void playlist_modified ();
int use_playlist (boost::shared_ptr<Playlist>); int use_playlist (boost::shared_ptr<Playlist>);
void set_align_style (AlignStyle); void set_align_style (AlignStyle);

View file

@ -20,14 +20,11 @@
#ifndef __ardour_types_h__ #ifndef __ardour_types_h__
#define __ardour_types_h__ #define __ardour_types_h__
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS /* PRI<foo>; C++ requires explicit requesting of these */
#endif
#include <istream> #include <istream>
#include <vector> #include <vector>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h>
#include <inttypes.h> #include <inttypes.h>
#include <jack/types.h> #include <jack/types.h>
@ -58,12 +55,6 @@ namespace ARDOUR {
typedef uint32_t nframes_t; typedef uint32_t nframes_t;
typedef int64_t nframes64_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 sframes_t;
typedef int64_t framepos_t; typedef int64_t framepos_t;
/* any offset from a framepos_t, measured in audio frames */ /* any offset from a framepos_t, measured in audio frames */
@ -71,6 +62,9 @@ namespace ARDOUR {
/* any count of audio frames */ /* any count of audio frames */
typedef int64_t framecnt_t; typedef int64_t framecnt_t;
static const framepos_t max_framepos = INT64_MAX;
static const framecnt_t max_framecnt = INT64_MAX;
struct IOChange { struct IOChange {
enum Type { enum Type {

View file

@ -204,19 +204,19 @@ AudioDiskstream::non_realtime_input_change ()
/* now refill channel buffers */ /* now refill channel buffers */
if (speed() != 1.0f || speed() != -1.0f) { if (speed() != 1.0f || speed() != -1.0f) {
seek ((nframes_t) (_session.transport_frame() * (double) speed())); seek ((framepos_t) (_session.transport_frame() * (double) speed()));
} else { } else {
seek (_session.transport_frame()); seek (_session.transport_frame());
} }
} }
void void
AudioDiskstream::non_realtime_locate (nframes_t location) AudioDiskstream::non_realtime_locate (framepos_t location)
{ {
/* now refill channel buffers */ /* now refill channel buffers */
if (speed() != 1.0f || speed() != -1.0f) { if (speed() != 1.0f || speed() != -1.0f) {
seek ((nframes_t) (location * (double) speed())); seek ((framepos_t) (location * (double) speed()));
} else { } else {
seek (location); seek (location);
} }
@ -347,7 +347,7 @@ AudioDiskstream::setup_destructive_playlist ()
PropertyList plist; PropertyList plist;
plist.add (Properties::name, _name.val()); plist.add (Properties::name, _name.val());
plist.add (Properties::start, 0); 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> region (RegionFactory::create (srcs, plist)); boost::shared_ptr<Region> region (RegionFactory::create (srcs, plist));
_playlist->add_region (region, srcs.front()->natural_position()); _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 */ /* 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; uint32_t n;
ChannelList::iterator chan; ChannelList::iterator chan;
@ -397,7 +397,7 @@ AudioDiskstream::use_destructive_playlist ()
} }
void void
AudioDiskstream::prepare_record_status(nframes_t capture_start_frame) AudioDiskstream::prepare_record_status(framepos_t capture_start_frame)
{ {
if (recordable() && destructive()) { if (recordable() && destructive()) {
boost::shared_ptr<ChannelList> c = channels.reader(); boost::shared_ptr<ChannelList> c = channels.reader();
@ -421,7 +421,7 @@ AudioDiskstream::prepare_record_status(nframes_t capture_start_frame)
} }
int 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; uint32_t n;
boost::shared_ptr<ChannelList> c = channels.reader(); boost::shared_ptr<ChannelList> 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 // and last_recordable_frame < first_recordable_frame
if (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); OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
@ -759,7 +759,7 @@ AudioDiskstream::overwrite_existing_buffers ()
size--; size--;
uint32_t n=0; uint32_t n=0;
nframes_t start; framepos_t start;
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan, ++n) { for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan, ++n) {
@ -808,7 +808,7 @@ AudioDiskstream::overwrite_existing_buffers ()
} }
int int
AudioDiskstream::seek (nframes_t frame, bool complete_refill) AudioDiskstream::seek (framepos_t frame, bool complete_refill)
{ {
uint32_t n; uint32_t n;
int ret = -1; int ret = -1;
@ -841,13 +841,13 @@ AudioDiskstream::seek (nframes_t frame, bool complete_refill)
} }
int int
AudioDiskstream::can_internal_playback_seek (nframes_t distance) AudioDiskstream::can_internal_playback_seek (framecnt_t distance)
{ {
ChannelList::iterator chan; ChannelList::iterator chan;
boost::shared_ptr<ChannelList> c = channels.reader(); boost::shared_ptr<ChannelList> c = channels.reader();
for (chan = c->begin(); chan != c->end(); ++chan) { 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; return false;
} }
} }
@ -855,7 +855,7 @@ AudioDiskstream::can_internal_playback_seek (nframes_t distance)
} }
int int
AudioDiskstream::internal_playback_seek (nframes_t distance) AudioDiskstream::internal_playback_seek (framecnt_t distance)
{ {
ChannelList::iterator chan; ChannelList::iterator chan;
boost::shared_ptr<ChannelList> c = channels.reader(); boost::shared_ptr<ChannelList> c = channels.reader();
@ -871,13 +871,14 @@ AudioDiskstream::internal_playback_seek (nframes_t distance)
} }
int 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) ChannelInfo* /*channel_info*/, int channel, bool reversed)
{ {
nframes_t this_read = 0; nframes_t this_read = 0;
bool reloop = false; bool reloop = false;
nframes_t loop_end = 0; framepos_t loop_end = 0;
nframes_t loop_start = 0; framepos_t loop_start = 0;
nframes_t offset = 0; nframes_t offset = 0;
Location *loc = 0; Location *loc = 0;
@ -885,7 +886,7 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
if (!reversed) { if (!reversed) {
nframes_t loop_length = 0; framecnt_t loop_length = 0;
/* Make the use of a Location atomic for this read operation. /* 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 { } else {
if (file_frame == max_frames) { if (file_frame == max_framepos) {
/* at end: nothing to do but fill with silence */ /* at end: nothing to do but fill with silence */
@ -1099,19 +1100,19 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer)
return 0; 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 */ /* to close to the end: read what we can, and zero fill the rest */
zero_fill = total_space - (max_frames - file_frame); zero_fill = total_space - (max_framepos - file_frame);
total_space = max_frames - file_frame; total_space = max_framepos - file_frame;
} else { } else {
zero_fill = 0; 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) { 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 void
AudioDiskstream::transport_looped (nframes_t transport_frame) AudioDiskstream::transport_looped (framepos_t transport_frame)
{ {
if (was_recording) { if (was_recording) {
// all we need to do is finish this capture, with modified capture length // 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 // no latency adjustment or capture offset needs to be made, as that already happened the first time
capture_start_frame = transport_frame; capture_start_frame = transport_frame;
first_recordable_frame = transport_frame; // mild lie first_recordable_frame = transport_frame; // mild lie
last_recordable_frame = max_frames; last_recordable_frame = max_framepos;
was_recording = true; was_recording = true;
if (recordable() && destructive()) { if (recordable() && destructive()) {
@ -1581,8 +1582,8 @@ void
AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr<ChannelList> c) AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr<ChannelList> c)
{ {
was_recording = false; was_recording = false;
first_recordable_frame = max_frames; first_recordable_frame = max_framepos;
last_recordable_frame = max_frames; last_recordable_frame = max_framepos;
if (capture_captured == 0) { if (capture_captured == 0) {
return; return;
@ -1627,7 +1628,7 @@ AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr<
capture_captured = 0; capture_captured = 0;
/* now we've finished a capture, reset first_recordable_frame for next time */ /* now we've finished a capture, reset first_recordable_frame for next time */
first_recordable_frame = max_frames; first_recordable_frame = max_framepos;
} }
void void
@ -2147,13 +2148,13 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node)
boost::shared_ptr<AudioFileSource> fs; boost::shared_ptr<AudioFileSource> fs;
boost::shared_ptr<AudioFileSource> first_fs; boost::shared_ptr<AudioFileSource> first_fs;
SourceList pending_sources; SourceList pending_sources;
nframes_t position; framepos_t position;
if ((prop = node.property (X_("at"))) == 0) { if ((prop = node.property (X_("at"))) == 0) {
return -1; return -1;
} }
if (sscanf (prop->value().c_str(), "%" PRIu32, &position) != 1) { if (sscanf (prop->value().c_str(), "%" PRIu64, &position) != 1) {
return -1; return -1;
} }

View file

@ -76,7 +76,7 @@ AudioEngine::AudioEngine (string client_name, string session_uuid)
_running = false; _running = false;
_has_run = false; _has_run = false;
last_monitor_check = 0; last_monitor_check = 0;
monitor_check_interval = max_frames; monitor_check_interval = INT32_MAX;
_processed_frames = 0; _processed_frames = 0;
_usecs_per_cycle = 0; _usecs_per_cycle = 0;
_jack = 0; _jack = 0;
@ -463,8 +463,8 @@ AudioEngine::process_callback (nframes_t nframes)
/* handle wrap around of total frames counter */ /* handle wrap around of total frames counter */
if (max_frames - _processed_frames < nframes) { if (max_framepos - _processed_frames < nframes) {
next_processed_frames = nframes - (max_frames - _processed_frames); next_processed_frames = nframes - (max_framepos - _processed_frames);
} else { } else {
next_processed_frames = _processed_frames + nframes; next_processed_frames = _processed_frames + nframes;
} }

View file

@ -218,7 +218,7 @@ CoreAudioSource::sample_rate() const
} }
int int
CoreAudioSource::update_header (sframes_t when, struct tm&, time_t) CoreAudioSource::update_header (framepos_t when, struct tm&, time_t)
{ {
return 0; return 0;
} }

View file

@ -87,8 +87,8 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag)
, adjust_capture_position (0) , adjust_capture_position (0)
, _capture_offset (0) , _capture_offset (0)
, _roll_delay (0) , _roll_delay (0)
, first_recordable_frame (max_frames) , first_recordable_frame (max_framepos)
, last_recordable_frame (max_frames) , last_recordable_frame (max_framepos)
, last_possibly_recording (0) , last_possibly_recording (0)
, _alignment_style (ExistingMaterial) , _alignment_style (ExistingMaterial)
, _scrubbing (false) , _scrubbing (false)
@ -134,8 +134,8 @@ Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/)
, adjust_capture_position (0) , adjust_capture_position (0)
, _capture_offset (0) , _capture_offset (0)
, _roll_delay (0) , _roll_delay (0)
, first_recordable_frame (max_frames) , first_recordable_frame (max_framepos)
, last_recordable_frame (max_frames) , last_recordable_frame (max_framepos)
, last_possibly_recording (0) , last_possibly_recording (0)
, _alignment_style (ExistingMaterial) , _alignment_style (ExistingMaterial)
, _scrubbing (false) , _scrubbing (false)
@ -213,7 +213,7 @@ Diskstream::non_realtime_set_speed ()
if (_seek_required) { if (_seek_required) {
if (speed() != 1.0f || speed() != -1.0f) { 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 { else {
seek (_session.transport_frame(), true); seek (_session.transport_frame(), true);
@ -297,7 +297,7 @@ Diskstream::set_loop (Location *location)
return 0; return 0;
} }
ARDOUR::nframes_t ARDOUR::framepos_t
Diskstream::get_capture_start_frame (uint32_t n) Diskstream::get_capture_start_frame (uint32_t n)
{ {
Glib::Mutex::Lock lm (capture_info_lock); 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) Diskstream::get_captured_frames (uint32_t n)
{ {
Glib::Mutex::Lock lm (capture_info_lock); Glib::Mutex::Lock lm (capture_info_lock);
@ -506,7 +506,7 @@ Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evora
} }
void 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 possibly_recording;
int rolling; 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 */ /* we transitioned to recording. lets see if its transport based or a punch */
first_recordable_frame = transport_frame + _capture_offset; first_recordable_frame = transport_frame + _capture_offset;
last_recordable_frame = max_frames; last_recordable_frame = max_framepos;
capture_start_frame = transport_frame; capture_start_frame = transport_frame;
if (change & transport_rolling) { if (change & transport_rolling) {
@ -633,7 +633,7 @@ Diskstream::route_going_away ()
} }
void 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) nframes_t& rec_nframes, nframes_t& rec_offset)
{ {
switch (ot) { switch (ot) {

View file

@ -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 * side of a frame. Note that if frame is exactly on a `mark', that mark will not be considered for returning
* as before/after. * as before/after.
* @param frame Frame to look for. * @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 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_frames if none exists) * @param after Filled in with the position of the next `mark' after `frame' (or max_framepos if none exists)
*/ */
void void
Locations::marks_either_side (nframes64_t const frame, nframes64_t& before, nframes64_t& after) const 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; LocationList locs;

View file

@ -143,7 +143,7 @@ MidiDiskstream::~MidiDiskstream ()
void void
MidiDiskstream::non_realtime_locate (nframes_t position) MidiDiskstream::non_realtime_locate (framepos_t position)
{ {
if (_write_source) { if (_write_source) {
_write_source->set_timeline_position (position); _write_source->set_timeline_position (position);
@ -192,7 +192,7 @@ MidiDiskstream::non_realtime_input_change ()
/* now refill channel buffers */ /* now refill channel buffers */
if (speed() != 1.0f || speed() != -1.0f) { if (speed() != 1.0f || speed() != -1.0f) {
seek ((nframes_t) (_session.transport_frame() * (double) speed())); seek ((framepos_t) (_session.transport_frame() * (double) speed()));
} }
else { else {
seek (_session.transport_frame()); seek (_session.transport_frame());
@ -488,7 +488,7 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len)
#endif #endif
int 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; int ret = -1;
nframes_t rec_offset = 0; nframes_t rec_offset = 0;
@ -619,7 +619,7 @@ MidiDiskstream::set_pending_overwrite (bool yn)
int int
MidiDiskstream::overwrite_existing_buffers () MidiDiskstream::overwrite_existing_buffers ()
{ {
//read(overwrite_frame, disk_io_chunk_frames, false); read (overwrite_frame, disk_io_chunk_frames, false);
overwrite_queued = false; overwrite_queued = false;
_pending_overwrite = false; _pending_overwrite = false;
@ -627,7 +627,7 @@ MidiDiskstream::overwrite_existing_buffers ()
} }
int int
MidiDiskstream::seek (nframes_t frame, bool complete_refill) MidiDiskstream::seek (framepos_t frame, bool complete_refill)
{ {
Glib::Mutex::Lock lm (state_lock); Glib::Mutex::Lock lm (state_lock);
int ret = -1; int ret = -1;
@ -650,7 +650,7 @@ MidiDiskstream::seek (nframes_t frame, bool complete_refill)
} }
int 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_read = g_atomic_int_get(&_frames_read_from_ringbuffer);
uint32_t frames_written = g_atomic_int_get(&_frames_written_to_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 int
MidiDiskstream::internal_playback_seek (nframes_t distance) MidiDiskstream::internal_playback_seek (framecnt_t distance)
{ {
first_recordable_frame += distance; first_recordable_frame += distance;
playback_sample += 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 */ /** @a start is set to the new frame position (TIME) read up to */
int 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; nframes_t this_read = 0;
bool reloop = false; bool reloop = false;
nframes_t loop_end = 0; framepos_t loop_end = 0;
nframes_t loop_start = 0; framepos_t loop_start = 0;
Location *loc = 0; Location *loc = 0;
if (!reversed) { if (!reversed) {
nframes_t loop_length = 0; framecnt_t loop_length = 0;
/* Make the use of a Location atomic for this read operation. /* 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) { if (reloop) {
// Synthesize LoopEvent here, because the next events // Synthesize LoopEvent here, because the next events
// written will have non-monotonic timestamps. // 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 cout << "Pushing LoopEvent ts=" << loop_end-1
<< " start+this_read " << start+this_read << endl; << " start+this_read " << start+this_read << endl;
@ -788,13 +788,13 @@ MidiDiskstream::do_refill ()
} }
/* at end: nothing to do */ /* at end: nothing to do */
if (file_frame == max_frames) { if (file_frame == max_framepos) {
return 0; return 0;
} }
// At this point we... // At this point we...
assert(_playback_buf->write_space() > 0); // ... have something to write to, and 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. // now calculate how much time is in the ringbuffer.
// and lets write as much as we need to get this to be midi_readahead; // 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: " //cout << "MDS read for midi_readahead " << to_read << " rb_contains: "
// << frames_written - frames_read << endl; // << 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)) { if (read (file_frame, to_read, reversed)) {
ret = -1; ret = -1;
@ -1061,7 +1061,7 @@ MidiDiskstream::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen
} }
void void
MidiDiskstream::transport_looped (nframes_t transport_frame) MidiDiskstream::transport_looped (framepos_t transport_frame)
{ {
if (was_recording) { 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 // no latency adjustment or capture offset needs to be made, as that already happened the first time
capture_start_frame = transport_frame; capture_start_frame = transport_frame;
first_recordable_frame = transport_frame; // mild lie first_recordable_frame = transport_frame; // mild lie
last_recordable_frame = max_frames; last_recordable_frame = max_framepos;
was_recording = true; was_recording = true;
} }
} }
@ -1463,7 +1463,7 @@ MidiDiskstream::use_pending_capture_data (XMLNode& /*node*/)
* so that an event at \a start has time = 0 * so that an event at \a start has time = 0
*/ */
void 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(); dst.clear();
assert(dst.size() == 0); assert(dst.size() == 0);

View file

@ -380,8 +380,6 @@ MidiModel::DiffCommand::marshal_note(const NotePtr note)
{ {
XMLNode* xml_note = new XMLNode("note"); XMLNode* xml_note = new XMLNode("note");
cerr << "Marshalling note: " << *note << endl;
{ {
ostringstream id_str(ios::ate); ostringstream id_str(ios::ate);
id_str << int(note->id()); id_str << int(note->id());

View file

@ -425,13 +425,10 @@ MidiPlaylist::region_changed (const PBD::PropertyChange& what_changed, boost::sh
return false; return false;
} }
// Feeling rather uninterested today, but thanks for the heads up anyway!
PBD::PropertyChange our_interests; PBD::PropertyChange our_interests;
our_interests.add (Properties::midi_data);
bool parent_wants_notify; bool parent_wants_notify = Playlist::region_changed (what_changed, region);
parent_wants_notify = Playlist::region_changed (what_changed, region);
if (parent_wants_notify || what_changed.contains (our_interests)) { if (parent_wants_notify || what_changed.contains (our_interests)) {
notify_contents_changed (); notify_contents_changed ();

View file

@ -47,10 +47,31 @@ using namespace std;
using namespace ARDOUR; using namespace ARDOUR;
using namespace PBD; using namespace PBD;
namespace ARDOUR {
namespace Properties {
PBD::PropertyDescriptor<void*> 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) */ /* Basic MidiRegion constructor (many channels) */
MidiRegion::MidiRegion (const SourceList& srcs) MidiRegion::MidiRegion (const SourceList& srcs)
: Region (srcs) : Region (srcs)
{ {
register_properties ();
// midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1)); // 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)); midi_source(0)->ModelChanged.connect_same_thread (_source_connection, boost::bind (&MidiRegion::model_changed, this));
model_changed (); model_changed ();
@ -62,6 +83,8 @@ MidiRegion::MidiRegion (const SourceList& srcs)
MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t offset, bool offset_relative) MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, frameoffset_t offset, bool offset_relative)
: Region (other, offset, offset_relative) : Region (other, offset, offset_relative)
{ {
register_properties ();
assert(_name.val().find("/") == string::npos); assert(_name.val().find("/") == string::npos);
// midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1)); // 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)); midi_source(0)->ModelChanged.connect_same_thread (_source_connection, boost::bind (&MidiRegion::model_changed, this));
@ -156,12 +179,13 @@ MidiRegion::_read_at (const SourceList& /*srcs*/, Evoral::EventSink<nframes_t>&
boost::shared_ptr<MidiSource> src = midi_source(chan_n); boost::shared_ptr<MidiSource> src = midi_source(chan_n);
src->set_note_mode(mode); src->set_note_mode(mode);
/*cerr << "MR read @ " << position << " * " << to_read /*
cerr << "MR read @ " << position << " * " << to_read
<< " _position = " << _position << " _position = " << _position
<< " _start = " << _start << " _start = " << _start
<< " offset = " << output_buffer_position
<< " intoffset = " << internal_offset << " intoffset = " << internal_offset
<< endl;*/ << endl;
*/
/* This call reads events from a source and writes them to `dst' timed in session frames */ /* 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 ( midi_source()->AutomationStateChanged.connect_same_thread (
_model_connection, boost::bind (&MidiRegion::model_automation_state_changed, this, _1) _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 void

View file

@ -123,7 +123,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, nframes_t now)
Timecode::Time timecode; Timecode::Time timecode;
TimecodeFormat tc_format; TimecodeFormat tc_format;
bool reset_tc = true; 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)); DEBUG_TRACE (DEBUG::MTC, string_compose ("full mtc time known at %1, full ? %2\n", now, was_full));

View file

@ -17,9 +17,7 @@
*/ */
#define __STDC_LIMIT_MACROS
#include <stdint.h> #include <stdint.h>
#include <set> #include <set>
#include <fstream> #include <fstream>
#include <algorithm> #include <algorithm>
@ -1501,8 +1499,8 @@ Playlist::core_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Reg
framepos_t new_pos = (*i)->position() + distance; framepos_t new_pos = (*i)->position() + distance;
if (new_pos < 0) { if (new_pos < 0) {
new_pos = 0; new_pos = 0;
} else if (new_pos >= max_frames - (*i)->length()) { } else if (new_pos >= max_framepos - (*i)->length()) {
new_pos = max_frames - (*i)->length(); new_pos = max_framepos - (*i)->length();
} }
(*i)->set_position (new_pos, this); (*i)->set_position (new_pos, this);
@ -1985,7 +1983,7 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
{ {
RegionLock rlock (this); RegionLock rlock (this);
boost::shared_ptr<Region> ret; boost::shared_ptr<Region> ret;
framepos_t closest = max_frames; framepos_t closest = max_framepos;
bool end_iter = false; bool end_iter = false;
@ -2046,7 +2044,7 @@ Playlist::find_next_region_boundary (framepos_t frame, int dir)
{ {
RegionLock rlock (this); RegionLock rlock (this);
framepos_t closest = max_frames; framepos_t closest = max_framepos;
framepos_t ret = -1; framepos_t ret = -1;
if (dir > 0) { if (dir > 0) {
@ -2320,7 +2318,7 @@ Playlist::get_extent () const
pair<framecnt_t, framecnt_t> pair<framecnt_t, framecnt_t>
Playlist::_get_extent () const Playlist::_get_extent () const
{ {
pair<framecnt_t, framecnt_t> ext (max_frames, 0); pair<framecnt_t, framecnt_t> ext (max_framepos, 0);
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) { for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
pair<framecnt_t, framecnt_t> const e ((*i)->position(), (*i)->position() + (*i)->length()); pair<framecnt_t, framecnt_t> 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 (forwards) {
if ((*i)->last_frame() > max_frames - distance) { if ((*i)->last_frame() > max_framepos - distance) {
new_pos = max_frames - (*i)->length(); new_pos = max_framepos - (*i)->length();
} else { } else {
new_pos = (*i)->position() + distance; new_pos = (*i)->position() + distance;
} }

View file

@ -452,7 +452,7 @@ Region::set_length (framecnt_t len, void */*src*/)
length impossible. length impossible.
*/ */
if (max_frames - len < _position) { if (max_framepos - len < _position) {
return; return;
} }
@ -602,9 +602,9 @@ Region::set_position_internal (framepos_t pos, bool allow_bbt_recompute)
XXX is this the right thing to do? XXX is this the right thing to do?
*/ */
if (max_frames - _length < _position) { if (max_framepos - _length < _position) {
_last_length = _length; _last_length = _length;
_length = max_frames - _position; _length = max_framepos - _position;
} }
if (allow_bbt_recompute) { if (allow_bbt_recompute) {
@ -667,8 +667,8 @@ Region::nudge_position (frameoffset_t n, void* /*src*/)
_last_position = _position; _last_position = _position;
if (n > 0) { if (n > 0) {
if (_position > max_frames - n) { if (_position > max_framepos - n) {
_position = max_frames; _position = max_framepos;
} else { } else {
_position += n; _position += n;
} }
@ -735,8 +735,8 @@ Region::trim_start (framepos_t new_position, void */*src*/)
if (start_shift > 0) { if (start_shift > 0) {
if (_start > max_frames - start_shift) { if (_start > max_framepos - start_shift) {
new_start = max_frames; new_start = max_framepos;
} else { } else {
new_start = _start + start_shift; 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_shift > 0) {
if (_start > max_frames - start_shift) { if (_start > max_framepos - start_shift) {
new_start = max_frames; new_start = max_framepos;
} else { } else {
new_start = _start + start_shift; new_start = _start + start_shift;
} }
@ -1077,7 +1077,7 @@ Region::adjust_to_sync (framepos_t pos) const
pos = 0; pos = 0;
} }
} else { } else {
if (max_frames - pos > offset) { if (max_framepos - pos > offset) {
pos += offset; pos += offset;
} }
} }

View file

@ -17,7 +17,6 @@
*/ */
#define __STDC_FORMAT_MACROS
#include <inttypes.h> #include <inttypes.h>
#include "pbd/error.h" #include "pbd/error.h"

View file

@ -17,7 +17,6 @@
*/ */
#define __STDC_FORMAT_MACROS
#include <inttypes.h> #include <inttypes.h>
#include <algorithm> #include <algorithm>

View file

@ -17,7 +17,6 @@
*/ */
#define __STDC_LIMIT_MACROS
#include <stdint.h> #include <stdint.h>
#include <algorithm> #include <algorithm>
@ -2491,11 +2490,11 @@ Session::update_session_range_location_marker ()
return; return;
} }
pair<nframes_t, nframes_t> const ext = get_extent (); pair<framepos_t, framepos_t> const ext = get_extent ();
if (_session_range_location == 0) { if (_session_range_location == 0) {
/* we don't have a session range yet; use this one (provided it is valid) */ /* 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); add_session_range_location (ext.first, ext.second);
} }
} else { } 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 /** @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<nframes_t, nframes_t> pair<framepos_t, framepos_t>
Session::get_extent () const Session::get_extent () const
{ {
pair<nframes_t, nframes_t> ext (max_frames, 0); pair<framepos_t, framepos_t> ext (max_framepos, 0);
boost::shared_ptr<RouteList> rl = routes.reader (); boost::shared_ptr<RouteList> rl = routes.reader ();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { 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 () Session::available_capture_duration ()
{ {
float sample_bytes_on_disk = 4.0; // keep gcc happy 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; double scale = 4096.0 / sample_bytes_on_disk;
if (_total_free_4k_blocks * scale > (double) max_frames) { if (_total_free_4k_blocks * scale > (double) max_framecnt) {
return max_frames; return max_framecnt;
} }
return (nframes_t) floor (_total_free_4k_blocks * scale); return (framecnt_t) floor (_total_free_4k_blocks * scale);
} }
void void
@ -3974,13 +3973,13 @@ Session::goto_start ()
} }
} }
nframes_t framepos_t
Session::current_start_frame () const Session::current_start_frame () const
{ {
return _session_range_location ? _session_range_location->start() : 0; return _session_range_location ? _session_range_location->start() : 0;
} }
nframes_t framepos_t
Session::current_end_frame () const Session::current_end_frame () const
{ {
return _session_range_location ? _session_range_location->end() : 0; return _session_range_location ? _session_range_location->end() : 0;

View file

@ -270,7 +270,7 @@ Session::mmc_locate (MIDI::MachineControl &/*mmc*/, const MIDI::byte* mmc_tc)
return; return;
} }
nframes_t target_frame; framepos_t target_frame;
Timecode::Time timecode; Timecode::Time timecode;
timecode.hours = mmc_tc[0] & 0xf; 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: // Also takes timecode offset into account:
timecode_to_sample( timecode, target_frame, true /* use_offset */, false /* use_subframes */ ); timecode_to_sample( timecode, target_frame, true /* use_offset */, false /* use_subframes */ );
if (target_frame > max_frames) { if (target_frame > max_framepos) {
target_frame = max_frames; target_frame = max_framepos;
} }
/* Some (all?) MTC/MMC devices do not send a full MTC frame /* Some (all?) MTC/MMC devices do not send a full MTC frame

View file

@ -235,9 +235,9 @@ Session::process_with_events (nframes_t nframes)
{ {
SessionEvent* ev; SessionEvent* ev;
nframes_t this_nframes; nframes_t this_nframes;
nframes_t end_frame; framepos_t end_frame;
bool session_needs_butler = false; bool session_needs_butler = false;
nframes_t stop_limit; framepos_t stop_limit;
framecnt_t frames_moved; framecnt_t frames_moved;
/* make sure the auditioner is silent */ /* make sure the auditioner is silent */
@ -316,13 +316,13 @@ Session::process_with_events (nframes_t nframes)
} }
if (actively_recording()) { if (actively_recording()) {
stop_limit = max_frames; stop_limit = max_framepos;
} else { } else {
if (Config->get_stop_at_session_end()) { if (Config->get_stop_at_session_end()) {
stop_limit = current_end_frame(); stop_limit = current_end_frame();
} else { } else {
stop_limit = max_frames; stop_limit = max_framepos;
} }
} }
@ -723,15 +723,15 @@ Session::follow_slave_silently (nframes_t nframes, float slave_speed)
increment_transport_position (frames_moved); increment_transport_position (frames_moved);
} }
nframes_t stop_limit; framepos_t stop_limit;
if (actively_recording()) { if (actively_recording()) {
stop_limit = max_frames; stop_limit = max_framepos;
} else { } else {
if (Config->get_stop_at_session_end()) { if (Config->get_stop_at_session_end()) {
stop_limit = current_end_frame(); stop_limit = current_end_frame();
} else { } else {
stop_limit = max_frames; stop_limit = max_framepos;
} }
} }
@ -743,7 +743,7 @@ void
Session::process_without_events (nframes_t nframes) Session::process_without_events (nframes_t nframes)
{ {
bool session_needs_butler = false; bool session_needs_butler = false;
nframes_t stop_limit; framepos_t stop_limit;
framecnt_t frames_moved; framecnt_t frames_moved;
if (!process_can_proceed()) { if (!process_can_proceed()) {
@ -767,12 +767,12 @@ Session::process_without_events (nframes_t nframes)
} }
if (actively_recording()) { if (actively_recording()) {
stop_limit = max_frames; stop_limit = max_framepos;
} else { } else {
if (Config->get_stop_at_session_end()) { if (Config->get_stop_at_session_end()) {
stop_limit = current_end_frame(); stop_limit = current_end_frame();
} else { } else {
stop_limit = max_frames; stop_limit = max_framepos;
} }
} }

View file

@ -1100,7 +1100,7 @@ Session::state(bool full_state)
// with the default start and end, and get the state for that. // with the default start and end, and get the state for that.
Locations loc (*this); Locations loc (*this);
Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange); Location* range = new Location (*this, 0, 0, _("session"), Location::IsSessionRange);
range->set (max_frames, 0); range->set (max_framepos, 0);
loc.add (range); loc.add (range);
node->add_child_nocopy (loc.get_state()); node->add_child_nocopy (loc.get_state());
} }
@ -1877,7 +1877,7 @@ Session::load_sources (const XMLNode& node)
} }
} catch (MissingSource& err) { } catch (MissingSource& err) {
warning << _("A sound file is missing. It will be replaced by silence.") << endmsg; 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);
} }
} }

View file

@ -205,7 +205,7 @@ Session::set_timecode_offset_negative (bool neg)
} }
void 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) { if (timecode.drop) {
@ -297,9 +297,9 @@ Session::timecode_to_sample( Timecode::Time& timecode, nframes_t& sample, bool u
void 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) { if (!use_offset) {
offset_sample = sample; offset_sample = sample;
@ -430,7 +430,7 @@ Session::timecode_duration (nframes_t when, Timecode::Time& timecode) const
} }
void void
Session::timecode_duration_string (char* buf, nframes_t when) const Session::timecode_duration_string (char* buf, framepos_t when) const
{ {
Timecode::Time timecode; Timecode::Time timecode;

View file

@ -487,7 +487,7 @@ SndFileSource::destructive_write_unlocked (Sample* data, framecnt_t cnt)
} }
int 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); set_timeline_position (when);
@ -818,7 +818,7 @@ SndFileSource::setup_standard_crossfades (Session const & s, nframes_t rate)
} }
void void
SndFileSource::set_timeline_position (int64_t pos) SndFileSource::set_timeline_position (framepos_t pos)
{ {
// destructive track timeline postion does not change // destructive track timeline postion does not change
// except at instantion or when header_position_offset // except at instantion or when header_position_offset

View file

@ -121,7 +121,7 @@ SourceFactory::setup_peakfile (boost::shared_ptr<Source> s, bool async)
} }
boost::shared_ptr<Source> boost::shared_ptr<Source>
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); Source* src = new SilentFileSource (s, node, nframes, sr);
// boost_debug_shared_ptr_mark_interesting (src, "Source"); // boost_debug_shared_ptr_mark_interesting (src, "Source");

View file

@ -480,9 +480,9 @@ Track::set_pending_overwrite (bool o)
} }
int 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 bool
@ -492,15 +492,15 @@ Track::hidden () const
} }
int 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 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 void
@ -510,7 +510,7 @@ Track::non_realtime_input_change ()
} }
void void
Track::non_realtime_locate (nframes_t p) Track::non_realtime_locate (framepos_t p)
{ {
_diskstream->non_realtime_locate (p); _diskstream->non_realtime_locate (p);
} }
@ -527,7 +527,7 @@ Track::overwrite_existing_buffers ()
return _diskstream->overwrite_existing_buffers (); return _diskstream->overwrite_existing_buffers ();
} }
nframes_t framecnt_t
Track::get_captured_frames (uint32_t n) Track::get_captured_frames (uint32_t n)
{ {
return _diskstream->get_captured_frames (n); return _diskstream->get_captured_frames (n);
@ -540,9 +540,9 @@ Track::set_loop (Location* l)
} }
void void
Track::transport_looped (nframes_t f) Track::transport_looped (framepos_t p)
{ {
_diskstream->transport_looped (f); _diskstream->transport_looped (p);
} }
bool bool
@ -587,7 +587,7 @@ Track::n_channels ()
return _diskstream->n_channels (); return _diskstream->n_channels ();
} }
nframes_t framepos_t
Track::get_capture_start_frame (uint32_t n) Track::get_capture_start_frame (uint32_t n)
{ {
return _diskstream->get_capture_start_frame (n); return _diskstream->get_capture_start_frame (n);
@ -599,13 +599,13 @@ Track::alignment_style () const
return _diskstream->alignment_style (); return _diskstream->alignment_style ();
} }
nframes_t framepos_t
Track::current_capture_start () const Track::current_capture_start () const
{ {
return _diskstream->current_capture_start (); return _diskstream->current_capture_start ();
} }
nframes_t framepos_t
Track::current_capture_end () const Track::current_capture_end () const
{ {
return _diskstream->current_capture_end (); return _diskstream->current_capture_end ();

View file

@ -285,13 +285,13 @@ BasicUI::timecode_time (nframes_t where, Timecode::Time& timecode)
} }
void 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); session->timecode_to_sample (*((Timecode::Time*)&timecode), sample, use_offset, use_subframes);
} }
void 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); session->sample_to_timecode (sample, *((Timecode::Time*)&timecode), use_offset, use_subframes);
} }

View file

@ -22,6 +22,8 @@
#define __ardour_basic_ui_h__ #define __ardour_basic_ui_h__
#include <string> #include <string>
#include <stdint.h>
#include "pbd/signals.h" #include "pbd/signals.h"
#include <jack/types.h> #include <jack/types.h>
@ -78,8 +80,8 @@ class BasicUI {
jack_nframes_t timecode_frames_per_hour (); jack_nframes_t timecode_frames_per_hour ();
void timecode_time (jack_nframes_t where, Timecode::Time&); 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 timecode_to_sample (Timecode::Time& timecode, int64_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 sample_to_timecode (int64_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
protected: protected:
BasicUI (); BasicUI ();

View file

@ -24,7 +24,6 @@
#include <vector> #include <vector>
#include <iomanip> #include <iomanip>
#define __STDC_FORMAT_MACROS
#include <inttypes.h> #include <inttypes.h>
#include <float.h> #include <float.h>
#include <sys/time.h> #include <sys/time.h>

View file

@ -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('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_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_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: if opt.nls:
conf.env.append_value('CXXFLAGS', '-DENABLE_NLS') conf.env.append_value('CXXFLAGS', '-DENABLE_NLS')
conf.env.append_value('CCFLAGS', '-DENABLE_NLS') conf.env.append_value('CCFLAGS', '-DENABLE_NLS')