- double asset_over_session = (double)source_samplerate /
- mwindow->edl->session->sample_rate;
- int64_t startsource = (int64_t)(((pixmap->pixmap_x - virtual_edit_x + x) *
- mwindow->edl->local_session->zoom_sample +
- edit->startsource) *
- asset_over_session);
-// just in case we get a numerical error
- if (startsource < 0) startsource = 0;
- int64_t length = (int64_t)(w *
- mwindow->edl->local_session->zoom_sample *
- asset_over_session);
- int64_t lengthindex = length / index_state->index_zoom * 2;
- int64_t startindex = startsource / index_state->index_zoom * 2;
-// length of index to read in floats
+ double asset_over_session = (double)source_samplerate / mwindow->edl->session->sample_rate;
+ int64_t start_source = (pixmap->pixmap_x - virtual_edit_x + x) *
+ mwindow->edl->local_session->zoom_sample + edit->startsource;
+ int64_t start_speed = speed_autos->automation_integral(0, start_source, PLAY_FORWARD);
+ int64_t start_asset = start_speed * asset_over_session;
+ if( start_asset < 0 ) start_asset = 0;
+ int64_t start_index = start_asset / index_state->index_zoom;
+ int64_t end_source = (pixmap->pixmap_x - virtual_edit_x + x + w) *
+ mwindow->edl->local_session->zoom_sample + edit->startsource;
+ int64_t end_speed = speed_autos->automation_integral(0, end_source, PLAY_FORWARD);
+ int64_t end_asset = end_speed * asset_over_session;
+ if( end_asset < 0 ) end_asset = 0;
+ int64_t end_index = end_asset / index_state->index_zoom;
+// start/length of index to read in floats
+ start_index *= 2; end_index *= 2;