OpenShot Audio Library | OpenShotAudio  0.3.1
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 //==============================================================================
47 {
48 public:
49  //==============================================================================
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  //==============================================================================
169 
171  void setPressureTrackingMode (TrackingMode modeToUse);
172 
174  void setPitchbendTrackingMode (TrackingMode modeToUse);
175 
177  void setTimbreTrackingMode (TrackingMode modeToUse);
178 
179 protected:
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
virtual void renderNextSubBlock(AudioBuffer< double > &, int, int)
std::unique_ptr< MPEInstrument > instrument
double getSampleRate() const noexcept