summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd/windows_timer_utils.h
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2015-09-14 10:29:00 +1000
committerTim Mayberry <mojofunk@gmail.com>2015-09-16 11:22:16 +1000
commita88b2da6a90b1d6f3004333a89761d312b02cf37 (patch)
treed8537fa4d18ee6606904550913d6f54abbd03a45 /libs/pbd/pbd/windows_timer_utils.h
parent62f75b8b162b479717bb7f9d9a8b5b65cd014512 (diff)
Fix PBD::MMTIMER::reset_resolution and add some documentation
timeEndPeriod must be called with the same timer resolution value used in timeBeginPeriod. When the process exits the timer resolution is restored anyway so this is not very important.
Diffstat (limited to 'libs/pbd/pbd/windows_timer_utils.h')
-rw-r--r--libs/pbd/pbd/windows_timer_utils.h32
1 files changed, 18 insertions, 14 deletions
diff --git a/libs/pbd/pbd/windows_timer_utils.h b/libs/pbd/pbd/windows_timer_utils.h
index 2e4f800bd5..72d3cc5431 100644
--- a/libs/pbd/pbd/windows_timer_utils.h
+++ b/libs/pbd/pbd/windows_timer_utils.h
@@ -26,30 +26,34 @@ namespace PBD {
namespace MMTIMERS {
/**
- * Set the minimum Multimedia Timer resolution as supported by the system
- * @return true if min timer resolution was successfully set
- *
- * Call reset_resolution to restore old timer resolution
+ * Get the minimum Multimedia Timer resolution as supported by the system
+ * @return true if getting min timer resolution was not successful
*/
-bool set_min_resolution ();
+bool get_min_resolution (uint32_t& timer_resolution_ms);
/**
- * Get current Multimedia Timer resolution
- * @return true if getting the timer value was successful
+ * Set the minimum Multimedia Timer resolution as supported by the system
+ * @return true if setting min timer resolution was successful
*/
-bool get_resolution(uint32_t& timer_resolution_us);
+bool set_min_resolution ();
/**
- * Set current Multimedia Timer resolution
- * @return true if setting the timer value was successful
+ * Set current Multimedia Timer resolution. If the timer resolution has already
+ * been set then reset_resolution() must be called before set_resolution will
+ * succeed.
+ * @return true if setting the timer value was successful, false if setting the
+ * timer resolution failed or the resolution has already been set.
*/
-bool set_resolution(uint32_t timer_resolution_us);
+bool set_resolution(uint32_t timer_resolution_ms);
/**
- * Reset the Multimedia Timer back to what it was originally before
- * setting the timer resolution.
+ * Reset Multimedia Timer resolution. In my testing, if the timer resolution is
+ * set below the default, then resetting the resolution will not reset the
+ * timer resolution back to 15ms. At least it does not reset immediately
+ * even after calling Sleep.
+ * @return true if setting the timer value was successful
*/
-bool reset_resolution ();
+bool reset_resolution();
} // namespace MMTIMERS