OpenShot Audio Library | OpenShotAudio  0.3.1
juce_MPESynthesiserVoice.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 //==============================================================================
37 class JUCE_API MPESynthesiserVoice
38 {
39 public:
40  //==============================================================================
43 
45  virtual ~MPESynthesiserVoice();
46 
51  MPENote getCurrentlyPlayingNote() const noexcept { return currentlyPlayingNote; }
52 
56  bool isCurrentlyPlayingNote (MPENote note) const noexcept;
57 
62  virtual bool isActive() const { return currentlyPlayingNote.isValid(); }
63 
65  bool isPlayingButReleased() const noexcept;
66 
70  virtual void noteStarted() = 0;
71 
84  virtual void noteStopped (bool allowTailOff) = 0;
85 
90  virtual void notePressureChanged() = 0;
91 
99  virtual void notePitchbendChanged() = 0;
100 
105  virtual void noteTimbreChanged() = 0;
106 
114  virtual void noteKeyStateChanged() = 0;
115 
131  virtual void renderNextBlock (AudioBuffer<float>& outputBuffer,
132  int startSample,
133  int numSamples) = 0;
134 
140  virtual void renderNextBlock (AudioBuffer<double>& /*outputBuffer*/,
141  int /*startSample*/,
142  int /*numSamples*/) {}
143 
152  virtual void setCurrentSampleRate (double newRate) { currentSampleRate = newRate; }
153 
157  double getSampleRate() const noexcept { return currentSampleRate; }
158 
162  uint32 noteOnTime = 0;
163 
164 protected:
165  //==============================================================================
178  void clearCurrentNote() noexcept;
179 
180  //==============================================================================
181  double currentSampleRate = 0.0;
182  MPENote currentlyPlayingNote;
183 
184 private:
185  //==============================================================================
186  friend class MPESynthesiser;
187 
188  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiserVoice)
189 };
190 
191 } // namespace juce
virtual void setCurrentSampleRate(double newRate)
MPENote getCurrentlyPlayingNote() const noexcept
double getSampleRate() const noexcept