Audaspace  1.4.0
A high level audio library.
PlaybackCategory.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2015-2016 Juan Francisco Crespo Galán
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 "devices/IHandle.h"
26 #include "devices/IDevice.h"
27 #include "VolumeStorage.h"
28 
29 #include <unordered_map>
30 #include <memory>
31 
33 
38 {
39 private:
43  unsigned int m_currentID;
44 
48  std::unordered_map<unsigned int, std::shared_ptr<IHandle>> m_handles;
49 
53  std::shared_ptr<IDevice> m_device;
54 
58  Status m_status;
59 
63  std::shared_ptr<VolumeStorage> m_volumeStorage;
64 
65  // delete copy constructor and operator=
66  PlaybackCategory(const PlaybackCategory&) = delete;
67  PlaybackCategory& operator=(const PlaybackCategory&) = delete;
68 
69 public:
74  PlaybackCategory(std::shared_ptr<IDevice> device);
76 
82  std::shared_ptr<IHandle> play(std::shared_ptr<ISound> sound);
83 
87  void resume();
88 
92  void pause();
93 
98  float getVolume();
99 
104  void setVolume(float volume);
105 
109  void stop();
110 
115  std::shared_ptr<VolumeStorage> getSharedVolume();
116 
121  void cleanHandles();
122 
123 private:
124  static void cleanHandleCallback(void* data);
125 };
126 
This class represents a category of related sounds which are currently playing and allows to control ...
Definition: PlaybackCategory.h:37
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
The IDevice interface.
#define AUD_API
Used for exporting symbols in the shared library.
Definition: Audaspace.h:93
Defines the IHandle interface as well as possible states of the handle.
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
The VolumeStorage class.
Status
Status of a playback handle.
Definition: IHandle.h:30