summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-07-18 05:16:37 +0000
committerDavid Robillard <d@drobilla.net>2006-07-18 05:16:37 +0000
commit36875bcf5c6d257e9173892d260db8462e849cb4 (patch)
treecd0bfb8ed55d6e941de2b0408f48525dadeb3c53 /src/libs
parentddaffbd41661e1bd24a9034331172c5d94f41241 (diff)
downloadingen-36875bcf5c6d257e9173892d260db8462e849cb4.tar.gz
ingen-36875bcf5c6d257e9173892d260db8462e849cb4.tar.bz2
ingen-36875bcf5c6d257e9173892d260db8462e849cb4.zip
Made a singleton
git-svn-id: http://svn.drobilla.net/lad/ingen@94 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/engine/OmApp.h13
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;