From 0052fcc10356061fe2ac94e37a139969c2a18c1c Mon Sep 17 00:00:00 2001 From: niels Date: Mon, 12 Nov 2012 18:21:58 +0100 Subject: [PATCH] add vims 114, sample skip frames. format: id, positive or negative value; --- veejay-current/veejay-server/veejay/vims.h | 1 + .../veejay-server/veejay/vj-event.c | 47 +++++++++++++++++++ .../veejay-server/veejay/vj-event.h | 1 + .../veejay-server/veejay/vj-eventman.c | 15 +++++- 4 files changed, 63 insertions(+), 1 deletion(-) diff --git a/veejay-current/veejay-server/veejay/vims.h b/veejay-current/veejay-server/veejay/vims.h index 75d92f74..dbb3c999 100644 --- a/veejay-current/veejay-server/veejay/vims.h +++ b/veejay-current/veejay-server/veejay/vims.h @@ -151,6 +151,7 @@ enum { VIMS_SAMPLE_SET_MARKER_START = 108, VIMS_SAMPLE_SET_MARKER_END = 109, VIMS_SAMPLE_SET_MARKER = 110, + VIMS_SAMPLE_SKIP_FRAME = 114, VIMS_SAMPLE_CLEAR_MARKER = 111, VIMS_SAMPLE_LOAD_SAMPLELIST = 125, VIMS_SAMPLE_SAVE_SAMPLELIST = 126, diff --git a/veejay-current/veejay-server/veejay/vj-event.c b/veejay-current/veejay-server/veejay/vj-event.c index cac95d4e..ab7e0c38 100644 --- a/veejay-current/veejay-server/veejay/vj-event.c +++ b/veejay-current/veejay-server/veejay/vj-event.c @@ -4199,6 +4199,53 @@ 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) +{ + int args[2]; + veejay_t *v = (veejay_t*) ptr; + char *s = NULL; + P_A(args, s, format, ap); + + if(args[0] == -1) + args[0] = sample_size() - 1; + + if( args[0] == 0) + args[0] = v->uc->sample_id; + + int job = sample_size(); + int i = 1; + int k = 0; + for( i = 1; i < job; i ++ ) { + sample_info *si = sample_get( i ); + if(!si) + continue; + + //@ find the mixing ID in all effect chains , frame offset is FX chain attribute + for( k = 0; k < SAMPLE_MAX_EFFECTS; k ++ ) { + if( si->effect_chain[k]->effect_id > 0 && + si->effect_chain[k]->source_type == 0 && + si->effect_chain[k]->channel == args[0] ) { + int start = sample_get_startFrame( + si->effect_chain[k]->channel ); + int end = sample_get_endFrame( + si->effect_chain[k]->channel ); + int len = end - start; + + si->effect_chain[k]->frame_offset += args[1]; + + if( si->effect_chain[k]->frame_offset > len ) + si->effect_chain[k]->frame_offset = len; + if( si->effect_chain[k]->frame_offset < 0 ) + si->effect_chain[k]->frame_offset = 0; + + veejay_msg(VEEJAY_MSG_DEBUG, + "Set offset of mixing sample #%d on chain entry %d of sample %d to %d", + si->effect_chain[k]->channel, k,i, si->effect_chain[k]->frame_offset ); + } + } + } +} + void vj_event_sample_set_speed(void *ptr, const char format[], va_list ap) { int args[2]; diff --git a/veejay-current/veejay-server/veejay/vj-event.h b/veejay-current/veejay-server/veejay/vj-event.h index 0d8dd8f6..86a34c99 100644 --- a/veejay-current/veejay-server/veejay/vj-event.h +++ b/veejay-current/veejay-server/veejay/vj-event.h @@ -127,6 +127,7 @@ 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_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 ); void vj_event_sample_set_nl ( void *ptr, const char format[], va_list ap ); void vj_event_sample_set_no ( 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 e5b1da3a..0c623109 100644 --- a/veejay-current/veejay-server/veejay/vj-eventman.c +++ b/veejay-current/veejay-server/veejay/vj-eventman.c @@ -445,7 +445,20 @@ void vj_init_vevo_events(void) "Number of frames", // param label 1, // default NULL ); - + + index_map_[VIMS_SAMPLE_SKIP_FRAME] = _new_event( + "%d %d", + VIMS_SAMPLE_SKIP_FRAME, + "Skip N frames forward or backward", + vj_event_sample_skip_frame, + 2, + VIMS_REQUIRE_ALL_PARAMS, + SAMPLE_ID_HELP, + 0, + "Increment value", + 0, + NULL ); + index_map_[VIMS_VIDEO_PREV_FRAME] = _new_event( "%d", VIMS_VIDEO_PREV_FRAME,