20 #define AUD_BUILD_PLUGIN 56 static const int CYCLE_BUFFERS = 3;
62 std::shared_ptr<IReader> m_reader;
74 ALuint m_buffers[CYCLE_BUFFERS];
108 OpenALHandle(
const OpenALHandle&) =
delete;
109 OpenALHandle& operator=(
const OpenALHandle&) =
delete;
120 OpenALHandle(
OpenALDevice* device, ALenum format, std::shared_ptr<IReader> reader,
bool keep);
122 virtual ~OpenALHandle() {}
123 virtual bool pause();
124 virtual bool resume();
126 virtual bool getKeep();
127 virtual bool setKeep(
bool keep);
128 virtual bool seek(
double position);
129 virtual double getPosition();
130 virtual Status getStatus();
133 virtual float getPitch();
134 virtual bool setPitch(
float pitch);
135 virtual int getLoopCount();
136 virtual bool setLoopCount(
int count);
137 virtual bool setStopCallback(
stopCallback callback = 0,
void* data = 0);
140 virtual bool setLocation(
const Vector3& location);
142 virtual bool setVelocity(
const Vector3& velocity);
144 virtual bool setOrientation(
const Quaternion& orientation);
145 virtual bool isRelative();
146 virtual bool setRelative(
bool relative);
147 virtual float getVolumeMaximum();
148 virtual bool setVolumeMaximum(
float volume);
149 virtual float getVolumeMinimum();
150 virtual bool setVolumeMinimum(
float volume);
151 virtual float getDistanceMaximum();
152 virtual bool setDistanceMaximum(
float distance);
153 virtual float getDistanceReference();
154 virtual bool setDistanceReference(
float distance);
155 virtual float getAttenuation();
156 virtual bool setAttenuation(
float factor);
157 virtual float getConeAngleOuter();
158 virtual bool setConeAngleOuter(
float angle);
159 virtual float getConeAngleInner();
160 virtual bool setConeAngleInner(
float angle);
161 virtual float getConeVolumeOuter();
162 virtual bool setConeVolumeOuter(
float volume);
173 ALCcontext* m_context;
193 bool m_checkDisconnect;
198 std::list<std::shared_ptr<OpenALHandle> > m_playingSounds;
203 std::list<std::shared_ptr<OpenALHandle> > m_pausedSounds;
208 std::recursive_mutex m_mutex;
213 std::thread m_thread;
236 uint64_t m_synchronizerPosition{0};
237 std::shared_ptr<IHandle> m_silenceHandle;
277 virtual std::shared_ptr<IHandle>
play(std::shared_ptr<IReader> reader,
bool keep =
false);
278 virtual std::shared_ptr<IHandle>
play(std::shared_ptr<ISound> sound,
bool keep =
false);
285 virtual void seekSynchronizer(
double time);
286 virtual double getSynchronizerPosition();
287 virtual void playSynchronizer();
288 virtual void stopSynchronizer();
289 virtual void setSyncCallback(
syncFunction function,
void* data);
290 virtual int isSynchronizerPlaying();
This class represents a quaternion used for 3D rotations.
Definition: Math3D.h:205
This device plays through OpenAL.
Definition: OpenALDevice.h:47
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
virtual float getDopplerFactor() const =0
Retrieves the doppler factor.
virtual void stopAll()
Stops all playing sounds.
virtual std::shared_ptr< IHandle > play(std::shared_ptr< IReader > reader, bool keep=false)
Plays a sound source.
virtual DistanceModel getDistanceModel() const =0
Retrieves the distance model.
virtual float getVolume() const
Retrieves the overall device volume.
virtual void setVolume(float volume)
Sets the overall device volume.
virtual Vector3 getListenerLocation() const =0
Retrieves the listener location.
virtual void lock()
Locks the device.
virtual void setListenerOrientation(const Quaternion &orientation)=0
Sets the listener orientation.
virtual void unlock()
Unlocks the previously locked device.
Specification of a sound source.
Definition: Specification.h:118
virtual void setDistanceModel(DistanceModel model)=0
Sets the distance model.
The I3DHandle interface represents a playback handle for 3D sources.
Definition: I3DHandle.h:38
#define AUD_DEFAULT_BUFFER_SIZE
The default playback buffer size of a device.
Definition: Audaspace.h:103
static void registerPlugin()
Registers this plugin.
void(* stopCallback)(void *)
The stopCallback is called when a handle reaches the end of the stream and thus gets stopped...
Definition: IHandle.h:42
This class is a simple buffer in RAM which is 32 Byte aligned and provides resize functionality...
Definition: Buffer.h:33
virtual DeviceSpecs getSpecs() const
Returns the specification of the device.
Specification of a sound device.
Definition: Specification.h:128
static std::list< std::string > getDeviceNames()
Retrieves a list of available hardware devices to open with OpenAL.
virtual void setListenerVelocity(const Vector3 &velocity)=0
Sets the listener velocity.
virtual float getSpeedOfSound() const =0
Retrieves the speed of sound.
The I3DDevice interface represents an output device for 3D sound.
Definition: I3DDevice.h:52
Defines the IHandle interface as well as possible states of the handle.
virtual Quaternion getListenerOrientation() const =0
Retrieves the listener orientation.
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
The IHandle interface represents a playback handles of a specific device.
Definition: IHandle.h:48
virtual Vector3 getListenerVelocity() const =0
Retrieves the listener velocity.
Defines the I3DDevice interface as well as the different distance models.
#define AUD_PLUGIN_API
Used for exporting symbols in the shared library.
Definition: Audaspace.h:94
The IDevice interface represents an output device for sound sources.
Definition: IDevice.h:45
virtual void setDopplerFactor(float factor)=0
Sets the doppler factor.
This class represents a 3 dimensional vector.
Definition: Math3D.h:35
void(* syncFunction)(void *, int, float)
The syncFunction is called when a synchronization event happens.
Definition: IDevice.h:120
#define AUD_LOCAL
Used for hiding symbols from export in the shared library.
Definition: Audaspace.h:80
virtual void setSpeedOfSound(float speed)=0
Sets the speed of sound.
virtual void setListenerLocation(const Vector3 &location)=0
Sets the listener location.
Status
Status of a playback handle.
Definition: IHandle.h:30
DistanceModel
Possible distance models for the 3D device.
Definition: I3DDevice.h:34