fix DSP load bounds 0..1 and add unbound API
authorRobin Gareus <robin@gareus.org>
Wed, 16 Sep 2015 15:45:04 +0000 (17:45 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 16 Sep 2015 16:24:57 +0000 (18:24 +0200)
libs/ardour/ardour/dsp_load_calculator.h

index 7ee741aceb4b147d2a5af970b04bdb0f60145841..c7f8e2a2e02402055561e46f2d574aed5b1c699d 100644 (file)
@@ -93,12 +93,18 @@ public:
         */
        float get_dsp_load() const
        {
-               if (m_dsp_load > m_max_time_us) {
-                       return 1.0f;
-               }
-               if (m_dsp_load < 0.0f) {
-                       return 0.0f;
-               }
+               assert (m_dsp_load >= 0.f); // since stop > start is assured this cannot happen.
+               return std::min (1.f, m_dsp_load);
+       }
+
+       /**
+        * @return an unbound value representing the percentage of time spent between
+        * start and stop in proportion to the max expected time in microseconds(us).
+        * This is useful for cases to estimate overload (e.g. Dummy backend)
+        */
+       float get_dsp_load_unbound() const
+       {
+               assert (m_dsp_load >= 0.f);
                return m_dsp_load;
        }