LMMS
Loading...
Searching...
No Matches
juce_MPESynthesiser.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 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
55{
56public:
57 //==============================================================================
64
71 MPESynthesiser (MPEInstrument& instrumentToUse);
72
74 ~MPESynthesiser() override;
75
76 //==============================================================================
78 void clearVoices();
79
81 int getNumVoices() const noexcept { return voices.size(); }
82
84 MPESynthesiserVoice* getVoice (int index) const;
85
94 void addVoice (MPESynthesiserVoice* newVoice);
95
97 void removeVoice (int index);
98
105 void reduceNumVoices (int newNumVoices);
106
115 virtual void turnOffAllVoices (bool allowTailOff);
116
117 //==============================================================================
124 void setVoiceStealingEnabled (bool shouldSteal) noexcept { shouldStealVoices = shouldSteal; }
125
128
129 //==============================================================================
136 void setCurrentPlaybackSampleRate (double newRate) override;
137
138 //==============================================================================
153 void handleMidiEvent (const MidiMessage&) override;
154
162 virtual void handleController (int /*midiChannel*/,
163 int /*controllerNumber*/,
164 int /*controllerValue*/) {}
165
173 virtual void handleProgramChange (int /*midiChannel*/,
174 int /*programNumber*/) {}
175
176protected:
177 //==============================================================================
190 void noteAdded (MPENote newNote) override;
191
205 void noteReleased (MPENote finishedNote) override;
206
213 void notePressureChanged (MPENote changedNote) override;
214
221 void notePitchbendChanged (MPENote changedNote) override;
222
229 void noteTimbreChanged (MPENote changedNote) override;
230
237 void noteKeyStateChanged (MPENote changedNote) override;
238
239 //==============================================================================
244 void renderNextSubBlock (AudioBuffer<float>& outputAudio,
245 int startSample,
246 int numSamples) override;
247
252 void renderNextSubBlock (AudioBuffer<double>& outputAudio,
253 int startSample,
254 int numSamples) override;
255
256 //==============================================================================
267 virtual MPESynthesiserVoice* findFreeVoice (MPENote noteToFindVoiceFor,
268 bool stealIfNoneAvailable) const;
269
282 virtual MPESynthesiserVoice* findVoiceToSteal (MPENote noteToStealVoiceFor = MPENote()) const;
283
289 void startVoice (MPESynthesiserVoice* voice, MPENote noteToStart);
290
297 void stopVoice (MPESynthesiserVoice* voice, MPENote noteToStop, bool allowTailOff);
298
299 //==============================================================================
302
303private:
304 //==============================================================================
305 std::atomic<bool> shouldStealVoices { false };
307
309};
310
311} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_AudioSampleBuffer.h:34
Definition juce_CriticalSection.h:43
Definition juce_MPEInstrument.h:54
bool isVoiceStealingEnabled() const noexcept
Definition juce_MPESynthesiser.h:127
CriticalSection voicesLock
Definition juce_MPESynthesiser.h:301
MPESynthesiser()
Definition juce_MPESynthesiser.cpp:26
void clearVoices()
Definition juce_MPESynthesiser.cpp:264
int getNumVoices() const noexcept
Definition juce_MPESynthesiser.h:81
void setVoiceStealingEnabled(bool shouldSteal) noexcept
Definition juce_MPESynthesiser.h:124
OwnedArray< MPESynthesiserVoice > voices
Definition juce_MPESynthesiser.h:300
std::atomic< bool > shouldStealVoices
Definition juce_MPESynthesiser.h:305
uint32 lastNoteOnCounter
Definition juce_MPESynthesiser.h:306
virtual void handleProgramChange(int, int)
Definition juce_MPESynthesiser.h:173
virtual void handleController(int, int, int)
Definition juce_MPESynthesiser.h:162
Definition juce_MPESynthesiserVoice.h:38
Definition juce_MidiMessage.h:35
Definition juce_OwnedArray.h:51
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
unsigned int uint32
Definition juce_MathsFunctions.h:45
Definition juce_MPENote.h:40
MPESynthesiserBase()
Definition juce_MPESynthesiserBase.cpp:26
#define const
Definition zconf.h:137