• R/O
  • SSH
  • HTTPS

cadencii: コミット


コミットメタ情報

リビジョン1781 (tree)
日時2011-11-17 01:57:52
作者kbinani

ログメッセージ

[luavsq] 〜Entryというクラス名を〜Itemに変更

変更サマリ

差分

--- luavsq/trunk/TempoTableEntry.lua (revision 1780)
+++ luavsq/trunk/TempoTableEntry.lua (nonexistent)
@@ -1,94 +0,0 @@
1---[[
2- TempoTableEntry.lua
3- Copyright © 2011 kbinani
4-
5- This file is part of luavsq.
6-
7- luavsq is free software; you can redistribute it and/or
8- modify it under the terms of the BSD License.
9-
10- luavsq is distributed in the hope that it will be useful,
11- but WITHOUT ANY WARRANTY; without even the implied warranty of
12- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13-]]
14-
15-if( nil == luavsq )then
16- luavsq = {};
17-end
18-
19-if( nil == luavsq.TempoTableEntry )then
20-
21- luavsq.TempoTableEntry = {};
22-
23- function luavsq.TempoTableEntry.new( ... )
24- local this = {};
25- local arguments = { ... };
26- this.clock = 0;
27- this.tempo = 0;
28- this.time = 0.0;
29-
30- ---
31- -- @return [string]
32- function this:toString()
33- return "{Clock=" .. self.clock .. ", Tempo=" .. self.tempo .. ", Time=" .. self.time .. "}";
34- end
35-
36- ---
37- -- @return [object]
38- function this:clone()
39- return luavsq.TempoTableEntry.new( self.clock, self.tempo, self.time );
40- end
41-
42- ---
43- -- overload1
44- -- @return [TempoTableEntry]
45- --
46- -- overload2
47- -- @param clock [int]
48- -- @param _tempo [int]
49- -- @param _time [int]
50- -- @return [TempoTableEntry]
51- function this:_init_3( clock, tempo, time )
52- self.clock = clock;
53- self.tempo = tempo;
54- self.time = time;
55- end
56-
57- ---
58- -- @param entry [TempoTableEntry]
59- -- @return [int]
60- function this:compareTo( entry )
61- return self.clock - entry.clock;
62- end
63-
64- ---
65- -- @param entry [TempoTableEntry]
66- -- @return [bool]
67- function this:equals( entry )
68- if( self.clock == entry.clock )then
69- return true;
70- else
71- return false;
72- end
73- end
74-
75- if( #arguments == 3 )then
76- this:_init_3( arguments[1], arguments[2], arguments[3] );
77- end
78-
79- return this;
80- end
81-
82- ---
83- -- @param a [TempoTableEntry]
84- -- @param b [TempoTableEntry]
85- -- @return [int]
86- function luavsq.TempoTableEntry.compare( a, b )
87- if( a:compareTo( b ) < 0 )then
88- return true;
89- else
90- return false;
91- end
92- end
93-
94-end
--- luavsq/trunk/MixerEntry.lua (revision 1780)
+++ luavsq/trunk/MixerEntry.lua (nonexistent)
@@ -1,52 +0,0 @@
1---[[
2- MixerEntry.lua
3- Copyright © 2011 kbinani
4-
5- This file is part of luavvsq.
6-
7- luavsq is free software; you can redistribute it and/or
8- modify it under the terms of the BSD License.
9-
10- luavsq is distributed in the hope that it will be useful,
11- but WITHOUT ANY WARRANTY; without even the implied warranty of
12- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13-]]
14-
15-if( nil == luavsq )then
16- luavsq = {};
17-end
18-
19-if( nil == luavsq.MixerEntry )then
20-
21- ---
22- -- VsqMixerのSlave要素に格納される各エントリ
23- luavsq.MixerEntry = {};
24-
25- ---
26- -- 各パラメータを指定したコンストラクタ
27- -- @param feder (integer) Feder値
28- -- @param panpot (integer) Panpot値
29- -- @param mute (integer) Mute値
30- -- @param solo (integer) Solo値
31- function luavsq.MixerEntry.new( feder, panpot, mute, solo )
32- local this = {};
33- this.feder = feder;
34- this.panpot = panpot;
35- this.mute = mute;
36- this.solo = solo;
37-
38- function this:_init_4( feder, panpot, mute, solo )
39- self.feder = feder;
40- self.panpot = panpot;
41- self.mute = mute;
42- self.solo = solo;
43- end
44-
45- function this:clone()
46- return luavsq.MixerEntry.new( self.feder, self.panpot, self.mute, self.solo );
47- end
48-
49- return this;
50- end
51-
52-end
--- luavsq/trunk/TimesigTableEntry.lua (revision 1780)
+++ luavsq/trunk/TimesigTableEntry.lua (nonexistent)
@@ -1,90 +0,0 @@
1---[[
2- TimesigTableEntry.lua
3- Copyright © 2011 kbinani
4-
5- This file is part of luavsq.
6-
7- luavsq is free software; you can redistribute it and/or
8- modify it under the terms of the BSD License.
9-
10- luavsq is distributed in the hope that it will be useful,
11- but WITHOUT ANY WARRANTY; without even the implied warranty of
12- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13-]]
14-
15-if( nil == luavsq )then
16- luavsq = {};
17-end
18-
19-if( nil == luavsq.TimesigTableEntry )then
20-
21- luavsq.TimesigTableEntry = {};
22-
23- function luavsq.TimesigTableEntry.new( ... )
24- local this = {};
25- local arguments = { ... };
26-
27- ---
28- -- クロック数
29- this.clock = 0;
30-
31- ---
32- -- 拍子の分子
33- this.numerator = 4;
34-
35- ---
36- -- 拍子の分母
37- this.denominator = 4;
38-
39- ---
40- -- 何小節目か
41- this.barCount = 0;
42-
43- ---
44- -- @param clock [int]
45- -- @param numerator [int]
46- -- @param denominator [int]
47- -- @param bar_count [int]
48- -- @return [TimeSigTableEntry]
49- function this:_init_4( clock, numerator, denominator, barCount )
50- self.clock = clock;
51- self.numerator = numerator;
52- self.denominator = denominator;
53- self.barCount = barCount;
54- end
55-
56- ---
57- -- @return [string]
58- function this:toString()
59- return "{Clock=" .. self.clock .. ", Numerator=" .. self.numerator .. ", Denominator=" .. self.denominator .. ", BarCount=" .. self.barCount .. "}";
60- end
61-
62- ---
63- -- @return [object]
64- function this:clone()
65- return luavsq.TimesigTableEntry.new( self.clock, self.numerator, self.denominator, self.barCount );
66- end
67-
68- ---
69- -- @param item [TimeSigTableEntry]
70- -- @return [int]
71- function this:compareTo( item )
72- return self.barCount - item.barCount;
73- end
74-
75- if( #arguments == 4 )then
76- this:_init_4( arguments[1], arguments[2], arguments[3], arguments[4] );
77- end
78-
79- return this;
80- end
81-
82- ---
83- -- @param a [TimeSigTableEntry]
84- -- @param b [TimeSigTableEntry]
85- -- @return [int]
86- function luavsq.TimesigTableEntry.compare( a, b )
87- return (a:compareTo( b ) < 0);
88- end
89-
90-end
--- luavsq/trunk/TimesigTable.lua (revision 1780)
+++ luavsq/trunk/TimesigTable.lua (revision 1781)
@@ -25,7 +25,7 @@
2525
2626 ---
2727 -- データ点を追加する
28- -- @param (luavsq.TimesigTableEntry)
28+ -- @param (luavsq.TimesigTableItem)
2929 function this:push( item )
3030 self._list:push( item );
3131 end
@@ -33,7 +33,7 @@
3333 ---
3434 -- データ点を取得する
3535 -- @param (number) index 取得するデータ点のインデックス(0から始まる)
36- -- @return (luavsq.TimesigTableEntry)
36+ -- @return (luavsq.TimesigTableItem)
3737 function this:get( index )
3838 return self._list[index];
3939 end
@@ -41,7 +41,7 @@
4141 ---
4242 -- データ点を設定する
4343 -- @param (number) index 設定するデータ点のインデックス(0から始まる)
44- -- @param (luavsq.TimesigTableEntry)
44+ -- @param (luavsq.TimesigTableItem)
4545 function this:set( index, value )
4646 self._list[index] = value;
4747 end
@@ -53,7 +53,7 @@
5353 return;
5454 end
5555 self._list[0].Clock = 0;
56- self._list:sort( luavsq.TimesigTableEntry.compare );-- Collections.sort( this );
56+ self._list:sort( luavsq.TimesigTableItem.compare );-- Collections.sort( this );
5757 local count = self._list:size();
5858 local j;
5959 for j = 1, count - 1, 1 do
@@ -73,7 +73,7 @@
7373 -- @param (number) clock ゲートタイム
7474 -- @return (luavsq.Timesig) 指定されたゲートタイムでの拍子情報
7575 function this:getTimesigAt( clock )
76- local ret = luavsq.TimesigTableEntry.new();
76+ local ret = luavsq.TimesigTableItem.new();
7777 ret.numerator = 4;
7878 ret.denominator = 4;
7979 local index = 0;
@@ -93,7 +93,7 @@
9393 ---
9494 -- 指定されたゲートタイムにおける拍子情報を取得する
9595 -- @param (number) clock ゲートタイム
96- -- @return (luavsq.TimesigTableEntry) 指定されたゲートタイムでの拍子情報
96+ -- @return (luavsq.TimesigTableItem) 指定されたゲートタイムでの拍子情報
9797 function this:findTimesigAt( clock )
9898 local index = 0;
9999 local c = self._list:size();
--- luavsq/trunk/Mixer.lua (revision 1780)
+++ luavsq/trunk/Mixer.lua (revision 1781)
@@ -94,7 +94,7 @@
9494 self.slave = {};
9595 local i;
9696 for i = 1, tracks, 1 do
97- self.slave[i] = luavsq.MixerEntry.new( 0, 0, 0, 0 );
97+ self.slave[i] = luavsq.MixerItem.new( 0, 0, 0, 0 );
9898 end
9999 spl = luavsq.Util.split( buffer, "\n" );
100100 local spl2;
--- luavsq/trunk/TimesigTableItem.lua (nonexistent)
+++ luavsq/trunk/TimesigTableItem.lua (revision 1781)
@@ -0,0 +1,90 @@
1+--[[
2+ TimesigTableItem.lua
3+ Copyright © 2011 kbinani
4+
5+ This file is part of luavsq.
6+
7+ luavsq is free software; you can redistribute it and/or
8+ modify it under the terms of the BSD License.
9+
10+ luavsq is distributed in the hope that it will be useful,
11+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+]]
14+
15+if( nil == luavsq )then
16+ luavsq = {};
17+end
18+
19+if( nil == luavsq.TimesigTableItem )then
20+
21+ luavsq.TimesigTableItem = {};
22+
23+ function luavsq.TimesigTableItem.new( ... )
24+ local this = {};
25+ local arguments = { ... };
26+
27+ ---
28+ -- クロック数
29+ this.clock = 0;
30+
31+ ---
32+ -- 拍子の分子
33+ this.numerator = 4;
34+
35+ ---
36+ -- 拍子の分母
37+ this.denominator = 4;
38+
39+ ---
40+ -- 何小節目か
41+ this.barCount = 0;
42+
43+ ---
44+ -- @param clock [int]
45+ -- @param numerator [int]
46+ -- @param denominator [int]
47+ -- @param bar_count [int]
48+ -- @return [TimeSigTableEntry]
49+ function this:_init_4( clock, numerator, denominator, barCount )
50+ self.clock = clock;
51+ self.numerator = numerator;
52+ self.denominator = denominator;
53+ self.barCount = barCount;
54+ end
55+
56+ ---
57+ -- @return [string]
58+ function this:toString()
59+ return "{Clock=" .. self.clock .. ", Numerator=" .. self.numerator .. ", Denominator=" .. self.denominator .. ", BarCount=" .. self.barCount .. "}";
60+ end
61+
62+ ---
63+ -- @return [object]
64+ function this:clone()
65+ return luavsq.TimesigTableItem.new( self.clock, self.numerator, self.denominator, self.barCount );
66+ end
67+
68+ ---
69+ -- @param item [TimeSigTableEntry]
70+ -- @return [int]
71+ function this:compareTo( item )
72+ return self.barCount - item.barCount;
73+ end
74+
75+ if( #arguments == 4 )then
76+ this:_init_4( arguments[1], arguments[2], arguments[3], arguments[4] );
77+ end
78+
79+ return this;
80+ end
81+
82+ ---
83+ -- @param a [TimeSigTableEntry]
84+ -- @param b [TimeSigTableEntry]
85+ -- @return [int]
86+ function luavsq.TimesigTableItem.compare( a, b )
87+ return (a:compareTo( b ) < 0);
88+ end
89+
90+end
--- luavsq/trunk/TempoTable.lua (revision 1780)
+++ luavsq/trunk/TempoTable.lua (revision 1781)
@@ -27,7 +27,7 @@
2727 this._array = luavsq.List.new();
2828
2929 ---
30- -- @return [Iterator<TempoTableEntry>]
30+ -- @return [Iterator<TempoTableItem>]
3131 function this:iterator()
3232 return this._array:iterator();
3333 end
@@ -36,12 +36,12 @@
3636 -- データ点を時刻順に並べ替えます
3737 -- @return [void]
3838 function this:sort()
39- self._array:sort( luavsq.TempoTableEntry.compare );
39+ self._array:sort( luavsq.TempoTableItem.compare );
4040 end
4141
4242 ---
4343 -- データ点を追加します
44- -- @param value [TempoTableEntry]
44+ -- @param value [TempoTableItem]
4545 -- @return [void]
4646 function this:push( value )
4747 self._array:push( value );
@@ -57,7 +57,7 @@
5757 ---
5858 -- 第index番目のデータ点を取得します
5959 -- @param index [int] 0 から始まるインデックス
60- -- @return [TempoTableEntry]
60+ -- @return [TempoTableItem]
6161 function this:get( index )
6262 return self._array[index];
6363 end
@@ -65,7 +65,7 @@
6565 ---
6666 -- データ点を設定します
6767 -- @param index [int]
68- -- @param value [TempoTableEntry]
68+ -- @param value [TempoTableItem]
6969 -- @return [void]
7070 function this:set( index, value )
7171 self._array[index] = value;
@@ -106,9 +106,9 @@
106106 function this:updateTempoInfo()
107107 local c = self._array:size();
108108 if( c == 0 )then
109- self._array:push( luavsq.TempoTableEntry.new( 0, luavsq.TempoTable.baseTempo, 0.0 ) );
109+ self._array:push( luavsq.TempoTableItem.new( 0, luavsq.TempoTable.baseTempo, 0.0 ) );
110110 end
111- self._array:sort( luavsq.TempoTableEntry.compare );
111+ self._array:sort( luavsq.TempoTableItem.compare );
112112 local item0 = self._array[0];
113113 if( item0.clock ~= 0 )then
114114 item0.time = luavsq.TempoTable.baseTempo * item0.clock / (luavsq.TempoTable.gatetimePerQuater * 1000000.0);
--- luavsq/trunk/test/MixerEntryTest.lua (revision 1780)
+++ luavsq/trunk/test/MixerEntryTest.lua (nonexistent)
@@ -1,20 +0,0 @@
1-require( "lunit" );
2-dofile( "../MixerEntry.lua" );
3-module( "MixerEntryTest", package.seeall, lunit.testcase );
4-
5-function testConstruct()
6- local mixerEntry = luavsq.MixerEntry.new( 1, 2, 3, 4 );
7- assert_equal( 1, mixerEntry.feder );
8- assert_equal( 2, mixerEntry.panpot );
9- assert_equal( 3, mixerEntry.mute );
10- assert_equal( 4, mixerEntry.solo );
11-end
12-
13-function testClone()
14- local mixerEntry = luavsq.MixerEntry.new( 1, 2, 3, 4 );
15- local copy = mixerEntry:clone();
16- assert_equal( 1, copy.feder );
17- assert_equal( 2, copy.panpot );
18- assert_equal( 3, copy.mute );
19- assert_equal( 4, copy.solo );
20-end
--- luavsq/trunk/test/TimesigTableEntryTest.lua (revision 1780)
+++ luavsq/trunk/test/TimesigTableEntryTest.lua (nonexistent)
@@ -1,63 +0,0 @@
1-require( "lunit" );
2-dofile( "../TimesigTableEntry.lua" );
3-module( "TimesigTableEntryTest", package.seeall, lunit.testcase );
4-
5-function testConstruct()
6- local item = luavsq.TimesigTableEntry.new();
7- assert_equal( 0, item.clock );
8- assert_equal( 4, item.numerator );
9- assert_equal( 4, item.denominator );
10- assert_equal( 0, item.barCount );
11-
12- item = luavsq.TimesigTableEntry.new( 480, 3, 4, 1 );
13- assert_equal( 480, item.clock );
14- assert_equal( 3, item.numerator );
15- assert_equal( 4, item.denominator );
16- assert_equal( 1, item.barCount );
17-end
18-
19-function testToString()
20- local item = luavsq.TimesigTableEntry.new( 480, 3, 4, 1 );
21- assert_equal( "{Clock=480, Numerator=3, Denominator=4, BarCount=1}", item:toString() );
22-end
23-
24-function testClone()
25- local item = luavsq.TimesigTableEntry.new( 480, 3, 4, 1 );
26- local copy = item:clone();
27- assert_equal( 480, copy.clock );
28- assert_equal( 3, copy.numerator );
29- assert_equal( 4, copy.denominator );
30- assert_equal( 1, copy.barCount );
31-end
32-
33-function testCompareTo()
34- local a = luavsq.TimesigTableEntry.new( 480, 3, 4, 1 );
35- local b = luavsq.TimesigTableEntry.new( 480, 3, 4, 1 );
36- assert_equal( 0, a:compareTo( b ) );
37-
38- -- barCount が異なる
39- a.barCount = 2;
40- assert_true( 0 < a:compareTo( b ) );
41- assert_true( 0 > b:compareTo( a ) );
42-
43- -- barCount が同じだが、他が異なる
44- a.barCount = 1;
45- a.clock = 1;
46- assert_equal( 0, a:compareTo( b ) );
47-end
48-
49-function testCompare()
50- local a = luavsq.TimesigTableEntry.new( 480, 3, 4, 1 );
51- local b = luavsq.TimesigTableEntry.new( 480, 3, 4, 1 );
52- assert_equal( 0, luavsq.TimesigTableEntry.compare( a, b ) );
53-
54- -- barCount が異なる
55- a.barCount = 2;
56- assert_true( 0 < luavsq.TimesigTableEntry.compare( a, b ) );
57- assert_true( 0 > luavsq.TimesigTableEntry.compare( b, a ) );
58-
59- -- barCount が同じだが、他が異なる
60- a.barCount = 1;
61- a.clock = 1;
62- assert_equal( 0, luavsq.TimesigTableEntry.compare( a, b ) );
63-end
--- luavsq/trunk/test/TempoTableEntryTest.lua (revision 1780)
+++ luavsq/trunk/test/TempoTableEntryTest.lua (nonexistent)
@@ -1,56 +0,0 @@
1-require( "lunit" );
2-dofile( "../TempoTableEntry.lua" );
3-module( "TempoTableEntryTest", package.seeall, lunit.testcase );
4-
5-function testConstructor()
6- local entry = luavsq.TempoTableEntry.new();
7- assert_equal( 0, entry.clock );
8- assert_equal( 0, entry.tempo );
9- assert_equal( 0.0, entry.time );
10-
11- entry = luavsq.TempoTableEntry.new( 480, 500000, 0.5 );
12- assert_equal( 480, entry.clock );
13- assert_equal( 500000, entry.tempo );
14- assert_equal( 0.5, entry.time );
15-end
16-
17-function testToString()
18- local entry = luavsq.TempoTableEntry.new( 480, 500000, 0.5 );
19- assert_equal( "{Clock=480, Tempo=500000, Time=0.5}", entry:toString() );
20-end
21-
22-function testClone()
23- local entry = luavsq.TempoTableEntry.new( 480, 500000, 0.5 );
24- local copy = entry:clone();
25- assert_equal( 480, copy.clock );
26- assert_equal( 500000, copy.tempo );
27- assert_equal( 0.5, copy.time );
28-end
29-
30-function testCompareTo()
31- local a = luavsq.TempoTableEntry.new();
32- local b = luavsq.TempoTableEntry.new( 480, 500000, 0.5 );
33- assert_true( 0 < b:compareTo( a ) );
34- assert_equal( 0, a:compareTo( a ) );
35- assert_true( 0 > a:compareTo( b ) );
36-end
37-
38-function testEquals()
39- local a = luavsq.TempoTableEntry.new( 480, 500000, 0.5 );
40- local b = luavsq.TempoTableEntry.new( 480, 500000, 0.5 );
41- assert_true( a:equals( b ) );
42- -- クロックは同じだがtimeが違う
43- b.time = 1;
44- assert_true( a:equals( b ) );
45- b.clock = 1;
46- b.time = 0.5;
47- assert_false( a:equals( b ) );
48-end
49-
50-function testCompare()
51- local a = luavsq.TempoTableEntry.new();
52- local b = luavsq.TempoTableEntry.new( 480, 500000, 0.5 );
53- assert_false( luavsq.TempoTableEntry.compare( b, a ) );
54- assert_false( luavsq.TempoTableEntry.compare( a, a ) );
55- assert_true( luavsq.TempoTableEntry.compare( a, b ) );
56-end
--- luavsq/trunk/test/TimesigTableTest.lua (revision 1780)
+++ luavsq/trunk/test/TimesigTableTest.lua (revision 1781)
@@ -1,15 +1,15 @@
11 require( "lunit" );
22 dofile( "../TimesigTable.lua" );
33 dofile( "../List.lua" );
4-dofile( "../TimesigTableEntry.lua" );
4+dofile( "../TimesigTableItem.lua" );
55 dofile( "../Timesig.lua" );
66 module( "TimesigTableTest", package.seeall, lunit.testcase );
77
88 function testUpdateTimesigInfo()
99 local table = luavsq.TimesigTable.new();
10- table:push( luavsq.TimesigTableEntry.new( 0, 4, 4, 2 ) );
11- table:push( luavsq.TimesigTableEntry.new( 0, 4, 4, 0 ) );
12- table:push( luavsq.TimesigTableEntry.new( 0, 3, 4, 1 ) );
10+ table:push( luavsq.TimesigTableItem.new( 0, 4, 4, 2 ) );
11+ table:push( luavsq.TimesigTableItem.new( 0, 4, 4, 0 ) );
12+ table:push( luavsq.TimesigTableItem.new( 0, 3, 4, 1 ) );
1313 table:updateTimesigInfo();
1414
1515 assert_equal( 0, table:get( 0 ).clock );
@@ -22,9 +22,9 @@
2222
2323 function testGetTimesigAt()
2424 local table = luavsq.TimesigTable.new();
25- table:push( luavsq.TimesigTableEntry.new( 0, 4, 6, 2 ) );
26- table:push( luavsq.TimesigTableEntry.new( 0, 4, 4, 0 ) );
27- table:push( luavsq.TimesigTableEntry.new( 0, 3, 4, 1 ) );
25+ table:push( luavsq.TimesigTableItem.new( 0, 4, 6, 2 ) );
26+ table:push( luavsq.TimesigTableItem.new( 0, 4, 4, 0 ) );
27+ table:push( luavsq.TimesigTableItem.new( 0, 3, 4, 1 ) );
2828 table:updateTimesigInfo();
2929
3030 local timesig = table:getTimesigAt( 480 );
@@ -42,9 +42,9 @@
4242
4343 function testFindTimesigAt()
4444 local table = luavsq.TimesigTable.new();
45- table:push( luavsq.TimesigTableEntry.new( 0, 4, 6, 2 ) );-- 3360 clock開始
46- table:push( luavsq.TimesigTableEntry.new( 0, 4, 4, 0 ) );-- 0 clock開始
47- table:push( luavsq.TimesigTableEntry.new( 0, 3, 4, 1 ) );-- 1920 clock開始
45+ table:push( luavsq.TimesigTableItem.new( 0, 4, 6, 2 ) );-- 3360 clock開始
46+ table:push( luavsq.TimesigTableItem.new( 0, 4, 4, 0 ) );-- 0 clock開始
47+ table:push( luavsq.TimesigTableItem.new( 0, 3, 4, 1 ) );-- 1920 clock開始
4848 table:updateTimesigInfo();
4949
5050 local timesig = table:findTimesigAt( 480 );
@@ -70,9 +70,9 @@
7070
7171 function testGetClockFromBarCount()
7272 local table = luavsq.TimesigTable.new();
73- table:push( luavsq.TimesigTableEntry.new( 0, 4, 6, 2 ) );-- 3360 clock開始
74- table:push( luavsq.TimesigTableEntry.new( 0, 4, 4, 0 ) );-- 0 clock開始
75- table:push( luavsq.TimesigTableEntry.new( 0, 3, 4, 1 ) );-- 1920 clock開始
73+ table:push( luavsq.TimesigTableItem.new( 0, 4, 6, 2 ) );-- 3360 clock開始
74+ table:push( luavsq.TimesigTableItem.new( 0, 4, 4, 0 ) );-- 0 clock開始
75+ table:push( luavsq.TimesigTableItem.new( 0, 3, 4, 1 ) );-- 1920 clock開始
7676 table:updateTimesigInfo();
7777
7878 assert_equal( 0, table:getClockFromBarCount( 0 ) );
@@ -83,9 +83,9 @@
8383
8484 function testGetBarCountFromClock()
8585 local table = luavsq.TimesigTable.new();
86- table:push( luavsq.TimesigTableEntry.new( 0, 4, 6, 2 ) );-- 3360 clock開始
87- table:push( luavsq.TimesigTableEntry.new( 0, 4, 4, 0 ) );-- 0 clock開始
88- table:push( luavsq.TimesigTableEntry.new( 0, 3, 4, 1 ) );-- 1920 clock開始
86+ table:push( luavsq.TimesigTableItem.new( 0, 4, 6, 2 ) );-- 3360 clock開始
87+ table:push( luavsq.TimesigTableItem.new( 0, 4, 4, 0 ) );-- 0 clock開始
88+ table:push( luavsq.TimesigTableItem.new( 0, 3, 4, 1 ) );-- 1920 clock開始
8989 table:updateTimesigInfo();
9090
9191 assert_equal( 0, table:getBarCountFromClock( 0 ) );
--- luavsq/trunk/test/MixerTest.lua (revision 1780)
+++ luavsq/trunk/test/MixerTest.lua (revision 1781)
@@ -1,6 +1,6 @@
11 require( "lunit" );
22 dofile( "../Mixer.lua" );
3-dofile( "../MixerEntry.lua" );
3+dofile( "../MixerItem.lua" );
44 dofile( "../TextStream.lua" );
55 dofile( "../Util.lua" );
66 module( "MixerTest", package.seeall, lunit.testcase );
@@ -44,8 +44,8 @@
4444 function testClone()
4545 local mixer = luavsq.Mixer.new( 1, 2, 3, 4 );
4646 mixer.slave = {};
47- mixer.slave[1] = luavsq.MixerEntry.new( 5, 6, 7, 8 );
48- mixer.slave[2] = luavsq.MixerEntry.new( 9, 10, 11, 12 );
47+ mixer.slave[1] = luavsq.MixerItem.new( 5, 6, 7, 8 );
48+ mixer.slave[2] = luavsq.MixerItem.new( 9, 10, 11, 12 );
4949
5050 local copy = mixer:clone();
5151 assert_equal( 2, #copy.slave );
@@ -66,8 +66,8 @@
6666 function testWrite()
6767 local mixer = luavsq.Mixer.new( 1, 2, 3, 4 );
6868 mixer.slave = {};
69- mixer.slave[1] = luavsq.MixerEntry.new( 5, 6, 7, 8 );
70- mixer.slave[2] = luavsq.MixerEntry.new( 9, 10, 11, 12 );
69+ mixer.slave[1] = luavsq.MixerItem.new( 5, 6, 7, 8 );
70+ mixer.slave[2] = luavsq.MixerItem.new( 9, 10, 11, 12 );
7171 local stream = luavsq.TextStream.new();
7272 mixer:write( stream );
7373 local expected =
--- luavsq/trunk/test/TimesigTableItemTest.lua (nonexistent)
+++ luavsq/trunk/test/TimesigTableItemTest.lua (revision 1781)
@@ -0,0 +1,67 @@
1+require( "lunit" );
2+dofile( "../TimesigTableItem.lua" );
3+module( "TimesigTableItemTest", package.seeall, lunit.testcase );
4+
5+function testConstruct()
6+ local item = luavsq.TimesigTableItem.new();
7+ assert_equal( 0, item.clock );
8+ assert_equal( 4, item.numerator );
9+ assert_equal( 4, item.denominator );
10+ assert_equal( 0, item.barCount );
11+
12+ item = luavsq.TimesigTableItem.new( 480, 3, 4, 1 );
13+ assert_equal( 480, item.clock );
14+ assert_equal( 3, item.numerator );
15+ assert_equal( 4, item.denominator );
16+ assert_equal( 1, item.barCount );
17+end
18+
19+function testToString()
20+ local item = luavsq.TimesigTableItem.new( 480, 3, 4, 1 );
21+ assert_equal( "{Clock=480, Numerator=3, Denominator=4, BarCount=1}", item:toString() );
22+end
23+
24+function testClone()
25+ local item = luavsq.TimesigTableItem.new( 480, 3, 4, 1 );
26+ local copy = item:clone();
27+ assert_equal( 480, copy.clock );
28+ assert_equal( 3, copy.numerator );
29+ assert_equal( 4, copy.denominator );
30+ assert_equal( 1, copy.barCount );
31+end
32+
33+function testCompareTo()
34+ local a = luavsq.TimesigTableItem.new( 480, 3, 4, 1 );
35+ local b = luavsq.TimesigTableItem.new( 480, 3, 4, 1 );
36+ assert_equal( 0, a:compareTo( b ) );
37+
38+ -- barCount が異なる
39+ a.barCount = 2;
40+ assert_true( 0 < a:compareTo( b ) );
41+ assert_true( 0 > b:compareTo( a ) );
42+
43+ -- barCount が同じだが、他が異なる
44+ a.barCount = 1;
45+ a.clock = 1;
46+ assert_equal( 0, a:compareTo( b ) );
47+end
48+
49+function testCompare()
50+ local a = luavsq.TimesigTableItem.new( 480, 3, 4, 1 );
51+ local b = luavsq.TimesigTableItem.new( 480, 3, 4, 1 );
52+ -- aとbが同じ序列
53+ assert_false( luavsq.TimesigTableItem.compare( a, b ) );
54+ assert_false( luavsq.TimesigTableItem.compare( b, a ) );
55+
56+ -- barCount が異なる
57+ a.barCount = 2;
58+ assert_false( luavsq.TimesigTableItem.compare( a, b ) );
59+ assert_true( luavsq.TimesigTableItem.compare( b, a ) );
60+
61+ -- barCount が同じだが、他が異なる
62+ -- この場合aとbは同じ序列
63+ a.barCount = 1;
64+ a.clock = 1;
65+ assert_false( luavsq.TimesigTableItem.compare( a, b ) );
66+ assert_false( luavsq.TimesigTableItem.compare( b, a ) );
67+end
--- luavsq/trunk/test/TempoTableTest.lua (revision 1780)
+++ luavsq/trunk/test/TempoTableTest.lua (revision 1781)
@@ -1,7 +1,7 @@
11 require( "lunit" );
22 dofile( "../TempoTable.lua" );
33 dofile( "../List.lua" );
4-dofile( "../TempoTableEntry.lua" );
4+dofile( "../TempoTableItem.lua" );
55 module( "TempoTableTest", package.seeall, lunit.testcase );
66
77 ---
@@ -9,8 +9,8 @@
99 function test()
1010 local list = luavsq.TempoTable.new();
1111 assert_equal( 0, list:size() );
12- list:push( luavsq.TempoTableEntry.new( 0, 500000, 0.0 ) );
13- list:push( luavsq.TempoTableEntry.new( 480, 525000, 0.5 ) );
12+ list:push( luavsq.TempoTableItem.new( 0, 500000, 0.0 ) );
13+ list:push( luavsq.TempoTableItem.new( 480, 525000, 0.5 ) );
1414 assert_equal( 2, list:size() );
1515 assert_equal( 0, list:get( 0 ).clock );
1616 assert_equal( 500000, list:get( 0 ).tempo );
@@ -23,8 +23,8 @@
2323 function testIterator()
2424 local list = luavsq.TempoTable.new();
2525 assert_equal( 0, list:size() );
26- list:push( luavsq.TempoTableEntry.new( 0, 500000, 0.0 ) );
27- list:push( luavsq.TempoTableEntry.new( 480, 525000, 0.5 ) );
26+ list:push( luavsq.TempoTableItem.new( 0, 500000, 0.0 ) );
27+ list:push( luavsq.TempoTableItem.new( 480, 525000, 0.5 ) );
2828 local i = list:iterator();
2929 assert_true( i:hasNext() );
3030 local item = i:next();
@@ -41,8 +41,8 @@
4141
4242 function testSort()
4343 local list = luavsq.TempoTable.new();
44- list:push( luavsq.TempoTableEntry.new( 480, 525000, 0.5 ) );
45- list:push( luavsq.TempoTableEntry.new( 0, 500000, 0.0 ) );
44+ list:push( luavsq.TempoTableItem.new( 480, 525000, 0.5 ) );
45+ list:push( luavsq.TempoTableItem.new( 0, 500000, 0.0 ) );
4646
4747 list:sort();
4848
@@ -56,8 +56,8 @@
5656
5757 function testClockFromSec()
5858 local list = luavsq.TempoTable.new();
59- list:push( luavsq.TempoTableEntry.new( 480, 480000, 0.0 ) );
60- list:push( luavsq.TempoTableEntry.new( 0, 500000, 0.0 ) );
59+ list:push( luavsq.TempoTableItem.new( 480, 480000, 0.0 ) );
60+ list:push( luavsq.TempoTableItem.new( 0, 500000, 0.0 ) );
6161 list:updateTempoInfo();
6262
6363 assert_equal( 0, list:getClockFromSec( 0.0 ) );
@@ -75,8 +75,8 @@
7575 assert_equal( 0.0, list:get( 0 ).time );
7676
7777 list = luavsq.TempoTable.new();
78- list:push( luavsq.TempoTableEntry.new( 480, 525000, 0.0 ) );
79- list:push( luavsq.TempoTableEntry.new( 0, 500000, 0.0 ) );
78+ list:push( luavsq.TempoTableItem.new( 480, 525000, 0.0 ) );
79+ list:push( luavsq.TempoTableItem.new( 0, 500000, 0.0 ) );
8080 list:updateTempoInfo();
8181 assert_equal( 2, list:size() );
8282 assert_equal( 0, list:get( 0 ).clock );
@@ -89,8 +89,8 @@
8989
9090 function testGetSecFromClock()
9191 list = luavsq.TempoTable.new();
92- list:push( luavsq.TempoTableEntry.new( 480, 480000, 0.0 ) );
93- list:push( luavsq.TempoTableEntry.new( 0, 500000, 0.0 ) );
92+ list:push( luavsq.TempoTableItem.new( 480, 480000, 0.0 ) );
93+ list:push( luavsq.TempoTableItem.new( 0, 500000, 0.0 ) );
9494 list:updateTempoInfo();
9595
9696 assert_equal( 0.0, list:getSecFromClock( 0 ) );
--- luavsq/trunk/test/MixerItemTest.lua (nonexistent)
+++ luavsq/trunk/test/MixerItemTest.lua (revision 1781)
@@ -0,0 +1,20 @@
1+require( "lunit" );
2+dofile( "../MixerItem.lua" );
3+module( "MixerItemTest", package.seeall, lunit.testcase );
4+
5+function testConstruct()
6+ local mixerEntry = luavsq.MixerItem.new( 1, 2, 3, 4 );
7+ assert_equal( 1, mixerEntry.feder );
8+ assert_equal( 2, mixerEntry.panpot );
9+ assert_equal( 3, mixerEntry.mute );
10+ assert_equal( 4, mixerEntry.solo );
11+end
12+
13+function testClone()
14+ local mixerEntry = luavsq.MixerItem.new( 1, 2, 3, 4 );
15+ local copy = mixerEntry:clone();
16+ assert_equal( 1, copy.feder );
17+ assert_equal( 2, copy.panpot );
18+ assert_equal( 3, copy.mute );
19+ assert_equal( 4, copy.solo );
20+end
--- luavsq/trunk/test/TrackTest.lua (revision 1780)
+++ luavsq/trunk/test/TrackTest.lua (revision 1781)
@@ -27,7 +27,7 @@
2727 dofile( "../VibratoBPList.lua" );
2828 dofile( "../Master.lua" );
2929 dofile( "../Mixer.lua" );
30-dofile( "../MixerEntry.lua" );
30+dofile( "../MixerItem.lua" );
3131 dofile( "../TextStream.lua" );
3232 dofile( "../Handle.lua" );
3333 dofile( "../HandleTypeEnum.lua" );
@@ -385,7 +385,7 @@
385385
386386 track.mixer = luavsq.Mixer.new( 1, 2, 3, 4 );
387387 track.mixer.slave = {};
388- track.mixer.slave[1] = luavsq.MixerEntry.new( 5, 6, 7, 8 );
388+ track.mixer.slave[1] = luavsq.MixerItem.new( 5, 6, 7, 8 );
389389
390390 track.common.version = "DSB301";
391391 track.common.name = "foo";
--- luavsq/trunk/test/TempoTableItemTest.lua (nonexistent)
+++ luavsq/trunk/test/TempoTableItemTest.lua (revision 1781)
@@ -0,0 +1,56 @@
1+require( "lunit" );
2+dofile( "../TempoTableItem.lua" );
3+module( "TempoTableItemTest", package.seeall, lunit.testcase );
4+
5+function testConstructor()
6+ local entry = luavsq.TempoTableItem.new();
7+ assert_equal( 0, entry.clock );
8+ assert_equal( 0, entry.tempo );
9+ assert_equal( 0.0, entry.time );
10+
11+ entry = luavsq.TempoTableItem.new( 480, 500000, 0.5 );
12+ assert_equal( 480, entry.clock );
13+ assert_equal( 500000, entry.tempo );
14+ assert_equal( 0.5, entry.time );
15+end
16+
17+function testToString()
18+ local entry = luavsq.TempoTableItem.new( 480, 500000, 0.5 );
19+ assert_equal( "{Clock=480, Tempo=500000, Time=0.5}", entry:toString() );
20+end
21+
22+function testClone()
23+ local entry = luavsq.TempoTableItem.new( 480, 500000, 0.5 );
24+ local copy = entry:clone();
25+ assert_equal( 480, copy.clock );
26+ assert_equal( 500000, copy.tempo );
27+ assert_equal( 0.5, copy.time );
28+end
29+
30+function testCompareTo()
31+ local a = luavsq.TempoTableItem.new();
32+ local b = luavsq.TempoTableItem.new( 480, 500000, 0.5 );
33+ assert_true( 0 < b:compareTo( a ) );
34+ assert_equal( 0, a:compareTo( a ) );
35+ assert_true( 0 > a:compareTo( b ) );
36+end
37+
38+function testEquals()
39+ local a = luavsq.TempoTableItem.new( 480, 500000, 0.5 );
40+ local b = luavsq.TempoTableItem.new( 480, 500000, 0.5 );
41+ assert_true( a:equals( b ) );
42+ -- クロックは同じだがtimeが違う
43+ b.time = 1;
44+ assert_true( a:equals( b ) );
45+ b.clock = 1;
46+ b.time = 0.5;
47+ assert_false( a:equals( b ) );
48+end
49+
50+function testCompare()
51+ local a = luavsq.TempoTableItem.new();
52+ local b = luavsq.TempoTableItem.new( 480, 500000, 0.5 );
53+ assert_false( luavsq.TempoTableItem.compare( b, a ) );
54+ assert_false( luavsq.TempoTableItem.compare( a, a ) );
55+ assert_true( luavsq.TempoTableItem.compare( a, b ) );
56+end
--- luavsq/trunk/MixerItem.lua (nonexistent)
+++ luavsq/trunk/MixerItem.lua (revision 1781)
@@ -0,0 +1,52 @@
1+--[[
2+ MixerItem.lua
3+ Copyright © 2011 kbinani
4+
5+ This file is part of luavvsq.
6+
7+ luavsq is free software; you can redistribute it and/or
8+ modify it under the terms of the BSD License.
9+
10+ luavsq is distributed in the hope that it will be useful,
11+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+]]
14+
15+if( nil == luavsq )then
16+ luavsq = {};
17+end
18+
19+if( nil == luavsq.MixerItem )then
20+
21+ ---
22+ -- VsqMixerのSlave要素に格納される各エントリ
23+ luavsq.MixerItem = {};
24+
25+ ---
26+ -- 各パラメータを指定したコンストラクタ
27+ -- @param feder (integer) Feder値
28+ -- @param panpot (integer) Panpot値
29+ -- @param mute (integer) Mute値
30+ -- @param solo (integer) Solo値
31+ function luavsq.MixerItem.new( feder, panpot, mute, solo )
32+ local this = {};
33+ this.feder = feder;
34+ this.panpot = panpot;
35+ this.mute = mute;
36+ this.solo = solo;
37+
38+ function this:_init_4( feder, panpot, mute, solo )
39+ self.feder = feder;
40+ self.panpot = panpot;
41+ self.mute = mute;
42+ self.solo = solo;
43+ end
44+
45+ function this:clone()
46+ return luavsq.MixerItem.new( self.feder, self.panpot, self.mute, self.solo );
47+ end
48+
49+ return this;
50+ end
51+
52+end
--- luavsq/trunk/TempoTableItem.lua (nonexistent)
+++ luavsq/trunk/TempoTableItem.lua (revision 1781)
@@ -0,0 +1,94 @@
1+--[[
2+ TempoTableItem.lua
3+ Copyright © 2011 kbinani
4+
5+ This file is part of luavsq.
6+
7+ luavsq is free software; you can redistribute it and/or
8+ modify it under the terms of the BSD License.
9+
10+ luavsq is distributed in the hope that it will be useful,
11+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+]]
14+
15+if( nil == luavsq )then
16+ luavsq = {};
17+end
18+
19+if( nil == luavsq.TempoTableItem )then
20+
21+ luavsq.TempoTableItem = {};
22+
23+ function luavsq.TempoTableItem.new( ... )
24+ local this = {};
25+ local arguments = { ... };
26+ this.clock = 0;
27+ this.tempo = 0;
28+ this.time = 0.0;
29+
30+ ---
31+ -- @return [string]
32+ function this:toString()
33+ return "{Clock=" .. self.clock .. ", Tempo=" .. self.tempo .. ", Time=" .. self.time .. "}";
34+ end
35+
36+ ---
37+ -- @return [object]
38+ function this:clone()
39+ return luavsq.TempoTableItem.new( self.clock, self.tempo, self.time );
40+ end
41+
42+ ---
43+ -- overload1
44+ -- @return [TempoTableItem]
45+ --
46+ -- overload2
47+ -- @param clock [int]
48+ -- @param _tempo [int]
49+ -- @param _time [int]
50+ -- @return [TempoTableItem]
51+ function this:_init_3( clock, tempo, time )
52+ self.clock = clock;
53+ self.tempo = tempo;
54+ self.time = time;
55+ end
56+
57+ ---
58+ -- @param entry [TempoTableItem]
59+ -- @return [int]
60+ function this:compareTo( entry )
61+ return self.clock - entry.clock;
62+ end
63+
64+ ---
65+ -- @param entry [TempoTableItem]
66+ -- @return [bool]
67+ function this:equals( entry )
68+ if( self.clock == entry.clock )then
69+ return true;
70+ else
71+ return false;
72+ end
73+ end
74+
75+ if( #arguments == 3 )then
76+ this:_init_3( arguments[1], arguments[2], arguments[3] );
77+ end
78+
79+ return this;
80+ end
81+
82+ ---
83+ -- @param a [TempoTableItem]
84+ -- @param b [TempoTableItem]
85+ -- @return [int]
86+ function luavsq.TempoTableItem.compare( a, b )
87+ if( a:compareTo( b ) < 0 )then
88+ return true;
89+ else
90+ return false;
91+ end
92+ end
93+
94+end
旧リポジトリブラウザで表示