DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit d1892e151f4fdeeb93f23beaddd69df6b53edeca
parent 14423c5eec85b7ef1b5f997a9e27bfc48487c24f
Author: falkTX <falktx@falktx.com>
Date:   Wed, 24 Nov 2021 22:46:10 +0000

Expose puglGetTime as Application::getTime

Diffstat:
Mdgl/Application.hpp | 9+++++++++
Mdgl/src/Application.cpp | 5+++++
Mdgl/src/ApplicationPrivateData.cpp | 7+++++++
Mdgl/src/ApplicationPrivateData.hpp | 3+++
4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/dgl/Application.hpp b/dgl/Application.hpp @@ -81,6 +81,15 @@ public: bool isStandalone() const noexcept; /** + Return the time in seconds. + + This is a monotonically increasing clock with high resolution.@n + The returned time is only useful to compare against other times returned by this function, + its absolute value has no meaning. + */ + double getTime() const; + + /** Add a callback function to be triggered on every idle cycle. You can add more than one, and remove them at anytime with removeIdleCallback(). Idle callbacks trigger right after OS event handling and Window idle events (within the same cycle). diff --git a/dgl/src/Application.cpp b/dgl/src/Application.cpp @@ -56,6 +56,11 @@ bool Application::isStandalone() const noexcept return pData->isStandalone; } +double Application::getTime() const +{ + return pData->getTime(); +} + void Application::addIdleCallback(IdleCallback* const callback) { DISTRHO_SAFE_ASSERT_RETURN(callback != nullptr,) diff --git a/dgl/src/ApplicationPrivateData.cpp b/dgl/src/ApplicationPrivateData.cpp @@ -152,6 +152,13 @@ void Application::PrivateData::quit() #endif } +double Application::PrivateData::getTime() const +{ + DISTRHO_SAFE_ASSERT_RETURN(world != nullptr, 0.0); + + return puglGetTime(world); +} + void Application::PrivateData::setClassName(const char* const name) { DISTRHO_SAFE_ASSERT_RETURN(world != nullptr,); diff --git a/dgl/src/ApplicationPrivateData.hpp b/dgl/src/ApplicationPrivateData.hpp @@ -91,6 +91,9 @@ struct Application::PrivateData { For standalone mode only. */ void quit(); + /** Get time via pugl */ + double getTime() const; + /** Set pugl world class name. */ void setClassName(const char* name);