diff options
-rw-r--r-- | src/libs/engine/OmApp.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libs/engine/OmApp.h b/src/libs/engine/OmApp.h index 240f356e..f59b15f5 100644 --- a/src/libs/engine/OmApp.h +++ b/src/libs/engine/OmApp.h @@ -39,15 +39,18 @@ template <typename T> class Driver; /** The main class for Om, the whole app lives in here * - * This class should not exist. + * A singleton, but shouldn't be (FIXME). Explicitly instantiated singleton + * to be exact - call instantiate before instance or suffer horrible death. * * \ingroup engine */ class OmApp { public: - OmApp(const char* const port, AudioDriver* audio_driver = 0); ~OmApp(); + + static void instantiate(const char* port, AudioDriver* audio_driver = 0); + OmApp& instance() { assert(m_instance); return *m_instance; } int main(); @@ -58,7 +61,6 @@ public: void activate(); void deactivate(); - AudioDriver* audio_driver() const { return m_audio_driver; } OSCReceiver* osc_receiver() const { return m_osc_receiver; } MidiDriver* midi_driver() const { return m_midi_driver; } @@ -75,10 +77,13 @@ public: template<typename T> Driver<T>* driver(); private: + OmApp(const char* port, AudioDriver* audio_driver = 0); + // Prevent copies OmApp(const OmApp&); OmApp& operator=(const OmApp&); - + + static OmApp* m_instance; AudioDriver* m_audio_driver; OSCReceiver* m_osc_receiver; |