LMMS
Loading...
Searching...
No Matches
juce_Sampler.h
Go to the documentation of this file.
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
26namespace juce
27{
28
29//==============================================================================
44{
45public:
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
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
93private:
94 //==============================================================================
95 friend class SamplerVoice;
96
98 std::unique_ptr<AudioBuffer<float>> data;
101 int length = 0, midiRootNote = 0;
102
104
106};
107
108
109//==============================================================================
121{
122public:
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;
141
142private:
143 //==============================================================================
144 double pitchRatio = 0;
146 float lgain = 0, rgain = 0;
147
149
151};
152
153} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_ADSR.h:41
Definition juce_AudioSampleBuffer.h:34
Definition juce_AudioFormatReader.h:44
Definition juce_BigInteger.h:39
BigInteger midiNotes
Definition juce_Sampler.h:100
SamplerSound(const String &name, AudioFormatReader &source, const BigInteger &midiNotes, int midiNoteForNormalPitch, double attackTimeSecs, double releaseTimeSecs, double maxSampleLengthSeconds)
Definition juce_Sampler.cpp:29
friend class SamplerVoice
Definition juce_Sampler.h:95
int midiRootNote
Definition juce_Sampler.h:101
AudioBuffer< float > * getAudioData() const noexcept
Definition juce_Sampler.h:83
int length
Definition juce_Sampler.h:101
std::unique_ptr< AudioBuffer< float > > data
Definition juce_Sampler.h:98
String name
Definition juce_Sampler.h:97
double sourceSampleRate
Definition juce_Sampler.h:99
ADSR::Parameters params
Definition juce_Sampler.h:103
void setEnvelopeParameters(ADSR::Parameters parametersToUse)
Definition juce_Sampler.h:87
const String & getName() const noexcept
Definition juce_Sampler.h:78
void startNote(int midiNoteNumber, float velocity, SynthesiserSound *, int pitchWheel) override
Definition juce_Sampler.cpp:78
void controllerMoved(int controllerNumber, int newValue) override
Definition juce_Sampler.cpp:114
bool canPlaySound(SynthesiserSound *) override
Definition juce_Sampler.cpp:73
void renderNextBlock(AudioBuffer< float > &, int startSample, int numSamples) override
Definition juce_Sampler.cpp:117
double pitchRatio
Definition juce_Sampler.h:144
void pitchWheelMoved(int newValue) override
Definition juce_Sampler.cpp:113
SamplerVoice()
Definition juce_Sampler.cpp:70
float rgain
Definition juce_Sampler.h:146
void stopNote(float velocity, bool allowTailOff) override
Definition juce_Sampler.cpp:100
ADSR adsr
Definition juce_Sampler.h:148
float lgain
Definition juce_Sampler.h:146
double sourceSamplePosition
Definition juce_Sampler.h:145
Definition juce_String.h:53
Definition juce_Synthesiser.h:42
SynthesiserSound()
Definition juce_Synthesiser.cpp:26
SynthesiserVoice()
Definition juce_Synthesiser.cpp:30
virtual void renderNextBlock(AudioBuffer< float > &outputBuffer, int startSample, int numSamples)=0
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition juce_LeakedObjectDetector.h:138
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
Definition juce_ADSR.h:56
#define const
Definition zconf.h:137