[luavsq] 各種ハンドルの処理をHandleクラスに移動した
@@ -1,178 +0,0 @@ | ||
1 | ---[[ | |
2 | - VibratoHandle.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 GPL version 3 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 | -module( "luavsq" ); | |
16 | - | |
17 | ---- | |
18 | --- ビブラートハンドルを表すクラス | |
19 | --- @class table | |
20 | --- @name VibratoHandle | |
21 | -VibratoHandle = {}; | |
22 | - | |
23 | ---- | |
24 | --- 初期化を行う | |
25 | --- @return (VibratoHandle) | |
26 | -function VibratoHandle.new() | |
27 | - local this = IconParameter.new(); | |
28 | - this.articulation = ArticulationTypeEnum.Vibrato; | |
29 | - this.index = 0; | |
30 | - this.iconId = ""; | |
31 | - this.ids = ""; | |
32 | - this.original = 0; | |
33 | - this.startRate = 64; | |
34 | - this.startDepth = 64; | |
35 | - this.rateBP = VibratoBPList.new(); | |
36 | - this.depthBP = VibratoBPList.new(); | |
37 | - | |
38 | - --- | |
39 | - -- 文字列に変換する | |
40 | - -- @return (string) 文字列 | |
41 | - function this:toString() | |
42 | - return self:getDisplayString(); | |
43 | - end | |
44 | - | |
45 | - --- | |
46 | - -- Rate のビブラートカーブを取得する | |
47 | - -- @return (VibratoBPList) Rate のビブラートカーブ | |
48 | - function this:getRateBP() | |
49 | - return self.rateBP; | |
50 | - end | |
51 | - | |
52 | - --- | |
53 | - -- Rate のビブラートカーブを設定する | |
54 | - -- @param value (VibratoBPList) 設定するビブラートカーブ | |
55 | - function this:setRateBP( value ) | |
56 | - self.rateBP = value; | |
57 | - end | |
58 | - | |
59 | - --- | |
60 | - -- キャプションを取得する | |
61 | - -- @return (string) キャプション | |
62 | - function this:getCaption() | |
63 | - return self.caption; | |
64 | - end | |
65 | - | |
66 | - --- | |
67 | - -- キャプションを設定する | |
68 | - -- @param value (string) キャプション | |
69 | - function this:setCaption( value ) | |
70 | - self.caption = value; | |
71 | - end | |
72 | - | |
73 | - --- | |
74 | - -- Rate の開始値を取得する | |
75 | - -- @return (integer) Rate の開始値 | |
76 | - function this:getStartRate() | |
77 | - return self.startRate; | |
78 | - end | |
79 | - | |
80 | - --- | |
81 | - -- Rate の開始値を設定する | |
82 | - -- @param value (integer) Rate の開始値 | |
83 | - function this:setStartRate( value ) | |
84 | - self.startRate = value; | |
85 | - end | |
86 | - | |
87 | - --- | |
88 | - -- Depth のビブラートカーブを取得する | |
89 | - -- @return (VibratoBPList) Depth のビビラートカーブ | |
90 | - function this:getDepthBP() | |
91 | - return self.depthBP; | |
92 | - end | |
93 | - | |
94 | - --- | |
95 | - -- Depth のビブラートカーブを設定する | |
96 | - -- @param value (VibratoBPList) 設定するビブラートカーブ | |
97 | - function this:setDepthBP( value ) | |
98 | - self.depthBP = value; | |
99 | - end | |
100 | - | |
101 | - --- | |
102 | - -- Depth の開始値を取得する | |
103 | - -- @return (integer) Depth の開始値 | |
104 | - function this:getStartDepth() | |
105 | - return self.startDepth; | |
106 | - end | |
107 | - | |
108 | - --- | |
109 | - -- Depth の開始値を設定する | |
110 | - -- @param value (integer) Depth の開始値 | |
111 | - function this:setStartDepth( value ) | |
112 | - self.startDepth = value; | |
113 | - end | |
114 | - | |
115 | - --- | |
116 | - -- 長さを取得する | |
117 | - -- @return (integer) Tick 単位の長さ | |
118 | - function this:getLength() | |
119 | - return self.length; | |
120 | - end | |
121 | - | |
122 | - --- | |
123 | - -- 長さを設定する | |
124 | - -- @param value (integer) Tick 単位の長さ | |
125 | - function this:setLength( value ) | |
126 | - self.length = value; | |
127 | - end | |
128 | - | |
129 | - --- | |
130 | - -- Display String の値を取得する | |
131 | - -- @return (string) Display String の値 | |
132 | - function this:getDisplayString() | |
133 | - return self.caption; | |
134 | - end | |
135 | - | |
136 | - --- | |
137 | - -- コピーを作成する | |
138 | - -- @return (VibratoHandle) このオブジェクトのコピー | |
139 | - function this:clone() | |
140 | - local result = VibratoHandle.new(); | |
141 | - result.index = self.index; | |
142 | - result.iconId = self.iconId; | |
143 | - result.ids = self.ids; | |
144 | - result.original = self.original; | |
145 | - result:setCaption( self.caption ); | |
146 | - result:setLength( self:getLength() ); | |
147 | - result:setStartDepth( self.startDepth ); | |
148 | - if( nil ~= self.depthBP )then | |
149 | - result:setDepthBP( self.depthBP:clone() ); | |
150 | - end | |
151 | - result:setStartRate( self.startRate ); | |
152 | - if( nil ~= self.rateBP )then | |
153 | - result:setRateBP( self.rateBP:clone() ); | |
154 | - end | |
155 | - return result; | |
156 | - end | |
157 | - | |
158 | - --- | |
159 | - -- このオブジェクトを、Handle に型変換する | |
160 | - -- @return (Handle) ハンドル | |
161 | - function this:castToHandle() | |
162 | - local ret = Handle.new(); | |
163 | - ret._type = HandleTypeEnum.Vibrato; | |
164 | - ret.index = self.index; | |
165 | - ret.iconId = self.iconId; | |
166 | - ret.ids = self.ids; | |
167 | - ret.original = self.original; | |
168 | - ret.caption = self.caption; | |
169 | - ret:setLength( self:getLength() ); | |
170 | - ret.startDepth = self.startDepth; | |
171 | - ret.startRate = self.startRate; | |
172 | - ret.depthBP = self.depthBP:clone(); | |
173 | - ret.rateBP = self.rateBP:clone(); | |
174 | - return ret; | |
175 | - end | |
176 | - | |
177 | - return this; | |
178 | -end |
@@ -1,100 +0,0 @@ | ||
1 | ---[[ | |
2 | - LyricHandle.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 GPL version 3 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 | -local table = table; | |
16 | - | |
17 | -module( "luavsq" ); | |
18 | - | |
19 | ---- | |
20 | --- 歌詞ハンドル | |
21 | --- @class table | |
22 | --- @name LyricHandle | |
23 | -LyricHandle = {}; | |
24 | - | |
25 | ---- | |
26 | --- 初期化を行う | |
27 | --- @param phrase (string) 歌詞 | |
28 | --- @param phoneticSymbol (string) 発音記号 | |
29 | --- @return (LyricHandle) | |
30 | -function LyricHandle.new( ... ) | |
31 | - local arguments = { ... }; | |
32 | - local this = {}; | |
33 | - this.articulation = ArticulationTypeEnum.Vibrato; | |
34 | - | |
35 | - --- | |
36 | - -- @var index (integer) | |
37 | - this.index = 0; | |
38 | - | |
39 | - --- | |
40 | - -- @var lyrics (table<Lyric>) | |
41 | - this.lyrics = {}; | |
42 | - | |
43 | - if( #arguments >= 2 )then | |
44 | - local phrase = arguments[1]; | |
45 | - local phoneticSymbol = arguments[2]; | |
46 | - this.lyrics[1] = Lyric.new( phrase, phoneticSymbol ); | |
47 | - else | |
48 | - this.lyrics[1] = Lyric.new(); | |
49 | - end | |
50 | - | |
51 | - --- | |
52 | - -- 指定した位置にある歌詞を取得する | |
53 | - -- @param index (integer) 取得する要素のインデックス(最初のインデックスは0) | |
54 | - -- @return (Lyric) 歌詞 | |
55 | - function this:getLyricAt( index ) | |
56 | - return self.lyrics[index + 1]; | |
57 | - end | |
58 | - | |
59 | - --- | |
60 | - -- 指定した位置にある歌詞を指定した要素で置き換える | |
61 | - -- @param index (integer) 置き換える要素のインデックス(最初のインデックスは0) | |
62 | - -- @param value (Lyric) 置き換える要素 | |
63 | - function this:setLyricAt( index, value ) | |
64 | - self.lyrics[index + 1] = value; | |
65 | - end | |
66 | - | |
67 | - --- | |
68 | - -- 歌詞の個数を返す | |
69 | - -- @return (integer) 歌詞の個数 | |
70 | - function this:size() | |
71 | - return #self.lyrics; | |
72 | - end | |
73 | - | |
74 | - --- | |
75 | - -- コピーを作成する | |
76 | - -- @return (LyricHandle) このオブジェクトのコピー | |
77 | - function this:clone() | |
78 | - local result = LyricHandle.new(); | |
79 | - result.index = self.index; | |
80 | - result.lyrics = {}; | |
81 | - for i = 1, #self.lyrics, 1 do | |
82 | - local buf = self.lyrics[i]:clone(); | |
83 | - table.insert( result.lyrics, buf ); | |
84 | - end | |
85 | - return result; | |
86 | - end | |
87 | - | |
88 | - --- | |
89 | - -- このオブジェクトを Handle に型変換する | |
90 | - -- @return (Handle) 変換後の Handle | |
91 | - function this:castToHandle() | |
92 | - local result = Handle.new(); | |
93 | - result._type = HandleTypeEnum.Lyric; | |
94 | - result.lyrics = self.lyrics; | |
95 | - result.index = self.index; | |
96 | - return result; | |
97 | - end | |
98 | - | |
99 | - return this; | |
100 | -end |
@@ -1,195 +0,0 @@ | ||
1 | ---[[ | |
2 | - IconDynamicsHandle.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 GPL version 3 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 | -module( "luavsq" ); | |
16 | - | |
17 | ---- | |
18 | --- ダイナミクスハンドル | |
19 | --- @class table | |
20 | --- @name IconDynamicsHandle | |
21 | -IconDynamicsHandle = {}; | |
22 | - | |
23 | ---- | |
24 | --- 強弱記号の場合の、IconId の最初の5文字。 | |
25 | -IconDynamicsHandle.ICONID_HEAD_DYNAFF = "$0501"; | |
26 | - | |
27 | ---- | |
28 | --- クレッシェンドの場合の、IconId の最初の5文字。 | |
29 | -IconDynamicsHandle.ICONID_HEAD_CRESCEND = "$0502"; | |
30 | - | |
31 | ---- | |
32 | --- デクレッシェンドの場合の、IconId の最初の5文字。 | |
33 | -IconDynamicsHandle.ICONID_HEAD_DECRESCEND = "$0503"; | |
34 | - | |
35 | ---- | |
36 | --- 初期化を行う | |
37 | --- @return (IconDynamicsHandle) | |
38 | -function IconDynamicsHandle.new() | |
39 | - local this = IconParameter.new(); | |
40 | - | |
41 | - this.articulation = ArticulationTypeEnum.Dynaff; | |
42 | - | |
43 | - --- | |
44 | - -- この強弱記号設定を一意に識別するためのIDです。 | |
45 | - this.iconId = ""; | |
46 | - | |
47 | - --- | |
48 | - -- ユーザ・フレンドリー名です。 | |
49 | - -- このフィールドの値は、他の強弱記号設定のユーザ・フレンドリー名と重複する場合があります。 | |
50 | - this.ids = ""; | |
51 | - | |
52 | - --- | |
53 | - -- この強弱記号設定が他の強弱記号設定から派生したものである場合、派生元を特定するための番号です。 | |
54 | - this.original = 0; | |
55 | - | |
56 | - --- | |
57 | - -- このハンドルが強弱記号を表すものかどうかを表すブール値を取得する | |
58 | - -- @return (boolean) このオブジェクトが強弱記号を表すものであれば true を、そうでなければ false を返す | |
59 | - function this:isDynaffType() | |
60 | - if( nil ~= self.iconId )then | |
61 | - return self.iconId:find( IconDynamicsHandle.ICONID_HEAD_DYNAFF ) == 1; | |
62 | - else | |
63 | - return false; | |
64 | - end | |
65 | - end | |
66 | - | |
67 | - --- | |
68 | - -- このハンドルがクレッシェンドを表すものかどうかを表すブール値を取得する | |
69 | - -- @return (boolean) このオブジェクトがクレッシェンドを表すものであれば true を、そうでなければ false を返す | |
70 | - function this:isCrescendType() | |
71 | - if( nil ~= self.iconId )then | |
72 | - return self.iconId:find( IconDynamicsHandle.ICONID_HEAD_CRESCEND ) == 1; | |
73 | - else | |
74 | - return false; | |
75 | - end | |
76 | - end | |
77 | - | |
78 | - --- | |
79 | - -- このハンドルがデクレッシェンドを表すものかどうかを表すブール値を取得する | |
80 | - -- @return (boolean) このオブジェクトがデクレッシェンドを表すものであれば true を、そうでなければ false を返す | |
81 | - function this:isDecrescendType() | |
82 | - if( nil ~= self.iconId )then | |
83 | - return self.iconId:find( IconDynamicsHandle.ICONID_HEAD_DECRESCEND ) == 1; | |
84 | - else | |
85 | - return false; | |
86 | - end | |
87 | - end | |
88 | - | |
89 | - --- | |
90 | - -- コピーを作成する | |
91 | - -- @return (IconDynamicsHandle) このインスタンスのコピー | |
92 | - function this:clone() | |
93 | - local ret = IconDynamicsHandle.new(); | |
94 | - ret.iconId = self.iconId; | |
95 | - ret.ids = self.ids; | |
96 | - ret.original = self.original; | |
97 | - ret:setCaption( self:getCaption() ); | |
98 | - ret:setStartDyn( self:getStartDyn() ); | |
99 | - ret:setEndDyn( self:getEndDyn() ); | |
100 | - if( nil ~= self.dynBP )then | |
101 | - ret:setDynBP( self.dynBP:clone() ); | |
102 | - end | |
103 | - ret:setLength( self:getLength() ); | |
104 | - return ret; | |
105 | - end | |
106 | - | |
107 | - --- | |
108 | - -- このオブジェクトを、Handle に型変換する | |
109 | - -- @return (Handle) ハンドル | |
110 | - function this:castToHandle() | |
111 | - local ret = Handle.new(); | |
112 | - ret._type = HandleTypeEnum.Dynamics; | |
113 | - ret.iconId = self.iconId; | |
114 | - ret.ids = self.ids; | |
115 | - ret.original = self.original; | |
116 | - ret.caption = self:getCaption(); | |
117 | - ret.dynBP = self:getDynBP(); | |
118 | - ret.endDyn = self:getEndDyn(); | |
119 | - ret:setLength( self:getLength() ); | |
120 | - ret.startDyn = self:getStartDyn(); | |
121 | - return ret; | |
122 | - end | |
123 | - | |
124 | - --- | |
125 | - -- キャプションを取得する | |
126 | - -- @return (string) キャプション | |
127 | - function this:getCaption() | |
128 | - return self.caption; | |
129 | - end | |
130 | - | |
131 | - --- | |
132 | - -- キャプションを設定する | |
133 | - -- @param value (string) | |
134 | - function this:setCaption( value ) | |
135 | - self.caption = value; | |
136 | - end | |
137 | - | |
138 | - --- | |
139 | - -- 長さを取得する | |
140 | - -- @return (integer) Tick 単位の長さ | |
141 | - function this:getLength() | |
142 | - return self.length; | |
143 | - end | |
144 | - | |
145 | - --- | |
146 | - -- 長さを設定する | |
147 | - -- @param value (integer) Tick 単位の長さ | |
148 | - function this:setLength( value ) | |
149 | - self.length = value; | |
150 | - end | |
151 | - | |
152 | - --- | |
153 | - -- DYN の開始値を取得する | |
154 | - -- @return (integer) DYN の開始値 | |
155 | - function this:getStartDyn() | |
156 | - return self.startDyn; | |
157 | - end | |
158 | - | |
159 | - --- | |
160 | - -- DYN の開始値を設定する | |
161 | - -- @param value (integer) DYN の開始値 | |
162 | - function this:setStartDyn( value ) | |
163 | - self.startDyn = value; | |
164 | - end | |
165 | - | |
166 | - --- | |
167 | - -- DYN の終了値を取得する | |
168 | - -- @return (integer) DYN の終了値 | |
169 | - function this:getEndDyn() | |
170 | - return self.endDyn; | |
171 | - end | |
172 | - | |
173 | - --- | |
174 | - -- DYN の終了値を設定する | |
175 | - -- @param value (integer) DYN の終了値 | |
176 | - function this:setEndDyn( value ) | |
177 | - self.endDyn = value; | |
178 | - end | |
179 | - | |
180 | - --- | |
181 | - -- DYN カーブを取得する | |
182 | - -- @return (VibratoBPList) DYN カーブ | |
183 | - function this:getDynBP() | |
184 | - return self.dynBP; | |
185 | - end | |
186 | - | |
187 | - --- | |
188 | - -- DYN カーブを設定する | |
189 | - -- @param value (VibratoBPList) DYN カーブ | |
190 | - function this:setDynBP( value ) | |
191 | - self.dynBP = value; | |
192 | - end | |
193 | - | |
194 | - return this; | |
195 | -end |
@@ -1,112 +0,0 @@ | ||
1 | ---[[ | |
2 | - SingerHandle.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 GPL version 3 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 | -module( "luavsq" ); | |
16 | - | |
17 | ---- | |
18 | --- 歌手ハンドルを表すクラス | |
19 | --- @class table | |
20 | --- @name SingerHandle | |
21 | -SingerHandle = {}; | |
22 | - | |
23 | ---- | |
24 | --- 初期化を行う | |
25 | --- @return (SingerHandle) | |
26 | -function SingerHandle.new() | |
27 | - local this = {}; | |
28 | - | |
29 | - --- | |
30 | - -- キャプション。 | |
31 | - this.caption = ""; | |
32 | - | |
33 | - --- | |
34 | - -- この歌手設定を一意に識別するための ID です。 | |
35 | - this.iconId = ""; | |
36 | - | |
37 | - --- | |
38 | - -- ユーザ・フレンドリー名。 | |
39 | - -- このフィールドの値は、他の歌手設定のユーザ・フレンドリー名と重複する場合があります。 | |
40 | - this.ids = ""; | |
41 | - | |
42 | - this.index = 0; | |
43 | - | |
44 | - --- | |
45 | - -- ゲートタイム長さ。 | |
46 | - this.length = 0; | |
47 | - | |
48 | - this.original = 0; | |
49 | - this.program = 0; | |
50 | - this.language = 0; | |
51 | - | |
52 | - --- | |
53 | - -- 長さを取得する | |
54 | - -- @return (integer) Tick 単位の長さ | |
55 | - function this:getLength() | |
56 | - return self.length; | |
57 | - end | |
58 | - | |
59 | - --- | |
60 | - -- 長さを設定する | |
61 | - -- @param value (integer) Tick 単位の長さ | |
62 | - function this:setLength( value ) | |
63 | - self.length = value; | |
64 | - end | |
65 | - | |
66 | - --- | |
67 | - -- このオブジェクトのインスタンスと、指定されたオブジェクトが同じかどうかを調べる | |
68 | - -- @param item (SingerHandle) 比較対象のオブジェクト | |
69 | - -- @return (boolean) 比較対象と同じであれば true を、そうでなければ false を返す | |
70 | - function this:equals( item ) | |
71 | - if( nil == item )then | |
72 | - return false; | |
73 | - else | |
74 | - return self.iconId == item.iconId; | |
75 | - end | |
76 | - end | |
77 | - | |
78 | - --- | |
79 | - -- コピーを作成する | |
80 | - -- @return (SingerHandle) このオブジェクトのコピー | |
81 | - function this:clone() | |
82 | - local ret = SingerHandle.new(); | |
83 | - ret.caption = self.caption; | |
84 | - ret.iconId = self.iconId; | |
85 | - ret.ids = self.ids; | |
86 | - ret.index = self.index; | |
87 | - ret.language = self.language; | |
88 | - ret:setLength( self.length ); | |
89 | - ret.original = self.original; | |
90 | - ret.program = self.program; | |
91 | - return ret; | |
92 | - end | |
93 | - | |
94 | - --- | |
95 | - -- このオブジェクトを、Handle に型変換する | |
96 | - -- @return (Handle) ハンドル | |
97 | - function this:castToHandle() | |
98 | - local ret = Handle.new(); | |
99 | - ret._type = HandleTypeEnum.Singer; | |
100 | - ret.caption = self.caption; | |
101 | - ret.iconId = self.iconId; | |
102 | - ret.ids = self.ids; | |
103 | - ret.index = self.index; | |
104 | - ret.language = self.language; | |
105 | - ret:setLength( self.length ); | |
106 | - ret.program = self.program; | |
107 | - ret.original = self.original; | |
108 | - return ret; | |
109 | - end | |
110 | - | |
111 | - return this; | |
112 | -end |
@@ -1,143 +0,0 @@ | ||
1 | ---[[ | |
2 | - NoteHeadHandle.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 GPL version 3 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 | -module( "luavsq" ); | |
16 | - | |
17 | ---- | |
18 | --- アタックハンドル | |
19 | --- @class table | |
20 | --- @name NoteHeadHandle | |
21 | -NoteHeadHandle = {}; | |
22 | - | |
23 | ---- | |
24 | --- 初期化を行う | |
25 | --- @return (NoteHeadHandle) | |
26 | -function NoteHeadHandle.new( ids, iconId, index ) | |
27 | - local this = IconParameter.new(); | |
28 | - | |
29 | - this.articulation = ArticulationTypeEnum.NoteAttack; | |
30 | - this.index = 0; | |
31 | - this.iconId = ""; | |
32 | - this.ids = ""; | |
33 | - this.original = 0; | |
34 | - | |
35 | - --- | |
36 | - -- 文字列に変換する | |
37 | - -- @return (string) 変換後の文字列 | |
38 | - function this:toString() | |
39 | - return self:getDisplayString(); | |
40 | - end | |
41 | - | |
42 | - --- | |
43 | - -- Depth 値を取得する | |
44 | - -- @return (integer) Depth 値 | |
45 | - function this:getDepth() | |
46 | - return self.depth; | |
47 | - end | |
48 | - | |
49 | - --- | |
50 | - -- Depth 値を設定する | |
51 | - -- @param value (integer) Depth 値 | |
52 | - function this:setDepth( value ) | |
53 | - self.depth = value; | |
54 | - end | |
55 | - | |
56 | - --- | |
57 | - -- Duration 値を取得する | |
58 | - -- @return (integer) Duration 値 | |
59 | - function this:getDuration() | |
60 | - return self.duration; | |
61 | - end | |
62 | - | |
63 | - --- | |
64 | - -- Duration 値を設定する | |
65 | - -- @param value (integer) Duration 値 | |
66 | - function this:setDuration( value ) | |
67 | - self.duration = value; | |
68 | - end | |
69 | - | |
70 | - --- | |
71 | - -- キャプションを取得する | |
72 | - -- @return (string) キャプション | |
73 | - function this:getCaption() | |
74 | - return self.caption; | |
75 | - end | |
76 | - | |
77 | - --- | |
78 | - -- キャプションを設定する | |
79 | - -- @param value (string) キャプション | |
80 | - function this:setCaption( value ) | |
81 | - self.caption = value; | |
82 | - end | |
83 | - | |
84 | - --- | |
85 | - -- 長さを取得する | |
86 | - -- @return (integer) 長さ | |
87 | - function this:getLength() | |
88 | - return self.length; | |
89 | - end | |
90 | - | |
91 | - --- | |
92 | - -- 長さを設定する | |
93 | - -- @param value (integer) 長さ | |
94 | - function this:setLength( value ) | |
95 | - self.length = value; | |
96 | - end | |
97 | - | |
98 | - --- | |
99 | - -- Display String 値を取得する | |
100 | - -- @return (string) Display String 値 | |
101 | - function this:getDisplayString() | |
102 | - return self.ids .. self.caption; | |
103 | - end | |
104 | - | |
105 | - --- | |
106 | - -- コピーを作成する | |
107 | - -- @return (NoteHeadHandle) このオブジェクトのコピー | |
108 | - function this:clone() | |
109 | - local result = NoteHeadHandle.new(); | |
110 | - result.index = self.index; | |
111 | - result.iconId = self.iconId; | |
112 | - result.ids = self.ids; | |
113 | - result.original = self.original; | |
114 | - result:setCaption( self:getCaption() ); | |
115 | - result:setLength( self:getLength() ); | |
116 | - result:setDuration( self:getDuration() ); | |
117 | - result:setDepth( self:getDepth() ); | |
118 | - return result; | |
119 | - end | |
120 | - | |
121 | - --- | |
122 | - -- Handle に型変換する | |
123 | - -- @return (Handle) Handle | |
124 | - function this:castToHandle() | |
125 | - local ret = Handle.new(); | |
126 | - ret._type = HandleTypeEnum.NoteHead; | |
127 | - ret.index = self.index; | |
128 | - ret.iconId = self.iconId; | |
129 | - ret.ids = self.ids; | |
130 | - ret.original = self.original; | |
131 | - ret.caption = self:getCaption(); | |
132 | - ret:setLength( self:getLength() ); | |
133 | - ret.duration = self:getDuration(); | |
134 | - ret.depth = self:getDepth(); | |
135 | - return ret; | |
136 | - end | |
137 | - | |
138 | - this.ids = ids; | |
139 | - this.iconId = iconId; | |
140 | - this.index = index; | |
141 | - | |
142 | - return this; | |
143 | -end |
@@ -267,47 +267,41 @@ | ||
267 | 267 | item.id.value = current_id; |
268 | 268 | -- SingerHandle |
269 | 269 | if( item.id.singerHandle ~= nil )then |
270 | - local ish = item.id.singerHandle; | |
271 | 270 | current_handle = current_handle + 1; |
272 | - local handle_item = ish:castToHandle(); | |
273 | - handle_item.index = current_handle; | |
274 | - table.insert( handle, handle_item ); | |
271 | + item.id.singerHandle.index = current_handle; | |
272 | + table.insert( handle, item.id.singerHandle ); | |
275 | 273 | item.id.singerHandleIndex = current_handle; |
276 | - local lang = VoiceLanguageEnum.valueFromSingerName( ish.ids ); | |
274 | + local lang = VoiceLanguageEnum.valueFromSingerName( item.id.singerHandle.ids ); | |
277 | 275 | add_quotation_mark = lang == VoiceLanguageEnum.Japanese; |
278 | 276 | end |
279 | 277 | -- LyricHandle |
280 | 278 | if( item.id.lyricHandle ~= nil )then |
281 | 279 | current_handle = current_handle + 1; |
282 | - local handle_item = item.id.lyricHandle:castToHandle(); | |
283 | - handle_item.index = current_handle; | |
284 | - handle_item.addQuotationMark = add_quotation_mark; | |
285 | - table.insert( handle, handle_item ); | |
280 | + item.id.lyricHandle.index = current_handle; | |
281 | + item.id.lyricHandle.addQuotationMark = add_quotation_mark; | |
282 | + table.insert( handle, item.id.lyricHandle ); | |
286 | 283 | item.id.lyricHandleIndex = current_handle; |
287 | 284 | end |
288 | 285 | -- VibratoHandle |
289 | 286 | if( item.id.vibratoHandle ~= nil )then |
290 | 287 | current_handle = current_handle + 1; |
291 | - local handle_item = item.id.vibratoHandle:castToHandle(); | |
292 | - handle_item.index = current_handle; | |
293 | - table.insert( handle, handle_item ); | |
288 | + item.id.vibratoHandle.index = current_handle; | |
289 | + table.insert( handle, item.id.vibratoHandle ); | |
294 | 290 | item.id.vibratoHandleIndex = current_handle; |
295 | 291 | end |
296 | 292 | -- NoteHeadHandle |
297 | 293 | if( item.id.noteHeadHandle ~= nil )then |
298 | 294 | current_handle = current_handle + 1; |
299 | - local handle_item = item.id.noteHeadHandle:castToHandle(); | |
300 | - handle_item.index = current_handle; | |
301 | - table.insert( handle, handle_item ); | |
295 | + item.id.noteHeadHandle.index = current_handle; | |
296 | + table.insert( handle, item.id.noteHeadHandle ); | |
302 | 297 | item.id.noteHeadHandleIndex = current_handle; |
303 | 298 | end |
304 | 299 | -- IconDynamicsHandle |
305 | 300 | if( item.id.iconDynamicsHandle ~= nil )then |
306 | 301 | current_handle = current_handle + 1; |
307 | - local handle_item = item.id.iconDynamicsHandle:castToHandle(); | |
308 | - handle_item.index = current_handle; | |
309 | - handle_item:setLength( item.id:getLength() ); | |
310 | - table.insert( handle, handle_item ); | |
302 | + item.id.iconDynamicsHandle.index = current_handle; | |
303 | + item.id.iconDynamicsHandle:setLength( item.id:getLength() ); | |
304 | + table.insert( handle, item.id.iconDynamicsHandle ); | |
311 | 305 | item.id.singerHandleIndex = current_handle; |
312 | 306 | end |
313 | 307 | end |
@@ -14,6 +14,7 @@ | ||
14 | 14 | |
15 | 15 | local tonumber = tonumber; |
16 | 16 | local string = string; |
17 | +local table = table; | |
17 | 18 | |
18 | 19 | module( "luavsq" ); |
19 | 20 |
@@ -24,6 +25,18 @@ | ||
24 | 25 | Handle = {}; |
25 | 26 | |
26 | 27 | --- |
28 | +-- 強弱記号の場合の、IconId の最初の5文字。 | |
29 | +Handle.ICONID_HEAD_DYNAFF = "$0501"; | |
30 | + | |
31 | +--- | |
32 | +-- クレッシェンドの場合の、IconId の最初の5文字。 | |
33 | +Handle.ICONID_HEAD_CRESCEND = "$0502"; | |
34 | + | |
35 | +--- | |
36 | +-- デクレッシェンドの場合の、IconId の最初の5文字。 | |
37 | +Handle.ICONID_HEAD_DECRESCEND = "$0503"; | |
38 | + | |
39 | +--- | |
27 | 40 | -- 初期化を行う |
28 | 41 | -- @see this:_init_3 |
29 | 42 | -- @return (Handle) |
@@ -31,6 +44,7 @@ | ||
31 | 44 | local arguments = { ... }; |
32 | 45 | local this = {}; |
33 | 46 | this._type = HandleTypeEnum.Lyric; |
47 | + this._articulation = nil; | |
34 | 48 | this.index = 0; |
35 | 49 | this.iconId = ""; |
36 | 50 | this.ids = ""; |
@@ -56,109 +70,21 @@ | ||
56 | 70 | this.addQuotationMark = true; |
57 | 71 | |
58 | 72 | --- |
59 | - -- Tick 単位の長さを取得する | |
60 | - -- @return (integer) | |
61 | - function this:getLength() | |
62 | - return self.length; | |
73 | + -- @param type (HandleTypeEnum) ハンドルの種類 | |
74 | + function this:_init_1( type ) | |
75 | + self._type = type; | |
76 | + if( type == HandleTypeEnum.Dynamics )then | |
77 | + self:_init_icon_dynamics(); | |
78 | + elseif( type == HandleTypeEnum.NoteHead )then | |
79 | + self._articulation = ArticulationTypeEnum.NoteAttack; | |
80 | + elseif( type == HandleTypeEnum.Vibrato )then | |
81 | + self:_init_vibrato(); | |
82 | + elseif( type == HandleTypeEnum.Lyric )then | |
83 | + self:_init_lyric(); | |
84 | + end | |
63 | 85 | end |
64 | 86 | |
65 | 87 | --- |
66 | - -- 長さを設定する | |
67 | - -- @param value (integer) Tick単位の長さ | |
68 | - function this:setLength( value ) | |
69 | - self.length = value; | |
70 | - end | |
71 | - | |
72 | - --- | |
73 | - -- ハンドルのタイプを取得する | |
74 | - -- @return (HandleTypeEnum) ハンドルのタイプ | |
75 | - function this:getHandleType() | |
76 | - return self._type; | |
77 | - end | |
78 | - | |
79 | - --- | |
80 | - -- このオブジェクトを歌詞ハンドルに型変換する | |
81 | - -- @return (LyricHandle) 歌詞ハンドル | |
82 | - function this:castToLyricHandle() | |
83 | - local ret = LyricHandle.new(); | |
84 | - ret.index = self.index; | |
85 | - ret.lyrics = self.lyrics; | |
86 | - return ret; | |
87 | - end | |
88 | - | |
89 | - --- | |
90 | - -- このオブジェクトをビブラートハンドルに型変換する | |
91 | - -- @return (VibratoHandle) ビブラートハンドル | |
92 | - function this:castToVibratoHandle() | |
93 | - local ret = VibratoHandle.new(); | |
94 | - ret.index = self.index; | |
95 | - ret:setCaption( self.caption ); | |
96 | - ret:setDepthBP( self.depthBP ); | |
97 | - ret.iconId = self.iconId; | |
98 | - ret.ids = self.ids; | |
99 | - ret:setLength( self.length ); | |
100 | - ret.original = self.original; | |
101 | - ret:setRateBP( self.rateBP ); | |
102 | - ret:setStartDepth( self.startDepth ); | |
103 | - ret:setStartRate( self.startRate ); | |
104 | - return ret; | |
105 | - end | |
106 | - | |
107 | - --- | |
108 | - -- このオブジェクトを歌手ハンドルに型変換する | |
109 | - -- @return (SingerHandle) 歌手ハンドル | |
110 | - function this:castToSingerHandle() | |
111 | - local ret = SingerHandle.new(); | |
112 | - ret.index = self.index; | |
113 | - ret.caption = self.caption; | |
114 | - ret.iconId = self.iconId; | |
115 | - ret.ids = self.ids; | |
116 | - ret.language = self.language; | |
117 | - ret:setLength( self.length ); | |
118 | - ret.original = self.original; | |
119 | - ret.program = self.program; | |
120 | - return ret; | |
121 | - end | |
122 | - | |
123 | - --- | |
124 | - -- このオブジェクトをアタックハンドルに型変換する | |
125 | - -- @return (NoteHeadHandle) アタックハンドル | |
126 | - function this:castToNoteHeadHandle() | |
127 | - local ret = NoteHeadHandle.new(); | |
128 | - ret:setCaption( self.caption ); | |
129 | - ret:setDepth( self.depth ); | |
130 | - ret:setDuration( self.duration ); | |
131 | - ret.iconId = self.iconId; | |
132 | - ret.ids = self.ids; | |
133 | - ret:setLength( self:getLength() ); | |
134 | - ret.original = self.original; | |
135 | - return ret; | |
136 | - end | |
137 | - | |
138 | - --- | |
139 | - -- このオブジェクトをダイナミクスハンドルに型変換する | |
140 | - -- @return (IconDynamicsHandle) ダイナミクスハンドル | |
141 | - function this:castToIconDynamicsHandle() | |
142 | - local ret = IconDynamicsHandle.new(); | |
143 | - ret.ids = self.ids; | |
144 | - ret.iconId = self.iconId; | |
145 | - ret.original = self.original; | |
146 | - ret:setCaption( self.caption ); | |
147 | - ret:setDynBP( self.dynBP ); | |
148 | - ret:setEndDyn( self.endDyn ); | |
149 | - ret:setLength( self:getLength() ); | |
150 | - ret:setStartDyn( self.startDyn ); | |
151 | - return ret; | |
152 | - end | |
153 | - | |
154 | - --- | |
155 | - -- ストリームに書き込む | |
156 | - -- @param stream (TextStream) 書き込み先のストリーム | |
157 | - function this:write( stream ) | |
158 | - stream:writeLine( self:toString() ); | |
159 | - end | |
160 | - | |
161 | - --- | |
162 | 88 | -- テキストストリームからハンドルの内容を読み込み初期化する |
163 | 89 | -- @param sr (TextStream) 読み込み元のテキストストリーム |
164 | 90 | -- @param index (integer) index フィールドの値 |
@@ -299,6 +225,283 @@ | ||
299 | 225 | end |
300 | 226 | |
301 | 227 | --- |
228 | + -- ビブラートハンドルとして初期化を行う | |
229 | + -- @access private | |
230 | + function this:_init_vibrato() | |
231 | + self._articulation = ArticulationTypeEnum.Vibrato; | |
232 | + self.index = 0; | |
233 | + self.iconId = ""; | |
234 | + self.ids = ""; | |
235 | + self.original = 0; | |
236 | + self.startRate = 64; | |
237 | + self.startDepth = 64; | |
238 | + self.rateBP = VibratoBPList.new(); | |
239 | + self.depthBP = VibratoBPList.new(); | |
240 | + end | |
241 | + | |
242 | + --- | |
243 | + -- 強弱記号ハンドルとして初期化を行う | |
244 | + -- @access private | |
245 | + function this:_init_icon_dynamics() | |
246 | + self._articulation = ArticulationTypeEnum.Dynaff; | |
247 | + self.iconId = ""; | |
248 | + self.ids = ""; | |
249 | + self.original = 0; | |
250 | + end | |
251 | + | |
252 | + --- | |
253 | + -- @access private | |
254 | + function this:_init_lyric() | |
255 | + self.index = 0; | |
256 | + self.lyrics = {}; | |
257 | + end | |
258 | + | |
259 | + --- | |
260 | + -- articulation の種類を取得する | |
261 | + -- @return (ArticulationTypeEnum) articulation の種類 | |
262 | + function this:getArticulation() | |
263 | + return self._articulation; | |
264 | + end | |
265 | + | |
266 | + --- | |
267 | + -- このハンドルが強弱記号を表すものかどうかを表すブール値を取得する | |
268 | + -- @return (boolean) このオブジェクトが強弱記号を表すものであれば true を、そうでなければ false を返す | |
269 | + function this:isDynaffType() | |
270 | + if( nil ~= self.iconId )then | |
271 | + return self.iconId:find( Handle.ICONID_HEAD_DYNAFF ) == 1; | |
272 | + else | |
273 | + return false; | |
274 | + end | |
275 | + end | |
276 | + | |
277 | + --- | |
278 | + -- このハンドルがクレッシェンドを表すものかどうかを表すブール値を取得する | |
279 | + -- @return (boolean) このオブジェクトがクレッシェンドを表すものであれば true を、そうでなければ false を返す | |
280 | + function this:isCrescendType() | |
281 | + if( nil ~= self.iconId )then | |
282 | + return self.iconId:find( Handle.ICONID_HEAD_CRESCEND ) == 1; | |
283 | + else | |
284 | + return false; | |
285 | + end | |
286 | + end | |
287 | + | |
288 | + --- | |
289 | + -- このハンドルがデクレッシェンドを表すものかどうかを表すブール値を取得する | |
290 | + -- @return (boolean) このオブジェクトがデクレッシェンドを表すものであれば true を、そうでなければ false を返す | |
291 | + function this:isDecrescendType() | |
292 | + if( nil ~= self.iconId )then | |
293 | + return self.iconId:find( Handle.ICONID_HEAD_DECRESCEND ) == 1; | |
294 | + else | |
295 | + return false; | |
296 | + end | |
297 | + end | |
298 | + | |
299 | + --- | |
300 | + -- Tick 単位の長さを取得する | |
301 | + -- @return (integer) | |
302 | + function this:getLength() | |
303 | + return self.length; | |
304 | + end | |
305 | + | |
306 | + --- | |
307 | + -- 長さを設定する | |
308 | + -- @param value (integer) Tick単位の長さ | |
309 | + function this:setLength( value ) | |
310 | + self.length = value; | |
311 | + end | |
312 | + | |
313 | + --- | |
314 | + -- キャプションを取得する | |
315 | + -- @return (string) キャプション | |
316 | + function this:getCaption() | |
317 | + return self.caption; | |
318 | + end | |
319 | + | |
320 | + --- | |
321 | + -- キャプションを設定する | |
322 | + -- @param value (string) | |
323 | + function this:setCaption( value ) | |
324 | + self.caption = value; | |
325 | + end | |
326 | + | |
327 | + --- | |
328 | + -- DYN の開始値を取得する | |
329 | + -- @return (integer) DYN の開始値 | |
330 | + function this:getStartDyn() | |
331 | + return self.startDyn; | |
332 | + end | |
333 | + | |
334 | + --- | |
335 | + -- DYN の開始値を設定する | |
336 | + -- @param value (integer) DYN の開始値 | |
337 | + function this:setStartDyn( value ) | |
338 | + self.startDyn = value; | |
339 | + end | |
340 | + | |
341 | + --- | |
342 | + -- DYN の終了値を取得する | |
343 | + -- @return (integer) DYN の終了値 | |
344 | + function this:getEndDyn() | |
345 | + return self.endDyn; | |
346 | + end | |
347 | + | |
348 | + --- | |
349 | + -- DYN の終了値を設定する | |
350 | + -- @param value (integer) DYN の終了値 | |
351 | + function this:setEndDyn( value ) | |
352 | + self.endDyn = value; | |
353 | + end | |
354 | + | |
355 | + --- | |
356 | + -- DYN カーブを取得する | |
357 | + -- @return (VibratoBPList) DYN カーブ | |
358 | + function this:getDynBP() | |
359 | + return self.dynBP; | |
360 | + end | |
361 | + | |
362 | + --- | |
363 | + -- DYN カーブを設定する | |
364 | + -- @param value (VibratoBPList) DYN カーブ | |
365 | + function this:setDynBP( value ) | |
366 | + self.dynBP = value; | |
367 | + end | |
368 | + | |
369 | + --- | |
370 | + -- Depth 値を取得する | |
371 | + -- @return (integer) Depth 値 | |
372 | + function this:getDepth() | |
373 | + return self.depth; | |
374 | + end | |
375 | + | |
376 | + --- | |
377 | + -- Depth 値を設定する | |
378 | + -- @param value (integer) Depth 値 | |
379 | + function this:setDepth( value ) | |
380 | + self.depth = value; | |
381 | + end | |
382 | + | |
383 | + --- | |
384 | + -- Duration 値を取得する | |
385 | + -- @return (integer) Duration 値 | |
386 | + function this:getDuration() | |
387 | + return self.duration; | |
388 | + end | |
389 | + | |
390 | + --- | |
391 | + -- Duration 値を設定する | |
392 | + -- @param value (integer) Duration 値 | |
393 | + function this:setDuration( value ) | |
394 | + self.duration = value; | |
395 | + end | |
396 | + | |
397 | + --- | |
398 | + -- Rate のビブラートカーブを取得する | |
399 | + -- @return (VibratoBPList) Rate のビブラートカーブ | |
400 | + function this:getRateBP() | |
401 | + return self.rateBP; | |
402 | + end | |
403 | + | |
404 | + --- | |
405 | + -- Rate のビブラートカーブを設定する | |
406 | + -- @param value (VibratoBPList) 設定するビブラートカーブ | |
407 | + function this:setRateBP( value ) | |
408 | + self.rateBP = value; | |
409 | + end | |
410 | + | |
411 | + --- | |
412 | + -- Depth のビブラートカーブを取得する | |
413 | + -- @return (VibratoBPList) Depth のビビラートカーブ | |
414 | + function this:getDepthBP() | |
415 | + return self.depthBP; | |
416 | + end | |
417 | + | |
418 | + --- | |
419 | + -- Depth のビブラートカーブを設定する | |
420 | + -- @param value (VibratoBPList) 設定するビブラートカーブ | |
421 | + function this:setDepthBP( value ) | |
422 | + self.depthBP = value; | |
423 | + end | |
424 | + | |
425 | + --- | |
426 | + -- Rate の開始値を取得する | |
427 | + -- @return (integer) Rate の開始値 | |
428 | + function this:getStartRate() | |
429 | + return self.startRate; | |
430 | + end | |
431 | + | |
432 | + --- | |
433 | + -- Rate の開始値を設定する | |
434 | + -- @param value (integer) Rate の開始値 | |
435 | + function this:setStartRate( value ) | |
436 | + self.startRate = value; | |
437 | + end | |
438 | + | |
439 | + --- | |
440 | + -- Depth の開始値を取得する | |
441 | + -- @return (integer) Depth の開始値 | |
442 | + function this:getStartDepth() | |
443 | + return self.startDepth; | |
444 | + end | |
445 | + | |
446 | + --- | |
447 | + -- Depth の開始値を設定する | |
448 | + -- @param value (integer) Depth の開始値 | |
449 | + function this:setStartDepth( value ) | |
450 | + self.startDepth = value; | |
451 | + end | |
452 | + | |
453 | + --- | |
454 | + -- 指定した位置にある歌詞を取得する | |
455 | + -- @param index (integer) 取得する要素のインデックス(最初のインデックスは0) | |
456 | + -- @return (Lyric) 歌詞 | |
457 | + function this:getLyricAt( index ) | |
458 | + return self.lyrics[index + 1]; | |
459 | + end | |
460 | + | |
461 | + --- | |
462 | + -- 指定した位置にある歌詞を指定した要素で置き換える | |
463 | + -- @param index (integer) 置き換える要素のインデックス(最初のインデックスは0) | |
464 | + -- @param value (Lyric) 置き換える要素 | |
465 | + function this:setLyricAt( index, value ) | |
466 | + if( index + 1 >= #self.lyrics )then | |
467 | + local remain = index + 1 - #self.lyrics; | |
468 | + local i; | |
469 | + for i = 1, remain, 1 do | |
470 | + table.insert( self.lyrics, false ); | |
471 | + end | |
472 | + end | |
473 | + self.lyrics[index + 1] = value; | |
474 | + end | |
475 | + | |
476 | + --- | |
477 | + -- 歌詞の個数を返す | |
478 | + -- @return (integer) 歌詞の個数 | |
479 | + function this:size() | |
480 | + return #self.lyrics; | |
481 | + end | |
482 | + | |
483 | + --- | |
484 | + -- Display String 値を取得する | |
485 | + -- @return (string) Display String 値 | |
486 | + function this:getDisplayString() | |
487 | + return self.ids .. self.caption; | |
488 | + end | |
489 | + | |
490 | + --- | |
491 | + -- ハンドルのタイプを取得する | |
492 | + -- @return (HandleTypeEnum) ハンドルのタイプ | |
493 | + function this:getHandleType() | |
494 | + return self._type; | |
495 | + end | |
496 | + | |
497 | + --- | |
498 | + -- ストリームに書き込む | |
499 | + -- @param stream (TextStream) 書き込み先のストリーム | |
500 | + function this:write( stream ) | |
501 | + stream:writeLine( self:toString() ); | |
502 | + end | |
503 | + | |
504 | + --- | |
302 | 505 | -- オブジェクトを文字列に変換する |
303 | 506 | -- @return (string) 文字列 |
304 | 507 | function this:toString() |
@@ -385,7 +588,80 @@ | ||
385 | 588 | return result; |
386 | 589 | end |
387 | 590 | |
388 | - if( #arguments == 3 )then | |
591 | + --- | |
592 | + -- コピーを作成する | |
593 | + -- @return (Handle) このオブジェクトのコピー | |
594 | + function this:clone() | |
595 | + if( self._type == HandleTypeEnum.Dynamics )then | |
596 | + local ret = Handle.new( HandleTypeEnum.Dynamics ); | |
597 | + ret.iconId = self.iconId; | |
598 | + ret.ids = self.ids; | |
599 | + ret.original = self.original; | |
600 | + ret:setCaption( self:getCaption() ); | |
601 | + ret:setStartDyn( self:getStartDyn() ); | |
602 | + ret:setEndDyn( self:getEndDyn() ); | |
603 | + if( nil ~= self.dynBP )then | |
604 | + ret:setDynBP( self.dynBP:clone() ); | |
605 | + end | |
606 | + ret:setLength( self:getLength() ); | |
607 | + return ret; | |
608 | + elseif( self._type == HandleTypeEnum.Lyric )then | |
609 | + local result = Handle.new( HandleTypeEnum.Lyric ); | |
610 | + result.index = self.index; | |
611 | + result.lyrics = {}; | |
612 | + for i = 1, #self.lyrics, 1 do | |
613 | + local buf = self.lyrics[i]:clone(); | |
614 | + table.insert( result.lyrics, buf ); | |
615 | + end | |
616 | + return result; | |
617 | + elseif( self._type == HandleTypeEnum.NoteHead )then | |
618 | + local result = Handle.new( HandleTypeEnum.NoteHead ); | |
619 | + result.index = self.index; | |
620 | + result.iconId = self.iconId; | |
621 | + result.ids = self.ids; | |
622 | + result.original = self.original; | |
623 | + result:setCaption( self:getCaption() ); | |
624 | + result:setLength( self:getLength() ); | |
625 | + result:setDuration( self:getDuration() ); | |
626 | + result:setDepth( self:getDepth() ); | |
627 | + return result; | |
628 | + elseif( self._type == HandleTypeEnum.Singer )then | |
629 | + local ret = Handle.new( HandleTypeEnum.Singer ); | |
630 | + ret.caption = self.caption; | |
631 | + ret.iconId = self.iconId; | |
632 | + ret.ids = self.ids; | |
633 | + ret.index = self.index; | |
634 | + ret.language = self.language; | |
635 | + ret:setLength( self.length ); | |
636 | + ret.original = self.original; | |
637 | + ret.program = self.program; | |
638 | + return ret; | |
639 | + elseif( self._type == HandleTypeEnum.Vibrato )then | |
640 | + local result = Handle.new( HandleTypeEnum.Vibrato ); | |
641 | + result.index = self.index; | |
642 | + result.iconId = self.iconId; | |
643 | + result.ids = self.ids; | |
644 | + result.original = self.original; | |
645 | + result:setCaption( self.caption ); | |
646 | + result:setLength( self:getLength() ); | |
647 | + result:setStartDepth( self.startDepth ); | |
648 | + if( nil ~= self.depthBP )then | |
649 | + result:setDepthBP( self.depthBP:clone() ); | |
650 | + end | |
651 | + result:setStartRate( self.startRate ); | |
652 | + if( nil ~= self.rateBP )then | |
653 | + result:setRateBP( self.rateBP:clone() ); | |
654 | + end | |
655 | + return result; | |
656 | + end | |
657 | + end | |
658 | + | |
659 | + if( #arguments == 0 )then | |
660 | + assert( false, "too few argument" ); | |
661 | + print( "Handle.new; #arguments=0" ); | |
662 | + elseif( #arguments == 1 )then | |
663 | + this:_init_1( arguments[1] ); | |
664 | + elseif( #arguments == 3 )then | |
389 | 665 | this:_init_3( arguments[1], arguments[2], arguments[3] ); |
390 | 666 | end |
391 | 667 |
@@ -104,17 +104,17 @@ | ||
104 | 104 | if( item.id.type == IdTypeEnum.Aicon and item.id.iconDynamicsHandle ~= nil and item.id.iconDynamicsHandle.iconId ~= nil )then |
105 | 105 | local iconid = item.id.iconDynamicsHandle.iconId; |
106 | 106 | if( self._kindDynaff )then |
107 | - if( iconid:find( IconDynamicsHandle.ICONID_HEAD_DYNAFF ) == 1 )then | |
107 | + if( iconid:find( Handle.ICONID_HEAD_DYNAFF ) == 1 )then | |
108 | 108 | return i; |
109 | 109 | end |
110 | 110 | end |
111 | 111 | if( self._kindCrescend )then |
112 | - if( iconid:find( IconDynamicsHandle.ICONID_HEAD_CRESCEND ) == 1 )then | |
112 | + if( iconid:find( Handle.ICONID_HEAD_CRESCEND ) == 1 )then | |
113 | 113 | return i; |
114 | 114 | end |
115 | 115 | end |
116 | 116 | if( self._kindDecrescend )then |
117 | - if( iconid:find( IconDynamicsHandle.ICONID_HEAD_DECRESCEND ) == 1 )then | |
117 | + if( iconid:find( Handle.ICONID_HEAD_DECRESCEND ) == 1 )then | |
118 | 118 | return i; |
119 | 119 | end |
120 | 120 | end |
@@ -5,13 +5,44 @@ | ||
5 | 5 | class SourceFilePacker implements Comparator<File> |
6 | 6 | { |
7 | 7 | private static String[] STD_FUNCTIONS = { |
8 | + "_G", | |
9 | + "_VERSION", | |
10 | + "assert", | |
11 | + "collectgarbage", | |
12 | + "coroutine", | |
13 | + "debug", | |
14 | + "dofile", | |
15 | + "error", | |
16 | + "file", | |
17 | + "getfenv", | |
18 | + "getmetatable", | |
19 | + "io", | |
20 | + "ipairs", | |
21 | + "load", | |
22 | + "loadfile", | |
23 | + "loadstring", | |
8 | 24 | "math", |
25 | + "module", | |
26 | + "next", | |
27 | + "os", | |
28 | + "package", | |
9 | 29 | "pairs", |
30 | + "pcall", | |
31 | + "print", | |
32 | + "rawequal", | |
33 | + "rawget", | |
34 | + "rawset", | |
35 | + "require", | |
36 | + "select", | |
37 | + "setfenv", | |
10 | 38 | "setmetatable", |
11 | 39 | "string", |
12 | 40 | "table", |
13 | 41 | "tonumber", |
42 | + "tostring", | |
14 | 43 | "type", |
44 | + "unpack", | |
45 | + "xpcall", | |
15 | 46 | }; |
16 | 47 | |
17 | 48 | public static void main( String[] args ) |
@@ -1,52 +0,0 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../LyricHandle.lua" ); | |
3 | -dofile( "../ArticulationTypeEnum.lua" ); | |
4 | -dofile( "../Lyric.lua" ); | |
5 | -dofile( "../Util.lua" ); | |
6 | -dofile( "../PhoneticSymbol.lua" ); | |
7 | -dofile( "../Handle.lua" ); | |
8 | -dofile( "../HandleTypeEnum.lua" ); | |
9 | -module( "LyricHandleTest", package.seeall, lunit.testcase ); | |
10 | - | |
11 | -function testConstruct() | |
12 | - local handle = luavsq.LyricHandle.new(); | |
13 | - assert_equal( 0, handle.index ); | |
14 | - assert_equal( 1, handle:size() ); | |
15 | - assert_equal( "a", handle:getLyricAt( 0 ).phrase ); | |
16 | - assert_equal( "a", handle:getLyricAt( 0 ):getPhoneticSymbol() ); | |
17 | -end | |
18 | - | |
19 | -function testConstructWithPhrase() | |
20 | - local handle = luavsq.LyricHandle.new( "は", "h a" ); | |
21 | - assert_equal( 0, handle.index ); | |
22 | - assert_equal( 1, handle:size() ); | |
23 | - assert_equal( "は", handle:getLyricAt( 0 ).phrase ); | |
24 | - assert_equal( "h a", handle:getLyricAt( 0 ):getPhoneticSymbol() ); | |
25 | -end | |
26 | - | |
27 | -function testGetterAndSetterLyric() | |
28 | - local handle = luavsq.LyricHandle.new( "は", "h a" ); | |
29 | - local lyric = luavsq.Lyric.new( "ら", "4 a" ); | |
30 | - handle:setLyricAt( 1, lyric ); | |
31 | - assert_equal( 2, handle:size() ); | |
32 | - assert_true( handle:getLyricAt( 1 ):equals( lyric ) ); | |
33 | -end | |
34 | - | |
35 | -function testClone() | |
36 | - local handle = luavsq.LyricHandle.new( "ら", "4 a" ); | |
37 | - handle.index = 10; | |
38 | - local copy = handle:clone(); | |
39 | - assert_equal( handle.index, copy.index ); | |
40 | - assert_true( handle:getLyricAt( 0 ):equals( copy:getLyricAt( 0 ) ) ); | |
41 | -end | |
42 | - | |
43 | -function testCastToHandle() | |
44 | - local lyricHandle = luavsq.LyricHandle.new( "ら", "4 a" ); | |
45 | - lyricHandle.index = 10; | |
46 | - local handle = lyricHandle:castToHandle(); | |
47 | - assert_equal( luavsq.HandleTypeEnum.Lyric, handle._type ); | |
48 | - assert_equal( 1, #handle.lyrics ); | |
49 | - assert_equal( "ら", handle.lyrics[1].phrase ); | |
50 | - assert_equal( "4 a", handle.lyrics[1]:getPhoneticSymbol() ); | |
51 | - assert_equal( 10, handle.index ); | |
52 | -end |
@@ -1,114 +0,0 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../NoteHeadHandle.lua" ); | |
3 | -dofile( "../IconParameter.lua" ); | |
4 | -dofile( "../ArticulationTypeEnum.lua" ); | |
5 | -dofile( "../Handle.lua" ); | |
6 | -dofile( "../HandleTypeEnum.lua" ); | |
7 | -module( "NoteHeadHandleTest", package.seeall, lunit.testcase ); | |
8 | - | |
9 | -function testConstruct() | |
10 | - local handle = luavsq.NoteHeadHandle.new(); | |
11 | - assert_equal( luavsq.ArticulationTypeEnum.NoteAttack, handle.articulation ); | |
12 | -end | |
13 | - | |
14 | -function testConstructWithArguments() | |
15 | - local ids = "foo"; | |
16 | - local iconId = "$05030000"; | |
17 | - local index = 1000; | |
18 | - local handle = luavsq.NoteHeadHandle.new( ids, iconId, index ); | |
19 | - assert_equal( luavsq.ArticulationTypeEnum.NoteAttack, handle.articulation ); | |
20 | - assert_equal( ids, handle.ids ); | |
21 | - assert_equal( iconId, handle.iconId ); | |
22 | - assert_equal( index, handle.index ); | |
23 | -end | |
24 | - | |
25 | -function testToString() | |
26 | - local handle = luavsq.NoteHeadHandle.new(); | |
27 | - handle.ids = "foo"; | |
28 | - handle.caption = "bar"; | |
29 | - assert_equal( "foobar", handle:toString() ); | |
30 | -end | |
31 | - | |
32 | -function testGetterAndSetterDepth() | |
33 | - local handle = luavsq.NoteHeadHandle.new(); | |
34 | - local expected = 1234; | |
35 | - assert_not_equal( expected, handle:getDepth() ); | |
36 | - handle:setDepth( expected ); | |
37 | - assert_equal( expected, handle:getDepth() ); | |
38 | -end | |
39 | - | |
40 | -function testGetterAndSetterDuration() | |
41 | - local handle = luavsq.NoteHeadHandle.new(); | |
42 | - local expected = 947; | |
43 | - assert_not_equal( expected, handle:getDuration() ); | |
44 | - handle:setDuration( expected ); | |
45 | - assert_equal( expected, handle:getDuration() ); | |
46 | -end | |
47 | - | |
48 | -function testGetterAndSetterCaption() | |
49 | - local handle = luavsq.NoteHeadHandle.new(); | |
50 | - local expected = "aho"; | |
51 | - assert_not_equal( expected, handle:getCaption() ); | |
52 | - handle:setCaption( expected ); | |
53 | - assert_equal( expected, handle:getCaption() ); | |
54 | -end | |
55 | - | |
56 | -function testGetterAndSetterLength() | |
57 | - local handle = luavsq.NoteHeadHandle.new(); | |
58 | - local expected = 31347; | |
59 | - assert_not_equal( expected, handle:getLength() ); | |
60 | - handle:setLength( expected ); | |
61 | - assert_equal( expected, handle:getLength() ); | |
62 | -end | |
63 | - | |
64 | -function testGetDisplayString() | |
65 | - local handle = luavsq.NoteHeadHandle.new(); | |
66 | - handle.ids = "goo"; | |
67 | - handle.caption = "gle"; | |
68 | - assert_equal( "google", handle:getDisplayString() ); | |
69 | -end | |
70 | - | |
71 | -function testClone() | |
72 | - local handle = luavsq.NoteHeadHandle.new(); | |
73 | - handle.index = 1; | |
74 | - handle.iconId = "$05010000"; | |
75 | - handle.ids = "dwango"; | |
76 | - handle.original = 2; | |
77 | - handle.caption = "niwango"; | |
78 | - handle:setLength( 3 ); | |
79 | - handle:setDuration( 4 ); | |
80 | - handle:setDepth( 5 ); | |
81 | - | |
82 | - local copy = handle:clone(); | |
83 | - assert_equal( 1, copy.index ); | |
84 | - assert_equal( "$05010000", copy.iconId ); | |
85 | - assert_equal( "dwango", copy.ids ); | |
86 | - assert_equal( 2, copy.original ); | |
87 | - assert_equal( "niwango", copy.caption ); | |
88 | - assert_equal( 3, copy:getLength() ); | |
89 | - assert_equal( 4, copy:getDuration() ); | |
90 | - assert_equal( 5, copy:getDepth() ); | |
91 | -end | |
92 | - | |
93 | -function testCastToHandle() | |
94 | - local handle = luavsq.NoteHeadHandle.new(); | |
95 | - handle.index = 1; | |
96 | - handle.iconId = "$05010000"; | |
97 | - handle.ids = "dwango"; | |
98 | - handle.original = 2; | |
99 | - handle.caption = "niwango"; | |
100 | - handle:setLength( 3 ); | |
101 | - handle:setDuration( 4 ); | |
102 | - handle:setDepth( 5 ); | |
103 | - | |
104 | - local casted = handle:castToHandle(); | |
105 | - assert_equal( luavsq.HandleTypeEnum.NoteHead, casted._type ); | |
106 | - assert_equal( 1, casted.index ); | |
107 | - assert_equal( "$05010000", casted.iconId ); | |
108 | - assert_equal( "dwango", casted.ids ); | |
109 | - assert_equal( 2, casted.original ); | |
110 | - assert_equal( "niwango", casted.caption ); | |
111 | - assert_equal( 3, casted.length ); | |
112 | - assert_equal( 4, casted.duration ); | |
113 | - assert_equal( 5, casted.depth ); | |
114 | -end |
@@ -1,62 +0,0 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../SingerHandle.lua" ); | |
3 | -dofile( "../Handle.lua" ); | |
4 | -dofile( "../HandleTypeEnum.lua" ); | |
5 | -module( "SingerHandleTest", package.seeall, lunit.testcase ); | |
6 | - | |
7 | -function getSingerHandle() | |
8 | - local handle = luavsq.SingerHandle.new(); | |
9 | - handle.caption = "bar"; | |
10 | - handle.iconId = "$07010001"; | |
11 | - handle.ids = "foo"; | |
12 | - handle.index = 1; | |
13 | - handle.length = 2; | |
14 | - handle.original = 3; | |
15 | - handle.program = 4; | |
16 | - handle.language= 5; | |
17 | - return handle; | |
18 | -end | |
19 | - | |
20 | -function testGetterAndSetterLength() | |
21 | - local handle = getSingerHandle(); | |
22 | - local expected = 12084; | |
23 | - assert_not_equal( expected, handle:getLength() ); | |
24 | - handle:setLength( expected ); | |
25 | - assert_equal( expected, handle:getLength() ); | |
26 | -end | |
27 | - | |
28 | -function testEqual() | |
29 | - local a = getSingerHandle(); | |
30 | - local b = getSingerHandle(); | |
31 | - assert_true( a:equals( b ) ); | |
32 | - a.iconId = "$07010001"; | |
33 | - b.iconId = "$07010002"; | |
34 | - assert_false( a:equals( b ) ); | |
35 | -end | |
36 | - | |
37 | -function testClone() | |
38 | - local handle = getSingerHandle(); | |
39 | - local copy = handle:clone(); | |
40 | - assert_equal( handle.caption, copy.caption ); | |
41 | - assert_equal( handle.iconId, copy.iconId ); | |
42 | - assert_equal( handle.ids, copy.ids ); | |
43 | - assert_equal( handle.index, copy.index ); | |
44 | - assert_equal( handle.language, copy.language ); | |
45 | - assert_equal( handle:getLength(), copy:getLength() ); | |
46 | - assert_equal( handle.original, copy.original ); | |
47 | - assert_equal( handle.program, copy.program ); | |
48 | -end | |
49 | - | |
50 | -function testCastToHandle() | |
51 | - local handle = getSingerHandle(); | |
52 | - local casted = handle:castToHandle(); | |
53 | - assert_equal( luavsq.HandleTypeEnum.Singer, casted._type ); | |
54 | - assert_equal( "bar", casted.caption ); | |
55 | - assert_equal( "$07010001", casted.iconId ); | |
56 | - assert_equal( "foo", casted.ids ); | |
57 | - assert_equal( 1, casted.index ); | |
58 | - assert_equal( 5, casted.language ); | |
59 | - assert_equal( 2, casted:getLength() ); | |
60 | - assert_equal( 4, casted.program ); | |
61 | - assert_equal( 3, casted.original ); | |
62 | -end |
@@ -1,130 +0,0 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../IconDynamicsHandle.lua" ); | |
3 | -dofile( "../IconParameter.lua" ); | |
4 | -dofile( "../ArticulationTypeEnum.lua" ); | |
5 | -dofile( "../Handle.lua" ); | |
6 | -dofile( "../VibratoBPList.lua" ); | |
7 | -dofile( "../HandleTypeEnum.lua" ); | |
8 | -dofile( "../VibratoBP.lua" ); | |
9 | -module( "IconDynamicsHandleTest", package.seeall, lunit.testcase ); | |
10 | - | |
11 | -function testConstruct() | |
12 | - local handle = luavsq.IconDynamicsHandle.new(); | |
13 | - assert_equal( luavsq.ArticulationTypeEnum.Dynaff, handle.articulation ); | |
14 | -end | |
15 | - | |
16 | -function testIsDynaffType() | |
17 | - local handle = luavsq.IconDynamicsHandle.new(); | |
18 | - handle.iconId = nil; | |
19 | - assert_false( handle:isDynaffType() ); | |
20 | - handle.iconId = "$05000000"; | |
21 | - assert_false( handle:isDynaffType() ); | |
22 | - handle.iconId = "$05010000"; | |
23 | - assert_true( handle:isDynaffType() ); | |
24 | -end | |
25 | - | |
26 | -function testIsCrescendType() | |
27 | - local handle = luavsq.IconDynamicsHandle.new(); | |
28 | - handle.iconId = nil; | |
29 | - assert_false( handle:isCrescendType() ); | |
30 | - handle.iconId = "$05000000"; | |
31 | - assert_false( handle:isCrescendType() ); | |
32 | - handle.iconId = "$05020000"; | |
33 | - assert_true( handle:isCrescendType() ); | |
34 | -end | |
35 | - | |
36 | -function testIsDecrescendType() | |
37 | - local handle = luavsq.IconDynamicsHandle.new(); | |
38 | - handle.iconId = nil; | |
39 | - assert_false( handle:isDecrescendType() ); | |
40 | - handle.iconId = "$05000000"; | |
41 | - assert_false( handle:isDecrescendType() ); | |
42 | - handle.iconId = "$05030000"; | |
43 | - assert_true( handle:isDecrescendType() ); | |
44 | -end | |
45 | - | |
46 | -function testClone() | |
47 | - local handle = luavsq.IconDynamicsHandle.new(); | |
48 | - handle.iconId = "$05010000"; | |
49 | - handle.ids = "foo"; | |
50 | - handle.original = 1; | |
51 | - handle.caption = "bar"; | |
52 | - handle.startDyn = 2; | |
53 | - handle.endDyn = 3; | |
54 | - handle.length = 4; | |
55 | - handle.dynBP = nil; | |
56 | - local copy = handle:clone(); | |
57 | - assert_equal( "$05010000", copy.iconId ); | |
58 | - assert_equal( "foo", copy.ids ); | |
59 | - assert_equal( 1, copy.original ); | |
60 | - assert_equal( "bar", copy.caption ); | |
61 | - assert_equal( 2, copy:getStartDyn() ); | |
62 | - assert_equal( 3, copy:getEndDyn() ); | |
63 | - assert_equal( 4, copy:getLength() ); | |
64 | - assert_nil( copy:getDynBP() ); | |
65 | - | |
66 | - local dynBP = luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 1, 64 } ); | |
67 | - handle:setDynBP( dynBP ); | |
68 | - copy = handle:clone(); | |
69 | - assert_equal( "0=1,1=64", copy:getDynBP():getData() ); | |
70 | -end | |
71 | - | |
72 | -function testCastToHandle() | |
73 | - local handle = luavsq.IconDynamicsHandle.new(); | |
74 | - handle.iconId = "$05010000"; | |
75 | - handle.ids = "foo"; | |
76 | - handle.original = 1; | |
77 | - handle.caption = "bar"; | |
78 | - handle.dynBP = nil; | |
79 | - handle.startDyn = 2; | |
80 | - handle.endDyn = 3; | |
81 | - handle:setLength( 4 ); | |
82 | - local casted = handle:castToHandle(); | |
83 | - assert_equal( "$05010000", casted.iconId ); | |
84 | - assert_equal( "foo", casted.ids ); | |
85 | - assert_equal( 1, casted.original ); | |
86 | - assert_equal( "bar", casted.caption ); | |
87 | - assert_equal( nil, casted.dynBP ); | |
88 | - assert_equal( 2, casted.startDyn ); | |
89 | - assert_equal( 3, casted.endDyn ); | |
90 | - assert_equal( 4, casted:getLength() ); | |
91 | -end | |
92 | - | |
93 | -function testGetterAndSetterCaption() | |
94 | - local handle = luavsq.IconDynamicsHandle.new(); | |
95 | - handle:setCaption( "foo" ); | |
96 | - assert_equal( "foo", handle:getCaption() ); | |
97 | -end | |
98 | - | |
99 | -function testGetterAndSetterLength() | |
100 | - local handle = luavsq.IconDynamicsHandle.new(); | |
101 | - local expected = 100; | |
102 | - assert_not_equal( expected, handle:getLength() ); | |
103 | - handle:setLength( expected ); | |
104 | - assert_equal( expected, handle:getLength() ); | |
105 | -end | |
106 | - | |
107 | -function testGetterAndSetterStartDyn() | |
108 | - local handle = luavsq.IconDynamicsHandle.new(); | |
109 | - local expected = 100; | |
110 | - assert_not_equal( expected, handle:getStartDyn() ); | |
111 | - handle:setStartDyn( expected ); | |
112 | - assert_equal( expected, handle:getStartDyn() ); | |
113 | -end | |
114 | - | |
115 | -function testGetterAndSetterEndDyn() | |
116 | - local handle = luavsq.IconDynamicsHandle.new(); | |
117 | - local expected = 100; | |
118 | - assert_not_equal( expected, handle:getEndDyn() ); | |
119 | - handle:setEndDyn( expected ); | |
120 | - assert_equal( expected, handle:getEndDyn() ); | |
121 | -end | |
122 | - | |
123 | -function testGetterAndSetterDynBP() | |
124 | - local handle = luavsq.IconDynamicsHandle.new(); | |
125 | - local dynBP = luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 1, 2 } ); | |
126 | - handle:setDynBP( nil ); | |
127 | - assert_nil( handle:getDynBP() ); | |
128 | - handle:setDynBP( dynBP ); | |
129 | - assert_equal( "0=1,1=2", handle:getDynBP():getData() ); | |
130 | -end |
@@ -1,121 +0,0 @@ | ||
1 | -require( "lunit" ); | |
2 | -dofile( "../VibratoHandle.lua" ); | |
3 | -dofile( "../IconParameter.lua" ); | |
4 | -dofile( "../ArticulationTypeEnum.lua" ); | |
5 | -dofile( "../VibratoBPList.lua" ); | |
6 | -dofile( "../VibratoBP.lua" ); | |
7 | -dofile( "../Handle.lua" ); | |
8 | -dofile( "../HandleTypeEnum.lua" ); | |
9 | -module( "VibratoHandleTest", package.seeall, lunit.testcase ); | |
10 | - | |
11 | -function testToString() | |
12 | - local handle = luavsq.VibratoHandle.new(); | |
13 | - handle:setCaption( "foo" ); | |
14 | - assert_equal( "foo", handle:toString() ); | |
15 | -end | |
16 | - | |
17 | -function testGetterAndSetterRateBP() | |
18 | - local handle = luavsq.VibratoHandle.new(); | |
19 | - local rateBP = luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 1, 128 } ); | |
20 | - assert_not_equal( "0=1,1=128", handle:getRateBP():getData() ); | |
21 | - handle:setRateBP( rateBP ); | |
22 | - assert_equal( "0=1,1=128", handle:getRateBP():getData() ); | |
23 | -end | |
24 | - | |
25 | -function testGetterAndSetterDepthBP() | |
26 | - local handle = luavsq.VibratoHandle.new(); | |
27 | - local depthBP = luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 1, 128 } ); | |
28 | - assert_not_equal( "0=1,1=128", handle:getDepthBP():getData() ); | |
29 | - handle:setDepthBP( depthBP ); | |
30 | - assert_equal( "0=1,1=128", handle:getDepthBP():getData() ); | |
31 | -end | |
32 | - | |
33 | -function testGetterAndSetterCaption() | |
34 | - local handle = luavsq.VibratoHandle.new(); | |
35 | - local expected = "asdf"; | |
36 | - assert_not_equal( expected, handle:getCaption() ); | |
37 | - handle:setCaption( expected ); | |
38 | - assert_equal( expected, handle:getCaption() ); | |
39 | -end | |
40 | - | |
41 | -function testGetterAndSetterStartRate() | |
42 | - local handle = luavsq.VibratoHandle.new(); | |
43 | - local expected = 12345; | |
44 | - assert_not_equal( expected, handle:getStartRate() ); | |
45 | - handle:setStartRate( expected ); | |
46 | - assert_equal( expected, handle:getStartRate() ); | |
47 | -end | |
48 | - | |
49 | -function testGetterAndSetterStartDepth() | |
50 | - local handle = luavsq.VibratoHandle.new(); | |
51 | - local expected = 12345; | |
52 | - assert_not_equal( expected, handle:getStartDepth() ); | |
53 | - handle:setStartDepth( expected ); | |
54 | - assert_equal( expected, handle:getStartDepth() ); | |
55 | -end | |
56 | - | |
57 | -function testGetterAndSetterLength() | |
58 | - local handle = luavsq.VibratoHandle.new(); | |
59 | - local expected = 9999; | |
60 | - assert_not_equal( handle:getLength() ); | |
61 | - handle:setLength( expected ); | |
62 | - assert_equal( expected, handle:getLength() ); | |
63 | -end | |
64 | - | |
65 | -function testGetDisplayString() | |
66 | - local handle = luavsq.VibratoHandle.new(); | |
67 | - handle:setCaption( "yahoo" ); | |
68 | - assert_equal( "yahoo", handle:getDisplayString() ); | |
69 | -end | |
70 | - | |
71 | -function testClone() | |
72 | - local handle = luavsq.VibratoHandle.new(); | |
73 | - handle.index = 1; | |
74 | - handle.iconId = "hahaha"; | |
75 | - handle.ids = "baka"; | |
76 | - handle.original = 2; | |
77 | - handle:setCaption( "aho" ); | |
78 | - handle:setLength( 3 ); | |
79 | - handle:setStartDepth( 4 ); | |
80 | - handle:setDepthBP( luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 32, 56 } ) ); | |
81 | - handle:setStartRate( 5 ); | |
82 | - handle:setRateBP( luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 64, 128 } ) ); | |
83 | - local copy = handle:clone(); | |
84 | - assert_equal( 1, copy.index ); | |
85 | - assert_equal( "hahaha", copy.iconId ); | |
86 | - assert_equal( "baka", copy.ids ); | |
87 | - assert_equal( 2, copy.original ); | |
88 | - assert_equal( "aho", copy:getCaption() ); | |
89 | - assert_equal( 3, copy:getLength() ); | |
90 | - assert_equal( 4, copy:getStartDepth() ); | |
91 | - assert_equal( "0=32,1=56", copy:getDepthBP():getData() ); | |
92 | - assert_equal( 5, copy:getStartRate() ); | |
93 | - assert_equal( "0=64,1=128", copy:getRateBP():getData() ); | |
94 | -end | |
95 | - | |
96 | -function testCastToHandle() | |
97 | - local vibratoHandle = luavsq.VibratoHandle.new(); | |
98 | - vibratoHandle.index = 1; | |
99 | - vibratoHandle.iconId = "hahaha"; | |
100 | - vibratoHandle.ids = "baka"; | |
101 | - vibratoHandle.original = 2; | |
102 | - vibratoHandle:setCaption( "aho" ); | |
103 | - vibratoHandle:setLength( 3 ); | |
104 | - vibratoHandle:setStartDepth( 4 ); | |
105 | - vibratoHandle:setDepthBP( luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 32, 56 } ) ); | |
106 | - vibratoHandle:setStartRate( 5 ); | |
107 | - vibratoHandle:setRateBP( luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 64, 128 } ) ); | |
108 | - | |
109 | - local handle = vibratoHandle:castToHandle(); | |
110 | - assert_equal( luavsq.HandleTypeEnum.Vibrato, handle._type ); | |
111 | - assert_equal( 1, handle.index ); | |
112 | - assert_equal( "hahaha", handle.iconId ); | |
113 | - assert_equal( "baka", handle.ids ); | |
114 | - assert_equal( 2, handle.original ); | |
115 | - assert_equal( "aho", handle.caption ); | |
116 | - assert_equal( 3, handle:getLength() ); | |
117 | - assert_equal( 4, handle.startDepth ); | |
118 | - assert_equal( "0=32,1=56", handle.depthBP:getData() ); | |
119 | - assert_equal( 5, handle.startRate ); | |
120 | - assert_equal( "0=64,1=128", handle.rateBP:getData() ); | |
121 | -end |
@@ -9,7 +9,6 @@ | ||
9 | 9 | dofile( "../EventList.lua" ); |
10 | 10 | dofile( "../Id.lua" ); |
11 | 11 | dofile( "../IdTypeEnum.lua" ); |
12 | -dofile( "../SingerHandle.lua" ); | |
13 | 12 | dofile( "../Event.lua" ); |
14 | 13 | dofile( "../Master.lua" ); |
15 | 14 | dofile( "../Mixer.lua" ); |
@@ -29,7 +28,6 @@ | ||
29 | 28 | dofile( "../VoiceLanguageEnum.lua" ); |
30 | 29 | dofile( "../NrpnEvent.lua" ); |
31 | 30 | dofile( "../MidiParameterEnum.lua" ); |
32 | -dofile( "../LyricHandle.lua" ); | |
33 | 31 | dofile( "../ArticulationTypeEnum.lua" ); |
34 | 32 | dofile( "../Lyric.lua" ); |
35 | 33 | dofile( "../PhoneticSymbol.lua" ); |
@@ -139,7 +137,8 @@ | ||
139 | 137 | note.id.type = luavsq.IdTypeEnum.Anote; |
140 | 138 | note.id.note = 60; |
141 | 139 | note.id:setLength( 480 ); |
142 | - note.id.lyricHandle = luavsq.LyricHandle.new( "あ", "a" ); | |
140 | + note.id.lyricHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Lyric ); | |
141 | + note.id.lyricHandle:setLyricAt( 0, luavsq.Lyric.new( "あ", "a" ) ); | |
143 | 142 | sequence.track:get( 1 ).events:add( note ); |
144 | 143 | local fileHandle = io.open( "foo.vsq", "wb" ); |
145 | 144 | fileHandle:write( sequence:write( 500, "Shift_JIS" ) ); |
@@ -3,17 +3,12 @@ | ||
3 | 3 | dofile( "../Event.lua" ); |
4 | 4 | dofile( "../Id.lua" ); |
5 | 5 | dofile( "../IdTypeEnum.lua" ); |
6 | -dofile( "../IconDynamicsHandle.lua" ); | |
7 | 6 | dofile( "../IconParameter.lua" ); |
8 | 7 | dofile( "../ArticulationTypeEnum.lua" ); |
9 | -dofile( "../SingerHandle.lua" ); | |
10 | -dofile( "../LyricHandle.lua" ); | |
11 | 8 | dofile( "../Lyric.lua" ); |
12 | 9 | dofile( "../Util.lua" ); |
13 | -dofile( "../NoteHeadHandle.lua" ); | |
14 | 10 | dofile( "../TextStream.lua" ); |
15 | 11 | dofile( "../EventList.Iterator.lua" ); |
16 | -dofile( "../VibratoHandle.lua" ); | |
17 | 12 | dofile( "../VibratoBPList.lua" ); |
18 | 13 | dofile( "../Handle.lua" ); |
19 | 14 | dofile( "../HandleTypeEnum.lua" ); |
@@ -202,12 +197,12 @@ | ||
202 | 197 | |
203 | 198 | local singerEvent = luavsq.Event.new( 0, luavsq.Id.new( 0 ) ); |
204 | 199 | singerEvent.id.type = luavsq.IdTypeEnum.Singer; |
205 | - singerEvent.id.singerHandle = luavsq.SingerHandle.new(); | |
200 | + singerEvent.id.singerHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Singer ); | |
206 | 201 | list:add( singerEvent, 1 ); |
207 | 202 | |
208 | 203 | local crescendoEvent = luavsq.Event.new( 240, luavsq.Id.new( 0 ) ); |
209 | 204 | crescendoEvent.id.type = luavsq.IdTypeEnum.Aicon; |
210 | - crescendoEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); | |
205 | + crescendoEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
211 | 206 | crescendoEvent.id.iconDynamicsHandle.iconId = "$05020001"; |
212 | 207 | list:add( crescendoEvent, 2 ); |
213 | 208 |
@@ -224,38 +219,39 @@ | ||
224 | 219 | |
225 | 220 | local singerEvent = luavsq.Event.new( 0, luavsq.Id.new( 0 ) ); |
226 | 221 | singerEvent.id.type = luavsq.IdTypeEnum.Singer; |
227 | - singerEvent.id.singerHandle = luavsq.SingerHandle.new(); | |
222 | + singerEvent.id.singerHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Singer ); | |
228 | 223 | list:add( singerEvent, 1 ); |
229 | 224 | |
230 | 225 | local crescendoEvent = luavsq.Event.new( 240, luavsq.Id.new( 0 ) ); |
231 | 226 | crescendoEvent.id.type = luavsq.IdTypeEnum.Aicon; |
232 | - crescendoEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); | |
227 | + crescendoEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
233 | 228 | crescendoEvent.id.iconDynamicsHandle.iconId = "$05020001"; |
234 | 229 | list:add( crescendoEvent, 2 ); |
235 | 230 | |
236 | 231 | local dynaffEvent = luavsq.Event.new( 480, luavsq.Id.new( 0 ) ); |
237 | 232 | dynaffEvent.id.type = luavsq.IdTypeEnum.Aicon; |
238 | - dynaffEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); | |
233 | + dynaffEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
239 | 234 | dynaffEvent.id.iconDynamicsHandle.iconId = "$05010001"; |
240 | 235 | list:add( dynaffEvent, 3 ); |
241 | 236 | |
242 | 237 | local decrescendoEvent = luavsq.Event.new( 720, luavsq.Id.new( 0 ) ); |
243 | 238 | decrescendoEvent.id.type = luavsq.IdTypeEnum.Aicon; |
244 | - decrescendoEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); | |
239 | + decrescendoEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
245 | 240 | decrescendoEvent.id.iconDynamicsHandle.iconId = "$05030001"; |
246 | 241 | list:add( decrescendoEvent, 4 ); |
247 | 242 | |
248 | 243 | local singerEvent2 = luavsq.Event.new( 1920, luavsq.Id.new( 0 ) ); |
249 | 244 | singerEvent2.id.type = luavsq.IdTypeEnum.Singer; |
250 | - singerEvent2.id.singerHandle = luavsq.SingerHandle.new(); | |
245 | + singerEvent2.id.singerHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Singer ); | |
251 | 246 | list:add( singerEvent2, 5 ); |
252 | 247 | |
253 | 248 | local noteEvent = luavsq.Event.new( 1920, luavsq.Id.new( 0 ) ); |
254 | 249 | noteEvent.id.type = luavsq.IdTypeEnum.Anote; |
255 | 250 | noteEvent.id:setLength( 480 ); |
256 | - noteEvent.id.lyricHandle = luavsq.LyricHandle.new( "ら", "4 a" ); | |
257 | - noteEvent.id.noteHeadHandle = luavsq.NoteHeadHandle.new(); | |
258 | - noteEvent.id.vibratoHandle = luavsq.VibratoHandle.new(); | |
251 | + noteEvent.id.lyricHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Lyric ); | |
252 | + noteEvent.id.lyricHandle:setLyricAt( 0, luavsq.Lyric.new( "ら", "4 a" ) ); | |
253 | + noteEvent.id.noteHeadHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.NoteHead ); | |
254 | + noteEvent.id.vibratoHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato ); | |
259 | 255 | list:add( noteEvent, 6 ); |
260 | 256 | |
261 | 257 | local stream = luavsq.TextStream.new(); |
@@ -3,15 +3,13 @@ | ||
3 | 3 | dofile( "../Id.lua" ); |
4 | 4 | dofile( "../Util.lua" ); |
5 | 5 | dofile( "../IdTypeEnum.lua" ); |
6 | -dofile( "../SingerHandle.lua" ); | |
7 | 6 | dofile( "../TextStream.lua" ); |
8 | -dofile( "../LyricHandle.lua" ); | |
9 | 7 | dofile( "../ArticulationTypeEnum.lua" ); |
10 | 8 | dofile( "../Lyric.lua" ); |
11 | -dofile( "../VibratoHandle.lua" ); | |
12 | 9 | dofile( "../IconParameter.lua" ); |
13 | 10 | dofile( "../VibratoBPList.lua" ); |
14 | -dofile( "../NoteHeadHandle.lua" ); | |
11 | +dofile( "../Handle.lua" ); | |
12 | +dofile( "../HandleTypeEnum.lua" ); | |
15 | 13 | module( "EventTest", package.seeall, lunit.testcase ); |
16 | 14 | |
17 | 15 | function getNoteId() |
@@ -124,9 +122,10 @@ | ||
124 | 122 | --現在、PreUtteranceとVoiceOverlapは扱わないようにしているので、 |
125 | 123 | --オプション全指定と、オプションが無い場合の動作が全くおなじになってしまっている。 |
126 | 124 | --ustEventをちゃんと処理するようになったら、TODOコメントのところを外すこと |
127 | - noteId.lyricHandle = luavsq.LyricHandle.new( "わ", "w a" ); | |
128 | - noteId.vibratoHandle = luavsq.VibratoHandle.new(); | |
129 | - noteId.noteHeadHandle = luavsq.NoteHeadHandle.new(); | |
125 | + noteId.lyricHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Lyric ); | |
126 | + noteId.lyricHandle:setLyricAt( 0, luavsq.Lyric.new( "わ", "w a" ) ); | |
127 | + noteId.vibratoHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato ); | |
128 | + noteId.noteHeadHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.NoteHead ); | |
130 | 129 | event.id = noteId; |
131 | 130 | stream = luavsq.TextStream.new(); |
132 | 131 | event:write( stream, optionAll ); |
@@ -209,7 +208,7 @@ | ||
209 | 208 | |
210 | 209 | function testClone() |
211 | 210 | local singerId = getSingerId(); |
212 | - singerId.singerHandle = luavsq.SingerHandle.new(); | |
211 | + singerId.singerHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Singer ); | |
213 | 212 | singerId.singerHandle.index = 12; |
214 | 213 | local event = luavsq.Event.new( 40, singerId ); |
215 | 214 | event.internalId = 4; |
@@ -6,13 +6,9 @@ | ||
6 | 6 | dofile( "../Util.lua" ); |
7 | 7 | dofile( "../VibratoBPList.lua" ); |
8 | 8 | dofile( "../VibratoBP.lua" ); |
9 | -dofile( "../SingerHandle.lua" ); | |
10 | -dofile( "../VibratoHandle.lua" ); | |
11 | -dofile( "../IconDynamicsHandle.lua" ); | |
12 | 9 | dofile( "../IconParameter.lua" ); |
13 | 10 | dofile( "../ArticulationTypeEnum.lua" ); |
14 | -dofile( "../NoteHeadHandle.lua" ); | |
15 | -dofile( "../LyricHandle.lua" ); | |
11 | +dofile( "../PhoneticSymbol.lua" ); | |
16 | 12 | module( "HandleTest", package.seeall, lunit.testcase ); |
17 | 13 | |
18 | 14 | function getLyricStream() |
@@ -85,6 +81,103 @@ | ||
85 | 81 | return stream; |
86 | 82 | end |
87 | 83 | |
84 | +function testConstructIconDynamicsHandle() | |
85 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
86 | + assert_equal( luavsq.ArticulationTypeEnum.Dynaff, handle:getArticulation() ); | |
87 | +end | |
88 | + | |
89 | +function testConstructNoteHeadHandle() | |
90 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.NoteHead ); | |
91 | + assert_equal( luavsq.ArticulationTypeEnum.NoteAttack, handle:getArticulation() ); | |
92 | +end | |
93 | + | |
94 | +function testIsDynaffType() | |
95 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
96 | + handle.iconId = nil; | |
97 | + assert_false( handle:isDynaffType() ); | |
98 | + handle.iconId = "$05000000"; | |
99 | + assert_false( handle:isDynaffType() ); | |
100 | + handle.iconId = "$05010000"; | |
101 | + assert_true( handle:isDynaffType() ); | |
102 | +end | |
103 | + | |
104 | +function testIsCrescendType() | |
105 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
106 | + handle.iconId = nil; | |
107 | + assert_false( handle:isCrescendType() ); | |
108 | + handle.iconId = "$05000000"; | |
109 | + assert_false( handle:isCrescendType() ); | |
110 | + handle.iconId = "$05020000"; | |
111 | + assert_true( handle:isCrescendType() ); | |
112 | +end | |
113 | + | |
114 | +function testIsDecrescendType() | |
115 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
116 | + handle.iconId = nil; | |
117 | + assert_false( handle:isDecrescendType() ); | |
118 | + handle.iconId = "$05000000"; | |
119 | + assert_false( handle:isDecrescendType() ); | |
120 | + handle.iconId = "$05030000"; | |
121 | + assert_true( handle:isDecrescendType() ); | |
122 | +end | |
123 | + | |
124 | +function __testClone() | |
125 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
126 | + handle.iconId = "$05010000"; | |
127 | + handle.ids = "foo"; | |
128 | + handle.original = 1; | |
129 | + handle.caption = "bar"; | |
130 | + handle.startDyn = 2; | |
131 | + handle.endDyn = 3; | |
132 | + handle.length = 4; | |
133 | + handle.dynBP = nil; | |
134 | + local copy = handle:clone(); | |
135 | + assert_equal( "$05010000", copy.iconId ); | |
136 | + assert_equal( "foo", copy.ids ); | |
137 | + assert_equal( 1, copy.original ); | |
138 | + assert_equal( "bar", copy.caption ); | |
139 | + assert_equal( 2, copy:getStartDyn() ); | |
140 | + assert_equal( 3, copy:getEndDyn() ); | |
141 | + assert_equal( 4, copy:getLength() ); | |
142 | + assert_nil( copy:getDynBP() ); | |
143 | + | |
144 | + local dynBP = luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 1, 64 } ); | |
145 | + handle:setDynBP( dynBP ); | |
146 | + copy = handle:clone(); | |
147 | + assert_equal( "0=1,1=64", copy:getDynBP():getData() ); | |
148 | +end | |
149 | + | |
150 | +function testGetterAndSetterCaption() | |
151 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
152 | + handle:setCaption( "foo" ); | |
153 | + assert_equal( "foo", handle:getCaption() ); | |
154 | +end | |
155 | + | |
156 | +function testGetterAndSetterStartDyn() | |
157 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
158 | + local expected = 100; | |
159 | + assert_not_equal( expected, handle:getStartDyn() ); | |
160 | + handle:setStartDyn( expected ); | |
161 | + assert_equal( expected, handle:getStartDyn() ); | |
162 | +end | |
163 | + | |
164 | +function testGetterAndSetterEndDyn() | |
165 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
166 | + local expected = 100; | |
167 | + assert_not_equal( expected, handle:getEndDyn() ); | |
168 | + handle:setEndDyn( expected ); | |
169 | + assert_equal( expected, handle:getEndDyn() ); | |
170 | +end | |
171 | + | |
172 | +function testGetterAndSetterDynBP() | |
173 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
174 | + local dynBP = luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 1, 2 } ); | |
175 | + handle:setDynBP( nil ); | |
176 | + assert_nil( handle:getDynBP() ); | |
177 | + handle:setDynBP( dynBP ); | |
178 | + assert_equal( "0=1,1=2", handle:getDynBP():getData() ); | |
179 | +end | |
180 | + | |
88 | 181 | --- |
89 | 182 | -- 歌詞ハンドルの読み込みテスト |
90 | 183 | -- EOFで読み込みが終了する場合 |
@@ -240,7 +333,7 @@ | ||
240 | 333 | end |
241 | 334 | |
242 | 335 | function testGetterAndSetterLength() |
243 | - local handle = luavsq.Handle.new(); | |
336 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato ); | |
244 | 337 | local expected = 847; |
245 | 338 | assert_not_equal( expected, handle:getLength() ); |
246 | 339 | handle:setLength( expected ); |
@@ -247,87 +340,6 @@ | ||
247 | 340 | assert_equal( expected, handle:getLength() ); |
248 | 341 | end |
249 | 342 | |
250 | -function testCastToLyricHandle() | |
251 | - local stream = getLyricStream(); | |
252 | - local lastLine = { ["value"] = "" }; | |
253 | - local index = 3847; | |
254 | - local handle = luavsq.Handle.new( stream, index, lastLine ); | |
255 | - local casted = handle:castToLyricHandle(); | |
256 | - assert_equal( index, casted.index ); | |
257 | - assert_equal( #handle.lyrics, #casted.lyrics ); | |
258 | - local i; | |
259 | - for i = 1, #handle.lyrics, 1 do | |
260 | - assert_equal( handle.lyrics[i]:toString(), casted.lyrics[i]:toString() ); | |
261 | - end | |
262 | -end | |
263 | - | |
264 | -function testCastToVibratoHandle() | |
265 | - local stream = getVibratoStream(); | |
266 | - local lastLine = { ["value"] = "" }; | |
267 | - local index = 347; | |
268 | - local handle = luavsq.Handle.new( stream, index, lastLine ); | |
269 | - | |
270 | - local casted = handle:castToVibratoHandle(); | |
271 | - assert_equal( index, casted.index ); | |
272 | - assert_equal( "キャプションです=あ", casted:getCaption() ); | |
273 | - assert_equal( "0.5=64,0.75=32,1=0", casted:getDepthBP():getData() ); | |
274 | - assert_equal( "$04040004", casted.iconId ); | |
275 | - assert_equal( "normal-da-yo", casted.ids ); | |
276 | - assert_equal( 120, casted:getLength() ); | |
277 | - assert_equal( 5, casted.original ); | |
278 | - assert_equal( "0.5=64,0.75=32,1=0", casted:getRateBP():getData() ); | |
279 | - assert_equal( 64, casted:getStartDepth() ); | |
280 | - assert_equal( 64, casted:getStartRate() ); | |
281 | -end | |
282 | - | |
283 | -function testCastToSingerHandle() | |
284 | - local stream = getSingerStream(); | |
285 | - local lastLine = { ["value"] = "" }; | |
286 | - local index = 9476; | |
287 | - local handle = luavsq.Handle.new( stream, index, lastLine ); | |
288 | - | |
289 | - local casted = handle:castToSingerHandle(); | |
290 | - assert_equal( index, casted.index ); | |
291 | - assert_equal( "", casted.caption ); | |
292 | - assert_equal( "$07010002", casted.iconId ); | |
293 | - assert_equal( "Miku3=God", casted.ids ); | |
294 | - assert_equal( 1, casted.language ); | |
295 | - assert_equal( 1, casted:getLength() ); | |
296 | - assert_equal( 2, casted.original ); | |
297 | - assert_equal( 2, casted.program ); | |
298 | -end | |
299 | - | |
300 | -function testCastToNoteHeadHandle() | |
301 | - local stream = getAttackStream(); | |
302 | - local lastLine = { ["value"] = "" }; | |
303 | - local index = 70375; | |
304 | - local handle = luavsq.Handle.new( stream, index, lastLine ); | |
305 | - local casted = handle:castToNoteHeadHandle(); | |
306 | - assert_equal( "Accent", casted:getCaption() ); | |
307 | - assert_equal( 63, casted:getDepth() ); | |
308 | - assert_equal( 64, casted:getDuration() ); | |
309 | - assert_equal( "$01010002", casted.iconId ); | |
310 | - assert_equal( "accent", casted.ids ); | |
311 | - assert_equal( 120, casted:getLength() ); | |
312 | - assert_equal( 2, casted.original ); | |
313 | -end | |
314 | - | |
315 | -function testCastToIconDynamicsHandle() | |
316 | - local stream = getCrescendoStream(); | |
317 | - local lastLine = { ["value"] = "" }; | |
318 | - local index = 1548; | |
319 | - local handle = luavsq.Handle.new( stream, index, lastLine ); | |
320 | - local casted = handle:castToIconDynamicsHandle(); | |
321 | - assert_equal( "Crescendo", casted.ids ); | |
322 | - assert_equal( "$05020001", casted.iconId ); | |
323 | - assert_equal( 4, casted.original ); | |
324 | - assert_equal( "Zero Crescendo Curve", casted:getCaption() ); | |
325 | - assert_equal( "0.5=11", casted.dynBP:getData() ); | |
326 | - assert_equal( 38, casted.endDyn ); | |
327 | - assert_equal( 960, casted:getLength() ); | |
328 | - assert_equal( 2, casted.startDyn ); | |
329 | -end | |
330 | - | |
331 | 343 | function testWrite() |
332 | 344 | local stream = getLyricStream(); |
333 | 345 | local handle = luavsq.Handle.new( stream, 1, {} ); |
@@ -470,3 +482,177 @@ | ||
470 | 482 | function testGetHandleIndexFromString() |
471 | 483 | assert_equal( 2, luavsq.Handle.getHandleIndexFromString( "h#0002" ) ); |
472 | 484 | end |
485 | + | |
486 | +function testGetterAndSetterDepth() | |
487 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.NoteHead ); | |
488 | + local expected = 1234; | |
489 | + assert_not_equal( expected, handle:getDepth() ); | |
490 | + handle:setDepth( expected ); | |
491 | + assert_equal( expected, handle:getDepth() ); | |
492 | +end | |
493 | + | |
494 | +function testGetterAndSetterDuration() | |
495 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.NoteHead ); | |
496 | + local expected = 947; | |
497 | + assert_not_equal( expected, handle:getDuration() ); | |
498 | + handle:setDuration( expected ); | |
499 | + assert_equal( expected, handle:getDuration() ); | |
500 | +end | |
501 | + | |
502 | +function testGetDisplayString() | |
503 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.NoteHead ); | |
504 | + handle.ids = "goo"; | |
505 | + handle.caption = "gle"; | |
506 | + assert_equal( "google", handle:getDisplayString() ); | |
507 | +end | |
508 | + | |
509 | +function testGetterAndSetterRateBP() | |
510 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato ); | |
511 | + local rateBP = luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 1, 128 } ); | |
512 | + assert_not_equal( "0=1,1=128", handle:getRateBP():getData() ); | |
513 | + handle:setRateBP( rateBP ); | |
514 | + assert_equal( "0=1,1=128", handle:getRateBP():getData() ); | |
515 | +end | |
516 | + | |
517 | +function testGetterAndSetterDepthBP() | |
518 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato ); | |
519 | + local depthBP = luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 1, 128 } ); | |
520 | + assert_not_equal( "0=1,1=128", handle:getDepthBP():getData() ); | |
521 | + handle:setDepthBP( depthBP ); | |
522 | + assert_equal( "0=1,1=128", handle:getDepthBP():getData() ); | |
523 | +end | |
524 | + | |
525 | +function testGetterAndSetterStartRate() | |
526 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato ); | |
527 | + local expected = 12345; | |
528 | + assert_not_equal( expected, handle:getStartRate() ); | |
529 | + handle:setStartRate( expected ); | |
530 | + assert_equal( expected, handle:getStartRate() ); | |
531 | +end | |
532 | + | |
533 | +function testGetterAndSetterStartDepth() | |
534 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato ); | |
535 | + local expected = 12345; | |
536 | + assert_not_equal( expected, handle:getStartDepth() ); | |
537 | + handle:setStartDepth( expected ); | |
538 | + assert_equal( expected, handle:getStartDepth() ); | |
539 | +end | |
540 | + | |
541 | +function testGetterAndSetterLyric() | |
542 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Lyric ); | |
543 | + handle:setLyricAt( 0, luavsq.Lyric.new( "は", "h a" ) ); | |
544 | + local lyric = luavsq.Lyric.new( "ら", "4 a" ); | |
545 | + handle:setLyricAt( 1, lyric ); | |
546 | + assert_equal( 2, handle:size() ); | |
547 | + assert_true( handle:getLyricAt( 1 ):equals( lyric ) ); | |
548 | +end | |
549 | + | |
550 | +function testCloneIconDynamicsHandle() | |
551 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
552 | + handle.iconId = "$05010000"; | |
553 | + handle.ids = "foo"; | |
554 | + handle.original = 1; | |
555 | + handle.caption = "bar"; | |
556 | + handle.startDyn = 2; | |
557 | + handle.endDyn = 3; | |
558 | + handle.length = 4; | |
559 | + handle.dynBP = nil; | |
560 | + local copy = handle:clone(); | |
561 | + assert_equal( "$05010000", copy.iconId ); | |
562 | + assert_equal( "foo", copy.ids ); | |
563 | + assert_equal( 1, copy.original ); | |
564 | + assert_equal( "bar", copy.caption ); | |
565 | + assert_equal( 2, copy:getStartDyn() ); | |
566 | + assert_equal( 3, copy:getEndDyn() ); | |
567 | + assert_equal( 4, copy:getLength() ); | |
568 | + assert_nil( copy:getDynBP() ); | |
569 | + | |
570 | + local dynBP = luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 1, 64 } ); | |
571 | + handle:setDynBP( dynBP ); | |
572 | + copy = handle:clone(); | |
573 | + assert_equal( "0=1,1=64", copy:getDynBP():getData() ); | |
574 | +end | |
575 | + | |
576 | +function testCloneLyricHandle() | |
577 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Lyric ); | |
578 | + handle:setLyricAt( 0, luavsq.Lyric.new( "ら", "4 a" ) ); | |
579 | + handle.index = 10; | |
580 | + local copy = handle:clone(); | |
581 | + assert_equal( handle.index, copy.index ); | |
582 | + assert_true( handle:getLyricAt( 0 ):equals( copy:getLyricAt( 0 ) ) ); | |
583 | +end | |
584 | + | |
585 | +function testCloneNoteHeadHandle() | |
586 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.NoteHead ); | |
587 | + handle.index = 1; | |
588 | + handle.iconId = "$05010000"; | |
589 | + handle.ids = "dwango"; | |
590 | + handle.original = 2; | |
591 | + handle.caption = "niwango"; | |
592 | + handle:setLength( 3 ); | |
593 | + handle:setDuration( 4 ); | |
594 | + handle:setDepth( 5 ); | |
595 | + | |
596 | + local copy = handle:clone(); | |
597 | + assert_equal( 1, copy.index ); | |
598 | + assert_equal( "$05010000", copy.iconId ); | |
599 | + assert_equal( "dwango", copy.ids ); | |
600 | + assert_equal( 2, copy.original ); | |
601 | + assert_equal( "niwango", copy.caption ); | |
602 | + assert_equal( 3, copy:getLength() ); | |
603 | + assert_equal( 4, copy:getDuration() ); | |
604 | + assert_equal( 5, copy:getDepth() ); | |
605 | +end | |
606 | + | |
607 | +function testCloneVibratoHandle() | |
608 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato ); | |
609 | + handle.index = 1; | |
610 | + handle.iconId = "hahaha"; | |
611 | + handle.ids = "baka"; | |
612 | + handle.original = 2; | |
613 | + handle:setCaption( "aho" ); | |
614 | + handle:setLength( 3 ); | |
615 | + handle:setStartDepth( 4 ); | |
616 | + handle:setDepthBP( luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 32, 56 } ) ); | |
617 | + handle:setStartRate( 5 ); | |
618 | + handle:setRateBP( luavsq.VibratoBPList.new( { 0.0, 1.0 }, { 64, 128 } ) ); | |
619 | + local copy = handle:clone(); | |
620 | + assert_equal( 1, copy.index ); | |
621 | + assert_equal( "hahaha", copy.iconId ); | |
622 | + assert_equal( "baka", copy.ids ); | |
623 | + assert_equal( 2, copy.original ); | |
624 | + assert_equal( "aho", copy:getCaption() ); | |
625 | + assert_equal( 3, copy:getLength() ); | |
626 | + assert_equal( 4, copy:getStartDepth() ); | |
627 | + assert_equal( "0=32,1=56", copy:getDepthBP():getData() ); | |
628 | + assert_equal( 5, copy:getStartRate() ); | |
629 | + assert_equal( "0=64,1=128", copy:getRateBP():getData() ); | |
630 | +end | |
631 | + | |
632 | +function testCloneSingerHandle() | |
633 | + local handle = luavsq.Handle.new( luavsq.HandleTypeEnum.Singer ); | |
634 | + handle.caption = "bar"; | |
635 | + handle.iconId = "$07010001"; | |
636 | + handle.ids = "foo"; | |
637 | + handle.index = 1; | |
638 | + handle.length = 2; | |
639 | + handle.original = 3; | |
640 | + handle.program = 4; | |
641 | + handle.language= 5; | |
642 | + | |
643 | + local copy = handle:clone(); | |
644 | + assert_equal( handle.caption, copy.caption ); | |
645 | + assert_equal( handle.iconId, copy.iconId ); | |
646 | + assert_equal( handle.ids, copy.ids ); | |
647 | + assert_equal( handle.index, copy.index ); | |
648 | + assert_equal( handle.language, copy.language ); | |
649 | + assert_equal( handle:getLength(), copy:getLength() ); | |
650 | + assert_equal( handle.original, copy.original ); | |
651 | + assert_equal( handle.program, copy.program ); | |
652 | +end | |
653 | + | |
654 | +--[[ | |
655 | +function testToDo() | |
656 | + fail( "sizeメソッドの名前を変える" ); | |
657 | +end | |
658 | +]] |
@@ -1,16 +1,13 @@ | ||
1 | 1 | require( "lunit" ); |
2 | 2 | dofile( "../Id.lua" ); |
3 | 3 | dofile( "../IdTypeEnum.lua" ); |
4 | -dofile( "../SingerHandle.lua" ); | |
5 | -dofile( "../LyricHandle.lua" ); | |
6 | 4 | dofile( "../ArticulationTypeEnum.lua" ); |
7 | 5 | dofile( "../Lyric.lua" ); |
8 | -dofile( "../VibratoHandle.lua" ); | |
9 | 6 | dofile( "../IconParameter.lua" ); |
10 | 7 | dofile( "../VibratoBPList.lua" ); |
11 | -dofile( "../NoteHeadHandle.lua" ); | |
12 | -dofile( "../IconDynamicsHandle.lua" ); | |
13 | 8 | dofile( "../Util.lua" ); |
9 | +dofile( "../Handle.lua" ); | |
10 | +dofile( "../HandleTypeEnum.lua" ); | |
14 | 11 | module( "IdTest", package.seeall, lunit.testcase ); |
15 | 12 | |
16 | 13 | function testConstructWithValue() |
@@ -90,19 +87,19 @@ | ||
90 | 87 | assert_equal( 16, copy.d4mean ); |
91 | 88 | assert_equal( 17, copy.pMeanEndingNote ); |
92 | 89 | |
93 | - local iconHandle = luavsq.SingerHandle.new(); | |
90 | + local iconHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Singer ); | |
94 | 91 | iconHandle.caption = "foo"; |
95 | 92 | id.singerHandle = iconHandle; |
96 | - local lyricHandle = luavsq.LyricHandle.new(); | |
93 | + local lyricHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Lyric ); | |
97 | 94 | lyricHandle.index = 102; |
98 | 95 | id.lyricHandle = lyricHandle; |
99 | - local vibratoHandle = luavsq.VibratoHandle.new(); | |
96 | + local vibratoHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato ); | |
100 | 97 | vibratoHandle.iconId = "aho"; |
101 | 98 | id.vibratoHandle = vibratoHandle; |
102 | - local noteHeadHandle = luavsq.NoteHeadHandle.new(); | |
99 | + local noteHeadHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.NoteHead ); | |
103 | 100 | noteHeadHandle.ids = "baka"; |
104 | 101 | id.noteHeadHandle = noteHeadHandle; |
105 | - local iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); | |
102 | + local iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
106 | 103 | iconDynamicsHandle:setStartDyn( 183635 ); |
107 | 104 | id.iconDynamicsHandle = iconDynamicsHandle; |
108 | 105 |
@@ -4,11 +4,12 @@ | ||
4 | 4 | dofile( "../Event.lua" ); |
5 | 5 | dofile( "../Id.lua" ); |
6 | 6 | dofile( "../IdTypeEnum.lua" ); |
7 | -dofile( "../IconDynamicsHandle.lua" ); | |
8 | 7 | dofile( "../IconParameter.lua" ); |
9 | 8 | dofile( "../ArticulationTypeEnum.lua" ); |
10 | 9 | dofile( "../EventList.IndexIteratorKindEnum.lua" ); |
11 | 10 | dofile( "../Util.lua" ); |
11 | +dofile( "../Handle.lua" ); | |
12 | +dofile( "../HandleTypeEnum.lua" ); | |
12 | 13 | module( "EventList.IndexIteratorTest", package.seeall, lunit.testcase ); |
13 | 14 | |
14 | 15 | function test() |
@@ -24,19 +25,19 @@ | ||
24 | 25 | |
25 | 26 | local dynaffEvent = luavsq.Event.new( 480, luavsq.Id.new( 0 ) ); |
26 | 27 | dynaffEvent.id.type = luavsq.IdTypeEnum.Aicon; |
27 | - dynaffEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); | |
28 | + dynaffEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
28 | 29 | dynaffEvent.id.iconDynamicsHandle.iconId = "$05010001"; |
29 | 30 | list:add( dynaffEvent, 3 ); |
30 | 31 | |
31 | 32 | local crescendoEvent = luavsq.Event.new( 240, luavsq.Id.new( 0 ) ); |
32 | 33 | crescendoEvent.id.type = luavsq.IdTypeEnum.Aicon; |
33 | - crescendoEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); | |
34 | + crescendoEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
34 | 35 | crescendoEvent.id.iconDynamicsHandle.iconId = "$05020001"; |
35 | 36 | list:add( crescendoEvent, 2 ); |
36 | 37 | |
37 | 38 | local decrescendoEvent = luavsq.Event.new( 720, luavsq.Id.new( 0 ) ); |
38 | 39 | decrescendoEvent.id.type = luavsq.IdTypeEnum.Aicon; |
39 | - decrescendoEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); | |
40 | + decrescendoEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
40 | 41 | decrescendoEvent.id.iconDynamicsHandle.iconId = "$05030001"; |
41 | 42 | list:add( decrescendoEvent, 4 ); |
42 | 43 |
@@ -7,20 +7,15 @@ | ||
7 | 7 | dofile( "../EventList.lua" ); |
8 | 8 | dofile( "../Id.lua" ); |
9 | 9 | dofile( "../IdTypeEnum.lua" ); |
10 | -dofile( "../SingerHandle.lua" ); | |
11 | 10 | dofile( "../Event.lua" ); |
12 | 11 | dofile( "../EventList.IndexIteratorKindEnum.lua" ); |
13 | 12 | dofile( "../EventList.IndexIterator.lua" ); |
14 | 13 | dofile( "../Util.lua" ); |
15 | -dofile( "../IconDynamicsHandle.lua" ); | |
16 | 14 | dofile( "../IconParameter.lua" ); |
17 | 15 | dofile( "../ArticulationTypeEnum.lua" ); |
18 | 16 | dofile( "../BP.lua" ); |
19 | 17 | dofile( "../EventList.Iterator.lua" ); |
20 | -dofile( "../LyricHandle.lua" ); | |
21 | 18 | dofile( "../Lyric.lua" ); |
22 | -dofile( "../NoteHeadHandle.lua" ); | |
23 | -dofile( "../VibratoHandle.lua" ); | |
24 | 19 | dofile( "../VibratoBPList.lua" ); |
25 | 20 | dofile( "../Master.lua" ); |
26 | 21 | dofile( "../Mixer.lua" ); |
@@ -272,7 +267,7 @@ | ||
272 | 267 | |
273 | 268 | local event = luavsq.Event.new( 480, luavsq.Id.new( 0 ) ); |
274 | 269 | event.id.type = luavsq.IdTypeEnum.Aicon; |
275 | - event.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); | |
270 | + event.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); | |
276 | 271 | event.id.iconDynamicsHandle.iconId = "$05019999"; |
277 | 272 | track.events:add( event, 10 ); |
278 | 273 | iterator = track:getIndexIterator( luavsq.EventList.IndexIteratorKindEnum.DYNAFF ); |
@@ -289,7 +284,7 @@ | ||
289 | 284 | |
290 | 285 | local singerEvent = luavsq.Event.new( 0, luavsq.Id.new( 0 ) ); |
291 | 286 | singerEvent.id.type = luavsq.IdTypeEnum.Singer; |
292 | - singerEvent.id.singerHandle = luavsq.SingerHandle.new(); --h#0000 | |
287 | + singerEvent.id.singerHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Singer ); --h#0000 | |
293 | 288 | singerEvent.id.singerHandle.iconId = "$07010002"; |
294 | 289 | singerEvent.id.singerHandle.ids = "Miku"; |
295 | 290 | singerEvent.id.singerHandle.original = 1; |
@@ -301,7 +296,7 @@ | ||
301 | 296 | local crescendoEvent = luavsq.Event.new( 240, luavsq.Id.new( 0 ) ); |
302 | 297 | crescendoEvent.id.type = luavsq.IdTypeEnum.Aicon; |
303 | 298 | crescendoEvent.id.note = 64; |
304 | - crescendoEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new(); --h#0001 | |
299 | + crescendoEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics ); --h#0001 | |
305 | 300 | crescendoEvent.id.iconDynamicsHandle.iconId = "$05020001"; |
306 | 301 | crescendoEvent.id.iconDynamicsHandle.ids = "crescendo"; |
307 | 302 | crescendoEvent.id.iconDynamicsHandle.original = 1; |
@@ -314,7 +309,7 @@ | ||
314 | 309 | local dynaffEvent = luavsq.Event.new( 480, luavsq.Id.new( 0 ) ); |
315 | 310 | dynaffEvent.id.type = luavsq.IdTypeEnum.Aicon; |
316 | 311 | dynaffEvent.id.note = 65; |
317 | - dynaffEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new();--h#0002 | |
312 | + dynaffEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics );--h#0002 | |
318 | 313 | dynaffEvent.id.iconDynamicsHandle.iconId = "$05010001"; |
319 | 314 | dynaffEvent.id.iconDynamicsHandle.ids = "dynaff"; |
320 | 315 | dynaffEvent.id.iconDynamicsHandle.original = 2; |
@@ -327,7 +322,7 @@ | ||
327 | 322 | local decrescendoEvent = luavsq.Event.new( 720, luavsq.Id.new( 0 ) ); |
328 | 323 | decrescendoEvent.id.type = luavsq.IdTypeEnum.Aicon; |
329 | 324 | decrescendoEvent.id.note = 66; |
330 | - decrescendoEvent.id.iconDynamicsHandle = luavsq.IconDynamicsHandle.new();--h#0003 | |
325 | + decrescendoEvent.id.iconDynamicsHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Dynamics );--h#0003 | |
331 | 326 | decrescendoEvent.id.iconDynamicsHandle.iconId = "$05030001"; |
332 | 327 | decrescendoEvent.id.iconDynamicsHandle.ids = "decrescendo"; |
333 | 328 | decrescendoEvent.id.iconDynamicsHandle.original = 3; |
@@ -339,7 +334,7 @@ | ||
339 | 334 | |
340 | 335 | local singerEvent2 = luavsq.Event.new( 1920, luavsq.Id.new( 0 ) ); |
341 | 336 | singerEvent2.id.type = luavsq.IdTypeEnum.Singer; |
342 | - singerEvent2.id.singerHandle = luavsq.SingerHandle.new();--h#0004 | |
337 | + singerEvent2.id.singerHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Singer );--h#0004 | |
343 | 338 | singerEvent2.id.singerHandle.iconId = "$07020003"; |
344 | 339 | singerEvent2.id.singerHandle.ids = "Luka_EN"; |
345 | 340 | singerEvent2.id.singerHandle.original = 0x82; |
@@ -358,8 +353,9 @@ | ||
358 | 353 | noteEvent.id.demDecGainRate = 71; |
359 | 354 | noteEvent.id.demAccent = 72; |
360 | 355 | noteEvent.id:setLength( 480 ); |
361 | - noteEvent.id.lyricHandle = luavsq.LyricHandle.new( "ら", "4 a" );--h#0005 | |
362 | - noteEvent.id.vibratoHandle = luavsq.VibratoHandle.new();--h#0006 | |
356 | + noteEvent.id.lyricHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Lyric ); | |
357 | + noteEvent.id.lyricHandle:setLyricAt( 0, luavsq.Lyric.new( "ら", "4 a" ) );--h#0005 | |
358 | + noteEvent.id.vibratoHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.Vibrato );--h#0006 | |
363 | 359 | noteEvent.id.vibratoDelay = 73; |
364 | 360 | noteEvent.id.vibratoHandle.iconId ="$04040004"; |
365 | 361 | noteEvent.id.vibratoHandle.ids = "vibrato"; |
@@ -368,7 +364,7 @@ | ||
368 | 364 | noteEvent.id.vibratoHandle:setLength( 407 ); |
369 | 365 | noteEvent.id.vibratoHandle.startDepth = 13; |
370 | 366 | noteEvent.id.vibratoHandle.startRate = 14; |
371 | - noteEvent.id.noteHeadHandle = luavsq.NoteHeadHandle.new();--h#0007 | |
367 | + noteEvent.id.noteHeadHandle = luavsq.Handle.new( luavsq.HandleTypeEnum.NoteHead );--h#0007 | |
372 | 368 | noteEvent.id.noteHeadHandle.iconId = "$05030000"; |
373 | 369 | noteEvent.id.noteHeadHandle.ids = "attack"; |
374 | 370 | noteEvent.id.noteHeadHandle.original = 15; |
@@ -246,7 +246,7 @@ | ||
246 | 246 | self.events = EventList.new(); |
247 | 247 | local id = Id.new( 0 ); |
248 | 248 | id.type = IdTypeEnum.Singer; |
249 | - local ish = SingerHandle.new(); | |
249 | + local ish = Handle.new( HandleTypeEnum.Singer ); | |
250 | 250 | ish.iconId = "$07010000"; |
251 | 251 | ish.ids = singer; |
252 | 252 | ish.original = 0; |
@@ -638,7 +638,7 @@ | ||
638 | 638 | if( singers_size <= 0 )then |
639 | 639 | default_id = Id.new(); |
640 | 640 | default_id.type = IdTypeEnum.Singer; |
641 | - local singer_handle = SingerHandle.new(); | |
641 | + local singer_handle = Handle.new( HandleTypeEnum.Singer ); | |
642 | 642 | singer_handle.IconID = "$0701" + org.kbinani.PortUtil.sprintf( "%04X", 0 ); |
643 | 643 | singer_handle.ids = "Unknown"; |
644 | 644 | singer_handle.Index = 0; |