summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorniels <niels@dyne.org>2015-08-05 19:23:19 (GMT)
committer niels <niels@dyne.org>2015-08-05 19:23:19 (GMT)
commit5f202a28b15673a19e445933aa584c26b52e2110 (patch)
treec85968771e66e9bb86564896bc6ca2ad07051aef
parente320fcd279596d912f18b29003502b0502bb68a5 (diff)
only set default fx values when fx id is changed, only clear/reset kf when fx id is changed
-rw-r--r--veejay-current/veejay-server/libsample/sampleadm.c86
-rw-r--r--veejay-current/veejay-server/libstream/vj-tag.c44
2 files changed, 68 insertions, 62 deletions
diff --git a/veejay-current/veejay-server/libsample/sampleadm.c b/veejay-current/veejay-server/libsample/sampleadm.c
index 2091993..a7a7a9f 100644
--- a/veejay-current/veejay-server/libsample/sampleadm.c
+++ b/veejay-current/veejay-server/libsample/sampleadm.c
@@ -2148,59 +2148,63 @@ int sample_chain_add(int s1, int c, int effect_nr)
if(!vj_effect_initialized(effect_nr, sample->effect_chain[c]->fx_instance) )
{
- int res = 0;
- sample->effect_chain[c]->fx_instance = vj_effect_activate( effect_nr, &res );
- if(!res)
- {
- veejay_msg(VEEJAY_MSG_ERROR, "Cannot activate %d", effect_nr);
- //@ clear
- sample->effect_chain[c]->effect_id = -1;
- sample->effect_chain[c]->e_flag = 1;
- int i;
- for( i = 0; i < SAMPLE_MAX_PARAMETERS; i ++ )
- sample->effect_chain[c]->arg[i] = 0;
-
- sample->effect_chain[c]->frame_trimmer = 0;
- return 0;
- }
+ int res = 0;
+ sample->effect_chain[c]->fx_instance = vj_effect_activate( effect_nr, &res );
+ if(!res)
+ {
+ veejay_msg(VEEJAY_MSG_ERROR, "Cannot activate %d", effect_nr);
+ //@ clear
+ sample->effect_chain[c]->effect_id = -1;
+ sample->effect_chain[c]->e_flag = 1;
+ int i;
+ for( i = 0; i < SAMPLE_MAX_PARAMETERS; i ++ )
+ sample->effect_chain[c]->arg[i] = 0;
+
+ sample->effect_chain[c]->frame_trimmer = 0;
+ return 0;
+ }
}
- sample->effect_chain[c]->effect_id = effect_nr;
- sample->effect_chain[c]->e_flag = 1; /* effect enabled standard */
effect_params = vj_effect_get_num_params(effect_nr);
- if (effect_params > 0)
- {
- /* there are parameters, set default values */
- for (i = 0; i < effect_params; i++)
- {
- int val = vj_effect_get_default(effect_nr, i);
- sample->effect_chain[c]->arg[i] = val;
- }
+ if( sample->effect_chain[c]->effect_id != effect_nr ) {
+ if( effect_params > 0 ) {
+ /* there are parameters, set default values */
+ for (i = 0; i < effect_params; i++)
+ {
+ int val = vj_effect_get_default(effect_nr, i);
+ sample->effect_chain[c]->arg[i] = val;
+ }
+ }
+ /* effect enabled standard */
+ sample->effect_chain[c]->e_flag = 1;
+ //clear fx anim
+ sample->effect_chain[c]->kf_status = 0;
+ sample->effect_chain[c]->kf_type = 0;
+ if(sample->effect_chain[c]->kf)
+ vpf(sample->effect_chain[c]->kf );
+ sample->effect_chain[c]->kf = NULL;
}
+
+ sample->effect_chain[c]->effect_id = effect_nr;
+
if (vj_effect_get_extra_frame(effect_nr))
- {
- //sample->effect_chain[c]->frame_offset = 0;
- sample->effect_chain[c]->frame_trimmer = 0;
+ {
+ //sample->effect_chain[c]->frame_offset = 0;
+ sample->effect_chain[c]->frame_trimmer = 0;
- if(s1 > 1)
- s1 = s1 - 1;
- if(!sample_exists(s1)) s1 = s1 + 1;
+ if(s1 > 1)
+ s1 = s1 - 1;
+ if(!sample_exists(s1)) s1 = s1 + 1;
- if(sample->effect_chain[c]->channel <= 0)
- sample->effect_chain[c]->channel = sample_size()-1; // follow newest
- if(sample->effect_chain[c]->source_type < 0)
- sample->effect_chain[c]->source_type = 0;
+ if(sample->effect_chain[c]->channel <= 0)
+ sample->effect_chain[c]->channel = sample_size()-1; // follow newest
+ if(sample->effect_chain[c]->source_type < 0)
+ sample->effect_chain[c]->source_type = 0;
veejay_msg(VEEJAY_MSG_DEBUG,"Effect %s on entry %d overlaying with sample %d",
vj_effect_get_description(sample->effect_chain[c]->effect_id),c,sample->effect_chain[c]->channel);
}
- //clear fx anim
- sample->effect_chain[c]->kf_status = 0;
- sample->effect_chain[c]->kf_type = 0;
- if(sample->effect_chain[c]->kf)
- vpf(sample->effect_chain[c]->kf );
- sample->effect_chain[c]->kf = NULL;
return 1; /* return position on which it was added */
}
diff --git a/veejay-current/veejay-server/libstream/vj-tag.c b/veejay-current/veejay-server/libstream/vj-tag.c
index 84f7c00..374198e 100644
--- a/veejay-current/veejay-server/libstream/vj-tag.c
+++ b/veejay-current/veejay-server/libstream/vj-tag.c
@@ -2152,28 +2152,30 @@ int vj_tag_set_effect(int t1, int position, int effect_id)
}
}
- tag->effect_chain[position]->effect_id = effect_id;
- tag->effect_chain[position]->e_flag = 1;
- params = vj_effect_get_num_params(effect_id);
- if (params > 0) {
- for (i = 0; i < params; i++) {
- int val = 0;
- val = vj_effect_get_default(effect_id, i);
- tag->effect_chain[position]->arg[i] = val;
+ if( tag->effect_chain[position]->effect_id != effect_id )
+ {
+ params = vj_effect_get_num_params(effect_id);
+ for (i = 0; i < params; i++) {
+ tag->effect_chain[position]->arg[i] = vj_effect_get_default(effect_id, i);
+ }
+ tag->effect_chain[position]->e_flag = 1;
+ tag->effect_chain[position]->kf_status = 0;
+ tag->effect_chain[position]->kf_type = 0;
+ if(tag->effect_chain[position]->kf)
+ vpf(tag->effect_chain[position]->kf );
+ // tag does not have chain_alloc_kf
+ tag->effect_chain[position]->kf = vpn(VEVO_ANONYMOUS_PORT );
}
- }
- if (vj_effect_get_extra_frame(effect_id)) {
- if(tag->effect_chain[position]->source_type < 0)
- tag->effect_chain[position]->source_type = 1;
- if(tag->effect_chain[position]->channel <= 0 )
- tag->effect_chain[position]->channel = t1;
- }
- tag->effect_chain[position]->kf_status = 0;
- tag->effect_chain[position]->kf_type = 0;
- if(tag->effect_chain[position]->kf)
- vpf(tag->effect_chain[position]->kf );
- tag->effect_chain[position]->kf = vpn(VEVO_ANONYMOUS_PORT );
+ tag->effect_chain[position]->effect_id = effect_id;
+
+
+ if (vj_effect_get_extra_frame(effect_id)) {
+ if(tag->effect_chain[position]->source_type < 0)
+ tag->effect_chain[position]->source_type = 1;
+ if(tag->effect_chain[position]->channel <= 0 )
+ tag->effect_chain[position]->channel = t1;
+ }
return 1;
}
@@ -3621,7 +3623,7 @@ int vj_tag_get_frame(int t1, uint8_t *buffer[3], uint8_t * abuffer)
//int vj_tag_sprint_status(int tag_id, int entry, int changed, char *str)
-int vj_tag_sprint_status( int tag_id,int cache,int sa, int ca, int pfps,int frame, int mode,int ts,int curfps, uint32_t lo, uint32_t hi, int macro, char *str )
+int vj_tag_sprint_status( int tag_id,int cache,int sa, int ca, int pfps,int frame,int mode,int ts,int curfps, uint32_t lo, uint32_t hi, int macro, char *str )
{
vj_tag *tag;
tag = vj_tag_get(tag_id);