From 1d81360a04e0e5c0a57b8be1708e29a3f2bde848 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 18 Jul 2006 05:22:07 +0000 Subject: Made OmApp a singleton git-svn-id: http://svn.drobilla.net/lad/ingen@95 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/OmApp.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/libs/engine/OmApp.cpp b/src/libs/engine/OmApp.cpp index a294afe3..0fcd8e1f 100644 --- a/src/libs/engine/OmApp.cpp +++ b/src/libs/engine/OmApp.cpp @@ -14,8 +14,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "config.h" #include "tuning.h" #include @@ -50,7 +49,18 @@ using std::cout; using std::cerr; using std::endl; namespace Om { -OmApp::OmApp(const char* port, AudioDriver* audio_driver) +Ingen::m_instance = NULL; + + +static void +Ingen::instantiate(const char* port, AudioDriver* audio_driver = 0) +{ + assert(!m_instance); + m_instance = new Ingen(port, audio_driver); +} + + +Ingen::Ingen(const char* port, AudioDriver* audio_driver) : m_audio_driver( (audio_driver) ? audio_driver : new JackAudioDriver() ), m_osc_receiver(new OSCReceiver(pre_processor_queue_size, port)), #ifdef HAVE_JACK_MIDI @@ -77,7 +87,7 @@ OmApp::OmApp(const char* port, AudioDriver* audio_driver) } -OmApp::~OmApp() +Ingen::~Ingen() { deactivate(); @@ -107,13 +117,13 @@ OmApp::~OmApp() * more elegant and extensible, but this is faster and simpler - for now. */ template<> -Driver* OmApp::driver() { return m_midi_driver; } +Driver* Ingen::driver() { return m_midi_driver; } template<> -Driver* OmApp::driver() { return m_audio_driver; } +Driver* Ingen::driver() { return m_audio_driver; } int -OmApp::main() +Ingen::main() { // Loop until quit flag is set (by OSCReceiver) while ( ! m_quit_flag) { @@ -139,7 +149,7 @@ OmApp::main() void -OmApp::activate() +Ingen::activate() { if (m_activated) return; @@ -168,7 +178,7 @@ OmApp::activate() void -OmApp::deactivate() +Ingen::deactivate() { if (!m_activated) return; -- cgit v1.2.1