OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
juce_MPESynthesiser.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
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
23 namespace juce
24{
25
26//==============================================================================
54 class JUCE_API MPESynthesiser : public MPESynthesiserBase
55{
56 public:
57 //==============================================================================
63 MPESynthesiser();
64
72 MPESynthesiser (MPEInstrument* instrumentToUse);
73
75 ~MPESynthesiser() override;
76
77 //==============================================================================
79 void clearVoices();
80
82 int getNumVoices() const noexcept { return voices.size(); }
83
85 MPESynthesiserVoice* getVoice (int index) const;
86
95 void addVoice (MPESynthesiserVoice* newVoice);
96
98 void removeVoice (int index);
99
106 void reduceNumVoices (int newNumVoices);
107
116 virtual void turnOffAllVoices (bool allowTailOff);
117
118 //==============================================================================
125 void setVoiceStealingEnabled (bool shouldSteal) noexcept { shouldStealVoices = shouldSteal; }
126
128 bool isVoiceStealingEnabled() const noexcept { return shouldStealVoices; }
129
130 //==============================================================================
137 void setCurrentPlaybackSampleRate (double newRate) override;
138
139 //==============================================================================
154 void handleMidiEvent (const MidiMessage&) override;
155
163 virtual void handleController (int /*midiChannel*/,
164 int /*controllerNumber*/,
165 int /*controllerValue*/) {}
166
174 virtual void handleProgramChange (int /*midiChannel*/,
175 int /*programNumber*/) {}
176
177 protected:
178 //==============================================================================
191 void noteAdded (MPENote newNote) override;
192
206 void noteReleased (MPENote finishedNote) override;
207
214 void notePressureChanged (MPENote changedNote) override;
215
222 void notePitchbendChanged (MPENote changedNote) override;
223
230 void noteTimbreChanged (MPENote changedNote) override;
231
238 void noteKeyStateChanged (MPENote changedNote) override;
239
240 //==============================================================================
245 void renderNextSubBlock (AudioBuffer<float>& outputAudio,
246 int startSample,
247 int numSamples) override;
248
253 void renderNextSubBlock (AudioBuffer<double>& outputAudio,
254 int startSample,
255 int numSamples) override;
256
257 //==============================================================================
268 virtual MPESynthesiserVoice* findFreeVoice (MPENote noteToFindVoiceFor,
269 bool stealIfNoneAvailable) const;
270
283 virtual MPESynthesiserVoice* findVoiceToSteal (MPENote noteToStealVoiceFor = MPENote()) const;
284
290 void startVoice (MPESynthesiserVoice* voice, MPENote noteToStart);
291
298 void stopVoice (MPESynthesiserVoice* voice, MPENote noteToStop, bool allowTailOff);
299
300 //==============================================================================
301 OwnedArray<MPESynthesiserVoice> voices;
302 CriticalSection voicesLock;
303
304 private:
305 //==============================================================================
306 bool shouldStealVoices = false;
307 uint32 lastNoteOnCounter = 0;
308
309 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiser)
310};
311
312} // namespace juce
juce::AudioBuffer
Definition: juce_AudioSampleBuffer.h:34
juce::CriticalSection
Definition: juce_CriticalSection.h:43
juce::MPEInstrument
Definition: juce_MPEInstrument.h:56
juce::MPESynthesiserVoice
Definition: juce_MPESynthesiserVoice.h:38
juce::MPESynthesiser
Definition: juce_MPESynthesiser.h:55
juce::MPESynthesiser::isVoiceStealingEnabled
bool isVoiceStealingEnabled() const noexcept
Definition: juce_MPESynthesiser.h:128
juce::MPESynthesiser::getNumVoices
int getNumVoices() const noexcept
Definition: juce_MPESynthesiser.h:82
juce::MPESynthesiser::setVoiceStealingEnabled
void setVoiceStealingEnabled(bool shouldSteal) noexcept
Definition: juce_MPESynthesiser.h:125
juce::MPESynthesiser::handleProgramChange
virtual void handleProgramChange(int, int)
Definition: juce_MPESynthesiser.h:174
juce::MPESynthesiser::handleController
virtual void handleController(int, int, int)
Definition: juce_MPESynthesiser.h:163
juce::MidiMessage
Definition: juce_MidiMessage.h:35
juce::OwnedArray
Definition: juce_OwnedArray.h:51
juce::MPENote
Definition: juce_MPENote.h:40
juce::MPESynthesiserBase
Definition: juce_MPESynthesiserBase.h:47