OpenShot Audio Library | OpenShotAudio
0.4.0
Loading...
Searching...
No Matches
juce_Sampler.h
1
/*
2
==============================================================================
3
4
This file is part of the JUCE library.
5
Copyright (c) 2022 - Raw Material Software Limited
6
7
JUCE is an open source library subject to commercial or open-source
8
licensing.
9
10
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11
Agreement and JUCE Privacy Policy.
12
13
End User License Agreement: www.juce.com/juce-7-licence
14
Privacy Policy: www.juce.com/juce-privacy-policy
15
16
Or: You may also use this code under the terms of the GPL v3 (see
17
www.gnu.org/licenses).
18
19
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21
DISCLAIMED.
22
23
==============================================================================
24
*/
25
26
namespace
juce
27
{
28
29
//==============================================================================
43
class
JUCE_API
SamplerSound
:
public
SynthesiserSound
44
{
45
public
:
46
//==============================================================================
65
SamplerSound
(
const
String
& name,
66
AudioFormatReader
& source,
67
const
BigInteger
& midiNotes,
68
int
midiNoteForNormalPitch
,
69
double
attackTimeSecs
,
70
double
releaseTimeSecs
,
71
double
maxSampleLengthSeconds
);
72
74
~SamplerSound
()
override
;
75
76
//==============================================================================
78
const
String
&
getName
()
const
noexcept
{
return
name; }
79
83
AudioBuffer<float>
*
getAudioData
()
const
noexcept
{
return
data.get(); }
84
85
//==============================================================================
87
void
setEnvelopeParameters
(
ADSR::Parameters
parametersToUse
) { params =
parametersToUse
; }
88
89
//==============================================================================
90
bool
appliesToNote (
int
midiNoteNumber
)
override
;
91
bool
appliesToChannel (
int
midiChannel)
override
;
92
93
private
:
94
//==============================================================================
95
friend
class
SamplerVoice
;
96
97
String
name;
98
std::unique_ptr<AudioBuffer<float>> data;
99
double
sourceSampleRate;
100
BigInteger
midiNotes;
101
int
length = 0, midiRootNote = 0;
102
103
ADSR::Parameters
params;
104
105
JUCE_LEAK_DETECTOR (
SamplerSound
)
106
};
107
108
109
//==============================================================================
120
class
JUCE_API
SamplerVoice
:
public
SynthesiserVoice
121
{
122
public
:
123
//==============================================================================
125
SamplerVoice
();
126
128
~SamplerVoice
()
override
;
129
130
//==============================================================================
131
bool
canPlaySound (
SynthesiserSound
*)
override
;
132
133
void
startNote (
int
midiNoteNumber
,
float
velocity
,
SynthesiserSound
*,
int
pitchWheel)
override
;
134
void
stopNote (
float
velocity
,
bool
allowTailOff
)
override
;
135
136
void
pitchWheelMoved (
int
newValue)
override
;
137
void
controllerMoved (
int
controllerNumber
,
int
newValue)
override
;
138
139
void
renderNextBlock (
AudioBuffer<float>
&,
int
startSample,
int
numSamples)
override
;
140
using
SynthesiserVoice::renderNextBlock;
141
142
private
:
143
//==============================================================================
144
double
pitchRatio = 0;
145
double
sourceSamplePosition = 0;
146
float
lgain = 0, rgain = 0;
147
148
ADSR
adsr;
149
150
JUCE_LEAK_DETECTOR (
SamplerVoice
)
151
};
152
153
}
// namespace juce
juce::ADSR
Definition
juce_ADSR.h:41
juce::AudioFormatReader
Definition
juce_AudioFormatReader.h:44
juce::BigInteger
Definition
juce_BigInteger.h:39
juce::Optional
Definition
juce_Optional.h:57
juce::SamplerSound
Definition
juce_Sampler.h:44
juce::SamplerSound::getAudioData
AudioBuffer< float > * getAudioData() const noexcept
Definition
juce_Sampler.h:83
juce::SamplerSound::setEnvelopeParameters
void setEnvelopeParameters(ADSR::Parameters parametersToUse)
Definition
juce_Sampler.h:87
juce::SamplerSound::getName
const String & getName() const noexcept
Definition
juce_Sampler.h:78
juce::SamplerVoice
Definition
juce_Sampler.h:121
juce::String
Definition
juce_String.h:53
juce::SynthesiserSound
Definition
juce_Synthesiser.h:42
juce::SynthesiserVoice
Definition
juce_Synthesiser.h:88
juce::ADSR::Parameters
Definition
juce_ADSR.h:56
JuceLibraryCode
modules
juce_audio_formats
sampler
juce_Sampler.h
Generated by
1.10.0