Audaspace  1.3.0
A high level audio library.
IHandle.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright 2009-2016 Jörg Müller
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 
17 #pragma once
18 
25 #include "Audaspace.h"
26 
28 
30 enum Status
31 {
32  STATUS_INVALID = 0,
36 };
37 
42 typedef void (*stopCallback)(void*);
43 
49 {
50 public:
54  virtual ~IHandle() {}
55 
62  virtual bool pause()=0;
63 
70  virtual bool resume()=0;
71 
79  virtual bool stop()=0;
80 
88  virtual bool getKeep()=0;
89 
98  virtual bool setKeep(bool keep)=0;
99 
108  virtual bool seek(float position)=0;
109 
115  virtual float getPosition()=0;
116 
128  virtual Status getStatus()=0;
129 
134  virtual float getVolume()=0;
135 
143  virtual bool setVolume(float volume)=0;
144 
149  virtual float getPitch()=0;
150 
158  virtual bool setPitch(float pitch)=0;
159 
165  virtual int getLoopCount()=0;
166 
175  virtual bool setLoopCount(int count)=0;
176 
186  virtual bool setStopCallback(stopCallback callback = 0, void* data = 0)=0;
187 };
188 
IHandle::pause
virtual bool pause()=0
Pauses a played back sound.
IHandle::~IHandle
virtual ~IHandle()
Destroys the handle.
Definition: IHandle.h:54
IHandle::getVolume
virtual float getVolume()=0
Retrieves the volume of a playing sound.
stopCallback
void(* stopCallback)(void *)
The stopCallback is called when a handle reaches the end of the stream and thus gets stopped.
Definition: IHandle.h:42
IHandle::setLoopCount
virtual bool setLoopCount(int count)=0
Sets the loop count of a playing sound.
IHandle::setVolume
virtual bool setVolume(float volume)=0
Sets the volume of a playing sound.
IHandle::getKeep
virtual bool getKeep()=0
Gets the behaviour of the device for a played back sound when the sound doesn't return any more sampl...
IHandle::seek
virtual bool seek(float position)=0
Seeks in a played back sound.
IHandle::stop
virtual bool stop()=0
Stops a played back or paused sound.
STATUS_STOPPED
@ STATUS_STOPPED
Sound is being paused.
Definition: IHandle.h:35
STATUS_PAUSED
@ STATUS_PAUSED
Sound is playing.
Definition: IHandle.h:34
IHandle::getStatus
virtual Status getStatus()=0
Returns the status of a played back sound.
IHandle::getLoopCount
virtual int getLoopCount()=0
Retrieves the loop count of a playing sound.
IHandle::setKeep
virtual bool setKeep(bool keep)=0
Sets the behaviour of the device for a played back sound when the sound doesn't return any more sampl...
AUD_NAMESPACE_END
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
IHandle::getPitch
virtual float getPitch()=0
Retrieves the pitch of a playing sound.
IHandle
The IHandle interface represents a playback handles of a specific device.
Definition: IHandle.h:49
IHandle::resume
virtual bool resume()=0
Resumes a paused sound.
IHandle::setStopCallback
virtual bool setStopCallback(stopCallback callback=0, void *data=0)=0
Sets the callback function that's called when the end of a playing sound is reached.
AUD_NAMESPACE_BEGIN
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
AUD_API
#define AUD_API
Used for exporting symbols in the shared library.
Definition: Audaspace.h:93
IHandle::getPosition
virtual float getPosition()=0
Retrieves the current playback position of a sound.
STATUS_PLAYING
@ STATUS_PLAYING
Invalid handle. Maybe due to stopping.
Definition: IHandle.h:33
IHandle::setPitch
virtual bool setPitch(float pitch)=0
Sets the pitch of a playing sound.
Status
Status
Status of a playback handle.
Definition: IHandle.h:31
Audaspace.h
The main header file of the library defining the namespace and basic data types.