diff options
author | David Robillard <d@drobilla.net> | 2007-01-16 00:11:55 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-01-16 00:11:55 +0000 |
commit | bf3a030a6753ae0ce6ea3c52fc7f8f77102262b0 (patch) | |
tree | 0ff24d624e47bffc2e942795210ba312808c0c16 /src/progs/ingenuity | |
parent | 8d20b981fa997d3a7f79fcb6f2120095949873a0 (diff) | |
download | ingen-bf3a030a6753ae0ce6ea3c52fc7f8f77102262b0.tar.gz ingen-bf3a030a6753ae0ce6ea3c52fc7f8f77102262b0.tar.bz2 ingen-bf3a030a6753ae0ce6ea3c52fc7f8f77102262b0.zip |
Deprecated patch loading.
git-svn-id: http://svn.drobilla.net/lad/ingen@261 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity')
-rw-r--r-- | src/progs/ingenuity/ThreadedLoader.cpp | 41 | ||||
-rw-r--r-- | src/progs/ingenuity/ThreadedLoader.h | 19 |
2 files changed, 34 insertions, 26 deletions
diff --git a/src/progs/ingenuity/ThreadedLoader.cpp b/src/progs/ingenuity/ThreadedLoader.cpp index 83b3d6b5..e63e7f54 100644 --- a/src/progs/ingenuity/ThreadedLoader.cpp +++ b/src/progs/ingenuity/ThreadedLoader.cpp @@ -18,7 +18,6 @@ #include <fstream> #include <cassert> #include <string> -#include "Loader.h" #include "PatchModel.h" using std::cout; using std::endl; @@ -26,11 +25,9 @@ namespace Ingenuity { ThreadedLoader::ThreadedLoader(SharedPtr<ModelEngineInterface> engine) -: _loader(new Loader(engine)) -, _serializer(new Serializer()) + : _deprecated_loader(engine) + , _loader(engine) { - assert(_loader != NULL); - // FIXME: rework this so the thread is only present when it's doing something (save mem) start(); } @@ -38,7 +35,6 @@ ThreadedLoader::ThreadedLoader(SharedPtr<ModelEngineInterface> engine) ThreadedLoader::~ThreadedLoader() { - delete _loader; } @@ -67,13 +63,26 @@ ThreadedLoader::load_patch(bool merge, { _mutex.lock(); - _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(_loader, &Loader::load), - data_base_uri, - engine_parent, - (engine_name) ? engine_name.get() : "", - "", - engine_data ))); + // FIXME: Filthy hack to load deprecated patches based on file extension + if (data_base_uri.substr(data_base_uri.length()-3) == ".om") { + _events.push_back(sigc::hide_return(sigc::bind( + sigc::mem_fun(_deprecated_loader, &DeprecatedLoader::load_patch), + data_base_uri, + engine_parent, + (engine_name) ? engine_name.get() : "", + (engine_poly) ? engine_poly.get() : 1, + engine_data, + false))); + } else { + _events.push_back(sigc::hide_return(sigc::bind( + sigc::mem_fun(_loader, &Loader::load), + data_base_uri, + engine_parent, + (engine_name) ? engine_name.get() : "", + // FIXME: poly here + "", + engine_data ))); + } _mutex.unlock(); @@ -102,9 +111,9 @@ ThreadedLoader::save_patch_event(SharedPtr<PatchModel> model, const string& file if (recursive) cerr << "FIXME: Recursive save." << endl; - _serializer->start_to_filename(filename); - _serializer->serialize(model); - _serializer->finish(); + _serializer.start_to_filename(filename); + _serializer.serialize(model); + _serializer.finish(); } diff --git a/src/progs/ingenuity/ThreadedLoader.h b/src/progs/ingenuity/ThreadedLoader.h index d5901a74..82080c94 100644 --- a/src/progs/ingenuity/ThreadedLoader.h +++ b/src/progs/ingenuity/ThreadedLoader.h @@ -28,14 +28,12 @@ #include "ModelEngineInterface.h" #include "ObjectModel.h" #include "Serializer.h" +#include "DeprecatedLoader.h" +#include "Loader.h" using std::string; using std::list; using boost::optional; -namespace Ingen { namespace Client { - class Loader; - class PatchModel; -} } using namespace Ingen::Client; namespace Ingenuity { @@ -58,8 +56,8 @@ public: ThreadedLoader(SharedPtr<ModelEngineInterface> engine); ~ThreadedLoader(); - Loader& loader() const { return *_loader; } - Serializer& serializer() const { return *_serializer; } + //Loader& loader() const { return *_loader; } + //Serializer& serializer() const { return *_serializer; } // FIXME: there's a pattern here.... // (same core interface as Loader/Serializer) @@ -83,10 +81,11 @@ private: void _whipped(); - Loader* const _loader; - Serializer* const _serializer; - Mutex _mutex; - list<Closure> _events; + DeprecatedLoader _deprecated_loader; + Loader _loader; + Serializer _serializer; + Mutex _mutex; + list<Closure> _events; }; |