X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fdiskstream.cc;h=5a8f26f17d696ded6808f9731573f7a86981fac8;hb=87f1c66ba1d33903662d44dabed032272827e7fd;hp=41f1eccdf7248dc3b62d6f5d69b96bedb12d22c5;hpb=30a9c2d05b422dc60e9f7c3e1cb35cd9d02accf2;p=ardour.git diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 41f1eccdf7..5a8f26f17d 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -42,6 +42,7 @@ #include "ardour/diskstream.h" #include "ardour/io.h" #include "ardour/pannable.h" +#include "ardour/profile.h" #include "ardour/playlist.h" #include "ardour/session.h" #include "ardour/track.h" @@ -53,12 +54,8 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -/* XXX This goes uninitialized when there is no ~/.config/ardour3 directory. - * I can't figure out why, so this will do for now (just stole the - * default from configuration_vars.h). 0 is not a good value for - * allocating buffer sizes.. - */ -ARDOUR::framecnt_t Diskstream::disk_io_chunk_frames = 1024 * 256 / sizeof (Sample); +ARDOUR::framecnt_t Diskstream::disk_read_chunk_frames = default_disk_read_chunk_frames (); +ARDOUR::framecnt_t Diskstream::disk_write_chunk_frames = default_disk_write_chunk_frames (); PBD::Signal0 Diskstream::DiskOverrun; PBD::Signal0 Diskstream::DiskUnderrun; @@ -68,6 +65,7 @@ Diskstream::Diskstream (Session &sess, const string &name, Flag flag) , i_am_the_modifier (0) , _track (0) , _record_enabled (0) + , _record_safe (0) , _visible_speed (1.0f) , _actual_speed (1.0f) , _buffer_reallocation_required (false) @@ -106,6 +104,7 @@ Diskstream::Diskstream (Session& sess, const XMLNode& /*node*/) , i_am_the_modifier (0) , _track (0) , _record_enabled (0) + , _record_safe (0) , _visible_speed (1.0f) , _actual_speed (1.0f) , _buffer_reallocation_required (false) @@ -462,7 +461,7 @@ Diskstream::get_state () { XMLNode* node = new XMLNode ("Diskstream"); char buf[64]; - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); node->add_property ("flags", enum_2_string (_flags)); node->add_property ("playlist", _playlist->name()); @@ -472,6 +471,7 @@ Diskstream::get_state () snprintf (buf, sizeof(buf), "%f", _visible_speed); node->add_property ("speed", buf); node->add_property ("capture-alignment", enum_2_string (_alignment_choice)); + node->add_property ("record-safe", _record_safe ? "yes" : "no"); if (_extra_xml) { node->add_child_copy (*_extra_xml); @@ -499,6 +499,11 @@ Diskstream::set_state (const XMLNode& node, int /*version*/) _flags = Flag (string_2_enum (prop->value(), _flags)); } + if (Profile->get_trx() && (_flags & Destructive)) { + error << string_compose (_("%1: this session uses destructive tracks, which are not supported"), PROGRAM_NAME) << endmsg; + return -1; + } + if ((prop = node.property (X_("capture-alignment"))) != 0) { set_align_choice (AlignChoice (string_2_enum (prop->value(), _alignment_choice)), true); } else { @@ -520,8 +525,12 @@ Diskstream::set_state (const XMLNode& node, int /*version*/) non_realtime_set_speed (); } } + + if ((prop = node.property ("record-safe")) != 0) { + _record_safe = PBD::string_is_affirmative (prop->value()) ? 1 : 0; + } - return 0; + return 0; } void @@ -772,3 +781,27 @@ Diskstream::disengage_record_enable () { g_atomic_int_set (&_record_enabled, 0); } + +void +Diskstream::engage_record_safe () +{ + g_atomic_int_set (&_record_safe, 1); +} + +void +Diskstream::disengage_record_safe () +{ + g_atomic_int_set (&_record_safe, 0); +} + +framecnt_t +Diskstream::default_disk_read_chunk_frames() +{ + return 65536; +} + +framecnt_t +Diskstream::default_disk_write_chunk_frames () +{ + return 65536; +}