• R/O
  • SSH
  • HTTPS

cadencii: コミット


コミットメタ情報

リビジョン1969 (tree)
日時2012-01-15 09:13:21
作者kbinani

ログメッセージ

[vConnect/trunk/stand2.0] moved: vsqTempo, クラス名を変更; added: TempoList, TempoListTest

変更サマリ

差分

--- vConnect/trunk/stand2.0/stand/vsqMetaText/vsqTempo.h (revision 1968)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/vsqTempo.h (nonexistent)
@@ -1,60 +0,0 @@
1-/*
2- *
3- * vsqTempo.h
4- * (c) HAL 2010-
5- *
6- * This files is a part of v.Connect.
7- * vsqTempo contains tempo data in vsq meta-text extention.
8- *
9- * These files are distributed in the hope that it will be useful,
10- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12- *
13- */
14-#ifndef __vsqTempo_h__
15-#define __vsqTempo_h__
16-
17-#include <string>
18-
19-using namespace std;
20-
21-class vsqTempo
22-{
23-
24-public:
25- vsqTempo()
26- {
27- tempo = DEFAULT_TEMPO;
28- }
29-
30- void setParameter( string left, string right );
31-
32- long secondToTick( double second );
33- double tickToSecond( long tick );
34-
35- /// <summary>
36- /// �e���|�l���擾���܂��D
37- /// </summary>
38- double getTempo()
39- {
40- return tempo;
41- }
42-
43-public:
44-
45- /// <summary>
46- /// �f�t�H���g�̃e���|�l�ł�
47- /// </summary>
48- static const double DEFAULT_TEMPO;
49-
50-
51-private:
52-
53- /// <summary>
54- /// �e���|�l
55- /// </summary>
56- double tempo;
57-
58-};
59-
60-#endif
--- vConnect/trunk/stand2.0/stand/vsqMetaText/vsqTempo.cpp (revision 1968)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/vsqTempo.cpp (nonexistent)
@@ -1,35 +0,0 @@
1-/*
2- *
3- * vsqTempo.cpp
4- * (c) HAL 2010-
5- *
6- * This files is a part of v.Connect.
7- * vsqTempo contains tempo data in vsq meta-text extention.
8- *
9- * These files are distributed in the hope that it will be useful,
10- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12- *
13- */
14-#include "vsqTempo.h"
15-#include "Sequence.h"
16-
17-using namespace vconnect;
18-
19-const double vsqTempo::DEFAULT_TEMPO = 120.0;
20-
21-void vsqTempo::setParameter( string left, string right )
22-{
23- tempo = atof( left.c_str() );
24-}
25-
26-long vsqTempo::secondToTick( double second )
27-{
28- /* In This Code, only static tempo is available */
29- return (long)(second / 60.0 * tempo * Sequence::getTickPerBeat());
30-}
31-
32-double vsqTempo::tickToSecond( long tick )
33-{
34- return 60.0 / tempo * (double)tick / Sequence::getTickPerBeat();
35-}
--- vConnect/trunk/stand2.0/stand/vsqMetaText/Sequence.h (revision 1968)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/Sequence.h (revision 1969)
@@ -19,7 +19,7 @@
1919 #include "Event.h"
2020 #include "EventList.h"
2121 #include "BPList.h"
22-#include "vsqTempo.h"
22+#include "TempoList.h"
2323 #include "CurveTypeEnum.h"
2424 #include "../RuntimeOption.h"
2525 #include "../Socket.h"
@@ -127,7 +127,7 @@
127127 /// <summary>
128128 /// テンポの変更情報を格納したリスト.
129129 /// </summary>
130- vsqTempo vsqTempoBp;
130+ TempoList vsqTempoBp;
131131
132132 /// <summary>
133133 /// [ID#]の文字列と,その中身との紐付けを保持するマップ.
--- vConnect/trunk/stand2.0/stand/vsqMetaText/TempoList.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/TempoList.cpp (revision 1969)
@@ -0,0 +1,37 @@
1+/*
2+ * TempoList.cpp
3+ * Copyright © 2010-2012 HAL
4+ * Copyright © 2012 kbinani
5+ *
6+ * This file is part of vConnect-STAND.
7+ *
8+ * vConnect-STAND is free software; you can redistribute it and/or
9+ * modify it under the terms of the GPL License.
10+ *
11+ * vConnect-STAND is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+ */
15+#include "TempoList.h"
16+#include "Sequence.h"
17+
18+namespace vconnect
19+{
20+ const double TempoList::DEFAULT_TEMPO = 120.0;
21+
22+ void TempoList::setParameter( string left, string right )
23+ {
24+ tempo = atof( left.c_str() );
25+ }
26+
27+ long TempoList::secondToTick( double second )
28+ {
29+ /* In This Code, only static tempo is available */
30+ return (long)(second / 60.0 * tempo * Sequence::getTickPerBeat());
31+ }
32+
33+ double TempoList::tickToSecond( long tick )
34+ {
35+ return 60.0 / tempo * (double)tick / Sequence::getTickPerBeat();
36+ }
37+}
--- vConnect/trunk/stand2.0/stand/vsqMetaText/TempoList.h (nonexistent)
+++ vConnect/trunk/stand2.0/stand/vsqMetaText/TempoList.h (revision 1969)
@@ -0,0 +1,60 @@
1+/*
2+ * TempoList.h
3+ * Copyright © 2010-2012 HAL
4+ * Copyright © 2012 kbinani
5+ *
6+ * This file is part of vConnect-STAND.
7+ *
8+ * vConnect-STAND is free software; you can redistribute it and/or
9+ * modify it under the terms of the GPL License.
10+ *
11+ * vConnect-STAND is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+ */
15+#ifndef __TempoList_h__
16+#define __TempoList_h__
17+
18+#include <string>
19+
20+using namespace std;
21+
22+namespace vconnect
23+{
24+ class TempoList
25+ {
26+ public:
27+ /**
28+ * デフォルトのテンポ値
29+ */
30+ static const double DEFAULT_TEMPO;
31+
32+ private:
33+ /**
34+ * テンポ値
35+ */
36+ double tempo;
37+
38+ public:
39+ TempoList()
40+ {
41+ this->tempo = DEFAULT_TEMPO;
42+ }
43+
44+ void setParameter( string left, string right );
45+
46+ long secondToTick( double second );
47+
48+ double tickToSecond( long tick );
49+
50+ /**
51+ * テンポ値を取得する
52+ * @return テンポ値
53+ */
54+ double getTempo()
55+ {
56+ return this->tempo;
57+ }
58+ };
59+}
60+#endif
--- vConnect/trunk/stand2.0/stand/tests/vsq/TempoListTest.cpp (nonexistent)
+++ vConnect/trunk/stand2.0/stand/tests/vsq/TempoListTest.cpp (revision 1969)
@@ -0,0 +1,44 @@
1+#ifndef TEST_TempoListTest
2+#define TEST_TempoListTest
3+#include "../AllTests.h"
4+#include "../../vsqMetaText/TempoList.h"
5+
6+using namespace std;
7+using namespace vconnect;
8+
9+class TempoListTest : public CppUnit::TestFixture {
10+public:
11+ void testConstruct()
12+ {
13+ TempoList list;
14+ CPPUNIT_ASSERT_EQUAL( 120.0, list.getTempo() );
15+ }
16+
17+ void testSetParameter()
18+ {
19+ TempoList list;
20+ list.setParameter( "60", "" );
21+ CPPUNIT_ASSERT_EQUAL( 60.0, list.getTempo() );
22+ }
23+
24+ void testSecondToTick()
25+ {
26+ TempoList list;
27+ CPPUNIT_ASSERT_EQUAL( (long)480, list.secondToTick( 0.5 ) );
28+ }
29+
30+ void testTickToSecond()
31+ {
32+ TempoList list;
33+ CPPUNIT_ASSERT_EQUAL( 0.5, list.tickToSecond( 480 ) );
34+ }
35+
36+ CPPUNIT_TEST_SUITE( TempoListTest );
37+ CPPUNIT_TEST( testConstruct );
38+ CPPUNIT_TEST( testSetParameter );
39+ CPPUNIT_TEST( testSecondToTick );
40+ CPPUNIT_TEST( testTickToSecond );
41+ CPPUNIT_TEST_SUITE_END();
42+};
43+REGISTER_TEST_SUITE( TempoListTest );
44+#endif
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
旧リポジトリブラウザで表示