soundoutput.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28
29
30 #pragma once
31
32 #include <memory>
33
34 namespace clan
35 {
38
39 class SoundFilter;
40 class SoundBuffer;
41 class SoundOutput_Description;
42 class SoundOutput_Impl;
43
48 class SoundOutput
49 {
52
53 public:
55 SoundOutput();
56
61 SoundOutput(int mixing_frequency, int latency = 50);
62
66 SoundOutput(const SoundOutput_Description &desc);
67
68 virtual ~SoundOutput();
69
73
74 public:
76 bool is_null() const { return !impl; }
77
79 void throw_if_null() const;
80
82 const std::string &get_name() const;
83
85 int get_mixing_frequency() const;
86
88 int get_mixing_latency() const;
89
91 float get_global_volume() const;
92
94 float get_global_pan() const;
95
99
100 public:
102 void stop_all();
103
105 void set_global_volume(float volume);
106
108 void set_global_pan(float pan);
109
113 void add_filter(SoundFilter &filter);
114
116 void remove_filter(SoundFilter &filter);
117
121
122 private:
123
127 SoundOutput(const std::weak_ptr<SoundOutput_Impl> impl);
128
129 std::shared_ptr<SoundOutput_Impl> impl;
130
131 friend class SoundBuffer;
132 friend class Sound;
133 friend class SoundBuffer_Session;
135 };
136
137 }
138
clan::Sound
Sound interface in ClanLib.
Definition: Sources/API/Sound/sound.h:46
clan
Definition: clanapp.h:35
clan::SoundOutput::remove_filter
void remove_filter(SoundFilter &filter)
Remove the sound filter from the session.
clan::SoundOutput::throw_if_null
void throw_if_null() const
Throw an exception if this object is invalid.
clan::SoundOutput::~SoundOutput
virtual ~SoundOutput()
clan::SoundOutput::get_global_volume
float get_global_volume() const
Returns the main volume of the sound output.
clan::SoundBuffer_Session
SoundBuffer_Session provides control over a playing soundeffect.
Definition: soundbuffer_session.h:51
clan::SoundOutput_Description
Sound output description class.
Definition: soundoutput_description.h:42
clan::SoundOutput
SoundOutput interface in ClanLib.
Definition: soundoutput.h:48
clan::SoundOutput::get_mixing_frequency
int get_mixing_frequency() const
Returns the mixing frequency for the sound output device.
clan::SoundOutput::get_global_pan
float get_global_pan() const
Returns the main panning position of the sound output.
clan::SoundBuffer
Sample interface in ClanLib.
Definition: soundbuffer.h:56
clan::StyleTokenType::string
@ keyword
clan::SoundOutput::set_global_volume
void set_global_volume(float volume)
Sets the main/mixer volume on the sound output.
clan::SoundOutput::get_name
const std::string & get_name() const
Name of the output device.
clan::SoundFilter
Sound Filter Class.
Definition: soundfilter.h:44
clan::SoundOutput::stop_all
void stop_all()
Stops all sample playbacks on the sound output.
clan::SoundOutput::get_mixing_latency
int get_mixing_latency() const
Returns the mixing latency in milliseconds.
clan::SoundOutput::add_filter
void add_filter(SoundFilter &filter)
Adds the sound filter to the sound output.
clan::SoundOutput::SoundOutput
SoundOutput()
Constructs a null instance.
clan::SoundOutput::set_global_pan
void set_global_pan(float pan)
Sets the main panning position on the sound output.
clan::SoundOutput::is_null
bool is_null() const
Returns true if this object is invalid.
Definition: soundoutput.h:76