mirror of
https://git.femboyfinancial.jp/james/lipsync.git
synced 2025-01-17 20:39:04 -08:00
git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@14 b1f601f4-4f45-0410-8980-aecacb008692
This commit is contained in:
parent
c143ea3286
commit
c089432c27
@ -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 { }
|
||||
|
@ -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
|
||||
|
||||
/// <summary>
|
||||
/// Stores the paired value of "Clock" and integer. Mainly used in VsqBPList
|
||||
/// </summary>
|
||||
#if JAVA
|
||||
class BPPair implements Comparable<BPPair> {
|
||||
#else
|
||||
[Serializable]
|
||||
public class BPPair : IComparable<BPPair> {
|
||||
#endif
|
||||
public int Clock;
|
||||
public int Value;
|
||||
|
||||
@ -28,7 +36,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
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_;
|
||||
|
@ -81,6 +81,7 @@
|
||||
<Compile Include="VibratoType.cs" />
|
||||
<Compile Include="VocaloSysUtil.cs" />
|
||||
<Compile Include="VsqBPPair.cs" />
|
||||
<Compile Include="VsqBPPairSearchContext.cs" />
|
||||
<Compile Include="VsqEventList.cs" />
|
||||
<Compile Include="VsqNrpn.cs" />
|
||||
<Compile Include="NrpnData.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<VibratoConfig> m_vibrato_configs;
|
||||
private List<AttackConfig> m_attack_configs;
|
||||
private Vector<VibratoConfig> m_vibrato_configs;
|
||||
private Vector<AttackConfig> m_attack_configs;
|
||||
|
||||
public ExpressionConfigSys( String path_expdb ) {
|
||||
m_vibrato_configs = new List<VibratoConfig>();
|
||||
m_attack_configs = new List<AttackConfig>();
|
||||
m_vibrato_configs = new Vector<VibratoConfig>();
|
||||
m_attack_configs = new Vector<AttackConfig>();
|
||||
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 ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
/// <summary>
|
||||
/// (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<ushort> nrpns = new List<ushort>();
|
||||
private Vector<ushort> nrpns = new Vector<ushort>();
|
||||
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 {
|
||||
/// </summary>
|
||||
/// <param name="curve_name"></param>
|
||||
/// <returns></returns>
|
||||
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:
|
||||
|
@ -14,56 +14,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
public class Vector<T> : List<T> {
|
||||
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<T> : Iterator {
|
||||
private List<T> m_list;
|
||||
private int m_pos;
|
||||
|
||||
public ListIterator( List<T> 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 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,8 +15,12 @@ using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
/// <summary>
|
||||
/// midiイベント。メタイベントは、メタイベントのデータ長をData[1]に格納せず、生のデータをDataに格納するので、注意が必要
|
||||
/// </summary>
|
||||
@ -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<List<MidiEvent>> m_events;
|
||||
private Vector<Vector<MidiEvent>> 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<List<MidiEvent>>();
|
||||
m_events = new Vector<Vector<MidiEvent>>();
|
||||
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<MidiEvent>() );
|
||||
m_events.add( new Vector<MidiEvent>() );
|
||||
|
||||
// チャンクサイズ
|
||||
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<MidiEvent> getMidiEventList( int track ) {
|
||||
public Vector<MidiEvent> getMidiEventList( int track ) {
|
||||
if ( m_events == null ) {
|
||||
return new List<MidiEvent>();
|
||||
} else if ( 0 <= track && track < m_events.Count ) {
|
||||
return m_events[track];
|
||||
return new Vector<MidiEvent>();
|
||||
} else if ( 0 <= track && track < m_events.size() ) {
|
||||
return m_events.get( track );
|
||||
} else {
|
||||
return new List<MidiEvent>();
|
||||
return new Vector<MidiEvent>();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
/// <param name="s"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
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<string> ret = new List<string>();
|
||||
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<String> ret = new Vector<String>();
|
||||
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;
|
||||
|
@ -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<SingerConfig> m_installed_singers = new List<SingerConfig>();
|
||||
private List<SingerConfig> m_singer_configs = new List<SingerConfig>();
|
||||
private Vector<SingerConfig> m_installed_singers = new Vector<SingerConfig>();
|
||||
private Vector<SingerConfig> m_singer_configs = new Vector<SingerConfig>();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="path_voicedb">音源のデータディレクトリ(ex:"C:\Program Files\VOCALOID2\voicedbdir")</param>
|
||||
/// <param name="path_installed_singers">音源のインストールディレクトリ(ex:new string[]{ "C:\Program Files\VOCALOID2\voicedbdir\BXXXXXXXXXXXXXXX", "D:\singers\BNXXXXXXXXXX" })</param>
|
||||
public SingerConfigSys( string path_voicedb, string[] path_installed_singers ) {
|
||||
m_installed_singers = new List<SingerConfig>();
|
||||
m_singer_configs = new List<SingerConfig>();
|
||||
/// <param name="path_installed_singers">音源のインストールディレクトリ(ex:new String[]{ "C:\Program Files\VOCALOID2\voicedbdir\BXXXXXXXXXXXXXXX", "D:\singers\BNXXXXXXXXXX" })</param>
|
||||
public SingerConfigSys( String path_voicedb, String[] path_installed_singers ) {
|
||||
m_installed_singers = new Vector<SingerConfig>();
|
||||
m_singer_configs = new Vector<SingerConfig>();
|
||||
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[]{} );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -84,13 +87,13 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="program_change"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// </summary>
|
||||
/// <param name="program_change"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SingerConfig[] getSingerConfigs() {
|
||||
return m_singer_configs.ToArray();
|
||||
return m_singer_configs.toArray( new SingerConfig[]{} );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,16 +21,18 @@ using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
public class SymbolTable : ICloneable {
|
||||
private Dictionary<string, string> m_dict;
|
||||
private string m_name;
|
||||
private bool m_enabled;
|
||||
private TreeMap<String, String> m_dict;
|
||||
private String m_name;
|
||||
private boolean m_enabled;
|
||||
|
||||
#region Static Field
|
||||
private static SortedList<int, SymbolTable> s_table = new SortedList<int, SymbolTable>();
|
||||
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<string, bool>[] list ) {
|
||||
public static void changeOrder( KeyValuePair<String, boolean>[] 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<string, string>();
|
||||
foreach ( string key in m_dict.Keys ) {
|
||||
ret.m_dict.Add( key, m_dict[key] );
|
||||
ret.m_dict = new TreeMap<String, String>();
|
||||
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<string, string>();
|
||||
public SymbolTable( String path, boolean is_udc_mode, boolean enabled ) {
|
||||
m_dict = new TreeMap<String, String>();
|
||||
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<string, string>();
|
||||
m_dict = new TreeMap<String, String>();
|
||||
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] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<TempoTableEntry> {
|
||||
public int Clock;
|
||||
@ -33,7 +37,7 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
}
|
||||
|
||||
private List<TempoTableEntry> m_tempo_table;
|
||||
private Vector<TempoTableEntry> 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<TempoTableEntry>();
|
||||
m_tempo_table.Add( new TempoTableEntry( 0, base_tempo, 0.0 ) );
|
||||
m_tempo_table = new Vector<TempoTableEntry>();
|
||||
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<TempoTableEntry>();
|
||||
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<TempoTableEntry>();
|
||||
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 {
|
||||
/// <param name="clock"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
|
@ -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<string> m_lines;
|
||||
private Vector<String> m_lines;
|
||||
private int m_index;
|
||||
|
||||
public TextMemoryStream() {
|
||||
m_lines = new List<string>();
|
||||
m_lines.Add( "" );
|
||||
m_lines = new Vector<String>();
|
||||
m_lines.add( "" );
|
||||
m_index = 0;
|
||||
}
|
||||
|
||||
public TextMemoryStream( string path, Encoding encoding ) {
|
||||
m_lines = new List<string>();
|
||||
public TextMemoryStream( String path, Encoding encoding ) {
|
||||
m_lines = new Vector<String>();
|
||||
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<string> lines2 = new List<string>();
|
||||
private void appendString( String value ) {
|
||||
String[] lines = value.Split( new String[] { NL }, StringSplitOptions.None );
|
||||
Vector<String> lines2 = new Vector<String>();
|
||||
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() {
|
||||
|
@ -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 + "}";
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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<UstTrack> m_tracks = new List<UstTrack>();
|
||||
private List<TempoTableEntry> 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<UstTrack> m_tracks = new Vector<UstTrack>();
|
||||
private Vector<TempoTableEntry> 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(); // "[#" ’¼‰º‚Ì<E2809A>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(); // "[#" ’¼‰º‚Ì<E2809A>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<TempoTableEntry> getTempoList() {
|
||||
public Vector<TempoTableEntry> 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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -197,31 +234,31 @@ namespace Boare.Lib.Vsq{
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void updateTempoInfo() {
|
||||
m_tempo_table = new List<TempoTableEntry>();
|
||||
if ( m_tracks.Count <= 0 ) {
|
||||
m_tempo_table = new Vector<TempoTableEntry>();
|
||||
if ( m_tracks.size() <= 0 ) {
|
||||
return;
|
||||
}
|
||||
int clock = 0;
|
||||
double time = 0.0;
|
||||
int last_tempo_clock = 0; //最後にTempo値が代入されていたイベントのクロック
|
||||
float last_tempo = m_tempo; //最後に代入されていたテンポの値
|
||||
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{
|
||||
/// <param name="clock"></param>
|
||||
/// <returns></returns>
|
||||
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<TempoTableEntry>();
|
||||
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<TempoTableEntry>();
|
||||
for ( int i = 0; i < m_tempo_table.size(); i++ ) {
|
||||
ret.m_tempo_table.add( (TempoTableEntry)m_tempo_table.get( i ).Clone() );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -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<UstPortamentoPoint> Points = new List<UstPortamentoPoint>();
|
||||
public Vector<UstPortamentoPoint> Points = new Vector<UstPortamentoPoint>();
|
||||
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=" ) ) {
|
||||
|
||||
|
@ -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<UstEvent> m_events;
|
||||
private Vector<UstEvent> m_events;
|
||||
|
||||
public UstTrack(){
|
||||
m_events = new List<UstEvent>();
|
||||
m_events = new Vector<UstEvent>();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -14,14 +14,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
[Serializable]
|
||||
public class VibratoBPList : ICloneable {
|
||||
private List<VibratoBPPair> m_list;
|
||||
private Vector<VibratoBPPair> m_list;
|
||||
|
||||
public VibratoBPList() {
|
||||
m_list = new List<VibratoBPPair>();
|
||||
m_list = new Vector<VibratoBPPair>();
|
||||
}
|
||||
|
||||
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<VibratoBPPair>( len );
|
||||
m_list = new Vector<VibratoBPPair>( 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 );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// XMLシリアライズ用
|
||||
/// </summary>
|
||||
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] ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,8 @@
|
||||
*/
|
||||
using System;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
/// <summary>
|
||||
@ -94,7 +96,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="icon_id"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <param name="value"></param>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// string str = VibratoTypeUtil.ToString( VibratoType.NormalType1 );
|
||||
/// String str = VibratoTypeUtil.ToString( VibratoType.NormalType1 );
|
||||
/// // str = "[Normal] Type 1"
|
||||
/// </code>
|
||||
/// </example>
|
||||
/// <returns></returns>
|
||||
public static string ToString( VibratoType value ) {
|
||||
public static String ToString( VibratoType value ) {
|
||||
switch ( value ) {
|
||||
case VibratoType.NormalType1:
|
||||
return "[Normal] Type 1";
|
||||
|
@ -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<String> dir1 = new Vector<String>();
|
||||
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<String> installed_singers1 = new Vector<String>();
|
||||
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<String> dir1 = new Vector<String>();
|
||||
RegistryKey key1 = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID", false );
|
||||
String path_voicedb1 = "";
|
||||
String path_expdb1 = "";
|
||||
Vector<String> installed_singers1 = new Vector<String>();
|
||||
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<String> dir2 = new Vector<String>();
|
||||
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<String> installed_singers2 = new Vector<String>();
|
||||
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<String> dir2 = new Vector<String>();
|
||||
RegistryKey key2 = Registry.LocalMachine.OpenSubKey( "SOFTWARE\\VOCALOID2", false );
|
||||
String path_voicedb2 = "";
|
||||
String path_expdb2 = "";
|
||||
Vector<String> installed_singers2 = new Vector<String>();
|
||||
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<String> 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<String> voice_ids = new Vector<String>();
|
||||
// 最初は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<String> exp_ids = new Vector<String>();
|
||||
// 最初は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<String> 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 {
|
||||
/// <param name="singer"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <param name="singer"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// </summary>
|
||||
/// <param name="name">name of singer</param>
|
||||
/// <returns></returns>
|
||||
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<SingerConfig> s_installed_singers2 = new List<SingerConfig>();
|
||||
private static List<SingerConfig> s_singer_configs2 = new List<SingerConfig>();
|
||||
private static String s_dll_path2 = "";
|
||||
private static String s_editor_path2 = "";
|
||||
private static String s_voicedbdir2 = "";
|
||||
private static Vector<SingerConfig> s_installed_singers2 = new Vector<SingerConfig>();
|
||||
private static Vector<SingerConfig> s_singer_configs2 = new Vector<SingerConfig>();
|
||||
|
||||
private static string s_dll_path1 = "";
|
||||
private static string s_editor_path1 = "";
|
||||
private static string s_voicedbdir1 = "";
|
||||
private static List<SingerConfig> s_installed_singers1 = new List<SingerConfig>();
|
||||
private static List<SingerConfig> s_singer_configs1 = new List<SingerConfig>();
|
||||
private static String s_dll_path1 = "";
|
||||
private static String s_editor_path1 = "";
|
||||
private static String s_voicedbdir1 = "";
|
||||
private static Vector<SingerConfig> s_installed_singers1 = new Vector<SingerConfig>();
|
||||
private static Vector<SingerConfig> s_singer_configs1 = new Vector<SingerConfig>();
|
||||
|
||||
private const int MAX_SINGERS = 0x4000;
|
||||
|
||||
@ -368,19 +397,19 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="singer"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// </summary>
|
||||
/// <param name="singer"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// </summary>
|
||||
/// <param name="name">name of singer</param>
|
||||
/// <returns></returns>
|
||||
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<string> vvoice_keys = new List<string>();
|
||||
List<SingerConfig> vvoice_values = new List<SingerConfig>();
|
||||
foreach ( string voiceidstr in singer_voiceidstrs ) {
|
||||
String[] singer_voiceidstrs = v1database.GetSubKeyNames();
|
||||
Vector<String> vvoice_keys = new Vector<String>();
|
||||
Vector<SingerConfig> vvoice_values = new Vector<SingerConfig>();
|
||||
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<string> vvoice_keys = new List<string>();
|
||||
List<SingerConfig> vvoice_values = new List<SingerConfig>();
|
||||
foreach ( string voiceidstr in singer_voiceidstrs ) {
|
||||
String[] singer_voiceidstrs = v2database.GetSubKeyNames();
|
||||
Vector<String> vvoice_keys = new Vector<String>();
|
||||
Vector<SingerConfig> vvoice_values = new Vector<SingerConfig>();
|
||||
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
|
||||
|
@ -16,17 +16,21 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
/// <summary>
|
||||
/// BPListのデータ部分を取り扱うためのクラス。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class VsqBPList : ICloneable {
|
||||
private SortedList<int, VsqBPPair> m_list = new SortedList<int, VsqBPPair>();
|
||||
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;
|
||||
/// <summary>
|
||||
/// このリストに設定されたidの最大値.次にデータ点が追加されたときは,個の値+1がidとして利用される.削除された場合でも減らない
|
||||
/// </summary>
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// このBPListのデフォルト値を取得します
|
||||
/// </summary>
|
||||
public int getDefault() {
|
||||
return m_default;
|
||||
}
|
||||
|
||||
public void setDefault( int value ) {
|
||||
m_default = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// データ点のIDを一度クリアし,新たに番号付けを行います.
|
||||
/// IDは,Redo,Undo用コマンドが使用するため,このメソッドを呼ぶとRedo,Undo操作が破綻する.XMLからのデシリアライズ直後のみ使用するべき.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// XMLシリアライズ用
|
||||
/// </summary>
|
||||
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の同一コピーを作成します
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// コンストラクタ。デフォルト値はココで指定する。
|
||||
/// </summary>
|
||||
/// <param name="default_value"></param>
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// このリストに設定された最大値を取得します。
|
||||
/// </summary>
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// このリストに設定された最小値を取得します
|
||||
/// </summary>
|
||||
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<int> t = new List<int>();
|
||||
Vector<int> t = new Vector<int>();
|
||||
foreach( int key in m_list.Keys ){
|
||||
t.Add( key );
|
||||
t.add( key );
|
||||
}
|
||||
return t.ToArray();
|
||||
return t.toArray( new Int32[]{} );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 時刻clockのデータを時刻new_clockに移動します。
|
||||
/// 時刻clockにデータがなければ何もしない。
|
||||
/// 時刻new_clockに既にデータがある場合、既存のデータは削除される。
|
||||
/// </summary>
|
||||
/// <param name="clock"></param>
|
||||
/// <param name="new_clock"></param>
|
||||
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 {
|
||||
|
||||
/// <summary>
|
||||
/// 新しいデータ点を追加します。
|
||||
/// 戻り値に、新しいデータ点のIDを返します
|
||||
/// </summary>
|
||||
/// <param name="clock"></param>
|
||||
/// <param name="value"></param>
|
||||
public void add( int clock, int value ) {
|
||||
/// <returns></returns>
|
||||
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 ) {
|
||||
/// <summary>
|
||||
/// 指定したid値を持つVsqBPPairを検索し、その結果を返します。
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// このBPListのデフォルト値を取得します
|
||||
/// </summary>
|
||||
public int getDefault() {
|
||||
return Default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// このBPListの内容をテキストファイルに書き出します
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
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の内容をテキストファイルに書き出します
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
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 {
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <returns></returns>
|
||||
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 );
|
||||
|
@ -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_;
|
||||
}
|
||||
|
9
trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs
Normal file
9
trunk/Boare.Lib.Vsq/VsqBPPairSearchContext.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
public class VsqBPPairSearchContext {
|
||||
public int clock;
|
||||
public int index;
|
||||
public VsqBPPair point;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -29,7 +35,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// <summary>
|
||||
/// 後続するコマンド
|
||||
/// </summary>
|
||||
public List<VsqCommand> Children = new List<VsqCommand>();
|
||||
public Vector<VsqCommand> Children = new Vector<VsqCommand>();
|
||||
/// <summary>
|
||||
/// このコマンドの親
|
||||
/// </summary>
|
||||
@ -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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <param name="track"></param>
|
||||
/// <param name="new_name"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <param name="track"></param>
|
||||
/// <param name="velocity"></param>
|
||||
/// <returns></returns>
|
||||
public static VsqCommand generateCommandEventChangeVelocity( int track, List<KeyValuePair<int, int>> velocity ) {
|
||||
public static VsqCommand generateCommandEventChangeVelocity( int track, Vector<KeyValuePair<Integer, Integer>> 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<KeyValuePair<int, int>> list = new List<KeyValuePair<int, int>>();
|
||||
foreach ( KeyValuePair<int, int> item in velocity ) {
|
||||
list.Add( new KeyValuePair<int, int>( item.Key, item.Value ) );
|
||||
Vector<KeyValuePair<Integer, Integer>> list = new Vector<KeyValuePair<Integer, Integer>>();
|
||||
for( Iterator itr = velocity.iterator(); itr.hasNext(); ){
|
||||
KeyValuePair<Int32, Int32> item = (KeyValuePair<Int32, Int32>)itr.next();
|
||||
list.add( new KeyValuePair<Integer, Integer>( 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 {
|
||||
/// <param name="track"></param>
|
||||
/// <param name="accent_list"></param>
|
||||
/// <returns></returns>
|
||||
public static VsqCommand generateCommandEventChangeAccent( int track, List<KeyValuePair<int, int>> accent_list ) {
|
||||
public static VsqCommand generateCommandEventChangeAccent( int track, Vector<KeyValuePair<Integer, Integer>> 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<KeyValuePair<int, int>> list = new List<KeyValuePair<int, int>>();
|
||||
foreach ( KeyValuePair<int, int> item in accent_list ) {
|
||||
list.Add( new KeyValuePair<int, int>( item.Key, item.Value ) );
|
||||
Vector<KeyValuePair<Integer, Integer>> list = new Vector<KeyValuePair<Integer, Integer>>();
|
||||
for ( Iterator itr = accent_list.iterator(); itr.hasNext(); ){
|
||||
KeyValuePair<Int32, Int32> item = (KeyValuePair<Int32, Int32>)itr.next();
|
||||
list.add( new KeyValuePair<Integer, Integer>( item.Key, item.Value ) );
|
||||
}
|
||||
command.Args[1] = list;
|
||||
return command;
|
||||
@ -344,19 +352,65 @@ namespace Boare.Lib.Vsq {
|
||||
/// <param name="track"></param>
|
||||
/// <param name="decay_list"></param>
|
||||
/// <returns></returns>
|
||||
public static VsqCommand generateCommandEventChangeDecay( int track, List<KeyValuePair<int, int>> decay_list ) {
|
||||
public static VsqCommand generateCommandEventChangeDecay( int track, Vector<KeyValuePair<Integer, Integer>> 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<KeyValuePair<int, int>> list = new List<KeyValuePair<int, int>>();
|
||||
foreach ( KeyValuePair<int, int> item in decay_list ) {
|
||||
list.Add( new KeyValuePair<int, int>( item.Key, item.Value ) );
|
||||
Vector<KeyValuePair<Integer, Integer>> list = new Vector<KeyValuePair<Integer, Integer>>();
|
||||
for ( Iterator itr = decay_list.iterator(); itr.hasNext(); ){
|
||||
KeyValuePair<Integer, Integer> item = (KeyValuePair<Integer, Integer>)itr.next();
|
||||
list.add( new KeyValuePair<Integer, Integer>( 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<Long> 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<Long> cpy = new Vector<Long>();
|
||||
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;
|
||||
}*/
|
||||
|
||||
/// <summary>
|
||||
/// vsqファイルのカーブを編集するコマンドを発行します.
|
||||
/// </summary>
|
||||
@ -364,31 +418,33 @@ namespace Boare.Lib.Vsq {
|
||||
/// <param name="target"></param>
|
||||
/// <param name="edit"></param>
|
||||
/// <returns></returns>
|
||||
public static VsqCommand generateCommandTrackEditCurve( int track, string target, List<BPPair> edit ) {
|
||||
public static VsqCommand generateCommandTrackCurveEdit( int track, String target, Vector<BPPair> 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<BPPair> copied = new List<BPPair>();
|
||||
foreach ( BPPair item in edit ) {
|
||||
copied.Add( item );
|
||||
Vector<BPPair> copied = new Vector<BPPair>();
|
||||
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<BPPair>[] edits ) {
|
||||
public static VsqCommand generateCommandTrackCurveEditRange( int track, String[] targets, Vector<BPPair>[] 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<BPPair>[] cpy = new List<BPPair>[targets.Length];
|
||||
command.Args[1] = (String[])targets.Clone();
|
||||
Vector<BPPair>[] cpy = new Vector<BPPair>[targets.Length];
|
||||
for ( int i = 0; i < edits.Length; i++ ) {
|
||||
List<BPPair> copied = new List<BPPair>();
|
||||
foreach ( BPPair item in edits[i] ) {
|
||||
copied.Add( new BPPair( item.Clock, item.Value ) );
|
||||
Vector<BPPair> copied = new Vector<BPPair>();
|
||||
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 {
|
||||
/// <param name="phrase"></param>
|
||||
/// <param name="phonetic_symbol"></param>
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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 {
|
||||
/// <returns></returns>
|
||||
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;
|
||||
|
@ -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,
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,6 +13,8 @@
|
||||
*/
|
||||
using System;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
/// <summary>
|
||||
@ -20,7 +22,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class VsqEvent : IComparable<VsqEvent>, ICloneable {
|
||||
public string Tag;
|
||||
public String Tag;
|
||||
/// <summary>
|
||||
/// 内部で使用するインスタンス固有のID
|
||||
/// </summary>
|
||||
@ -33,8 +35,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// このオブジェクトのコピーを作成します
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
/// <summary>
|
||||
@ -21,19 +23,20 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class VsqEventList {
|
||||
public List<VsqEvent> Events;
|
||||
private List<int> m_ids;
|
||||
public Vector<VsqEvent> Events;
|
||||
private Vector<int> m_ids;
|
||||
|
||||
/// <summary>
|
||||
/// コンストラクタ
|
||||
/// </summary>
|
||||
public VsqEventList() {
|
||||
Events = new List<VsqEvent>();
|
||||
m_ids = new List<int>();
|
||||
Events = new Vector<VsqEvent>();
|
||||
m_ids = new Vector<int>();
|
||||
}
|
||||
|
||||
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<int> current = new List<int>( m_ids );
|
||||
Vector<int> current = new Vector<int>( 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,21 +17,25 @@ using System.Text;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
/// <summary>
|
||||
/// vsqファイルのメタテキストの[Common]セクションに記録される内容を取り扱う
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class VsqCommon : ICloneable {
|
||||
public string Version;
|
||||
public string Name;
|
||||
public string Color;
|
||||
public String Version;
|
||||
public String Name;
|
||||
public String Color;
|
||||
public int DynamicsMode;
|
||||
public int PlayMode;
|
||||
|
||||
public object Clone() {
|
||||
string[] spl = Color.Split( ",".ToCharArray(), 3 );
|
||||
String[] spl = Color.Split( ",".ToCharArray(), 3 );
|
||||
int r = int.Parse( spl[0] );
|
||||
int g = int.Parse( spl[1] );
|
||||
int b = int.Parse( spl[2] );
|
||||
@ -48,7 +52,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// <param name="color">Color値(意味は不明)</param>
|
||||
/// <param name="dynamics_mode">DynamicsMode(デフォルトは1)</param>
|
||||
/// <param name="play_mode">PlayMode(デフォルトは1)</param>
|
||||
public VsqCommon( string name, Color color, int dynamics_mode, int play_mode ) {
|
||||
public VsqCommon( String name, Color color, int dynamics_mode, int play_mode ) {
|
||||
this.Version = "DSB301";
|
||||
this.Name = name;
|
||||
this.Color = color.R + "," + color.G + "," + color.B;
|
||||
@ -65,14 +69,14 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="sr">読み込むテキストファイル</param>
|
||||
/// <param name="last_line">読み込んだ最後の行が返される</param>
|
||||
public VsqCommon( TextMemoryStream sr, ref string last_line ) {
|
||||
public VsqCommon( TextMemoryStream sr, ref String last_line ) {
|
||||
Version = "";
|
||||
Name = "";
|
||||
Color = "0,0,0";
|
||||
DynamicsMode = 0;
|
||||
PlayMode = 0;
|
||||
last_line = sr.readLine();
|
||||
string[] spl;
|
||||
String[] spl;
|
||||
while ( !last_line.StartsWith( "[" ) ) {
|
||||
spl = last_line.Split( new char[] { '=' } );
|
||||
switch ( spl[0] ) {
|
||||
@ -116,8 +120,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// VsqCommon構造体を構築するテストを行います
|
||||
/// </summary>
|
||||
/// <returns>テストに成功すればtrue、そうでなければfalse</returns>
|
||||
public static bool test() {
|
||||
string fpath = Path.GetTempFileName();
|
||||
public static boolean test() {
|
||||
String fpath = Path.GetTempFileName();
|
||||
StreamWriter sw = new StreamWriter( fpath, false, Encoding.Unicode );
|
||||
sw.WriteLine( "Version=DSB301" );
|
||||
sw.WriteLine( "Name=Voice1" );
|
||||
@ -128,18 +132,18 @@ namespace Boare.Lib.Vsq {
|
||||
sw.Close();
|
||||
|
||||
VsqCommon vsqCommon;
|
||||
string last_line = "";
|
||||
String last_line = "";
|
||||
using ( TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ) ) {
|
||||
vsqCommon = new VsqCommon( sr, ref last_line );
|
||||
}
|
||||
|
||||
bool result;
|
||||
if ( vsqCommon.Version == "DSB301" &&
|
||||
vsqCommon.Name == "Voice1" &&
|
||||
vsqCommon.Color == "181,162,123" &&
|
||||
boolean result;
|
||||
if ( vsqCommon.Version.Equals( "DSB301" ) &&
|
||||
vsqCommon.Name.Equals( "Voice1" ) &&
|
||||
vsqCommon.Color.Equals( "181,162,123" ) &&
|
||||
vsqCommon.DynamicsMode == 1 &&
|
||||
vsqCommon.PlayMode == 1 &&
|
||||
last_line == "[Master]" ) {
|
||||
last_line.Equals( "[Master]" ) ) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
|
@ -16,13 +16,17 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
[Serializable]
|
||||
public class IconHandle : ICloneable {
|
||||
public string Caption;
|
||||
public string IconID;
|
||||
public string IDS;
|
||||
public String Caption;
|
||||
public String IconID;
|
||||
public String IDS;
|
||||
public int Index;
|
||||
public int Length;
|
||||
public int Original;
|
||||
@ -72,7 +76,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="phrase">歌詞</param>
|
||||
/// <param name="phonetic_symbol">発音記号</param>
|
||||
public LyricHandle( string phrase, string phonetic_symbol ) {
|
||||
public LyricHandle( String phrase, String phonetic_symbol ) {
|
||||
L0 = new Lyric( phrase, phonetic_symbol );
|
||||
}
|
||||
|
||||
@ -100,10 +104,10 @@ namespace Boare.Lib.Vsq {
|
||||
public int StartRate;
|
||||
public VibratoBPList RateBP;
|
||||
public int Index;
|
||||
public string IconID;
|
||||
public string IDS;
|
||||
public String IconID;
|
||||
public String IDS;
|
||||
public int Original;
|
||||
public string Caption;
|
||||
public String Caption;
|
||||
public int Length;
|
||||
|
||||
public VibratoHandle(){
|
||||
@ -113,7 +117,7 @@ namespace Boare.Lib.Vsq {
|
||||
DepthBP = new VibratoBPList();
|
||||
}
|
||||
|
||||
/*public static VibratoHandle[] fromVED( string ved_file, int original ){
|
||||
/*public static VibratoHandle[] fromVED( String ved_file, int original ){
|
||||
|
||||
}*/
|
||||
|
||||
@ -152,10 +156,10 @@ namespace Boare.Lib.Vsq {
|
||||
[Serializable]
|
||||
public class NoteHeadHandle : ICloneable {
|
||||
public int Index;
|
||||
public string IconID;
|
||||
public string IDS;
|
||||
public String IconID;
|
||||
public String IDS;
|
||||
public int Original;
|
||||
public string Caption;
|
||||
public String Caption;
|
||||
public int Length;
|
||||
public int Duration;
|
||||
public int Depth;
|
||||
@ -198,11 +202,11 @@ namespace Boare.Lib.Vsq {
|
||||
public class VsqHandle {
|
||||
public VsqHandleType m_type;
|
||||
public int Index;
|
||||
public string IconID;
|
||||
public string IDS;
|
||||
public String IconID;
|
||||
public String IDS;
|
||||
public Lyric L0;
|
||||
public int Original;
|
||||
public string Caption;
|
||||
public String Caption;
|
||||
public int Length;
|
||||
public int StartDepth;
|
||||
public VibratoBPList DepthBP;
|
||||
@ -271,7 +275,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="sw">書き込み対象</param>
|
||||
/// <param name="encode">2バイト文字をエンコードするか否かを指定するフラグ</param>
|
||||
public void write( TextMemoryStream sw, bool encode ) {
|
||||
public void write( TextMemoryStream sw, boolean encode ) {
|
||||
sw.writeLine( this.ToString( encode ) );
|
||||
}
|
||||
|
||||
@ -279,10 +283,10 @@ namespace Boare.Lib.Vsq {
|
||||
/// FileStreamから読み込みながらコンストラクト
|
||||
/// </summary>
|
||||
/// <param name="sr">読み込み対象</param>
|
||||
public VsqHandle( TextMemoryStream sr, int value, ref string last_line ) {
|
||||
public VsqHandle( TextMemoryStream sr, int value, ref String last_line ) {
|
||||
this.Index = value;
|
||||
string[] spl;
|
||||
string[] spl2;
|
||||
String[] spl;
|
||||
String[] spl2;
|
||||
|
||||
// default値で梅
|
||||
m_type = VsqHandleType.Vibrato;
|
||||
@ -303,10 +307,10 @@ namespace Boare.Lib.Vsq {
|
||||
Duration = 0;
|
||||
Depth = 64;
|
||||
|
||||
string tmpDepthBPX = "";
|
||||
string tmpDepthBPY = "";
|
||||
string tmpRateBPX = "";
|
||||
string tmpRateBPY = "";
|
||||
String tmpDepthBPX = "";
|
||||
String tmpDepthBPY = "";
|
||||
String tmpRateBPX = "";
|
||||
String tmpRateBPY = "";
|
||||
|
||||
// "["にぶち当たるまで読込む
|
||||
last_line = sr.readLine();
|
||||
@ -439,8 +443,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="_string">ハンドル指定子</param>
|
||||
/// <returns>ハンドル番号</returns>
|
||||
public static int HandleIndexFromString( string _string ) {
|
||||
string[] spl = _string.Split( new char[] { '#' } );
|
||||
public static int HandleIndexFromString( String _string ) {
|
||||
String[] spl = _string.Split( new char[] { '#' } );
|
||||
return int.Parse( spl[1] );
|
||||
}
|
||||
|
||||
@ -449,7 +453,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="sw">出力先</param>
|
||||
public void Print( StreamWriter sw ) {
|
||||
string result = this.ToString();
|
||||
String result = this.ToString();
|
||||
sw.WriteLine( result );
|
||||
}
|
||||
|
||||
@ -457,7 +461,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// インスタンスをコンソール画面に出力します
|
||||
/// </summary>
|
||||
private void Print() {
|
||||
string result = this.ToString();
|
||||
String result = this.ToString();
|
||||
Console.WriteLine( result );
|
||||
}
|
||||
|
||||
@ -466,8 +470,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="encode">2バイト文字をエンコードするか否かを指定するフラグ</param>
|
||||
/// <returns>インスタンスを変換した文字列</returns>
|
||||
public string ToString( bool encode ) {
|
||||
string result = "";
|
||||
public String ToString( boolean encode ) {
|
||||
String result = "";
|
||||
result += "[h#" + Index.ToString( "0000" ) + "]";
|
||||
switch ( m_type ) {
|
||||
case VsqHandleType.Lyric:
|
||||
|
@ -16,8 +16,12 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
/// <summary>
|
||||
/// メタテキストに埋め込まれるIDを表すクラス。
|
||||
/// </summary>
|
||||
@ -55,13 +59,7 @@ namespace Boare.Lib.Vsq {
|
||||
return m_length;
|
||||
}
|
||||
set {
|
||||
if ( value < 0 ) {
|
||||
m_length = 0;
|
||||
} else if ( MAX_NOTE_LENGTH < value ) {
|
||||
m_length = MAX_NOTE_LENGTH;
|
||||
} else {
|
||||
m_length = value;
|
||||
}
|
||||
m_length = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +67,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// このインスタンスの簡易コピーを取得します。
|
||||
/// </summary>
|
||||
/// <returns>このインスタンスの簡易コピー</returns>
|
||||
public object Clone() {
|
||||
public Object clone() {
|
||||
VsqID result = new VsqID( this.value );
|
||||
result.type = this.type;
|
||||
if ( this.IconHandle != null ) {
|
||||
@ -100,6 +98,9 @@ namespace Boare.Lib.Vsq {
|
||||
return result;
|
||||
}
|
||||
|
||||
public object Clone() {
|
||||
return clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// IDの番号(ID#****の****)を指定したコンストラクタ。
|
||||
@ -119,8 +120,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// <param name="sr">読み込み対象</param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="last_line">読み込んだ最後の行が返されます</param>
|
||||
public VsqID( TextMemoryStream sr, int value, ref string last_line ) {
|
||||
string[] spl;
|
||||
public VsqID( TextMemoryStream sr, int value, ref String last_line ) {
|
||||
String[] spl;
|
||||
this.value = value;
|
||||
this.type = VsqIDType.Unknown;
|
||||
this.IconHandle_index = -2;
|
||||
@ -143,9 +144,9 @@ namespace Boare.Lib.Vsq {
|
||||
spl = last_line.Split( new char[] { '=' } );
|
||||
switch ( spl[0] ) {
|
||||
case "Type":
|
||||
if ( spl[1] == "Anote" ) {
|
||||
if ( spl[1].Equals( "Anote" ) ) {
|
||||
type = VsqIDType.Anote;
|
||||
} else if ( spl[1] == "Singer" ) {
|
||||
} else if ( spl[1].Equals( "Singer" ) ) {
|
||||
type = VsqIDType.Singer;
|
||||
} else {
|
||||
type = VsqIDType.Unknown;
|
||||
@ -199,8 +200,8 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
string ret = "{Type=" + type;
|
||||
public override String ToString() {
|
||||
String ret = "{Type=" + type;
|
||||
switch ( type ) {
|
||||
case VsqIDType.Anote:
|
||||
ret += ", Length=" + Length;
|
||||
@ -266,8 +267,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// VsqIDを構築するテストを行います。
|
||||
/// </summary>
|
||||
/// <returns>テストに成功すればtrue、そうでなければfalseを返します</returns>
|
||||
public static bool test() {
|
||||
string fpath = Path.GetTempFileName();
|
||||
public static boolean test() {
|
||||
String fpath = Path.GetTempFileName();
|
||||
using ( StreamWriter sw = new StreamWriter( fpath, false, Encoding.Unicode ) ) {
|
||||
sw.WriteLine( "Type=Anote" );
|
||||
sw.WriteLine( "Length=320" );
|
||||
@ -282,8 +283,8 @@ namespace Boare.Lib.Vsq {
|
||||
sw.WriteLine( "[ID#0104]" );
|
||||
}
|
||||
|
||||
string last_line = "";
|
||||
bool result;
|
||||
String last_line = "";
|
||||
boolean result;
|
||||
using ( TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ) ) {
|
||||
VsqID vsqID = new VsqID( sr, 103, ref last_line );
|
||||
if ( vsqID.type == VsqIDType.Anote &&
|
||||
@ -296,7 +297,7 @@ namespace Boare.Lib.Vsq {
|
||||
vsqID.DEMdecGainRate == 50 &&
|
||||
vsqID.DEMaccent == 50 &&
|
||||
vsqID.LyricHandle_index == 111 &&
|
||||
last_line == "[ID#0104]" ) {
|
||||
last_line.Equals( "[ID#0104]" ) ) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
|
@ -21,6 +21,8 @@ using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
/// <summary>
|
||||
/// VsqHandleに格納される歌詞の情報を扱うクラス。
|
||||
/// </summary>
|
||||
@ -29,11 +31,11 @@ namespace Boare.Lib.Vsq {
|
||||
/// <summary>
|
||||
/// この歌詞のフレーズ
|
||||
/// </summary>
|
||||
public string Phrase;
|
||||
private string[] m_phonetic_symbol;
|
||||
public String Phrase;
|
||||
private String[] m_phonetic_symbol;
|
||||
public float UnknownFloat;
|
||||
private int[] m_consonant_adjustment;
|
||||
public bool PhoneticSymbolProtected;
|
||||
public boolean PhoneticSymbolProtected;
|
||||
|
||||
public int[] getConsonantAdjustment() {
|
||||
return m_consonant_adjustment;
|
||||
@ -46,7 +48,7 @@ namespace Boare.Lib.Vsq {
|
||||
public Lyric Clone() {
|
||||
Lyric result = new Lyric();
|
||||
result.Phrase = this.Phrase;
|
||||
result.m_phonetic_symbol = (string[])this.m_phonetic_symbol.Clone();
|
||||
result.m_phonetic_symbol = (String[])this.m_phonetic_symbol.Clone();
|
||||
result.UnknownFloat = this.UnknownFloat;
|
||||
result.m_consonant_adjustment = (int[])this.m_consonant_adjustment.Clone();
|
||||
result.PhoneticSymbolProtected = PhoneticSymbolProtected;
|
||||
@ -58,7 +60,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="phrase">歌詞</param>
|
||||
/// <param name="phonetic_symbol">発音記号</param>
|
||||
public Lyric( string phrase, string phonetic_symbol ) {
|
||||
public Lyric( String phrase, String phonetic_symbol ) {
|
||||
Phrase = phrase;
|
||||
setPhoneticSymbol( phonetic_symbol );
|
||||
UnknownFloat = 0.000000f;
|
||||
@ -70,8 +72,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// <summary>
|
||||
/// この歌詞の発音記号を取得します。
|
||||
/// </summary>
|
||||
public string getPhoneticSymbol() {
|
||||
string ret = m_phonetic_symbol[0];
|
||||
public String getPhoneticSymbol() {
|
||||
String ret = m_phonetic_symbol[0];
|
||||
for ( int i = 1; i < m_phonetic_symbol.Length; i++ ) {
|
||||
ret += " " + m_phonetic_symbol[i];
|
||||
}
|
||||
@ -81,8 +83,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// <summary>
|
||||
/// この歌詞の発音記号を設定します。
|
||||
/// </summary>
|
||||
public void setPhoneticSymbol( string value ) {
|
||||
string s = value.Replace( " ", " " );
|
||||
public void setPhoneticSymbol( String value ) {
|
||||
String s = value.Replace( " ", " " );
|
||||
m_phonetic_symbol = s.Split( " ".ToCharArray(), 16 );
|
||||
for ( int i = 0; i < m_phonetic_symbol.Length; i++ ) {
|
||||
m_phonetic_symbol[i] = m_phonetic_symbol[i].Replace( @"\\", @"\" );
|
||||
@ -100,7 +102,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// <summary>
|
||||
/// XMLシリアライズ用
|
||||
/// </summary>
|
||||
public string PhoneticSymbol {
|
||||
public String PhoneticSymbol {
|
||||
get {
|
||||
return getPhoneticSymbol();
|
||||
}
|
||||
@ -109,8 +111,8 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
}
|
||||
|
||||
public string[] getPhoneticSymbolList() {
|
||||
string[] ret = new string[m_phonetic_symbol.Length];
|
||||
public String[] getPhoneticSymbolList() {
|
||||
String[] ret = new String[m_phonetic_symbol.Length];
|
||||
for ( int i = 0; i < m_phonetic_symbol.Length; i++ ) {
|
||||
ret[i] = m_phonetic_symbol[i];
|
||||
}
|
||||
@ -121,13 +123,13 @@ namespace Boare.Lib.Vsq {
|
||||
/// 文字列からのコンストラクタ
|
||||
/// </summary>
|
||||
/// <param name="_line">生成元の文字列</param>
|
||||
public Lyric( string _line ) {
|
||||
public Lyric( String _line ) {
|
||||
byte[] b = new byte[_line.Length];
|
||||
for ( int i = 0; i < _line.Length; i++ ) {
|
||||
b[i] = (byte)_line[i];
|
||||
}
|
||||
string s = cp932.convert( b );
|
||||
string[] spl = s.Split( new char[] { ',' } );
|
||||
String s = cp932.convert( b );
|
||||
String[] spl = s.Split( new char[] { ',' } );
|
||||
int c_length = spl.Length - 3;
|
||||
if ( spl.Length < 4 ) {
|
||||
Phrase = "a";
|
||||
@ -142,7 +144,7 @@ namespace Boare.Lib.Vsq {
|
||||
if ( Phrase.EndsWith( "\"" ) ) {
|
||||
Phrase = Phrase.Substring( 0, Phrase.Length - 1 );
|
||||
}
|
||||
string symbols = spl[1];
|
||||
String symbols = spl[1];
|
||||
if ( symbols.StartsWith( "\"" ) ) {
|
||||
symbols = symbols.Substring( 1 );
|
||||
}
|
||||
@ -151,7 +153,7 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
setPhoneticSymbol( symbols );
|
||||
UnknownFloat = float.Parse( spl[2] );
|
||||
PhoneticSymbolProtected = (spl[spl.Length - 1] == "0") ? false : true;
|
||||
PhoneticSymbolProtected = (spl[spl.Length - 1].Equals( "0" )) ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,10 +162,10 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="item">エンコード対象</param>
|
||||
/// <returns>エンコードした文字列</returns>
|
||||
public static char[] encode( string item ) {
|
||||
public static char[] encode( String item ) {
|
||||
//Encoding sjis = Encoding.GetEncoding( 932 );
|
||||
byte[] bytea = cp932.convert( item );// sjis.GetBytes( item );
|
||||
string result = "";
|
||||
String result = "";
|
||||
for ( int i = 0; i < bytea.Length; i++ ) {
|
||||
if ( isprint( (char)bytea[i] ) ) {
|
||||
result += (char)bytea[i];
|
||||
@ -180,17 +182,14 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="a_encode">2バイト文字をエンコードするか否かを指定するフラグ</param>
|
||||
/// <returns>変換後の文字列</returns>
|
||||
public string ToString( bool a_encode ) {
|
||||
string result;
|
||||
public String ToString( boolean a_encode ) {
|
||||
String result;
|
||||
if ( a_encode ) {
|
||||
string njp = new string( encode( this.Phrase ) );
|
||||
String njp = new String( encode( this.Phrase ) );
|
||||
result = "\"" + njp + "\",\"" + this.getPhoneticSymbol() + "\"," + UnknownFloat.ToString( "0.000000" );
|
||||
} else {
|
||||
result = "\"";
|
||||
byte[] dat = cp932.convert( this.Phrase );
|
||||
for ( int i = 0; i < dat.Length; i++ ) {
|
||||
result += (char)dat[i];
|
||||
}
|
||||
result += this.Phrase;
|
||||
result += "\",\"" + this.getPhoneticSymbol() + "\"," + UnknownFloat.ToString( "0.000000" );
|
||||
result = result.Replace( @"\\", @"\" );
|
||||
}
|
||||
@ -210,7 +209,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="ch"></param>
|
||||
/// <returns></returns>
|
||||
private static bool isprint( char ch ) {
|
||||
private static boolean isprint( char ch ) {
|
||||
if ( 32 <= (int)ch && (int)ch <= 126 ) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -15,8 +15,12 @@ using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
/// <summary>
|
||||
/// vsqファイルのメタテキストの[Master]に記録される内容を取り扱う
|
||||
/// </summary>
|
||||
@ -46,9 +50,9 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="sr">読み込み元</param>
|
||||
/// <param name="last_line">最後に読み込んだ行が返されます</param>
|
||||
public VsqMaster( TextMemoryStream sr, ref string last_line ) {
|
||||
public VsqMaster( TextMemoryStream sr, ref String last_line ) {
|
||||
PreMeasure = 0;
|
||||
string[] spl;
|
||||
String[] spl;
|
||||
last_line = sr.readLine();
|
||||
while ( !last_line.StartsWith( "[" ) ) {
|
||||
spl = last_line.Split( new char[] { '=' } );
|
||||
@ -77,19 +81,19 @@ namespace Boare.Lib.Vsq {
|
||||
/// VsqMasterのインスタンスを構築するテストを行います
|
||||
/// </summary>
|
||||
/// <returns>テストに成功すればtrue、そうでなければfalseを返します</returns>
|
||||
public static bool test() {
|
||||
string fpath = Path.GetTempFileName();
|
||||
public static boolean test() {
|
||||
String fpath = Path.GetTempFileName();
|
||||
using ( StreamWriter sw = new StreamWriter( fpath, false, Encoding.Unicode ) ) {
|
||||
sw.WriteLine( "PreMeasure=2" );
|
||||
sw.WriteLine( "[Mixer]" );
|
||||
}
|
||||
|
||||
bool result;
|
||||
boolean result;
|
||||
using ( TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ) ) {
|
||||
string last_line = "";
|
||||
String last_line = "";
|
||||
VsqMaster vsqMaster = new VsqMaster( sr, ref last_line );
|
||||
if ( vsqMaster.PreMeasure == 2 &&
|
||||
last_line == "[Mixer]" ) {
|
||||
last_line.Equals( "[Mixer]" ) ) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
|
@ -16,8 +16,12 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
/// <summary>
|
||||
/// vsqファイルのメタテキストの[Mixer]セクションに記録される内容を取り扱う
|
||||
/// </summary>
|
||||
@ -31,13 +35,14 @@ namespace Boare.Lib.Vsq {
|
||||
/// <summary>
|
||||
/// vsqファイルの各トラックのfader, panpot, muteおよびoutputmode値を保持します
|
||||
/// </summary>
|
||||
public List<VsqMixerEntry> Slave = new List<VsqMixerEntry>();
|
||||
public Vector<VsqMixerEntry> Slave = new Vector<VsqMixerEntry>();
|
||||
|
||||
public object Clone() {
|
||||
VsqMixer res = new VsqMixer( MasterFeder, MasterPanpot, MasterMute, OutputMode );
|
||||
res.Slave = new List<VsqMixerEntry>();
|
||||
foreach ( VsqMixerEntry item in Slave ) {
|
||||
res.Slave.Add( (VsqMixerEntry)item.Clone() );
|
||||
res.Slave = new Vector<VsqMixerEntry>();
|
||||
for ( Iterator itr = Slave.iterator(); itr.hasNext(); ){
|
||||
VsqMixerEntry item = (VsqMixerEntry)itr.next();
|
||||
res.Slave.add( (VsqMixerEntry)item.Clone() );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -54,7 +59,7 @@ namespace Boare.Lib.Vsq {
|
||||
this.MasterMute = master_mute;
|
||||
this.MasterPanpot = master_panpot;
|
||||
this.OutputMode = output_mode;
|
||||
Slave = new List<VsqMixerEntry>();
|
||||
Slave = new Vector<VsqMixerEntry>();
|
||||
}
|
||||
|
||||
public VsqMixer()
|
||||
@ -66,15 +71,15 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="sr">読み込み対象</param>
|
||||
/// <param name="last_line">最後に読み込んだ行が返されます</param>
|
||||
public VsqMixer( TextMemoryStream sr, ref string last_line ) {
|
||||
public VsqMixer( TextMemoryStream sr, ref String last_line ) {
|
||||
MasterFeder = 0;
|
||||
MasterPanpot = 0;
|
||||
MasterMute = 0;
|
||||
OutputMode = 0;
|
||||
//Tracks = 1;
|
||||
int tracks = 0;
|
||||
string[] spl;
|
||||
string buffer = "";
|
||||
String[] spl;
|
||||
String buffer = "";
|
||||
last_line = sr.readLine();
|
||||
while ( !last_line.StartsWith( "[" ) ) {
|
||||
spl = last_line.Split( new char[] { '=' } );
|
||||
@ -109,32 +114,32 @@ namespace Boare.Lib.Vsq {
|
||||
last_line = sr.readLine();
|
||||
}
|
||||
|
||||
Slave = new List<VsqMixerEntry>();
|
||||
Slave = new Vector<VsqMixerEntry>();
|
||||
for ( int i = 0; i < tracks; i++ ) {
|
||||
Slave.Add( new VsqMixerEntry( 0, 0, 0, 0 ) );
|
||||
Slave.add( new VsqMixerEntry( 0, 0, 0, 0 ) );
|
||||
}
|
||||
spl = buffer.Split( new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries );
|
||||
string[] spl2;
|
||||
spl = buffer.Split( new String[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries );
|
||||
String[] spl2;
|
||||
for ( int i = 0; i < spl.Length; i++ ) {
|
||||
string ind = "";
|
||||
String ind = "";
|
||||
int index;
|
||||
spl2 = spl[i].Split( new char[] { '=' } );
|
||||
if ( spl2[0].StartsWith( "Feder" ) ) {
|
||||
ind = spl2[0].Replace( "Feder", "" );
|
||||
index = int.Parse( ind );
|
||||
Slave[index].Feder = int.Parse( spl2[1] );
|
||||
Slave.get( index ).Feder = int.Parse( spl2[1] );
|
||||
} else if ( spl2[0].StartsWith( "Panpot" ) ) {
|
||||
ind = spl2[0].Replace( "Panpot", "" );
|
||||
index = int.Parse( ind );
|
||||
Slave[index].Panpot = int.Parse( spl2[1] );
|
||||
Slave.get( index ).Panpot = int.Parse( spl2[1] );
|
||||
} else if ( spl2[0].StartsWith( "Mute" ) ) {
|
||||
ind = spl2[0].Replace( "Mute", "" );
|
||||
index = int.Parse( ind );
|
||||
Slave[index].Mute = int.Parse( spl2[1] );
|
||||
Slave.get( index ).Mute = int.Parse( spl2[1] );
|
||||
} else if ( spl2[0].StartsWith( "Solo" ) ) {
|
||||
ind = spl2[0].Replace( "Solo", "" );
|
||||
index = int.Parse( ind );
|
||||
Slave[index].Solo = int.Parse( spl2[1] );
|
||||
Slave.get( index ).Solo = int.Parse( spl2[1] );
|
||||
}
|
||||
|
||||
}
|
||||
@ -150,12 +155,12 @@ namespace Boare.Lib.Vsq {
|
||||
sw.writeLine( "MasterPanpot=" + MasterPanpot );
|
||||
sw.writeLine( "MasterMute=" + MasterMute );
|
||||
sw.writeLine( "OutputMode=" + OutputMode );
|
||||
sw.writeLine( "Tracks=" + Slave.Count );
|
||||
for ( int i = 0; i < Slave.Count; i++ ) {
|
||||
sw.writeLine( "Feder" + i + "=" + Slave[i].Feder );
|
||||
sw.writeLine( "Panpot" + i + "=" + Slave[i].Panpot );
|
||||
sw.writeLine( "Mute" + i + "=" + Slave[i].Mute );
|
||||
sw.writeLine( "Solo" + i + "=" + Slave[i].Solo );
|
||||
sw.writeLine( "Tracks=" + Slave.size() );
|
||||
for ( int i = 0; i < Slave.size(); i++ ) {
|
||||
sw.writeLine( "Feder" + i + "=" + Slave.get( i ).Feder );
|
||||
sw.writeLine( "Panpot" + i + "=" + Slave.get( i ).Panpot );
|
||||
sw.writeLine( "Mute" + i + "=" + Slave.get( i ).Mute );
|
||||
sw.writeLine( "Solo" + i + "=" + Slave.get( i ).Solo );
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,8 +168,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// VsqMixerのインスタンスを構築するテストを行います
|
||||
/// </summary>
|
||||
/// <returns>テストに成功すればtrue、そうでなければfalseを返します</returns>
|
||||
public static bool test() {
|
||||
string fpath = Path.GetTempFileName();
|
||||
public static boolean test() {
|
||||
String fpath = Path.GetTempFileName();
|
||||
StreamWriter sw = new StreamWriter( fpath, false, Encoding.Unicode );
|
||||
sw.WriteLine( "MasterFeder=12" );
|
||||
sw.WriteLine( "MasterPanpot=13" );
|
||||
@ -207,20 +212,20 @@ namespace Boare.Lib.Vsq {
|
||||
sw.Close();
|
||||
|
||||
TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode );
|
||||
string last_line = "";
|
||||
String last_line = "";
|
||||
VsqMixer vsqMixer = new VsqMixer( sr, ref last_line );
|
||||
|
||||
if( vsqMixer.MasterFeder == 12 &&
|
||||
vsqMixer.MasterPanpot == 13 &&
|
||||
vsqMixer.MasterMute == 14 &&
|
||||
vsqMixer.OutputMode == 15 &&
|
||||
vsqMixer.Slave.Count == 8 ){
|
||||
for( int i = 0; i < vsqMixer.Slave.Count; i++ ){
|
||||
vsqMixer.Slave.size() == 8 ){
|
||||
for( int i = 0; i < vsqMixer.Slave.size(); i++ ){
|
||||
int start = 4 * i;
|
||||
if ( vsqMixer.Slave[i].Feder != start + 1 ||
|
||||
vsqMixer.Slave[i].Panpot != start + 2 ||
|
||||
vsqMixer.Slave[i].Mute != start + 3 ||
|
||||
vsqMixer.Slave[i].Solo != start + 4 ) {
|
||||
if ( vsqMixer.Slave.get( i ).Feder != start + 1 ||
|
||||
vsqMixer.Slave.get( i ).Panpot != start + 2 ||
|
||||
vsqMixer.Slave.get( i ).Mute != start + 3 ||
|
||||
vsqMixer.Slave.get( i ).Solo != start + 4 ) {
|
||||
sr.close();
|
||||
File.Delete( fpath );
|
||||
return false;
|
||||
|
@ -17,8 +17,13 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
using Integer = System.Int32;
|
||||
|
||||
/// <summary>
|
||||
/// vsqのメタテキストの中身を処理するためのクラス
|
||||
/// </summary>
|
||||
@ -99,7 +104,7 @@ namespace Boare.Lib.Vsq {
|
||||
if ( Events != null ) {
|
||||
res.Events = new VsqEventList();
|
||||
for ( Iterator itr = Events.iterator(); itr.hasNext(); ) {
|
||||
res.Events.add( (VsqEvent)((VsqEvent)itr.next()).Clone() );
|
||||
res.Events.add( (VsqEvent)((VsqEvent)itr.next()).clone() );
|
||||
}
|
||||
}
|
||||
if ( PIT != null ) {
|
||||
@ -178,7 +183,7 @@ namespace Boare.Lib.Vsq {
|
||||
return Events;
|
||||
}
|
||||
|
||||
internal VsqBPList getElement( string curve ) {
|
||||
internal VsqBPList getElement( String curve ) {
|
||||
switch ( curve.Trim().ToLower() ) {
|
||||
case "bre":
|
||||
return this.BRE;
|
||||
@ -215,7 +220,7 @@ namespace Boare.Lib.Vsq {
|
||||
case "reso2freq":
|
||||
return this.reso2FreqBPList;
|
||||
case "reso3amp":
|
||||
return this.reso2AmpBPList;
|
||||
return this.reso3AmpBPList;
|
||||
case "reso3bw":
|
||||
return this.reso3BWBPList;
|
||||
case "reso3freq":
|
||||
@ -231,7 +236,7 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
}
|
||||
|
||||
internal void setElement( string curve, VsqBPList value ) {
|
||||
internal void setElement( String curve, VsqBPList value ) {
|
||||
switch ( curve.Trim().ToLower() ) {
|
||||
case "bre":
|
||||
this.BRE = value;
|
||||
@ -260,6 +265,53 @@ namespace Boare.Lib.Vsq {
|
||||
case "por":
|
||||
this.POR = value;
|
||||
break;
|
||||
case "harmonics":
|
||||
this.harmonics = value;
|
||||
break;
|
||||
case "fx2depth":
|
||||
this.fx2depth = value;
|
||||
break;
|
||||
case "reso1amp":
|
||||
this.reso1AmpBPList = value;
|
||||
break;
|
||||
case "reso1bw":
|
||||
this.reso1BWBPList = value;
|
||||
break;
|
||||
case "reso1freq":
|
||||
this.reso1FreqBPList = value;
|
||||
break;
|
||||
case "reso2amp":
|
||||
this.reso2AmpBPList = value;
|
||||
break;
|
||||
case "reso2bw":
|
||||
this.reso2BWBPList = value;
|
||||
break;
|
||||
case "reso2freq":
|
||||
this.reso2FreqBPList = value;
|
||||
break;
|
||||
case "reso3amp":
|
||||
this.reso3AmpBPList = value;
|
||||
break;
|
||||
case "reso3bw":
|
||||
this.reso3BWBPList = value;
|
||||
break;
|
||||
case "reso3freq":
|
||||
this.reso3FreqBPList = value;
|
||||
break;
|
||||
case "reso4amp":
|
||||
this.reso4AmpBPList = value;
|
||||
break;
|
||||
case "reso4bw":
|
||||
this.reso4BWBPList = value;
|
||||
break;
|
||||
case "reso4freq":
|
||||
this.reso4FreqBPList = value;
|
||||
break;
|
||||
default:
|
||||
#if DEBUG
|
||||
Console.WriteLine( "VsqMetaText#setElement; warning:unknown curve; curve=" + curve );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,7 +351,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public static string getCurveName( int index ) {
|
||||
public static String getCurveName( int index ) {
|
||||
switch ( index ) {
|
||||
case 0:
|
||||
return "VEL";
|
||||
@ -329,7 +381,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// <summary>
|
||||
/// Singerプロパティに指定されている
|
||||
/// </summary>
|
||||
public string getSinger() {
|
||||
public String getSinger() {
|
||||
for ( Iterator itr = Events.iterator(); itr.hasNext(); ) {
|
||||
VsqEvent item = (VsqEvent)itr.next();
|
||||
if ( item.ID.type == VsqIDType.Singer ) {
|
||||
@ -339,7 +391,7 @@ namespace Boare.Lib.Vsq {
|
||||
return "";
|
||||
}
|
||||
|
||||
public void setSinger( string value ) {
|
||||
public void setSinger( String value ) {
|
||||
for ( Iterator itr = Events.iterator(); itr.hasNext(); ) {
|
||||
VsqEvent item = (VsqEvent)itr.next();
|
||||
if ( item.ID.type == VsqIDType.Singer ) {
|
||||
@ -369,19 +421,19 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="handle"></param>
|
||||
void BuildIDHandleList( out List<VsqID> id, out List<VsqHandle> handle ) {
|
||||
id = new List<VsqID>();
|
||||
handle = new List<VsqHandle>();
|
||||
void BuildIDHandleList( out Vector<VsqID> id, out Vector<VsqHandle> handle ) {
|
||||
id = new Vector<VsqID>();
|
||||
handle = new Vector<VsqHandle>();
|
||||
int current_id = -1;
|
||||
int current_handle = -1;
|
||||
List<VsqEvent> events = new List<VsqEvent>();
|
||||
Vector<VsqEvent> events = new Vector<VsqEvent>();
|
||||
for ( Iterator itr = Events.iterator(); itr.hasNext(); ) {
|
||||
events.Add( (VsqEvent)itr.next() );
|
||||
events.add( (VsqEvent)itr.next() );
|
||||
}
|
||||
events.Sort();
|
||||
for ( int i = 0; i < events.Count; i++ ) {
|
||||
VsqEvent item = events[i];
|
||||
VsqID id_item = (VsqID)item.ID.Clone();
|
||||
Collections.sort( events );
|
||||
for ( int i = 0; i < events.size(); i++ ) {
|
||||
VsqEvent item = events.get( i );
|
||||
VsqID id_item = (VsqID)item.ID.clone();
|
||||
current_id++;
|
||||
item.ID.value = current_id;
|
||||
id_item.value = current_id;
|
||||
@ -390,7 +442,7 @@ namespace Boare.Lib.Vsq {
|
||||
current_handle++;
|
||||
VsqHandle handle_item = item.ID.IconHandle.castToVsqHandle();
|
||||
handle_item.Index = current_handle;
|
||||
handle.Add( handle_item );
|
||||
handle.add( handle_item );
|
||||
id_item.IconHandle_index = current_handle;
|
||||
}
|
||||
// LyricHandle
|
||||
@ -398,7 +450,7 @@ namespace Boare.Lib.Vsq {
|
||||
current_handle++;
|
||||
VsqHandle handle_item = item.ID.LyricHandle.castToVsqHandle();
|
||||
handle_item.Index = current_handle;
|
||||
handle.Add( handle_item );
|
||||
handle.add( handle_item );
|
||||
id_item.LyricHandle_index = current_handle;
|
||||
}
|
||||
// VibratoHandle
|
||||
@ -406,7 +458,7 @@ namespace Boare.Lib.Vsq {
|
||||
current_handle++;
|
||||
VsqHandle handle_item = item.ID.VibratoHandle.castToVsqHandle();
|
||||
handle_item.Index = current_handle;
|
||||
handle.Add( handle_item );
|
||||
handle.add( handle_item );
|
||||
id_item.VibratoHandle_index = current_handle;
|
||||
}
|
||||
// NoteHeadHandle
|
||||
@ -414,10 +466,10 @@ namespace Boare.Lib.Vsq {
|
||||
current_handle++;
|
||||
VsqHandle handle_item = item.ID.NoteHeadHandle.castToVsqHandle();
|
||||
handle_item.Index = current_handle;
|
||||
handle.Add( handle_item );
|
||||
handle.add( handle_item );
|
||||
id_item.NoteHeadHandle_index = current_handle;
|
||||
}
|
||||
id.Add( id_item );
|
||||
id.add( id_item );
|
||||
}
|
||||
}
|
||||
|
||||
@ -426,7 +478,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="sw"></param>
|
||||
/// <param name="encode"></param>
|
||||
public void print( TextMemoryStream sw, bool encode, int eos, int start ) {
|
||||
public void print( TextMemoryStream sw, boolean encode, int eos, int start ) {
|
||||
if ( Common != null ) {
|
||||
Common.write( sw );
|
||||
}
|
||||
@ -436,92 +488,92 @@ namespace Boare.Lib.Vsq {
|
||||
if ( mixer != null ) {
|
||||
mixer.write( sw );
|
||||
}
|
||||
List<VsqID> id;
|
||||
List<VsqHandle> handle;
|
||||
Vector<VsqID> id;
|
||||
Vector<VsqHandle> handle;
|
||||
BuildIDHandleList( out id, out handle );
|
||||
writeEventList( sw, eos );
|
||||
int i;
|
||||
for ( i = 0; i < id.Count; i++ ) {
|
||||
id[i].write( sw );
|
||||
for ( i = 0; i < id.size(); i++ ) {
|
||||
id.get( i ).write( sw );
|
||||
}
|
||||
for ( i = 0; i < handle.Count; i++ ) {
|
||||
handle[i].write( sw, encode );
|
||||
for ( i = 0; i < handle.size(); i++ ) {
|
||||
handle.get( i ).write( sw, encode );
|
||||
}
|
||||
string version = Common.Version;
|
||||
if ( PIT.getCount() > 0 ) {
|
||||
String version = Common.Version;
|
||||
if ( PIT.size() > 0 ) {
|
||||
PIT.print( sw, start, "[PitchBendBPList]" );
|
||||
}
|
||||
if ( PBS.getCount() > 0 ) {
|
||||
if ( PBS.size() > 0 ) {
|
||||
PBS.print( sw, start, "[PitchBendSensBPList]" );
|
||||
}
|
||||
if ( DYN.getCount() > 0 ) {
|
||||
if ( DYN.size() > 0 ) {
|
||||
DYN.print( sw, start, "[DynamicsBPList]" );
|
||||
}
|
||||
if ( BRE.getCount() > 0 ) {
|
||||
if ( BRE.size() > 0 ) {
|
||||
BRE.print( sw, start, "[EpRResidualBPList]" );
|
||||
}
|
||||
if ( BRI.getCount() > 0 ) {
|
||||
if ( BRI.size() > 0 ) {
|
||||
BRI.print( sw, start, "[EpRESlopeBPList]" );
|
||||
}
|
||||
if ( CLE.getCount() > 0 ) {
|
||||
if ( CLE.size() > 0 ) {
|
||||
CLE.print( sw, start, "[EpRESlopeDepthBPList]" );
|
||||
}
|
||||
if ( version.StartsWith( "DSB2" ) ) {
|
||||
if ( harmonics.getCount() > 0 ) {
|
||||
if ( harmonics.size() > 0 ) {
|
||||
harmonics.print( sw, start, "[EpRSineBPList]" );
|
||||
}
|
||||
if ( fx2depth.getCount() > 0 ) {
|
||||
if ( fx2depth.size() > 0 ) {
|
||||
fx2depth.print( sw, start, "[VibTremDepthBPList]" );
|
||||
}
|
||||
|
||||
if ( reso1FreqBPList.getCount() > 0 ) {
|
||||
if ( reso1FreqBPList.size() > 0 ) {
|
||||
reso1FreqBPList.print( sw, start, "[Reso1FreqBPList]" );
|
||||
}
|
||||
if ( reso2FreqBPList.getCount() > 0 ) {
|
||||
if ( reso2FreqBPList.size() > 0 ) {
|
||||
reso2FreqBPList.print( sw, start, "[Reso2FreqBPList]" );
|
||||
}
|
||||
if ( reso3FreqBPList.getCount() > 0 ) {
|
||||
if ( reso3FreqBPList.size() > 0 ) {
|
||||
reso3FreqBPList.print( sw, start, "[Reso3FreqBPList]" );
|
||||
}
|
||||
if ( reso4FreqBPList.getCount() > 0 ) {
|
||||
if ( reso4FreqBPList.size() > 0 ) {
|
||||
reso4FreqBPList.print( sw, start, "[Reso4FreqBPList]" );
|
||||
}
|
||||
|
||||
if ( reso1BWBPList.getCount() > 0 ) {
|
||||
if ( reso1BWBPList.size() > 0 ) {
|
||||
reso1BWBPList.print( sw, start, "[Reso1BWBPList]" );
|
||||
}
|
||||
if ( reso2BWBPList.getCount() > 0 ) {
|
||||
if ( reso2BWBPList.size() > 0 ) {
|
||||
reso2BWBPList.print( sw, start, "[Reso2BWBPList]" );
|
||||
}
|
||||
if ( reso3BWBPList.getCount() > 0 ) {
|
||||
if ( reso3BWBPList.size() > 0 ) {
|
||||
reso3BWBPList.print( sw, start, "[Reso3BWBPList]" );
|
||||
}
|
||||
if ( reso4BWBPList.getCount() > 0 ) {
|
||||
if ( reso4BWBPList.size() > 0 ) {
|
||||
reso4BWBPList.print( sw, start, "[Reso4BWBPList]" );
|
||||
}
|
||||
|
||||
if ( reso1AmpBPList.getCount() > 0 ) {
|
||||
if ( reso1AmpBPList.size() > 0 ) {
|
||||
reso1AmpBPList.print( sw, start, "[Reso1AmpBPList]" );
|
||||
}
|
||||
if ( reso2AmpBPList.getCount() > 0 ) {
|
||||
if ( reso2AmpBPList.size() > 0 ) {
|
||||
reso2AmpBPList.print( sw, start, "[Reso2AmpBPList]" );
|
||||
}
|
||||
if ( reso3AmpBPList.getCount() > 0 ) {
|
||||
if ( reso3AmpBPList.size() > 0 ) {
|
||||
reso3AmpBPList.print( sw, start, "[Reso3AmpBPList]" );
|
||||
}
|
||||
if ( reso4AmpBPList.getCount() > 0 ) {
|
||||
if ( reso4AmpBPList.size() > 0 ) {
|
||||
reso4AmpBPList.print( sw, start, "[Reso4AmpBPList]" );
|
||||
}
|
||||
}
|
||||
|
||||
if ( GEN.getCount() > 0 ) {
|
||||
if ( GEN.size() > 0 ) {
|
||||
GEN.print( sw, start, "[GenderFactorBPList]" );
|
||||
}
|
||||
if ( POR.getCount() > 0 ) {
|
||||
if ( POR.size() > 0 ) {
|
||||
POR.print( sw, start, "[PortamentoTimingBPList]" );
|
||||
}
|
||||
if ( version.StartsWith( "DSB3" ) ) {
|
||||
if ( OPE.getCount() > 0 ) {
|
||||
if ( OPE.size() > 0 ) {
|
||||
OPE.print( sw, start, "[OpeningBPList]" );
|
||||
}
|
||||
}
|
||||
@ -529,18 +581,18 @@ namespace Boare.Lib.Vsq {
|
||||
|
||||
private void writeEventList( TextMemoryStream sw, int eos ) {
|
||||
sw.writeLine( "[EventList]" );
|
||||
List<VsqEvent> temp = new List<VsqEvent>();
|
||||
Vector<VsqEvent> temp = new Vector<VsqEvent>();
|
||||
for ( Iterator itr = Events.iterator(); itr.hasNext(); ) {
|
||||
temp.Add( (VsqEvent)itr.next() );
|
||||
temp.add( (VsqEvent)itr.next() );
|
||||
}
|
||||
temp.Sort();
|
||||
Collections.sort( temp );
|
||||
int i = 0;
|
||||
while ( i < temp.Count ) {
|
||||
VsqEvent item = temp[i];
|
||||
while ( i < temp.size() ) {
|
||||
VsqEvent item = temp.get( i );
|
||||
if ( !item.ID.Equals( VsqID.EOS ) ) {
|
||||
string ids = "ID#" + i.ToString( "0000" );
|
||||
int clock = temp[i].Clock;
|
||||
while ( i + 1 < temp.Count && clock == temp[i + 1].Clock ) {
|
||||
String ids = "ID#" + i.ToString( "0000" );
|
||||
int clock = temp.get( i ).Clock;
|
||||
while ( i + 1 < temp.size() && clock == temp.get( i + 1 ).Clock ) {
|
||||
i++;
|
||||
ids += ",ID#" + i.ToString( "0000" );
|
||||
}
|
||||
@ -560,7 +612,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// <summary>
|
||||
/// 最初のトラック以外の一般のメタテキストを構築。(Masterが作られない)
|
||||
/// </summary>
|
||||
public VsqMetaText( string name, string singer )
|
||||
public VsqMetaText( String name, String singer )
|
||||
: this( name, 0, singer, false ) {
|
||||
}
|
||||
|
||||
@ -568,11 +620,11 @@ namespace Boare.Lib.Vsq {
|
||||
/// 最初のトラックのメタテキストを構築。(Masterが作られる)
|
||||
/// </summary>
|
||||
/// <param name="pre_measure"></param>
|
||||
public VsqMetaText( string name, string singer, int pre_measure )
|
||||
public VsqMetaText( String name, String singer, int pre_measure )
|
||||
: this( name, pre_measure, singer, true ) {
|
||||
}
|
||||
|
||||
private VsqMetaText( string name, int pre_measure, string singer, bool is_first_track ) {
|
||||
private VsqMetaText( String name, int pre_measure, String singer, boolean is_first_track ) {
|
||||
Common = new VsqCommon( name, Color.FromArgb( 179, 181, 123 ), 1, 1 );
|
||||
PIT = new VsqBPList( 0, -8192, 8191 );
|
||||
//PIT.add( 0, PIT.getDefault() );
|
||||
@ -662,9 +714,9 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
|
||||
public VsqMetaText( TextMemoryStream sr ) {
|
||||
List<KeyValuePair<int, int>> t_event_list = new List<KeyValuePair<int, int>>();
|
||||
Dictionary<int, VsqID> __id = new Dictionary<int, VsqID>();
|
||||
Dictionary<int, VsqHandle> __handle = new Dictionary<int, VsqHandle>();
|
||||
Vector<KeyValuePair<Integer, Integer>> t_event_list = new Vector<KeyValuePair<Integer, Integer>>();
|
||||
TreeMap<Integer, VsqID> __id = new TreeMap<Integer, VsqID>();
|
||||
TreeMap<Integer, VsqHandle> __handle = new TreeMap<Integer, VsqHandle>();
|
||||
PIT = new VsqBPList( 0, -8192, 8191 );
|
||||
PBS = new VsqBPList( 2, 0, 24 );
|
||||
DYN = new VsqBPList( 64, 0, 127 );
|
||||
@ -689,7 +741,7 @@ namespace Boare.Lib.Vsq {
|
||||
POR = new VsqBPList( 64, 0, 127 );
|
||||
OPE = new VsqBPList( 127, 0, 127 );
|
||||
|
||||
string last_line = sr.readLine();
|
||||
String last_line = sr.readLine();
|
||||
while ( true ) {
|
||||
#region "TextMemoryStreamから順次読込み"
|
||||
if ( last_line.Length == 0 ) {
|
||||
@ -708,18 +760,18 @@ namespace Boare.Lib.Vsq {
|
||||
case "[EventList]":
|
||||
last_line = sr.readLine();
|
||||
while ( !last_line.StartsWith( "[" ) ) {
|
||||
string[] spl2 = last_line.Split( new char[] { '=' } );
|
||||
String[] spl2 = last_line.Split( new char[] { '=' } );
|
||||
int clock = int.Parse( spl2[0] );
|
||||
int id_number = -1;
|
||||
if ( spl2[1] != "EOS" ) {
|
||||
string[] ids = spl2[1].Split( ",".ToCharArray() );
|
||||
String[] ids = spl2[1].Split( ",".ToCharArray() );
|
||||
for ( int i = 0; i < ids.Length; i++ ) {
|
||||
string[] spl3 = ids[i].Split( new char[] { '#' } );
|
||||
String[] spl3 = ids[i].Split( new char[] { '#' } );
|
||||
id_number = int.Parse( spl3[1] );
|
||||
t_event_list.Add( new KeyValuePair<int,int>( clock, id_number ) );
|
||||
t_event_list.add( new KeyValuePair<int,int>( clock, id_number ) );
|
||||
}
|
||||
} else {
|
||||
t_event_list.Add( new KeyValuePair<int,int>( clock, -1) );
|
||||
t_event_list.add( new KeyValuePair<int,int>( clock, -1) );
|
||||
}
|
||||
if ( sr.peek() < 0 ) {
|
||||
break;
|
||||
@ -798,15 +850,15 @@ namespace Boare.Lib.Vsq {
|
||||
last_line = OPE.appendFromText( sr );
|
||||
break;
|
||||
default:
|
||||
string buffer = last_line;
|
||||
String buffer = last_line;
|
||||
buffer = buffer.Replace( "[", "" );
|
||||
buffer = buffer.Replace( "]", "" );
|
||||
string[] spl = buffer.Split( new char[] { '#' } );
|
||||
String[] spl = buffer.Split( new char[] { '#' } );
|
||||
int index = int.Parse( spl[1] );
|
||||
if ( last_line.StartsWith( "[ID#" ) ) {
|
||||
__id.Add( index, new VsqID( sr, index, ref last_line ) );
|
||||
__id.put( index, new VsqID( sr, index, ref last_line ) );
|
||||
} else if ( last_line.StartsWith( "[h#" ) ) {
|
||||
__handle.Add( index, new VsqHandle( sr, index, ref last_line ) );
|
||||
__handle.put( index, new VsqHandle( sr, index, ref last_line ) );
|
||||
}
|
||||
break;
|
||||
#endregion
|
||||
@ -818,46 +870,46 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
|
||||
// まずhandleをidに埋め込み
|
||||
for ( int i = 0; i < __id.Count; i++ ) {
|
||||
if ( __handle.ContainsKey( __id[i].IconHandle_index ) ) {
|
||||
__id[i].IconHandle = __handle[__id[i].IconHandle_index].castToIconHandle();
|
||||
for ( int i = 0; i < __id.size(); i++ ) {
|
||||
if ( __handle.containsKey( __id.get( i ).IconHandle_index ) ) {
|
||||
__id.get( i ).IconHandle = __handle.get( __id.get( i ).IconHandle_index ).castToIconHandle();
|
||||
}
|
||||
if ( __handle.ContainsKey( __id[i].LyricHandle_index ) ) {
|
||||
__id[i].LyricHandle = __handle[__id[i].LyricHandle_index].castToLyricHandle();
|
||||
if ( __handle.containsKey( __id.get( i ).LyricHandle_index ) ) {
|
||||
__id.get( i ).LyricHandle = __handle.get( __id.get( i ).LyricHandle_index ).castToLyricHandle();
|
||||
}
|
||||
if ( __handle.ContainsKey( __id[i].VibratoHandle_index ) ) {
|
||||
__id[i].VibratoHandle = __handle[__id[i].VibratoHandle_index].castToVibratoHandle();
|
||||
if ( __handle.containsKey( __id.get( i ).VibratoHandle_index ) ) {
|
||||
__id.get( i ).VibratoHandle = __handle.get( __id.get( i ).VibratoHandle_index ).castToVibratoHandle();
|
||||
}
|
||||
if ( __handle.ContainsKey( __id[i].NoteHeadHandle_index ) ) {
|
||||
__id[i].NoteHeadHandle = __handle[__id[i].NoteHeadHandle_index].castToNoteHeadHandle();
|
||||
if ( __handle.containsKey( __id.get( i ).NoteHeadHandle_index ) ) {
|
||||
__id.get( i ).NoteHeadHandle = __handle.get( __id.get( i ).NoteHeadHandle_index ).castToNoteHeadHandle();
|
||||
}
|
||||
}
|
||||
|
||||
// idをeventListに埋め込み
|
||||
Events = new VsqEventList();
|
||||
for ( int i = 0; i < t_event_list.Count; i++ ) {
|
||||
int clock = t_event_list[i].Key;
|
||||
int id_number = t_event_list[i].Value;
|
||||
if ( __id.ContainsKey( id_number ) ) {
|
||||
Events.add( new VsqEvent( clock, (VsqID)__id[id_number].Clone() ) );
|
||||
for ( int i = 0; i < t_event_list.size(); i++ ) {
|
||||
int clock = t_event_list.get( i ).Key;
|
||||
int id_number = t_event_list.get( i ).Value;
|
||||
if ( __id.containsKey( id_number ) ) {
|
||||
Events.add( new VsqEvent( clock, (VsqID)__id.get( id_number ).clone() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool test( string fpath ) {
|
||||
public static boolean test( String fpath ) {
|
||||
/*VsqMetaText metaText;
|
||||
using ( TextMemoryStream sr = new TextMemoryStream( fpath, Encoding.Unicode ) ) {
|
||||
metaText = new VsqMetaText( sr );
|
||||
}*/
|
||||
string result = "test.txt";
|
||||
String result = "test.txt";
|
||||
|
||||
StreamReader honmono = new StreamReader( fpath );
|
||||
TextMemoryStream copy = new TextMemoryStream();
|
||||
//metaText.print( copy, true, 1000, 100 );
|
||||
copy.rewind();
|
||||
while ( honmono.Peek() >= 0 && copy.peek() >= 0 ) {
|
||||
string hon = honmono.ReadLine();
|
||||
string cop = copy.readLine();
|
||||
String hon = honmono.ReadLine();
|
||||
String cop = copy.readLine();
|
||||
if ( hon != cop ) {
|
||||
Console.WriteLine( "honmono,copy=" + hon + "," + cop );
|
||||
honmono.Close();
|
||||
|
@ -15,8 +15,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
/// <summary>
|
||||
/// 音階を表現するためのクラス
|
||||
/// </summary>
|
||||
@ -26,7 +30,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// このインスタンスが表す音階のノート値
|
||||
/// </summary>
|
||||
public int Value;
|
||||
private static readonly bool[] _KEY_TYPE = new bool[128] {
|
||||
private static readonly boolean[] _KEY_TYPE = new boolean[128] {
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
@ -168,7 +172,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// <summary>
|
||||
/// このインスタンスが表す音階が、ピアノの白鍵かどうかを返します
|
||||
/// </summary>
|
||||
public bool isWhiteKey() {
|
||||
public boolean isWhiteKey() {
|
||||
return isNoteWhiteKey( Value );
|
||||
}
|
||||
|
||||
@ -177,7 +181,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="note"></param>
|
||||
/// <returns></returns>
|
||||
public static bool isNoteWhiteKey( int note ) {
|
||||
public static boolean isNoteWhiteKey( int note ) {
|
||||
if ( 0 <= note && note <= 127 ) {
|
||||
return _KEY_TYPE[note];
|
||||
} else {
|
||||
@ -195,7 +199,7 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
}
|
||||
|
||||
public static string getNoteString( int note ) {
|
||||
public static String getNoteString( int note ) {
|
||||
int odd = note % 12;
|
||||
int order = (note - odd) / 12 - 2;
|
||||
switch ( odd ) {
|
||||
@ -228,7 +232,7 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
}
|
||||
|
||||
override public string ToString() {
|
||||
override public String ToString() {
|
||||
return getNoteString( Value );
|
||||
}
|
||||
}
|
||||
|
@ -14,16 +14,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
public struct VsqNrpn : IComparable<VsqNrpn> {
|
||||
public int Clock;
|
||||
public ushort Nrpn;
|
||||
public byte DataMsb;
|
||||
public byte DataLsb;
|
||||
public bool DataLsbSpecified;
|
||||
public bool msbOmitRequired;
|
||||
private List<VsqNrpn> m_list;
|
||||
public boolean DataLsbSpecified;
|
||||
public boolean msbOmitRequired;
|
||||
private Vector<VsqNrpn> m_list;
|
||||
|
||||
public VsqNrpn( int clock, ushort nrpn, byte data_msb ) {
|
||||
Clock = clock;
|
||||
@ -32,7 +36,7 @@ namespace Boare.Lib.Vsq {
|
||||
DataLsb = 0x0;
|
||||
DataLsbSpecified = false;
|
||||
msbOmitRequired = false;
|
||||
m_list = new List<VsqNrpn>();
|
||||
m_list = new Vector<VsqNrpn>();
|
||||
}
|
||||
|
||||
public VsqNrpn( int clock, ushort nrpn, byte data_msb, byte data_lsb ) {
|
||||
@ -42,93 +46,93 @@ namespace Boare.Lib.Vsq {
|
||||
DataLsb = data_lsb;
|
||||
DataLsbSpecified = true;
|
||||
msbOmitRequired = false;
|
||||
m_list = new List<VsqNrpn>();
|
||||
m_list = new Vector<VsqNrpn>();
|
||||
}
|
||||
|
||||
public VsqNrpn[] expand() {
|
||||
List<VsqNrpn> ret = new List<VsqNrpn>();
|
||||
Vector<VsqNrpn> ret = new Vector<VsqNrpn>();
|
||||
if ( DataLsbSpecified ) {
|
||||
VsqNrpn v = new VsqNrpn( Clock, Nrpn, DataMsb, DataLsb );
|
||||
v.msbOmitRequired = msbOmitRequired;
|
||||
ret.Add( v );
|
||||
ret.add( v );
|
||||
} else {
|
||||
VsqNrpn v = new VsqNrpn( Clock, Nrpn, DataMsb );
|
||||
v.msbOmitRequired = msbOmitRequired;
|
||||
ret.Add( v );
|
||||
ret.add( v );
|
||||
}
|
||||
for ( int i = 0; i < m_list.Count; i++ ) {
|
||||
ret.AddRange( m_list[i].expand() );
|
||||
for ( int i = 0; i < m_list.size(); i++ ) {
|
||||
ret.addAll( m_list.get( i ).expand() );
|
||||
}
|
||||
return ret.ToArray();
|
||||
return ret.toArray( new VsqNrpn[]{} );
|
||||
}
|
||||
|
||||
public static List<VsqNrpn> sort( List<VsqNrpn> list ) {
|
||||
List<VsqNrpn> ret = new List<VsqNrpn>();
|
||||
list.Sort();
|
||||
if ( list.Count >= 2 ) {
|
||||
List<VsqNrpn> work = new List<VsqNrpn>(); //workには、clockが同じNRPNだけが入る
|
||||
int last_clock = list[0].Clock;
|
||||
work.Add( list[0] );
|
||||
for ( int i = 1; i < list.Count; i++ ) {
|
||||
if ( list[i].Clock == last_clock ) {
|
||||
work.Add( list[i] );
|
||||
public static Vector<VsqNrpn> sort( Vector<VsqNrpn> list ) {
|
||||
Vector<VsqNrpn> ret = new Vector<VsqNrpn>();
|
||||
Collections.sort( list );
|
||||
if ( list.size() >= 2 ) {
|
||||
Vector<VsqNrpn> work = new Vector<VsqNrpn>(); //workには、clockが同じNRPNだけが入る
|
||||
int last_clock = list.get( 0 ).Clock;
|
||||
work.add( list.get( 0 ) );
|
||||
for ( int i = 1; i < list.size(); i++ ) {
|
||||
if ( list.get( i ).Clock == last_clock ) {
|
||||
work.add( list.get( i ) );
|
||||
} else {
|
||||
// まずworkを並べ替え
|
||||
last_clock = list[i].Clock;
|
||||
bool changed = true;
|
||||
last_clock = list.get( i ).Clock;
|
||||
boolean changed = true;
|
||||
while ( changed ) {
|
||||
changed = false;
|
||||
for ( int j = 0; j < work.Count - 1; j++ ) {
|
||||
byte nrpn_msb0 = (byte)((work[j].Nrpn >> 8) & 0xff);
|
||||
byte nrpn_msb1 = (byte)((work[j + 1].Nrpn >> 8) & 0xff);
|
||||
for ( int j = 0; j < work.size() - 1; j++ ) {
|
||||
byte nrpn_msb0 = (byte)((work.get( j ).Nrpn >> 8) & 0xff);
|
||||
byte nrpn_msb1 = (byte)((work.get( j + 1 ).Nrpn >> 8) & 0xff);
|
||||
if ( nrpn_msb1 > nrpn_msb0 ) {
|
||||
VsqNrpn buf = work[j];
|
||||
work[j] = work[j + 1];
|
||||
work[j + 1] = buf;
|
||||
VsqNrpn buf = work.get( j );
|
||||
work.set( j, work.get( j + 1 ) );
|
||||
work.set( j + 1, buf );
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( int j = 0; j < work.Count; j++ ) {
|
||||
ret.Add( work[j] );
|
||||
for ( int j = 0; j < work.size(); j++ ) {
|
||||
ret.add( work.get( j ) );
|
||||
}
|
||||
work.Clear();
|
||||
work.Add( list[i] );
|
||||
work.clear();
|
||||
work.add( list.get( i ) );
|
||||
}
|
||||
}
|
||||
for ( int j = 0; j < work.Count; j++ ) {
|
||||
ret.Add( work[j] );
|
||||
for ( int j = 0; j < work.size(); j++ ) {
|
||||
ret.add( work.get( j ) );
|
||||
}
|
||||
} else {
|
||||
for ( int i = 0; i < list.Count; i++ ) {
|
||||
ret.Add( list[i] );
|
||||
for ( int i = 0; i < list.size(); i++ ) {
|
||||
ret.add( list.get( i ) );
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static VsqNrpn[] merge( VsqNrpn[] src1, VsqNrpn[] src2 ) {
|
||||
List<VsqNrpn> ret = new List<VsqNrpn>();
|
||||
Vector<VsqNrpn> ret = new Vector<VsqNrpn>();
|
||||
for ( int i = 0; i < src1.Length; i++ ) {
|
||||
ret.Add( src1[i] );
|
||||
ret.add( src1[i] );
|
||||
}
|
||||
for ( int i = 0; i < src2.Length; i++ ) {
|
||||
ret.Add( src2[i] );
|
||||
ret.add( src2[i] );
|
||||
}
|
||||
ret.Sort();
|
||||
return ret.ToArray();
|
||||
Collections.sort( ret );
|
||||
return ret.toArray( new VsqNrpn[]{} );
|
||||
}
|
||||
|
||||
public static NrpnData[] convert( VsqNrpn[] source ) {
|
||||
ushort nrpn = (ushort)source[0].Nrpn;
|
||||
byte msb = (byte)(nrpn >> 8);
|
||||
byte lsb = (byte)(nrpn - (nrpn << 8));
|
||||
List<NrpnData> ret = new List<NrpnData>();
|
||||
ret.Add( new NrpnData( source[0].Clock, 0x63, msb ) );
|
||||
ret.Add( new NrpnData( source[0].Clock, 0x62, lsb ) );
|
||||
ret.Add( new NrpnData( source[0].Clock, 0x06, source[0].DataMsb ) );
|
||||
Vector<NrpnData> ret = new Vector<NrpnData>();
|
||||
ret.add( new NrpnData( source[0].Clock, 0x63, msb ) );
|
||||
ret.add( new NrpnData( source[0].Clock, 0x62, lsb ) );
|
||||
ret.add( new NrpnData( source[0].Clock, 0x06, source[0].DataMsb ) );
|
||||
if ( source[0].DataLsbSpecified ) {
|
||||
ret.Add( new NrpnData( source[0].Clock, 0x26, source[0].DataLsb ) );
|
||||
ret.add( new NrpnData( source[0].Clock, 0x26, source[0].DataLsb ) );
|
||||
}
|
||||
for ( int i = 1; i < source.Length; i++ ) {
|
||||
VsqNrpn item = source[i];
|
||||
@ -136,21 +140,21 @@ namespace Boare.Lib.Vsq {
|
||||
msb = (byte)(tnrpn >> 8);
|
||||
lsb = (byte)(tnrpn - (tnrpn << 8));
|
||||
if ( item.msbOmitRequired ) {
|
||||
ret.Add( new NrpnData( item.Clock, 0x62, lsb ) );
|
||||
ret.Add( new NrpnData( item.Clock, 0x06, item.DataMsb ) );
|
||||
ret.add( new NrpnData( item.Clock, 0x62, lsb ) );
|
||||
ret.add( new NrpnData( item.Clock, 0x06, item.DataMsb ) );
|
||||
if ( item.DataLsbSpecified ) {
|
||||
ret.Add( new NrpnData( item.Clock, 0x26, item.DataLsb ) );
|
||||
ret.add( new NrpnData( item.Clock, 0x26, item.DataLsb ) );
|
||||
}
|
||||
} else {
|
||||
ret.Add( new NrpnData( item.Clock, 0x63, msb ) );
|
||||
ret.Add( new NrpnData( item.Clock, 0x62, lsb ) );
|
||||
ret.Add( new NrpnData( item.Clock, 0x06, item.DataMsb ) );
|
||||
ret.add( new NrpnData( item.Clock, 0x63, msb ) );
|
||||
ret.add( new NrpnData( item.Clock, 0x62, lsb ) );
|
||||
ret.add( new NrpnData( item.Clock, 0x06, item.DataMsb ) );
|
||||
if ( item.DataLsbSpecified ) {
|
||||
ret.Add( new NrpnData( item.Clock, 0x26, item.DataLsb ) );
|
||||
ret.add( new NrpnData( item.Clock, 0x26, item.DataLsb ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret.ToArray();
|
||||
return ret.toArray( new NrpnData[]{} );
|
||||
}
|
||||
|
||||
public int CompareTo( VsqNrpn item ) {
|
||||
@ -158,23 +162,23 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
|
||||
public void append( ushort nrpn, byte data_msb ) {
|
||||
m_list.Add( new VsqNrpn( Clock, nrpn, data_msb ) );
|
||||
m_list.add( new VsqNrpn( Clock, nrpn, data_msb ) );
|
||||
}
|
||||
|
||||
public void append( ushort nrpn, byte data_msb, byte data_lsb ) {
|
||||
m_list.Add( new VsqNrpn( Clock, nrpn, data_msb, data_lsb ) );
|
||||
m_list.add( new VsqNrpn( Clock, nrpn, data_msb, data_lsb ) );
|
||||
}
|
||||
|
||||
public void append( ushort nrpn, byte data_msb, bool msb_omit_required ) {
|
||||
public void append( ushort nrpn, byte data_msb, boolean msb_omit_required ) {
|
||||
VsqNrpn v = new VsqNrpn( Clock, nrpn, data_msb );
|
||||
v.msbOmitRequired = msb_omit_required;
|
||||
m_list.Add( v );
|
||||
m_list.add( v );
|
||||
}
|
||||
|
||||
public void append( ushort nrpn, byte data_msb, byte data_lsb, bool msb_omit_required ) {
|
||||
public void append( ushort nrpn, byte data_msb, byte data_lsb, boolean msb_omit_required ) {
|
||||
VsqNrpn v = new VsqNrpn( Clock, nrpn, data_msb, data_lsb );
|
||||
v.msbOmitRequired = msb_omit_required;
|
||||
m_list.Add( v );
|
||||
m_list.add( v );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,17 +13,21 @@
|
||||
*/
|
||||
using System;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
public class VsqPhoneticSymbol {
|
||||
private static string[] _SYMBOL_VOWEL_JP = new string[]{
|
||||
private static String[] _SYMBOL_VOWEL_JP = new String[]{
|
||||
@"a",
|
||||
@"i",
|
||||
@"M",
|
||||
@"e",
|
||||
@"o",
|
||||
};
|
||||
private static string[] _SYMBOL_CONSONANT_JP = new string[]{
|
||||
private static String[] _SYMBOL_CONSONANT_JP = new String[]{
|
||||
@"k",
|
||||
@"k'",
|
||||
@"g",
|
||||
@ -61,7 +65,7 @@ namespace Boare.Lib.Vsq {
|
||||
@"w",
|
||||
@"N\",
|
||||
};
|
||||
private static string[] _SYMBOL_EN = new string[]{
|
||||
private static String[] _SYMBOL_EN = new String[]{
|
||||
@"@",
|
||||
@"V",
|
||||
@"e",
|
||||
@ -117,32 +121,32 @@ namespace Boare.Lib.Vsq {
|
||||
@"h",
|
||||
};
|
||||
|
||||
public static bool isConsonant( string symbol ) {
|
||||
public static boolean isConsonant( String symbol ) {
|
||||
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ){
|
||||
string s = _SYMBOL_CONSONANT_JP[i];
|
||||
if ( s == symbol ) {
|
||||
String s = _SYMBOL_CONSONANT_JP[i];
|
||||
if ( s.Equals( symbol ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool isValidSymbol( string symbol ) {
|
||||
public static boolean isValidSymbol( String symbol ) {
|
||||
for ( int i = 0; i < _SYMBOL_VOWEL_JP.Length; i++ ){
|
||||
string s = _SYMBOL_VOWEL_JP[i];
|
||||
if ( s == symbol ) {
|
||||
String s = _SYMBOL_VOWEL_JP[i];
|
||||
if ( s.Equals( symbol ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.Length; i++ ){
|
||||
string s = _SYMBOL_CONSONANT_JP[i];
|
||||
if ( s == symbol ) {
|
||||
String s = _SYMBOL_CONSONANT_JP[i];
|
||||
if ( s.Equals( symbol ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for ( int i = 0; i < _SYMBOL_EN.Length; i++ ){
|
||||
string s = _SYMBOL_EN[i];
|
||||
if ( s == symbol ) {
|
||||
String s = _SYMBOL_EN[i];
|
||||
if ( s.Equals( symbol ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -14,19 +14,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using bocoree;
|
||||
|
||||
namespace Boare.Lib.Vsq {
|
||||
|
||||
using boolean = System.Boolean;
|
||||
|
||||
/// <summary>
|
||||
/// Stores the data of a vsq track.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public partial class VsqTrack : ICloneable {
|
||||
public string Tag;
|
||||
public String Tag;
|
||||
/// <summary>
|
||||
/// トラックの名前。
|
||||
/// </summary>
|
||||
public string Name;
|
||||
//public String Name;
|
||||
public VsqMetaText MetaText;
|
||||
private int m_edited_start = int.MaxValue;
|
||||
private int m_edited_end = int.MinValue;
|
||||
@ -40,7 +45,7 @@ namespace Boare.Lib.Vsq {
|
||||
m_pos = -1;
|
||||
}
|
||||
|
||||
public bool hasNext() {
|
||||
public boolean hasNext() {
|
||||
for ( int i = m_pos + 1; i < m_list.getCount(); i++ ) {
|
||||
if ( m_list.getElement( i ).ID.type == VsqIDType.Singer ) {
|
||||
return true;
|
||||
@ -76,7 +81,7 @@ namespace Boare.Lib.Vsq {
|
||||
m_pos = -1;
|
||||
}
|
||||
|
||||
public bool hasNext() {
|
||||
public boolean hasNext() {
|
||||
for ( int i = m_pos + 1; i < m_list.getCount(); i++ ) {
|
||||
if ( m_list.getElement( i ).ID.type == VsqIDType.Anote ) {
|
||||
return true;
|
||||
@ -131,6 +136,30 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if ( MetaText == null ) {
|
||||
return "Master Track";
|
||||
} else {
|
||||
return MetaText.Common.Name;
|
||||
}
|
||||
}
|
||||
|
||||
public void setName( String value ) {
|
||||
if ( MetaText != null ) {
|
||||
MetaText.Common.Name = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public String Name {
|
||||
get {
|
||||
return getName();
|
||||
}
|
||||
set {
|
||||
setName( value );
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ピッチベンド。Cent単位
|
||||
/// </summary>
|
||||
@ -143,6 +172,23 @@ namespace Boare.Lib.Vsq {
|
||||
return (double)pit * (double)pbs * inv2_13 * 100.0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 指定したクロック位置において、歌唱を担当している歌手のVsqEventを返します。
|
||||
/// </summary>
|
||||
/// <param name="clock"></param>
|
||||
/// <returns></returns>
|
||||
public VsqEvent getSingerEventAt( int clock ) {
|
||||
VsqEvent last = null;
|
||||
for ( Iterator itr = getSingerEventIterator(); itr.hasNext(); ) {
|
||||
VsqEvent item = (VsqEvent)itr.next();
|
||||
if ( clock < item.Clock ) {
|
||||
return last;
|
||||
}
|
||||
last = item;
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
public void sortEvent() {
|
||||
MetaText.Events.sort();
|
||||
}
|
||||
@ -182,7 +228,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// メタテキストを,指定されたファイルに出力します
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
public void printMetaText( string file ) {
|
||||
public void printMetaText( String file ) {
|
||||
TextMemoryStream tms = new TextMemoryStream();
|
||||
int count = MetaText.getEventList().getCount();
|
||||
int clLast = MetaText.getEventList().getElement( count - 1 ).Clock + 480;
|
||||
@ -190,7 +236,7 @@ namespace Boare.Lib.Vsq {
|
||||
using ( StreamWriter sw = new StreamWriter( file ) ) {
|
||||
tms.rewind();
|
||||
while ( tms.peek() >= 0 ) {
|
||||
string line = tms.readLine();
|
||||
String line = tms.readLine();
|
||||
sw.WriteLine( line );
|
||||
}
|
||||
}
|
||||
@ -232,9 +278,9 @@ namespace Boare.Lib.Vsq {
|
||||
/// <param name="track"></param>
|
||||
/// <param name="new_renderer"></param>
|
||||
/// <param name="singers"></param>
|
||||
public void changeRenderer( string new_renderer, List<VsqID> singers ) {
|
||||
public void changeRenderer( String new_renderer, Vector<VsqID> singers ) {
|
||||
VsqID default_id = null;
|
||||
if ( singers.Count <= 0 ) {
|
||||
if ( singers.size() <= 0 ) {
|
||||
default_id = new VsqID();
|
||||
default_id.type = VsqIDType.Singer;
|
||||
default_id.IconHandle = new IconHandle();
|
||||
@ -247,21 +293,21 @@ namespace Boare.Lib.Vsq {
|
||||
default_id.IconHandle.Program = 0;
|
||||
default_id.IconHandle.Caption = "";
|
||||
} else {
|
||||
default_id = singers[0];
|
||||
default_id = singers.get( 0 );
|
||||
}
|
||||
for ( Iterator itr = getSingerEventIterator(); itr.hasNext(); ) {
|
||||
VsqEvent ve = (VsqEvent)itr.next();
|
||||
int program = ve.ID.IconHandle.Program;
|
||||
bool found = false;
|
||||
for ( int i = 0; i < singers.Count; i++ ) {
|
||||
if ( program == singers[i].IconHandle.Program ) {
|
||||
ve.ID = (VsqID)singers[i].Clone();
|
||||
boolean found = false;
|
||||
for ( int i = 0; i < singers.size(); i++ ) {
|
||||
if ( program == singers.get( i ).IconHandle.Program ) {
|
||||
ve.ID = (VsqID)singers.get( i ).clone();
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !found ) {
|
||||
VsqID add = (VsqID)default_id.Clone();
|
||||
VsqID add = (VsqID)default_id.clone();
|
||||
add.IconHandle.Program = program;
|
||||
ve.ID = add;
|
||||
}
|
||||
@ -274,11 +320,11 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="curve"></param>
|
||||
/// <returns></returns>
|
||||
public VsqBPList getCurve( string curve ) {
|
||||
public VsqBPList getCurve( String curve ) {
|
||||
return MetaText.getElement( curve );
|
||||
}
|
||||
|
||||
public void setCurve( string curve, VsqBPList value ) {
|
||||
public void setCurve( String curve, VsqBPList value ) {
|
||||
MetaText.setElement( curve, value );
|
||||
}
|
||||
|
||||
@ -348,9 +394,9 @@ namespace Boare.Lib.Vsq {
|
||||
/// このインスタンスのコピーを作成します
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public object Clone() {
|
||||
public Object clone() {
|
||||
VsqTrack res = new VsqTrack();
|
||||
res.Name = Name;
|
||||
res.setName( getName() );
|
||||
if ( MetaText != null ) {
|
||||
res.MetaText = (VsqMetaText)MetaText.Clone();
|
||||
}
|
||||
@ -360,6 +406,10 @@ namespace Boare.Lib.Vsq {
|
||||
return res;
|
||||
}
|
||||
|
||||
public object Clone() {
|
||||
return clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Master Trackを構築
|
||||
/// </summary>
|
||||
@ -367,7 +417,8 @@ namespace Boare.Lib.Vsq {
|
||||
/// <param name="numerator"></param>
|
||||
/// <param name="denominator"></param>
|
||||
public VsqTrack( int tempo, int numerator, int denominator ) {
|
||||
this.Name = "Master Track";
|
||||
//this.Name = "Master Track";
|
||||
// metatextがnullのとき,トラック名はMaster Track
|
||||
this.MetaText = null;
|
||||
}
|
||||
|
||||
@ -376,8 +427,7 @@ namespace Boare.Lib.Vsq {
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="singer"></param>
|
||||
public VsqTrack( string name, string singer ) {
|
||||
Name = name;
|
||||
public VsqTrack( String name, String singer ) {
|
||||
MetaText = new VsqMetaText( name, singer );
|
||||
}
|
||||
|
||||
@ -399,28 +449,31 @@ namespace Boare.Lib.Vsq {
|
||||
return counter;
|
||||
}
|
||||
|
||||
public VsqTrack( List<Boare.Lib.Vsq.MidiEvent> midi_event ) {
|
||||
Name = "";
|
||||
public VsqTrack( Vector<Boare.Lib.Vsq.MidiEvent> midi_event, Encoding encoding ) {
|
||||
#if DEBUG
|
||||
bocoree.debug.push_log( "VsqTrack..ctor" );
|
||||
#endif
|
||||
String track_name = "";
|
||||
using ( TextMemoryStream sw = new TextMemoryStream() ) {
|
||||
for ( int i = 0; i < midi_event.Count; i++ ) {
|
||||
if ( midi_event[i].firstByte == 0xff && midi_event[i].data.Length > 0 ) {
|
||||
for ( int i = 0; i < midi_event.size(); i++ ) {
|
||||
if ( midi_event.get( i ).firstByte == 0xff && midi_event.get( i ).data.Length > 0 ) {
|
||||
// meta textを抽出
|
||||
byte type = midi_event[i].data[0];
|
||||
byte type = midi_event.get( i ).data[0];
|
||||
if ( type == 0x01 || type == 0x03 ) {
|
||||
char[] ch = new char[midi_event[i].data.Length - 1];
|
||||
for ( int j = 1; j < midi_event[i].data.Length; j++ ) {
|
||||
ch[j - 1] = (char)midi_event[i].data[j];
|
||||
/*char[] ch = new char[midi_event.get( i ).data.Length - 1];
|
||||
for ( int j = 1; j < midi_event.get( i ).data.Length; j++ ) {
|
||||
ch[j - 1] = (char)midi_event.get( i ).data[j];
|
||||
}
|
||||
string line = new string( ch );
|
||||
|
||||
String line = new String( ch );*/
|
||||
byte[] dat = midi_event.get( i ).data;
|
||||
String line = encoding.GetString( dat, 1, dat.Length - 1 );
|
||||
if ( type == 0x01 ) {
|
||||
int second_colon = line.IndexOf( ':', 3 );
|
||||
line = line.Substring( second_colon + 1 );
|
||||
line = line.Replace( "\\n", "\n" );
|
||||
//line = line.Replace( "\n", Environment.NewLine );
|
||||
string[] lines = line.Split( '\n' );
|
||||
String[] lines = line.Split( '\n' );
|
||||
int c = lines.Length;
|
||||
for ( int j = 0; j < c; j++ ) {
|
||||
if ( j < c - 1 ) {
|
||||
@ -431,7 +484,7 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
//sw.write( line );
|
||||
} else {
|
||||
Name = line;
|
||||
track_name = line;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -440,6 +493,7 @@ namespace Boare.Lib.Vsq {
|
||||
}
|
||||
sw.rewind();
|
||||
MetaText = new VsqMetaText( sw );
|
||||
setName( track_name );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ namespace LipSync {
|
||||
public System.Drawing.Imaging.ImageFormat ImageFormat;
|
||||
public bool UseVfwEncoder = true;
|
||||
public bool IsRawMode = false;
|
||||
public int Step = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ using System.Windows.Forms;
|
||||
using Boare.Lib.AppUtil;
|
||||
using Boare.Lib.Media;
|
||||
using Boare.Lib.Vsq;
|
||||
using bocoree;
|
||||
using Plugin;
|
||||
#if DEBUG
|
||||
using Boare.Lib.Swf;
|
||||
@ -2343,7 +2344,7 @@ namespace LipSync {
|
||||
if ( openVsqDialog.FilterIndex == 0 || Path.GetExtension( openVsqDialog.FileName ).ToLower() == ".vsq" ) {
|
||||
// VsqFileを取得
|
||||
int most_lyrics_track = 0; // 一番歌詞の文字数が多かったトラックの番号
|
||||
VsqFile vsqFile = new VsqFile( openVsqDialog.FileName );
|
||||
VsqFile vsqFile = new VsqFile( openVsqDialog.FileName, Encoding.GetEncoding( "Shift_JIS" ) );
|
||||
AppManager.SaveData.m_totalSec = (float)vsqFile.getTotalSec();
|
||||
|
||||
AppManager.SaveData.m_timesig_ex = new List<TimeSigTableEntry>( vsqFile.TimesigTable.ToArray() );
|
||||
@ -2810,6 +2811,7 @@ namespace LipSync {
|
||||
args.End = fsi.End;
|
||||
args.FileNameParser = fsi.ParserString;
|
||||
args.ImageFormat = fsi.ImageFormat;
|
||||
args.Step = fsi.Step;
|
||||
bgWorkSeriesImage.RunWorkerAsync( args );
|
||||
}
|
||||
}
|
||||
@ -3643,6 +3645,7 @@ namespace LipSync {
|
||||
if ( menuVisualSync.Checked ) {
|
||||
correctPosition();
|
||||
}
|
||||
previewer.Invalidate();
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
@ -3676,6 +3679,7 @@ namespace LipSync {
|
||||
|
||||
long start_frame;
|
||||
AviOutputArguments args = (AviOutputArguments)e.Argument;
|
||||
int step = args.Step;
|
||||
bool is_raw_mode = args.IsRawMode;
|
||||
if ( args.StartSpecified ) {
|
||||
start_frame = (long)(args.Start * AppManager.SaveData.FrameRate);
|
||||
@ -3689,12 +3693,12 @@ namespace LipSync {
|
||||
} else {
|
||||
end_frame = (long)((AppManager.SaveData.m_totalSec) * AppManager.SaveData.FrameRate);
|
||||
}
|
||||
long total_frames = end_frame - start_frame + 1;
|
||||
long total_frames = (end_frame - start_frame) / Math.Abs( step ) + 1;
|
||||
#if !DEBUG
|
||||
try {
|
||||
#endif
|
||||
long count = -1;
|
||||
for ( long frame = start_frame; frame <= end_frame; frame++ ) {
|
||||
for ( long frame = start_frame; frame <= end_frame; frame+= step ) {
|
||||
count++;
|
||||
float now = (float)frame / AppManager.SaveData.FrameRate;
|
||||
Bitmap frm = GetPicture( now, false );
|
||||
@ -3708,7 +3712,7 @@ namespace LipSync {
|
||||
this.Invoke( new Form1_AviWritingChange( ChangeAviWriting ), new object[] { false } );
|
||||
return;
|
||||
}
|
||||
bgWorkSeriesImage.ReportProgress( (int)((double)(frame - start_frame) / (double)(total_frames) * 100.0), new long[] { frame - start_frame, total_frames } );
|
||||
bgWorkSeriesImage.ReportProgress( (int)((double)(frame - start_frame) / (double)(total_frames) * 100.0), new long[] { (frame - start_frame) / Math.Abs( step ), total_frames } );
|
||||
if ( m_avi_cancel ) {
|
||||
m_avi_cancel = false;
|
||||
return;
|
||||
|
@ -20,6 +20,7 @@ using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Text;
|
||||
|
||||
using Boare.Lib.AppUtil;
|
||||
using Boare.Lib.Vsq;
|
||||
@ -266,7 +267,7 @@ namespace LipSync {
|
||||
}
|
||||
AppManager.SaveData.m_totalSec = Math.Max( AppManager.SaveData.m_totalSec, (float)ust.getTotalSec() );
|
||||
} else {
|
||||
VsqFile vsqFile = new VsqFile( filename );
|
||||
VsqFile vsqFile = new VsqFile( filename, Encoding.GetEncoding( "Shift_JIS" ) );
|
||||
int tracks = vsqFile.Track.Count;
|
||||
string[] track_names = new string[tracks];
|
||||
for ( int track = 0; track < tracks; track++ ) {
|
||||
|
@ -53,6 +53,11 @@ namespace LipSync {
|
||||
this.comboFormat = new System.Windows.Forms.ComboBox();
|
||||
this.lblParser = new System.Windows.Forms.Label();
|
||||
this.txtPreview = new System.Windows.Forms.TextBox();
|
||||
this.txtStep = new System.Windows.Forms.TextBox();
|
||||
this.chkStep = new System.Windows.Forms.CheckBox();
|
||||
this.lblStart = new System.Windows.Forms.Label();
|
||||
this.lblEnd = new System.Windows.Forms.Label();
|
||||
this.lblStep = new System.Windows.Forms.Label();
|
||||
this.groupStartEnd.SuspendLayout();
|
||||
this.groupFileName.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -91,7 +96,7 @@ namespace LipSync {
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point( 371, 283 );
|
||||
this.btnCancel.Location = new System.Drawing.Point( 371, 309 );
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size( 75, 23 );
|
||||
this.btnCancel.TabIndex = 13;
|
||||
@ -101,7 +106,7 @@ namespace LipSync {
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnOK.Location = new System.Drawing.Point( 272, 283 );
|
||||
this.btnOK.Location = new System.Drawing.Point( 272, 309 );
|
||||
this.btnOK.Name = "btnOK";
|
||||
this.btnOK.Size = new System.Drawing.Size( 75, 23 );
|
||||
this.btnOK.TabIndex = 12;
|
||||
@ -124,13 +129,18 @@ namespace LipSync {
|
||||
//
|
||||
this.groupStartEnd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupStartEnd.Controls.Add( this.lblStep );
|
||||
this.groupStartEnd.Controls.Add( this.lblEnd );
|
||||
this.groupStartEnd.Controls.Add( this.lblStart );
|
||||
this.groupStartEnd.Controls.Add( this.txtStep );
|
||||
this.groupStartEnd.Controls.Add( this.chkStep );
|
||||
this.groupStartEnd.Controls.Add( this.txtEnd );
|
||||
this.groupStartEnd.Controls.Add( this.txtStart );
|
||||
this.groupStartEnd.Controls.Add( this.chkEnd );
|
||||
this.groupStartEnd.Controls.Add( this.chkStart );
|
||||
this.groupStartEnd.Location = new System.Drawing.Point( 14, 41 );
|
||||
this.groupStartEnd.Name = "groupStartEnd";
|
||||
this.groupStartEnd.Size = new System.Drawing.Size( 432, 89 );
|
||||
this.groupStartEnd.Size = new System.Drawing.Size( 432, 112 );
|
||||
this.groupStartEnd.TabIndex = 7;
|
||||
this.groupStartEnd.TabStop = false;
|
||||
this.groupStartEnd.Text = "出力範囲を指定";
|
||||
@ -174,7 +184,7 @@ namespace LipSync {
|
||||
this.groupFileName.Controls.Add( this.comboFormat );
|
||||
this.groupFileName.Controls.Add( this.lblParser );
|
||||
this.groupFileName.Controls.Add( this.txtPreview );
|
||||
this.groupFileName.Location = new System.Drawing.Point( 14, 136 );
|
||||
this.groupFileName.Location = new System.Drawing.Point( 14, 159 );
|
||||
this.groupFileName.Name = "groupFileName";
|
||||
this.groupFileName.Size = new System.Drawing.Size( 432, 132 );
|
||||
this.groupFileName.TabIndex = 20;
|
||||
@ -241,13 +251,59 @@ namespace LipSync {
|
||||
this.txtPreview.Size = new System.Drawing.Size( 159, 94 );
|
||||
this.txtPreview.TabIndex = 1;
|
||||
//
|
||||
// txtStep
|
||||
//
|
||||
this.txtStep.Location = new System.Drawing.Point( 90, 78 );
|
||||
this.txtStep.Name = "txtStep";
|
||||
this.txtStep.Size = new System.Drawing.Size( 144, 19 );
|
||||
this.txtStep.TabIndex = 13;
|
||||
this.txtStep.Text = "1";
|
||||
this.txtStep.TextChanged += new System.EventHandler( this.txtStep_TextChanged );
|
||||
//
|
||||
// chkStep
|
||||
//
|
||||
this.chkStep.AutoSize = true;
|
||||
this.chkStep.Location = new System.Drawing.Point( 19, 80 );
|
||||
this.chkStep.Name = "chkStep";
|
||||
this.chkStep.Size = new System.Drawing.Size( 48, 16 );
|
||||
this.chkStep.TabIndex = 12;
|
||||
this.chkStep.Text = "増分";
|
||||
this.chkStep.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lblStart
|
||||
//
|
||||
this.lblStart.AutoSize = true;
|
||||
this.lblStart.Location = new System.Drawing.Point( 240, 28 );
|
||||
this.lblStart.Name = "lblStart";
|
||||
this.lblStart.Size = new System.Drawing.Size( 23, 12 );
|
||||
this.lblStart.TabIndex = 14;
|
||||
this.lblStart.Text = "sec";
|
||||
//
|
||||
// lblEnd
|
||||
//
|
||||
this.lblEnd.AutoSize = true;
|
||||
this.lblEnd.Location = new System.Drawing.Point( 240, 56 );
|
||||
this.lblEnd.Name = "lblEnd";
|
||||
this.lblEnd.Size = new System.Drawing.Size( 23, 12 );
|
||||
this.lblEnd.TabIndex = 15;
|
||||
this.lblEnd.Text = "sec";
|
||||
//
|
||||
// lblStep
|
||||
//
|
||||
this.lblStep.AutoSize = true;
|
||||
this.lblStep.Location = new System.Drawing.Point( 240, 81 );
|
||||
this.lblStep.Name = "lblStep";
|
||||
this.lblStep.Size = new System.Drawing.Size( 34, 12 );
|
||||
this.lblStep.TabIndex = 16;
|
||||
this.lblStep.Text = "frame";
|
||||
//
|
||||
// FormSeriesImage
|
||||
//
|
||||
this.AcceptButton = this.btnOK;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.btnCancel;
|
||||
this.ClientSize = new System.Drawing.Size( 460, 323 );
|
||||
this.ClientSize = new System.Drawing.Size( 460, 349 );
|
||||
this.Controls.Add( this.groupFileName );
|
||||
this.Controls.Add( this.groupStartEnd );
|
||||
this.Controls.Add( this.btnCancel );
|
||||
@ -289,5 +345,10 @@ namespace LipSync {
|
||||
private System.Windows.Forms.Label lblParser;
|
||||
private System.Windows.Forms.Label lblFormat;
|
||||
private System.Windows.Forms.CheckBox chkAutomaticallyAddExtension;
|
||||
private System.Windows.Forms.TextBox txtStep;
|
||||
private System.Windows.Forms.CheckBox chkStep;
|
||||
private System.Windows.Forms.Label lblStep;
|
||||
private System.Windows.Forms.Label lblEnd;
|
||||
private System.Windows.Forms.Label lblStart;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ namespace LipSync {
|
||||
public partial class FormSeriesImage : Form, IMultiLanguageControl {
|
||||
float m_start = 0f;
|
||||
float m_end = 0f;
|
||||
int m_step = 1;
|
||||
|
||||
public FormSeriesImage() {
|
||||
InitializeComponent();
|
||||
@ -60,7 +61,7 @@ namespace LipSync {
|
||||
public string ParserString {
|
||||
get {
|
||||
if ( chkAutomaticallyAddExtension.Checked ) {
|
||||
return txtParser.Text + "." + Misc.GetExtensionFromImageFormat( ImageFormat );
|
||||
return txtParser.Text + Misc.GetExtensionFromImageFormat( ImageFormat );
|
||||
} else {
|
||||
return txtParser.Text;
|
||||
}
|
||||
@ -103,6 +104,7 @@ namespace LipSync {
|
||||
groupStartEnd.Text = _( "Specify output range" );
|
||||
chkStart.Text = _( "Start" );
|
||||
chkEnd.Text = _( "End" );
|
||||
chkStep.Text = _( "Step" );
|
||||
groupFileName.Text = _( "File Name" );
|
||||
lblParser.Text = _( "Parser String" );
|
||||
chkAutomaticallyAddExtension.Text = _( "Automatically Add Extension" );
|
||||
@ -125,6 +127,12 @@ namespace LipSync {
|
||||
}
|
||||
}
|
||||
|
||||
public int Step {
|
||||
get {
|
||||
return m_step;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOK_Click( object sender, EventArgs e ) {
|
||||
try {
|
||||
m_start = float.Parse( txtStart.Text );
|
||||
@ -202,6 +210,16 @@ namespace LipSync {
|
||||
private void chkAutomaticallyAddExtension_CheckedChanged( object sender, EventArgs e ) {
|
||||
UpdateSampleFileNames();
|
||||
}
|
||||
|
||||
private void txtStep_TextChanged( object sender, EventArgs e ) {
|
||||
int draft;
|
||||
if ( !int.TryParse( txtStep.Text, out draft ) ) {
|
||||
return;
|
||||
}
|
||||
if ( draft != 0 ) {
|
||||
m_step = draft;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -252,6 +252,9 @@
|
||||
<EmbeddedResource Include="Editor\FormCurveExport.resx">
|
||||
<DependentUpon>FormCurveExport.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Editor\FormSeriesImage.resx">
|
||||
<DependentUpon>FormSeriesImage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
@ -30,4 +30,4 @@ using System.Runtime.InteropServices;
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion( "1.0.0.0" )]
|
||||
[assembly: AssemblyFileVersion( "2.4.8" )]
|
||||
[assembly: AssemblyFileVersion( "2.4.9_DRAFT_07Sep2009" )]
|
||||
|
25
trunk/bocoree/Collections.cs
Normal file
25
trunk/bocoree/Collections.cs
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Collections.cs
|
||||
* Copyright (c) 2009 kbinani
|
||||
*
|
||||
* This file is part of Boare.Cadencii.
|
||||
*
|
||||
* Boare.Cadencii is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GPLv3 License.
|
||||
*
|
||||
* Boare.Cadencii 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.
|
||||
*/
|
||||
//#define VECTOR_TEST
|
||||
namespace bocoree {
|
||||
|
||||
public static class Collections {
|
||||
public static void sort<T>( Vector<T> list ) {
|
||||
#if !VECTOR_TEST
|
||||
list.Sort();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
64
trunk/bocoree/Graphics.cs
Normal file
64
trunk/bocoree/Graphics.cs
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Graphics.cs
|
||||
* Copyright (c) 2009 kbinani
|
||||
*
|
||||
* This file is part of Boare.Cadencii.
|
||||
*
|
||||
* Boare.Cadencii is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GPLv3 License.
|
||||
*
|
||||
* Boare.Cadencii 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;
|
||||
using System.Drawing;
|
||||
|
||||
namespace bocoree {
|
||||
|
||||
public class Graphics2D {
|
||||
private System.Drawing.Graphics m_graphics;
|
||||
private Color m_color = Color.Black;
|
||||
private Pen m_pen = Pens.Black;
|
||||
private SolidBrush m_brush = new SolidBrush( Color.Black );
|
||||
|
||||
public Graphics2D( System.Drawing.Graphics g ) {
|
||||
m_graphics = g;
|
||||
}
|
||||
|
||||
public void clearRect( int x, int y, int width, int height ) {
|
||||
m_graphics.FillRectangle( System.Drawing.Brushes.White, x, y, width, height );
|
||||
}
|
||||
|
||||
public void drawLine( int x1, int y1, int x2, int y2 ) {
|
||||
m_graphics.DrawLine( m_pen, x1, y1, x2, y2 );
|
||||
}
|
||||
|
||||
public void drawRect( int x, int y, int width, int height ) {
|
||||
m_graphics.DrawRectangle( m_pen, x, y, width, height );
|
||||
}
|
||||
|
||||
public void fillRect( int x, int y, int width, int height ) {
|
||||
m_graphics.FillRectangle( m_brush, x, y, width, height );
|
||||
}
|
||||
|
||||
public void drawOval( int x, int y, int width, int height ) {
|
||||
m_graphics.DrawEllipse( m_pen, x, y, width, height );
|
||||
}
|
||||
|
||||
public void fillOval( int x, int y, int width, int height ) {
|
||||
m_graphics.FillRectangle( m_brush, x, y, width, height );
|
||||
}
|
||||
|
||||
public void setColor( System.Drawing.Color c ) {
|
||||
m_color = c;
|
||||
m_pen.Color = c;
|
||||
m_brush.Color = c;
|
||||
}
|
||||
|
||||
public Color getColor() {
|
||||
return m_color;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
22
trunk/bocoree/Iterator.cs
Normal file
22
trunk/bocoree/Iterator.cs
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Iterator.cs
|
||||
* Copyright (c) 2009 kbinani
|
||||
*
|
||||
* This file is part of Boare.Cadencii.
|
||||
*
|
||||
* Boare.Cadencii is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GPLv3 License.
|
||||
*
|
||||
* Boare.Cadencii 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.
|
||||
*/
|
||||
namespace bocoree {
|
||||
|
||||
public interface Iterator {
|
||||
bool hasNext();
|
||||
object next();
|
||||
void remove();
|
||||
}
|
||||
|
||||
}
|
58
trunk/bocoree/ListIterator.cs
Normal file
58
trunk/bocoree/ListIterator.cs
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* ListIterator.cs
|
||||
* Copyright (c) 2009 kbinani
|
||||
*
|
||||
* This file is part of Boare.Cadencii.
|
||||
*
|
||||
* Boare.Cadencii is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GPLv3 License.
|
||||
*
|
||||
* Boare.Cadencii 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;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace bocoree {
|
||||
|
||||
public class ListIterator<T> : Iterator {
|
||||
private List<T> m_list;
|
||||
private int m_pos;
|
||||
|
||||
public ListIterator( Vector<T> list ) {
|
||||
m_list = new List<T>();
|
||||
int c = list.size();
|
||||
for( int i = 0; i < c; i++ ){
|
||||
m_list.Add( list.get( i ) );
|
||||
}
|
||||
m_pos = -1;
|
||||
}
|
||||
|
||||
public ListIterator( List<T> 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 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
106
trunk/bocoree/TreeMap.cs
Normal file
106
trunk/bocoree/TreeMap.cs
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* TreeMap.cs
|
||||
* Copyright (c) 2009 kbinani
|
||||
*
|
||||
* This file is part of Boare.Cadencii.
|
||||
*
|
||||
* Boare.Cadencii is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GPLv3 License.
|
||||
*
|
||||
* Boare.Cadencii 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.
|
||||
*/
|
||||
//#define DICTIONARY_TEST
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace bocoree {
|
||||
|
||||
[Serializable]
|
||||
#if DICTIONARY_TEST
|
||||
public class TreeMap<K, V> {
|
||||
public V remove( Object key ) {
|
||||
return default( V );
|
||||
}
|
||||
|
||||
public Vector<K> keySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public V get( K key ) {
|
||||
return default( V );
|
||||
}
|
||||
|
||||
public V put( K key, V value ) {
|
||||
return default( V );
|
||||
}
|
||||
|
||||
public bool containsKey( Object key ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
public class TreeMap<K, V> : Dictionary<K, V> {
|
||||
public TreeMap()
|
||||
: base() {
|
||||
}
|
||||
|
||||
protected TreeMap( SerializationInfo info, StreamingContext context )
|
||||
: base( info, context ) {
|
||||
}
|
||||
|
||||
public V remove( Object key ) {
|
||||
K k = (K)key;
|
||||
if ( base.ContainsKey( k ) ) {
|
||||
V old = base[k];
|
||||
base.Remove( k );
|
||||
return old;
|
||||
} else {
|
||||
base.Remove( k );
|
||||
return default( V );
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<K> keySet() {
|
||||
return new Vector<K>( base.Keys );
|
||||
}
|
||||
|
||||
public V get( K key ){
|
||||
return base[key];
|
||||
}
|
||||
|
||||
public int size(){
|
||||
return base.Count;
|
||||
}
|
||||
|
||||
public bool containsKey( Object key ) {
|
||||
return base.ContainsKey( (K)key );
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
base.Clear();
|
||||
}
|
||||
|
||||
public V put( K key, V value ) {
|
||||
if ( base.ContainsKey( key ) ){
|
||||
V old = base[key];
|
||||
base[key] = value;
|
||||
return old;
|
||||
} else {
|
||||
base.Add( key, value );
|
||||
return default( V );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
174
trunk/bocoree/Vector.cs
Normal file
174
trunk/bocoree/Vector.cs
Normal file
@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Vector.cs
|
||||
* Copyright (c) 2009 kbinani
|
||||
*
|
||||
* This file is part of Boare.Cadencii.
|
||||
*
|
||||
* Boare.Cadencii is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GPLv3 License.
|
||||
*
|
||||
* Boare.Cadencii 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.
|
||||
*/
|
||||
//#define VECTOR_TEST
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace bocoree {
|
||||
|
||||
[Serializable]
|
||||
#if VECTOR_TEST
|
||||
public class Vector<T> {
|
||||
public Vector( int capacity ) {
|
||||
}
|
||||
|
||||
public Vector( Vector<T> array ) {
|
||||
}
|
||||
|
||||
public Vector( T[] array ){
|
||||
}
|
||||
|
||||
public Vector(){
|
||||
}
|
||||
|
||||
public void addAll( T[] array ) {
|
||||
}
|
||||
|
||||
public void addAll( Vector<T> array ) {
|
||||
}
|
||||
|
||||
public void insertElementAt( T obj, int index ) {
|
||||
}
|
||||
|
||||
public void removeElementAt( int index ) {
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public T get( int index ) {
|
||||
return default( T );
|
||||
}
|
||||
|
||||
public void set( int index, T value ) {
|
||||
}
|
||||
|
||||
public Object[] toArray() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public T[] toArray( T[] array ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterator iterator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void add( T obj ) {
|
||||
}
|
||||
|
||||
public void Add( T obj ) {
|
||||
}
|
||||
|
||||
public bool contains( T obj ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
}
|
||||
}
|
||||
#else
|
||||
public class Vector<T> : List<T> {
|
||||
public Vector( ICollection<T> list ) :
|
||||
base( list ) {
|
||||
}
|
||||
|
||||
public Vector( int capacity )
|
||||
: base( capacity ) {
|
||||
}
|
||||
|
||||
public Vector( Vector<T> array )
|
||||
: base( array.toArray( new T[]{} ) ){
|
||||
}
|
||||
|
||||
public void addAll( T[] array ) {
|
||||
base.AddRange( array );
|
||||
}
|
||||
|
||||
public void addAll( Vector<T> array ) {
|
||||
base.AddRange( array );
|
||||
}
|
||||
|
||||
public void insertElementAt( T obj, int index ){
|
||||
base.Insert( index, obj );
|
||||
}
|
||||
|
||||
public bool removeElement( T obj ) {
|
||||
return base.Remove( obj );
|
||||
}
|
||||
|
||||
public void removeElementAt( int index ){
|
||||
base.RemoveAt( index );
|
||||
}
|
||||
|
||||
public Vector( T[] array )
|
||||
: base( array ) {
|
||||
}
|
||||
|
||||
public Vector()
|
||||
: base() {
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
base.Clear();
|
||||
}
|
||||
|
||||
public bool contains( T obj ){
|
||||
return base.Contains( obj );
|
||||
}
|
||||
|
||||
public void add( T obj ) {
|
||||
base.Add( obj );
|
||||
}
|
||||
|
||||
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 Object[] toArray() {
|
||||
int c = size();
|
||||
Object[] ret = new Object[c];
|
||||
for( int i = 0; i < c; i++ ){
|
||||
ret[i] = base[i];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public T[] toArray( T[] array ) {
|
||||
int c = size();
|
||||
T[] ret = new T[c];
|
||||
for( int i = 0; i < c; i++ ){
|
||||
ret[i] = base[i];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Iterator iterator() {
|
||||
return new ListIterator<T>( this );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{C8AAE632-9C6C-4372-8175-811528A66742}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
@ -56,12 +56,18 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Collections.cs" />
|
||||
<Compile Include="cp932.cs" />
|
||||
<Compile Include="cp932reader.cs" />
|
||||
<Compile Include="cp932writer.cs" />
|
||||
<Compile Include="fft.cs" />
|
||||
<Compile Include="Graphics.cs" />
|
||||
<Compile Include="Iterator.cs" />
|
||||
<Compile Include="ListIterator.cs" />
|
||||
<Compile Include="math.cs" />
|
||||
<Compile Include="misc.cs" />
|
||||
<Compile Include="TreeMap.cs" />
|
||||
<Compile Include="Vector.cs" />
|
||||
<Compile Include="winmm.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="windows.cs" />
|
||||
|
@ -19,6 +19,86 @@ using System.Collections.Generic;
|
||||
|
||||
namespace bocoree {
|
||||
|
||||
public class _FOO_BAR_STRING {
|
||||
public static bool operator !=( _FOO_BAR_STRING a, _FOO_BAR_STRING b ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool operator ==( _FOO_BAR_STRING a, _FOO_BAR_STRING b ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int Length {
|
||||
get {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING[] Split( params char[] separator ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING[] Split( char[] separator, int count ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING[] Split( char[] separator, StringSplitOptions options ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING[] Split( _FOO_BAR_STRING[] separator, StringSplitOptions options ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING[] Split( char[] separator, int count, StringSplitOptions options ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING[] Split( _FOO_BAR_STRING[] separator, int count, StringSplitOptions options ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING Substring( int startIndex ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING Substring( int startIndex, int length ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public char[] ToCharArray() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public char[] ToCharArray( int startIndex, int length ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING ToLower() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING ToLowerInvariant() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING ToUpper() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING ToUpperInvariant() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public _FOO_BAR_STRING Trim() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static class misc {
|
||||
/// <summary>
|
||||
/// Reflectionを利用して、インスタンスのディープなクローニングを行います。
|
||||
|
@ -1,3 +0,0 @@
|
||||
todo: タイムラインの灰色の部分をクリックしてプレイポジションを変更しても,画面が更新されない.
|
||||
todo: 連続BMP出力機能,自動で拡張子を付けるのを有効にすると,拡張子のピリオドが2つ追加されてしまう.
|
||||
todo: CadenciiのBoare.Lib.Vsqソースコードを輸入.
|
Loading…
Reference in New Issue
Block a user