soundoutput.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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#pragma once
30
31#include <memory>
32
33namespace clan
34{
37
38 class SoundFilter;
39 class SoundBuffer;
40 class SoundOutput_Description;
41 class SoundOutput_Impl;
42
48 {
49 public:
52
57 SoundOutput(int mixing_frequency, int latency = 50);
58
63
64 virtual ~SoundOutput();
65
67 bool is_null() const { return !impl; }
68
70 void throw_if_null() const;
71
73 const std::string &get_name() const;
74
77
79 int get_mixing_latency() const;
80
82 float get_global_volume() const;
83
85 float get_global_pan() const;
86
88 void stop_all();
89
91 void set_global_volume(float volume);
92
94 void set_global_pan(float pan);
95
99 void add_filter(SoundFilter &filter);
100
103
104 private:
105 SoundOutput(const std::weak_ptr<SoundOutput_Impl> impl);
106
107 std::shared_ptr<SoundOutput_Impl> impl;
108
109 friend class SoundBuffer;
110 friend class Sound;
112 };
113
115}
SoundBuffer_Session provides control over a playing soundeffect.
Definition soundbuffer_session.h:51
Sample interface in ClanLib.
Definition soundbuffer.h:56
Sound Filter Class.
Definition soundfilter.h:44
Sound output description class.
Definition soundoutput_description.h:42
SoundOutput interface in ClanLib.
Definition soundoutput.h:48
void remove_filter(SoundFilter &filter)
Remove the sound filter from the session.
int get_mixing_frequency() const
Returns the mixing frequency for the sound output device.
float get_global_volume() const
Returns the main volume of the sound output.
bool is_null() const
Returns true if this object is invalid.
Definition soundoutput.h:67
void set_global_volume(float volume)
Sets the main/mixer volume on the sound output.
void throw_if_null() const
Throw an exception if this object is invalid.
float get_global_pan() const
Returns the main panning position of the sound output.
virtual ~SoundOutput()
void stop_all()
Stops all sample playbacks on the sound output.
SoundOutput()
Constructs a null instance.
SoundOutput(int mixing_frequency, int latency=50)
Constructs a SoundOutput.
void set_global_pan(float pan)
Sets the main panning position on the sound output.
int get_mixing_latency() const
Returns the mixing latency in milliseconds.
const std::string & get_name() const
Name of the output device.
SoundOutput(const SoundOutput_Description &desc)
Constructs a SoundOutput.
void add_filter(SoundFilter &filter)
Adds the sound filter to the sound output.
Sound interface in ClanLib.
Definition Sources/API/Sound/sound.h:45
Definition clanapp.h:36