mixer
[goodguy/history.git] / cinelerra-5.1 / cinelerra / tracks.C
index 9d994f471855e14b53bfe163ead38b21916f20db..1eec0d4179c1dcae49829432aa7027c5c4666e6a 100644 (file)
@@ -402,23 +402,21 @@ int Tracks::detach_shared_effects(int module)
 int Tracks::total_of(int type)
 {
        int result = 0;
-       IntAuto *mute_keyframe = 0;
 
        for(Track *current = first; current; current = NEXT)
        {
                long unit_start = current->to_units(edl->local_session->get_selectionstart(1), 0);
-               mute_keyframe =
-                       (IntAuto*)current->automation->autos[AUTOMATION_MUTE]->get_prev_auto(
-                       unit_start,
-                       PLAY_FORWARD,
-                       (Auto* &)mute_keyframe);
+               Auto *mute_keyframe = 0;
+               current->automation->autos[AUTOMATION_MUTE]->
+                       get_prev_auto(unit_start, PLAY_FORWARD, mute_keyframe);
+               IntAuto *mute_auto = (IntAuto *)mute_keyframe;
 
                result +=
                        (current->play && type == PLAY) ||
                        (current->record && type == RECORD) ||
                        (current->gang && type == GANG) ||
                        (current->draw && type == DRAW) ||
-                       (mute_keyframe->value && type == MUTE) ||
+                       (mute_auto->value && type == MUTE) ||
                        (current->expand_view && type == EXPAND);
        }
        return result;
@@ -493,15 +491,18 @@ double Tracks::total_playable_length()
        double total = 0;
        for(Track *current = first; current; current = NEXT)
        {
-               double length = current->get_length();
-               if(length > total) total = length;
+               if( current->play )
+               {
+                       double length = current->get_length();
+                       if(length > total) total = length;
+               }
        }
        return total;
 }
 
 double Tracks::total_recordable_length()
 {
-       double total = 0;
+       double total = -1;
        for(Track *current = first; current; current = NEXT)
        {
                if(current->record)
@@ -518,7 +519,8 @@ double Tracks::total_length()
        double total = 0;
        for(Track *current = first; current; current = NEXT)
        {
-               if(current->get_length() > total) total = current->get_length();
+               double length = current->get_length();
+               if(length > total) total = length;
        }
        return total;
 }