From 9ca089d20dee0f0e74014086a7d8ac2c41c6e898 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 28 Jan 2006 16:54:25 +0000 Subject: [PATCH] important bug fix in handling GUI messages; destructive tracks now operational (lots of GUI stuff to fix for them) git-svn-id: svn://localhost/trunk/ardour2@302 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audio_track.cc | 8 ++++---- libs/ardour/diskstream.cc | 19 +++++++++++++++++-- libs/gtkmm2ext/gtk_ui.cc | 3 ++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index e93e411868..dd9648c7bf 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -33,12 +33,9 @@ #include #include - - #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); diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index b19f25be72..09f9fcdd9d 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -1062,7 +1062,9 @@ DiskStream::seek (jack_nframes_t frame, bool complete_refill) (*chan).capture_buf->reset (); if (destructive()) { DestructiveFileSource* dfs = dynamic_cast ((*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 (); diff --git a/libs/gtkmm2ext/gtk_ui.cc b/libs/gtkmm2ext/gtk_ui.cc index 6b0326ab67..747d4be0cd 100644 --- a/libs/gtkmm2ext/gtk_ui.cc +++ b/libs/gtkmm2ext/gtk_ui.cc @@ -522,6 +522,7 @@ UI::do_request (Request* req) case ErrorMessage: process_error_message (req->chn, req->msg); free (const_cast(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); } -- 2.30.2