[luavsq] 〜Entryというクラス名を〜Itemに変更
@@ -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 |
@@ -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 |
@@ -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 |
@@ -25,7 +25,7 @@ | ||
25 | 25 | |
26 | 26 | --- |
27 | 27 | -- データ点を追加する |
28 | - -- @param (luavsq.TimesigTableEntry) | |
28 | + -- @param (luavsq.TimesigTableItem) | |
29 | 29 | function this:push( item ) |
30 | 30 | self._list:push( item ); |
31 | 31 | end |
@@ -33,7 +33,7 @@ | ||
33 | 33 | --- |
34 | 34 | -- データ点を取得する |
35 | 35 | -- @param (number) index 取得するデータ点のインデックス(0から始まる) |
36 | - -- @return (luavsq.TimesigTableEntry) | |
36 | + -- @return (luavsq.TimesigTableItem) | |
37 | 37 | function this:get( index ) |
38 | 38 | return self._list[index]; |
39 | 39 | end |
@@ -41,7 +41,7 @@ | ||
41 | 41 | --- |
42 | 42 | -- データ点を設定する |
43 | 43 | -- @param (number) index 設定するデータ点のインデックス(0から始まる) |
44 | - -- @param (luavsq.TimesigTableEntry) | |
44 | + -- @param (luavsq.TimesigTableItem) | |
45 | 45 | function this:set( index, value ) |
46 | 46 | self._list[index] = value; |
47 | 47 | end |
@@ -53,7 +53,7 @@ | ||
53 | 53 | return; |
54 | 54 | end |
55 | 55 | 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 ); | |
57 | 57 | local count = self._list:size(); |
58 | 58 | local j; |
59 | 59 | for j = 1, count - 1, 1 do |
@@ -73,7 +73,7 @@ | ||
73 | 73 | -- @param (number) clock ゲートタイム |
74 | 74 | -- @return (luavsq.Timesig) 指定されたゲートタイムでの拍子情報 |
75 | 75 | function this:getTimesigAt( clock ) |
76 | - local ret = luavsq.TimesigTableEntry.new(); | |
76 | + local ret = luavsq.TimesigTableItem.new(); | |
77 | 77 | ret.numerator = 4; |
78 | 78 | ret.denominator = 4; |
79 | 79 | local index = 0; |
@@ -93,7 +93,7 @@ | ||
93 | 93 | --- |
94 | 94 | -- 指定されたゲートタイムにおける拍子情報を取得する |
95 | 95 | -- @param (number) clock ゲートタイム |
96 | - -- @return (luavsq.TimesigTableEntry) 指定されたゲートタイムでの拍子情報 | |
96 | + -- @return (luavsq.TimesigTableItem) 指定されたゲートタイムでの拍子情報 | |
97 | 97 | function this:findTimesigAt( clock ) |
98 | 98 | local index = 0; |
99 | 99 | local c = self._list:size(); |
@@ -94,7 +94,7 @@ | ||
94 | 94 | self.slave = {}; |
95 | 95 | local i; |
96 | 96 | 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 ); | |
98 | 98 | end |
99 | 99 | spl = luavsq.Util.split( buffer, "\n" ); |
100 | 100 | local spl2; |
@@ -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 |
@@ -27,7 +27,7 @@ | ||
27 | 27 | this._array = luavsq.List.new(); |
28 | 28 | |
29 | 29 | --- |
30 | - -- @return [Iterator<TempoTableEntry>] | |
30 | + -- @return [Iterator<TempoTableItem>] | |
31 | 31 | function this:iterator() |
32 | 32 | return this._array:iterator(); |
33 | 33 | end |
@@ -36,12 +36,12 @@ | ||
36 | 36 | -- データ点を時刻順に並べ替えます |
37 | 37 | -- @return [void] |
38 | 38 | function this:sort() |
39 | - self._array:sort( luavsq.TempoTableEntry.compare ); | |
39 | + self._array:sort( luavsq.TempoTableItem.compare ); | |
40 | 40 | end |
41 | 41 | |
42 | 42 | --- |
43 | 43 | -- データ点を追加します |
44 | - -- @param value [TempoTableEntry] | |
44 | + -- @param value [TempoTableItem] | |
45 | 45 | -- @return [void] |
46 | 46 | function this:push( value ) |
47 | 47 | self._array:push( value ); |
@@ -57,7 +57,7 @@ | ||
57 | 57 | --- |
58 | 58 | -- 第index番目のデータ点を取得します |
59 | 59 | -- @param index [int] 0 から始まるインデックス |
60 | - -- @return [TempoTableEntry] | |
60 | + -- @return [TempoTableItem] | |
61 | 61 | function this:get( index ) |
62 | 62 | return self._array[index]; |
63 | 63 | end |
@@ -65,7 +65,7 @@ | ||
65 | 65 | --- |
66 | 66 | -- データ点を設定します |
67 | 67 | -- @param index [int] |
68 | - -- @param value [TempoTableEntry] | |
68 | + -- @param value [TempoTableItem] | |
69 | 69 | -- @return [void] |
70 | 70 | function this:set( index, value ) |
71 | 71 | self._array[index] = value; |
@@ -106,9 +106,9 @@ | ||
106 | 106 | function this:updateTempoInfo() |
107 | 107 | local c = self._array:size(); |
108 | 108 | 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 ) ); | |
110 | 110 | end |
111 | - self._array:sort( luavsq.TempoTableEntry.compare ); | |
111 | + self._array:sort( luavsq.TempoTableItem.compare ); | |
112 | 112 | local item0 = self._array[0]; |
113 | 113 | if( item0.clock ~= 0 )then |
114 | 114 | item0.time = luavsq.TempoTable.baseTempo * item0.clock / (luavsq.TempoTable.gatetimePerQuater * 1000000.0); |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -1,15 +1,15 @@ | ||
1 | 1 | require( "lunit" ); |
2 | 2 | dofile( "../TimesigTable.lua" ); |
3 | 3 | dofile( "../List.lua" ); |
4 | -dofile( "../TimesigTableEntry.lua" ); | |
4 | +dofile( "../TimesigTableItem.lua" ); | |
5 | 5 | dofile( "../Timesig.lua" ); |
6 | 6 | module( "TimesigTableTest", package.seeall, lunit.testcase ); |
7 | 7 | |
8 | 8 | function testUpdateTimesigInfo() |
9 | 9 | 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 ) ); | |
13 | 13 | table:updateTimesigInfo(); |
14 | 14 | |
15 | 15 | assert_equal( 0, table:get( 0 ).clock ); |
@@ -22,9 +22,9 @@ | ||
22 | 22 | |
23 | 23 | function testGetTimesigAt() |
24 | 24 | 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 ) ); | |
28 | 28 | table:updateTimesigInfo(); |
29 | 29 | |
30 | 30 | local timesig = table:getTimesigAt( 480 ); |
@@ -42,9 +42,9 @@ | ||
42 | 42 | |
43 | 43 | function testFindTimesigAt() |
44 | 44 | 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開始 | |
48 | 48 | table:updateTimesigInfo(); |
49 | 49 | |
50 | 50 | local timesig = table:findTimesigAt( 480 ); |
@@ -70,9 +70,9 @@ | ||
70 | 70 | |
71 | 71 | function testGetClockFromBarCount() |
72 | 72 | 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開始 | |
76 | 76 | table:updateTimesigInfo(); |
77 | 77 | |
78 | 78 | assert_equal( 0, table:getClockFromBarCount( 0 ) ); |
@@ -83,9 +83,9 @@ | ||
83 | 83 | |
84 | 84 | function testGetBarCountFromClock() |
85 | 85 | 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開始 | |
89 | 89 | table:updateTimesigInfo(); |
90 | 90 | |
91 | 91 | assert_equal( 0, table:getBarCountFromClock( 0 ) ); |
@@ -1,6 +1,6 @@ | ||
1 | 1 | require( "lunit" ); |
2 | 2 | dofile( "../Mixer.lua" ); |
3 | -dofile( "../MixerEntry.lua" ); | |
3 | +dofile( "../MixerItem.lua" ); | |
4 | 4 | dofile( "../TextStream.lua" ); |
5 | 5 | dofile( "../Util.lua" ); |
6 | 6 | module( "MixerTest", package.seeall, lunit.testcase ); |
@@ -44,8 +44,8 @@ | ||
44 | 44 | function testClone() |
45 | 45 | local mixer = luavsq.Mixer.new( 1, 2, 3, 4 ); |
46 | 46 | 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 ); | |
49 | 49 | |
50 | 50 | local copy = mixer:clone(); |
51 | 51 | assert_equal( 2, #copy.slave ); |
@@ -66,8 +66,8 @@ | ||
66 | 66 | function testWrite() |
67 | 67 | local mixer = luavsq.Mixer.new( 1, 2, 3, 4 ); |
68 | 68 | 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 ); | |
71 | 71 | local stream = luavsq.TextStream.new(); |
72 | 72 | mixer:write( stream ); |
73 | 73 | local expected = |
@@ -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 |
@@ -1,7 +1,7 @@ | ||
1 | 1 | require( "lunit" ); |
2 | 2 | dofile( "../TempoTable.lua" ); |
3 | 3 | dofile( "../List.lua" ); |
4 | -dofile( "../TempoTableEntry.lua" ); | |
4 | +dofile( "../TempoTableItem.lua" ); | |
5 | 5 | module( "TempoTableTest", package.seeall, lunit.testcase ); |
6 | 6 | |
7 | 7 | --- |
@@ -9,8 +9,8 @@ | ||
9 | 9 | function test() |
10 | 10 | local list = luavsq.TempoTable.new(); |
11 | 11 | 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 ) ); | |
14 | 14 | assert_equal( 2, list:size() ); |
15 | 15 | assert_equal( 0, list:get( 0 ).clock ); |
16 | 16 | assert_equal( 500000, list:get( 0 ).tempo ); |
@@ -23,8 +23,8 @@ | ||
23 | 23 | function testIterator() |
24 | 24 | local list = luavsq.TempoTable.new(); |
25 | 25 | 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 ) ); | |
28 | 28 | local i = list:iterator(); |
29 | 29 | assert_true( i:hasNext() ); |
30 | 30 | local item = i:next(); |
@@ -41,8 +41,8 @@ | ||
41 | 41 | |
42 | 42 | function testSort() |
43 | 43 | 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 ) ); | |
46 | 46 | |
47 | 47 | list:sort(); |
48 | 48 |
@@ -56,8 +56,8 @@ | ||
56 | 56 | |
57 | 57 | function testClockFromSec() |
58 | 58 | 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 ) ); | |
61 | 61 | list:updateTempoInfo(); |
62 | 62 | |
63 | 63 | assert_equal( 0, list:getClockFromSec( 0.0 ) ); |
@@ -75,8 +75,8 @@ | ||
75 | 75 | assert_equal( 0.0, list:get( 0 ).time ); |
76 | 76 | |
77 | 77 | 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 ) ); | |
80 | 80 | list:updateTempoInfo(); |
81 | 81 | assert_equal( 2, list:size() ); |
82 | 82 | assert_equal( 0, list:get( 0 ).clock ); |
@@ -89,8 +89,8 @@ | ||
89 | 89 | |
90 | 90 | function testGetSecFromClock() |
91 | 91 | 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 ) ); | |
94 | 94 | list:updateTempoInfo(); |
95 | 95 | |
96 | 96 | assert_equal( 0.0, list:getSecFromClock( 0 ) ); |
@@ -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 |
@@ -27,7 +27,7 @@ | ||
27 | 27 | dofile( "../VibratoBPList.lua" ); |
28 | 28 | dofile( "../Master.lua" ); |
29 | 29 | dofile( "../Mixer.lua" ); |
30 | -dofile( "../MixerEntry.lua" ); | |
30 | +dofile( "../MixerItem.lua" ); | |
31 | 31 | dofile( "../TextStream.lua" ); |
32 | 32 | dofile( "../Handle.lua" ); |
33 | 33 | dofile( "../HandleTypeEnum.lua" ); |
@@ -385,7 +385,7 @@ | ||
385 | 385 | |
386 | 386 | track.mixer = luavsq.Mixer.new( 1, 2, 3, 4 ); |
387 | 387 | 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 ); | |
389 | 389 | |
390 | 390 | track.common.version = "DSB301"; |
391 | 391 | track.common.name = "foo"; |
@@ -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 |
@@ -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 |
@@ -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 |