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