OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
juce_MPESynthesiserBase.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//==============================================================================
46 struct JUCE_API MPESynthesiserBase : public MPEInstrument::Listener
47{
48 public:
49 //==============================================================================
51 MPESynthesiserBase();
52
61 MPESynthesiserBase (MPEInstrument* instrument);
62
63 //==============================================================================
67 MPEZoneLayout getZoneLayout() const noexcept;
68
73 void setZoneLayout (MPEZoneLayout newLayout);
74
75 //==============================================================================
79 virtual void setCurrentPlaybackSampleRate (double sampleRate);
80
84 double getSampleRate() const noexcept { return sampleRate; }
85
86 //==============================================================================
95 template <typename floatType>
96 void renderNextBlock (AudioBuffer<floatType>& outputAudio,
97 const MidiBuffer& inputMidi,
98 int startSample,
99 int numSamples);
100
101 //==============================================================================
113 virtual void handleMidiEvent (const MidiMessage&);
114
115 //==============================================================================
136 void setMinimumRenderingSubdivisionSize (int numSamples, bool shouldBeStrict = false) noexcept;
137
138 //==============================================================================
149 void enableLegacyMode (int pitchbendRange = 2,
150 Range<int> channelRange = Range<int> (1, 17));
151
153 bool isLegacyModeEnabled() const noexcept;
154
156 Range<int> getLegacyModeChannelRange() const noexcept;
157
159 void setLegacyModeChannelRange (Range<int> channelRange);
160
162 int getLegacyModePitchbendRange() const noexcept;
163
165 void setLegacyModePitchbendRange (int pitchbendRange);
166
167 //==============================================================================
168 using TrackingMode = MPEInstrument::TrackingMode;
169
171 void setPressureTrackingMode (TrackingMode modeToUse);
172
174 void setPitchbendTrackingMode (TrackingMode modeToUse);
175
177 void setTimbreTrackingMode (TrackingMode modeToUse);
178
179protected:
180 //==============================================================================
184 virtual void renderNextSubBlock (AudioBuffer<float>& outputAudio,
185 int startSample,
186 int numSamples) = 0;
187
191 virtual void renderNextSubBlock (AudioBuffer<double>& /*outputAudio*/,
192 int /*startSample*/,
193 int /*numSamples*/) {}
194
195 protected:
196 //==============================================================================
198 std::unique_ptr<MPEInstrument> instrument;
199
200 private:
201 //==============================================================================
202 CriticalSection noteStateLock;
203 double sampleRate = 0.0;
204 int minimumSubBlockSize = 32;
205 bool subBlockSubdivisionIsStrict = false;
206
207 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiserBase)
208};
209
210} // namespace juce
juce::AudioBuffer
Definition: juce_AudioSampleBuffer.h:34
juce::CriticalSection
Definition: juce_CriticalSection.h:43
juce::MPEInstrument::Listener
Definition: juce_MPEInstrument.h:256
juce::MPEInstrument
Definition: juce_MPEInstrument.h:56
juce::MPEZoneLayout
Definition: juce_MPEZoneLayout.h:45
juce::MidiBuffer
Definition: juce_MidiBuffer.h:43
juce::MidiMessage
Definition: juce_MidiMessage.h:35
juce::Range
Definition: juce_Range.h:40
juce::MPESynthesiserBase
Definition: juce_MPESynthesiserBase.h:47
juce::MPESynthesiserBase::instrument
std::unique_ptr< MPEInstrument > instrument
Definition: juce_MPESynthesiserBase.h:198
juce::MPESynthesiserBase::getSampleRate
double getSampleRate() const noexcept
Definition: juce_MPESynthesiserBase.h:84