/*
* CINELERRA
* Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
+ * 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
int Track::has_speed()
{
FloatAutos *autos = (FloatAutos*)automation->autos[AUTOMATION_SPEED];
- if(autos)
- {
- if(autos->first)
- {
- for(FloatAuto *current = (FloatAuto*)autos->first;
- current;
- current = (FloatAuto*)current->next)
- {
- if(!EQUIV(current->get_value(), 1.0) ||
- !EQUIV(current->get_control_in_value(), 0.0) ||
- !EQUIV(current->get_control_out_value(), 0.0))
- {
- return 1;
- }
- }
+ if( autos ) {
+ FloatAuto *current = (FloatAuto*)autos->first;
+ for( ; current; current=(FloatAuto*)current->next ) {
+ if( !EQUIV(current->get_value(0), 1.0) ||
+ !EQUIV(current->get_control_in_value(), 0.0) ||
+ !EQUIV(current->get_control_out_value(), 0.0))
+ return 1;
+ if( current->curve_mode == FloatAuto::BUMP &&
+ !EQUIV(current->get_value(1), 1.0) )
+ return 1;
}
}
-
return 0;
}
+int64_t Track::speed_length(int64_t start, int64_t end)
+{
+ if( !has_speed() ) return end - start;
+ FloatAutos *speeds = (FloatAutos *) automation->autos[AUTOMATION_SPEED];
+ return speeds->automation_integral(start, end-start, PLAY_FORWARD);
+}
+
int Track::show_assets()
{
return expand_view || edl->session->show_assets ? 1 : 0;
return 0;
}
-int Track::paste_automation(double selectionstart, double total_length,
- double frame_rate, int64_t sample_rate,
- FileXML *file, int default_only, int active_only)
+int Track::paste_automation(FileXML *file,
+ double selectionstart, double src_length, double src_rate,
+ int default_only, int active_only)
{
// Only used for pasting automation alone.
- double scale = data_type == TRACK_AUDIO ?
- edl->session->sample_rate / sample_rate :
- edl->session->frame_rate / frame_rate ;
-
- total_length *= scale;
- int64_t start = to_units(selectionstart, 0);
- int64_t length = to_units(total_length, 1);
+ double dst_rate = data_type == TRACK_AUDIO ?
+ edl->session->sample_rate : edl->session->frame_rate;
+ double scale = dst_rate / src_rate;
+ int64_t start = to_units(selectionstart, 1);
+ int64_t length = to_units(selectionstart + src_length, 1) - start;
int result = 0;
int current_pluginset = 0;
//printf("Track::paste_automation 1\n");
int edit_edits, int edit_labels, int edit_plugins,
int edit_autos, Edits *trim_edits)
{
+ if( edit_edits )
+ edits->clear(start, end);
//printf("Track::clear 1 %d %d %d\n", edit_edits, edit_labels, edit_plugins);
if( edit_autos )
automation->clear(start, end, 0, 1);
plugin_set.values[i]->clear(start, end, edit_keyframes);
}
}
- if( edit_edits )
- edits->clear(start, end);
return 0;
}
set_fauto_xyz(AUTOMATION_CAMERA_X, x, y, z);
}
+int Track::is_hidden()
+{
+ if( master ) return 0;
+ if( edl->local_session->gang_tracks == GANG_MEDIA ) return 1;
+ if( edl->local_session->gang_tracks == GANG_CHANNELS ) {
+ for( Track *track=previous; track; track=track->previous ) {
+ if( track->data_type == data_type ) return 1;
+ if( track->master ) return 0;
+ }
+ }
+ return 0;
+}
+
Track *Track::gang_master()
{
Track *track = this;
- switch( edl->session->gang_tracks ) {
+ switch( edl->local_session->gang_tracks ) {
case GANG_NONE:
return track;
case GANG_CHANNELS: {
Track *current = track;
int data_type = track->data_type;
- while( current && !track->master ) {
+ while( current && !current->master ) {
if( !(current = current->previous) ) break;
if( current->data_type == data_type ) track = current;
- if( track->master ) break;
}
break; }
case GANG_MEDIA: {
return track;
}
-int Track::is_hidden()
+int Track::in_gang(Track *track)
{
- if( master ) return 0;
- if( edl->session->gang_tracks == GANG_MEDIA ) return 1;
- if( edl->session->gang_tracks == GANG_CHANNELS ) {
- for( Track *track=previous; track; track=track->previous ) {
- if( track->data_type == data_type ) return 1;
- if( track->master ) return 0;
- }
- }
- return 0;
+ if( edl->local_session->gang_tracks == GANG_NONE ) return ganged;
+ Track *current = this;
+ while( current && !current->master ) current = current->previous;
+ while( track && !track->master ) track = track->previous;
+ return current == track ? 1 : 0;
}
+
int Track::is_armed()
{
+// return armed && gang_master()->armed;
return gang_master()->armed;
}
int Track::is_ganged()
{
+// return ganged && gang_master()->ganged;
return gang_master()->ganged;
}
int Track::armed_gang(Track *track)
{
- if( edl->session->gang_tracks == GANG_NONE ) return ganged;
+// if( !track->ganged ) return 0;
+ if( edl->local_session->gang_tracks == GANG_NONE ) return ganged;
Track *current = gang_master();
+// if( !current->ganged ) return 0;
for(;;) {
if( track == current ) return 1;
current = current->next;
return 1;
}
+int Track::plays()
+{
+ return play && gang_master()->play;
+}
int Track::index_in(Mixer *mixer)
{
return k;
}
+void Track::create_keyframes(double position, int mask, int mode)
+{
+ for( int idx=0; idx<AUTOMATION_TOTAL; mask>>=1,++idx ) {
+ if( !(mask & 1) ) continue;
+ Autos *autos = automation->autos[idx];
+ if( !autos ) continue;
+ FloatAuto *float_auto = (FloatAuto *)
+ autos->get_auto_for_editing(position, -1);
+ float_auto->change_curve_mode((FloatAuto::t_mode)mode, 0);
+ }
+}
+