13
0

allow to set custom file name for each diststream

This commit is contained in:
Robin Gareus 2014-06-26 19:04:06 +02:00
parent c596e8dd87
commit 7cb6e9065a
7 changed files with 67 additions and 8 deletions

View File

@ -108,6 +108,7 @@ class LIBARDOUR_API AudioDiskstream : public Diskstream
int remove_channel (uint32_t how_many);
bool set_name (std::string const &);
bool set_write_source_name (const std::string& str);
/* stateful */

View File

@ -70,6 +70,15 @@ class LIBARDOUR_API Diskstream : public SessionObject, public PublicDiskstream
virtual ~Diskstream();
virtual bool set_name (const std::string& str);
virtual bool set_write_source_name (const std::string& str);
std::string write_source_name () const {
if (_write_source_name.empty()) {
return name();
} else {
return _write_source_name;
}
}
virtual std::string steal_write_source_name () { return std::string(); }
@ -312,6 +321,8 @@ class LIBARDOUR_API Diskstream : public SessionObject, public PublicDiskstream
bool in_set_state;
std::string _write_source_name;
Glib::Threads::Mutex state_lock;
PBD::ScopedConnectionList playlist_connections;

View File

@ -76,6 +76,7 @@ class LIBARDOUR_API MidiDiskstream : public Diskstream
int use_copy_playlist ();
bool set_name (std::string const &);
bool set_write_source_name (const std::string& str);
/* stateful */
XMLNode& get_state(void);

View File

@ -1908,7 +1908,7 @@ AudioDiskstream::use_new_write_source (uint32_t n)
try {
if ((chan->write_source = _session.create_audio_source_for_session (
n_channels().n_audio(), name(), n, destructive())) == 0) {
n_channels().n_audio(), write_source_name(), n, destructive())) == 0) {
throw failed_constructor();
}
}
@ -2451,6 +2451,9 @@ AudioDiskstream::ChannelInfo::~ChannelInfo ()
bool
AudioDiskstream::set_name (string const & name)
{
if (_name == name) {
return true;
}
Diskstream::set_name (name);
/* get a new write source so that its name reflects the new diskstream name */
@ -2465,3 +2468,24 @@ AudioDiskstream::set_name (string const & name)
return true;
}
bool
AudioDiskstream::set_write_source_name (const std::string& str) {
if (_write_source_name == str) {
return true;
}
Diskstream::set_write_source_name (str);
if (_write_source_name == name()) {
return true;
}
boost::shared_ptr<ChannelList> c = channels.reader();
ChannelList::iterator i;
int n = 0;
for (n = 0, i = c->begin(); i != c->end(); ++i, ++n) {
use_new_write_source (n);
}
return true;
}

View File

@ -437,7 +437,13 @@ Diskstream::set_name (const string& str)
playlist()->set_name (str);
SessionObject::set_name(str);
}
return true;
return true;
}
bool
Diskstream::set_write_source_name (const std::string& str) {
_write_source_name = str;
return true;
}
XMLNode&

View File

@ -1223,7 +1223,7 @@ MidiDiskstream::use_new_write_source (uint32_t n)
try {
_write_source = boost::dynamic_pointer_cast<SMFSource>(
_session.create_midi_source_for_session (name ()));
_session.create_midi_source_for_session (write_source_name ()));
if (!_write_source) {
throw failed_constructor();
@ -1441,6 +1441,9 @@ MidiDiskstream::get_playback (MidiBuffer& dst, framecnt_t nframes)
bool
MidiDiskstream::set_name (string const & name)
{
if (_name == name) {
return true;
}
Diskstream::set_name (name);
/* get a new write source so that its name reflects the new diskstream name */
@ -1449,6 +1452,19 @@ MidiDiskstream::set_name (string const & name)
return true;
}
bool
MidiDiskstream::set_write_source_name (const std::string& str) {
if (_write_source_name == str) {
return true;
}
Diskstream::set_write_source_name (str);
if (_write_source_name == name()) {
return true;
}
use_new_write_source (0);
return true;
}
boost::shared_ptr<MidiBuffer>
MidiDiskstream::get_gui_feed_buffer () const
{

View File

@ -3562,14 +3562,14 @@ Route::save_as_template (const string& path, const string& name)
bool
Route::set_name (const string& str)
{
bool ret;
string ioproc_name;
string name;
if (str == name()) {
return true;
}
name = Route::ensure_track_or_route_name (str, _session);
string name = Route::ensure_track_or_route_name (str, _session);
SessionObject::set_name (name);
ret = (_input->set_name(name) && _output->set_name(name));
bool ret = (_input->set_name(name) && _output->set_name(name));
if (ret) {
/* rename the main outs. Leave other IO processors