OpenShot Audio Library | OpenShotAudio  0.3.2
juce_AudioProcessLoadMeasurer.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  By using JUCE, you agree to the terms of both the JUCE 5 End-User License
11  Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
12  27th April 2017).
13 
14  End User License Agreement: www.juce.com/juce-5-licence
15  Privacy Policy: www.juce.com/juce-5-privacy-policy
16 
17  Or: You may also use this code under the terms of the GPL v3 (see
18  www.gnu.org/licenses).
19 
20  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22  DISCLAIMED.
23 
24  ==============================================================================
25 */
26 
27 namespace juce
28 {
29 
30 //==============================================================================
38 {
39 public:
42 
45 
46  //==============================================================================
48  void reset();
49 
51  void reset (double sampleRate, int blockSize);
52 
54  double getLoadAsProportion() const;
55 
57  double getLoadAsPercentage() const;
58 
60  int getXRunCount() const;
61 
62  //==============================================================================
76  struct JUCE_API ScopedTimer
77  {
79  ~ScopedTimer();
80 
81  private:
83  double startTime;
84 
85  JUCE_DECLARE_NON_COPYABLE (ScopedTimer)
86  };
87 
92  void registerBlockRenderTime (double millisecondsTaken);
93 
94 private:
95  double cpuUsageMs = 0, timeToCpuScale = 0, msPerBlock = 0;
96  int xruns = 0;
97 };
98 
99 
100 } // namespace juce