namespace Msp {
namespace AL {
+Listener &Listener::instance()
+{
+ static Listener listener;
+ return listener;
+}
+
void Listener::attribute(ALenum attr, float v)
{
alListenerf(attr, v);
namespace AL {
/**
-Represents the listener in the 3D environment. There is only one listener in
-OpenAL - this class is not instantiable and all of its functions are static.
+Represents the listener in the 3D environment. This class is a singleton.
*/
class Listener
{
private:
- Listener();
+ Listener() { }
public:
- static void attribute(ALenum, float);
- static void attribute(ALenum, float, float, float);
- static void attribute(ALenum, const float *);
- static void set_position(float, float, float);
- static void set_gain(float);
+ static Listener &instance();
+
+ void attribute(ALenum, float);
+ void attribute(ALenum, float, float, float);
+ void attribute(ALenum, const float *);
+ void set_position(float, float, float);
+ void set_gain(float);
};
} // namespace AL