diff options
author | Max Horn | 2010-01-06 15:56:04 +0000 |
---|---|---|
committer | Max Horn | 2010-01-06 15:56:04 +0000 |
commit | dd76e2bda0e33ad78c8c7dd8c998c6e51c8a04ca (patch) | |
tree | b88749e1df71ca22d4ce7b66a2d64a296fbb2cd7 | |
parent | 297a95557946555e5cc51279abafc0dc362af5f7 (diff) | |
download | scummvm-rg350-dd76e2bda0e33ad78c8c7dd8c998c6e51c8a04ca.tar.gz scummvm-rg350-dd76e2bda0e33ad78c8c7dd8c998c6e51c8a04ca.tar.bz2 scummvm-rg350-dd76e2bda0e33ad78c8c7dd8c998c6e51c8a04ca.zip |
Rename some Timestamp methods: getNumberOfFrames -> numberOfFrames and getFramerate -> framerate
svn-id: r47083
-rw-r--r-- | sound/audiostream.cpp | 2 | ||||
-rw-r--r-- | sound/timestamp.cpp | 10 | ||||
-rw-r--r-- | sound/timestamp.h | 10 | ||||
-rw-r--r-- | test/sound/timestamp.h | 14 |
4 files changed, 18 insertions, 18 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index a3a00a4eba..748e480c61 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -110,7 +110,7 @@ inline int32 calculatePlayTime(int rate, int samples) { uint32 calculateSampleOffset(const Timestamp &where, int rate) { const Timestamp whereRate = where.convertToFramerate(rate); - return whereRate.secs() * rate + whereRate.getNumberOfFrames(); + return whereRate.secs() * rate + whereRate.numberOfFrames(); } /** diff --git a/sound/timestamp.cpp b/sound/timestamp.cpp index 9d95fbe556..f6ac56bfad 100644 --- a/sound/timestamp.cpp +++ b/sound/timestamp.cpp @@ -36,12 +36,12 @@ static uint gcd(uint a, uint b) { return b; } -Timestamp::Timestamp(uint32 ms, int framerate) { - assert(framerate > 0); +Timestamp::Timestamp(uint32 ms, int fr) { + assert(fr > 0); _secs = ms / 1000; - _framerateFactor = 1000 / gcd(1000, framerate); - _framerate = framerate * _framerateFactor; + _framerateFactor = 1000 / gcd(1000, fr); + _framerate = fr * _framerateFactor; _numberOfFrames = (ms % 1000) * _framerate / 1000; } @@ -50,7 +50,7 @@ Timestamp::Timestamp(uint32 ms, int framerate) { Timestamp Timestamp::convertToFramerate(int newFramerate) const { Timestamp ts(*this); - if (ts.getFramerate() != newFramerate) { + if (ts.framerate() != newFramerate) { ts._framerateFactor = 1000 / gcd(1000, newFramerate); ts._framerate = newFramerate * ts._framerateFactor; diff --git a/sound/timestamp.h b/sound/timestamp.h index a027570469..fcfa8cf5fc 100644 --- a/sound/timestamp.h +++ b/sound/timestamp.h @@ -126,19 +126,19 @@ public: */ uint32 msecs() const; - /** Return the framerate used by this timestamp. */ - int getFramerate() const { return _framerate / _framerateFactor; } - /** * Determines the time in seconds described by this timestamp, * rounded down. */ - uint32 secs() const { return _secs; } + inline uint32 secs() const { return _secs; } /** * Determines the frames described by this timestamp. */ - int getNumberOfFrames() const { return _numberOfFrames / _framerateFactor; } + inline int numberOfFrames() const { return _numberOfFrames / _framerateFactor; } + + /** Return the framerate used by this timestamp. */ + inline int framerate() const { return _framerate / _framerateFactor; } protected: diff --git a/test/sound/timestamp.h b/test/sound/timestamp.h index 39d095aa35..6fc83480b4 100644 --- a/test/sound/timestamp.h +++ b/test/sound/timestamp.h @@ -143,10 +143,10 @@ class TimestampTestSuite : public CxxTest::TestSuite const Audio::Timestamp c = Audio::Timestamp(500, 100); const Audio::Timestamp d = Audio::Timestamp(500, 44100); - TS_ASSERT_EQUALS(a.getFramerate(), 1000); - TS_ASSERT_EQUALS(b.getFramerate(), 67); - TS_ASSERT_EQUALS(c.getFramerate(), 100); - TS_ASSERT_EQUALS(d.getFramerate(), 44100); + TS_ASSERT_EQUALS(a.framerate(), 1000); + TS_ASSERT_EQUALS(b.framerate(), 67); + TS_ASSERT_EQUALS(c.framerate(), 100); + TS_ASSERT_EQUALS(d.framerate(), 44100); } void test_direct_query() { @@ -156,14 +156,14 @@ class TimestampTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(a.secs(), (uint32)0); TS_ASSERT_EQUALS(a.msecs(), (uint32)0); - TS_ASSERT_EQUALS(a.getNumberOfFrames(), 0); + TS_ASSERT_EQUALS(a.numberOfFrames(), 0); TS_ASSERT_EQUALS(b.secs(), (uint32)0); TS_ASSERT_EQUALS(b.msecs(), (uint32)500); - TS_ASSERT_EQUALS(b.getNumberOfFrames(), 11025); + TS_ASSERT_EQUALS(b.numberOfFrames(), 11025); TS_ASSERT_EQUALS(c.secs(), (uint32)1); TS_ASSERT_EQUALS(c.msecs(), (uint32)1500); - TS_ASSERT_EQUALS(c.getNumberOfFrames(), 11025); + TS_ASSERT_EQUALS(c.numberOfFrames(), 11025); } }; |