Audaspace  1.9.0
A high level audio library.
IDevice.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 <memory>
26 
27 #include "respec/Specification.h"
28 #include "util/ILockable.h"
29 
31 
32 class IHandle;
33 class IReader;
34 class ISound;
35 
45 class IDevice : public ILockable
46 {
47 public:
51  virtual ~IDevice() {}
52 
56  virtual DeviceSpecs getSpecs() const=0;
57 
68  virtual std::shared_ptr<IHandle> play(std::shared_ptr<IReader> reader, bool keep = false)=0;
69 
80  virtual std::shared_ptr<IHandle> play(std::shared_ptr<ISound> sound, bool keep = false)=0;
81 
85  virtual void stopAll()=0;
86 
95  virtual void lock()=0;
96 
100  virtual void unlock()=0;
101 
106  virtual float getVolume() const=0;
107 
112  virtual void setVolume(float volume) = 0;
113 
120  typedef void (*syncFunction)(void*, int, float);
121 
122  virtual void seekSynchronizer(double time) = 0;
123  virtual double getSynchronizerPosition() = 0;
124  virtual void playSynchronizer() = 0;
125  virtual void stopSynchronizer() = 0;
126  virtual void setSyncCallback(syncFunction function, void* data) = 0;
127  virtual int isSynchronizerPlaying() = 0;
128 };
129 
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
This class represents a sound source as stream or as buffer which can be read for example by another ...
Definition: IReader.h:34
virtual void unlock()=0
Unlocks the previously locked device.
virtual void lock()=0
Locks the device.
Defines all important macros and basic data structures for stream format descriptions.
virtual ~IDevice()
Destroys the device.
Definition: IDevice.h:51
Specification of a sound device.
Definition: Specification.h:128
This class represents a type of sound source and saves the necessary values for it.
Definition: ISound.h:39
virtual void stopAll()=0
Stops all playing sounds.
virtual void setVolume(float volume)=0
Sets the overall device volume.
virtual float getVolume() const =0
Retrieves the overall device volume.
virtual std::shared_ptr< IHandle > play(std::shared_ptr< IReader > reader, bool keep=false)=0
Plays a sound source.
The ILockable interface.
#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 DeviceSpecs getSpecs() const =0
Returns the specification of the device.
This class provides an interface for lockable objects.
Definition: ILockable.h:33
The IDevice interface represents an output device for sound sources.
Definition: IDevice.h:45
void(* syncFunction)(void *, int, float)
The syncFunction is called when a synchronization event happens.
Definition: IDevice.h:120