Fix the horrible mess that was anything related to sources and paths.

Most significant changes:

 - Factor out FileSource from AudioFileSource, use for SMFSource too
 - Explicitly pass embedded rather than mysterious name mangling or whatever
 - Destroy a ton of duplicated or very-nearly-duplicated code
 - Clean up and document all that weird source stuff in session.cc


git-svn-id: svn://localhost/ardour2/branches/3.0@4609 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2009-02-17 02:11:49 +00:00
parent 4565b73a39
commit 022818b4a7
33 changed files with 983 additions and 1276 deletions

View file

@ -50,8 +50,7 @@ using namespace PBD;
sigc::signal<void,MidiSource *> MidiSource::MidiSourceCreated;
MidiSource::MidiSource (Session& s, string name, Source::Flag flags)
: Source (s, name, DataType::MIDI, flags)
, _timeline_position(0)
: Source (s, DataType::MIDI, name, flags)
, _read_data_count(0)
, _write_data_count(0)
, _converter(s, _timeline_position)
@ -62,7 +61,6 @@ MidiSource::MidiSource (Session& s, string name, Source::Flag flags)
MidiSource::MidiSource (Session& s, const XMLNode& node)
: Source (s, node)
, _timeline_position(0)
, _read_data_count(0)
, _write_data_count(0)
, _converter(s, _timeline_position)
@ -98,8 +96,6 @@ MidiSource::set_state (const XMLNode& node)
{
const XMLProperty* prop;
Source::set_state (node);
if ((prop = node.property ("captured-for")) != 0) {
_captured_for = prop->value();
}
@ -161,10 +157,10 @@ MidiSource::file_changed (string path)
}
void
MidiSource::set_timeline_position (nframes_t when)
MidiSource::set_timeline_position (int64_t pos)
{
_timeline_position = when;
_converter.set_origin(when);
Source::set_timeline_position(pos);
_converter.set_origin(pos);
}
void
@ -225,7 +221,8 @@ MidiSource::session_saved()
string newpath = _session.session_directory().midi_path().to_string() +"/"+ newname + ".mid";
boost::shared_ptr<MidiSource> newsrc = boost::dynamic_pointer_cast<MidiSource>(
SourceFactory::createWritable(DataType::MIDI, _session, newpath, 1, 0, true));
SourceFactory::createWritable(DataType::MIDI, _session,
newpath, true, false, _session.frame_rate()));
newsrc->set_timeline_position(_timeline_position);
_model->write_to(newsrc);