2
* $Id: AUD_IDevice.h 25643 2010-01-01 05:09:30Z nexyon $
4
* ***** BEGIN LGPL LICENSE BLOCK *****
6
* Copyright 2009 Jörg Hermann Müller
2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* Copyright 2009-2011 Jörg Hermann Müller
8
6
* This file is part of AudaSpace.
10
* AudaSpace is free software: you can redistribute it and/or modify
11
* it under the terms of the GNU Lesser General Public License as published by
12
* the Free Software Foundation, either version 3 of the License, or
8
* Audaspace is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
13
11
* (at your option) any later version.
15
13
* AudaSpace is distributed in the hope that it will be useful,
16
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Lesser General Public License for more details.
20
* You should have received a copy of the GNU Lesser General Public License
21
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
23
* ***** END LGPL LICENSE BLOCK *****
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with Audaspace; if not, write to the Free Software Foundation,
20
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
* ***** END GPL LICENSE BLOCK *****
25
/** \file audaspace/intern/AUD_IDevice.h
26
* \ingroup audaspaceintern
30
#ifndef __AUD_IDEVICE_H__
31
#define __AUD_IDEVICE_H__
29
33
#include "AUD_Space.h"
32
/// Handle structure, for inherition.
34
#include "AUD_Reference.h"
35
#include "AUD_IFactory.h"
36
#include "AUD_IReader.h"
37
#include "AUD_IHandle.h"
38
40
* This class represents an output device for sound sources.
54
56
* Returns the specification of the device.
56
virtual AUD_DeviceSpecs getSpecs()=0;
58
virtual AUD_DeviceSpecs getSpecs() const=0;
61
* Plays a sound source.
62
* \param reader The reader to play.
63
* \param keep When keep is true the sound source will not be deleted but
64
* set to paused when its end has been reached.
65
* \return Returns a handle with which the playback can be controlled.
66
* This is NULL if the sound couldn't be played back.
67
* \exception AUD_Exception Thrown if there's an unexpected (from the
68
* device side) error during creation of the reader.
70
virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IReader> reader, bool keep = false)=0;
59
73
* Plays a sound source.
65
79
* \exception AUD_Exception Thrown if there's an unexpected (from the
66
80
* device side) error during creation of the reader.
68
virtual AUD_Handle* play(AUD_IFactory* factory, bool keep = false)=0;
71
* Pauses a played back sound.
72
* \param handle The handle returned by the play function.
74
* - true if the sound has been paused.
75
* - false if the sound isn't playing back or the handle is invalid.
77
virtual bool pause(AUD_Handle* handle)=0;
80
* Resumes a paused sound.
81
* \param handle The handle returned by the play function.
83
* - true if the sound has been resumed.
84
* - false if the sound isn't paused or the handle is invalid.
86
virtual bool resume(AUD_Handle* handle)=0;
89
* Stops a played back or paused sound. The handle is definitely invalid
91
* \param handle The handle returned by the play function.
93
* - true if the sound has been stopped.
94
* - false if the handle is invalid.
96
virtual bool stop(AUD_Handle* handle)=0;
99
* Sets the behaviour of the device for a played back sound when the sound
100
* doesn't return any more samples.
101
* \param handle The handle returned by the play function.
102
* \param keep True when the source should be paused and not deleted.
104
* - true if the behaviour has been changed.
105
* - false if the handle is invalid.
107
virtual bool setKeep(AUD_Handle* handle, bool keep)=0;
110
* Sends a message to a sound or all sounds that are currently played or
112
* \param handle The sound that should receive the message or NULL if all
113
* sounds should receive it.
114
* \param message The message.
115
* \return True if the message has been read by at least one sound.
117
virtual bool sendMessage(AUD_Handle* handle, AUD_Message &message)=0;
120
* Seeks in a played back sound.
121
* \param handle The handle returned by the play function.
122
* \param position The new position from where to play back, in seconds.
124
* - true if the handle is valid.
125
* - false if the handle is invalid.
126
* \warning Whether the seek works or not depends on the sound source.
128
virtual bool seek(AUD_Handle* handle, float position)=0;
131
* Retrieves the current playback position of a sound.
132
* \param handle The handle returned by the play function.
133
* \return The playback position in seconds, or 0.0 if the handle is
136
virtual float getPosition(AUD_Handle* handle)=0;
139
* Returns the status of a played back sound.
140
* \param handle The handle returned by the play function.
142
* - AUD_STATUS_INVALID if the sound has stopped or the handle is
144
* - AUD_STATUS_PLAYING if the sound is currently played back.
145
* - AUD_STATUS_PAUSED if the sound is currently paused.
148
virtual AUD_Status getStatus(AUD_Handle* handle)=0;
82
virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IFactory> factory, bool keep = false)=0;
85
* Stops all playing sounds.
87
virtual void stopAll()=0;
151
90
* Locks the device.
163
102
virtual void unlock()=0;
166
* Checks if a specific capability as available on a device.
167
* \param capability The capability.
168
* \return Whether it is available or not.
170
virtual bool checkCapability(int capability)=0;
173
* Set a value of a capability. The data behind the pointer depends on the
175
* \param capability The capability.
176
* \param value The value.
177
* \return Whether the action succeeded or not.
179
virtual bool setCapability(int capability, void *value)=0;
182
* Retrieves a value of a capability. The data behind the pointer depends on
184
* \param capability The capability.
185
* \param value The value.
186
* \return Whether the action succeeded or not.
188
virtual bool getCapability(int capability, void *value)=0;
105
* Retrieves the overall device volume.
106
* \return The overall device volume.
108
virtual float getVolume() const=0;
111
* Sets the overall device volume.
112
* \param handle The sound handle.
113
* \param volume The overall device volume.
115
virtual void setVolume(float volume)=0;
191
118
#endif //AUD_IDevice