add x10tv ati remote rework, android remote rework, wintv remote tweaks
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / playabletracks.C
index 80e655248476ec2b320e1935005ef17959884c8a..cf98666bb2388b59e65ef3707959e14f17958ff1 100644 (file)
@@ -22,6 +22,7 @@
 #include "automation.h"
 #include "edl.h"
 #include "edlsession.h"
+#include "localsession.h"
 #include "mwindow.h"
 #include "patchbay.h"
 #include "playabletracks.h"
 #include "transportque.h"
 
 
-PlayableTracks::PlayableTracks(EDL *edl,
-       int64_t current_position,
-       int direction,
-       int data_type,
-       int use_nudge)
+PlayableTracks::PlayableTracks(EDL *edl, int64_t current_position,
+               int direction, int data_type, int use_nudge)
  : ArrayList<Track*>()
 {
        this->data_type = data_type;
 
-       for(Track *current_track = edl->tracks->first;
-               current_track;
-               current_track = current_track->next)
-       {
-               if(is_playable(current_track, current_position, direction, use_nudge))
-               {
-// printf("PlayableTracks::PlayableTracks %d this=%p current_track=%p total=%d current_position=%jd\n",
-// __LINE__,
-// this,
-// current_track,
-// total,
-// current_position);
-                       append(current_track);
-               }
+       for( Track *track=edl->tracks->first; track; track=track->next ) {
+               if( is_playable(track, current_position, direction, use_nudge) )
+                       append(track);
        }
-// printf("PlayableTracks::PlayableTracks %d data_type=%d total=%d current_position=%jd\n",
-// __LINE__,
-// data_type,
-// total,
-// current_position);
 }
 
 PlayableTracks::~PlayableTracks()
@@ -69,31 +51,40 @@ PlayableTracks::~PlayableTracks()
 }
 
 
-int PlayableTracks::is_playable(Track *current_track,
-       int64_t position,
-       int direction,
-       int use_nudge)
+int PlayableTracks::is_playable(Track *current_track, int64_t position,
+               int direction, int use_nudge)
 {
        int result = 1;
        if(use_nudge) position += current_track->nudge;
        if(current_track->data_type != data_type) result = 0;
 
 // Track is off screen and not bounced to other modules
-       if(result)
-       {
-               if(!current_track->plugin_used(position, direction) &&
-                       !current_track->is_playable(position, direction))
+       if( result &&
+               !current_track->plugin_used(position, direction) &&
+               !current_track->is_playable(position, direction) )
                        result = 0;
-       }
-
 // Test play patch
-       if(!current_track->play)
-       {
-               result = 0;
+       if( result &&
+               !current_track->play )
+                       result = 0;
+       if( result ) {
+               EDL *edl = current_track->edl;
+               int solo_track_id = edl->local_session->solo_track_id;
+               if( solo_track_id >= 0 ) {
+                       int visible = 0;
+                       int current_id = current_track->get_id();
+                       Track *track = edl->tracks->first;
+                       while( track ) {
+                               int id = track->get_id();
+                               if( id == solo_track_id ) { visible = 1;  break; }
+                               if( id == current_id ) { visible = 0; break; }
+                               track = track->next;
+                       }
+                       if( !track ) visible = 1;
+                       result = visible;
+               }
        }
-
-       if(result)
-       {
+       if( result ) {
 // Test for playable edit
                if(!current_track->playable_edit(position, direction))
                {