[Scummvm-cvs-logs] SF.net SVN: scummvm:[47083] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Wed Jan 6 16:56:04 CET 2010


Revision: 47083
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47083&view=rev
Author:   fingolfin
Date:     2010-01-06 15:56:04 +0000 (Wed, 06 Jan 2010)

Log Message:
-----------
Rename some Timestamp methods: getNumberOfFrames -> numberOfFrames and getFramerate -> framerate

Modified Paths:
--------------
    scummvm/trunk/sound/audiostream.cpp
    scummvm/trunk/sound/timestamp.cpp
    scummvm/trunk/sound/timestamp.h
    scummvm/trunk/test/sound/timestamp.h

Modified: scummvm/trunk/sound/audiostream.cpp
===================================================================
--- scummvm/trunk/sound/audiostream.cpp	2010-01-06 15:40:49 UTC (rev 47082)
+++ scummvm/trunk/sound/audiostream.cpp	2010-01-06 15:56:04 UTC (rev 47083)
@@ -110,7 +110,7 @@
 
 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();
 }
 
 /**

Modified: scummvm/trunk/sound/timestamp.cpp
===================================================================
--- scummvm/trunk/sound/timestamp.cpp	2010-01-06 15:40:49 UTC (rev 47082)
+++ scummvm/trunk/sound/timestamp.cpp	2010-01-06 15:56:04 UTC (rev 47083)
@@ -36,12 +36,12 @@
 	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::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;
 

Modified: scummvm/trunk/sound/timestamp.h
===================================================================
--- scummvm/trunk/sound/timestamp.h	2010-01-06 15:40:49 UTC (rev 47082)
+++ scummvm/trunk/sound/timestamp.h	2010-01-06 15:56:04 UTC (rev 47083)
@@ -126,20 +126,20 @@
 	 */
 	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:
 
 	int cmp(const Timestamp &ts) const;

Modified: scummvm/trunk/test/sound/timestamp.h
===================================================================
--- scummvm/trunk/test/sound/timestamp.h	2010-01-06 15:40:49 UTC (rev 47082)
+++ scummvm/trunk/test/sound/timestamp.h	2010-01-06 15:56:04 UTC (rev 47083)
@@ -143,10 +143,10 @@
 		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 @@
 
 		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);
 	}
 };


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list