summaryrefslogtreecommitdiff
path: root/src/mixer.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2018-07-19 21:17:07 +0200
committerPatric Stout <truebrain@openttd.org>2018-07-19 21:17:07 +0200
commit2a868b9f3b8e3b5f8b9e5f728f628ec88fd5e3ad (patch)
tree36da708e128fc68d9ceac32362503df43af2fc22 /src/mixer.cpp
parenta3d1950b656787b76fbccec1aedd63407c34c2f1 (diff)
downloadopenttd-2a868b9f3b8e3b5f8b9e5f728f628ec88fd5e3ad.tar.xz
Feature: Framerate display window (#6822)
Frame rate and various game loop/graphics timing measurements and graphs. Accessible via the Help menu, and can print some stats in the console via the fps command.
Diffstat (limited to 'src/mixer.cpp')
-rw-r--r--src/mixer.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mixer.cpp b/src/mixer.cpp
index 5945bd235..6aaa8204d 100644
--- a/src/mixer.cpp
+++ b/src/mixer.cpp
@@ -12,6 +12,7 @@
#include "stdafx.h"
#include <math.h>
#include "core/math_func.hpp"
+#include "framerate_type.h"
#include "safeguards.h"
@@ -138,6 +139,13 @@ static void MxCloseChannel(MixerChannel *mc)
void MxMixSamples(void *buffer, uint samples)
{
+ PerformanceMeasurer framerate(PFE_SOUND);
+ static uint last_samples = 0;
+ if (samples != last_samples) {
+ framerate.SetExpectedRate((double)_play_rate / samples);
+ last_samples = samples;
+ }
+
MixerChannel *mc;
/* Clear the buffer */