important bug fix in handling GUI messages; destructive tracks now operational (lots...
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 28 Jan 2006 16:54:25 +0000 (16:54 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sat, 28 Jan 2006 16:54:25 +0000 (16:54 +0000)
git-svn-id: svn://localhost/trunk/ardour2@302 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audio_track.cc
libs/ardour/diskstream.cc
libs/gtkmm2ext/gtk_ui.cc

index e93e4118689e0938ecdd6960258e2f46605311a1..dd9648c7bf1f133511c39f768c189dfd4ed3f2bb 100644 (file)
 #include <ardour/panner.h>
 #include <ardour/utils.h>
 
-
-
 #include "i18n.h"
 
 using namespace std;
-//using namespace sigc;
 using namespace ARDOUR;
 
 AudioTrack::AudioTrack (Session& sess, string name, Route::Flag flag, TrackMode mode)
@@ -56,7 +53,10 @@ AudioTrack::AudioTrack (Session& sess, string name, Route::Flag flag, TrackMode
 
        if (mode == Destructive) {
                dflags = DiskStream::Flag (dflags | DiskStream::Destructive);
-       } 
+               cerr << "Creating a new audio track, destructive mode\n";
+       } else {
+               cerr << "Creating a new audio track, NOT destructive mode\n";
+       }
 
        DiskStream* ds = new DiskStream (_session, name, dflags);
        
index b19f25be72ba1fed9c91c89db6ef9cf71045fe19..09f9fcdd9da111eb4ebc5368f069ffcd2defa9fa 100644 (file)
@@ -1062,7 +1062,9 @@ DiskStream::seek (jack_nframes_t frame, bool complete_refill)
                (*chan).capture_buf->reset ();
                if (destructive()) {
                        DestructiveFileSource* dfs = dynamic_cast<DestructiveFileSource*> ((*chan).write_source);
-                       dfs->seek (frame);
+                       if (dfs) {
+                               dfs->seek (frame);
+                       }
                }
        }
        
@@ -2007,7 +2009,20 @@ DiskStream::reset_write_sources (bool mark_write_complete, bool force)
        }
        
        if (!force && destructive()) {
-               return;
+
+               /* make sure we always have enough sources for the current channel count */
+
+               for (chan = channels.begin(), n = 0; chan != channels.end(); ++chan, ++n) {
+                       if ((*chan).write_source == 0) {
+                               break;
+                       }
+               }
+
+               if (chan == channels.end()) {
+                       return;
+               }
+
+               /* some channels do not have a write source */
        }
 
        capturing_sources.clear ();
index 6b0326ab67ed7ca8fcce6e2309c0609a6a99b62e..747d4be0cdb2dab79df930347281c280843a8076 100644 (file)
@@ -522,6 +522,7 @@ UI::do_request (Request* req)
        case ErrorMessage:
                process_error_message (req->chn, req->msg);
                free (const_cast<char*>(req->msg)); /* it was strdup'ed */
+               req->msg = 0; /* don't free it again in the destructor */
                break;
                
        case Quit:
@@ -594,7 +595,7 @@ UI::send_request (Request *req)
                        abort ();
                }
                
-               // cerr << "thread " << pthread_self() << " sent request " << req << " type = " << req->type << endl;
+               cerr << "thread " << pthread_self() << " sent request " << req << " type = " << req->type << endl;
                rbuf->increment_write_ptr (1);
                write (signal_pipe[1], &c, 1);
        }