soundoutput.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2016 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 
33 namespace clan
34 {
37 
38  class SoundFilter;
39  class SoundBuffer;
40  class SoundOutput_Description;
41  class SoundOutput_Impl;
42 
48  {
49  public:
51  SoundOutput();
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 
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 }
const std::string & get_name() const
Name of the output device.
Sound interface in ClanLib.
Definition: Sources/API/Sound/sound.h:44
Definition: clanapp.h:35
int get_mixing_latency() const
Returns the mixing latency in milliseconds.
void remove_filter(SoundFilter &filter)
Remove the sound filter from the session.
SoundBuffer_Session provides control over a playing soundeffect.
Definition: soundbuffer_session.h:50
Sound output description class.
Definition: soundoutput_description.h:41
virtual ~SoundOutput()
void stop_all()
Stops all sample playbacks on the sound output.
SoundOutput interface in ClanLib.
Definition: soundoutput.h:47
SoundOutput()
Constructs a null instance.
Sample interface in ClanLib.
Definition: soundbuffer.h:55
void throw_if_null() const
Throw an exception if this object is invalid.
bool is_null() const
Returns true if this object is invalid.
Definition: soundoutput.h:67
Sound Filter Class.
Definition: soundfilter.h:43
float get_global_pan() const
Returns the main panning position of the sound output.
void set_global_volume(float volume)
Sets the main/mixer volume on the sound output.
void add_filter(SoundFilter &filter)
Adds the sound filter to the sound output.
float get_global_volume() const
Returns the main volume of the sound output.
int get_mixing_frequency() const
Returns the mixing frequency for the sound output device.
void set_global_pan(float pan)
Sets the main panning position on the sound output.