Audaspace  1.3.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 "respec/Specification.h"
26 #include "util/ILockable.h"
27 
28 #include <memory>
29 
31 
32 class IHandle;
33 class IReader;
34 class ISound;
35 class ISynchronizer;
36 
46 class IDevice : public ILockable
47 {
48 public:
52  virtual ~IDevice() {}
53 
57  virtual DeviceSpecs getSpecs() const=0;
58 
69  virtual std::shared_ptr<IHandle> play(std::shared_ptr<IReader> reader, bool keep = false)=0;
70 
81  virtual std::shared_ptr<IHandle> play(std::shared_ptr<ISound> sound, bool keep = false)=0;
82 
86  virtual void stopAll()=0;
87 
96  virtual void lock()=0;
97 
101  virtual void unlock()=0;
102 
107  virtual float getVolume() const=0;
108 
113  virtual void setVolume(float volume)=0;
114 
121 };
122 
ILockable.h
The ILockable interface.
IDevice::setVolume
virtual void setVolume(float volume)=0
Sets the overall device volume.
ISound
This class represents a type of sound source and saves the necessary values for it.
Definition: ISound.h:40
IDevice::unlock
virtual void unlock()=0
Unlocks the previously locked device.
IDevice::play
virtual std::shared_ptr< IHandle > play(std::shared_ptr< ISound > sound, bool keep=false)=0
Plays a sound source.
DeviceSpecs
Specification of a sound device.
Definition: Specification.h:120
IDevice::getSynchronizer
virtual ISynchronizer * getSynchronizer()=0
Retrieves the synchronizer for this device, which enables accurate synchronization between audio play...
ISynchronizer
This class enables global synchronization of several audio applications if supported.
Definition: ISynchronizer.h:39
IReader
This class represents a sound source as stream or as buffer which can be read for example by another ...
Definition: IReader.h:35
IDevice::play
virtual std::shared_ptr< IHandle > play(std::shared_ptr< IReader > reader, bool keep=false)=0
Plays a sound source.
Specification.h
Defines all important macros and basic data structures for stream format descriptions.
IDevice
The IDevice interface represents an output device for sound sources.
Definition: IDevice.h:47
AUD_NAMESPACE_END
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
IDevice::stopAll
virtual void stopAll()=0
Stops all playing sounds.
ILockable
This class provides an interface for lockable objects.
Definition: ILockable.h:34
IHandle
The IHandle interface represents a playback handles of a specific device.
Definition: IHandle.h:49
IDevice::getSpecs
virtual DeviceSpecs getSpecs() const =0
Returns the specification of the device.
AUD_NAMESPACE_BEGIN
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
IDevice::lock
virtual void lock()=0
Locks the device.
IDevice::getVolume
virtual float getVolume() const =0
Retrieves the overall device volume.
IDevice::~IDevice
virtual ~IDevice()
Destroys the device.
Definition: IDevice.h:52