add vims 114, sample skip frames. format: id, positive or negative value;

This commit is contained in:
niels
2012-11-12 18:21:58 +01:00
parent d2b974a602
commit 0052fcc103
4 changed files with 63 additions and 1 deletions

View File

@@ -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,

View File

@@ -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];

View File

@@ -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 );

View File

@@ -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,