fixes for scrubbing, change "crop" to Crop in menu

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2516 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2007-10-05 17:03:23 +00:00
parent 17ebbb9d3f
commit c72611e1cd
5 changed files with 20 additions and 14 deletions

View file

@ -251,7 +251,7 @@ Editor::register_actions ()
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "normalize-region", _("Normalize Region"), mem_fun(*this, &Editor::normalize_region));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "crop", _("crop"), mem_fun(*this, &Editor::crop_region_to_selection));
act = ActionManager::register_action (editor_actions, "crop", _("Crop"), mem_fun(*this, &Editor::crop_region_to_selection));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "insert-chunk", _("Insert Chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f));
ActionManager::session_sensitive_actions.push_back (act);

View file

@ -776,7 +776,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
if (drag_info.item) {
if (end_grab (item, event)) {
/* grab dragged, so do nothing else */
cerr << "return from drag+grab\n";
return true;
}
}
@ -1476,7 +1475,7 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
last_scrub_frame = (nframes64_t) drag_info.current_pointer_frame;
gettimeofday (&tmnow, 0);
last_scrub_time = tmnow.tv_sec * 1000000 + tmnow.tv_usec;
last_scrub_time = tmnow.tv_sec * 1000000.0 + tmnow.tv_usec;
session->request_locate (last_scrub_frame, true);
} else {
@ -1506,11 +1505,10 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
#endif
gettimeofday (&tmnow, 0);
time = (tmnow.tv_sec * 1000000 + tmnow.tv_usec) - last_scrub_time;
time = (tmnow.tv_sec * 1000000.0 + tmnow.tv_usec) - last_scrub_time;
last_scrub_frame = drag_info.current_pointer_frame;
last_scrub_time = (tmnow.tv_sec * 1000000) + tmnow.tv_usec;
speed = (distance * 1000000.0) / time; // frames/sec
speed /= session->frame_rate();
last_scrub_time = (tmnow.tv_sec * 1000000.0) + tmnow.tv_usec;
speed = ((double)distance/session->frame_rate()) / (time/1000000.0); // frames/sec
add_mouse_speed (speed, dir);
@ -5005,7 +5003,6 @@ Editor::add_mouse_speed (double speed, double dir)
}
mouse_speed[index] = speed;
mouse_speed_entries = index;
}
@ -5014,7 +5011,6 @@ Editor::compute_mouse_speed ()
{
double total = 0;
if (!have_full_mouse_speed) {
/* partial speed buffer, just use whatever we have so far */
@ -5038,6 +5034,7 @@ Editor::compute_mouse_speed ()
total += mouse_speed[n];
}
return mouse_direction * total/mouse_speed_size;
}
@ -5073,7 +5070,7 @@ Editor::update_mouse_speed ()
add_mouse_speed (fabs (speed * 0.6), mouse_direction);
}
}
session->request_transport_speed (speed);
return _scrubbing;
}

View file

@ -279,6 +279,7 @@ class Diskstream : public PBD::StatefulDestructible
uint64_t last_phase;
uint64_t phi;
uint64_t target_phi;
nframes_t file_frame;
nframes_t playback_sample;

View file

@ -760,11 +760,18 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_
if (rec_nframes == 0 && _actual_speed != 1.0f && _actual_speed != -1.0f) {
uint64_t phase = last_phase;
uint64_t phi_delta;
nframes_t i = 0;
// Linearly interpolate into the alt buffer
// using 40.24 fixp maths (swh)
if (phi != target_phi) {
phi_delta = (target_phi - phi) / nframes;
} else {
phi_delta = 0;
}
for (chan = c->begin(); chan != c->end(); ++chan) {
float fr;
@ -779,7 +786,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_
chaninfo->speed_buffer[outsample] =
chaninfo->current_playback_buffer[i] * (1.0f - fr) +
chaninfo->current_playback_buffer[i+1] * fr;
phase += phi;
phase += phi + phi_delta;
}
chaninfo->current_playback_buffer = chaninfo->speed_buffer;
@ -792,6 +799,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_
playback_distance = nframes;
}
phi = target_phi;
}
ret = 0;

View file

@ -109,6 +109,7 @@ Diskstream::init (Flag f)
speed_buffer_size = 0;
last_phase = 0;
phi = (uint64_t) (0x1000000);
target_phi = phi;
file_frame = 0;
playback_sample = 0;
playback_distance = 0;
@ -151,8 +152,7 @@ Diskstream::handle_input_change (IOChange change, void *src)
void
Diskstream::non_realtime_set_speed ()
{
if (_buffer_reallocation_required)
{
if (_buffer_reallocation_required) {
Glib::Mutex::Lock lm (state_lock);
allocate_temporary_buffers ();
@ -192,7 +192,7 @@ Diskstream::realtime_set_speed (double sp, bool global)
}
_actual_speed = new_speed;
phi = (uint64_t) (0x1000000 * fabs(_actual_speed));
target_phi = (uint64_t) (0x1000000 * fabs(_actual_speed));
}
if (changed) {