diff --git a/trunk/Boare.Lib.Vsq/AttackConfig.cs b/trunk/Boare.Lib.Vsq/AttackConfig.cs
index 9b07c62..58fb615 100644
--- a/trunk/Boare.Lib.Vsq/AttackConfig.cs
+++ b/trunk/Boare.Lib.Vsq/AttackConfig.cs
@@ -11,10 +11,17 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
+#if JAVA
+package com.boare.vsq;
+import java.io.*;
+#else
using System;
using System.IO;
+using bocoree;
+
namespace Boare.Lib.Vsq {
+#endif
public class AttackConfig {
public int number;
@@ -36,7 +43,7 @@ namespace Boare.Lib.Vsq {
if ( line.StartsWith( "[" ) ) {
current_entry = line;
continue;
- } else if ( line == "" || line.StartsWith( ";" ) ) {
+ } else if ( line.Equals( "" ) || line.StartsWith( ";" ) ) {
continue;
}
@@ -46,20 +53,20 @@ namespace Boare.Lib.Vsq {
}
spl[0] = spl[0].Trim();
spl[1] = spl[1].Trim();
- if ( current_entry == "[Common]" ) {
- if ( spl[0] == "Articulation" ) {
+ if ( current_entry.Equals( "[Common]" ) ) {
+ if ( spl[0].Equals( "Articulation" ) ) {
articulation = spl[1];
}
- } else if ( current_entry == "[Parameter]" ) {
- if ( spl[0] == "Length" ) {
+ } else if ( current_entry.Equals( "[Parameter]" ) ) {
+ if ( spl[0].Equals( "Length" ) ) {
try {
this.contents.Length = int.Parse( spl[1] );
} catch { }
- } else if ( spl[0] == "Duration" ) {
+ } else if ( spl[0].Equals( "Duration" ) ) {
try {
this.contents.Duration = int.Parse( spl[1] );
} catch { }
- } else if ( spl[0] == "Depth" ) {
+ } else if ( spl[0].Equals( "Depth" ) ) {
try {
this.contents.Depth = int.Parse( spl[1] );
} catch { }
diff --git a/trunk/Boare.Lib.Vsq/BPPair.cs b/trunk/Boare.Lib.Vsq/BPPair.cs
index 0e3cdd5..8ef236c 100644
--- a/trunk/Boare.Lib.Vsq/BPPair.cs
+++ b/trunk/Boare.Lib.Vsq/BPPair.cs
@@ -11,15 +11,23 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
+#if JAVA
+package com.boare.vsq;
+#else
using System;
namespace Boare.Lib.Vsq {
+#endif
///
/// Stores the paired value of "Clock" and integer. Mainly used in VsqBPList
///
+#if JAVA
+ class BPPair implements Comparable {
+#else
[Serializable]
public class BPPair : IComparable {
+#endif
public int Clock;
public int Value;
@@ -28,7 +36,7 @@ namespace Boare.Lib.Vsq {
///
///
///
- public int CompareTo( BPPair item ) {
+ public int compareTo( BPPair item ) {
if ( Clock > item.Clock ) {
return 1;
} else if ( Clock < item.Clock ) {
@@ -38,6 +46,10 @@ namespace Boare.Lib.Vsq {
}
}
+ public int CompareTo( BPPair item ) {
+ return compareTo( item );
+ }
+
public BPPair( int clock_, int value_ ) {
Clock = clock_;
Value = value_;
diff --git a/trunk/Boare.Lib.Vsq/Boare.Lib.Vsq.csproj b/trunk/Boare.Lib.Vsq/Boare.Lib.Vsq.csproj
index 28ee08f..afa6219 100644
--- a/trunk/Boare.Lib.Vsq/Boare.Lib.Vsq.csproj
+++ b/trunk/Boare.Lib.Vsq/Boare.Lib.Vsq.csproj
@@ -81,6 +81,7 @@
+
diff --git a/trunk/Boare.Lib.Vsq/ExpressionConfigSys.cs b/trunk/Boare.Lib.Vsq/ExpressionConfigSys.cs
index 1b42411..b43a300 100644
--- a/trunk/Boare.Lib.Vsq/ExpressionConfigSys.cs
+++ b/trunk/Boare.Lib.Vsq/ExpressionConfigSys.cs
@@ -11,27 +11,35 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
+#if JAVA
+package com.boare.vsq;
+#else
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
+using bocoree;
+
namespace Boare.Lib.Vsq {
+#endif
public class ExpressionConfigSys {
private const int MAX_VIBRATO = 0x400;
- private List m_vibrato_configs;
- private List m_attack_configs;
+ private Vector m_vibrato_configs;
+ private Vector m_attack_configs;
public ExpressionConfigSys( String path_expdb ) {
- m_vibrato_configs = new List();
- m_attack_configs = new List();
+ m_vibrato_configs = new Vector();
+ m_attack_configs = new Vector();
String expression = Path.Combine( path_expdb, "expression.map" );
if ( !File.Exists( expression ) ) {
return;
}
- using ( FileStream fs = new FileStream( expression, FileMode.Open, FileAccess.Read ) ) {
+ FileStream fs = null;
+ try {
+ new FileStream( expression, FileMode.Open, FileAccess.Read );
byte[] dat = new byte[8];
fs.Seek( 0x20, SeekOrigin.Begin );
for ( int i = 0; i < MAX_VIBRATO; i++ ) {
@@ -51,19 +59,21 @@ namespace Boare.Lib.Vsq {
continue;
}
- string NL = (char)0x0D + "" + (char)0x0A;
- using ( FileStream fs_ved = new FileStream( ved, FileMode.Open, FileAccess.Read ) ){
+ String NL = (char)0x0D + "" + (char)0x0A;
+ FileStream fs_ved = null;
+ try {
+ fs_ved = new FileStream( ved, FileMode.Open, FileAccess.Read );
byte[] byte_ved = new byte[fs_ved.Length];
fs_ved.Read( byte_ved, 0, byte_ved.Length );
TransCodeUtil.decodeBytes( ref byte_ved );
String str = new String( Encoding.ASCII.GetChars( byte_ved ) );
- String[] spl = str.Split( new String[]{ NL }, StringSplitOptions.RemoveEmptyEntries );
+ String[] spl = str.Split( new String[] { NL }, StringSplitOptions.RemoveEmptyEntries );
String current_entry = "";
for ( int j = 0; j < spl.Length; j++ ) {
if ( spl[j].StartsWith( "[" ) ) {
current_entry = spl[j];
continue;
- } else if ( spl[j] == "" ) {
+ } else if ( spl[j].Equals( "" ) ) {
continue;
}
if ( current_entry.Equals( "[VIBRATO]" ) ) {
@@ -84,13 +94,13 @@ namespace Boare.Lib.Vsq {
continue;
}
item.parseAic( aic_file );
- } if ( current_entry == "[NOTEATTACK]" ) {
+ } if ( current_entry.Equals( "[NOTEATTACK]" ) ) {
String[] spl2 = spl[j].Split( ',' );
if ( spl2.Length < 6 ) {
continue;
}
// ex: 1,1,"normal","normal2_type1.aic","[Normal]:Type:1","Standard","YAMAHA",0
- AttackConfig item = new AttackConfig();
+ AttackConfig item = new AttackConfig();
item.number = int.Parse( spl2[0] );
item.contents.IDS = spl2[2].Replace( "\"", "" );
item.file = spl2[3].Replace( "\"", "" );
@@ -104,6 +114,22 @@ namespace Boare.Lib.Vsq {
item.parseAic( aic_file );
}
}
+ } catch ( Exception ex ) {
+ } finally {
+ if ( fs_ved != null ) {
+ try {
+ fs_ved.Close();
+ } catch ( Exception ex2 ) {
+ }
+ }
+ }
+ }
+ } catch ( Exception ex ) {
+ } finally {
+ if ( fs != null ) {
+ try {
+ fs.Close();
+ } catch ( Exception ex2 ) {
}
}
}
diff --git a/trunk/Boare.Lib.Vsq/NRPN.cs b/trunk/Boare.Lib.Vsq/NRPN.cs
index b57dc32..88c9596 100644
--- a/trunk/Boare.Lib.Vsq/NRPN.cs
+++ b/trunk/Boare.Lib.Vsq/NRPN.cs
@@ -15,8 +15,12 @@ using System;
using System.Reflection;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq {
+ using boolean = System.Boolean;
+
public static class NRPN {
///
/// (0x5000) Version number(MSB) &, Device number(LSB)
@@ -556,20 +560,20 @@ namespace Boare.Lib.Vsq {
public const ushort VCP_VOICE_CHANGE_PARAMETER = 0x5503;
private class NrpnIterator : Iterator {
- private List nrpns = new List();
+ private Vector nrpns = new Vector();
private int m_pos = -1;
public NrpnIterator() {
Type t = typeof( NRPN );
foreach ( FieldInfo fi in t.GetFields() ) {
if ( fi.FieldType.Equals( typeof( ushort ) ) ) {
- nrpns.Add( (ushort)fi.GetValue( t ) );
+ nrpns.add( (ushort)fi.GetValue( t ) );
}
}
}
- public bool hasNext() {
- if ( 0 <= m_pos + 1 && m_pos + 1 < nrpns.Count ) {
+ public boolean hasNext() {
+ if ( 0 <= m_pos + 1 && m_pos + 1 < nrpns.size() ) {
return true;
} else {
return false;
@@ -578,7 +582,7 @@ namespace Boare.Lib.Vsq {
public Object next() {
m_pos++;
- return nrpns[m_pos];
+ return nrpns.get( m_pos );
}
public void remove() {
@@ -589,7 +593,7 @@ namespace Boare.Lib.Vsq {
return new NrpnIterator();
}
- public static string getName( ushort nrpn ) {
+ public static String getName( ushort nrpn ) {
foreach ( FieldInfo fi in typeof( NRPN ).GetFields() ) {
if ( fi.FieldType.Equals( typeof( ushort ) ) ) {
ushort v = (ushort)fi.GetValue( typeof( NRPN ) );
@@ -606,7 +610,7 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static byte getVoiceChangeParameterID( string curve_name ) {
+ public static byte getVoiceChangeParameterID( String curve_name ) {
byte lsb = 0x31;
switch ( curve_name.ToLower() ) {
case "harmonics":
@@ -670,7 +674,7 @@ namespace Boare.Lib.Vsq {
return lsb;
}
- public static bool is_require_data_lsb( ushort nrpn ) {
+ public static boolean is_require_data_lsb( ushort nrpn ) {
switch ( nrpn ) {
case CVM_NM_VERSION_AND_DEVICE:
case CVM_NM_DELAY:
diff --git a/trunk/Boare.Lib.Vsq/PortUtil.cs b/trunk/Boare.Lib.Vsq/PortUtil.cs
index cbb9e48..108a42d 100644
--- a/trunk/Boare.Lib.Vsq/PortUtil.cs
+++ b/trunk/Boare.Lib.Vsq/PortUtil.cs
@@ -14,56 +14,8 @@
using System;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq {
- public class Vector : List {
- public int size() {
- return base.Count;
- }
-
- public T get( int index ) {
- return base[index];
- }
-
- public void set( int index, T value ) {
- base[index] = value;
- }
- }
-
- public interface Iterator {
- bool hasNext();
- object next();
- void remove();
- }
-
- public class ListIterator : Iterator {
- private List m_list;
- private int m_pos;
-
- public ListIterator( List list ) {
- m_list = list;
- m_pos = -1;
- }
-
- public Boolean hasNext() {
- if ( m_list != null && 0 <= m_pos + 1 && m_pos + 1 < m_list.Count ) {
- return true;
- } else {
- return false;
- }
- }
-
- public Object next() {
- if ( m_list == null ) {
- return null;
- }
- m_pos++;
- return m_list[m_pos];
- }
-
- public void remove() {
- m_list.RemoveAt( m_pos );
- }
- }
-
}
diff --git a/trunk/Boare.Lib.Vsq/SMF/MidiFile.cs b/trunk/Boare.Lib.Vsq/SMF/MidiFile.cs
index 5a4b9cb..1eed05d 100644
--- a/trunk/Boare.Lib.Vsq/SMF/MidiFile.cs
+++ b/trunk/Boare.Lib.Vsq/SMF/MidiFile.cs
@@ -15,8 +15,12 @@ using System;
using System.IO;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq {
+ using boolean = System.Boolean;
+
///
/// midiイベント。メタイベントは、メタイベントのデータ長をData[1]に格納せず、生のデータをDataに格納するので、注意が必要
///
@@ -53,7 +57,7 @@ namespace Boare.Lib.Vsq {
}
private static void writeDeltaClock( Stream stream, long number ) {
- bool[] bits = new bool[64];
+ boolean[] bits = new boolean[64];
long val = 0x1;
bits[0] = (number & val) == val;
for ( int i = 1; i < 64; i++ ) {
@@ -203,7 +207,43 @@ namespace Boare.Lib.Vsq {
}
public int CompareTo( MidiEvent item ) {
- return (int)(clock - item.clock);
+ if ( clock != item.clock ) {
+ return (int)(clock - item.clock);
+ } else {
+ int first_this = firstByte & 0xf0;
+ int first_item = item.firstByte & 0xf0;
+
+ if ( (first_this == 0x80 || first_this == 0x90) && (first_item == 0x80 || first_item == 0x90) ) {
+ if ( data != null && data.Length >= 2 && item.data != null && item.data.Length >= 2 ) {
+ if ( first_item == 0x90 && item.data[1] == 0 ) {
+ first_item = 0x80;
+ }
+ if ( first_this == 0x90 && data[1] == 0 ) {
+ first_this = 0x80;
+ }
+ if ( data[0] == item.data[0] ) {
+ if ( first_this == 0x90 ) {
+ if ( first_item == 0x80 ) {
+ // ON -> OFF
+ return 1;
+ } else {
+ // ON -> ON
+ return 0;
+ }
+ } else {
+ if ( first_item == 0x80 ) {
+ // OFF -> OFF
+ return 0;
+ } else {
+ // OFF -> ON
+ return -1;
+ }
+ }
+ }
+ }
+ }
+ return (int)(clock - item.clock);
+ }
}
public static MidiEvent generateTimeSigEvent( int clock, int numerator, int denominator ) {
@@ -233,11 +273,11 @@ namespace Boare.Lib.Vsq {
}
public class MidiFile : IDisposable {
- private List> m_events;
+ private Vector> m_events;
private ushort m_format;
private ushort m_time_format;
- public MidiFile( string path ){
+ public MidiFile( String path ){
Stream stream = new FileStream( path, FileMode.Open, FileAccess.Read );
// ヘッダ
byte[] byte4 = new byte[4];
@@ -264,14 +304,14 @@ namespace Boare.Lib.Vsq {
m_time_format = makeUint16( byte4 );
// 各トラックを読込み
- m_events = new List>();
+ m_events = new Vector>();
for ( int track = 0; track < tracks; track++ ) {
// ヘッダー
stream.Read( byte4, 0, 4 );
if ( makeUInt32( byte4 ) != 0x4d54726b ) {
throw new ApplicationException( "header error; MTrk" );
}
- m_events.Add( new List() );
+ m_events.add( new Vector() );
// チャンクサイズ
stream.Read( byte4, 0, 4 );
@@ -283,58 +323,58 @@ namespace Boare.Lib.Vsq {
byte last_status_byte = 0x00;
while ( stream.Position < startpos + size ) {
MidiEvent mi = MidiEvent.read( stream, ref clock, ref last_status_byte );
- m_events[track].Add( mi );
+ m_events.get( track ).add( mi );
}
if ( m_time_format != 480 ) {
- int count = m_events[track].Count;
+ int count = m_events.get( track ).size();
for ( int i = 0; i < count; i++ ) {
- MidiEvent mi = m_events[track][i];
+ MidiEvent mi = m_events.get( track ).get( i );
mi.clock = mi.clock * 480 / m_time_format;
- m_events[track][i] = mi;
+ m_events.get( track ).set( i, mi );
}
}
}
m_time_format = 480;
#if DEBUG
- string dbg = Path.Combine( Path.GetDirectoryName( path ), Path.GetFileNameWithoutExtension( path ) + ".txt" );
+ String dbg = Path.Combine( Path.GetDirectoryName( path ), Path.GetFileNameWithoutExtension( path ) + ".txt" );
using ( StreamWriter sw = new StreamWriter( dbg ) ) {
- const string format = " {0,8} 0x{1:X4} {2,-35} 0x{3:X2} 0x{4:X2}";
- const string format0 = " {0,8} 0x{1:X4} {2,-35} 0x{3:X2}";
- for ( int track = 1; track < m_events.Count; track++ ) {
+ const String format = " {0,8} 0x{1:X4} {2,-35} 0x{3:X2} 0x{4:X2}";
+ const String format0 = " {0,8} 0x{1:X4} {2,-35} 0x{3:X2}";
+ for ( int track = 1; track < m_events.size(); track++ ) {
sw.WriteLine( "MidiFile..ctor; track=" + track );
byte msb, lsb, data_msb, data_lsb;
msb = lsb = data_msb = data_lsb = 0x0;
- for ( int i = 0; i < m_events[track].Count; i++ ) {
- if ( m_events[track][i].firstByte == 0xb0 ) {
- switch ( m_events[track][i].data[0] ) {
+ for ( int i = 0; i < m_events.get( track ).size(); i++ ) {
+ if ( m_events.get( track ).get( i ).firstByte == 0xb0 ) {
+ switch ( m_events.get( track ).get( i ).data[0] ) {
case 0x63:
- msb = m_events[track][i].data[1];
+ msb = m_events.get( track ).get( i ).data[1];
lsb = 0x0;
break;
case 0x62:
- lsb = m_events[track][i].data[1];
+ lsb = m_events.get( track ).get( i ).data[1];
break;
case 0x06:
- data_msb = m_events[track][i].data[1];
+ data_msb = m_events.get( track ).get( i ).data[1];
ushort nrpn = (ushort)(msb << 8 | lsb);
- string name = NRPN.getName( nrpn );
- if ( name == "" ) {
+ String name = NRPN.getName( nrpn );
+ if ( name.Equals( "" ) ) {
name = "* * UNKNOWN * *";
- sw.WriteLine( string.Format( format0, m_events[track][i].clock, nrpn, name, data_msb ) );
+ sw.WriteLine( String.Format( format0, m_events.get( track ).get( i ).clock, nrpn, name, data_msb ) );
} else {
//if ( !NRPN.is_require_data_lsb( nrpn ) ) {
- sw.WriteLine( string.Format( format0, m_events[track][i].clock, nrpn, name, data_msb ) );
+ sw.WriteLine( String.Format( format0, m_events.get( track ).get( i ).clock, nrpn, name, data_msb ) );
//}
}
break;
case 0x26:
- data_lsb = m_events[track][i].data[1];
+ data_lsb = m_events.get( track ).get( i ).data[1];
ushort nrpn2 = (ushort)(msb << 8 | lsb);
- string name2 = NRPN.getName( nrpn2 );
- if ( name2 == "" ) {
+ String name2 = NRPN.getName( nrpn2 );
+ if ( name2.Equals( "" ) ) {
name2 = "* * UNKNOWN * *";
}
- sw.WriteLine( string.Format( format, m_events[track][i].clock, nrpn2, name2, data_msb, data_lsb ) );
+ sw.WriteLine( String.Format( format, m_events.get( track ).get( i ).clock, nrpn2, name2, data_msb, data_lsb ) );
break;
}
}
@@ -345,16 +385,16 @@ namespace Boare.Lib.Vsq {
stream.Close();
}
- /*public void Write( string path ) {
+ /*public void Write( String path ) {
}*/
- public List getMidiEventList( int track ) {
+ public Vector getMidiEventList( int track ) {
if ( m_events == null ) {
- return new List();
- } else if ( 0 <= track && track < m_events.Count ) {
- return m_events[track];
+ return new Vector();
+ } else if ( 0 <= track && track < m_events.size() ) {
+ return m_events.get( track );
} else {
- return new List();
+ return new Vector();
}
}
@@ -362,7 +402,7 @@ namespace Boare.Lib.Vsq {
if ( m_events == null ) {
return 0;
} else {
- return m_events.Count;
+ return m_events.size();
}
}
@@ -372,10 +412,10 @@ namespace Boare.Lib.Vsq {
public void Close() {
if ( m_events != null ) {
- for ( int i = 0; i < m_events.Count; i++ ) {
- m_events[i].Clear();
+ for ( int i = 0; i < m_events.size(); i++ ) {
+ m_events.get( i ).clear();
}
- m_events.Clear();
+ m_events.clear();
}
}
diff --git a/trunk/Boare.Lib.Vsq/SingerConfig.cs b/trunk/Boare.Lib.Vsq/SingerConfig.cs
index 561b0fc..799e2f6 100644
--- a/trunk/Boare.Lib.Vsq/SingerConfig.cs
+++ b/trunk/Boare.Lib.Vsq/SingerConfig.cs
@@ -15,13 +15,15 @@ using System;
using System.IO;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq {
public class SingerConfig : ICloneable {
- public string ID = "";
- public string FORMAT = "";
- public string VOICEIDSTR = "";
- public string VOICENAME = "Unknown";
+ public String ID = "";
+ public String FORMAT = "";
+ public String VOICEIDSTR = "";
+ public String VOICENAME = "Unknown";
public int Breathiness;
public int Brightness;
public int Clearness;
@@ -75,7 +77,7 @@ namespace Boare.Lib.Vsq {
return ret;
}
- public static SingerConfig fromVvd( string file, int original ) {
+ public static SingerConfig fromVvd( String file, int original ) {
SingerConfig sc = new SingerConfig();
//original = original;
sc.ID = "VOCALOID:VIRTUAL:VOICE";
@@ -95,69 +97,69 @@ namespace Boare.Lib.Vsq {
byte[] dat = new byte[length];
fs.Read( dat, 0, length );
TransCodeUtil.decodeBytes( ref dat );
- string str = bocoree.cp932.convert( dat );
+ String str = bocoree.cp932.convert( dat );
#if DEBUG
Console.WriteLine( "SingerConfig.readSingerConfig; str=" + str );
#endif
- string crlf = ((char)0x0d).ToString() + ((char)0x0a).ToString();
- string[] spl = str.Split( new string[] { crlf }, StringSplitOptions.RemoveEmptyEntries );
+ String crlf = ((char)0x0d).ToString() + ((char)0x0a).ToString();
+ String[] spl = str.Split( new String[] { crlf }, StringSplitOptions.RemoveEmptyEntries );
- foreach ( string s in spl ) {
+ foreach ( String s in spl ) {
int first = s.IndexOf( '"' );
int first_end = get_quated_string( s, first );
int second = s.IndexOf( '"', first_end + 1 );
int second_end = get_quated_string( s, second );
char[] chs = s.ToCharArray();
- string id = new string( chs, first, first_end - first + 1 );
- string value = new string( chs, second, second_end - second + 1 );
+ String id = new String( chs, first, first_end - first + 1 );
+ String value = new String( chs, second, second_end - second + 1 );
id = id.Substring( 1, id.Length - 2 );
value = value.Substring( 1, value.Length - 2 );
value = value.Replace( "\\\"", "\"" );
int parsed_int = 64;
int.TryParse( value, out parsed_int );
- if ( id == "ID" ) {
+ if ( id.Equals( "ID" ) ) {
sc.ID = value;
- } else if ( id == "FORMAT" ) {
+ } else if ( id.Equals( "FORMAT" ) ) {
sc.FORMAT = value;
- } else if ( id == "VOICEIDSTR" ) {
+ } else if ( id.Equals( "VOICEIDSTR" ) ) {
sc.VOICEIDSTR = value;
- } else if ( id == "VOICENAME" ) {
+ } else if ( id.Equals( "VOICENAME" ) ) {
sc.VOICENAME = value;
- } else if ( id == "Breathiness" || id == "Noise" ) {
+ } else if ( id.Equals( "Breathiness" ) || id.Equals( "Noise" ) ) {
sc.Breathiness = parsed_int;
- } else if ( id == "Brightness" ) {
+ } else if ( id.Equals( "Brightness" ) ) {
sc.Brightness = parsed_int;
- } else if ( id == "Clearness" ) {
+ } else if ( id.Equals( "Clearness" ) ) {
sc.Clearness = parsed_int;
- } else if ( id == "Opening" ) {
+ } else if ( id.Equals( "Opening" ) ) {
sc.Opening = parsed_int;
- } else if ( id == "Gender:Factor" ) {
+ } else if ( id.Equals( "Gender:Factor" ) ) {
sc.GenderFactor = parsed_int;
- } else if ( id == "Resonance1:Frequency" ) {
+ } else if ( id.Equals( "Resonance1:Frequency" ) ) {
sc.Resonance1Frequency = parsed_int;
- } else if ( id == "Resonance1:Band:Width" ) {
+ } else if ( id.Equals( "Resonance1:Band:Width" ) ) {
sc.Resonance1BandWidth = parsed_int;
- } else if ( id == "Resonance1:Amplitude" ) {
+ } else if ( id.Equals( "Resonance1:Amplitude" ) ) {
sc.Resonance1Amplitude = parsed_int;
- } else if ( id == "Resonance2:Frequency" ) {
+ } else if ( id.Equals( "Resonance2:Frequency" ) ) {
sc.Resonance2Frequency = parsed_int;
- } else if ( id == "Resonance2:Band:Width" ) {
+ } else if ( id.Equals( "Resonance2:Band:Width" ) ) {
sc.Resonance2BandWidth = parsed_int;
- } else if ( id == "Resonance2:Amplitude" ) {
+ } else if ( id.Equals( "Resonance2:Amplitude" ) ) {
sc.Resonance2Amplitude = parsed_int;
- } else if ( id == "Resonance3:Frequency" ) {
+ } else if ( id.Equals( "Resonance3:Frequency" ) ) {
sc.Resonance3Frequency = parsed_int;
- } else if ( id == "Resonance3:Band:Width" ) {
+ } else if ( id.Equals( "Resonance3:Band:Width" ) ) {
sc.Resonance3BandWidth = parsed_int;
- } else if ( id == "Resonance3:Amplitude" ) {
+ } else if ( id.Equals( "Resonance3:Amplitude" ) ) {
sc.Resonance3Amplitude = parsed_int;
- } else if ( id == "Resonance4:Frequency" ) {
+ } else if ( id.Equals( "Resonance4:Frequency" ) ) {
sc.Resonance4Frequency = parsed_int;
- } else if ( id == "Resonance4:Band:Width" ) {
+ } else if ( id.Equals( "Resonance4:Band:Width" ) ) {
sc.Resonance4BandWidth = parsed_int;
- } else if ( id == "Resonance4:Amplitude" ) {
+ } else if ( id.Equals( "Resonance4:Amplitude" ) ) {
sc.Resonance4Amplitude = parsed_int;
- } else if ( id == "Harmonics" ) {
+ } else if ( id.Equals( "Harmonics" ) ) {
sc.Harmonics = parsed_int;
}
}
@@ -177,7 +179,7 @@ namespace Boare.Lib.Vsq {
///
///
///
- static int get_quated_string( string s, int position ) {
+ static int get_quated_string( String s, int position ) {
if ( position < 0 ) {
return -1;
}
@@ -198,24 +200,24 @@ namespace Boare.Lib.Vsq {
return end;
}
- public string[] ToStringArray() {
- List ret = new List();
- ret.Add( "\"ID\":=:\"" + ID + "\"" );
- ret.Add( "\"FORMAT\":=:\"" + FORMAT + "\"" );
- ret.Add( "\"VOICEIDSTR\":=:\"" + VOICEIDSTR + "\"" );
- ret.Add( "\"VOICENAME\":=:\"" + VOICENAME.Replace( "\"", "\\\"" ) + "\"" );
- ret.Add( "\"Breathiness\":=:\"" + Breathiness + "\"" );
- ret.Add( "\"Brightness\":=:\"" + Brightness + "\"" );
- ret.Add( "\"Clearness\":=:\"" + Clearness + "\"" );
- ret.Add( "\"Opening\":=:\"" + Opening + "\"" );
- ret.Add( "\"Gender:Factor\":=:\"" + GenderFactor + "\"" );
- return ret.ToArray();
+ public String[] ToStringArray() {
+ Vector ret = new Vector();
+ ret.add( "\"ID\":=:\"" + ID + "\"" );
+ ret.add( "\"FORMAT\":=:\"" + FORMAT + "\"" );
+ ret.add( "\"VOICEIDSTR\":=:\"" + VOICEIDSTR + "\"" );
+ ret.add( "\"VOICENAME\":=:\"" + VOICENAME.Replace( "\"", "\\\"" ) + "\"" );
+ ret.add( "\"Breathiness\":=:\"" + Breathiness + "\"" );
+ ret.add( "\"Brightness\":=:\"" + Brightness + "\"" );
+ ret.add( "\"Clearness\":=:\"" + Clearness + "\"" );
+ ret.add( "\"Opening\":=:\"" + Opening + "\"" );
+ ret.add( "\"Gender:Factor\":=:\"" + GenderFactor + "\"" );
+ return ret.toArray( new String[]{} );
}
- public override string ToString() {
- string[] r = ToStringArray();
- string ret = "";
- foreach ( string s in r ) {
+ public override String ToString() {
+ String[] r = ToStringArray();
+ String ret = "";
+ foreach ( String s in r ) {
ret += s + "\n";
}
return ret;
diff --git a/trunk/Boare.Lib.Vsq/SingerConfigSys.cs b/trunk/Boare.Lib.Vsq/SingerConfigSys.cs
index 4383dce..cf661bf 100644
--- a/trunk/Boare.Lib.Vsq/SingerConfigSys.cs
+++ b/trunk/Boare.Lib.Vsq/SingerConfigSys.cs
@@ -15,22 +15,24 @@ using System;
using System.Collections.Generic;
using System.IO;
+using bocoree;
+
namespace Boare.Lib.Vsq {
public class SingerConfigSys {
private const int MAX_SINGERS = 0x4000;
- private List m_installed_singers = new List();
- private List m_singer_configs = new List();
+ private Vector m_installed_singers = new Vector();
+ private Vector m_singer_configs = new Vector();
///
///
///
/// 音源のデータディレクトリ(ex:"C:\Program Files\VOCALOID2\voicedbdir")
- /// 音源のインストールディレクトリ(ex:new string[]{ "C:\Program Files\VOCALOID2\voicedbdir\BXXXXXXXXXXXXXXX", "D:\singers\BNXXXXXXXXXX" })
- public SingerConfigSys( string path_voicedb, string[] path_installed_singers ) {
- m_installed_singers = new List();
- m_singer_configs = new List();
+ /// 音源のインストールディレクトリ(ex:new String[]{ "C:\Program Files\VOCALOID2\voicedbdir\BXXXXXXXXXXXXXXX", "D:\singers\BNXXXXXXXXXX" })
+ public SingerConfigSys( String path_voicedb, String[] path_installed_singers ) {
+ m_installed_singers = new Vector();
+ m_singer_configs = new Vector();
String map = Path.Combine( path_voicedb, "voice.map" );
if ( !File.Exists( map ) ) {
return;
@@ -47,8 +49,9 @@ namespace Boare.Lib.Vsq {
item.Program = i;
int original = -1;
- foreach ( SingerConfig sc in m_installed_singers ) {
- if ( sc.VOICEIDSTR == item.VOICEIDSTR ) {
+ for ( Iterator itr = m_installed_singers.iterator(); itr.hasNext(); ){
+ SingerConfig sc = (SingerConfig)itr.next();
+ if ( sc.VOICEIDSTR.Equals( item.VOICEIDSTR ) ) {
original = sc.Program;
break;
}
@@ -56,12 +59,12 @@ namespace Boare.Lib.Vsq {
if ( original < 0 ) {
foreach ( String ipath in path_installed_singers ) {
if ( ipath.EndsWith( item.VOICEIDSTR ) ) {
- string[] vvds = Directory.GetFiles( ipath, "*.vvd" );
+ String[] vvds = Directory.GetFiles( ipath, "*.vvd" );
if ( vvds.Length > 0 ) {
- original = m_installed_singers.Count;
+ original = m_installed_singers.size();
SingerConfig installed = SingerConfig.fromVvd( vvds[0], original );
installed.Program = original;
- m_installed_singers.Add( installed );
+ m_installed_singers.add( installed );
break;
}
}
@@ -69,14 +72,14 @@ namespace Boare.Lib.Vsq {
}
item.Original = original;
- m_singer_configs.Add( item );
+ m_singer_configs.add( item );
}
}
}
}
public SingerConfig[] getInstalledSingers() {
- return m_installed_singers.ToArray();
+ return m_installed_singers.toArray( new SingerConfig[]{} );
}
///
@@ -84,13 +87,13 @@ namespace Boare.Lib.Vsq {
///
///
///
- public VsqID getSingerID( string singer ) {
+ public VsqID getSingerID( String singer ) {
VsqID ret = new VsqID( 0 );
ret.type = VsqIDType.Singer;
SingerConfig sc = null;
- for ( int i = 0; i < m_singer_configs.Count; i++ ) {
- if ( m_singer_configs[i].VOICENAME == singer ) {
- sc = m_singer_configs[i];
+ for ( int i = 0; i < m_singer_configs.size(); i++ ) {
+ if ( m_singer_configs.get( i ).VOICENAME.Equals( singer ) ) {
+ sc = m_singer_configs.get( i );
break;
}
}
@@ -98,8 +101,9 @@ namespace Boare.Lib.Vsq {
sc = new SingerConfig();
}
int lang = 0;
- foreach ( SingerConfig sc2 in m_installed_singers ) {
- if ( sc.VOICEIDSTR == sc2.VOICEIDSTR ) {
+ for( Iterator itr = m_installed_singers.iterator(); itr.hasNext(); ){
+ SingerConfig sc2 = (SingerConfig)itr.next();
+ if ( sc.VOICEIDSTR.Equals( sc2.VOICEIDSTR ) ) {
lang = (int)VocaloSysUtil.getLanguageFromName( sc.VOICENAME );
break;
}
@@ -121,9 +125,10 @@ namespace Boare.Lib.Vsq {
///
///
///
- public SingerConfig getSingerInfo( string singer ) {
- foreach ( SingerConfig item in m_singer_configs ) {
- if ( item.VOICENAME == singer ) {
+ public SingerConfig getSingerInfo( String singer ) {
+ for ( Iterator itr = m_installed_singers.iterator(); itr.hasNext(); ){
+ SingerConfig item = (SingerConfig)itr.next();
+ if ( item.VOICENAME.Equals( singer ) ) {
return item;
}
}
@@ -135,7 +140,7 @@ namespace Boare.Lib.Vsq {
///
///
public SingerConfig[] getSingerConfigs() {
- return m_singer_configs.ToArray();
+ return m_singer_configs.toArray( new SingerConfig[]{} );
}
}
diff --git a/trunk/Boare.Lib.Vsq/SymbolTable.cs b/trunk/Boare.Lib.Vsq/SymbolTable.cs
index ce3f07a..65492d1 100644
--- a/trunk/Boare.Lib.Vsq/SymbolTable.cs
+++ b/trunk/Boare.Lib.Vsq/SymbolTable.cs
@@ -21,16 +21,18 @@ using bocoree;
namespace Boare.Lib.Vsq {
+ using boolean = System.Boolean;
+
public class SymbolTable : ICloneable {
- private Dictionary m_dict;
- private string m_name;
- private bool m_enabled;
+ private TreeMap m_dict;
+ private String m_name;
+ private boolean m_enabled;
#region Static Field
private static SortedList s_table = new SortedList();
private static SymbolTable s_default_jp = null;
- private static bool s_initialized = false;
- public static readonly string[,] _KEY_JP = {
+ private static boolean s_initialized = false;
+ public static readonly String[,] _KEY_JP = {
{"あ", "a"},
{"い", "i"},
{"う", "M"},
@@ -480,35 +482,35 @@ namespace Boare.Lib.Vsq {
int count = 0;
// 辞書フォルダからの読込み
- string editor_path = VocaloSysUtil.getEditorPath2();
- if ( editor_path.Length > 0 ) {
- string path = Path.Combine( Path.GetDirectoryName( editor_path ), "UDIC" );
+ String editor_path = VocaloSysUtil.getEditorPath2();
+ if ( editor_path != "" ) {
+ String path = Path.Combine( Path.GetDirectoryName( editor_path ), "UDIC" );
if ( !Directory.Exists( path ) ) {
return;
}
- string[] files = Directory.GetFiles( path, "*.udc" );
+ String[] files = Directory.GetFiles( path, "*.udc" );
for ( int i = 0; i < files.Length; i++ ) {
files[i] = Path.GetFileName( files[i] );
#if DEBUG
Console.WriteLine( " files[i]=" + files[i] );
#endif
count++;
- string dict = Path.Combine( path, files[i] );
+ String dict = Path.Combine( path, files[i] );
s_table.Add( count, new SymbolTable( dict, true, false ) );
}
}
// 起動ディレクトリ
- string path2 = Path.Combine( Application.StartupPath, "udic" );
+ String path2 = Path.Combine( Application.StartupPath, "udic" );
if ( Directory.Exists( path2 ) ) {
- string[] files2 = Directory.GetFiles( path2, "*.eudc" );
+ String[] files2 = Directory.GetFiles( path2, "*.eudc" );
for ( int i = 0; i < files2.Length; i++ ) {
files2[i] = Path.GetFileName( files2[i] );
#if DEBUG
Console.WriteLine( " files2[i]=" + files2[i] );
#endif
count++;
- string dict = Path.Combine( path2, files2[i] );
+ String dict = Path.Combine( path2, files2[i] );
s_table.Add( count, new SymbolTable( dict, false, false ) );
}
}
@@ -516,7 +518,7 @@ namespace Boare.Lib.Vsq {
}
- public static bool attatch( string phrase, out string result ) {
+ public static boolean attatch( String phrase, out String result ) {
#if DEBUG
Console.WriteLine( "SymbolTable.Attatch" );
Console.WriteLine( " phrase=" + phrase );
@@ -540,7 +542,7 @@ namespace Boare.Lib.Vsq {
return s_table.Count;
}
- public static void changeOrder( KeyValuePair[] list ) {
+ public static void changeOrder( KeyValuePair[] list ) {
#if DEBUG
Console.WriteLine( "SymbolTable.Sort()" );
#endif
@@ -555,7 +557,7 @@ namespace Boare.Lib.Vsq {
#endif
for ( int j = 0; j < buff.Keys.Count; j++ ) {
int key = buff.Keys[j];
- if ( buff[key].getName() == list[i].Key ) {
+ if ( buff[key].getName().Equals( list[i].Key ) ) {
buff[key].setEnabled( list[i].Value );
s_table.Add( i, buff[key] );
break;
@@ -567,9 +569,10 @@ namespace Boare.Lib.Vsq {
public object Clone() {
SymbolTable ret = new SymbolTable();
- ret.m_dict = new Dictionary();
- foreach ( string key in m_dict.Keys ) {
- ret.m_dict.Add( key, m_dict[key] );
+ ret.m_dict = new TreeMap();
+ for ( Iterator itr = m_dict.keySet().iterator(); itr.hasNext(); ){
+ String key = (String)itr.next();
+ ret.m_dict.put( key, m_dict.get( key ) );
}
ret.m_name = m_name;
ret.m_enabled = m_enabled;
@@ -579,20 +582,20 @@ namespace Boare.Lib.Vsq {
private SymbolTable() {
}
- public string getName() {
+ public String getName() {
return m_name;
}
- public bool isEnabled() {
+ public boolean isEnabled() {
return m_enabled;
}
- public void setEnabled( bool value ){
+ public void setEnabled( boolean value ){
m_enabled = value;
}
- public SymbolTable( string path, bool is_udc_mode, bool enabled ) {
- m_dict = new Dictionary();
+ public SymbolTable( String path, boolean is_udc_mode, boolean enabled ) {
+ m_dict = new TreeMap();
m_enabled = enabled;
if ( !File.Exists( path ) ) {
return;
@@ -612,18 +615,18 @@ namespace Boare.Lib.Vsq {
return;
}
}
- string line;
+ String line;
int peek = (is_udc_mode) ? sr1.Peek() : sr2.Peek();
while ( peek >= 0 ) {
line = (is_udc_mode) ? sr1.ReadLine() : sr2.ReadLine();
if ( !line.StartsWith( "//" ) ) {
- string[] spl = line.Split( "\t".ToCharArray(), 2, StringSplitOptions.RemoveEmptyEntries );
+ String[] spl = line.Split( "\t".ToCharArray(), 2, StringSplitOptions.RemoveEmptyEntries );
if ( spl.Length >= 2 ) {
- if ( m_dict.ContainsKey( spl[0] ) ) {
+ if ( m_dict.containsKey( spl[0] ) ) {
bocoree.debug.push_log( "SymbolTable..ctor" );
bocoree.debug.push_log( " dictionary already contains key: " + spl[0] );
} else {
- m_dict.Add( spl[0], spl[1] );
+ m_dict.put( spl[0], spl[1] );
}
}
}
@@ -642,10 +645,10 @@ namespace Boare.Lib.Vsq {
}
}
- private bool attatchImp( string phrase, out string result ) {
- string s = phrase.ToLower();
- if ( m_dict.ContainsKey( s ) ) {
- result = m_dict[s];
+ private boolean attatchImp( String phrase, out String result ) {
+ String s = phrase.ToLower();
+ if ( m_dict.containsKey( s ) ) {
+ result = m_dict.get( s );
return true;
} else {
result = "a";
@@ -653,21 +656,21 @@ namespace Boare.Lib.Vsq {
}
}
- private SymbolTable( string name, string[,] key, bool enabled ) {
+ private SymbolTable( String name, String[,] key, boolean enabled ) {
#if DEBUG
- Console.WriteLine( "SymolTable.ctor(string,string[,])" );
+ Console.WriteLine( "SymolTable.ctor(String,String[,])" );
Console.WriteLine( " key.GetLength(0)=" + key.GetLength( 0 ) );
#endif
m_enabled = enabled;
m_name = name;
- m_dict = new Dictionary();
+ m_dict = new TreeMap();
for ( int i = 0; i < key.GetLength( 0 ); i++ ) {
- if ( m_dict.ContainsKey( key[i, 0] ) ) {
+ if ( m_dict.containsKey( key[i, 0] ) ) {
#if DEBUG
throw new ApplicationException( "dictionary already contains key: " + key[i, 0] );
#endif
} else {
- m_dict.Add( key[i, 0], key[i, 1] );
+ m_dict.put( key[i, 0], key[i, 1] );
}
}
}
diff --git a/trunk/Boare.Lib.Vsq/TempoTableEntry.cs b/trunk/Boare.Lib.Vsq/TempoTableEntry.cs
index cbc8b57..be6f172 100644
--- a/trunk/Boare.Lib.Vsq/TempoTableEntry.cs
+++ b/trunk/Boare.Lib.Vsq/TempoTableEntry.cs
@@ -14,8 +14,12 @@
using System;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq {
+ using boolean = System.Boolean;
+
public class TempoTable : ICloneable {
private struct TempoTableEntry : IComparable {
public int Clock;
@@ -33,7 +37,7 @@ namespace Boare.Lib.Vsq {
}
}
- private List m_tempo_table;
+ private Vector m_tempo_table;
private int m_base_tempo;
private int m_tpq;
@@ -43,51 +47,51 @@ namespace Boare.Lib.Vsq {
public TempoTable( int base_tempo, int clock_per_quoter ) {
m_base_tempo = base_tempo;
m_tpq = clock_per_quoter;
- m_tempo_table = new List();
- m_tempo_table.Add( new TempoTableEntry( 0, base_tempo, 0.0 ) );
+ m_tempo_table = new Vector();
+ m_tempo_table.add( new TempoTableEntry( 0, base_tempo, 0.0 ) );
}
public object Clone() {
TempoTable ret = new TempoTable();
ret.m_base_tempo = m_base_tempo;
ret.m_tpq = m_tpq;
- ret.m_tempo_table = new List();
- for ( int i = 0; i < m_tempo_table.Count; i++ ) {
- ret.m_tempo_table.Add( m_tempo_table[i] );
+ ret.m_tempo_table = new Vector();
+ for ( int i = 0; i < m_tempo_table.size(); i++ ) {
+ ret.m_tempo_table.add( m_tempo_table.get( i ) );
}
ret.update();
return ret;
}
public void add( int clock, int tempo ) {
- bool found = false;
- for ( int i = 0; i < m_tempo_table.Count; i++ ) {
- if ( m_tempo_table[i].Clock == clock ) {
+ boolean found = false;
+ for ( int i = 0; i < m_tempo_table.size(); i++ ) {
+ if ( m_tempo_table.get( i ).Clock == clock ) {
found = true;
- m_tempo_table[i] = new TempoTableEntry( clock, tempo, 0.0 );
+ m_tempo_table.set( i, new TempoTableEntry( clock, tempo, 0.0 ) );
break;
}
}
if ( !found ) {
- m_tempo_table.Add( new TempoTableEntry( clock, tempo, 0.0 ) );
+ m_tempo_table.add( new TempoTableEntry( clock, tempo, 0.0 ) );
}
- m_tempo_table.Sort();
+ Collections.sort( m_tempo_table );
update();
}
public void clear( int base_tempo ) {
- m_tempo_table.Clear();
- m_tempo_table.Add( new TempoTableEntry( 0, base_tempo, 0.0 ) );
+ m_tempo_table.clear();
+ m_tempo_table.add( new TempoTableEntry( 0, base_tempo, 0.0 ) );
}
private void update() {
- for ( int i = 0; i < m_tempo_table.Count; i++ ) {
+ for ( int i = 0; i < m_tempo_table.size(); i++ ) {
long sum = 0;
for ( int k = 0; k < i; k++ ) {
- sum += (m_tempo_table[k].Tempo * (m_tempo_table[k + 1].Clock - m_tempo_table[k].Clock));
+ sum += (m_tempo_table.get( k ).Tempo * (m_tempo_table.get( k + 1 ).Clock - m_tempo_table.get( k ).Clock));
}
double time = sum / (m_tpq * 1e6);
- m_tempo_table[i] = new TempoTableEntry( m_tempo_table[i].Clock, m_tempo_table[i].Tempo, time );
+ m_tempo_table.set( i, new TempoTableEntry( m_tempo_table.get( i ).Clock, m_tempo_table.get( i ).Tempo, time ) );
}
}
@@ -101,18 +105,18 @@ namespace Boare.Lib.Vsq {
int tempo = m_base_tempo;
double base_clock = 0;
double base_time = 0f;
- if ( m_tempo_table.Count == 0 ) {
+ if ( m_tempo_table.size() == 0 ) {
tempo = m_base_tempo;
base_clock = 0;
base_time = 0f;
- } else if ( m_tempo_table.Count == 1 ) {
- tempo = m_tempo_table[0].Tempo;
- base_clock = m_tempo_table[0].Clock;
- base_time = m_tempo_table[0].Time;
+ } else if ( m_tempo_table.size() == 1 ) {
+ tempo = m_tempo_table.get( 0 ).Tempo;
+ base_clock = m_tempo_table.get( 0 ).Clock;
+ base_time = m_tempo_table.get( 0 ).Time;
} else {
- for ( int i = m_tempo_table.Count - 1; i >= 0; i-- ) {
- if ( m_tempo_table[i].Time < time ) {
- return m_tempo_table[i].Clock + (time - m_tempo_table[i].Time) * m_tpq * 1000000.0 / m_tempo_table[i].Tempo;
+ for ( int i = m_tempo_table.size() - 1; i >= 0; i-- ) {
+ if ( m_tempo_table.get( i ).Time < time ) {
+ return m_tempo_table.get( i ).Clock + (time - m_tempo_table.get( i ).Time) * m_tpq * 1000000.0 / m_tempo_table.get( i ).Tempo;
}
}
}
@@ -126,11 +130,11 @@ namespace Boare.Lib.Vsq {
///
///
public double getSecFromClock( int clock ) {
- for ( int i = m_tempo_table.Count - 1; i >= 0; i-- ) {
- if ( m_tempo_table[i].Clock < clock ) {
- double init = m_tempo_table[i].Time;
- int dclock = clock - m_tempo_table[i].Clock;
- double sec_per_clock1 = m_tempo_table[i].Tempo * 1e-6 / 480.0;
+ for ( int i = m_tempo_table.size() - 1; i >= 0; i-- ) {
+ if ( m_tempo_table.get( i ).Clock < clock ) {
+ double init = m_tempo_table.get( i ).Time;
+ int dclock = clock - m_tempo_table.get( i ).Clock;
+ double sec_per_clock1 = m_tempo_table.get( i ).Tempo * 1e-6 / 480.0;
return init + dclock * sec_per_clock1;
}
}
@@ -166,7 +170,7 @@ namespace Boare.Lib.Vsq {
return this.Clock - entry.Clock;
}
- public bool Equals( TempoTableEntry entry ) {
+ public boolean Equals( TempoTableEntry entry ) {
if ( this.Clock == entry.Clock ) {
return true;
} else {
diff --git a/trunk/Boare.Lib.Vsq/TextMemoryStream.cs b/trunk/Boare.Lib.Vsq/TextMemoryStream.cs
index f656b63..0da581b 100644
--- a/trunk/Boare.Lib.Vsq/TextMemoryStream.cs
+++ b/trunk/Boare.Lib.Vsq/TextMemoryStream.cs
@@ -16,56 +16,58 @@ using System.IO;
using System.Text;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq {
public class TextMemoryStream : IDisposable {
- private static readonly string NL = (char)0x0d + "" + (char)0x0a;
+ private static readonly String NL = (char)0x0d + "" + (char)0x0a;
- private List m_lines;
+ private Vector m_lines;
private int m_index;
public TextMemoryStream() {
- m_lines = new List();
- m_lines.Add( "" );
+ m_lines = new Vector();
+ m_lines.add( "" );
m_index = 0;
}
- public TextMemoryStream( string path, Encoding encoding ) {
- m_lines = new List();
+ public TextMemoryStream( String path, Encoding encoding ) {
+ m_lines = new Vector();
m_index = 0;
if ( File.Exists( path ) ) {
using ( StreamReader sr = new StreamReader( path, encoding ) ) {
while ( sr.Peek() >= 0 ) {
- string line = sr.ReadLine();
- m_lines.Add( line );
+ String line = sr.ReadLine();
+ m_lines.add( line );
m_index++;
}
}
}
}
- public void write( string value ) {
+ public void write( String value ) {
appendString( value );
}
- public void writeLine( string value ) {
+ public void writeLine( String value ) {
appendString( value + NL );
}
- private void appendString( string value ) {
- string[] lines = value.Split( new string[] { NL }, StringSplitOptions.None );
- List lines2 = new List();
+ private void appendString( String value ) {
+ String[] lines = value.Split( new String[] { NL }, StringSplitOptions.None );
+ Vector lines2 = new Vector();
for ( int i = 0; i < lines.Length; i++ ) {
- string[] spl = lines[i].Split( (char)0x0d, (char)0x0a );
+ String[] spl = lines[i].Split( (char)0x0d, (char)0x0a );
for ( int j = 0; j < spl.Length; j++ ) {
- lines2.Add( spl[j] );
+ lines2.add( spl[j] );
}
}
- int count = lines2.Count;
+ int count = lines2.size();
if ( count > 0 ) {
- m_lines[m_index] += lines2[0];
+ m_lines.set( m_index, m_lines.get( m_index ) + lines2.get( 0 ) );
for ( int i = 1; i < count; i++ ) {
- m_lines.Add( lines2[i] );
+ m_lines.add( lines2.get( i ) );
m_index++;
}
}
@@ -75,17 +77,17 @@ namespace Boare.Lib.Vsq {
m_index = 0;
}
- public string readLine() {
+ public String readLine() {
m_index++;
- return m_lines[m_index - 1];
+ return m_lines.get( m_index - 1 );
}
public int peek() {
- if ( m_index < m_lines.Count ) {
- if ( m_lines[m_index] == "" ) {
+ if ( m_index < m_lines.size() ) {
+ if ( m_lines.get( m_index ).Equals( "" ) ) {
return -1;
} else {
- return (int)m_lines[m_index][0];
+ return (int)m_lines.get( m_index )[0];
}
} else {
return -1;
@@ -93,7 +95,7 @@ namespace Boare.Lib.Vsq {
}
public void close() {
- m_lines.Clear();
+ m_lines.clear();
}
public void Dispose() {
diff --git a/trunk/Boare.Lib.Vsq/TimeSigTableEntry.cs b/trunk/Boare.Lib.Vsq/TimeSigTableEntry.cs
index 5140ab3..61b8468 100644
--- a/trunk/Boare.Lib.Vsq/TimeSigTableEntry.cs
+++ b/trunk/Boare.Lib.Vsq/TimeSigTableEntry.cs
@@ -13,6 +13,8 @@
*/
using System;
+using bocoree;
+
namespace Boare.Lib.Vsq{
[Serializable]
@@ -48,7 +50,7 @@ namespace Boare.Lib.Vsq{
public TimeSigTableEntry() {
}
- public override string ToString() {
+ public override String ToString() {
return "{Clock=" + Clock + ", Numerator=" + Numerator + ", Denominator=" + Denominator + ", BarCount=" + BarCount + "}";
}
diff --git a/trunk/Boare.Lib.Vsq/UstEnvelope.cs b/trunk/Boare.Lib.Vsq/UstEnvelope.cs
index b864160..fa31bc3 100644
--- a/trunk/Boare.Lib.Vsq/UstEnvelope.cs
+++ b/trunk/Boare.Lib.Vsq/UstEnvelope.cs
@@ -13,6 +13,8 @@
*/
using System;
+using bocoree;
+
namespace Boare.Lib.Vsq {
[Serializable]
@@ -24,7 +26,7 @@ namespace Boare.Lib.Vsq {
public int v2 = 100;
public int v3 = 100;
public int v4 = 0;
- //public string Separator = "";
+ //public String Separator = "";
public int p4 = 0;
public int p5 = 0;
public int v5 = 100;
@@ -32,9 +34,9 @@ namespace Boare.Lib.Vsq {
public UstEnvelope() {
}
- public UstEnvelope( string line ) {
+ public UstEnvelope( String line ) {
if ( line.ToLower().StartsWith( "envelope=" ) ) {
- string[] spl = line.Split( '=' );
+ String[] spl = line.Split( '=' );
spl = spl[1].Split( ',' );
if ( spl.Length < 7 ) {
return;
@@ -60,8 +62,8 @@ namespace Boare.Lib.Vsq {
return new UstEnvelope( ToString() );
}
- public override string ToString() {
- string ret = "Envelope=" + p1 + "," + p2 + "," + p3 + "," + v1 + "," + v2 + "," + v3 + "," + v4;
+ public override String ToString() {
+ String ret = "Envelope=" + p1 + "," + p2 + "," + p3 + "," + v1 + "," + v2 + "," + v3 + "," + v4;
ret += ",%," + p4 + "," + p5 + "," + v5;
return ret;
}
diff --git a/trunk/Boare.Lib.Vsq/UstEvent.cs b/trunk/Boare.Lib.Vsq/UstEvent.cs
index 612322c..f114fdb 100644
--- a/trunk/Boare.Lib.Vsq/UstEvent.cs
+++ b/trunk/Boare.Lib.Vsq/UstEvent.cs
@@ -16,13 +16,15 @@ using System.IO;
using System.Collections.Generic;
using System.Text;
+using bocoree;
+
namespace Boare.Lib.Vsq {
[Serializable]
public class UstEvent : ICloneable {
- public string Tag;
+ public String Tag;
public int Length = 0;
- public string Lyric = "";
+ public String Lyric = "";
public int Note = -1;
public int Intensity = -1;
public int PBType = -1;
@@ -33,8 +35,9 @@ namespace Boare.Lib.Vsq {
public int PreUtterance = 0;
public int VoiceOverlap = 0;
public UstEnvelope Envelope = null;
- public string Flags = "";
+ public String Flags = "";
public int Moduration = 100;
+ public int Index;
public UstEvent(){
}
@@ -70,8 +73,14 @@ namespace Boare.Lib.Vsq {
return ret;
}
- public void print( StreamWriter sw, uint index ) {
- sw.WriteLine( string.Format( "[#{0:d4}]", index ) );
+ public void print( StreamWriter sw ) {
+ if ( this.Index == int.MinValue ) {
+ sw.WriteLine( "[#PREV]" );
+ } else if ( this.Index == int.MaxValue ) {
+ sw.WriteLine( "[#NEXT]" );
+ } else {
+ sw.WriteLine( String.Format( "[#{0:d4}]", Index ) );
+ }
sw.WriteLine( "Length=" + Length );
sw.WriteLine( "Lyric=" + Lyric );
sw.WriteLine( "NoteNum=" + Note );
diff --git a/trunk/Boare.Lib.Vsq/UstFile.cs b/trunk/Boare.Lib.Vsq/UstFile.cs
index db75cd6..abfbbc3 100644
--- a/trunk/Boare.Lib.Vsq/UstFile.cs
+++ b/trunk/Boare.Lib.Vsq/UstFile.cs
@@ -23,144 +23,181 @@ namespace Boare.Lib.Vsq{
public class UstFile : ICloneable {
public object Tag;
private float m_tempo = 120.00f;
- private string m_project_name = "";
- private string m_voice_dir = "";
- private string m_out_file = "";
- private string m_cache_dir = "";
- private string m_tool1 = "";
- private string m_tool2 = "";
- private List m_tracks = new List();
- private List m_tempo_table;
+ private String m_project_name = "";
+ private String m_voice_dir = "";
+ private String m_out_file = "";
+ private String m_cache_dir = "";
+ private String m_tool1 = "";
+ private String m_tool2 = "";
+ private Vector m_tracks = new Vector();
+ private Vector m_tempo_table;
- public UstFile( string path ){
- cp932reader sr = new cp932reader( path );
- string line = sr.ReadLine();
- if ( line != "[#SETTING]" ) {
- throw new Exception( "invalid ust file" );
- }
- UstTrack track = new UstTrack();
- int type = 0; //0 => reading "SETTING" section
- while( true ) {
- UstEvent ue = null;
- if ( type == 1 ) {
- ue = new UstEvent();
+ public UstFile( String path ){
+ try {
+ cp932reader sr = new cp932reader( path );
+#if DEBUG
+ bocoree.debug.push_log( "path=" + path );
+ bocoree.debug.push_log( "(sr==null)=" + (sr == null) );
+#endif
+ String line = sr.ReadLine();
+ if ( line != "[#SETTING]" ) {
+ throw new Exception( "invalid ust file" );
}
- if ( line == "[#TRACKEND]" ) {
- break;
- }
- line = sr.ReadLine(); // "[#" ̍s
- while( !line.StartsWith( "[#" ) ){
- string[] spl = line.Split( "=".ToCharArray(), 2 );
- if ( type == 0 ) {
- // reading "SETTING" section
- if ( spl[0] == "Tempo" ) {
- m_tempo = 125f;
- float v = 125f;
- if ( float.TryParse( spl[1], out v ) ) {
- m_tempo = v;
- }
- } else if ( spl[0] == "ProjectName" ) {
- m_project_name = spl[1];
- } else if ( spl[0] == "VoiceDir" ) {
- m_voice_dir = spl[1];
- } else if ( spl[0] == "OutFile" ) {
- m_out_file = spl[1];
- } else if ( spl[0] == "CacheDir" ) {
- m_cache_dir = spl[1];
- } else if ( spl[0] == "Tool1" ) {
- m_tool1 = spl[1];
- } else if ( spl[0] == "Tool2" ) {
- m_tool2 = spl[1];
- }
- } else if ( type == 1 ) {
- // readin event section
- if ( spl[0] == "Length" ) {
- ue.Length = 0;
- int v = 0;
- if ( int.TryParse( spl[1], out v ) ){
- ue.Length =v;
- }
- } else if ( spl[0] == "Lyric" ) {
- ue.Lyric = spl[1];
- } else if ( spl[0] == "NoteNum" ) {
- ue.Note = 0;
- int v = 0;
- if ( int.TryParse( spl[1], out v ) ) {
- ue.Note = v;
- }
- } else if ( spl[0] == "Intensity" ) {
- ue.Intensity =64;
- int v = 64;
- if ( int.TryParse( spl[1], out v ) ) {
- ue.Intensity = v;
- }
- } else if ( spl[0] == "PBType" ) {
- ue.PBType = 5;
- int v = 5;
- if ( int.TryParse( spl[1], out v ) ) {
- ue.PBType = v;
- }
- } else if ( spl[0] == "Piches" ) {
- string[] spl2 = spl[1].Split( ",".ToCharArray() );
- float[] t = new float[spl2.Length];
- for ( int i = 0; i < spl2.Length; i++ ) {
- float v = 0;
- float.TryParse( spl2[i], out v );
- t[i] = v;
- }
- ue.Pitches = t;
- } else if ( spl[0] == "Tempo" ) {
- ue.Tempo = 125f;
- float v;
- if ( float.TryParse( spl[1], out v ) ){
- ue.Tempo = v;
- }
- } else if ( spl[0] == "VBR" ) {
- ue.Vibrato = new UstVibrato( line );
- /*
- PBW=50,50,46,48,56,50,50,50,50
- PBS=-87
- PBY=-15.9,-20,-31.5,-26.6
- PBM=,s,r,j,s,s,s,s,s
- */
- } else if ( spl[0] == "PBW" || spl[0] == "PBS" || spl[0] == "PBY" || spl[0] == "PBM" ) {
- if ( ue.Portamento == null ) {
- ue.Portamento = new UstPortamento();
- }
- ue.Portamento.ParseLine( line );
- } else if ( spl[0] == "Envelope" ) {
- ue.Envelope = new UstEnvelope( line );
- //PreUtterance=1
- //VoiceOverlap=6
- } else if ( spl[0] == "VoiceOverlap" ) {
- if ( spl[1] != "" ) {
- ue.VoiceOverlap = int.Parse( spl[1] );
- }
- } else if ( spl[0] == "PreUtterance" ) {
- if ( spl[1] != "" ) {
- ue.PreUtterance = int.Parse( spl[1] );
- }
- } else if ( spl[0] == "Flags" ) {
- ue.Flags = line.Substring( 6 );
- }
+ UstTrack track = new UstTrack();
+ int type = 0; //0 => reading "SETTING" section
+ while ( true ) {
+#if DEBUG
+ bocoree.debug.push_log( "line=" + line );
+#endif
+ UstEvent ue = null;
+ if ( type == 1 ) {
+ ue = new UstEvent();
+ }
+ int index = 0;
+ if ( line.Equals( "[#TRACKEND]" ) ) {
+ break;
+ } else if ( line.ToUpper().Equals( "[#NEXT]" ) ) {
+ index = int.MaxValue;
+ } else if ( line.ToUpper().Equals( "[#PREV]" ) ) {
+ index = int.MinValue;
+ } else {
+ String s = line.Replace( "[#", "" ).Replace( "#", "" ).Trim();
+ int.TryParse( s, out index );
+ }
+#if DEBUG
+ bocoree.debug.push_log( "index=" + index );
+#endif
+ line = sr.ReadLine(); // "[#" ̍s
+ if ( line == null ) {
+ break;
+ }
+ while ( !line.StartsWith( "[#" ) ) {
+#if DEBUG
+ Console.WriteLine( "line=" + line );
+#endif
+ String[] spl = line.Split( "=".ToCharArray(), 2 );
+ if ( type == 0 ) {
+ // reading "SETTING" section
+ if ( spl[0].Equals( "Tempo" ) ) {
+ m_tempo = 125f;
+ float v = 125f;
+ if ( float.TryParse( spl[1], out v ) ) {
+ m_tempo = v;
+ }
+ } else if ( spl[0].Equals( "ProjectName" ) ) {
+ m_project_name = spl[1];
+ } else if ( spl[0].Equals( "VoiceDir" ) ) {
+ m_voice_dir = spl[1];
+ } else if ( spl[0].Equals( "OutFile" ) ) {
+ m_out_file = spl[1];
+ } else if ( spl[0].Equals( "CacheDir" ) ) {
+ m_cache_dir = spl[1];
+ } else if ( spl[0].Equals( "Tool1" ) ) {
+ m_tool1 = spl[1];
+ } else if ( spl[0].Equals( "Tool2" ) ) {
+ m_tool2 = spl[1];
+ }
+ } else if ( type == 1 ) {
+ // readin event section
+ if ( spl[0].Equals( "Length" ) ) {
+ ue.Length = 0;
+ int v = 0;
+ if ( int.TryParse( spl[1], out v ) ) {
+ ue.Length = v;
+ }
+ } else if ( spl[0].Equals( "Lyric" ) ) {
+ ue.Lyric = spl[1];
+ } else if ( spl[0].Equals( "NoteNum" ) ) {
+ ue.Note = 0;
+ int v = 0;
+ if ( int.TryParse( spl[1], out v ) ) {
+ ue.Note = v;
+ }
+ } else if ( spl[0].Equals( "Intensity" ) ) {
+ ue.Intensity = 64;
+ int v = 64;
+ if ( int.TryParse( spl[1], out v ) ) {
+ ue.Intensity = v;
+ }
+ } else if ( spl[0].Equals( "PBType" ) ) {
+ ue.PBType = 5;
+ int v = 5;
+ if ( int.TryParse( spl[1], out v ) ) {
+ ue.PBType = v;
+ }
+ } else if ( spl[0].Equals( "Piches" ) ) {
+ String[] spl2 = spl[1].Split( ",".ToCharArray() );
+ float[] t = new float[spl2.Length];
+ for ( int i = 0; i < spl2.Length; i++ ) {
+ float v = 0;
+ float.TryParse( spl2[i], out v );
+ t[i] = v;
+ }
+ ue.Pitches = t;
+ } else if ( spl[0].Equals( "Tempo" ) ) {
+ ue.Tempo = 125f;
+ float v;
+ if ( float.TryParse( spl[1], out v ) ) {
+ ue.Tempo = v;
+ }
+ } else if ( spl[0].Equals( "VBR" ) ) {
+ ue.Vibrato = new UstVibrato( line );
+ /*
+ PBW=50,50,46,48,56,50,50,50,50
+ PBS=-87
+ PBY=-15.9,-20,-31.5,-26.6
+ PBM=,s,r,j,s,s,s,s,s
+ */
+ } else if ( spl[0].Equals( "PBW" ) || spl[0].Equals( "PBS" ) || spl[0].Equals( "PBY" ) || spl[0].Equals( "PBM" ) ) {
+ if ( ue.Portamento == null ) {
+ ue.Portamento = new UstPortamento();
+ }
+ ue.Portamento.ParseLine( line );
+ } else if ( spl[0].Equals( "Envelope" ) ) {
+ ue.Envelope = new UstEnvelope( line );
+ //PreUtterance=1
+ //VoiceOverlap=6
+ } else if ( spl[0].Equals( "VoiceOverlap" ) ) {
+ if ( spl[1] != "" ) {
+ ue.VoiceOverlap = int.Parse( spl[1] );
+ }
+ } else if ( spl[0].Equals( "PreUtterance" ) ) {
+ if ( spl[1] != "" ) {
+ ue.PreUtterance = int.Parse( spl[1] );
+ }
+ } else if ( spl[0].Equals( "Flags" ) ) {
+ ue.Flags = line.Substring( 6 );
+ }
+ }
+ if ( sr.Peek() < 0 ) {
+ break;
+ }
+ line = sr.ReadLine();
+ }
+#if DEBUG
+ bocoree.debug.push_log( "(ue==null)=" + (ue == null) );
+#endif
+ if ( type == 0 ) {
+ type = 1;
+ } else if ( type == 1 ) {
+ ue.Index = index;
+ track.addEvent( ue );
}
- line = sr.ReadLine();
- }
- if ( type == 0 ) {
- type = 1;
- } else if ( type == 1 ) {
- track.addEvent( ue );
}
+ m_tracks.add( track );
+ sr.Close();
+ updateTempoInfo();
+ } catch ( Exception ex ) {
+#if DEBUG
+ bocoree.debug.push_log( "ex=" + ex );
+#endif
}
- m_tracks.Add( track );
- sr.Close();
- updateTempoInfo();
}
private UstFile(){
}
- public string getProjectName() {
+ public String getProjectName() {
return m_project_name;
}
@@ -170,26 +207,26 @@ namespace Boare.Lib.Vsq{
public double getTotalSec() {
int max = 0;
- for ( int track = 0; track < m_tracks.Count; track++ ) {
+ for ( int track = 0; track < m_tracks.size(); track++ ) {
int count = 0;
- for ( int i = 0; i < m_tracks[track].getEventCount(); i++ ) {
- count += (int)m_tracks[track].getEvent( i ).Length;
+ for ( int i = 0; i < m_tracks.get( track ).getEventCount(); i++ ) {
+ count += (int)m_tracks.get( track ).getEvent( i ).Length;
}
max = Math.Max( max, count );
}
return getSecFromClock( max );
}
- public List getTempoList() {
+ public Vector getTempoList() {
return m_tempo_table;
}
public UstTrack getTrack( int track ) {
- return m_tracks[track];
+ return m_tracks.get( track );
}
public int getTrackCount() {
- return m_tracks.Count;
+ return m_tracks.size();
}
///
@@ -197,31 +234,31 @@ namespace Boare.Lib.Vsq{
///
///
public void updateTempoInfo() {
- m_tempo_table = new List();
- if ( m_tracks.Count <= 0 ) {
+ m_tempo_table = new Vector();
+ if ( m_tracks.size() <= 0 ) {
return;
}
int clock = 0;
double time = 0.0;
int last_tempo_clock = 0; //ŌTempolĂCxg̃NbN
float last_tempo = m_tempo; //ŌɑĂe|̒l
- for ( int i = 0; i < m_tracks[0].getEventCount(); i++ ) {
- if ( m_tracks[0].getEvent( i ).Tempo > 0f ) {
+ for ( int i = 0; i < m_tracks.get( 0 ).getEventCount(); i++ ) {
+ if ( m_tracks.get( 0 ).getEvent( i ).Tempo > 0f ) {
time += (clock - last_tempo_clock) / (8.0 * last_tempo);
- if ( m_tempo_table.Count == 0 && clock != 0 ) {
- m_tempo_table.Add( new TempoTableEntry( 0, (int)(6e7 / m_tempo), 0.0 ) );
+ if ( m_tempo_table.size() == 0 && clock != 0 ) {
+ m_tempo_table.add( new TempoTableEntry( 0, (int)(6e7 / m_tempo), 0.0 ) );
}
- m_tempo_table.Add( new TempoTableEntry( clock, (int)(6e7 / m_tracks[0].getEvent( i ).Tempo), time ) );
- last_tempo = m_tracks[0].getEvent( i ).Tempo;
+ m_tempo_table.add( new TempoTableEntry( clock, (int)(6e7 / m_tracks.get( 0 ).getEvent( i ).Tempo), time ) );
+ last_tempo = m_tracks.get( 0 ).getEvent( i ).Tempo;
last_tempo_clock = clock;
}
- clock += (int)m_tracks[0].getEvent( i ).Length;
+ clock += (int)m_tracks.get( 0 ).getEvent( i ).Length;
}
#if DEBUG
using ( StreamWriter sw = new StreamWriter( Path.Combine( System.Windows.Forms.Application.StartupPath, "ust_tempo_info.txt" ) ) ) {
sw.WriteLine( "Clock\tTime\tTempo" );
- for ( int i = 0; i < m_tempo_table.Count; i++ ) {
- sw.WriteLine( m_tempo_table[i].Clock + "\t" + m_tempo_table[i].Time + "\t" + m_tempo_table[i].Tempo );
+ for ( int i = 0; i < m_tempo_table.size(); i++ ) {
+ sw.WriteLine( m_tempo_table.get( i ).Clock + "\t" + m_tempo_table.get( i ).Time + "\t" + m_tempo_table.get( i ).Tempo );
}
}
#endif
@@ -233,11 +270,11 @@ namespace Boare.Lib.Vsq{
///
///
public double getSecFromClock( int clock ) {
- for ( int i = m_tempo_table.Count - 1; i >= 0; i-- ) {
- if ( m_tempo_table[i].Clock < clock ) {
- double init = m_tempo_table[i].Time;
- int dclock = clock - m_tempo_table[i].Clock;
- double sec_per_clock1 = m_tempo_table[i].Tempo * 1e-6 / 480.0;
+ for ( int i = m_tempo_table.size() - 1; i >= 0; i-- ) {
+ if ( m_tempo_table.get( i ).Clock < clock ) {
+ double init = m_tempo_table.get( i ).Time;
+ int dclock = clock - m_tempo_table.get( i ).Clock;
+ double sec_per_clock1 = m_tempo_table.get( i ).Tempo * 1e-6 / 480.0;
return init + dclock * sec_per_clock1;
}
}
@@ -245,7 +282,7 @@ namespace Boare.Lib.Vsq{
return clock * sec_per_clock;
}
- public void write( string file ) {
+ public void write( String file ) {
StreamWriter sw = new StreamWriter( file, false, Encoding.GetEncoding( "Shift_JIS" ) );
sw.WriteLine( "[#SETTING]" );
sw.WriteLine( "Tempo=" + m_tempo );
@@ -256,8 +293,8 @@ namespace Boare.Lib.Vsq{
sw.WriteLine( "CacheDir=" + m_cache_dir );
sw.WriteLine( "Tool1=" + m_tool1 );
sw.WriteLine( "Tool2=" + m_tool2 );
- for ( int i = 0; i < m_tracks[0].getEventCount(); i++ ) {
- m_tracks[0].getEvent( i ).print( sw, (uint)i );
+ for ( int i = 0; i < m_tracks.get( 0 ).getEventCount(); i++ ) {
+ m_tracks.get( 0 ).getEvent( i ).print( sw );
}
sw.WriteLine( "[#TRACKEND]" );
sw.Close();
@@ -272,12 +309,12 @@ namespace Boare.Lib.Vsq{
ret.m_cache_dir = m_cache_dir;
ret.m_tool1 = m_tool1;
ret.m_tool2 = m_tool2;
- for ( int i = 0; i < m_tracks.Count; i++ ) {
- ret.m_tracks[i] = (UstTrack)m_tracks[i].Clone();
+ for ( int i = 0; i < m_tracks.size(); i++ ) {
+ ret.m_tracks.set( i, (UstTrack)m_tracks.get( i ).Clone() );
}
- ret.m_tempo_table = new List();
- for ( int i = 0; i < m_tempo_table.Count; i++ ) {
- ret.m_tempo_table.Add( (TempoTableEntry)m_tempo_table[i].Clone() );
+ ret.m_tempo_table = new Vector();
+ for ( int i = 0; i < m_tempo_table.size(); i++ ) {
+ ret.m_tempo_table.add( (TempoTableEntry)m_tempo_table.get( i ).Clone() );
}
return ret;
}
diff --git a/trunk/Boare.Lib.Vsq/UstPortamento.cs b/trunk/Boare.Lib.Vsq/UstPortamento.cs
index 4b1931b..5b1ab10 100644
--- a/trunk/Boare.Lib.Vsq/UstPortamento.cs
+++ b/trunk/Boare.Lib.Vsq/UstPortamento.cs
@@ -15,23 +15,25 @@ using System;
using System.Collections.Generic;
using System.IO;
+using bocoree;
+
namespace Boare.Lib.Vsq {
[Serializable]
public class UstPortamento : ICloneable {
- public List Points = new List();
+ public Vector Points = new Vector();
public int Start;
public void print( StreamWriter sw ) {
- string pbw = "";
- string pby = "";
- string pbm = "";
- for ( int i = 0; i < Points.Count; i++ ) {
- string comma = (i == 0 ? "" : ",");
- pbw += comma + Points[i].Step;
- pby += comma + Points[i].Value;
- string type = "";
- switch ( Points[i].Type ) {
+ String pbw = "";
+ String pby = "";
+ String pbm = "";
+ for ( int i = 0; i < Points.size(); i++ ) {
+ String comma = (i == 0 ? "" : ",");
+ pbw += comma + Points.get( i ).Step;
+ pby += comma + Points.get( i ).Value;
+ String type = "";
+ switch ( Points.get( i ).Type ) {
case UstPortamentoType.S:
type = "";
break;
@@ -55,8 +57,8 @@ namespace Boare.Lib.Vsq {
public object Clone() {
UstPortamento ret = new UstPortamento();
- for ( int i = 0; i < Points.Count; i++ ) {
- ret.Points.Add( Points[i] );
+ for ( int i = 0; i < Points.size(); i++ ) {
+ ret.Points.add( Points.get( i ) );
}
ret.Start = Start;
return ret;
@@ -68,39 +70,39 @@ namespace Boare.Lib.Vsq {
PBY=-15.9,-20,-31.5,-26.6
PBM=,s,r,j,s,s,s,s,s
*/
- public void ParseLine( string line ) {
+ public void ParseLine( String line ) {
line = line.ToLower();
- string[] spl = line.Split( '=' );
+ String[] spl = line.Split( '=' );
if ( spl.Length == 0 ) {
return;
}
- string[] values = spl[1].Split( ',' );
+ String[] values = spl[1].Split( ',' );
if ( line.StartsWith( "pbs=" ) ) {
Start = int.Parse( values[0] );
} else if ( line.StartsWith( "pbw=" ) ) {
for ( int i = 0; i < values.Length; i++ ) {
- if ( i >= Points.Count ) {
- Points.Add( new UstPortamentoPoint() );
+ if ( i >= Points.size() ) {
+ Points.add( new UstPortamentoPoint() );
}
- UstPortamentoPoint up = Points[i];
+ UstPortamentoPoint up = Points.get( i );
up.Step = int.Parse( values[i] );
- Points[i] = up;
+ Points.set( i, up );
}
} else if ( line.StartsWith( "pby=" ) ) {
for ( int i = 0; i < values.Length; i++ ) {
- if ( i >= Points.Count ) {
- Points.Add( new UstPortamentoPoint() );
+ if ( i >= Points.size() ) {
+ Points.add( new UstPortamentoPoint() );
}
- UstPortamentoPoint up = Points[i];
+ UstPortamentoPoint up = Points.get( i );
up.Value = float.Parse( values[i] );
- Points[i] = up;
+ Points.set( i, up );
}
} else if ( line.StartsWith( "pbm=" ) ) {
for ( int i = 0; i < values.Length; i++ ) {
- if ( i >= Points.Count ) {
- Points.Add( new UstPortamentoPoint() );
+ if ( i >= Points.size() ) {
+ Points.add( new UstPortamentoPoint() );
}
- UstPortamentoPoint up = Points[i];
+ UstPortamentoPoint up = Points.get( i );
switch ( values[i].ToLower() ) {
case "s":
up.Type = UstPortamentoType.Linear;
@@ -115,7 +117,7 @@ namespace Boare.Lib.Vsq {
up.Type = UstPortamentoType.S;
break;
}
- Points[i] = up;
+ Points.set( i, up );
}
} else if ( line.StartsWith( "pbs=" ) ) {
diff --git a/trunk/Boare.Lib.Vsq/UstTrack.cs b/trunk/Boare.Lib.Vsq/UstTrack.cs
index 9e766e1..19307e3 100644
--- a/trunk/Boare.Lib.Vsq/UstTrack.cs
+++ b/trunk/Boare.Lib.Vsq/UstTrack.cs
@@ -14,34 +14,36 @@
using System;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq{
public class UstTrack : ICloneable {
public object Tag;
- private List m_events;
+ private Vector m_events;
public UstTrack(){
- m_events = new List();
+ m_events = new Vector();
}
public UstEvent getEvent( int index ) {
- return m_events[index];
+ return m_events.get( index );
}
public void setEvent( int index, UstEvent item ) {
- m_events[index] = item;
+ m_events.set( index, item );
}
public void addEvent( UstEvent item ) {
- m_events.Add( item );
+ m_events.add( item );
}
public void removeEvent( int index ) {
- m_events.RemoveAt( index );
+ m_events.removeElementAt( index );
}
public int getEventCount() {
- return m_events.Count;
+ return m_events.size();
}
public Iterator getNoteEventIterator() {
@@ -50,8 +52,8 @@ namespace Boare.Lib.Vsq{
public object Clone() {
UstTrack ret = new UstTrack();
- for ( int i = 0; i < m_events.Count; i++ ) {
- ret.m_events[i] = (UstEvent)m_events[i].Clone();
+ for ( int i = 0; i < m_events.size(); i++ ) {
+ ret.m_events.set( i, (UstEvent)m_events.get( i ).Clone() );
}
return ret;
}
diff --git a/trunk/Boare.Lib.Vsq/UstVibrato.cs b/trunk/Boare.Lib.Vsq/UstVibrato.cs
index 20bc327..f02a10f 100644
--- a/trunk/Boare.Lib.Vsq/UstVibrato.cs
+++ b/trunk/Boare.Lib.Vsq/UstVibrato.cs
@@ -13,6 +13,8 @@
*/
using System;
+using bocoree;
+
namespace Boare.Lib.Vsq {
[Serializable]
@@ -47,9 +49,9 @@ namespace Boare.Lib.Vsq {
public float Shift;
public float Unknown = 100;
- public UstVibrato( string line ) {
+ public UstVibrato( String line ) {
if ( line.ToLower().StartsWith( "vbr=" ) ) {
- string[] spl = line.Split( '=' );
+ String[] spl = line.Split( '=' );
spl = spl[1].Split( ',' );
//VBR=65,180,70,20.0,17.6,82.8,49.8,100
if ( spl.Length >= 8 ) {
@@ -68,7 +70,7 @@ namespace Boare.Lib.Vsq {
public UstVibrato() {
}
- public override string ToString() {
+ public override String ToString() {
return "VBR=" + Length + "," + Period + "," + Depth + "," + In + "," + Out + "," + Phase + "," + Shift + "," + Unknown;
}
diff --git a/trunk/Boare.Lib.Vsq/VibratoBPList.cs b/trunk/Boare.Lib.Vsq/VibratoBPList.cs
index 2264746..371bd9d 100644
--- a/trunk/Boare.Lib.Vsq/VibratoBPList.cs
+++ b/trunk/Boare.Lib.Vsq/VibratoBPList.cs
@@ -14,14 +14,16 @@
using System;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq {
[Serializable]
public class VibratoBPList : ICloneable {
- private List m_list;
+ private Vector m_list;
public VibratoBPList() {
- m_list = new List();
+ m_list = new Vector();
}
public VibratoBPList( float[] x, int[] y ){
@@ -32,20 +34,20 @@ namespace Boare.Lib.Vsq {
throw new ArgumentNullException( "y" );
}
int len = Math.Min( x.Length, y.Length );
- m_list = new List( len );
+ m_list = new Vector( len );
for ( int i = 0; i < len; i++ ) {
- m_list.Add( new VibratoBPPair( x[i], y[i] ) );
+ m_list.add( new VibratoBPPair( x[i], y[i] ) );
}
- m_list.Sort();
+ Collections.sort( m_list );
}
public int getValue( float x, int default_value ) {
- if ( m_list.Count <= 0 ) {
+ if ( m_list.size() <= 0 ) {
return default_value;
}
int index = -1;
- for ( int i = 0; i < m_list.Count; i++ ) {
- if ( x < m_list[i].X ) {
+ for ( int i = 0; i < m_list.size(); i++ ) {
+ if ( x < m_list.get( i ).X ) {
break;
}
index = i;
@@ -53,50 +55,50 @@ namespace Boare.Lib.Vsq {
if ( index == -1 ) {
return default_value;
} else {
- return m_list[index].Y;
+ return m_list.get( index ).Y;
}
}
public object Clone() {
VibratoBPList ret = new VibratoBPList();
- for ( int i = 0; i < m_list.Count; i++ ) {
- ret.m_list.Add( new VibratoBPPair( m_list[i].X, m_list[i].Y ) );
+ for ( int i = 0; i < m_list.size(); i++ ) {
+ ret.m_list.add( new VibratoBPPair( m_list.get( i ).X, m_list.get( i ).Y ) );
}
return ret;
}
public int getCount() {
- return m_list.Count;
+ return m_list.size();
}
public VibratoBPPair getElement( int index ) {
- return m_list[index];
+ return m_list.get( index );
}
public void setElement( int index, VibratoBPPair value ) {
- m_list[index] = value;
+ m_list.set( index, value );
}
///
/// XMLシリアライズ用
///
- public string Data {
+ public String Data {
get {
- string ret = "";
- for ( int i = 0; i < m_list.Count; i++ ) {
- ret += (i == 0 ? "" : ",") + m_list[i].X + "=" + m_list[i].Y;
+ String ret = "";
+ for ( int i = 0; i < m_list.size(); i++ ) {
+ ret += (i == 0 ? "" : ",") + m_list.get( i ).X + "=" + m_list.get( i ).Y;
}
return ret;
}
set {
- m_list.Clear();
- string[] spl = value.Split( ',' );
+ m_list.clear();
+ String[] spl = value.Split( ',' );
for ( int i = 0; i < spl.Length; i++ ) {
- string[] spl2 = spl[i].Split( '=' );
+ String[] spl2 = spl[i].Split( '=' );
if ( spl2.Length < 2 ) {
continue;
}
- m_list.Add( new VibratoBPPair( float.Parse( spl2[0] ), int.Parse( spl2[1] ) ) );
+ m_list.add( new VibratoBPPair( float.Parse( spl2[0] ), int.Parse( spl2[1] ) ) );
}
}
}
diff --git a/trunk/Boare.Lib.Vsq/VibratoConfig.cs b/trunk/Boare.Lib.Vsq/VibratoConfig.cs
index d1152e4..d2e4b15 100644
--- a/trunk/Boare.Lib.Vsq/VibratoConfig.cs
+++ b/trunk/Boare.Lib.Vsq/VibratoConfig.cs
@@ -14,6 +14,8 @@
using System;
using System.IO;
+using bocoree;
+
namespace Boare.Lib.Vsq {
public class VibratoConfig {
@@ -42,7 +44,7 @@ namespace Boare.Lib.Vsq {
if ( line.StartsWith( "[" ) ) {
current_entry = line;
continue;
- } else if ( line == "" || line.StartsWith( ";" ) ) {
+ } else if ( line.Equals( "" ) || line.StartsWith( ";" ) ) {
continue;
}
@@ -52,38 +54,38 @@ namespace Boare.Lib.Vsq {
}
spl[0] = spl[0].Trim();
spl[1] = spl[1].Trim();
- if ( current_entry == "[Common]" ) {
- if ( spl[0] == "Articulation" ) {
+ if ( current_entry.Equals( "[Common]" ) ) {
+ if ( spl[0].Equals( "Articulation" ) ) {
articulation = spl[1];
}
- } else if ( current_entry == "[Parameter]" ) {
- if ( spl[0] == "Length" ) {
+ } else if ( current_entry.Equals( "[Parameter]" ) ) {
+ if ( spl[0].Equals( "Length" ) ) {
try {
this.contents.Length = int.Parse( spl[1] );
} catch { }
- } else if ( spl[0] == "StartDepth" ) {
+ } else if ( spl[0].Equals( "StartDepth" ) ) {
try {
this.contents.StartDepth = int.Parse( spl[1] );
} catch { }
- } else if ( spl[0] == "DepthBPNum" ) {
+ } else if ( spl[0].Equals( "DepthBPNum" ) ) {
try {
depth_bpnum = int.Parse( spl[1] );
} catch { }
- } else if ( spl[0] == "DepthBPX" ) {
+ } else if ( spl[0].Equals( "DepthBPX" ) ) {
depth_bpx = spl[1];
- } else if ( spl[0] == "DepthBPY" ) {
+ } else if ( spl[0].Equals( "DepthBPY" ) ) {
depth_bpy = spl[1];
- } else if ( spl[0] == "StartRate" ) {
+ } else if ( spl[0].Equals( "StartRate" ) ) {
try {
this.contents.StartRate = int.Parse( spl[1] );
} catch { }
- } else if ( spl[0] == "RateBPNum" ) {
+ } else if ( spl[0].Equals( "RateBPNum" ) ) {
try {
rate_bpnum = int.Parse( spl[1] );
} catch { }
- } else if ( spl[0] == "RateBPX" ) {
+ } else if ( spl[0].Equals( "RateBPX" ) ) {
rate_bpx = spl[1];
- } else if ( spl[0] == "RateBPY" ) {
+ } else if ( spl[0].Equals( "RateBPY" ) ) {
rate_bpy = spl[1];
}
}
diff --git a/trunk/Boare.Lib.Vsq/VibratoType.cs b/trunk/Boare.Lib.Vsq/VibratoType.cs
index 925f7bb..bf1bbe2 100644
--- a/trunk/Boare.Lib.Vsq/VibratoType.cs
+++ b/trunk/Boare.Lib.Vsq/VibratoType.cs
@@ -13,6 +13,8 @@
*/
using System;
+using bocoree;
+
namespace Boare.Lib.Vsq {
///
@@ -94,7 +96,7 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static VibratoType getVibratoTypeFromIconID( string icon_id ) {
+ public static VibratoType getVibratoTypeFromIconID( String icon_id ) {
switch ( icon_id ) {
case "$04040001":
return VibratoType.NormalType1;
@@ -137,7 +139,7 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static string getIconIDFromVibratoType( VibratoType type ) {
+ public static String getIconIDFromVibratoType( VibratoType type ) {
switch ( type ) {
case VibratoType.NormalType1:
return "$04040001";
@@ -304,12 +306,12 @@ namespace Boare.Lib.Vsq {
///
///
///
- /// string str = VibratoTypeUtil.ToString( VibratoType.NormalType1 );
+ /// String str = VibratoTypeUtil.ToString( VibratoType.NormalType1 );
/// // str = "[Normal] Type 1"
///
///
///
- public static string ToString( VibratoType value ) {
+ public static String ToString( VibratoType value ) {
switch ( value ) {
case VibratoType.NormalType1:
return "[Normal] Type 1";
diff --git a/trunk/Boare.Lib.Vsq/VocaloSysUtil.cs b/trunk/Boare.Lib.Vsq/VocaloSysUtil.cs
index d151176..5f10f78 100644
--- a/trunk/Boare.Lib.Vsq/VocaloSysUtil.cs
+++ b/trunk/Boare.Lib.Vsq/VocaloSysUtil.cs
@@ -16,6 +16,8 @@ using System.IO;
using System.Collections.Generic;
using Microsoft.Win32;
+using bocoree;
+
namespace Boare.Lib.Vsq {
using boolean = Boolean;
@@ -25,47 +27,63 @@ namespace Boare.Lib.Vsq {
private static SingerConfigSys s_singer_config_sys2;
private static ExpressionConfigSys s_exp_config_sys1;
private static ExpressionConfigSys s_exp_config_sys2;
- private static String s_path_vsti1;
- private static String s_path_vsti2;
- private static String s_path_editor1;
- private static String s_path_editor2;
+ private static String s_path_vsti1 = "";
+ private static String s_path_vsti2 = "";
+ private static String s_path_editor1 = "";
+ private static String s_path_editor2 = "";
static VocaloSysUtil() {
- Vector dir1 = new Vector();
- RegistryKey key1 = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID", false );
- String header1 = "HKLM\\SOFTWARE\\VOCALOID";
- print( key1, header1, dir1 );
- key1.Close();
- String path_voicedb1;
- String path_expdb1;
- Vector installed_singers1 = new Vector();
- extract( dir1,
- header1,
- out s_path_vsti1,
- out path_voicedb1,
- out path_expdb1,
- out s_path_editor1,
- installed_singers1 );
- s_singer_config_sys1 = new SingerConfigSys( path_voicedb1, installed_singers1.ToArray() );
- s_exp_config_sys1 = new ExpressionConfigSys( path_expdb1 );
+ try {
+ Vector dir1 = new Vector();
+ RegistryKey key1 = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID", false );
+ String path_voicedb1 = "";
+ String path_expdb1 = "";
+ Vector installed_singers1 = new Vector();
+ if ( key1 != null ) {
+ String header1 = "HKLM\\SOFTWARE\\VOCALOID";
+ print( key1, header1, dir1 );
+ key1.Close();
+ extract( dir1,
+ header1,
+ out s_path_vsti1,
+ out path_voicedb1,
+ out path_expdb1,
+ out s_path_editor1,
+ installed_singers1 );
+ }
+ s_singer_config_sys1 = new SingerConfigSys( path_voicedb1, installed_singers1.toArray( new String[] { } ) );
+ s_exp_config_sys1 = new ExpressionConfigSys( path_expdb1 );
+ }catch( Exception ex ){
+ Console.WriteLine( "VocaloSysUtil..cctor; ex=" + ex );
+ s_singer_config_sys1 = new SingerConfigSys( "", new String[] { } );
+ s_exp_config_sys1 = new ExpressionConfigSys( "" );
+ }
- Vector dir2 = new Vector();
- RegistryKey key2 = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID2", false );
- String header2 = "HKLM\\SOFTWARE\\VOCALOID2";
- print( key2, header2 , dir2 );
- key2.Close();
- String path_voicedb2;
- String path_expdb2;
- Vector installed_singers2 = new Vector();
- extract( dir2,
- header2,
- out s_path_vsti2,
- out path_voicedb2,
- out path_expdb2,
- out s_path_editor2,
- installed_singers2 );
- s_singer_config_sys2 = new SingerConfigSys( path_voicedb2, installed_singers2.ToArray() );
- s_exp_config_sys2 = new ExpressionConfigSys( path_expdb2 );
+ try{
+ Vector dir2 = new Vector();
+ RegistryKey key2 = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID2", false );
+ String path_voicedb2 = "";
+ String path_expdb2 = "";
+ Vector installed_singers2 = new Vector();
+ if ( key2 != null ) {
+ String header2 = "HKLM\\SOFTWARE\\VOCALOID2";
+ print( key2, header2, dir2 );
+ key2.Close();
+ extract( dir2,
+ header2,
+ out s_path_vsti2,
+ out path_voicedb2,
+ out path_expdb2,
+ out s_path_editor2,
+ installed_singers2 );
+ }
+ s_singer_config_sys2 = new SingerConfigSys( path_voicedb2, installed_singers2.toArray( new String[] { } ) );
+ s_exp_config_sys2 = new ExpressionConfigSys( path_expdb2 );
+ } catch ( Exception ex ) {
+ Console.WriteLine( "VocaloSysUtil..cctor; ex=" + ex );
+ s_singer_config_sys2 = new SingerConfigSys( "", new String[] { } );
+ s_exp_config_sys2 = new ExpressionConfigSys( "" );
+ }
}
private static void extract( Vector dir,
@@ -82,18 +100,20 @@ namespace Boare.Lib.Vsq {
path_expdb = "";
path_voicedb = "";
path_editor = "";
- foreach ( String s in dir ) {
+ for( Iterator itr = dir.iterator(); itr.hasNext(); ) {
+ String s = (String)itr.next();
if ( s.StartsWith( header + "\\APPLICATION" ) ) {
- application.Add( s.Substring( (header + "\\APPLICATION").Length ) );
+ application.add( s.Substring( (header + "\\APPLICATION").Length ) );
} else if ( s.StartsWith( header + "\\DATABASE\\EXPRESSION" ) ) {
- expression.Add( s.Substring( (header + "\\DATABASE\\EXPRESSION").Length ) );
+ expression.add( s.Substring( (header + "\\DATABASE\\EXPRESSION").Length ) );
} else if ( s.StartsWith( header + "\\DATABASE\\VOICE" ) ) {
- voice.Add( s.Substring( (header + "\\DATABASE\\VOICE\\").Length ) );
+ voice.add( s.Substring( (header + "\\DATABASE\\VOICE\\").Length ) );
}
}
// path_vstiを取得
- foreach ( String s in application ) {
+ for( Iterator itr = application.iterator(); itr.hasNext(); ){
+ String s = (String)itr.next();
String[] spl = s.Split( '\t' );
if ( spl.Length >= 3 && spl[1].Equals( "PATH" ) ){
if ( spl[2].ToLower().EndsWith( ".dll" ) ) {
@@ -107,7 +127,8 @@ namespace Boare.Lib.Vsq {
// path_vicedbを取得
Vector voice_ids = new Vector();
// 最初はpath_voicedbの取得と、id(BHXXXXXXXXXXXXXXXX)のようなシリアルを取得
- foreach ( String s in voice ) {
+ for( Iterator itr = voice.iterator(); itr.hasNext(); ){
+ String s = (String)itr.next();
String[] spl = s.Split( '\t' );
if ( spl.Length >= 2 ) {
if ( spl[0].Equals( "VOICEDIR" ) ) {
@@ -115,17 +136,19 @@ namespace Boare.Lib.Vsq {
} else if ( spl.Length >= 3 ) {
String[] spl2 = spl[0].Split( '\\' );
if ( spl2.Length == 1 ) {
- if ( !voice_ids.Contains( spl2[0] ) ) {
- voice_ids.Add( spl2[0] );
+ if ( !voice_ids.contains( spl2[0] ) ) {
+ voice_ids.add( spl2[0] );
}
}
}
}
}
// 取得したシリアルを元に、installed_singersを取得
- foreach ( String s in voice_ids ) {
+ for( Iterator itr = voice_ids.iterator(); itr.hasNext(); ) {
+ String s = (String)itr.next();
String install_dir = "";
- foreach ( String s2 in voice ) {
+ for( Iterator itr2 = voice.iterator(); itr2.hasNext(); ){
+ String s2 = (String)itr2.next();
if ( s2.StartsWith( header + "\\" + s + "\t" ) ) {
String[] spl = s2.Split( '\t' );
if ( spl.Length >= 3 && spl[1].Equals( "INSTALLDIR" ) ) {
@@ -137,13 +160,14 @@ namespace Boare.Lib.Vsq {
if ( install_dir.Equals( "" ) ) {
install_dir = Path.Combine( path_voicedb, s );
}
- installed_singers.Add( install_dir );
+ installed_singers.add( install_dir );
}
// path_expdbを取得
Vector exp_ids = new Vector();
// 最初はpath_expdbの取得と、id(BHXXXXXXXXXXXXXXXX)のようなシリアルを取得
- foreach ( String s in expression ) {
+ for( Iterator itr = expression.iterator(); itr.hasNext(); ){
+ String s = (String)itr.next();
String[] spl = s.Split( '\t' );
if ( spl.Length >= 2 ) {
if ( spl[0].Equals( "EXPRESSIONDIR" ) ) {
@@ -151,8 +175,8 @@ namespace Boare.Lib.Vsq {
} else if ( spl.Length >= 3 ) {
String[] spl2 = spl[0].Split( '\\' );
if ( spl2.Length == 1 ) {
- if ( !exp_ids.Contains( spl2[0] ) ) {
- exp_ids.Add( spl2[0] );
+ if ( !exp_ids.contains( spl2[0] ) ) {
+ exp_ids.add( spl2[0] );
}
}
}
@@ -181,7 +205,8 @@ namespace Boare.Lib.Vsq {
Console.WriteLine( "path_voicedb=" + path_voicedb );
Console.WriteLine( "path_expdb=" + path_expdb );
Console.WriteLine( "installed_singers=" );
- foreach ( String s in installed_singers ) {
+ for( Iterator itr = installed_singers.iterator(); itr.hasNext(); ){
+ String s = (String)itr.next();
Console.WriteLine( " " + s );
}
#endif
@@ -189,6 +214,10 @@ namespace Boare.Lib.Vsq {
// レジストリkey内の値を再帰的に検索し、ファイルfpに順次出力する
private static void print( RegistryKey key, String parent_name, Vector list ){
+ if ( key == null ) {
+ return;
+ }
+
// 直下のキー内を再帰的にリストアップ
String[] subkeys = key.GetSubKeyNames();
foreach( String s in subkeys ){
@@ -202,8 +231,8 @@ namespace Boare.Lib.Vsq {
foreach( String s in valuenames ){
RegistryValueKind kind = key.GetValueKind( s );
if ( kind == RegistryValueKind.String ){
- String str = parent_name + "\t" + s + "\t" + (String)key.GetValue( s );
- list.Add( str );
+ String str = parent_name + "\t" + s + "\t" + (String)key.GetValue( s, "" );
+ list.add( str );
}
}
}
@@ -214,7 +243,7 @@ namespace Boare.Lib.Vsq {
///
///
public static String getOriginalSinger1( String singer ) {
- string voiceidstr = "";
+ String voiceidstr = "";
SingerConfig[] singer_configs = s_singer_config_sys1.getSingerConfigs();
for ( int i = 0; i < singer_configs.Length; i++ ) {
if ( singer.Equals( singer_configs[i].VOICENAME ) ) {
@@ -240,7 +269,7 @@ namespace Boare.Lib.Vsq {
///
///
public static String getOriginalSinger2( String singer ) {
- string voiceidstr = "";
+ String voiceidstr = "";
SingerConfig[] singer_configs = s_singer_config_sys2.getSingerConfigs();
for ( int i = 0; i < singer_configs.Length; i++ ) {
if ( singer.Equals( singer_configs[i].VOICENAME ) ) {
@@ -297,7 +326,7 @@ namespace Boare.Lib.Vsq {
///
/// name of singer
///
- public static VsqVoiceLanguage getLanguageFromName( string name ) {
+ public static VsqVoiceLanguage getLanguageFromName( String name ) {
switch ( name.ToLower() ) {
case "meiko":
case "kaito":
@@ -342,19 +371,19 @@ namespace Boare.Lib.Vsq {
}
public static class VocaloSysUtil_ {
- private static bool s_initialized = false;
+ private static boolean s_initialized = false;
- private static string s_dll_path2 = "";
- private static string s_editor_path2 = "";
- private static string s_voicedbdir2 = "";
- private static List s_installed_singers2 = new List();
- private static List s_singer_configs2 = new List();
+ private static String s_dll_path2 = "";
+ private static String s_editor_path2 = "";
+ private static String s_voicedbdir2 = "";
+ private static Vector s_installed_singers2 = new Vector();
+ private static Vector s_singer_configs2 = new Vector();
- private static string s_dll_path1 = "";
- private static string s_editor_path1 = "";
- private static string s_voicedbdir1 = "";
- private static List s_installed_singers1 = new List();
- private static List s_singer_configs1 = new List();
+ private static String s_dll_path1 = "";
+ private static String s_editor_path1 = "";
+ private static String s_voicedbdir1 = "";
+ private static Vector s_installed_singers1 = new Vector();
+ private static Vector s_singer_configs1 = new Vector();
private const int MAX_SINGERS = 0x4000;
@@ -368,19 +397,19 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static string getOriginalSinger1( string singer ) {
- string voiceidstr = "";
- for ( int i = 0; i < s_singer_configs1.Count; i++ ) {
- if ( singer == s_singer_configs1[i].VOICENAME ) {
- voiceidstr = s_singer_configs1[i].VOICEIDSTR;
+ public static String getOriginalSinger1( String singer ) {
+ String voiceidstr = "";
+ for ( int i = 0; i < s_singer_configs1.size(); i++ ) {
+ if ( singer.Equals( s_singer_configs1.get( i ).VOICENAME ) ) {
+ voiceidstr = s_singer_configs1.get( i ).VOICEIDSTR;
}
}
- if ( voiceidstr == "" ) {
+ if ( voiceidstr.Equals( "" ) ) {
return "";
}
- for ( int i = 0; i < s_installed_singers1.Count; i++ ) {
- if ( voiceidstr == s_installed_singers1[i].VOICEIDSTR ) {
- return s_installed_singers1[i].VOICENAME;
+ for ( int i = 0; i < s_installed_singers1.size(); i++ ) {
+ if ( voiceidstr.Equals( s_installed_singers1.get( i ).VOICEIDSTR ) ) {
+ return s_installed_singers1.get( i ).VOICENAME;
}
}
return "";
@@ -391,19 +420,19 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static string getOriginalSinger2( string singer ) {
- string voiceidstr = "";
- for ( int i = 0; i < s_singer_configs2.Count; i++ ) {
- if ( singer == s_singer_configs2[i].VOICENAME ) {
- voiceidstr = s_singer_configs2[i].VOICEIDSTR;
+ public static String getOriginalSinger2( String singer ) {
+ String voiceidstr = "";
+ for ( int i = 0; i < s_singer_configs2.size(); i++ ) {
+ if ( singer.Equals( s_singer_configs2.get( i ).VOICENAME ) ) {
+ voiceidstr = s_singer_configs2.get( i ).VOICEIDSTR;
}
}
- if ( voiceidstr == "" ) {
+ if ( voiceidstr.Equals( "" ) ) {
return "";
}
- for ( int i = 0; i < s_installed_singers2.Count; i++ ) {
- if ( voiceidstr == s_installed_singers2[i].VOICEIDSTR ) {
- return s_installed_singers2[i].VOICENAME;
+ for ( int i = 0; i < s_installed_singers2.size(); i++ ) {
+ if ( voiceidstr.Equals( s_installed_singers2.get( i ).VOICEIDSTR ) ) {
+ return s_installed_singers2.get( i ).VOICENAME;
}
}
return "";
@@ -414,7 +443,7 @@ namespace Boare.Lib.Vsq {
///
/// name of singer
///
- public static VsqVoiceLanguage getLanguageFromName( string name ) {
+ public static VsqVoiceLanguage getLanguageFromName( String name ) {
switch ( name ) {
case "MEIKO":
case "KAITO":
@@ -435,13 +464,13 @@ namespace Boare.Lib.Vsq {
return VsqVoiceLanguage.Default;
}
- public static VsqID getSingerID1( string singer_name ) {
+ public static VsqID getSingerID1( String singer_name ) {
VsqID ret = new VsqID( 0 );
ret.type = VsqIDType.Singer;
SingerConfig sc = null;
- for ( int i = 0; i < s_singer_configs1.Count; i++ ) {
- if ( s_singer_configs1[i].VOICENAME == singer_name ) {
- sc = s_singer_configs1[i];
+ for ( int i = 0; i < s_singer_configs1.size(); i++ ) {
+ if ( s_singer_configs1.get( i ).VOICENAME.Equals( singer_name ) ) {
+ sc = s_singer_configs1.get( i );
break;
}
}
@@ -449,8 +478,9 @@ namespace Boare.Lib.Vsq {
sc = new SingerConfig();
}
int lang = 0;
- foreach ( SingerConfig sc2 in s_installed_singers1 ) {
- if ( sc.VOICEIDSTR == sc2.VOICEIDSTR ) {
+ for ( Iterator itr = s_installed_singers1.iterator(); itr.hasNext(); ){
+ SingerConfig sc2 = (SingerConfig)itr.next();
+ if ( sc.VOICEIDSTR.Equals( sc2.VOICEIDSTR ) ) {
lang = (int)getLanguageFromName( sc.VOICENAME );
break;
}
@@ -467,13 +497,13 @@ namespace Boare.Lib.Vsq {
return ret;
}
- public static VsqID getSingerID2( string singer_name ) {
+ public static VsqID getSingerID2( String singer_name ) {
VsqID ret = new VsqID( 0 );
ret.type = VsqIDType.Singer;
SingerConfig sc = null;
- for ( int i = 0; i < s_singer_configs2.Count; i++ ) {
- if ( s_singer_configs2[i].VOICENAME == singer_name ) {
- sc = s_singer_configs2[i];
+ for ( int i = 0; i < s_singer_configs2.size(); i++ ) {
+ if ( s_singer_configs2.get( i ).VOICENAME.Equals( singer_name ) ) {
+ sc = s_singer_configs2.get( i );
break;
}
}
@@ -481,8 +511,9 @@ namespace Boare.Lib.Vsq {
sc = new SingerConfig();
}
int lang = 0;
- foreach ( SingerConfig sc2 in s_installed_singers2 ) {
- if ( sc.VOICEIDSTR == sc2.VOICEIDSTR ) {
+ for ( Iterator itr = s_installed_singers2.iterator(); itr.hasNext(); ){
+ SingerConfig sc2 = (SingerConfig)itr.next();
+ if ( sc.VOICEIDSTR.Equals( sc2.VOICEIDSTR ) ) {
lang = (int)getLanguageFromName( sc.VOICENAME );
break;
}
@@ -500,11 +531,11 @@ namespace Boare.Lib.Vsq {
}
public static SingerConfig[] getSingerConfigs1() {
- return s_singer_configs1.ToArray();
+ return s_singer_configs1.toArray( new SingerConfig[]{} );
}
public static SingerConfig[] getSingerConfigs2() {
- return s_singer_configs2.ToArray();
+ return s_singer_configs2.toArray( new SingerConfig[]{} );
}
public static double getAmplifyCoeffFromPanLeft( int pan ) {
@@ -519,19 +550,19 @@ namespace Boare.Lib.Vsq {
return Math.Exp( -1.26697245e-02 + 1.18448420e-01 * feder / 10.0 );
}
- public static string getEditorPath2() {
+ public static String getEditorPath2() {
return s_editor_path2;
}
- public static string getEditorPath1() {
+ public static String getEditorPath1() {
return s_editor_path1;
}
- public static string getDllPathVsti2() {
+ public static String getDllPathVsti2() {
return s_dll_path2;
}
- public static string getDllPathVsti1() {
+ public static String getDllPathVsti1() {
return s_dll_path1;
}
@@ -543,11 +574,11 @@ namespace Boare.Lib.Vsq {
RegistryKey v1application = null;
v1application = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID\\APPLICATION", false );
if ( v1application != null ) {
- string[] keys = v1application.GetSubKeyNames();
+ String[] keys = v1application.GetSubKeyNames();
for ( int i = 0; i < keys.Length; i++ ) {
RegistryKey key = v1application.OpenSubKey( keys[i], false );
if ( key != null ) {
- string name = (string)key.GetValue( "PATH" );
+ String name = (String)key.GetValue( "PATH" );
if ( name.ToLower().EndsWith( "\\vocaloid.dll" ) ) {
s_dll_path1 = name;
} else if ( name.ToLower().EndsWith( "\\vocaloid.exe" ) ) {
@@ -562,40 +593,40 @@ namespace Boare.Lib.Vsq {
// voicedbdir for vocaloid1
RegistryKey v1database = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID\\DATABASE\\VOICE", false );
if ( v1database != null ) {
- s_voicedbdir1 = (string)v1database.GetValue( "VOICEDIR", "" );
+ s_voicedbdir1 = (String)v1database.GetValue( "VOICEDIR", "" );
#if DEBUG
Console.WriteLine( "s_voicedbdir1=" + s_voicedbdir1 );
#endif
// インストールされている歌手のVOICEIDSTRを列挙
- string[] singer_voiceidstrs = v1database.GetSubKeyNames();
- List vvoice_keys = new List();
- List vvoice_values = new List();
- foreach ( string voiceidstr in singer_voiceidstrs ) {
+ String[] singer_voiceidstrs = v1database.GetSubKeyNames();
+ Vector vvoice_keys = new Vector();
+ Vector vvoice_values = new Vector();
+ foreach ( String voiceidstr in singer_voiceidstrs ) {
RegistryKey singer = v1database.OpenSubKey( voiceidstr );
if ( singer == null ) {
continue;
}
RegistryKey vvoice = singer.OpenSubKey( "vvoice" );
if ( vvoice != null ) {
- string[] vvoices = vvoice.GetValueNames();
+ String[] vvoices = vvoice.GetValueNames();
// インストールされた歌手の.vvdを読みにいく
// installdir以下の、拡張子.vvdのファイルを探す
- foreach ( string file in Directory.GetFiles( Path.Combine( s_voicedbdir1, voiceidstr ), "*.vvd" ) ) {
+ foreach ( String file in Directory.GetFiles( Path.Combine( s_voicedbdir1, voiceidstr ), "*.vvd" ) ) {
SingerConfig config = SingerConfig.fromVvd( file, 0 ); //とりあえずプログラムチェンジは0
- s_installed_singers1.Add( config );
+ s_installed_singers1.add( config );
}
// vvoice*.vvdを読みにいく。
- foreach ( string s in vvoices ) {
+ foreach ( String s in vvoices ) {
#if DEBUG
Console.WriteLine( "s=" + s );
#endif
- string file = Path.Combine( s_voicedbdir1, s + ".vvd" );
+ String file = Path.Combine( s_voicedbdir1, s + ".vvd" );
if ( File.Exists( file ) ) {
SingerConfig config = SingerConfig.fromVvd( file, 0 );
- vvoice_keys.Add( s );
- vvoice_values.Add( config );
+ vvoice_keys.add( s );
+ vvoice_values.add( config );
}
}
}
@@ -603,7 +634,7 @@ namespace Boare.Lib.Vsq {
}
// voice.mapを読み込んで、s_singer_configs1のプログラムチェンジを更新する
- string map = Path.Combine( s_voicedbdir1, "voice.map" );
+ String map = Path.Combine( s_voicedbdir1, "voice.map" );
if ( File.Exists( map ) ) {
using ( FileStream fs = new FileStream( map, FileMode.Open, FileAccess.Read ) ) {
byte[] dat = new byte[8];
@@ -615,9 +646,9 @@ namespace Boare.Lib.Vsq {
#if DEBUG
Console.WriteLine( "value=" + value );
#endif
- for ( int j = 0; j < vvoice_keys.Count; j++ ) {
- if ( vvoice_keys[j] == "vvoice" + value ) {
- vvoice_values[j].Program = i;
+ for ( int j = 0; j < vvoice_keys.size(); j++ ) {
+ if ( vvoice_keys.get( j ).Equals( "vvoice" + value ) ) {
+ vvoice_values.get( j ).Program = i;
}
}
}
@@ -626,30 +657,32 @@ namespace Boare.Lib.Vsq {
}
// s_installed_singers1のSingerConfigのProgramとOriginalを適当に頒番する
- for ( int i = 0; i < s_installed_singers1.Count; i++ ) {
- s_installed_singers1[i].Program = i;
- s_installed_singers1[i].Original = i;
+ for ( int i = 0; i < s_installed_singers1.size(); i++ ) {
+ s_installed_singers1.get( i ).Program = i;
+ s_installed_singers1.get( i ).Original = i;
}
// s_singer_configs1を更新
- for ( int i = 0; i < vvoice_values.Count; i++ ) {
- for ( int j = 0; j < s_installed_singers1.Count; j++ ) {
- if ( vvoice_values[i].VOICEIDSTR == s_installed_singers1[j].VOICEIDSTR ) {
- vvoice_values[i].Original = s_installed_singers1[j].Program;
+ for ( int i = 0; i < vvoice_values.size(); i++ ) {
+ for ( int j = 0; j < s_installed_singers1.size(); j++ ) {
+ if ( vvoice_values.get( i ).VOICEIDSTR.Equals( s_installed_singers1.get( j ).VOICEIDSTR ) ) {
+ vvoice_values.get( i ).Original = s_installed_singers1.get( j ).Program;
break;
}
}
- s_singer_configs1.Add( vvoice_values[i] );
+ s_singer_configs1.add( vvoice_values.get( i ) );
}
v1database.Close();
}
#if DEBUG
Console.WriteLine( "installed" );
- foreach ( SingerConfig sc in s_installed_singers1 ) {
+ for ( Iterator itr = s_installed_singers1.iterator(); itr.hasNext(); ){
+ SingerConfig sc = (SingerConfig)itr.next();
Console.WriteLine( "VOICENAME=" + sc.VOICENAME + "; VOICEIDSTR=" + sc.VOICEIDSTR + "; Program=" + sc.Program + "; Original=" + sc.Original );
}
Console.WriteLine( "singer configs" );
- foreach ( SingerConfig sc in s_singer_configs1 ) {
+ for ( Iterator itr = s_singer_configs1.iterator(); itr.hasNext(); ){
+ SingerConfig sc = (SingerConfig)itr.next();
Console.WriteLine( "VOICENAME=" + sc.VOICENAME + "; VOICEIDSTR=" + sc.VOICEIDSTR + "; Program=" + sc.Program + "; Original=" + sc.Original );
}
#endif
@@ -665,11 +698,11 @@ namespace Boare.Lib.Vsq {
v2application = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID2_DEMO\\APPLICATION", false );
}
if ( v2application != null ) {
- string[] keys = v2application.GetSubKeyNames();
+ String[] keys = v2application.GetSubKeyNames();
for ( int i = 0; i < keys.Length; i++ ) {
RegistryKey key = v2application.OpenSubKey( keys[i], false );
if ( key != null ) {
- string name = (string)key.GetValue( "PATH" );
+ String name = (String)key.GetValue( "PATH" );
if ( name.ToLower().EndsWith( "\\vocaloid2.dll" ) ) {
s_dll_path2 = name;
} else if ( name.ToLower().EndsWith( "\\vocaloid2_demo.dll" ) ) {
@@ -687,38 +720,38 @@ namespace Boare.Lib.Vsq {
RegistryKey v2database = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID2\\DATABASE\\VOICE", false );
if ( v2database != null ) {
// データベース(というよりもvoice.map)が保存されているパスを取得
- s_voicedbdir2 = (string)v2database.GetValue( "VOICEDIR", "" );
+ s_voicedbdir2 = (String)v2database.GetValue( "VOICEDIR", "" );
// インストールされている歌手のVOICEIDSTRを列挙
- string[] singer_voiceidstrs = v2database.GetSubKeyNames();
- List vvoice_keys = new List();
- List vvoice_values = new List();
- foreach ( string voiceidstr in singer_voiceidstrs ) {
+ String[] singer_voiceidstrs = v2database.GetSubKeyNames();
+ Vector vvoice_keys = new Vector();
+ Vector vvoice_values = new Vector();
+ foreach ( String voiceidstr in singer_voiceidstrs ) {
RegistryKey singer = v2database.OpenSubKey( voiceidstr );
if ( singer == null ) {
continue;
}
- string installdir = (string)singer.GetValue( "INSTALLDIR", "" );
+ String installdir = (String)singer.GetValue( "INSTALLDIR", "" );
#if DEBUG
Console.WriteLine( "installdir=" + installdir );
#endif
RegistryKey vvoice = singer.OpenSubKey( "vvoice" );
if ( vvoice != null ) {
- string[] vvoices = vvoice.GetValueNames();
+ String[] vvoices = vvoice.GetValueNames();
// インストールされた歌手の.vvdを読みにいく
// installdir以下の、拡張子.vvdのファイルを探す
- foreach ( string file in Directory.GetFiles( Path.Combine( installdir, voiceidstr ), "*.vvd" ) ) {
+ foreach ( String file in Directory.GetFiles( Path.Combine( installdir, voiceidstr ), "*.vvd" ) ) {
SingerConfig config = SingerConfig.fromVvd( file, 0 ); //とりあえずプログラムチェンジは0
- s_installed_singers2.Add( config );
+ s_installed_singers2.add( config );
}
// vvoice*.vvdを読みにいく。場所は、installdirではなく、s_voicedbdir2
- foreach ( string s in vvoices ) {
- string file = Path.Combine( s_voicedbdir2, s + ".vvd" );
+ foreach ( String s in vvoices ) {
+ String file = Path.Combine( s_voicedbdir2, s + ".vvd" );
if ( File.Exists( file ) ) {
SingerConfig config = SingerConfig.fromVvd( file, 0 );
- vvoice_keys.Add( s );
- vvoice_values.Add( config );
+ vvoice_keys.add( s );
+ vvoice_values.add( config );
}
}
}
@@ -726,7 +759,7 @@ namespace Boare.Lib.Vsq {
}
// voice.mapを読み込んで、s_singer_configs2のプログラムチェンジを更新する
- string map = Path.Combine( s_voicedbdir2, "voice.map" );
+ String map = Path.Combine( s_voicedbdir2, "voice.map" );
if ( File.Exists( map ) ) {
using ( FileStream fs = new FileStream( map, FileMode.Open, FileAccess.Read ) ) {
byte[] dat = new byte[8];
@@ -738,9 +771,9 @@ namespace Boare.Lib.Vsq {
#if DEBUG
Console.WriteLine( "value=" + value );
#endif
- for ( int j = 0; j < vvoice_keys.Count; j++ ) {
- if ( vvoice_keys[j] == "vvoice" + value ) {
- vvoice_values[j].Program = i;
+ for ( int j = 0; j < vvoice_keys.size(); j++ ) {
+ if ( vvoice_keys.get( j ).Equals( "vvoice" + value ) ) {
+ vvoice_values.get( j ).Program = i;
}
}
}
@@ -749,30 +782,32 @@ namespace Boare.Lib.Vsq {
}
// s_installed_singers2のSingerConfigのProgramとOriginalを適当に頒番する
- for ( int i = 0; i < s_installed_singers2.Count; i++ ) {
- s_installed_singers2[i].Program = i;
- s_installed_singers2[i].Original = i;
+ for ( int i = 0; i < s_installed_singers2.size(); i++ ) {
+ s_installed_singers2.get( i ).Program = i;
+ s_installed_singers2.get( i ).Original = i;
}
// s_singer_configs2を更新
- for ( int i = 0; i < vvoice_values.Count; i++ ) {
- for ( int j = 0; j < s_installed_singers2.Count; j++ ) {
- if ( vvoice_values[i].VOICEIDSTR == s_installed_singers2[j].VOICEIDSTR ) {
- vvoice_values[i].Original = s_installed_singers2[j].Program;
+ for ( int i = 0; i < vvoice_values.size(); i++ ) {
+ for ( int j = 0; j < s_installed_singers2.size(); j++ ) {
+ if ( vvoice_values.get( i ).VOICEIDSTR.Equals( s_installed_singers2.get( j ).VOICEIDSTR ) ) {
+ vvoice_values.get( i ).Original = s_installed_singers2.get( j ).Program;
break;
}
}
- s_singer_configs2.Add( vvoice_values[i] );
+ s_singer_configs2.add( vvoice_values.get( i ) );
}
v2database.Close();
}
#if DEBUG
Console.WriteLine( "installed" );
- foreach ( SingerConfig sc in s_installed_singers2 ) {
+ for ( Iterator itr = s_installed_singers2.iterator(); itr.hasNext(); ){
+ SingerConfig sc = (SingerConfig)itr.next();
Console.WriteLine( "VOICENAME=" + sc.VOICENAME + "; VOICEIDSTR=" + sc.VOICEIDSTR + "; Program=" + sc.Program + "; Original=" + sc.Original );
}
Console.WriteLine( "singer configs" );
- foreach ( SingerConfig sc in s_singer_configs2 ) {
+ for ( Iterator itr = s_singer_configs2.iterator(); itr.hasNext(); ){
+ SingerConfig sc = (SingerConfig)itr.next();
Console.WriteLine( "VOICENAME=" + sc.VOICENAME + "; VOICEIDSTR=" + sc.VOICEIDSTR + "; Program=" + sc.Program + "; Original=" + sc.Original );
}
#endif
diff --git a/trunk/Boare.Lib.Vsq/VsqBPList.cs b/trunk/Boare.Lib.Vsq/VsqBPList.cs
index b0f1df8..3a85226 100644
--- a/trunk/Boare.Lib.Vsq/VsqBPList.cs
+++ b/trunk/Boare.Lib.Vsq/VsqBPList.cs
@@ -16,17 +16,21 @@ using System.Collections.Generic;
using System.Text;
using System.IO;
+using bocoree;
+
namespace Boare.Lib.Vsq {
+ using boolean = System.Boolean;
+
///
/// BPListのデータ部分を取り扱うためのクラス。
///
[Serializable]
public class VsqBPList : ICloneable {
private SortedList m_list = new SortedList();
- public int Default = 0;
- public int Maximum = 127;
- public int Minimum = 0;
+ private int m_default = 0;
+ private int m_maximum = 127;
+ private int m_minimum = 0;
///
/// このリストに設定されたidの最大値.次にデータ点が追加されたときは,個の値+1がidとして利用される.削除された場合でも減らない
///
@@ -41,7 +45,7 @@ namespace Boare.Lib.Vsq {
m_pos = -1;
}
- public bool hasNext() {
+ public boolean hasNext() {
if ( m_pos + 1 < m_list.Keys.Count ) {
return true;
} else {
@@ -66,12 +70,45 @@ namespace Boare.Lib.Vsq {
: this( 0, 0, 64 ) {
}
+ public int Default {
+ get {
+ return getDefault();
+ }
+ set {
+ setDefault( value );
+ }
+ }
+
+ ///
+ /// このBPListのデフォルト値を取得します
+ ///
+ public int getDefault() {
+ return m_default;
+ }
+
+ public void setDefault( int value ) {
+ m_default = value;
+ }
+
+ ///
+ /// データ点のIDを一度クリアし,新たに番号付けを行います.
+ /// IDは,Redo,Undo用コマンドが使用するため,このメソッドを呼ぶとRedo,Undo操作が破綻する.XMLからのデシリアライズ直後のみ使用するべき.
+ ///
+ public void renumberIDs() {
+ m_max_id = 0;
+ for ( Iterator itr = keyClockIterator(); itr.hasNext(); ) {
+ VsqBPPair item = (VsqBPPair)itr.next();
+ m_max_id++;
+ item.id = m_max_id;
+ }
+ }
+
///
/// XMLシリアライズ用
///
- public string Data {
+ public String Data {
get {
- string ret = "";
+ String ret = "";
int count = -1;
foreach ( int key in m_list.Keys ) {
count++;
@@ -82,9 +119,9 @@ namespace Boare.Lib.Vsq {
set {
m_list.Clear();
m_max_id = 0;
- string[] spl = value.Split( ',' );
+ String[] spl = value.Split( ',' );
for ( int i = 0; i < spl.Length; i++ ) {
- string[] spl2 = spl[i].Split( '=' );
+ String[] spl2 = spl[i].Split( '=' );
if ( spl2.Length < 2 ) {
continue;
}
@@ -105,37 +142,68 @@ namespace Boare.Lib.Vsq {
/// このVsqBPListの同一コピーを作成します
///
///
- public object Clone() {
- VsqBPList res = new VsqBPList( Default, Minimum, Maximum );
+ public Object clone() {
+ VsqBPList res = new VsqBPList( getDefault(), getMinimum(), getMaximum() );
foreach ( int key in m_list.Keys ) {
res.m_list.Add( key, m_list[key] );
}
+ res.m_max_id = m_max_id;
return res;
}
+ public object Clone() {
+ return clone();
+ }
+
///
/// コンストラクタ。デフォルト値はココで指定する。
///
///
public VsqBPList( int default_value, int minimum, int maximum ) {
- Default = default_value;
- Maximum = maximum;
- Minimum = minimum;
+ m_default = default_value;
+ m_maximum = maximum;
+ m_minimum = minimum;
m_max_id = 0;
}
+ public int Maximum {
+ get {
+ return getMaximum();
+ }
+ set {
+ setMaximum( value );
+ }
+ }
+
///
/// このリストに設定された最大値を取得します。
///
public int getMaximum() {
- return Maximum;
+ return m_maximum;
+ }
+
+ public void setMaximum( int value ){
+ m_maximum = value;
+ }
+
+ public int Minimum {
+ get {
+ return getMinimum();
+ }
+ set {
+ setMinimum( value );
+ }
}
///
/// このリストに設定された最小値を取得します
///
public int getMinimum() {
- return Minimum;
+ return m_minimum;
+ }
+
+ public void setMinimum( int value ) {
+ m_minimum = value;
}
public Iterator keyClockIterator() {
@@ -148,20 +216,40 @@ namespace Boare.Lib.Vsq {
}
}
- public bool isContainsKey( int clock ) {
+ public boolean isContainsKey( int clock ) {
return m_list.ContainsKey( clock );
}
- public int getCount() {
+ public int size() {
return m_list.Count;
}
public int[] getKeys() {
- List t = new List();
+ Vector t = new Vector();
foreach( int key in m_list.Keys ){
- t.Add( key );
+ t.add( key );
}
- return t.ToArray();
+ return t.toArray( new Int32[]{} );
+ }
+
+ ///
+ /// 時刻clockのデータを時刻new_clockに移動します。
+ /// 時刻clockにデータがなければ何もしない。
+ /// 時刻new_clockに既にデータがある場合、既存のデータは削除される。
+ ///
+ ///
+ ///
+ public void move( int clock, int new_clock, int new_value ) {
+ if ( !m_list.ContainsKey( clock ) ) {
+ return;
+ }
+ VsqBPPair item = m_list[clock];
+ m_list.Remove( clock );
+ if ( m_list.ContainsKey( new_clock ) ) {
+ m_list.Remove( new_clock );
+ }
+ item.value = new_value;
+ m_list.Add( new_clock, item );
}
public void clear() {
@@ -170,42 +258,81 @@ namespace Boare.Lib.Vsq {
///
/// 新しいデータ点を追加します。
+ /// 戻り値に、新しいデータ点のIDを返します
///
///
///
- public void add( int clock, int value ) {
+ ///
+ public long add( int clock, int value ) {
lock ( m_list ) {
if ( m_list.ContainsKey( clock ) ) {
VsqBPPair v = m_list[clock];
v.value = value;
m_list[clock] = v;
+ return v.id;
} else {
VsqBPPair v = new VsqBPPair( value, m_max_id + 1 );
m_max_id++;
+#if DEBUG
+ //Console.WriteLine( "VsqBPList#add; m_max_id=" + m_max_id );
+#endif
m_list.Add( clock, v );
+ return m_max_id;
}
}
}
public int getElement( int index ) {
+ return getElementA( index );
+ }
+
+ public int getElementA( int index ) {
return m_list[m_list.Keys[index]].value;
}
+ public VsqBPPair getElementB( int index ) {
+ return m_list[m_list.Keys[index]];
+ }
+
public int getKeyClock( int index ) {
return m_list.Keys[index];
}
- public int findValueFromID( int id ) {
+ public int findValueFromID( long id ) {
int c = m_list.Keys.Count;
foreach ( int key in m_list.Keys ) {
if ( m_list[key].id == id ) {
return m_list[key].value;
}
}
- return Default;
+ return m_default;
}
- public void setValueForID( int id, int value ) {
+ ///
+ /// 指定したid値を持つVsqBPPairを検索し、その結果を返します。
+ ///
+ ///
+ ///
+ public VsqBPPairSearchContext findElement( long id ) {
+ VsqBPPairSearchContext context = new VsqBPPairSearchContext();
+ int c = m_list.Keys.Count;
+ for ( int i = 0; i < c; i++ ) {
+ int clock = m_list.Keys[i];
+ VsqBPPair item = m_list[clock];
+ if ( item.id == id ) {
+ context.clock = clock;
+ context.index = i;
+ context.point = item;
+ return context;
+ }
+ }
+ context.clock = -1;
+ context.index = -1;
+ context.point = new VsqBPPair( m_default, -1 );
+ return context;
+ }
+
+ public void setValueForID( long id, int value ) {
int c = m_list.Keys.Count;
foreach ( int key in m_list.Keys ) {
if ( m_list[key].id == id ) {
@@ -219,7 +346,7 @@ namespace Boare.Lib.Vsq {
public int getValue( int clock, ref int index ) {
if ( m_list.Count == 0 ) {
- return Default;
+ return m_default;
} else {
if ( index < 0 ) {
index = 0;
@@ -232,7 +359,7 @@ namespace Boare.Lib.Vsq {
return m_list[m_list.Keys[i - 1]].value;
} else {
index = i;
- return Default;
+ return m_default;
}
}
}
@@ -243,7 +370,7 @@ namespace Boare.Lib.Vsq {
public int getValue( int clock ) {
if ( m_list.Count == 0 ) {
- return Default;
+ return m_default;
} else {
for ( int i = 0; i < m_list.Keys.Count; i++ ) {
int keyclock = m_list.Keys[i];
@@ -251,7 +378,7 @@ namespace Boare.Lib.Vsq {
if ( i > 0 ) {
return m_list[m_list.Keys[i - 1]].value;
} else {
- return Default;
+ return m_default;
}
}
}
@@ -259,19 +386,12 @@ namespace Boare.Lib.Vsq {
}
}
- ///
- /// このBPListのデフォルト値を取得します
- ///
- public int getDefault() {
- return Default;
- }
-
///
/// このBPListの内容をテキストファイルに書き出します
///
///
public void print( StreamWriter writer ) {
- bool first = true;
+ boolean first = true;
foreach ( int key in m_list.Keys ) {
int val = m_list[key].value;
if ( first ) {
@@ -287,8 +407,8 @@ namespace Boare.Lib.Vsq {
/// このBPListの内容をテキストファイルに書き出します
///
///
- public void print( TextMemoryStream writer, int start, string header ) {
- bool first = true;
+ public void print( TextMemoryStream writer, int start, String header ) {
+ boolean first = true;
foreach ( int key in m_list.Keys ) {
if ( start <= key ) {
if ( first ) {
@@ -306,10 +426,10 @@ namespace Boare.Lib.Vsq {
///
///
///
- public string appendFromText( TextMemoryStream reader ) {
- string last_line = reader.readLine();
+ public String appendFromText( TextMemoryStream reader ) {
+ String last_line = reader.readLine();
while ( !last_line.StartsWith( "[" ) ) {
- string[] spl = last_line.Split( new char[] { '=' } );
+ String[] spl = last_line.Split( new char[] { '=' } );
int i1 = int.Parse( spl[0] );
int i2 = int.Parse( spl[1] );
VsqBPPair v = new VsqBPPair( i2, m_max_id + 1 );
diff --git a/trunk/Boare.Lib.Vsq/VsqBPPair.cs b/trunk/Boare.Lib.Vsq/VsqBPPair.cs
index 09bb261..5b039c5 100644
--- a/trunk/Boare.Lib.Vsq/VsqBPPair.cs
+++ b/trunk/Boare.Lib.Vsq/VsqBPPair.cs
@@ -1,12 +1,26 @@
-using System;
+/*
+ * VsqBPPair.cs
+ * Copyright (c) 2009 kbinani
+ *
+ * This file is part of Boare.Lib.Vsq.
+ *
+ * Boare.Lib.Vsq is free software; you can redistribute it and/or
+ * modify it under the terms of the BSD License.
+ *
+ * Boare.Lib.Vsq is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+using System;
namespace Boare.Lib.Vsq {
+ [Serializable]
public struct VsqBPPair {
public int value;
- public int id;
+ public long id;
- public VsqBPPair( int value_, int id_ ) {
+ public VsqBPPair( int value_, long id_ ) {
value = value_;
id = id_;
}
diff --git a/trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs b/trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs
new file mode 100644
index 0000000..081401e
--- /dev/null
+++ b/trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs
@@ -0,0 +1,9 @@
+namespace Boare.Lib.Vsq {
+
+ public class VsqBPPairSearchContext {
+ public int clock;
+ public int index;
+ public VsqBPPair point;
+ }
+
+}
diff --git a/trunk/Boare.Lib.Vsq/VsqBarLineType.cs b/trunk/Boare.Lib.Vsq/VsqBarLineType.cs
index a4518f8..5e33612 100644
--- a/trunk/Boare.Lib.Vsq/VsqBarLineType.cs
+++ b/trunk/Boare.Lib.Vsq/VsqBarLineType.cs
@@ -15,9 +15,11 @@ using System;
namespace Boare.Lib.Vsq {
+ using boolean = System.Boolean;
+
public struct VsqBarLineType {
private int m_clock;
- private bool m_is_separator;
+ private boolean m_is_separator;
private int m_denominator;
private int m_numerator;
private int m_bar_count;
@@ -38,11 +40,11 @@ namespace Boare.Lib.Vsq {
return m_clock;
}
- public bool isSeparator() {
+ public boolean isSeparator() {
return m_is_separator;
}
- public VsqBarLineType( int clock, bool is_separator, int denominator, int numerator, int bar_count ) {
+ public VsqBarLineType( int clock, boolean is_separator, int denominator, int numerator, int bar_count ) {
m_clock = clock;
m_is_separator = is_separator;
m_denominator = denominator;
diff --git a/trunk/Boare.Lib.Vsq/VsqCommand.cs b/trunk/Boare.Lib.Vsq/VsqCommand.cs
index 1938fc6..61819a2 100644
--- a/trunk/Boare.Lib.Vsq/VsqCommand.cs
+++ b/trunk/Boare.Lib.Vsq/VsqCommand.cs
@@ -14,8 +14,14 @@
using System;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq {
+ using boolean = System.Boolean;
+ using Integer = System.Int32;
+ using Long = System.Int64;
+
///
///
///
@@ -29,7 +35,7 @@ namespace Boare.Lib.Vsq {
///
/// 後続するコマンド
///
- public List Children = new List();
+ public Vector Children = new Vector();
///
/// このコマンドの親
///
@@ -43,7 +49,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandRoot() {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.Root;
+ command.Type = VsqCommandType.ROOT;
command.Args = null;
return command;
}
@@ -51,14 +57,14 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandReplace( VsqFile vsq ) {
VsqCommand command = new VsqCommand();
command.Args = new object[1];
- command.Type = VsqCommandType.Replace;
+ command.Type = VsqCommandType.REPLACE;
command.Args[0] = (VsqFile)vsq.Clone();
return command;
}
public static VsqCommand generateCommandTrackReplace( int track, VsqTrack item ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.TrackReplace;
+ command.Type = VsqCommandType.TRACK_REPLACE;
command.Args = new object[2];
command.Args[0] = track;
command.Args[1] = (VsqTrack)item.Clone();
@@ -67,7 +73,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandUpdateTimesig( int bar_count, int new_barcount, int numerator, int denominator ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.UpdateTimesig;
+ command.Type = VsqCommandType.UPDATE_TIMESIG;
command.Args = new object[4];
command.Args[0] = bar_count;
command.Args[1] = numerator;
@@ -78,7 +84,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandUpdateTimesigRange( int[] bar_counts, int[] new_barcounts, int[] numerators, int[] denominators ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.UpdateTimesigRange;
+ command.Type = VsqCommandType.UPDATE_TIMESIG_RANGE;
command.Args = new object[4];
command.Args[0] = (int[])bar_counts.Clone();
command.Args[1] = (int[])numerators.Clone();
@@ -89,7 +95,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandUpdateTempoRange( int[] clocks, int[] new_clocks, int[] tempos ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.UpdateTempoRange;
+ command.Type = VsqCommandType.UPDATE_TEMPO_RANGE;
command.Args = new object[3];
command.Args[0] = (int[])clocks.Clone();
command.Args[1] = (int[])tempos.Clone();
@@ -99,7 +105,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandUpdateTempo( int clock, int new_clock, int tempo ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.UpdateTempo;
+ command.Type = VsqCommandType.UPDATE_TEMPO;
command.Args = new object[3];
command.Args[0] = clock;
command.Args[1] = tempo;
@@ -109,7 +115,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandChangePreMeasure( int pre_measure ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.ChangePreMeasure;
+ command.Type = VsqCommandType.CHANGE_PRE_MEASURE;
command.Args = new object[1];
command.Args[0] = pre_measure;
return command;
@@ -117,7 +123,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandDeleteTrack( int track ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.DeleteTrack;
+ command.Type = VsqCommandType.TRACK_DELETE;
command.Args = new object[1];
command.Args[0] = track;
return command;
@@ -130,7 +136,7 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandAddTrack( VsqTrack track, VsqMixerEntry mixer, int position ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.AddTrack;
+ command.Type = VsqCommandType.TRACK_ADD;
command.Args = new object[5];
command.Args[0] = track;
command.Args[1] = mixer;
@@ -144,9 +150,9 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static VsqCommand generateCommandTrackChangeName( int track, string new_name ) {
+ public static VsqCommand generateCommandTrackChangeName( int track, String new_name ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.TrackChangeName;
+ command.Type = VsqCommandType.TRACK_CHANGE_NAME;
command.Args = new object[2];
command.Args[0] = track;
command.Args[1] = new_name;
@@ -155,7 +161,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandTrackChangePlayMode( int track, int play_mode ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.TrackChangePlayMode;
+ command.Type = VsqCommandType.TRACK_CHANGE_PLAY_MODE;
command.Args = new object[2];
command.Args[0] = track;
command.Args[1] = play_mode;
@@ -172,7 +178,7 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventChangeClockAndIDContaintsRange( int track, int[] internal_ids, int[] clocks, VsqID[] values ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeClockAndIDContaintsRange;
+ command.Type = VsqCommandType.EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS_RANGE;
int count = internal_ids.Length;
command.Args = new object[4];
command.Args[0] = track;
@@ -192,12 +198,12 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventChangeClockAndIDContaints( int track, int internal_id, int clock, VsqID value ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeClockAndIDContaints;
+ command.Type = VsqCommandType.EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS;
command.Args = new object[4];
command.Args[0] = track;
command.Args[1] = internal_id;
command.Args[2] = clock;
- command.Args[3] = (VsqID)value.Clone();
+ command.Args[3] = (VsqID)value.clone();
return command;
}
@@ -210,13 +216,13 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventChangeIDContaintsRange( int track, int[] internal_ids, VsqID[] values ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeIDContaintsRange;
+ command.Type = VsqCommandType.EVENT_CHANGE_ID_CONTAINTS_RANGE;
command.Args = new object[3];
command.Args[0] = track;
command.Args[1] = (int[])internal_ids.Clone();
VsqID[] list = new VsqID[values.Length];
for ( int i = 0; i < values.Length; i++ ) {
- list[i] = (VsqID)values[i].Clone();
+ list[i] = (VsqID)values[i].clone();
}
command.Args[2] = list;
return command;
@@ -231,11 +237,11 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventChangeIDContaints( int track, int internal_id, VsqID value ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeIDContaints;
+ command.Type = VsqCommandType.EVENT_CHANGE_ID_CONTAINTS;
command.Args = new object[3];
command.Args[0] = track;
command.Args[1] = internal_id;
- command.Args[2] = (VsqID)value.Clone();
+ command.Args[2] = (VsqID)value.clone();
return command;
}
@@ -249,7 +255,7 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventChangeClockAndLength( int track, int internal_id, int new_clock, int new_length ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeClockAndLength;
+ command.Type = VsqCommandType.EVENT_CHANGE_CLOCK_AND_LENGTH;
command.Args = new object[4];
command.Args[0] = track;
command.Args[1] = internal_id;
@@ -267,7 +273,7 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventChangeLength( int track, int internal_id, int new_length ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeLength;
+ command.Type = VsqCommandType.EVENT_CHANGE_LENGTH;
command.Args = new object[3];
command.Args[0] = track;
command.Args[1] = internal_id;
@@ -282,14 +288,15 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static VsqCommand generateCommandEventChangeVelocity( int track, List> velocity ) {
+ public static VsqCommand generateCommandEventChangeVelocity( int track, Vector> velocity ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeVelocity;
+ command.Type = VsqCommandType.EVENT_CHANGE_VELOCITY;
command.Args = new object[2];
command.Args[0] = track;
- List> list = new List>();
- foreach ( KeyValuePair item in velocity ) {
- list.Add( new KeyValuePair( item.Key, item.Value ) );
+ Vector> list = new Vector>();
+ for( Iterator itr = velocity.iterator(); itr.hasNext(); ){
+ KeyValuePair item = (KeyValuePair)itr.next();
+ list.add( new KeyValuePair( item.Key, item.Value ) );
}
command.Args[1] = list;
return command;
@@ -297,21 +304,21 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandEventReplace( int track, VsqEvent item ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventReplace;
+ command.Type = VsqCommandType.EVENT_REPLACE;
command.Args = new object[2];
command.Args[0] = track;
- command.Args[1] = item.Clone();
+ command.Args[1] = item.clone();
return command;
}
public static VsqCommand generateCommandEventReplaceRange( int track, VsqEvent[] items ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventReplaceRange;
+ command.Type = VsqCommandType.EVENT_REPLACE_RANGE;
command.Args = new object[2];
command.Args[0] = track;
VsqEvent[] objs = new VsqEvent[items.Length];
for( int i = 0; i < items.Length; i++ ){
- objs[i] = (VsqEvent)items[i].Clone();
+ objs[i] = (VsqEvent)items[i].clone();
}
command.Args[1] = objs;
return command;
@@ -324,14 +331,15 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static VsqCommand generateCommandEventChangeAccent( int track, List> accent_list ) {
+ public static VsqCommand generateCommandEventChangeAccent( int track, Vector> accent_list ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeAccent;
+ command.Type = VsqCommandType.EVENT_CHANGE_ACCENT;
command.Args = new object[2];
command.Args[0] = track;
- List> list = new List>();
- foreach ( KeyValuePair item in accent_list ) {
- list.Add( new KeyValuePair( item.Key, item.Value ) );
+ Vector> list = new Vector>();
+ for ( Iterator itr = accent_list.iterator(); itr.hasNext(); ){
+ KeyValuePair item = (KeyValuePair)itr.next();
+ list.add( new KeyValuePair( item.Key, item.Value ) );
}
command.Args[1] = list;
return command;
@@ -344,19 +352,65 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static VsqCommand generateCommandEventChangeDecay( int track, List> decay_list ) {
+ public static VsqCommand generateCommandEventChangeDecay( int track, Vector> decay_list ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeDecay;
+ command.Type = VsqCommandType.EVENT_CHANGE_DECAY;
command.Args = new object[2];
command.Args[0] = track;
- List> list = new List>();
- foreach ( KeyValuePair item in decay_list ) {
- list.Add( new KeyValuePair( item.Key, item.Value ) );
+ Vector> list = new Vector>();
+ for ( Iterator itr = decay_list.iterator(); itr.hasNext(); ){
+ KeyValuePair item = (KeyValuePair)itr.next();
+ list.add( new KeyValuePair( item.Key, item.Value ) );
}
command.Args[1] = list;
return command;
}
+ public static VsqCommand generateCommandTrackCurveReplaceRange( int track, String[] target_curve, VsqBPList[] bplist ) {
+ VsqCommand command = new VsqCommand();
+ command.Type = VsqCommandType.TRACK_CURVE_REPLACE_RANGE;
+ command.Args = new object[3];
+ command.Args[0] = track;
+ String[] arr = new String[target_curve.Length];
+ for ( int i = 0; i < target_curve.Length; i++ ) {
+ arr[i] = target_curve[i];
+ }
+ command.Args[1] = arr;
+ VsqBPList[] cp = new VsqBPList[bplist.Length];
+ for ( int i = 0; i < bplist.Length; i++ ) {
+ cp[i] = (VsqBPList)bplist[i].clone();
+ }
+ command.Args[2] = cp;
+ return command;
+ }
+
+ public static VsqCommand generateCommandTrackCurveReplace( int track, String target_curve, VsqBPList bplist ) {
+ VsqCommand command = new VsqCommand();
+ command.Type = VsqCommandType.TRACK_CURVE_REPLACE;
+ command.Args = new object[3];
+ command.Args[0] = track;
+ command.Args[1] = target_curve;
+ command.Args[2] = bplist.clone();
+ return command;
+ }
+
+ /*public static VsqCommand generateCommandTrackRemovePoints( int track, String target, Vector ids ) {
+ VsqCommand command = new VsqCommand();
+ command.Type = VsqCommandType.TRACK_CURVE_REMOVE_POINTS;
+ command.Args = new object[3];
+ command.Args[0] = track;
+ command.Args[1] = target;
+ Vector cpy = new Vector();
+ if ( ids != null ){
+ int count = ids.size();
+ for ( int i = 0; i < count; i++ ) {
+ cpy.add( ids.get( i ) );
+ }
+ }
+ command.Args[2] = cpy;
+ return command;
+ }*/
+
///
/// vsqファイルのカーブを編集するコマンドを発行します.
///
@@ -364,31 +418,33 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static VsqCommand generateCommandTrackEditCurve( int track, string target, List edit ) {
+ public static VsqCommand generateCommandTrackCurveEdit( int track, String target, Vector edit ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.TrackEditCurve;
+ command.Type = VsqCommandType.TRACK_CURVE_EDIT;
command.Args = new object[5];
command.Args[0] = track;
command.Args[1] = target;
- List copied = new List();
- foreach ( BPPair item in edit ) {
- copied.Add( item );
+ Vector copied = new Vector();
+ for ( Iterator itr = edit.iterator(); itr.hasNext(); ){
+ BPPair item = (BPPair)itr.next();
+ copied.add( item );
}
command.Args[2] = copied;
return command;
}
- public static VsqCommand generateCommandTrackEditCurveRange( int track, string[] targets, List[] edits ) {
+ public static VsqCommand generateCommandTrackCurveEditRange( int track, String[] targets, Vector[] edits ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.TrackEditCurveRange;
+ command.Type = VsqCommandType.TRACK_CURVE_EDIT_RANGE;
command.Args = new object[3];
command.Args[0] = track;
- command.Args[1] = (string[])targets.Clone();
- List[] cpy = new List[targets.Length];
+ command.Args[1] = (String[])targets.Clone();
+ Vector[] cpy = new Vector[targets.Length];
for ( int i = 0; i < edits.Length; i++ ) {
- List copied = new List();
- foreach ( BPPair item in edits[i] ) {
- copied.Add( new BPPair( item.Clock, item.Value ) );
+ Vector copied = new Vector();
+ for ( Iterator itr = edits[i].iterator(); itr.hasNext(); ){
+ BPPair item = (BPPair)itr.next();
+ copied.add( new BPPair( item.Clock, item.Value ) );
}
cpy[i] = copied;
}
@@ -404,9 +460,9 @@ namespace Boare.Lib.Vsq {
///
///
///
- public static VsqCommand generateCommandEventChangeLyric( int track, int internal_id, string phrase, string phonetic_symbol, bool protect_symbol ) {
+ public static VsqCommand generateCommandEventChangeLyric( int track, int internal_id, String phrase, String phonetic_symbol, boolean protect_symbol ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeLyric;
+ command.Type = VsqCommandType.EVENT_CHANGE_LYRIC;
command.Args = new object[5];
command.Args[0] = track;
command.Args[1] = internal_id;
@@ -425,7 +481,7 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventChangeClock( int track, int internal_id, int value ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeClock;
+ command.Type = VsqCommandType.EVENT_CHANGE_CLOCK;
command.Args = new object[3];
command.Args[0] = track;
command.Args[1] = internal_id;
@@ -435,7 +491,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandEventDeleteRange( int track, int[] internal_ids ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventDeleteRange;
+ command.Type = VsqCommandType.EVENT_DELETE_RANGE;
command.Args = new object[2];
command.Args[0] = (int[])internal_ids.Clone();
command.Args[1] = track;
@@ -449,7 +505,7 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventDelete( int track, int internal_id ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventDelete;
+ command.Type = VsqCommandType.EVENT_DELETE;
command.Args = new object[2];
command.Args[1] = track;
command.Args[0] = internal_id;
@@ -458,7 +514,7 @@ namespace Boare.Lib.Vsq {
public static VsqCommand generateCommandEventAddRange( int track, VsqEvent[] items ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventAddRange;
+ command.Type = VsqCommandType.EVENT_ADD_RANGE;
command.Args = new object[2];
command.Args[0] = track;
command.Args[1] = (VsqEvent[])items.Clone();
@@ -473,10 +529,10 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventAdd( int track, VsqEvent item ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventAdd;
+ command.Type = VsqCommandType.EVENT_ADD;
command.Args = new object[2];
command.Args[0] = track;
- command.Args[1] = (VsqEvent)item.Clone();
+ command.Args[1] = (VsqEvent)item.clone();
return command;
}
@@ -489,7 +545,7 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventChangeNote( int track, int internal_id, int note ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeNote;
+ command.Type = VsqCommandType.EVENT_CHANGE_NOTE;
command.Args = new object[3];
command.Args[0] = track;
command.Args[1] = internal_id;
@@ -506,7 +562,7 @@ namespace Boare.Lib.Vsq {
///
public static VsqCommand generateCommandEventChangeClockAndNote( int track, int internal_id, int clock, int note ) {
VsqCommand command = new VsqCommand();
- command.Type = VsqCommandType.EventChangeClockAndNote;
+ command.Type = VsqCommandType.EVENT_CHANGE_CLOCK_AND_NOTE;
command.Args = new object[4];
command.Args[0] = track;
command.Args[1] = internal_id;
diff --git a/trunk/Boare.Lib.Vsq/VsqCommandType.cs b/trunk/Boare.Lib.Vsq/VsqCommandType.cs
index 2ba70e0..14c6109 100644
--- a/trunk/Boare.Lib.Vsq/VsqCommandType.cs
+++ b/trunk/Boare.Lib.Vsq/VsqCommandType.cs
@@ -14,39 +14,42 @@
namespace Boare.Lib.Vsq {
public enum VsqCommandType {
- Root,
- ChangePreMeasure,
- EventAdd,
- EventDelete,
- EventChangeClock,
- EventChangeLyric,
- EventChangeNote,
- EventChangeClockAndNote,
- TrackEditCurve,
- TrackEditCurveRange,
- EventChangeVelocity,
- EventChangeAccent,
- EventChangeDecay,
- EventChangeLength,
- EventChangeClockAndLength,
- EventChangeIDContaints,
- EventChangeClockAndIDContaints,
- TrackChangeName,
- AddTrack,
- DeleteTrack,
- EventChangeClockAndIDContaintsRange,
- EventDeleteRange,
- EventAddRange,
- UpdateTempo,
- UpdateTempoRange,
- UpdateTimesig,
- UpdateTimesigRange,
- EventChangeIDContaintsRange,
- TrackReplace,
- Replace,
- TrackChangePlayMode,
- EventReplace,
- EventReplaceRange,
+ ROOT,
+ CHANGE_PRE_MEASURE,
+ EVENT_ADD,
+ EVENT_DELETE,
+ EVENT_CHANGE_CLOCK,
+ EVENT_CHANGE_LYRIC,
+ EVENT_CHANGE_NOTE,
+ EVENT_CHANGE_CLOCK_AND_NOTE,
+ TRACK_CURVE_EDIT,
+ TRACK_CURVE_EDIT_RANGE,
+ //TRACK_CURVE_REMOVE_POINTS,
+ TRACK_CURVE_REPLACE,
+ TRACK_CURVE_REPLACE_RANGE,
+ EVENT_CHANGE_VELOCITY,
+ EVENT_CHANGE_ACCENT,
+ EVENT_CHANGE_DECAY,
+ EVENT_CHANGE_LENGTH,
+ EVENT_CHANGE_CLOCK_AND_LENGTH,
+ EVENT_CHANGE_ID_CONTAINTS,
+ EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS,
+ TRACK_CHANGE_NAME,
+ TRACK_ADD,
+ TRACK_DELETE,
+ EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS_RANGE,
+ EVENT_DELETE_RANGE,
+ EVENT_ADD_RANGE,
+ UPDATE_TEMPO,
+ UPDATE_TEMPO_RANGE,
+ UPDATE_TIMESIG,
+ UPDATE_TIMESIG_RANGE,
+ EVENT_CHANGE_ID_CONTAINTS_RANGE,
+ TRACK_REPLACE,
+ REPLACE,
+ TRACK_CHANGE_PLAY_MODE,
+ EVENT_REPLACE,
+ EVENT_REPLACE_RANGE,
}
}
diff --git a/trunk/Boare.Lib.Vsq/VsqEvent.cs b/trunk/Boare.Lib.Vsq/VsqEvent.cs
index a2416dc..420538e 100644
--- a/trunk/Boare.Lib.Vsq/VsqEvent.cs
+++ b/trunk/Boare.Lib.Vsq/VsqEvent.cs
@@ -13,6 +13,8 @@
*/
using System;
+using bocoree;
+
namespace Boare.Lib.Vsq {
///
@@ -20,7 +22,7 @@ namespace Boare.Lib.Vsq {
///
[Serializable]
public class VsqEvent : IComparable, ICloneable {
- public string Tag;
+ public String Tag;
///
/// 内部で使用するインスタンス固有のID
///
@@ -33,8 +35,8 @@ namespace Boare.Lib.Vsq {
/// このオブジェクトのコピーを作成します
///
///
- public object Clone() {
- VsqEvent ret = new VsqEvent( Clock, (VsqID)ID.Clone() );
+ public Object clone() {
+ VsqEvent ret = new VsqEvent( Clock, (VsqID)ID.clone() );
ret.InternalID = InternalID;
if ( UstEvent != null ) {
ret.UstEvent = (UstEvent)UstEvent.Clone();
@@ -43,6 +45,10 @@ namespace Boare.Lib.Vsq {
return ret;
}
+ public object Clone() {
+ return clone();
+ }
+
public int CompareTo( VsqEvent item ) {
int ret = this.Clock - item.Clock;
if ( ret == 0 ) {
@@ -56,10 +62,10 @@ namespace Boare.Lib.Vsq {
}
}
- public VsqEvent( string line ) {
- string[] spl = line.Split( new char[] { '=' } );
+ public VsqEvent( String line ) {
+ String[] spl = line.Split( new char[] { '=' } );
Clock = int.Parse( spl[0] );
- if ( spl[1] == "EOS" ) {
+ if ( spl[1].Equals( "EOS" ) ) {
ID = VsqID.EOS;
}
}
diff --git a/trunk/Boare.Lib.Vsq/VsqEventList.cs b/trunk/Boare.Lib.Vsq/VsqEventList.cs
index 731dcc9..35eb31a 100644
--- a/trunk/Boare.Lib.Vsq/VsqEventList.cs
+++ b/trunk/Boare.Lib.Vsq/VsqEventList.cs
@@ -14,6 +14,8 @@
using System;
using System.Collections.Generic;
+using bocoree;
+
namespace Boare.Lib.Vsq {
///
@@ -21,19 +23,20 @@ namespace Boare.Lib.Vsq {
///
[Serializable]
public class VsqEventList {
- public List Events;
- private List m_ids;
+ public Vector Events;
+ private Vector m_ids;
///
/// コンストラクタ
///
public VsqEventList() {
- Events = new List();
- m_ids = new List();
+ Events = new Vector();
+ m_ids = new Vector();
}
public VsqEvent findFromID( int internal_id ) {
- foreach ( VsqEvent item in Events ) {
+ for ( Iterator itr = Events.iterator(); itr.hasNext(); ){
+ VsqEvent item = (VsqEvent)itr.next();
if ( item.InternalID == internal_id ) {
return item;
}
@@ -42,10 +45,10 @@ namespace Boare.Lib.Vsq {
}
public void setForID( int internal_id, VsqEvent value ) {
- int c = Events.Count;
+ int c = Events.size();
for ( int i = 0; i < c; i++ ) {
- if ( Events[i].InternalID == internal_id ) {
- Events[i] = value;
+ if ( Events.get( i ).InternalID == internal_id ) {
+ Events.set( i, value );
break;
}
}
@@ -53,14 +56,14 @@ namespace Boare.Lib.Vsq {
public void sort() {
lock ( this ) {
- Events.Sort();
+ Collections.sort( Events );
updateIDList();
}
}
public void clear() {
- Events.Clear();
- m_ids.Clear();
+ Events.clear();
+ m_ids.clear();
}
public Iterator iterator() {
@@ -72,59 +75,59 @@ namespace Boare.Lib.Vsq {
updateIDList();
int new_id = getNextId( 0 );
item.InternalID = new_id;
- Events.Add( item );
- m_ids.Add( new_id );
- Events.Sort();
- for ( int i = 0; i < Events.Count; i++ ) {
- m_ids[i] = Events[i].InternalID;
+ Events.add( item );
+ m_ids.add( new_id );
+ Collections.sort( Events );
+ for ( int i = 0; i < Events.size(); i++ ) {
+ m_ids.set( i, Events.get( i ).InternalID );
}
}
public void removeAt( int index ) {
updateIDList();
- Events.RemoveAt( index );
- m_ids.RemoveAt( index );
+ Events.removeElementAt( index );
+ m_ids.removeElementAt( index );
}
private int getNextId( int next ) {
updateIDList();
int index = -1;
- List current = new List( m_ids );
+ Vector current = new Vector( m_ids );
int nfound = 0;
while ( true ) {
index++;
- if ( !current.Contains( index ) ) {
+ if ( !current.contains( index ) ) {
nfound++;
if ( nfound == next + 1 ) {
return index;
} else {
- current.Add( index );
+ current.add( index );
}
}
}
}
public int getCount() {
- return Events.Count;
+ return Events.size();
}
public VsqEvent getElement( int index ) {
- return Events[index];
+ return Events.get( index );
}
public void setElement( int index, VsqEvent value ) {
- Events[index] = value;
+ Events.set( index, value );
}
public void updateIDList() {
- if ( m_ids.Count != Events.Count ) {
- m_ids.Clear();
- for ( int i = 0; i < Events.Count; i++ ) {
- m_ids.Add( Events[i].InternalID );
+ if ( m_ids.size() != Events.size() ) {
+ m_ids.clear();
+ for ( int i = 0; i < Events.size(); i++ ) {
+ m_ids.add( Events.get( i ).InternalID );
}
} else {
- for ( int i = 0; i < Events.Count; i++ ) {
- m_ids[i] = Events[i].InternalID;
+ for ( int i = 0; i < Events.size(); i++ ) {
+ m_ids.set( i, Events.get( i ).InternalID );
}
}
}
diff --git a/trunk/Boare.Lib.Vsq/VsqFile.cs b/trunk/Boare.Lib.Vsq/VsqFile.cs
index 8b0bb07..eb49640 100644
--- a/trunk/Boare.Lib.Vsq/VsqFile.cs
+++ b/trunk/Boare.Lib.Vsq/VsqFile.cs
@@ -14,9 +14,16 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Text;
+
+using bocoree;
namespace Boare.Lib.Vsq {
+ using boolean = System.Boolean;
+ using Integer = Int32;
+ using Long = Int64;
+
///
/// VSQファイルの内容を保持するクラス
///
@@ -25,16 +32,16 @@ namespace Boare.Lib.Vsq {
///
/// トラックのリスト.最初のトラックはMasterTrackであり,通常の音符が格納されるトラックはインデックス1以降となる
///
- public List Track;
+ public Vector Track;
///
/// テンポ情報を保持したテーブル
///
#if USE_TEMPO_LIST
protected TempoTable m_tempo_table;
#else
- public List TempoTable;
+ public Vector TempoTable;
#endif
- public List TimesigTable;
+ public Vector TimesigTable;
protected int m_tpq;
///
/// 曲の長さを取得します。(クロック(4分音符は480クロック))
@@ -43,13 +50,33 @@ namespace Boare.Lib.Vsq {
protected int m_base_tempo;
public VsqMaster Master; // VsqMaster, VsqMixerは通常,最初の非Master Trackに記述されるが,可搬性のため,
public VsqMixer Mixer; // ここではVsqFileに直属するものとして取り扱う.
- //protected int m_premeasure_clocks;
public object Tag;
static readonly byte[] _MTRK = new byte[] { 0x4d, 0x54, 0x72, 0x6b };
static readonly byte[] _MTHD = new byte[] { 0x4d, 0x54, 0x68, 0x64 };
static readonly byte[] _MASTER_TRACK = new byte[] { 0x4D, 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x54, 0x72, 0x61, 0x63, 0x6B, };
- static readonly string[] _CURVES = new string[] { "VEL", "DYN", "BRE", "BRI", "CLE", "OPE", "GEN", "POR", "PIT", "PBS" };
+ static readonly String[] _CURVES = new String[] { "VEL", "DYN", "BRE", "BRI", "CLE", "OPE", "GEN", "POR", "PIT", "PBS" };
+
+ ///
+ /// プリセンドタイムの妥当性を判定します
+ ///
+ ///
+ ///
+ public bool checkPreSendTimeValidity( int ms_pre_send_time ) {
+ int track_count = Track.size();
+ for ( int i = 1; i < track_count; i++ ) {
+ VsqTrack track = Track.get( i );
+ for ( Iterator itr = track.getNoteEventIterator(); itr.hasNext(); ) {
+ VsqEvent item = (VsqEvent)itr.next();
+ int presend_clock = getPresendClockAt( item.Clock, ms_pre_send_time );
+ if ( item.Clock - presend_clock < 0 ) {
+ return false;
+ }
+ break;
+ }
+ }
+ return true;
+ }
///
/// テンポ値を一律order倍します。
@@ -57,9 +84,9 @@ namespace Boare.Lib.Vsq {
///
public void speedingUp( double order ) {
lock ( TempoTable ) {
- int c = TempoTable.Count;
+ int c = TempoTable.size();
for ( int i = 0; i < c; i++ ) {
- TempoTable[i].Tempo = (int)(TempoTable[i].Tempo / order);
+ TempoTable.get( i ).Tempo = (int)(TempoTable.get( i ).Tempo / order);
}
}
updateTempoInfo();
@@ -76,7 +103,7 @@ namespace Boare.Lib.Vsq {
Console.WriteLine( " type=" + command.Type );
#endif
VsqCommandType type = command.Type;
- if ( type == VsqCommandType.ChangePreMeasure ) {
+ if ( type == VsqCommandType.CHANGE_PRE_MEASURE ) {
#region ChangePreMeasure
VsqCommand ret = VsqCommand.generateCommandChangePreMeasure( Master.PreMeasure );
int value = (int)command.Args[0];
@@ -84,7 +111,7 @@ namespace Boare.Lib.Vsq {
updateTimesigInfo();
return ret;
#endregion
- } else if ( type == VsqCommandType.AddTrack ) {
+ } else if ( type == VsqCommandType.TRACK_ADD ) {
#region AddTrack
#if DEBUG
System.Diagnostics.Debug.WriteLine( " AddTrack" );
@@ -93,33 +120,33 @@ namespace Boare.Lib.Vsq {
VsqMixerEntry mixer = (VsqMixerEntry)command.Args[1];
int position = (int)command.Args[2];
VsqCommand ret = VsqCommand.generateCommandDeleteTrack( position );
- if ( Track.Count <= 17 ) {
- Track.Insert( position, (VsqTrack)track.Clone() );
- Mixer.Slave.Add( (VsqMixerEntry)mixer.Clone() );
+ if ( Track.size() <= 17 ) {
+ Track.insertElementAt( (VsqTrack)track.Clone(), position );
+ Mixer.Slave.add( (VsqMixerEntry)mixer.Clone() );
return ret;
} else {
return null;
}
#endregion
- } else if ( type == VsqCommandType.DeleteTrack ) {
+ } else if ( type == VsqCommandType.TRACK_DELETE ) {
#region DeleteTrack
int track = (int)command.Args[0];
- VsqCommand ret = VsqCommand.generateCommandAddTrack( Track[track], Mixer.Slave[track - 1], track );
- Track.RemoveAt( track );
- Mixer.Slave.RemoveAt( track - 1 );
+ VsqCommand ret = VsqCommand.generateCommandAddTrack( Track.get( track ), Mixer.Slave.get( track - 1 ), track );
+ Track.removeElementAt( track );
+ Mixer.Slave.removeElementAt( track - 1 );
updateTotalClocks();
return ret;
#endregion
- } else if ( type == VsqCommandType.UpdateTempo ) {
+ } else if ( type == VsqCommandType.UPDATE_TEMPO ) {
#region UpdateTempo
int clock = (int)command.Args[0];
int tempo = (int)command.Args[1];
int new_clock = (int)command.Args[2];
int index = -1;
- int c = TempoTable.Count;
+ int c = TempoTable.size();
for ( int i = 0; i < c; i++ ) {
- if ( TempoTable[i].Clock == clock ) {
+ if ( TempoTable.get( i ).Clock == clock ) {
index = i;
break;
}
@@ -127,32 +154,32 @@ namespace Boare.Lib.Vsq {
VsqCommand ret = null;
if ( index >= 0 ) {
if ( tempo <= 0 ) {
- ret = VsqCommand.generateCommandUpdateTempo( clock, clock, TempoTable[index].Tempo );
- TempoTable.RemoveAt( index );
+ ret = VsqCommand.generateCommandUpdateTempo( clock, clock, TempoTable.get( index ).Tempo );
+ TempoTable.removeElementAt( index );
} else {
- ret = VsqCommand.generateCommandUpdateTempo( new_clock, clock, TempoTable[index].Tempo );
- TempoTable[index].Tempo= tempo ;
- TempoTable[index].Clock= new_clock ;
+ ret = VsqCommand.generateCommandUpdateTempo( new_clock, clock, TempoTable.get( index ).Tempo );
+ TempoTable.get( index ).Tempo= tempo ;
+ TempoTable.get( index ).Clock= new_clock ;
}
} else {
ret = VsqCommand.generateCommandUpdateTempo( clock, clock, -1 );
- TempoTable.Add( new TempoTableEntry( new_clock, tempo, 0.0 ) );
+ TempoTable.add( new TempoTableEntry( new_clock, tempo, 0.0 ) );
}
updateTempoInfo();
updateTotalClocks();
// 編集領域を更新
int affected_clock = Math.Min( clock, new_clock );
- c = Track.Count;
+ c = Track.size();
for ( int i = 1; i < c; i++ ) {
- if ( affected_clock < Track[i].getEditedStart() ) {
- Track[i].setEditedStart( affected_clock );
+ if ( affected_clock < Track.get( i ).getEditedStart() ) {
+ Track.get( i ).setEditedStart( affected_clock );
}
- Track[i].setEditedEnd( (int)TotalClocks );
+ Track.get( i ).setEditedEnd( (int)TotalClocks );
}
return ret;
#endregion
- } else if ( type == VsqCommandType.UpdateTempoRange ) {
+ } else if ( type == VsqCommandType.UPDATE_TEMPO_RANGE ) {
#region UpdateTempoRange
int[] clocks = (int[])command.Args[0];
int[] tempos = (int[])command.Args[1];
@@ -163,47 +190,47 @@ namespace Boare.Lib.Vsq {
int index = -1;
affected_clock = Math.Min( affected_clock, clocks[i] );
affected_clock = Math.Min( affected_clock, new_clocks[i] );
- int tempo_table_count = TempoTable.Count;
+ int tempo_table_count = TempoTable.size();
for ( int j = 0; j < tempo_table_count; j++ ) {
- if ( TempoTable[j].Clock == clocks[i] ) {
+ if ( TempoTable.get( j ).Clock == clocks[i] ) {
index = j;
break;
}
}
if ( index >= 0 ) {
- new_tempos[i] = TempoTable[index].Tempo;
+ new_tempos[i] = TempoTable.get( index ).Tempo;
if ( tempos[i] <= 0 ) {
- TempoTable.RemoveAt( index );
+ TempoTable.removeElementAt( index );
} else {
- TempoTable[index].Tempo = tempos[i];
- TempoTable[index].Clock = new_clocks[i];
+ TempoTable.get( index ).Tempo = tempos[i];
+ TempoTable.get( index ).Clock = new_clocks[i];
}
} else {
new_tempos[i] = -1;
- TempoTable.Add( new TempoTableEntry( new_clocks[i], tempos[i], 0.0 ) );
+ TempoTable.add( new TempoTableEntry( new_clocks[i], tempos[i], 0.0 ) );
}
}
updateTempoInfo();
updateTotalClocks();
- int track_count = Track.Count;
+ int track_count = Track.size();
for ( int i = 1; i < track_count; i++ ) {
- if ( affected_clock < Track[i].getEditedStart() ) {
- Track[i].setEditedStart( affected_clock );
+ if ( affected_clock < Track.get( i ).getEditedStart() ) {
+ Track.get( i ).setEditedStart( affected_clock );
}
- Track[i].setEditedEnd( (int)TotalClocks );
+ Track.get( i ).setEditedEnd( (int)TotalClocks );
}
return VsqCommand.generateCommandUpdateTempoRange( new_clocks, clocks, new_tempos );
#endregion
- } else if ( type == VsqCommandType.UpdateTimesig ) {
+ } else if ( type == VsqCommandType.UPDATE_TIMESIG ) {
#region UpdateTimesig
int barcount = (int)command.Args[0];
int numerator = (int)command.Args[1];
int denominator = (int)command.Args[2];
int new_barcount = (int)command.Args[3];
int index = -1;
- int timesig_table_count = TimesigTable.Count;
+ int timesig_table_count = TimesigTable.size();
for ( int i = 0; i < timesig_table_count; i++ ) {
- if ( barcount == TimesigTable[i].BarCount ) {
+ if ( barcount == TimesigTable.get( i ).BarCount ) {
index = i;
break;
}
@@ -211,23 +238,23 @@ namespace Boare.Lib.Vsq {
VsqCommand ret = null;
if ( index >= 0 ) {
if ( numerator <= 0 ) {
- ret = VsqCommand.generateCommandUpdateTimesig( barcount, barcount, TimesigTable[index].Numerator, TimesigTable[index].Denominator );
- TimesigTable.RemoveAt( index );
+ ret = VsqCommand.generateCommandUpdateTimesig( barcount, barcount, TimesigTable.get( index ).Numerator, TimesigTable.get( index ).Denominator );
+ TimesigTable.removeElementAt( index );
} else {
- ret = VsqCommand.generateCommandUpdateTimesig( new_barcount, barcount, TimesigTable[index].Numerator, TimesigTable[index].Denominator );
- TimesigTable[index].BarCount = new_barcount;
- TimesigTable[index].Numerator = numerator;
- TimesigTable[index].Denominator = denominator;
+ ret = VsqCommand.generateCommandUpdateTimesig( new_barcount, barcount, TimesigTable.get( index ).Numerator, TimesigTable.get( index ).Denominator );
+ TimesigTable.get( index ).BarCount = new_barcount;
+ TimesigTable.get( index ).Numerator = numerator;
+ TimesigTable.get( index ).Denominator = denominator;
}
} else {
ret = VsqCommand.generateCommandUpdateTimesig( new_barcount, new_barcount, -1, -1 );
- TimesigTable.Add( new TimeSigTableEntry( 0, numerator, denominator, new_barcount ) );
+ TimesigTable.add( new TimeSigTableEntry( 0, numerator, denominator, new_barcount ) );
}
updateTimesigInfo();
updateTotalClocks();
return ret;
#endregion
- } else if ( type == VsqCommandType.UpdateTimesigRange ) {
+ } else if ( type == VsqCommandType.UPDATE_TIMESIG_RANGE ) {
#region UpdateTimesigRange
int[] barcounts = (int[])command.Args[0];
int[] numerators = (int[])command.Args[1];
@@ -238,57 +265,57 @@ namespace Boare.Lib.Vsq {
for ( int i = 0; i < barcounts.Length; i++ ) {
int index = -1;
// すでに拍子が登録されているかどうかを検査
- int timesig_table_count = TimesigTable.Count;
+ int timesig_table_count = TimesigTable.size();
for ( int j = 0; j < timesig_table_count; j++ ) {
- if ( TimesigTable[j].BarCount == barcounts[i] ) {
+ if ( TimesigTable.get( j ).BarCount == barcounts[i] ) {
index = j;
break;
}
}
if ( index >= 0 ) {
// 登録されている場合
- new_numerators[i] = TimesigTable[index].Numerator;
- new_denominators[i] = TimesigTable[index].Denominator;
+ new_numerators[i] = TimesigTable.get( index ).Numerator;
+ new_denominators[i] = TimesigTable.get( index ).Denominator;
if ( numerators[i] <= 0 ) {
- TimesigTable.RemoveAt( index );
+ TimesigTable.removeElementAt( index );
} else {
- TimesigTable[index].BarCount = new_barcounts[i];
- TimesigTable[index].Numerator = numerators[i];
- TimesigTable[index].Denominator = denominators[i];
+ TimesigTable.get( index ).BarCount = new_barcounts[i];
+ TimesigTable.get( index ).Numerator = numerators[i];
+ TimesigTable.get( index ).Denominator = denominators[i];
}
} else {
// 登録されていない場合
new_numerators[i] = -1;
new_denominators[i] = -1;
- TimesigTable.Add( new TimeSigTableEntry( 0, numerators[i], denominators[i], new_barcounts[i] ) );
+ TimesigTable.add( new TimeSigTableEntry( 0, numerators[i], denominators[i], new_barcounts[i] ) );
}
}
updateTimesigInfo();
updateTotalClocks();
return VsqCommand.generateCommandUpdateTimesigRange( new_barcounts, barcounts, new_numerators, new_denominators );
#endregion
- } else if ( type == VsqCommandType.Replace ) {
+ } else if ( type == VsqCommandType.REPLACE ) {
#region Replace
VsqFile vsq = (VsqFile)command.Args[0];
VsqFile inv = (VsqFile)this.Clone();
- Track.Clear();
- int track_count = vsq.Track.Count;
+ Track.clear();
+ int track_count = vsq.Track.size();
for ( int i = 0; i < track_count; i++ ) {
- Track.Add( (VsqTrack)vsq.Track[i].Clone() );
+ Track.add( (VsqTrack)vsq.Track.get( i ).Clone() );
}
#if USE_TEMPO_LIST
m_tempo_table = (TempoTable)vsq.m_tempo_table.Clone();
#else
- TempoTable.Clear();
- int tempo_table_count = vsq.TempoTable.Count;
+ TempoTable.clear();
+ int tempo_table_count = vsq.TempoTable.size();
for ( int i = 0; i < tempo_table_count; i++ ) {
- TempoTable.Add( (TempoTableEntry)vsq.TempoTable[i].Clone() );
+ TempoTable.add( (TempoTableEntry)vsq.TempoTable.get( i ).Clone() );
}
#endif
- TimesigTable.Clear();
- int timesig_table_count = vsq.TimesigTable.Count;
+ TimesigTable.clear();
+ int timesig_table_count = vsq.TimesigTable.size();
for ( int i = 0; i < timesig_table_count; i++ ) {
- TimesigTable.Add( (TimeSigTableEntry)vsq.TimesigTable[i].Clone() );
+ TimesigTable.add( (TimeSigTableEntry)vsq.TimesigTable.get( i ).Clone() );
}
m_tpq = vsq.m_tpq;
TotalClocks = vsq.TotalClocks;
@@ -298,65 +325,65 @@ namespace Boare.Lib.Vsq {
updateTotalClocks();
return VsqCommand.generateCommandReplace( inv );
#endregion
- } else if ( type == VsqCommandType.EventAdd ) {
+ } else if ( type == VsqCommandType.EVENT_ADD ) {
#region EventAdd
int track = (int)command.Args[0];
VsqEvent item = (VsqEvent)command.Args[1];
- Track[track].addEvent( item );
+ Track.get( track ).addEvent( item );
VsqCommand ret = VsqCommand.generateCommandEventDelete( track, item.InternalID );
updateTotalClocks();
- if ( item.Clock < Track[track].getEditedStart() ) {
- Track[track].setEditedStart( item.Clock );
+ if ( item.Clock < Track.get( track ).getEditedStart() ) {
+ Track.get( track ).setEditedStart( item.Clock );
}
- if ( Track[track].getEditedEnd() < item.Clock + item.ID.Length ) {
- Track[track].setEditedEnd( item.Clock + item.ID.Length );
+ if ( Track.get( track ).getEditedEnd() < item.Clock + item.ID.Length ) {
+ Track.get( track ).setEditedEnd( item.Clock + item.ID.Length );
}
- Track[track].sortEvent();
+ Track.get( track ).sortEvent();
return ret;
#endregion
- } else if ( type == VsqCommandType.EventAddRange ) {
+ } else if ( type == VsqCommandType.EVENT_ADD_RANGE ) {
#region TrackAddNoteRange
#if DEBUG
Console.WriteLine( " TrackAddNoteRange" );
#endif
int track = (int)command.Args[0];
VsqEvent[] items = (VsqEvent[])command.Args[1];
- List inv_ids = new List();
+ Vector inv_ids = new Vector();
int min_clock = (int)TotalClocks;
int max_clock = 0;
for ( int i = 0; i < items.Length; i++ ) {
- VsqEvent item = (VsqEvent)items[i].Clone();
+ VsqEvent item = (VsqEvent)items[i].clone();
min_clock = Math.Min( min_clock, item.Clock );
max_clock = Math.Max( max_clock, item.Clock + item.ID.Length );
#if DEBUG
Console.Write( " i=" + i + "; item.InternalID=" + item.InternalID );
#endif
- Track[track].addEvent( item );
- inv_ids.Add( item.InternalID );
+ Track.get( track ).addEvent( item );
+ inv_ids.add( item.InternalID );
#if DEBUG
Console.WriteLine( " => " + item.InternalID );
#endif
}
updateTotalClocks();
- if ( min_clock < Track[track].getEditedStart() ) {
- Track[track].setEditedStart( min_clock );
+ if ( min_clock < Track.get( track ).getEditedStart() ) {
+ Track.get( track ).setEditedStart( min_clock );
}
- if ( Track[track].getEditedEnd() < max_clock ) {
- Track[track].setEditedEnd( max_clock );
+ if ( Track.get( track ).getEditedEnd() < max_clock ) {
+ Track.get( track ).setEditedEnd( max_clock );
}
- Track[track].sortEvent();
- return VsqCommand.generateCommandEventDeleteRange( track, inv_ids.ToArray() );
+ Track.get( track ).sortEvent();
+ return VsqCommand.generateCommandEventDeleteRange( track, inv_ids.toArray( new Integer[]{} ) );
#endregion
- } else if ( type == VsqCommandType.EventDelete ) {
+ } else if ( type == VsqCommandType.EVENT_DELETE ) {
#region TrackDeleteNote
int internal_id = (int)command.Args[0];
int track = (int)command.Args[1];
VsqEvent[] original = new VsqEvent[1];
- VsqTrack target = Track[track];
+ VsqTrack target = Track.get( track );
for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) {
VsqEvent item = (VsqEvent)itr.next();
if ( item.InternalID == internal_id ) {
- original[0] = (VsqEvent)item.Clone();
+ original[0] = (VsqEvent)item.clone();
break;
}
}
@@ -377,19 +404,19 @@ namespace Boare.Lib.Vsq {
updateTotalClocks();
return ret;
#endregion
- } else if ( type == VsqCommandType.EventDeleteRange ) {
+ } else if ( type == VsqCommandType.EVENT_DELETE_RANGE ) {
#region TrackDeleteNoteRange
int[] internal_ids = (int[])command.Args[0];
int track = (int)command.Args[1];
- List inv = new List();
+ Vector inv = new Vector();
int min_clock = int.MaxValue;
int max_clock = int.MinValue;
- VsqTrack target = this.Track[track];
+ VsqTrack target = this.Track.get( track );
for ( int j = 0; j < internal_ids.Length; j++ ) {
for ( int i = 0; i < target.getEventCount(); i++ ) {
VsqEvent item = target.getEvent( i );
if ( internal_ids[j] == item.InternalID ) {
- inv.Add( (VsqEvent)item.Clone() );
+ inv.add( (VsqEvent)item.clone() );
min_clock = Math.Min( min_clock, item.Clock );
max_clock = Math.Max( max_clock, item.Clock + item.ID.Length );
target.removeEvent( i );
@@ -400,14 +427,14 @@ namespace Boare.Lib.Vsq {
updateTotalClocks();
target.setEditedStart( min_clock );
target.setEditedEnd( max_clock );
- return VsqCommand.generateCommandEventAddRange( track, inv.ToArray() );
+ return VsqCommand.generateCommandEventAddRange( track, inv.toArray( new VsqEvent[]{} ) );
#endregion
- } else if ( type == VsqCommandType.EventChangeClock ) {
+ } else if ( type == VsqCommandType.EVENT_CHANGE_CLOCK ) {
#region TrackChangeClock
int track = (int)command.Args[0];
int internal_id = (int)command.Args[1];
int value = (int)command.Args[2];
- VsqTrack target = this.Track[track];
+ VsqTrack target = this.Track.get( track );
for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) {
VsqEvent item = (VsqEvent)itr.next();
if ( item.InternalID == internal_id ) {
@@ -423,14 +450,14 @@ namespace Boare.Lib.Vsq {
}
return null;
#endregion
- } else if ( type == VsqCommandType.EventChangeLyric ) {
+ } else if ( type == VsqCommandType.EVENT_CHANGE_LYRIC ) {
#region TrackChangeLyric
int track = (int)command.Args[0];
int internal_id = (int)command.Args[1];
- string phrase = (string)command.Args[2];
- string phonetic_symbol = (string)command.Args[3];
- bool protect_symbol = (bool)command.Args[4];
- VsqTrack target = this.Track[track];
+ String phrase = (String)command.Args[2];
+ String phonetic_symbol = (String)command.Args[3];
+ boolean protect_symbol = (boolean)command.Args[4];
+ VsqTrack target = this.Track.get( track );
for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) {
VsqEvent item = (VsqEvent)itr.next();
if ( item.InternalID == internal_id ) {
@@ -448,12 +475,12 @@ namespace Boare.Lib.Vsq {
}
return null;
#endregion
- } else if ( type == VsqCommandType.EventChangeNote ) {
+ } else if ( type == VsqCommandType.EVENT_CHANGE_NOTE ) {
#region TrackChangeNote
int track = (int)command.Args[0];
int internal_id = (int)command.Args[1];
int note = (int)command.Args[2];
- VsqTrack target = this.Track[track];
+ VsqTrack target = this.Track.get( track );
for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) {
VsqEvent item = (VsqEvent)itr.next();
if ( item.InternalID == internal_id ) {
@@ -467,13 +494,13 @@ namespace Boare.Lib.Vsq {
}
return null;
#endregion
- } else if ( type == VsqCommandType.EventChangeClockAndNote ) {
+ } else if ( type == VsqCommandType.EVENT_CHANGE_CLOCK_AND_NOTE ) {
#region TrackChangeClockAndNote
int track = (int)command.Args[0];
int internal_id = (int)command.Args[1];
int clock = (int)command.Args[2];
int note = (int)command.Args[3];
- VsqTrack target = this.Track[track];
+ VsqTrack target = this.Track.get( track );
for ( Iterator itr = target.getEventIterator(); itr.hasNext(); ) {
VsqEvent item = (VsqEvent)itr.next();
if ( item.InternalID == internal_id ) {
@@ -490,274 +517,314 @@ namespace Boare.Lib.Vsq {
}
return null;
#endregion
- } else if ( type == VsqCommandType.TrackEditCurve ) {
- #region TrackEditCurve
+ } else if ( type == VsqCommandType.TRACK_CURVE_EDIT ) {
+ #region TRACK_CURVE_EDIT
int track = (int)command.Args[0];
- string curve = (string)command.Args[1];
- List com = (List)command.Args[2];
+ String curve = (String)command.Args[1];
+ Vector com = (Vector)command.Args[2];
VsqCommand inv = null;
- List edit = new List();
+ Vector edit = new Vector();
+ VsqBPList target_list = Track.get( track ).getCurve( curve );
if ( com != null ) {
- if ( com.Count > 0 ) {
- int start_clock = com[0].Clock;
- int end_clock = com[0].Clock;
- foreach ( BPPair item in com ) {
+ if ( com.size() > 0 ) {
+ int start_clock = com.get( 0 ).Clock;
+ int end_clock = com.get( 0 ).Clock;
+ for ( Iterator itr = com.iterator(); itr.hasNext(); ){
+ BPPair item = (BPPair)itr.next();
start_clock = Math.Min( start_clock, item.Clock );
end_clock = Math.Max( end_clock, item.Clock );
}
- Track[track].setEditedStart( start_clock );
- Track[track].setEditedEnd( end_clock );
- int start_value = Track[track].getCurve( curve ).getValue( start_clock );
- int end_value = Track[track].getCurve( curve ).getValue( end_clock );
- for ( Iterator i = Track[track].getCurve( curve ).keyClockIterator(); i.hasNext(); ){
+ Track.get( track ).setEditedStart( start_clock );
+ Track.get( track ).setEditedEnd( end_clock );
+ int start_value = target_list.getValue( start_clock );
+ int end_value = target_list.getValue( end_clock );
+ for ( Iterator i = target_list.keyClockIterator(); i.hasNext(); ){
int clock = (int)i.next();
if ( start_clock <= clock && clock <= end_clock ) {
- edit.Add( new BPPair( clock, Track[track].getCurve( curve ).getValue( clock ) ) );
+ edit.add( new BPPair( clock, target_list.getValue( clock ) ) );
}
}
- bool start_found = false;
- bool end_found = false;
- for ( int i = 0; i < edit.Count; i++ ) {
- if ( edit[i].Clock == start_clock ) {
+ boolean start_found = false;
+ boolean end_found = false;
+ int count = edit.size();
+ for ( int i = 0; i < count; i++ ) {
+ if ( edit.get( i ).Clock == start_clock ) {
start_found = true;
- edit[i].Value = start_value;
+ edit.get( i ).Value = start_value;
if ( start_found && end_found ) {
break;
}
}
- if ( edit[i].Clock == end_clock ) {
+ if ( edit.get( i ).Clock == end_clock ) {
end_found = true;
- edit[i].Value = end_value;
+ edit.get( i ).Value = end_value;
if ( start_found && end_found ) {
break;
}
}
}
if ( !start_found ) {
- edit.Add( new BPPair( start_clock, start_value ) );
+ edit.add( new BPPair( start_clock, start_value ) );
}
if ( !end_found ) {
- edit.Add( new BPPair( end_clock, end_value ) );
+ edit.add( new BPPair( end_clock, end_value ) );
}
// 並べ替え
- edit.Sort();
- inv = VsqCommand.generateCommandTrackEditCurve( track, curve, edit );
- } else if ( com.Count == 0 ) {
- inv = VsqCommand.generateCommandTrackEditCurve( track, curve, new List() );
+ Collections.sort( edit );
+ inv = VsqCommand.generateCommandTrackCurveEdit( track, curve, edit );
+ } else if ( com.size() == 0 ) {
+ inv = VsqCommand.generateCommandTrackCurveEdit( track, curve, new Vector() );
}
}
updateTotalClocks();
- if ( com.Count == 0 ) {
+ if ( com.size() == 0 ) {
return inv;
- } else if ( com.Count == 1 ) {
- bool found = false;
- for ( Iterator itr = Track[track].getCurve( curve ).keyClockIterator(); itr.hasNext(); ){
+ } else if ( com.size() == 1 ) {
+ boolean found = false;
+ for ( Iterator itr = target_list.keyClockIterator(); itr.hasNext(); ){
int clock = (int)itr.next();
- if ( clock == com[0].Clock ) {
+ if ( clock == com.get( 0 ).Clock ) {
found = true;
- Track[track].getCurve( curve ).add( clock, com[0].Value );
+ target_list.add( clock, com.get( 0 ).Value );
break;
}
}
if ( !found ) {
- Track[track].getCurve( curve ).add( com[0].Clock, com[0].Value );
+ target_list.add( com.get( 0 ).Clock, com.get( 0 ).Value );
}
} else {
- int start_clock = com[0].Clock;
- int end_clock = com[com.Count - 1].Clock;
- bool removed = true;
+ int start_clock = com.get( 0 ).Clock;
+ int end_clock = com.get( com.size() - 1 ).Clock;
+ boolean removed = true;
while ( removed ) {
removed = false;
- for ( Iterator itr = Track[track].getCurve( curve ).keyClockIterator(); itr.hasNext(); ) {
+ for ( Iterator itr = target_list.keyClockIterator(); itr.hasNext(); ) {
int clock = (int)itr.next();
if ( start_clock <= clock && clock <= end_clock ) {
- Track[track].getCurve( curve ).remove( clock );
+ target_list.remove( clock );
removed = true;
break;
}
}
}
- foreach ( BPPair item in com ) {
- Track[track].getCurve( curve ).add( item.Clock, item.Value );
+ for ( Iterator itr = com.iterator(); itr.hasNext(); ){
+ BPPair item = (BPPair)itr.next();
+ target_list.add( item.Clock, item.Value );
}
}
return inv;
#endregion
- } else if ( type == VsqCommandType.TrackEditCurveRange ) {
+ } else if ( type == VsqCommandType.TRACK_CURVE_REPLACE ) {
+ #region TRACK_CURVE_REPLACE
+ int track = (int)command.Args[0];
+ String target_curve = (String)command.Args[1];
+ VsqBPList bplist = (VsqBPList)command.Args[2];
+ VsqCommand inv = VsqCommand.generateCommandTrackCurveReplace( track, target_curve, Track.get( track ).getCurve( target_curve ) );
+ Track.get( track ).setCurve( target_curve, bplist );
+ return inv;
+ #endregion
+ } else if ( type == VsqCommandType.TRACK_CURVE_REPLACE_RANGE ) {
+ #region TRACK_CURVE_REPLACE_RANGE
+ int track = (int)command.Args[0];
+ String[] target_curve = (String[])command.Args[1];
+ VsqBPList[] bplist = (VsqBPList[])command.Args[2];
+ VsqBPList[] inv_bplist = new VsqBPList[bplist.Length];
+ VsqTrack work = Track.get( track );
+ for ( int i = 0; i < target_curve.Length; i++ ) {
+ inv_bplist[i] = work.getCurve( target_curve[i] );
+ }
+ VsqCommand inv = VsqCommand.generateCommandTrackCurveReplaceRange( track, target_curve, inv_bplist );
+ for ( int i = 0; i < target_curve.Length; i++ ) {
+ work.setCurve( target_curve[i], bplist[i] );
+ }
+ return inv;
+ #endregion
+ } else if ( type == VsqCommandType.TRACK_CURVE_EDIT_RANGE ) {
#region TrackEditCurveRange
int track = (int)command.Args[0];
- string[] curves = (string[])command.Args[1];
- List[] coms = (List