From e96c36c1a7abb062e36efc0ac95c35fedcef922e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 8 Apr 2007 06:04:32 +0000 Subject: De-template-ification of port types (req. for LV2 MIDI, but nice code size reduction). LV2 MIDI patching support (LV2 style MIDI throughout, inc. internal plugins). git-svn-id: http://svn.drobilla.net/lad/ingen@415 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/Engine.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/libs/engine/Engine.cpp') diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index 387714f8..053528ff 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -88,16 +88,16 @@ Engine::~Engine() } -/* driver() template specializations. - * Due to the lack of RTTI, this needs to be implemented manually like this. - * If more types/drivers start getting added, it may be worth it to enable - * RTTI and put all the drivers into a map with typeid's as the key. That's - * more elegant and extensible, but this is faster and simpler - for now. - */ -template<> -Driver* Engine::driver() { return _midi_driver; } -template<> -Driver* Engine::driver() { return _audio_driver.get(); } +Driver* +Engine::driver(DataType type) +{ + if (type == DataType::FLOAT) + return _audio_driver.get(); + else if (type == DataType::MIDI) + return _midi_driver; + else + return NULL; +} int -- cgit v1.2.1