Otclient  14/8/2020
combinedsoundsource.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #include "combinedsoundsource.h"
24 
26 {
27 }
28 
30 {
31  m_sources.push_back(source);
32 }
33 
35 {
36  for(const SoundSourcePtr& source : m_sources)
37  source->play();
38 }
39 
41 {
42  for(const SoundSourcePtr& source : m_sources)
43  source->stop();
44 }
45 
47 {
48  for(const SoundSourcePtr& source : m_sources) {
49  if(source->isBuffering())
50  return true;
51  }
52  return false;
53 }
54 
56 {
57  for(const SoundSourcePtr& source : m_sources) {
58  if(source->isPlaying())
59  return true;
60  }
61  return false;
62 }
63 
65 {
66  for(const SoundSourcePtr& source : m_sources)
67  source->setLooping(looping);
68 }
69 
71 {
72  for(const SoundSourcePtr& source : m_sources)
73  source->setRelative(relative);
74 }
75 
77 {
78  for(const SoundSourcePtr& source : m_sources)
79  source->setReferenceDistance(distance);
80 }
81 
83 {
84  for(const SoundSourcePtr& source : m_sources)
85  source->setGain(gain);
86 }
87 
89 {
90  for(const SoundSourcePtr& source : m_sources)
91  source->setPitch(pitch);
92 }
93 
95 {
96  for(const SoundSourcePtr& source : m_sources)
97  source->setPosition(pos);
98 }
99 
101 {
102  for(const SoundSourcePtr& source : m_sources)
103  source->setVelocity(velocity);
104 }
105 
107 {
108  for(const SoundSourcePtr& source : m_sources)
109  source->setFading(state, fadetime);
110 }
111 
113 {
114  for(const SoundSourcePtr& source : m_sources)
115  source->update();
116 }
SoundSource
Definition: soundsource.h:30
combinedsoundsource.h
SoundSource::FadeState
FadeState
Definition: soundsource.h:36
CombinedSoundSource::addSource
void addSource(const SoundSourcePtr &source)
Definition: combinedsoundsource.cpp:29
CombinedSoundSource::setPosition
void setPosition(const Point &pos)
Definition: combinedsoundsource.cpp:94
CombinedSoundSource::setLooping
void setLooping(bool looping)
Definition: combinedsoundsource.cpp:64
CombinedSoundSource::setFading
void setFading(FadeState state, float fadetime)
Definition: combinedsoundsource.cpp:106
CombinedSoundSource::isBuffering
bool isBuffering()
Definition: combinedsoundsource.cpp:46
CombinedSoundSource::update
virtual void update()
Definition: combinedsoundsource.cpp:112
CombinedSoundSource::setVelocity
void setVelocity(const Point &velocity)
Definition: combinedsoundsource.cpp:100
CombinedSoundSource::setPitch
void setPitch(float pitch)
Definition: combinedsoundsource.cpp:88
CombinedSoundSource::stop
void stop()
Definition: combinedsoundsource.cpp:40
stdext::shared_object_ptr< SoundSource >
CombinedSoundSource::setReferenceDistance
void setReferenceDistance(float distance)
Definition: combinedsoundsource.cpp:76
CombinedSoundSource::CombinedSoundSource
CombinedSoundSource()
Definition: combinedsoundsource.cpp:25
CombinedSoundSource::setGain
void setGain(float gain)
Definition: combinedsoundsource.cpp:82
CombinedSoundSource::play
void play()
Definition: combinedsoundsource.cpp:34
CombinedSoundSource::isPlaying
bool isPlaying()
Definition: combinedsoundsource.cpp:55
CombinedSoundSource::setRelative
void setRelative(bool relative)
Definition: combinedsoundsource.cpp:70
TPoint< int >