13
0

never remove tape track source files even if empty, reconnect editor mute/solo buttons

git-svn-id: svn://localhost/ardour2/trunk@911 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-09-08 17:12:14 +00:00
parent 7c95da93ab
commit 3c45ab0846
5 changed files with 32 additions and 11 deletions

View File

@ -125,6 +125,11 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
visual_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::visual_click));
hide_button.signal_clicked().connect (mem_fun(*this, &RouteTimeAxisView::hide_click));
solo_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::solo_press), false);
solo_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::solo_release), false);
mute_button->signal_button_press_event().connect (mem_fun(*this, &RouteUI::mute_press), false);
mute_button->signal_button_release_event().connect (mem_fun(*this, &RouteUI::mute_release), false);
if (is_track()) {
rec_enable_button->set_active (false);
rec_enable_button->set_name ("TrackRecordEnableButton");

View File

@ -121,7 +121,6 @@ class AudioFileSource : public AudioSource {
string _path;
Flag _flags;
string _take_id;
bool allow_remove_if_empty;
uint64_t timeline_position;
static string peak_dir;

View File

@ -101,6 +101,7 @@ AudioFileSource::AudioFileSource (Session& s, const XMLNode& node)
AudioFileSource::~AudioFileSource ()
{
if (removable()) {
cerr << "Removing file " << _path << " because its removable\n";
unlink (_path.c_str());
unlink (peakpath.c_str());
}
@ -109,7 +110,7 @@ AudioFileSource::~AudioFileSource ()
bool
AudioFileSource::removable () const
{
return (_flags & Removable) && ((_flags & RemoveAtDestroy) || ((_flags & RemovableIfEmpty) && is_empty (_session, _path)));
return (_flags & Removable) && ((_flags & RemoveAtDestroy) || ((_flags & RemovableIfEmpty) && length() == 0));
}
int
@ -518,7 +519,7 @@ void
AudioFileSource::set_allow_remove_if_empty (bool yn)
{
if (writable()) {
allow_remove_if_empty = yn;
_flags = Flag (_flags | RemovableIfEmpty);
}
}

View File

@ -3183,16 +3183,34 @@ Session::RoutePublicOrderSorter::operator() (boost::shared_ptr<Route> a, boost::
void
Session::remove_empty_sounds ()
{
PathScanner scanner;
string dir;
dir = sound_dir ();
vector<string *>* possible_audiofiles = scanner (dir, "\\.wav$", false, true);
vector<string *>* possible_audiofiles = scanner (sound_dir(), "\\.(wav|aiff|caf|w64)$", false, true);
for (vector<string *>::iterator i = possible_audiofiles->begin(); i != possible_audiofiles->end(); ++i) {
Glib::Mutex::Lock lm (audio_source_lock);
regex_t compiled_tape_track_pattern;
int err;
if ((err = regcomp (&compiled_tape_track_pattern, "/T[0-9][0-9][0-9][0-9]-", REG_EXTENDED|REG_NOSUB))) {
char msg[256];
regerror (err, &compiled_tape_track_pattern, msg, sizeof (msg));
error << string_compose (_("Cannot compile tape track regexp for use (%1)"), msg) << endmsg;
return;
}
for (vector<string *>::iterator i = possible_audiofiles->begin(); i != possible_audiofiles->end(); ++i) {
/* never remove files that appear to be a tape track */
if (regexec (&compiled_tape_track_pattern, (*i)->c_str(), 0, 0, 0) == 0) {
delete *i;
continue;
}
if (AudioFileSource::is_empty (*this, *(*i))) {
unlink ((*i)->c_str());

View File

@ -302,7 +302,6 @@ Session::second_stage_init (bool new_session)
if (!new_session) {
if (load_state (_current_snapshot_name)) {
cerr << "load state failed\n";
return -1;
}
remove_empty_sounds ();
@ -1884,7 +1883,6 @@ Session::load_sources (const XMLNode& node)
boost::shared_ptr<Source>
Session::XMLSourceFactory (const XMLNode& node)
{
if (node.name() != "Source") {
return boost::shared_ptr<Source>();
}