summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-05-29 01:54:19 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-05-29 01:54:19 +0000
commitc3821a78162fe6d89455ab5ed4e925bafec2a845 (patch)
tree5c3937c797cecb03897a47daf881c214bdc2dff0 /libs/ardour/source_factory.cc
parent8855b1643c6e18f567bafb975478fa3bbaf56270 (diff)
totally untested initial code for MidiPlaylistSource, to provide for compound MIDI regions. putting it into SVN because my system might crash overnight :)
git-svn-id: svn://localhost/ardour2/branches/3.0@9626 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index afc92c450c..5ff2a6f4e4 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -30,6 +30,8 @@
#include "ardour/audioplaylist.h"
#include "ardour/audio_playlist_source.h"
+#include "ardour/midi_playlist.h"
+#include "ardour/midi_playlist_source.h"
#include "ardour/source_factory.h"
#include "ardour/sndfilesource.h"
#include "ardour/silentfilesource.h"
@@ -380,6 +382,29 @@ SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<
}
} else if (type == DataType::MIDI) {
+
+ try {
+
+ boost::shared_ptr<MidiPlaylist> ap = boost::dynamic_pointer_cast<MidiPlaylist>(p);
+
+ if (ap) {
+
+ if (copy) {
+ ap.reset (new MidiPlaylist (ap, start, len, name, true));
+ start = 0;
+ }
+
+ Source* src = new MidiPlaylistSource (s, orig, name, ap, chn, start, len, Source::Flag (0));
+ boost::shared_ptr<Source> ret (src);
+
+ SourceCreated (ret);
+ return ret;
+ }
+ }
+
+ catch (failed_constructor& err) {
+ /* relax - return at function scope */
+ }
}