1 /*******************************************************************************
2  * Copyright 2009-2016 Jörg Müller
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 
17 #include "fx/ADSR.h"
18 #include "fx/ADSRReader.h"
19 
20 AUD_NAMESPACE_BEGIN
21 
ADSR(std::shared_ptr<ISound> sound,float attack,float decay,float sustain,float release)22 ADSR::ADSR(std::shared_ptr<ISound> sound, float attack, float decay, float sustain, float release) :
23 		Effect(sound),
24 		m_attack(attack), m_decay(decay), m_sustain(sustain), m_release(release)
25 {
26 }
27 
getAttack() const28 float ADSR::getAttack() const
29 {
30 	return m_attack;
31 }
32 
setAttack(float attack)33 void ADSR::setAttack(float attack)
34 {
35 	m_attack = attack;
36 }
37 
getDecay() const38 float ADSR::getDecay() const
39 {
40 	return m_decay;
41 }
42 
setDecay(float decay)43 void ADSR::setDecay(float decay)
44 {
45 	m_decay = decay;
46 }
47 
getSustain() const48 float ADSR::getSustain() const
49 {
50 	return m_sustain;
51 }
52 
setSustain(float sustain)53 void ADSR::setSustain(float sustain)
54 {
55 	m_sustain = sustain;
56 }
57 
getRelease() const58 float ADSR::getRelease() const
59 {
60 	return m_release;
61 }
62 
setRelease(float release)63 void ADSR::setRelease(float release)
64 {
65 	m_release = release;
66 }
67 
createReader()68 std::shared_ptr<IReader> ADSR::createReader()
69 {
70 	return std::shared_ptr<IReader>(new ADSRReader(getReader(), m_attack, m_decay, m_sustain, m_release));
71 }
72 
73 AUD_NAMESPACE_END
74