int PlayTransport::keypress_event()
{
- int result = 1;
int key = subwindow->get_keypress();
+ return do_keypress(key);
+}
+
+int PlayTransport::do_keypress(int key)
+{
+ int result = 1;
// unqualified keys, still holding lock
switch( key ) {
case HOME:
int toggle_audio = subwindow->shift_down() ? 1 : 0;
int use_inout = subwindow->ctrl_down() ? 1 : 0;
+ int alt_key = subwindow->alt_down() ? 1 : 0;
int command = -1, prev_command = engine->command->command;
using_inout = use_inout;
subwindow->unlock_window();
+ result = 0;
switch( key ) {
- case 'k':
case KPINS: command = STOP; break;
case KPPLUS: command = FAST_REWIND; break;
case KP6: command = NORMAL_REWIND; break;
break;
}
break;
- default:
- result = 0;
+ case 'u': case 'U':
+ if( alt_key ) command = SINGLE_FRAME_REWIND;
+ break;
+ case 'i': case 'I':
+ if( alt_key ) command = SLOW_REWIND;
+ break;
+ case 'o': case 'O':
+ if( alt_key ) command = NORMAL_REWIND;
+ break;
+ case 'p': case 'P':
+ if( alt_key ) command = FAST_REWIND;
+ break;
+ case 'j': case 'J':
+ if( alt_key ) command = SINGLE_FRAME_FWD;
+ break;
+ case 'k': case 'K':
+ if( alt_key ) command = SLOW_FWD;
+ break;
+ case 'l': case 'L':
+ if( alt_key ) command = NORMAL_FWD;
+ break;
+ case ':': case ';':
+ if( alt_key ) command = FAST_FWD;
+ break;
+ case 'm': case 'M':
+ if( alt_key ) command = STOP;
break;
}
- if( command >= 0 )
+ if( command >= 0 ) {
handle_transport(command, 0, use_inout, 1, toggle_audio);
+ result = 1;
+ }
subwindow->lock_window("PlayTransport::keypress_event 5");
return result;
void PlayTransport::handle_transport(int command,
int wait_tracking, int use_inout, int update_refresh, int toggle_audio)
{
- if( !get_edl() ) return;
-
-// Stop requires transferring the output buffer to a refresh buffer.
- int do_stop = 0;
- int resume = 0;
-//printf("PlayTransport::handle_transport 1 %d\n", command);
- int prev_command = engine->command->command;
- int prev_single_frame = engine->command->single_frame();
- int prev_audio = engine->command->audio_toggle ?
- !prev_single_frame : prev_single_frame;
- int cur_single_frame = TransportCommand::single_frame(command);
- int cur_audio = toggle_audio ?
- !cur_single_frame : cur_single_frame;
-
-// Dispatch command
- switch(command) {
- case FAST_REWIND: // Commands that play back
- case NORMAL_REWIND:
- case SLOW_REWIND:
- case SINGLE_FRAME_REWIND:
- case SINGLE_FRAME_FWD:
- case SLOW_FWD:
- case NORMAL_FWD:
- case FAST_FWD:
- if( !prev_single_frame &&
- prev_command == command &&
- cur_audio == prev_audio ) {
-// Same direction pressed twice and no change in audio state, Stop
- do_stop = 1;
- break;
- }
-// Resume or change direction
- switch( prev_command ) {
- default:
- engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0);
- engine->interrupt_playback(wait_tracking);
- resume = 1;
-// fall through
- case STOP:
- case COMMAND_NONE:
- case SINGLE_FRAME_FWD:
- case SINGLE_FRAME_REWIND:
-// Start from scratch
- engine->que->send_command(command, CHANGE_NONE, get_edl(),
- 1, resume, use_inout, toggle_audio);
- break;
- }
- break;
-
-// Commands that stop
- case STOP:
- do_stop = 1;
- break;
-
- case REWIND:
- case GOTO_END:
- engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0);
- engine->interrupt_playback(wait_tracking);
- break;
- }
-
- if( do_stop ) {
- engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0);
- engine->interrupt_playback(wait_tracking);
- }
+ EDL *edl = get_edl();
+ if( !edl ) return;
+ if( !is_vwindow() )
+ mwindow->queue_mixers(edl, command, wait_tracking, use_inout, update_refresh, toggle_audio);
+ engine->issue_command(edl, command, wait_tracking, use_inout, update_refresh, toggle_audio);
}
-
EDL* PlayTransport::get_edl()
{
return mwindow->edl;
void PlayTransport::change_position(double position)
{
- EDL *edl = get_edl();
- if( !edl ) return;
+ if( !get_edl() ) return;
int prev_command = engine->command->command;
// stop transport
if( prev_command != STOP && prev_command != COMMAND_NONE &&
prev_command != SINGLE_FRAME_FWD && prev_command != SINGLE_FRAME_REWIND ) {
- engine->que->send_command(STOP, CHANGE_NONE, 0, 0, 0, 0);
+ engine->que->send_command(STOP, CHANGE_NONE, 0, 0);
engine->interrupt_playback(0);
}
mwindow->gui->lock_window("PlayTransport::change_position");
case NORMAL_FWD:
case FAST_FWD:
engine->que->send_command(prev_command, CHANGE_NONE,
- get_edl(), 1, 1, using_inout);
+ get_edl(), 1, 1, using_inout, 0);
}
}