X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Ftransportque.C;h=5048beaf73cc42520323514b38255f4b324bcf2e;hb=HEAD;hp=5b3a3762a5abfb71355d4bc8ae4debf2236ad0cb;hpb=f377b3322b0c0cdf4b39abadac9ff528fa6ff70c;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/transportque.C b/cinelerra-5.1/cinelerra/transportque.C index 5b3a3762..96645929 100644 --- a/cinelerra-5.1/cinelerra/transportque.C +++ b/cinelerra-5.1/cinelerra/transportque.C @@ -2,6 +2,7 @@ /* * CINELERRA * Copyright (C) 2008 Adam Williams + * Copyright (C) 2003-2016 Cinelerra CV contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,10 +27,12 @@ #include "edlsession.h" #include "localsession.h" #include "playbackengine.h" +#include "preferences.h" #include "tracks.h" #include "transportque.h" -TransportCommand::TransportCommand() + +TransportCommand::TransportCommand(Preferences *preferences) { // In rendering we want a master EDL so settings don't get clobbered // in the middle of a job. @@ -37,6 +40,7 @@ TransportCommand::TransportCommand() edl->create_objects(); command = 0; change_type = 0; + this->preferences = preferences; reset(); } @@ -134,10 +138,16 @@ int TransportCommand::get_direction(int command) float TransportCommand::get_speed(int command, float speed) { +// fast = 2.0, slow = 0.5 +// float my_fast_speed = 2.0; +// float my_slow_speed = 0.5; +float my_fast_speed = preferences->fast_speed; +float my_slow_speed = preferences->slow_speed; + switch(command) { case SLOW_FWD: case SLOW_REWIND: - return speed ? speed : 0.5; + return speed ? speed : my_slow_speed; case NORMAL_FWD: case NORMAL_REWIND: @@ -149,7 +159,7 @@ float TransportCommand::get_speed(int command, float speed) case FAST_FWD: case FAST_REWIND: - return speed ? speed : 2.; + return speed ? speed : my_fast_speed; } return 0.; @@ -169,11 +179,19 @@ void TransportCommand::set_playback_range(EDL *edl, int use_inout, int do_displa end_position = use_inout && edl->local_session->outpoint_valid() ? edl->local_session->get_outpoint() : !loop_play ? edl->local_session->get_selectionend(1) : length; + if( start_position >= length ) + length = edl->tracks->total_length(); - if( !use_inout && EQUIV(start_position, end_position) ) { + if( command == REWIND ) { + start_position = end_position = 0; + command = CURRENT_FRAME; + } + else if( command == GOTO_END ) { + start_position = end_position = length; + command = LAST_FRAME; + } + else if( !use_inout && EQUIV(start_position, end_position) ) { // starting play at or past end_position, play to end_position of media (for mixers) - if( start_position >= length ) - length = edl->tracks->total_length(); switch( command ) { case SLOW_FWD: case FAST_FWD: @@ -184,6 +202,7 @@ void TransportCommand::set_playback_range(EDL *edl, int use_inout, int do_displa start_position > edl->local_session->loop_end ) { start_position = edl->local_session->loop_start; } + displacement = realtime && do_displacement ? frame_period : 0; break; } case SLOW_REWIND: @@ -197,31 +216,20 @@ void TransportCommand::set_playback_range(EDL *edl, int use_inout, int do_displa } break; - case REWIND: - start_position = 0; + case SINGLE_FRAME_FWD: + displacement = realtime && do_displacement ? frame_period : 0; case CURRENT_FRAME: case LAST_FRAME: - case SINGLE_FRAME_FWD: end_position = start_position + frame_period; break; - case GOTO_END: - end_position = length; case SINGLE_FRAME_REWIND: start_position = end_position - frame_period; break; } - - if( realtime && do_displacement ) { - if( (command != CURRENT_FRAME && get_direction() == PLAY_FORWARD ) || - (command != LAST_FRAME && get_direction() == PLAY_REVERSE ) ) { - start_position += frame_period; - end_position += frame_period; - displacement = 1; - } - } + start_position += displacement; + end_position += displacement; } - // if( start_position < 0 ) // start_position = 0; // if( end_position > length )