-
Notifications
You must be signed in to change notification settings - Fork 0
/
Listener.hpp
50 lines (42 loc) · 1.16 KB
/
Listener.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef INC_LISTENER_H
#define INC_LISTENER_H
#include <stk/FileWvIn.h>
class Listener
{
private:
// Constructor
Listener ();
// Destructor
~Listener ();
float volume_;
static bool onoff_;
static stk::FileWvIn * audiofile_;
static Listener * singleton_;
public:
inline float * getVolumeP () { return &volume_; }
//inline stk::FileWvIn * getAudioFile () { return audiofile_; }
//inline void setAudioFile (stk::FileWvIn * file) { audiofile_ = file; }
stk::StkFloat tick (unsigned int channel = 0);
static inline bool isOn () { return onoff_; }
static inline void setOn () { onoff_ = true; }
static inline void setOff () { onoff_ = false; }
static inline bool * getOnOffP () { return &onoff_; }
static void openFile (std::string filename) { audiofile_ -> openFile (filename, false, true); }
static void closeFile () { if ( audiofile_->isOpen() ) audiofile_->closeFile (); }
// Singleton
static Listener *getInstance ()
{
if ( NULL == singleton_ )
singleton_ = new Listener;
return singleton_;
}
static void kill ()
{
if ( NULL != singleton_ )
{
delete singleton_;
singleton_ = NULL;
}
}
};
#endif