Audaspace
1.9.0
A high level audio library.
Toggle main menu visibility
Loading...
Searching...
No Matches
fx
ADSRReader.h
Go to the documentation of this file.
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
#pragma once
18
24
25
#include "
fx/EffectReader.h
"
26
27
AUD_NAMESPACE_BEGIN
28
32
class
AUD_API
ADSRReader :
public
EffectReader
33
{
34
private
:
35
enum
ADSRState
36
{
37
ADSR_STATE_INVALID = 0,
38
ADSR_STATE_ATTACK = 1,
39
ADSR_STATE_DECAY = 2,
40
ADSR_STATE_SUSTAIN = 3,
41
ADSR_STATE_RELEASE = 4
42
};
43
47
float
m_attack;
48
52
float
m_decay;
53
57
float
m_sustain;
58
62
float
m_release;
63
67
ADSRState m_state;
68
72
float
m_level;
73
74
// delete copy constructor and operator=
75
ADSRReader(
const
ADSRReader&) =
delete
;
76
ADSRReader& operator=(
const
ADSRReader&) =
delete
;
77
78
void
AUD_LOCAL
nextState(ADSRState state);
79
80
public
:
89
ADSRReader
(std::shared_ptr<IReader> reader,
float
attack,
float
decay,
float
sustain,
float
release
);
90
91
virtual
~ADSRReader();
92
93
virtual
void
read
(
int
& length,
bool
& eos,
sample_t
* buffer);
94
98
void
release
();
99
};
100
101
AUD_NAMESPACE_END
AUD_NAMESPACE_END
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition
Audaspace.h:119
sample_t
float sample_t
Sample type.(float samples).
Definition
Audaspace.h:126
AUD_LOCAL
#define AUD_LOCAL
Used for hiding symbols from export in the shared library.
Definition
Audaspace.h:80
AUD_NAMESPACE_BEGIN
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition
Audaspace.h:116
AUD_API
#define AUD_API
Used for exporting symbols in the shared library.
Definition
Audaspace.h:93
EffectReader.h
The EffectReader class.
ADSRReader::read
virtual void read(int &length, bool &eos, sample_t *buffer)
Request to read the next length samples out of the source.
ADSRReader::release
void release()
Triggers the release.
ADSRReader::ADSRReader
ADSRReader(std::shared_ptr< IReader > reader, float attack, float decay, float sustain, float release)
Creates a new ADSR reader.
Generated by
1.17.0