diff --git a/veejay-current/veejay-client/share/gveejay.reloaded.glade b/veejay-current/veejay-client/share/gveejay.reloaded.glade index e263c2f8..f217f52d 100644 --- a/veejay-current/veejay-client/share/gveejay.reloaded.glade +++ b/veejay-current/veejay-client/share/gveejay.reloaded.glade @@ -1673,6 +1673,24 @@ + + + + + + + + + + + + + + + + + + True @@ -12595,8 +12613,6 @@ YUV (current) True False - 2 - 2 True @@ -12701,38 +12717,16 @@ YUV (current) 1 - - - - - - - True - True - 0 - - - - - True - False - 0 - 2 - 32 - - - True - False - - - True - False + + + True True False - Play once + True + Play once and then pause the video True loop_normal @@ -12765,31 +12759,75 @@ YUV (current) + + True + True + 3 + - - - False - False - 0 - - - - - True - True - False - Random Frame - True - loop_normal - - + True - False - 0 - 0 + True + False + True + Play once and keep playing last frame + True + loop_normal + - + + True + False + 0 + 0 + + + True + False + 2 + + + True + False + 3 + icon_looponcenop.png + + + False + False + 0 + + + + + + + + + True + True + 4 + + + + + True + True + False + True + Random Frame + True + loop_normal + + + + True + False + 0 + 0 + + True False 2 @@ -12805,16 +12843,18 @@ YUV (current) 0 + + + + False + False + 5 + - - False - False - 1 - @@ -12822,9 +12862,12 @@ YUV (current) True True - 1 + 0 + + + @@ -16178,6 +16221,24 @@ YUV (current) + + + + + + + + + + + + + + + + + + True diff --git a/veejay-current/veejay-client/src/callback.c b/veejay-current/veejay-client/src/callback.c index e7469221..662b9a7b 100644 --- a/veejay-current/veejay-client/src/callback.c +++ b/veejay-current/veejay-client/src/callback.c @@ -1680,6 +1680,16 @@ void on_loop_pingpong_clicked(GtkWidget *widget, gpointer user_data) } } + +void on_loop_oncenop_clicked(GtkWidget *widget, gpointer user_data) +{ + if(!info->status_lock) + { + multi_vims(VIMS_SAMPLE_SET_LOOPTYPE,"%d %d",0,4); + vj_midi_learning_vims_msg2(info->midi,NULL,VIMS_SAMPLE_SET_LOOPTYPE,0,4); + } +} + /* void on_check_marker_bind_clicked(GtkWidget *widget, gpointer user_data) { diff --git a/veejay-current/veejay-client/src/vj-api.c b/veejay-current/veejay-client/src/vj-api.c index e608b635..5a4fdfd4 100644 --- a/veejay-current/veejay-client/src/vj-api.c +++ b/veejay-current/veejay-client/src/vj-api.c @@ -2371,6 +2371,8 @@ int get_loop_value() return 2; else if (is_button_toggled("loop_random")) return 3; + if( is_button_toggled( "loop_oncenop" )) + return 4; } return 1; } @@ -3311,6 +3313,9 @@ static void update_current_slot(int *history, int pm, int last_pm) case 3: set_toggle_button("loop_random", 1 ); break; + case 4: + set_toggle_button("loop_oncenop", 1 ); + break; } } diff --git a/veejay-current/veejay-server/libsample/sampleadm.c b/veejay-current/veejay-server/libsample/sampleadm.c index 563db41a..bd7b7594 100644 --- a/veejay-current/veejay-server/libsample/sampleadm.c +++ b/veejay-current/veejay-server/libsample/sampleadm.c @@ -1771,7 +1771,7 @@ int sample_set_looptype(int s1, int looptype) sample_info *sample = sample_get(s1); if(!sample) return -1; - if (looptype == 3 || looptype == 0 || looptype == 1 || looptype == 2) { + if( looptype >= 0 && looptype < 5 ) { sample->looptype = looptype; return 1; } diff --git a/veejay-current/veejay-server/veejay/vims.h b/veejay-current/veejay-server/veejay/vims.h index 48a3a2ec..8c77f306 100644 --- a/veejay-current/veejay-server/veejay/vims.h +++ b/veejay-current/veejay-server/veejay/vims.h @@ -174,6 +174,7 @@ enum { VIMS_SAMPLE_KF_STATUS_PARAM = 142, VIMS_SAMPLE_UPDATE = 143, VIMS_SAMPLE_TOGGLE_LOOP = 144, + VIMS_SAMPLE_TOGGLE_RAND_LOOP = 154, VIMS_SAMPLE_KF_STATUS = 145, VIMS_SAMPLE_KF_GET = 146, VIMS_SAMPLE_KF_RESET = 147, diff --git a/veejay-current/veejay-server/veejay/vj-event.c b/veejay-current/veejay-server/veejay/vj-event.c index 6a0f8421..ef695b7c 100644 --- a/veejay-current/veejay-server/veejay/vj-event.c +++ b/veejay-current/veejay-server/veejay/vj-event.c @@ -339,6 +339,7 @@ static struct { /* hardcoded keyboard layout (the default keys) */ { VIMS_SAMPLE_SET_MARKER_START, SDLK_LEFTBRACKET,VIMS_MOD_ALT, NULL }, { VIMS_SAMPLE_SET_MARKER_END, SDLK_RIGHTBRACKET,VIMS_MOD_ALT, NULL }, { VIMS_SAMPLE_TOGGLE_LOOP, SDLK_KP_MULTIPLY,VIMS_MOD_NONE,NULL }, + { VIMS_SAMPLE_TOGGLE_RAND_LOOP, SDLK_KP_MULTIPLY, VIMS_MOD_SHIFT }, { VIMS_SWITCH_SAMPLE_STREAM, SDLK_ESCAPE, VIMS_MOD_NONE, NULL }, { VIMS_PRINT_INFO, SDLK_HOME, VIMS_MOD_NONE, NULL }, { VIMS_OSL, SDLK_HOME, VIMS_MOD_CTRL, NULL }, @@ -3889,18 +3890,44 @@ void vj_event_sample_rand_stop( void *ptr, const char format[], va_list ap) settings->randplayer.mode = RANDMODE_INACTIVE; } -void vj_event_sample_set_loop_type(void *ptr, const char format[], va_list ap) +void vj_event_sample_set_rand_loop(void *ptr, const char format[], va_list ap) { int args[2]; veejay_t *v = (veejay_t*) ptr; char *s = NULL; P_A(args,s,format,ap); - if(!SAMPLE_PLAYING(v)) + SAMPLE_DEFAULTS(args[0]); + + if( args[1] == -1 ) { - p_invalid_mode(); - return; + if( sample_exists(args[0]) ) + { + int cur_loop = sample_get_looptype(args[0]); + if( cur_loop == 4 ) { + sample_set_looptype(args[0],3 ); + } + else { + sample_set_looptype(args[0],4 ); + } + cur_loop = sample_get_looptype(args[0]); + + veejay_msg(VEEJAY_MSG_INFO,"Sample %d loop type is now %s", args[0], (cur_loop == 3 ? "Random" : "Play once and keep playing last frame" ) ); + } + else + { + p_no_sample(args[0]); + } + } +} + +void vj_event_sample_set_loop_type(void *ptr, const char format[], va_list ap) +{ + int args[2]; + veejay_t *v = (veejay_t*) ptr; + char *s = NULL; + P_A(args,s,format,ap); SAMPLE_DEFAULTS(args[0]); @@ -3934,7 +3961,7 @@ void vj_event_sample_set_loop_type(void *ptr, const char format[], va_list ap) } } - if(args[1] >= 0 && args[1] <= 3) + if(args[1] >= 0 && args[1] <= 4) { if(sample_exists(args[0])) { @@ -3947,6 +3974,7 @@ void vj_event_sample_set_loop_type(void *ptr, const char format[], va_list ap) case 1: veejay_msg(VEEJAY_MSG_INFO, "Normal looping");break; case 2: veejay_msg(VEEJAY_MSG_INFO, "Pingpong looping");break; case 3: veejay_msg(VEEJAY_MSG_INFO, "Random frame");break; + case 4: veejay_msg(VEEJAY_MSG_INFO, "Play once (no pause)");break; } } } @@ -4055,12 +4083,6 @@ void vj_event_sample_set_marker_start(void *ptr, const char format[], va_list ap char *str = NULL; P_A(args,str,format,ap); - if(!SAMPLE_PLAYING(v)) - { - p_invalid_mode(); - return; - } - SAMPLE_DEFAULTS(args[0]); if( sample_exists(args[0]) ) @@ -4093,12 +4115,6 @@ void vj_event_sample_set_marker_end(void *ptr, const char format[], va_list ap) char *str = NULL; P_A(args,str,format,ap); - if(!SAMPLE_PLAYING(v)) - { - p_invalid_mode(); - return; - } - SAMPLE_DEFAULTS(args[0]); if( sample_exists(args[0]) ) @@ -4131,12 +4147,6 @@ void vj_event_sample_set_marker(void *ptr, const char format[], va_list ap) char *s = NULL; P_A(args,s,format,ap); - if(!SAMPLE_PLAYING(v)) - { - p_invalid_mode(); - return; - } - SAMPLE_DEFAULTS(args[0]); if( sample_exists(args[0]) ) @@ -4169,12 +4179,6 @@ void vj_event_sample_set_marker_clear(void *ptr, const char format[],va_list ap) char *s = NULL; P_A(args,s,format,ap); - if(!SAMPLE_PLAYING(v)) - { - p_invalid_mode(); - return; - } - SAMPLE_DEFAULTS(args[0]); if( sample_exists(args[0]) ) @@ -4197,12 +4201,6 @@ void vj_event_sample_set_dup(void *ptr, const char format[], va_list ap) char *s = NULL; P_A(args,s,format,ap); - if(!SAMPLE_PLAYING(v)) - { - p_invalid_mode(); - return; - } - SAMPLE_DEFAULTS(args[0]); if( sample_exists(args[0])) @@ -4261,12 +4259,6 @@ void vj_event_sample_set_descr(void *ptr, const char format[], va_list ap) veejay_t *v = (veejay_t*) ptr; P_A(args,str,format,ap); - if(!SAMPLE_PLAYING(v)) - { - p_invalid_mode(); - return; - } - SAMPLE_DEFAULTS(args[0]); if(sample_set_description(args[0],str) == 0) diff --git a/veejay-current/veejay-server/veejay/vj-event.h b/veejay-current/veejay-server/veejay/vj-event.h index d25e21e9..ad8c6baa 100644 --- a/veejay-current/veejay-server/veejay/vj-event.h +++ b/veejay-current/veejay-server/veejay/vj-event.h @@ -133,6 +133,7 @@ void vj_event_sample_set_descr ( void *ptr, const char format[], va_list ap void vj_event_sample_set_end ( void *ptr, const char format[], va_list ap ); void vj_event_sample_set_freeze_play ( void *ptr, const char format[], va_list ap ); void vj_event_sample_set_loop_type ( void *ptr, const char format[], va_list ap ); +void vj_event_sample_set_rand_loop ( void *ptr, const char format[], va_list ap ); void vj_event_sample_set_position ( void *ptr, const char format[], va_list ap ); void vj_event_sample_skip_frame ( void *ptr, const char format[], va_list ap ); void vj_event_sample_set_speed ( void *ptr, const char format[], va_list ap ); diff --git a/veejay-current/veejay-server/veejay/vj-eventman.c b/veejay-current/veejay-server/veejay/vj-eventman.c index af2c2c41..99167f66 100644 --- a/veejay-current/veejay-server/veejay/vj-eventman.c +++ b/veejay-current/veejay-server/veejay/vj-eventman.c @@ -806,6 +806,20 @@ void vj_init_vevo_events(void) -1, NULL); + index_map_[VIMS_SAMPLE_TOGGLE_RAND_LOOP] = _new_event( + "%d %d", + VIMS_SAMPLE_TOGGLE_RAND_LOOP, + "Switch between loop types random and play once", + vj_event_sample_set_rand_loop, + 2, + VIMS_REQUIRE_ALL_PARAMS, + SAMPLE_ID_HELP, + 0, + "Looptype (3=Random, 4=Play Once)", + -1, + NULL ); + + index_map_[VIMS_PREVIEW_BW] = _new_event( NULL, VIMS_PREVIEW_BW, diff --git a/veejay-current/veejay-server/veejay/vj-perform.c b/veejay-current/veejay-server/veejay/vj-perform.c index ea20e3f9..cca0440e 100644 --- a/veejay-current/veejay-server/veejay/vj-perform.c +++ b/veejay-current/veejay-server/veejay/vj-perform.c @@ -401,8 +401,7 @@ static int vj_perform_try_sequence( veejay_t *info ) static int vj_perform_increase_sample_frame(veejay_t * info, long num) { - video_playback_setup *settings = - (video_playback_setup *) info->settings; + video_playback_setup *settings = (video_playback_setup *) info->settings; int start,end,looptype,speed; int ret_val = 1; @@ -474,6 +473,9 @@ static int vj_perform_increase_sample_frame(veejay_t * info, long num) sample_loopcount( info->uc->sample_id); veejay_set_frame(info, start); break; + case 4: + veejay_set_frame(info,end); + break; default: veejay_set_frame(info, end); veejay_set_speed(info, 0); @@ -523,6 +525,9 @@ static int vj_perform_increase_sample_frame(veejay_t * info, long num) veejay_set_frame(info,end); break; + case 4: + veejay_set_frame(info,start); + break; default: veejay_set_frame(info, start); veejay_set_speed(info, 0);