diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SMFDriver.cpp | 6 | ||||
-rw-r--r-- | src/engine/machina/SMFDriver.hpp | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/engine/SMFDriver.cpp b/src/engine/SMFDriver.cpp index 181da52..3481222 100644 --- a/src/engine/SMFDriver.cpp +++ b/src/engine/SMFDriver.cpp @@ -36,7 +36,7 @@ namespace Machina { * @return the resulting machine. */ SharedPtr<Machine> -SMFDriver::learn(const Glib::ustring& uri) +SMFDriver::learn(const Glib::ustring& uri, unsigned track) { const string filename = Glib::filename_from_uri(uri); @@ -51,6 +51,10 @@ SMFDriver::learn(const Glib::ustring& uri) Raul::SMFReader reader; reader.open(filename); + + if ( ! reader.seek_to_track(track) ) + return SharedPtr<Machine>(); + Raul::BeatTime t = 0; unsigned char buf[4]; uint32_t ev_size; diff --git a/src/engine/machina/SMFDriver.hpp b/src/engine/machina/SMFDriver.hpp index e702534..f5d1229 100644 --- a/src/engine/machina/SMFDriver.hpp +++ b/src/engine/machina/SMFDriver.hpp @@ -34,7 +34,7 @@ class Machine; class SMFDriver : public Raul::SMFWriter, public boost::enable_shared_from_this<SMFDriver> { public: - SharedPtr<Machine> learn(const Glib::ustring& uri); + SharedPtr<Machine> learn(const Glib::ustring& uri, unsigned track=1); void run(SharedPtr<Machine> machine, Raul::BeatTime max_time); }; |