Made a singleton
git-svn-id: http://svn.drobilla.net/lad@94 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
parent
2891e14e42
commit
246f424207
|
@ -39,15 +39,18 @@ template <typename T> class Driver;
|
||||||
|
|
||||||
/** The main class for Om, the whole app lives in here
|
/** 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
|
* \ingroup engine
|
||||||
*/
|
*/
|
||||||
class OmApp
|
class OmApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OmApp(const char* const port, AudioDriver* audio_driver = 0);
|
|
||||||
~OmApp();
|
~OmApp();
|
||||||
|
|
||||||
|
static void instantiate(const char* port, AudioDriver* audio_driver = 0);
|
||||||
|
OmApp& instance() { assert(m_instance); return *m_instance; }
|
||||||
|
|
||||||
int main();
|
int main();
|
||||||
|
|
||||||
|
@ -58,7 +61,6 @@ public:
|
||||||
void activate();
|
void activate();
|
||||||
void deactivate();
|
void deactivate();
|
||||||
|
|
||||||
|
|
||||||
AudioDriver* audio_driver() const { return m_audio_driver; }
|
AudioDriver* audio_driver() const { return m_audio_driver; }
|
||||||
OSCReceiver* osc_receiver() const { return m_osc_receiver; }
|
OSCReceiver* osc_receiver() const { return m_osc_receiver; }
|
||||||
MidiDriver* midi_driver() const { return m_midi_driver; }
|
MidiDriver* midi_driver() const { return m_midi_driver; }
|
||||||
|
@ -75,10 +77,13 @@ public:
|
||||||
template<typename T> Driver<T>* driver();
|
template<typename T> Driver<T>* driver();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
OmApp(const char* port, AudioDriver* audio_driver = 0);
|
||||||
|
|
||||||
// Prevent copies
|
// Prevent copies
|
||||||
OmApp(const OmApp&);
|
OmApp(const OmApp&);
|
||||||
OmApp& operator=(const OmApp&);
|
OmApp& operator=(const OmApp&);
|
||||||
|
|
||||||
|
static OmApp* m_instance;
|
||||||
|
|
||||||
AudioDriver* m_audio_driver;
|
AudioDriver* m_audio_driver;
|
||||||
OSCReceiver* m_osc_receiver;
|
OSCReceiver* m_osc_receiver;
|
||||||
|
|
Loading…
Reference in New Issue