soundoutput.h Source File - ClanLib SDK
Description: soundoutput.h Source File

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
47 class SoundOutput
48 {
49 public:
51 SoundOutput();
52
57 SoundOutput(int mixing_frequency, int latency = 50);
58
62 SoundOutput(const SoundOutput_Description &desc);
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
76 int get_mixing_frequency() const;
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
102 void remove_filter(SoundFilter &filter);
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;
111 friend class SoundBuffer_Session;
112 };
113
115}
clan::SoundBuffer_Session
SoundBuffer_Session provides control over a playing soundeffect.
Definition soundbuffer_session.h:51
clan::SoundBuffer
Sample interface in ClanLib.
Definition soundbuffer.h:56
clan::SoundFilter
Sound Filter Class.
Definition soundfilter.h:44
clan::SoundOutput_Description
Sound output description class.
Definition soundoutput_description.h:42
clan::SoundOutput
SoundOutput interface in ClanLib.
Definition soundoutput.h:48
clan::SoundOutput::remove_filter
void remove_filter(SoundFilter &filter)
Remove the sound filter from the session.
clan::SoundOutput::get_mixing_frequency
int get_mixing_frequency() const
Returns the mixing frequency for the sound output device.
clan::SoundOutput::get_global_volume
float get_global_volume() const
Returns the main volume of the sound output.
clan::SoundOutput::is_null
bool is_null() const
Returns true if this object is invalid.
Definition soundoutput.h:67
clan::SoundOutput::set_global_volume
void set_global_volume(float volume)
Sets the main/mixer volume on the sound output.
clan::SoundOutput::throw_if_null
void throw_if_null() const
Throw an exception if this object is invalid.
clan::SoundOutput::get_global_pan
float get_global_pan() const
Returns the main panning position of the sound output.
clan::SoundOutput::~SoundOutput
virtual ~SoundOutput()
clan::SoundOutput::stop_all
void stop_all()
Stops all sample playbacks on the sound output.
clan::SoundOutput::SoundOutput
SoundOutput()
Constructs a null instance.
clan::SoundOutput::SoundOutput
SoundOutput(int mixing_frequency, int latency=50)
Constructs a SoundOutput.
clan::SoundOutput::set_global_pan
void set_global_pan(float pan)
Sets the main panning position on the sound output.
clan::SoundOutput::get_mixing_latency
int get_mixing_latency() const
Returns the mixing latency in milliseconds.
clan::SoundOutput::get_name
const std::string & get_name() const
Name of the output device.
clan::SoundOutput::SoundOutput
SoundOutput(const SoundOutput_Description &desc)
Constructs a SoundOutput.
clan::SoundOutput::add_filter
void add_filter(SoundFilter &filter)
Adds the sound filter to the sound output.
clan::Sound
Sound interface in ClanLib.
Definition Sources/API/Sound/sound.h:45
clan
Definition clanapp.h:36