git-svn-id: http://svn.sourceforge.jp/svnroot/lipsync@5 b1f601f4-4f45-0410-8980-aecacb008692

This commit is contained in:
kbinani 2009-06-25 14:09:54 +00:00
parent 09b7366d95
commit 775d25e7fa
597 changed files with 0 additions and 64861 deletions

View File

@ -1,239 +0,0 @@
namespace Background {
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using Plugin;
public class Background : IPlugin {
public void ApplyLanguage( string language_code ) {
}
/// <summary>
/// プラグインの名称
/// </summary>
public string Name {
get {
return "Background";
}
}
/// <summary>
/// プラグインのタイプを表す。
/// </summary>
public ulong Type {
get {
return Constants.LS_ENABLES_ENTRY_SETTING + Constants.LS_NO_EVENT_HANDLER;
}
}
/// <summary>
/// プラグインの簡潔な説明文。
/// </summary>
public string Abstract {
get {
return "画像を配置するプラグインです。様々な特効が使えます。";
}
}
/// <summary>
/// イベントハンドラ。このプラグインの設定メニューが押された時呼び出されます。
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public DialogResult BaseSetting() {
return DialogResult.Cancel;
}
public DialogResult EntrySetting( ref string config ) {
EntryConfig cfg = new EntryConfig( config );
DialogResult result;
using ( entry_config dlg = new entry_config( cfg ) ) {
result = dlg.ShowDialog();
if ( result == DialogResult.OK ) {
cfg = dlg.Config;
config = cfg.ToString();
}
}
return result;
}
/// <summary>
/// 設定値を格納した文字列を指定します。
/// </summary>
/// <returns></returns>
public string Config {
get {
return "";
}
set {
}
}
private Bitmap m_bmp;
private string m_last_file = "";
/// <summary>
/// フレームに加工を施す関数
/// </summary>
/// <param name="bmp"></param>
/// <param name="time"></param>
public void Apply( ref Bitmap bmp, float time, float e_begin, float e_end, ref string e_body ) {
EntryConfig cfg = new EntryConfig( e_body );
if ( m_last_file != "" ) {
if ( m_last_file != cfg.File ) {
Image img = ImageFromFile( cfg.File );
if ( img != null ) {
m_bmp = new Bitmap( img.Width, img.Height, PixelFormat.Format32bppArgb );
using ( Graphics gx = Graphics.FromImage( m_bmp ) ) {
gx.DrawImage( img, 0, 0, img.Width, img.Height );
}
}
m_last_file = cfg.File;
}
} else {
Image img = ImageFromFile( cfg.File );
if ( img != null ) {
m_bmp = new Bitmap( img.Width, img.Height, PixelFormat.Format32bppArgb );
using ( Graphics gx = Graphics.FromImage( m_bmp ) ) {
gx.DrawImage( img, 0, 0, img.Width, img.Height );
}
}
}
float alpha = 1f;
if ( cfg.FadeIn ) {
float diff = time - e_begin;
if ( 0f <= diff && diff <= cfg.FadeInRatio ) {
alpha = 1.0f / cfg.FadeInRatio * diff;
}
}
if ( cfg.FadeOut ) {
float diff = e_end - time;
if ( 0f <= diff && diff <= cfg.FadeOutRatio ) {
alpha = 1.0f / cfg.FadeOutRatio * diff;
}
}
if ( m_bmp != null ) {
using ( Graphics g = Graphics.FromImage( bmp ) ) {
//g.DrawImage( m_bmp, cfg.X, cfg.Y, m_bmp.Width * cfg.Scale, m_bmp.Height * cfg.Scale );
ColorMatrix cm = new ColorMatrix();
cm.Matrix00 = 1;
cm.Matrix11 = 1;
cm.Matrix22 = 1;
cm.Matrix33 = alpha;
cm.Matrix44 = 1;
ImageAttributes ia = new ImageAttributes();
ia.SetColorMatrix( cm );
int width = (int)(m_bmp.Width * cfg.Scale);
int height = (int)(m_bmp.Height * cfg.Scale);
int iwidth = m_bmp.Width;
int iheight = m_bmp.Height;
g.DrawImage( m_bmp, new Rectangle( cfg.X, cfg.Y, width, height ),
0, 0, iwidth, iheight, GraphicsUnit.Pixel, ia );
}
}
}
/// <summary>
/// 指定したパスのファイルからイメージを読み込みます
/// </summary>
/// <param name="fpath"></param>
/// <returns></returns>
public static Image ImageFromFile( string fpath ) {
Image result = null;
if ( File.Exists( fpath ) ) {
using ( FileStream fs = new FileStream( fpath, FileMode.Open, FileAccess.Read ) ) {
result = Image.FromStream( fs );
}
}
return result;
}
public void Render( Graphics g, Size size, float time, string mouth, string reserved ) {
}
}
public struct EntryConfig {
public string File;
public bool FadeIn;
public bool FadeOut;
public int X;
public int Y;
public float Scale;
public float FadeInRatio;
public float FadeOutRatio;
public EntryConfig( string config ) {
string[] spl = config.Split( new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries );
File = "";
FadeIn = false;
FadeOut = false;
X = 0;
Y = 0;
Scale = 1f;
FadeInRatio = 2f;
FadeOutRatio = 2f;
foreach ( string entry in spl ) {
string[] spl2 = entry.Split( new char[] { '=' } );
switch ( spl2[0] ) {
case "File":
File = spl2[1];
break;
case "FadeIn":
if ( spl2[1] == TRUE ) {
FadeIn = true;
} else {
FadeIn = false;
}
break;
case "FadeOut":
if ( spl2[1] == TRUE ) {
FadeOut = true;
} else {
FadeOut = false;
}
break;
case "X":
X = int.Parse( spl2[1] );
break;
case "Y":
Y = int.Parse( spl2[1] );
break;
case "Scale":
Scale = float.Parse( spl2[1] );
break;
case "FadeInRatio":
FadeInRatio = float.Parse( spl2[1] );
break;
case "FadeOutRatio":
FadeOutRatio = float.Parse( spl2[1] );
break;
}
}
}
private const string TRUE = "true";
private const string FALSE = "false";
new public string ToString() {
string fadein, fadeout;
if ( FadeIn ) {
fadein = TRUE;
} else {
fadein = FALSE;
}
if ( FadeOut ) {
fadeout = TRUE;
} else {
fadeout = FALSE;
}
return "File=" + File + "\nFadeIn=" + fadein + "\nFadeOut=" + fadeout + "\nX=" + X + "\nY=" + Y + "\nScale=" + Scale + "\nFadeInRatio=" + FadeInRatio + "\nFadeOutRatio=" + FadeOutRatio;
}
}
}

View File

@ -1,77 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Background</RootNamespace>
<AssemblyName>Background</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Background.cs" />
<Compile Include="entry_config.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="entry_config.Designer.cs">
<DependentUpon>entry_config.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="entry_config.resx">
<SubType>Designer</SubType>
<DependentUpon>entry_config.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IPlugin\IPlugin.csproj">
<Project>{FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}</Project>
<Name>IPlugin</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle( "Background" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Boare" )]
[assembly: AssemblyProduct( "Background" )]
[assembly: AssemblyCopyright( "Copyright (C) 2008" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントには
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible( false )]
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid( "8c648f56-5cc7-432d-a8a5-73ed17b699b1" )]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を
// 既定値にすることができます:
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

View File

@ -1,289 +0,0 @@
namespace Background {
partial class entry_config {
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose( bool disposing ) {
if ( disposing && (components != null) ) {
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent() {
this.btnCancel = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.txtFile = new System.Windows.Forms.TextBox();
this.btnFile = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.txtX = new System.Windows.Forms.TextBox();
this.txtY = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.dialogImage = new System.Windows.Forms.OpenFileDialog();
this.label4 = new System.Windows.Forms.Label();
this.txtScale = new System.Windows.Forms.TextBox();
this.chkFadeIn = new System.Windows.Forms.CheckBox();
this.chkFadeOut = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtFadeOutRatio = new System.Windows.Forms.TextBox();
this.txtFadeInRatio = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point( 280, 238 );
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size( 75, 23 );
this.btnCancel.TabIndex = 21;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point( 181, 238 );
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size( 75, 23 );
this.btnOK.TabIndex = 20;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler( this.btnOK_Click );
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point( 12, 15 );
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size( 63, 12 );
this.label1.TabIndex = 22;
this.label1.Text = "画像ファイル";
//
// txtFile
//
this.txtFile.Location = new System.Drawing.Point( 81, 12 );
this.txtFile.Name = "txtFile";
this.txtFile.Size = new System.Drawing.Size( 244, 19 );
this.txtFile.TabIndex = 23;
//
// btnFile
//
this.btnFile.Location = new System.Drawing.Point( 331, 10 );
this.btnFile.Name = "btnFile";
this.btnFile.Size = new System.Drawing.Size( 24, 23 );
this.btnFile.TabIndex = 24;
this.btnFile.Text = "...";
this.btnFile.UseVisualStyleBackColor = true;
this.btnFile.Click += new System.EventHandler( this.btnFile_Click );
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point( 12, 24 );
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size( 12, 12 );
this.label2.TabIndex = 25;
this.label2.Text = "X";
//
// txtX
//
this.txtX.Location = new System.Drawing.Point( 30, 21 );
this.txtX.Name = "txtX";
this.txtX.Size = new System.Drawing.Size( 100, 19 );
this.txtX.TabIndex = 26;
this.txtX.Text = "0";
//
// txtY
//
this.txtY.Location = new System.Drawing.Point( 213, 21 );
this.txtY.Name = "txtY";
this.txtY.Size = new System.Drawing.Size( 100, 19 );
this.txtY.TabIndex = 28;
this.txtY.Text = "0";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point( 195, 24 );
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size( 12, 12 );
this.label3.TabIndex = 27;
this.label3.Text = "Y";
//
// dialogImage
//
this.dialogImage.Filter = "Image Files|*.bmp;*.png;*.jpg|All Files|*.*";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point( 12, 60 );
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size( 53, 12 );
this.label4.TabIndex = 29;
this.label4.Text = "表示倍率";
//
// txtScale
//
this.txtScale.Location = new System.Drawing.Point( 71, 57 );
this.txtScale.Name = "txtScale";
this.txtScale.Size = new System.Drawing.Size( 100, 19 );
this.txtScale.TabIndex = 30;
this.txtScale.Text = "1.0";
//
// chkFadeIn
//
this.chkFadeIn.AutoSize = true;
this.chkFadeIn.Location = new System.Drawing.Point( 18, 24 );
this.chkFadeIn.Name = "chkFadeIn";
this.chkFadeIn.Size = new System.Drawing.Size( 76, 16 );
this.chkFadeIn.TabIndex = 31;
this.chkFadeIn.Text = "フェードイン";
this.chkFadeIn.UseVisualStyleBackColor = true;
this.chkFadeIn.CheckedChanged += new System.EventHandler( this.chkFadeIn_CheckedChanged );
//
// chkFadeOut
//
this.chkFadeOut.AutoSize = true;
this.chkFadeOut.Location = new System.Drawing.Point( 18, 59 );
this.chkFadeOut.Name = "chkFadeOut";
this.chkFadeOut.Size = new System.Drawing.Size( 84, 16 );
this.chkFadeOut.TabIndex = 32;
this.chkFadeOut.Text = "フェードアウト";
this.chkFadeOut.UseVisualStyleBackColor = true;
this.chkFadeOut.CheckedChanged += new System.EventHandler( this.chkFadeOut_CheckedChanged );
//
// groupBox1
//
this.groupBox1.Controls.Add( this.txtFadeOutRatio );
this.groupBox1.Controls.Add( this.txtFadeInRatio );
this.groupBox1.Controls.Add( this.label6 );
this.groupBox1.Controls.Add( this.label5 );
this.groupBox1.Controls.Add( this.chkFadeIn );
this.groupBox1.Controls.Add( this.chkFadeOut );
this.groupBox1.Location = new System.Drawing.Point( 12, 136 );
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size( 343, 90 );
this.groupBox1.TabIndex = 33;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Fade IN/OUT";
//
// txtFadeOutRatio
//
this.txtFadeOutRatio.Enabled = false;
this.txtFadeOutRatio.Location = new System.Drawing.Point( 227, 57 );
this.txtFadeOutRatio.Name = "txtFadeOutRatio";
this.txtFadeOutRatio.Size = new System.Drawing.Size( 103, 19 );
this.txtFadeOutRatio.TabIndex = 36;
//
// txtFadeInRatio
//
this.txtFadeInRatio.Enabled = false;
this.txtFadeInRatio.Location = new System.Drawing.Point( 227, 22 );
this.txtFadeInRatio.Name = "txtFadeInRatio";
this.txtFadeInRatio.Size = new System.Drawing.Size( 103, 19 );
this.txtFadeInRatio.TabIndex = 35;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point( 138, 60 );
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size( 83, 12 );
this.label6.TabIndex = 34;
this.label6.Text = "効果時間(秒):";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point( 138, 25 );
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size( 83, 12 );
this.label5.TabIndex = 33;
this.label5.Text = "効果時間(秒):";
//
// groupBox2
//
this.groupBox2.Controls.Add( this.txtScale );
this.groupBox2.Controls.Add( this.label4 );
this.groupBox2.Controls.Add( this.txtX );
this.groupBox2.Controls.Add( this.label2 );
this.groupBox2.Controls.Add( this.txtY );
this.groupBox2.Controls.Add( this.label3 );
this.groupBox2.Location = new System.Drawing.Point( 12, 37 );
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size( 343, 93 );
this.groupBox2.TabIndex = 34;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Position and Scale";
//
// entry_config
//
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( 369, 273 );
this.Controls.Add( this.groupBox2 );
this.Controls.Add( this.groupBox1 );
this.Controls.Add( this.btnFile );
this.Controls.Add( this.txtFile );
this.Controls.Add( this.label1 );
this.Controls.Add( this.btnCancel );
this.Controls.Add( this.btnOK );
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "entry_config";
this.ShowInTaskbar = false;
this.Text = "EntryConfig";
this.groupBox1.ResumeLayout( false );
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout( false );
this.groupBox2.PerformLayout();
this.ResumeLayout( false );
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtFile;
private System.Windows.Forms.Button btnFile;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtX;
private System.Windows.Forms.TextBox txtY;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.OpenFileDialog dialogImage;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtScale;
private System.Windows.Forms.CheckBox chkFadeIn;
private System.Windows.Forms.CheckBox chkFadeOut;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox txtFadeOutRatio;
private System.Windows.Forms.TextBox txtFadeInRatio;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.GroupBox groupBox2;
}
}

View File

@ -1,74 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Background {
public partial class entry_config : Form {
EntryConfig m_entry_config;
public entry_config( EntryConfig config ) {
InitializeComponent();
m_entry_config = config;
txtFile.Text = m_entry_config.File;
txtX.Text = m_entry_config.X.ToString();
txtY.Text = m_entry_config.Y.ToString();
txtScale.Text = m_entry_config.Scale.ToString();
chkFadeIn.Checked = m_entry_config.FadeIn;
chkFadeOut.Checked = m_entry_config.FadeOut;
txtFadeInRatio.Text = m_entry_config.FadeInRatio.ToString();
txtFadeOutRatio.Text = m_entry_config.FadeOutRatio.ToString();
}
private void btnFile_Click( object sender, EventArgs e ) {
if ( dialogImage.ShowDialog() == DialogResult.OK ) {
txtFile.Text = dialogImage.FileName;
}
}
private void btnOK_Click( object sender, EventArgs e ) {
EntryConfig old = m_entry_config;
try {
m_entry_config.File = txtFile.Text;
m_entry_config.X = int.Parse( txtX.Text );
m_entry_config.Y = int.Parse( txtY.Text );
m_entry_config.Scale = float.Parse( txtScale.Text );
m_entry_config.FadeIn = chkFadeIn.Checked;
m_entry_config.FadeOut = chkFadeOut.Checked;
m_entry_config.FadeInRatio = float.Parse( txtFadeInRatio.Text );
m_entry_config.FadeOutRatio = float.Parse( txtFadeOutRatio.Text );
if ( m_entry_config.FadeInRatio <= 0f ) {
m_entry_config.FadeIn = false;
m_entry_config.FadeInRatio = 2f;
}
if ( m_entry_config.FadeOutRatio <= 0f ) {
m_entry_config.FadeOut = false;
m_entry_config.FadeOutRatio = 2f;
}
this.DialogResult = DialogResult.OK;
} catch {
m_entry_config = old;
this.DialogResult = DialogResult.Cancel;
}
}
public EntryConfig Config {
get {
return m_entry_config;
}
}
private void chkFadeIn_CheckedChanged( object sender, EventArgs e ) {
txtFadeInRatio.Enabled = chkFadeIn.Checked;
}
private void chkFadeOut_CheckedChanged( object sender, EventArgs e ) {
txtFadeOutRatio.Enabled = chkFadeOut.Checked;
}
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="dialogImage.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1,10 +0,0 @@
RM=rm
CP=cp
Background.dll: Background.cs entry_config.cs entry_config.Designer.cs IPlugin.dll
gmcs -target:library -out:Background.dll \
-r:System.Windows.Forms,System.Drawing,IPlugin.dll \
Background.cs entry_config.cs entry_config.Designer.cs
clean:
$(RM) Background.dll IPlugin.dll

View File

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DevUtl</RootNamespace>
<AssemblyName>DevUtl</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Boare.Lib.AppUtil\Boare.Lib.AppUtil.csproj">
<Project>{0C58B068-272F-4390-A14F-3D72AFCF3DFB}</Project>
<Name>Boare.Lib.AppUtil</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,139 +0,0 @@
//#define BINARYFILE_TO_BYTEARRAY
#define BINARYFILE_TO_BASE64
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Boare.Lib.AppUtil;
namespace DevUtl {
class Program {
static void Main( string[] args ) {
#if BINARYFILE_TO_BASE64
Console.WriteLine( "BINARYFILE_TO_BASE64" );
if ( args.Length < 1 ) {
Console.WriteLine( "error; too few arguments" );
return;
}
if ( !File.Exists( args[0] ) ) {
Console.WriteLine( "error; file not found" );
return;
}
string str = "";
using ( FileStream fs = new FileStream( args[0], FileMode.Open ) ) {
byte[] b = new byte[fs.Length];
fs.Read( b, 0, b.Length );
str = Convert.ToBase64String( b );
}
int length = str.Length;
int split_length = 100;
Console.Write( "string foo = " );
uint count = 0;
while ( length > 0 ) {
count++;
string pref = " ";
if ( count == 1 ) {
pref = "";
}
if ( length < split_length ) {
Console.WriteLine( pref + "\"" + str + "\";" );
break;
} else {
string part = str.Substring( 0, split_length );
str = str.Substring( split_length );
length = str.Length;
Console.WriteLine( pref + "\"" + part + "\" +" );
}
}
#endif
#if BINARYFILE_TO_BYTEARRAY
Console.WriteLine( "BINARYFILE_TO_BYTEARRAY" );
if ( args.Length < 2 ) {
Console.WriteLine( "error; too few arguments" );
return;
}
if ( !File.Exists( args[0] ) ) {
Console.WriteLine( "error; file not found" );
return;
}
byte[] hoge = new byte[] { 0x00, 0x01, };
using ( StreamWriter sw = new StreamWriter( args[1], false, Encoding.UTF8 ) ) {
sw.Write( "byte[] foo = new byte[] { " );
bool first = true;
using ( FileStream fs = new FileStream( args[0], FileMode.Open ) ) {
const int BUF = 20;
byte[] buffer = new byte[BUF];
while ( true ) {
int len = fs.Read( buffer, 0, BUF );
if ( len <= 0 ) {
break;
}
if ( first ) {
first = false;
} else {
sw.WriteLine();
sw.Write( " " );
}
for ( int i = 0; i < len; i++ ) {
sw.Write( "0x" + Convert.ToString( buffer[i], 16 ) + ", " );
}
}
}
sw.WriteLine( "};" );
}
#else
#if LANGUAGE_FILE_CONVERSION
Console.WriteLine( "LANGUAGE_FILE_CONVERSION" );
//Console.WriteLine( "input the name of message definition file" );
string msg_dat = @"C:\cvs\lipsync\LipSync\en.lang";// Console.ReadLine();
Dictionary<string, string> dict = new Dictionary<string, string>();
using ( StreamReader sr = new StreamReader( msg_dat ) ) {
while ( sr.Peek() >= 0 ) {
string line = sr.ReadLine();
if ( line.StartsWith( "#" ) ) {
continue;
}
string[] spl = line.Split( "\t".ToCharArray() );
dict.Add( spl[0], spl[1] );
}
}
while ( true ) {
Console.WriteLine( "input edit target file" );
string cs = Console.ReadLine();
string new_file = Path.Combine( Path.GetDirectoryName( cs ), Path.GetFileNameWithoutExtension( cs ) + "_.tmp" );
using ( StreamWriter sw = new StreamWriter( new_file ) )
using ( StreamReader sr = new StreamReader( cs ) ) {
while ( sr.Peek() >= 0 ) {
sw.WriteLine( sr.ReadLine() );
}
}
using ( StreamWriter sw = new StreamWriter( cs ) )
using ( StreamReader sr = new StreamReader( new_file ) ) {
while ( sr.Peek() >= 0 ) {
string line = sr.ReadLine();
int index = line.IndexOf( "Messaging.GetMessage( MessageID." );
if ( index >= 0 ) {
while ( index >= 0 ) {
int right = line.IndexOf( ")", index );
string item = line.Substring( index + 32, right - (index + 32) );
item = item.Trim();
Console.WriteLine( "item=\"" + item + "\"" );
string new_line = line.Substring( 0, index ) + "_( \"" + dict[item] + "\" )" + line.Substring( right + 1 );
line = new_line;
index = line.IndexOf( "Messaging.GetMessage( MessageID." );
}
sw.WriteLine( line );
} else {
sw.WriteLine( line );
}
}
}
}
#endif
#endif
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle( "DevUtl" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "" )]
[assembly: AssemblyProduct( "DevUtl" )]
[assembly: AssemblyCopyright( "Copyright © 2008" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible( false )]
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid( "568982bb-45a8-4ebc-bf4f-e3d4d4606b1d" )]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

View File

@ -1,483 +0,0 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.IO;
namespace Plugin {
public class Avi {
public const int StreamtypeVIDEO = 1935960438; //mmioStringToFOURCC("vids", 0)
public const int OF_SHARE_DENY_WRITE = 32;
public const int BMP_MAGIC_COOKIE = 19778; //ascii string "BM"
#region structure declarations
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public struct RECT {
public UInt32 left;
public UInt32 top;
public UInt32 right;
public UInt32 bottom;
}
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public struct BITMAPINFOHEADER {
public UInt32 biSize;
public Int32 biWidth;
public Int32 biHeight;
public Int16 biPlanes;
public Int16 biBitCount;
public UInt32 biCompression;
public UInt32 biSizeImage;
public Int32 biXPelsPerMeter;
public Int32 biYPelsPerMeter;
public UInt32 biClrUsed;
public UInt32 biClrImportant;
}
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public struct AVISTREAMINFO {
public UInt32 fccType;
public UInt32 fccHandler;
public UInt32 dwFlags;
public UInt32 dwCaps;
public UInt16 wPriority;
public UInt16 wLanguage;
public UInt32 dwScale;
public UInt32 dwRate;
public UInt32 dwStart;
public UInt32 dwLength;
public UInt32 dwInitialFrames;
public UInt32 dwSuggestedBufferSize;
public UInt32 dwQuality;
public UInt32 dwSampleSize;
public RECT rcFrame;
public UInt32 dwEditCount;
public UInt32 dwFormatChangeCount;
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 64 )]
public UInt16[] szName;
}
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
public struct BITMAPFILEHEADER {
public Int16 bfType; //"magic cookie" - must be "BM"
public Int32 bfSize;
public Int16 bfReserved1;
public Int16 bfReserved2;
public Int32 bfOffBits;
}
#endregion structure declarations
#region method declarations
//Initialize the AVI library
[DllImport( "avifil32.dll" )]
public static extern void AVIFileInit();
//Open an AVI file
[DllImport( "avifil32.dll", PreserveSig = true )]
public static extern int AVIFileOpen(
ref int ppfile,
String szFile,
int uMode,
int pclsidHandler );
//Get a stream from an open AVI file
[DllImport( "avifil32.dll" )]
public static extern int AVIFileGetStream(
int pfile,
out IntPtr ppavi,
int fccType,
int lParam );
//Get the start position of a stream
[DllImport( "avifil32.dll", PreserveSig = true )]
public static extern int AVIStreamStart( int pavi );
//Get the length of a stream in frames
[DllImport( "avifil32.dll", PreserveSig = true )]
public static extern int AVIStreamLength( int pavi );
//Get information about an open stream
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamInfo(
int pAVIStream,
ref AVISTREAMINFO psi,
int lSize );
//Get a pointer to a GETFRAME object (returns 0 on error)
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamGetFrameOpen(
IntPtr pAVIStream,
ref BITMAPINFOHEADER bih );
/*[DllImport("avifil32.dll")]
public static extern int AVIStreamGetFrameOpen(
IntPtr pAVIStream,
int dummy);*/
//Get a pointer to a packed DIB (returns 0 on error)
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamGetFrame(
int pGetFrameObj,
int lPos );
//Create a new stream in an open AVI file
[DllImport( "avifil32.dll" )]
public static extern int AVIFileCreateStream(
int pfile,
out IntPtr ppavi,
ref AVISTREAMINFO ptr_streaminfo );
//Set the format for a new stream
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamSetFormat(
IntPtr aviStream, Int32 lPos,
ref BITMAPINFOHEADER lpFormat, Int32 cbFormat );
//Write a sample to a stream
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamWrite(
IntPtr aviStream, Int32 lStart, Int32 lSamples,
IntPtr lpBuffer, Int32 cbBuffer, Int32 dwFlags,
Int32 dummy1, Int32 dummy2 );
//Release the GETFRAME object
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamGetFrameClose(
int pGetFrameObj );
//Release an open AVI stream
[DllImport( "avifil32.dll" )]
public static extern int AVIStreamRelease( IntPtr aviStream );
//Release an open AVI file
[DllImport( "avifil32.dll" )]
public static extern int AVIFileRelease( int pfile );
//Close the AVI library
[DllImport( "avifil32.dll" )]
public static extern void AVIFileExit();
#endregion methos declarations
#region other useful avi functions
//public const int StreamtypeAUDIO = 1935963489; //mmioStringToFOURCC("auds", 0)
//public const int StreamtypeMIDI = 1935960429; //mmioStringToFOURCC("mids", 0)
//public const int StreamtypeTEXT = 1937012852; //mmioStringToFOURCC("txts", 0)
/*[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct AVIFILEINFO{
public Int32 dwMaxBytesPerSecond;
public Int32 dwFlags;
public Int32 dwCaps;
public Int32 dwStreams;
public Int32 dwSuggestedBufferSize;
public Int32 dwWidth;
public Int32 dwHeight;
public Int32 dwScale;
public Int32 dwRate;
public Int32 dwLength;
public Int32 dwEditCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=64)]
public char[] szFileType;
}*/
/*[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct AVICOMPRESSOPTIONS {
public UInt32 fccType;
public UInt32 fccHandler;
public UInt32 dwKeyFrameEvery; // only used with AVICOMRPESSF_KEYFRAMES
public UInt32 dwQuality;
public UInt32 dwBytesPerSecond; // only used with AVICOMPRESSF_DATARATE
public UInt32 dwFlags;
public IntPtr lpFormat;
public UInt32 cbFormat;
public IntPtr lpParms;
public UInt32 cbParms;
public UInt32 dwInterleaveEvery;
}*/
/*[DllImport("avifil32.dll")]
public static extern int AVIMakeCompressedStream(
out IntPtr ppsCompressed, IntPtr aviStream,
ref AVICOMPRESSOPTIONS ao, int dummy);*/
/*[DllImport("avifil32.dll")]
public static extern int AVISaveOptions(
IntPtr hWnd,
int uiFlags,
int nStreams,
ref IntPtr ppavi,
ref IntPtr ppOptions);*/
/*[DllImport("avifil32.dll")]
public static extern int AVIFileInfo(
int pfile,
ref AVIFILEINFO pfi,
int lSize);*/
/*[DllImport("winmm.dll", EntryPoint="mmioStringToFOURCCA")]
public static extern int mmioStringToFOURCC(String sz, int uFlags);*/
/*[DllImport("avifil32.dll")]
public static extern int AVIStreamRead(
IntPtr pavi,
Int32 lStart,
Int32 lSamples,
IntPtr lpBuffer,
Int32 cbBuffer,
Int32 plBytes,
Int32 plSamples
);*/
#endregion other useful avi functions
}
/// <summary>Extract bitmaps from AVI files</summary>
public class AviReader {
//position of the first frame, count of frames in the stream
private int firstFrame = 0, countFrames = 0;
//pointers
private int aviFile = 0;
private int getFrameObject;
private IntPtr aviStream;
//stream and header info
private Avi.AVISTREAMINFO streamInfo;
public int CountFrames {
get {
return countFrames;
}
}
public UInt32 FrameRate {
get {
return streamInfo.dwRate / streamInfo.dwScale;
}
}
public Size BitmapSize {
get {
return new Size( (int)streamInfo.rcFrame.right, (int)streamInfo.rcFrame.bottom );
}
}
/// <summary>Opens an AVI file and creates a GetFrame object</summary>
/// <param name="fileName">Name of the AVI file</param>
public void Open( string fileName ) {
//Intitialize AVI library
Avi.AVIFileInit();
//Open the file
int result = Avi.AVIFileOpen(
ref aviFile, fileName,
Avi.OF_SHARE_DENY_WRITE, 0 );
if ( result != 0 ) {
throw new Exception( "Exception in AVIFileOpen: " + result.ToString() );
}
//Get the video stream
result = Avi.AVIFileGetStream(
aviFile,
out aviStream,
Avi.StreamtypeVIDEO, 0 );
if ( result != 0 ) {
throw new Exception( "Exception in AVIFileGetStream: " + result.ToString() );
}
firstFrame = Avi.AVIStreamStart( aviStream.ToInt32() );
countFrames = Avi.AVIStreamLength( aviStream.ToInt32() );
streamInfo = new Avi.AVISTREAMINFO();
result = Avi.AVIStreamInfo( aviStream.ToInt32(), ref streamInfo, Marshal.SizeOf( streamInfo ) );
if ( result != 0 ) {
throw new Exception( "Exception in AVIStreamInfo: " + result.ToString() );
}
//Open frames
Avi.BITMAPINFOHEADER bih = new Avi.BITMAPINFOHEADER();
bih.biBitCount = 24;
bih.biClrImportant = 0;
bih.biClrUsed = 0;
bih.biCompression = 0; //BI_RGB;
bih.biHeight = (Int32)streamInfo.rcFrame.bottom;
bih.biWidth = (Int32)streamInfo.rcFrame.right;
bih.biPlanes = 1;
bih.biSize = (UInt32)Marshal.SizeOf( bih );
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
getFrameObject = Avi.AVIStreamGetFrameOpen( aviStream, ref bih ); //force function to return 24bit DIBS
//getFrameObject = Avi.AVIStreamGetFrameOpen(aviStream, 0); //return any bitmaps
if ( getFrameObject == 0 ) {
throw new Exception( "Exception in AVIStreamGetFrameOpen!" );
}
}
/// <summary>Closes all streams, files and libraries</summary>
public void Close() {
if ( getFrameObject != 0 ) {
Avi.AVIStreamGetFrameClose( getFrameObject );
getFrameObject = 0;
}
if ( aviStream != IntPtr.Zero ) {
Avi.AVIStreamRelease( aviStream );
aviStream = IntPtr.Zero;
}
if ( aviFile != 0 ) {
Avi.AVIFileRelease( aviFile );
aviFile = 0;
}
Avi.AVIFileExit();
}
public Bitmap Export( int position ) {
if ( position > countFrames ) {
throw new Exception( "Invalid frame position" );
}
//Decompress the frame and return a pointer to the DIB
int pDib = Avi.AVIStreamGetFrame( getFrameObject, firstFrame + position );
//Copy the bitmap header into a managed struct
Avi.BITMAPINFOHEADER bih = new Avi.BITMAPINFOHEADER();
bih = (Avi.BITMAPINFOHEADER)Marshal.PtrToStructure( new IntPtr( pDib ), bih.GetType() );
/*if(bih.biBitCount < 24){
throw new Exception("Not enough colors! DIB color depth is less than 24 bit.");
}else */
if ( bih.biSizeImage < 1 ) {
throw new Exception( "Exception in AVIStreamGetFrame: Not bitmap decompressed." );
}
//Copy the image
byte[] bitmapData = new byte[bih.biSizeImage];
int address = pDib + Marshal.SizeOf( bih );
for ( int offset = 0; offset < bitmapData.Length; offset++ ) {
bitmapData[offset] = Marshal.ReadByte( new IntPtr( address ) );
address++;
}
//Copy bitmap info
byte[] bitmapInfo = new byte[Marshal.SizeOf( bih )];
IntPtr ptr;
ptr = Marshal.AllocHGlobal( bitmapInfo.Length );
Marshal.StructureToPtr( bih, ptr, false );
address = ptr.ToInt32();
for ( int offset = 0; offset < bitmapInfo.Length; offset++ ) {
bitmapInfo[offset] = Marshal.ReadByte( new IntPtr( address ) );
address++;
}
//Create file header
Avi.BITMAPFILEHEADER bfh = new Avi.BITMAPFILEHEADER();
bfh.bfType = Avi.BMP_MAGIC_COOKIE;
bfh.bfSize = (Int32)(55 + bih.biSizeImage); //size of file as written to disk
bfh.bfReserved1 = 0;
bfh.bfReserved2 = 0;
bfh.bfOffBits = Marshal.SizeOf( bih ) + Marshal.SizeOf( bfh );
//Create or overwrite the destination file
MemoryStream fs = new MemoryStream();
//FileStream fs = new FileStream( dstFileName, System.IO.FileMode.Create );
BinaryWriter bw = new BinaryWriter( fs );
//Write header
bw.Write( bfh.bfType );
bw.Write( bfh.bfSize );
bw.Write( bfh.bfReserved1 );
bw.Write( bfh.bfReserved2 );
bw.Write( bfh.bfOffBits );
//Write bitmap info
bw.Write( bitmapInfo );
//Write bitmap data
bw.Write( bitmapData );
bw.Close();
// fs.Close();
fs.Flush();
fs.Seek( 0, SeekOrigin.Begin );
Bitmap bmp = new Bitmap( fs );
fs.Close();
return bmp;
}
/// <summary>Exports a frame into a bitmap file</summary>
/// <param name="position">Position of the frame</param>
/// <param name="dstFileName">Name ofthe file to store the bitmap</param>
public void ExportBitmap( int position, String dstFileName ) {
if ( position > countFrames ) {
throw new Exception( "Invalid frame position" );
}
//Decompress the frame and return a pointer to the DIB
int pDib = Avi.AVIStreamGetFrame( getFrameObject, firstFrame + position );
//Copy the bitmap header into a managed struct
Avi.BITMAPINFOHEADER bih = new Avi.BITMAPINFOHEADER();
bih = (Avi.BITMAPINFOHEADER)Marshal.PtrToStructure( new IntPtr( pDib ), bih.GetType() );
/*if(bih.biBitCount < 24){
throw new Exception("Not enough colors! DIB color depth is less than 24 bit.");
}else */
if ( bih.biSizeImage < 1 ) {
throw new Exception( "Exception in AVIStreamGetFrame: Not bitmap decompressed." );
}
//Copy the image
byte[] bitmapData = new byte[bih.biSizeImage];
int address = pDib + Marshal.SizeOf( bih );
for ( int offset = 0; offset < bitmapData.Length; offset++ ) {
bitmapData[offset] = Marshal.ReadByte( new IntPtr( address ) );
address++;
}
//Copy bitmap info
byte[] bitmapInfo = new byte[Marshal.SizeOf( bih )];
IntPtr ptr;
ptr = Marshal.AllocHGlobal( bitmapInfo.Length );
Marshal.StructureToPtr( bih, ptr, false );
address = ptr.ToInt32();
for ( int offset = 0; offset < bitmapInfo.Length; offset++ ) {
bitmapInfo[offset] = Marshal.ReadByte( new IntPtr( address ) );
address++;
}
//Create file header
Avi.BITMAPFILEHEADER bfh = new Avi.BITMAPFILEHEADER();
bfh.bfType = Avi.BMP_MAGIC_COOKIE;
bfh.bfSize = (Int32)(55 + bih.biSizeImage); //size of file as written to disk
bfh.bfReserved1 = 0;
bfh.bfReserved2 = 0;
bfh.bfOffBits = Marshal.SizeOf( bih ) + Marshal.SizeOf( bfh );
//Create or overwrite the destination file
FileStream fs = new FileStream( dstFileName, System.IO.FileMode.Create );
BinaryWriter bw = new BinaryWriter( fs );
//Write header
bw.Write( bfh.bfType );
bw.Write( bfh.bfSize );
bw.Write( bfh.bfReserved1 );
bw.Write( bfh.bfReserved2 );
bw.Write( bfh.bfOffBits );
//Write bitmap info
bw.Write( bitmapInfo );
//Write bitmap data
bw.Write( bitmapData );
bw.Close();
fs.Close();
}
}
}

View File

@ -1,129 +0,0 @@
/*
* IPlugin.cs
* Copyright (c) 2007, 2008 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace Plugin {
public class Constants {
/// <summary>
/// エントリーごとの設定が可能なプラグインであることを表します。
/// </summary>
public const ulong LS_ENABLES_ENTRY_SETTING = 1;
/// <summary>
/// このプラグインが、設定用ウィンドウを持たないことを表します。
/// </summary>
public const ulong LS_NO_EVENT_HANDLER = 2;
/// <summary>
/// このプラグインが、キャラクタ描画用のプラグインであることを表します。
/// </summary>
public const ulong LS_TYPE_CHARACTER = 4;
}
/// <summary>
/// メイン画面で使用されている変数へのプロキシを提供
/// </summary>
public class Proxy {
}
/// <summary>
/// プラグイン用のインターフェースを定義します
/// </summary>
public interface IPlugin {
/// <summary>
/// プラグインの名称
/// </summary>
string Name {
get;
}
/// <summary>
/// プラグインの簡潔な説明文。
/// </summary>
string Abstract {
get;
}
/// <summary>
/// フレームに加工を施す関数
/// </summary>
/// <param name="frame">加工の対象</param>
/// <param name="time">ビデオの先頭からの時刻(秒)</param>
/// <param name="e_begin">エントリの開始時刻</param>
/// <param name="e_body">エントリの終了時刻</param>
/// <param name="e_end">エントリの設定値</param>
void Apply( ref Bitmap frame, float time, float e_begin, float e_end, ref string e_body );
/// <summary>
/// プラグイン用の設定値を格納した文字列を指定します。
/// </summary>
/// <returns></returns>
string Config {
get;
set;
}
/// <summary>
/// メイン画面の言語設定が変更されたとき呼び出されます。
/// </summary>
/// <param name="language_code"></param>
void ApplyLanguage( string language_code );
/// <summary>
/// このプラグインの設定メニューが押された時呼び出されます。
/// </summary>
DialogResult BaseSetting();
/// <summary>
/// エントリーごとの設定メニューが押された時呼び出されます。
/// エントリーごとの設定は、ぷらぐいん側で任意に設定できます。
/// </summary>
/// <param name="entry_config">編集するエントリの設定</param>
DialogResult EntrySetting( ref string entry_config );
/// <summary>
/// このプラグインのタイプを指定します。
/// </summary>
ulong Type {
get;
}
/// <summary>
/// キャラクタ描画関数。
/// </summary>
/// <param name="g">キャラクタの描画先</param>
/// <param name="size">gのサイズ</param>
/// <param name="time">ビデオの先頭からの時刻</param>
/// <param name="mouth">時刻timeにおける口の形がコンマ区切りで列挙されている</param>
/// <param name="Reserved">(予約)</param>
void Render( Graphics g, Size size, float time, string mouth, string Reserved );
}
}

View File

@ -1,74 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>IPlugin</RootNamespace>
<AssemblyName>IPlugin</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\IPlugin.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\IPlugin.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="InputBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="InputBox.designer.cs">
<DependentUpon>InputBox.cs</DependentUpon>
</Compile>
<Compile Include="IPlugin.cs" />
<Compile Include="ISO639.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="InputBox.resx">
<DependentUpon>InputBox.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -1,29 +0,0 @@
/*
* ISO639.cs
* Copyright (c) 2007, 2008 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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.Globalization;
namespace Plugin {
public class ISO639 {
public static bool CheckValidity( string code_string ) {
try {
CultureInfo c = CultureInfo.CreateSpecificCulture( code_string );
} catch {
return false;
}
return true;
}
}
}

View File

@ -1,44 +0,0 @@
/*
* InputBox.cs
* Copyright (c) 2007, 2008 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Plugin {
public partial class InputBox : Form {
public string rText{
get{
return input.Text;
}
set {
input.Text = value;
}
}
public InputBox( string title, string message ) {
InitializeComponent();
this.message.Text = message;
this.Text = title;
}
private void btnOK_Click( object sender, EventArgs e ) {
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}

View File

@ -1,111 +0,0 @@
/*
* InputBox.designer.cs
* Copyright (c) 2007, 2008 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 Plugin {
partial class InputBox {
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose( bool disposing ) {
if ( disposing && (components != null) ) {
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent() {
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.message = new System.Windows.Forms.Label();
this.input = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point( 114, 73 );
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size( 75, 23 );
this.btnOK.TabIndex = 1;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler( this.btnOK_Click );
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point( 208, 73 );
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size( 75, 23 );
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// message
//
this.message.AutoEllipsis = true;
this.message.AutoSize = true;
this.message.Location = new System.Drawing.Point( 12, 9 );
this.message.Name = "message";
this.message.Size = new System.Drawing.Size( 50, 12 );
this.message.TabIndex = 2;
this.message.Text = "message";
//
// input
//
this.input.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.input.Location = new System.Drawing.Point( 29, 35 );
this.input.Name = "input";
this.input.Size = new System.Drawing.Size( 254, 19 );
this.input.TabIndex = 0;
//
// InputBox
//
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( 298, 113 );
this.Controls.Add( this.input );
this.Controls.Add( this.message );
this.Controls.Add( this.btnCancel );
this.Controls.Add( this.btnOK );
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InputBox";
this.Text = "InputBox";
this.ResumeLayout( false );
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Label message;
private System.Windows.Forms.TextBox input;
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle( "IPlugin" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Boare" )]
[assembly: AssemblyProduct( "IPlugin" )]
[assembly: AssemblyCopyright( "Copyright (C) 2007" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントには
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible( false )]
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid( "eb60d449-2a04-4bc0-b45c-d4ebf429cf13" )]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を
// 既定値にすることができます:
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

View File

@ -1,10 +0,0 @@
CP=cp
RM=rm
OPT=-r:System,System.Drawing,System.Windows.Forms
IPLUGIN_SRC=IPlugin.cs ISO639.cs InputBox.cs InputBox.designer.cs
IPlugin.dll: $(IPLUGIN_SRC)
gmcs -target:library -out:IPlugin.dll $(IPLUGIN_SRC) $(OPT)
clean:
$(RM) IPlugin.dll

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="JVsq" default="default" basedir=".">
<description>Builds, tests, and runs the project JVsq.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="JVsq-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

View File

@ -1,629 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- jar
- execution
- debugging
- javadoc
- junit compilation
- junit execution
- junit debugging
- applet
- cleanup
-->
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="JVsq-impl">
<target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
<!--
======================
INITIALIZATION SECTION
======================
-->
<target name="-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init" name="-init-private">
<property file="nbproject/private/config.properties"/>
<property file="nbproject/private/configs/${config}.properties"/>
<property file="nbproject/private/private.properties"/>
</target>
<target depends="-pre-init,-init-private" name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
<property file="nbproject/configs/${config}.properties"/>
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<available file="${manifest.file}" property="manifest.available"/>
<condition property="manifest.available+main.class">
<and>
<isset property="manifest.available"/>
<isset property="main.class"/>
<not>
<equals arg1="${main.class}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition property="manifest.available+main.class+mkdist.available">
<and>
<istrue value="${manifest.available+main.class}"/>
<isset property="libs.CopyLibs.classpath"/>
</and>
</condition>
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
</or>
</condition>
<condition property="have.sources">
<or>
<available file="${src.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
<and>
<isset property="netbeans.home"/>
<isset property="have.tests"/>
</and>
</condition>
<condition property="no.javadoc.preview">
<and>
<isset property="javadoc.preview"/>
<isfalse value="${javadoc.preview}"/>
</and>
</condition>
<property name="run.jvmargs" value=""/>
<property name="javac.compilerargs" value=""/>
<property name="work.dir" value="${basedir}"/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<property name="javac.debug" value="true"/>
<property name="javadoc.preview" value="true"/>
<property name="application.args" value=""/>
<property name="source.encoding" value="${file.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
<not>
<equals arg1="${javadoc.encoding}" arg2=""/>
</not>
</and>
</condition>
<property name="javadoc.encoding.used" value="${source.encoding}"/>
<property name="includes" value="**"/>
<property name="excludes" value=""/>
<property name="do.depend" value="false"/>
<condition property="do.depend.true">
<istrue value="${do.depend}"/>
</condition>
<condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
<and>
<isset property="jaxws.endorsed.dir"/>
<available file="nbproject/jaxws-build.xml"/>
</and>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="test.src.dir">Must set test.src.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.jar">Must set dist.jar</fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-javac">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="" name="sourcepath"/>
<element name="customize" optional="true"/>
<sequential>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
<customize/>
</javac>
</sequential>
</macrodef>
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}" name="classpath"/>
<sequential>
<depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</depend>
</sequential>
</macrodef>
<macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${build.classes.dir}" name="destdir"/>
<sequential>
<fail unless="javac.includes">Must set javac.includes</fail>
<pathconvert pathsep="," property="javac.includes.binary">
<path>
<filelist dir="@{destdir}" files="${javac.includes}"/>
</path>
<globmapper from="*.java" to="*.class"/>
</pathconvert>
<delete>
<files includes="${javac.includes.binary}"/>
</delete>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<sequential>
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${run.jvmargs}"/>
</junit>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
<classpath>
<path path="@{classpath}"/>
</classpath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${build.classes.dir}" name="dir"/>
<sequential>
<nbjpdareload>
<fileset dir="@{dir}" includes="${fix.classes}">
<include name="${fix.includes}*.class"/>
</fileset>
</nbjpdareload>
</sequential>
</macrodef>
</target>
<target name="-init-debug-args">
<property name="version-output" value="java version &quot;${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-java">
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="classname"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="${run.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-presetdef-jar">
<presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<j2seproject1:fileset dir="${build.classes.dir}"/>
</jar>
</presetdef>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
<!--
===================
COMPILATION SECTION
===================
-->
<target depends="init" name="deps-jar" unless="no.deps"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="-pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-depend">
<j2seproject3:depend/>
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
<j2seproject3:javac/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile/>
<j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<!--
====================
JAR BUILDING SECTION
====================
-->
<target depends="init" name="-pre-pre-jar">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
</target>
<target name="-pre-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
<j2seproject1:jar/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
<j2seproject1:jar manifest="${manifest.file}"/>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
<j2seproject1:jar manifest="${manifest.file}">
<j2seproject1:manifest>
<j2seproject1:attribute name="Main-Class" value="${main.class}"/>
</j2seproject1:manifest>
</j2seproject1:jar>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<pathconvert property="run.classpath.with.dist.jar">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
</pathconvert>
<echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
</target>
<target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
<pathconvert property="run.classpath.without.build.classes.dir">
<path path="${run.classpath}"/>
<map from="${build.classes.dir.resolved}" to=""/>
</pathconvert>
<pathconvert pathsep=" " property="jar.classpath">
<path path="${run.classpath.without.build.classes.dir}"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="lib/*"/>
</chainedmapper>
</pathconvert>
<taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
<copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>
</copylibs>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${dist.jar}" name="dist.jar.resolved"/>
<echo>java -jar "${dist.jar.resolved}"</echo>
</target>
<target name="-post-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
<!--
=================
EXECUTION SECTION
=================
-->
<target depends="init,compile" description="Run a main class." name="run">
<j2seproject1:java>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject1:java>
</target>
<target name="-do-not-recompile">
<property name="javac.includes.binary" value=""/>
</target>
<target depends="init,-do-not-recompile,compile-single" name="run-single">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<j2seproject1:java classname="${run.class}"/>
</target>
<!--
=================
DEBUGGING SECTION
=================
-->
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
<j2seproject1:nbjpdastart name="${debug.class}"/>
</target>
<target depends="init,compile" name="-debug-start-debuggee">
<j2seproject3:debug>
<customize>
<arg line="${application.args}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
<target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
<j2seproject1:nbjpdastart stopclassname="${main.class}"/>
</target>
<target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<j2seproject3:debug classname="${debug.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
<target depends="init" name="-pre-debug-fix">
<fail unless="fix.includes">Must set fix.includes</fail>
<property name="javac.includes" value="${fix.includes}.java"/>
</target>
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
<j2seproject1:nbjpdareload/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
===============
JAVADOC SECTION
===============
-->
<target depends="init" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}"/>
</classpath>
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
</javadoc>
</target>
<target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
=========================
JUNIT COMPILATION SECTION
=========================
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
</target>
<target name="-pre-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="do.depend.true" name="-compile-test-depend">
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
<target name="-pre-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
<j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
=======================
JUNIT EXECUTION SECTION
=======================
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<j2seproject3:junit testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init" if="have.tests" name="test-report"/>
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
<target depends="init" if="have.tests" name="-pre-test-run-single">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<j2seproject3:junit excludes="" includes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed">Some tests failed; see details above.</fail>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<!--
=======================
JUNIT DEBUGGING SECTION
=======================
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<mkdir dir="${build.test.results.dir}"/>
<j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
<customize>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg value="${test.class}"/>
<arg value="showoutput=true"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
=========================
APPLET EXECUTION SECTION
=========================
-->
<target depends="init,compile-single" name="run-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject1:java classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject1:java>
</target>
<!--
=========================
APPLET DEBUGGING SECTION
=========================
-->
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<j2seproject3:debug classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</j2seproject3:debug>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
<!--
===============
CLEANUP SECTION
===============
-->
<target depends="init" name="deps-clean" unless="no.deps"/>
<target depends="init" name="-do-clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
</project>

View File

@ -1,8 +0,0 @@
build.xml.data.CRC32=56626a14
build.xml.script.CRC32=9b5d8d76
build.xml.stylesheet.CRC32=be360661
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=56626a14
nbproject/build-impl.xml.script.CRC32=c54cb890
nbproject/build-impl.xml.stylesheet.CRC32=487672f9

View File

@ -1,57 +0,0 @@
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/JVsq.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>JVsq</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

View File

@ -1,130 +0,0 @@
/*
* cp932.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.bocoree
*
* jp.sourceforge.lipsync.bocoree is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.bocoree 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.
*/
package jp.sourceforge.lipsync.bocoree;
import java.util.*;
import java.nio.charset.*;
public class cp932 {
//private static HashMap _DICT = new HashMap();
private static boolean m_initialized = false;
private static boolean m_cp932_available = false;
//private static Charset m_cp932 = null;
private static String s_sjis = "Shift_JIS";
private static int attatchKey( int key ) {
if ( cp932_a.getMinKey() <= key && key <= cp932_a.getMaxKey() ) {
return cp932_a.get( key );
} else if ( cp932_b.getMinKey() <= key && key <= cp932_b.getMaxKey() ) {
return cp932_b.get( key );
} else if ( cp932_c.getMinKey() <= key && key <= cp932_c.getMaxKey() ) {
return cp932_c.get( key );
} else {
return -1;
}
}
private static void init() {
m_cp932_available = Charset.isSupported( "Shift_JIS" );
m_initialized = true;
}
public static byte[] convert( String str ) {
if ( !m_initialized ) {
init();
}
if ( m_cp932_available ) {
byte[] ret;
try{
ret = str.getBytes( s_sjis );
}catch( Exception e ){
ret = new byte[0];
}
return ret;
} else {
char[] arr = str.toCharArray();
ArrayList list = new ArrayList();
for ( int i = 0; i < arr.length; i++ ) {
int att = attatchKey( arr[i] );
if ( att >= 0 ) {
if ( att > 0xff ) {
byte b1 = (byte) (att >> 8);
byte b2 = (byte) (att - (b1 << 8));
list.add( b1 );
list.add( b2 );
} else {
list.add( (byte) att );
}
} else {
list.add( 0x63 );
}
}
byte[] ret = new byte[list.size()];
for ( int i = 0; i < list.size(); i++ ) {
Integer value = (Integer) list.get( i );
ret[i] = (byte) value.intValue();
}
return ret;
}
}
public static String convert( byte[] dat ) {
if ( !m_initialized ) {
init();
}
if ( m_cp932_available ) {
String ret;
try{
ret = new String( dat, s_sjis );
}catch( Exception e ){
ret = "";
}
return ret;
} else {
StringBuilder sb = new StringBuilder();
/*int i = 0;
while ( i < dat.length ) {
int b1 = dat[i];
boolean found = false;
for ( Iterator keys = _DICT.keySet().iterator(); keys.hasNext();) {
int key = ((Integer) keys.next()).intValue();
int test = (Integer) _DICT.get( key );
if ( b1 == test ) {
found = true;
char ch = (char) key;
sb.append( ch + "" );
break;
}
}
i++;
if ( !found && i < dat.length ) {
int b2 = (dat[i - 1] << 8) + dat[i];
for ( Iterator keys = _DICT.keySet().iterator(); keys.hasNext();) {
Integer key = (Integer) keys.next();
int test = ((Integer) _DICT.get( key )).intValue();
if ( test == b2 ) {
int ik = key.intValue();
char ch = (char) ik;
sb.append( ch + "" );
break;
}
}
i++;
}
}*/
return sb.toString();
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,340 +0,0 @@
/*
* math.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.bocoree.
*
* jp.sourceforge.lipsync.bocoree is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.bocoree 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.
*/
package jp.sourceforge.lipsync.bocoree;
public class math {
private static final double _PI2 = 2.0 * Math.PI;
private static final double _PI4 = 4.0 * Math.PI;
private static final double _PI6 = 6.0 * Math.PI;
private static final double _PI8 = 8.0 * Math.PI;
public enum WindowFunctionType {
Hamming,
rectangular,
Gauss,
Hann,
Blackman,
Bartlett,
Nuttall,
Blackman_Harris,
Blackman_Nattall,
flap_top,
Parzen,
Akaike,
Welch,
Kaiser,
}
public static double window_func(WindowFunctionType type, double x) throws Exception {
switch ( type ) {
case Akaike:
return wnd_akaike(x);
case Bartlett:
return wnd_bartlett(x);
case Blackman:
return wnd_blackman(x);
case Blackman_Harris:
return wnd_blackman_harris(x);
case Blackman_Nattall:
return wnd_blackman_nattall(x);
case flap_top:
return wnd_flap_top(x);
case Gauss:
throw new Exception("too few argument for Gauss window function");
case Hamming:
return wnd_hamming(x);
case Hann:
return wnd_hann(x);
case Kaiser:
throw new Exception("too few argument for Kaiser window function");
case Nuttall:
return wnd_nuttall(x);
case Parzen:
return wnd_parzen(x);
case rectangular:
return wnd_rectangular(x);
case Welch:
return wnd_welch(x);
}
return 0.0;
}
public static double window_func(WindowFunctionType type, double x, double[] param) {
switch ( type ) {
case Akaike:
return wnd_akaike(x);
case Bartlett:
return wnd_bartlett(x);
case Blackman:
return wnd_blackman(x);
case Blackman_Harris:
return wnd_blackman_harris(x);
case Blackman_Nattall:
return wnd_blackman_nattall(x);
case flap_top:
return wnd_flap_top(x);
case Gauss:
return wnd_gauss(x, param[0]);
case Hamming:
return wnd_hamming(x);
case Hann:
return wnd_hann(x);
case Kaiser:
return wnd_kaiser(x, param[0]);
case Nuttall:
return wnd_nuttall(x);
case Parzen:
return wnd_parzen(x);
case rectangular:
return wnd_rectangular(x);
case Welch:
return wnd_welch(x);
}
return 0.0;
}
/**
* カイザー窓
* @param x
* @param alpha
* @return
*/
public static double wnd_kaiser(double x, double alpha) {
if ( 0.0 <= x && x <= 1.0 ) {
double t = 2.0 * x - 1.0;
return besi0(Math.PI * alpha * Math.sqrt(1.0 - t * t)) / besi0(Math.PI * alpha);
} else {
return 0.0;
}
}
/**
* ウェルチ窓
* @param x
* @return
*/
public static double wnd_welch(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 4.0 * x * (1.0 - x);
} else {
return 0.0;
}
}
/**
* 赤池窓
* @param x
* @return
*/
public static double wnd_akaike(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.625 - 0.5 * Math.cos(_PI2 * x) - 0.125 * Math.cos(_PI4 * x);
} else {
return 0.0;
}
}
/**
* パルザン窓
* @param x
* @return
*/
public static double wnd_parzen(double x) {
double x0 = Math.abs(x);
if ( x0 <= 1.0 ) {
return (0.75 * x0 - 1.5) * x0 * x0 + 1.0;
} else {
x0 = 2.0 - x0;
return 0.25 * x0 * x0 * x0;
}
}
/**
* フラットトップ窓
* @param x
* @return
*/
public static double wnd_flap_top(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 1.0 - 1.93 * Math.cos(_PI2 * x) + 1.29 * Math.cos(_PI4 * x) - 0.388 * Math.cos(_PI6 * x) + 0.032 * Math.cos(_PI8 * x);
} else {
return 0.0;
}
}
/**
* ブラックマンナットール窓
* @param x
* @return
*/
public static double wnd_blackman_nattall(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.3635819 - 0.4891775 * Math.cos(_PI2 * x) + 0.1365995 * Math.cos(_PI4 * x) - 0.0106411 * Math.cos(_PI6 * x);
} else {
return 0.0;
}
}
/**
* ブラックマンハリス窓
* @param x
* @return
*/
public static double wnd_blackman_harris(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.35875 - 0.48829 * Math.cos(_PI2 * x) + 0.14128 * Math.cos(_PI4 * x) - 0.01168 * Math.cos(_PI6 * x);
} else {
return 0.0;
}
}
/**
* ナットール窓
* @param x
* @return
*/
public static double wnd_nuttall(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.355768 - 0.487396 * Math.cos(_PI2 * x) + 0.144232 * Math.cos(_PI4 * x) - 0.012604 * Math.cos(_PI6 * x);
} else {
return 0.0;
}
}
/**
* バートレット窓
* @param x
* @return
*/
public static double wnd_bartlett(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 1.0 - 2.0 * Math.abs(x - 0.5);
} else {
return 0.0;
}
}
/**
* ブラックマン窓
* @param x
* @return
*/
public static double wnd_blackman(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.42 - 0.5 * Math.cos(_PI2 * x) + 0.08 * Math.cos(_PI4 * x);
} else {
return 0.0;
}
}
/**
* ハン窓
* @param x
* @return
*/
public static double wnd_hann(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.5 - 0.5 * Math.cos(_PI2 * x);
} else {
return 0.0;
}
}
/**
* ガウス窓
* @param x
* @param sigma
* @return
*/
public static double wnd_gauss(double x, double sigma) {
return Math.exp(-x * x / (sigma * sigma));
}
/**
* 矩形窓
* @param x
* @return
*/
public static double wnd_rectangular(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 1.0;
} else {
return 0.0;
}
}
/**
* ハミング窓
* @param x
* @return
*/
public static double wnd_hamming(double x) {
if ( 0.0 <= x && x <= 1.0 ) {
return 0.54 - 0.46 * Math.cos(_PI2 * x);
} else {
return 0.0;
}
}
/**
* 第1種ベッセル関数
* @param x
* @return
*/
public static double besi0(double x) {
int i;
double w, wx375;
double[] a = {1.0, 3.5156229, 3.0899424,
1.2067492, 0.2659732, 0.0360768
};
double[] b = {0.39894228, 0.013285917, 0.002253187,
-0.001575649, 0.009162808, -0.020577063,
0.026355372, -0.016476329
};
if ( x < 0.0 ) {
return 0.0;
}
if ( x <= 3.75 ) {
wx375 = x * x / 14.0625;
w = 0.0045813;
for ( i = 5; i >= 0; i-- ) {
w = w * wx375 + a[i];
}
return w;
}
wx375 = 3.75 / x;
w = 0.003923767;
for ( i = 7; i >= 0; i-- ) {
w = w * wx375 + b[i];
}
return w / Math.sqrt(x) * Math.exp(x);
}
/**
* 補誤差関数
* @param x
* @return
*/
public static double erfcc(double x) {
double t, z, res;
z = Math.abs(x);
t = 1.0 / (1.0 + 0.5 * z);
res = t * Math.exp(-z * z - 1.26551223 + t * (1.00002368 + t * (0.37409196 + t * (0.09678418 + t * (-0.18628806 + t * (0.27886807 + t * (-1.13520398 + t * (1.48851587 + t * (-0.82215223 + t * 0.17087277)))))))));
if ( x < 0.0 ) {
res = 2.0 - res;
}
return res;
}
}

View File

@ -1,58 +0,0 @@
/*
* BPPair.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public class BPPair implements Comparable {
//private int m_clock;
public int Clock;
//private int m_value;
public int Value;
public int compareTo( Object arg_item ) {
if ( !arg_item.getClass().equals( BPPair.class.getClass() ) ) {
return 0;
}
BPPair item = (BPPair)arg_item;
if ( Clock > item.Clock ) {
return 1;
} else if ( Clock < item.Clock ) {
return -1;
} else {
return 0;
}
}
/*public property int Clock {
get {
return m_clock;
}
set {
m_clock = value;
}
};*/
/*public property int Value {
get {
return m_value;
}
set {
m_value = value;
}
};*/
public BPPair( int clock, int value ) {
Clock = clock;
Value = value;
}
}

View File

@ -1,88 +0,0 @@
/*
* IconHandle.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public class IconHandle extends VsqHandle implements Cloneable {
public Object clone() {
IconHandle ret = new IconHandle();
ret.Caption = Caption;
ret.IconID = IconID;
ret.IDS = IDS;
ret.Index = Index;
ret.Language = Language;
ret.Length = Length;
ret.Original = Original;
ret.Program = Program;
ret.Type = Type;
return ret;
}
/*public property int Program {
get {
return m_program;
}
set {
m_program = value;
}
};*/
/*public property int Language {
get {
return m_language;
}
set {
m_language = value;
}
};*/
/*public property int Length {
get {
return m_length;
}
set {
m_length = value;
}
};*/
/*public property String Caption {
get {
return m_caption;
}
set {
m_caption = value;
}
};*/
/*public property String IconID {
get {
return m_icon_id;
}
set {
m_icon_id = value;
}
};*/
/*public property String IDS {
get {
return m_ids;
}
set {
m_ids = value;
}
};*/
/*public property int Original {
get {
return m_original;
}
set {
m_original = value;
}
};*/
}

View File

@ -1,28 +0,0 @@
/*
* KeyValuePair.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public class KeyValuePair<K, V> {
public K Key;
public V Value;
public KeyValuePair( K key, V value ) {
Key = key;
Value = value;
}
}

View File

@ -1,365 +0,0 @@
/*
* Lyric.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import jp.sourceforge.lipsync.bocoree.*;
/**
* VsqHandleに格納される歌詞の情報を扱うクラス
*/
public class Lyric {
//private String m_phrase;
public String Phrase;
private String[] m_phonetic_symbol;
//private float UnknownFloat;
public float UnknownFloat;
private int[] m_consonant_adjustment;
private boolean m_protected;
public boolean PhoneticSymbolProtected;
/*public proprety boolean PhoneticSymbolProtected {
get {
return m_protected;
}
set {
m_protected = value;
}
};*/
/*public property float UnknownFloat {
get {
return UnknownFloat;
}
set {
UnknownFloat = value;
}
};*/
public int[] getConsonantAdjustment() {
return m_consonant_adjustment;
}
/**
* このオブジェクトの簡易コピーを取得します
* @returns このインスタンスの簡易コピー
*/
public Lyric clone() {
Lyric result = new Lyric();
result.Phrase = this.Phrase;
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.m_protected = m_protected;
return result;
}
/**
* 歌詞発音記号を指定したコンストラクタ
* @param phrase 歌詞
* @param phonetic_symbol 発音記号
*/
public Lyric( String phrase, String phonetic_symbol ) {
Phrase = phrase;
setPhoneticSymbol( phonetic_symbol );
UnknownFloat = 0.000000f;
}
private Lyric() {
}
/*// <summary>
/// この歌詞のフレーズを取得または設定します
/// </summary>
public proprety String Phrase {
get {
return m_phrase;
}
set {
m_phrase = value;
}
};*/
/// <summary>
/// この歌詞の発音記号を取得または設定します
/// </summary>
public String getPhoneticSymbol() {
String ret = m_phonetic_symbol[0];
for ( int i = 1; i < m_phonetic_symbol.length; i++ ) {
ret += " " + m_phonetic_symbol[i];
}
return ret;
}
public void setPhoneticSymbol( String value ) {
String s = value.replace( " ", " " );
m_phonetic_symbol = s.split( " ", 16 );
for ( int i = 0; i < m_phonetic_symbol.length; i++ ) {
m_phonetic_symbol[i] = m_phonetic_symbol[i].replace( "\\\\", "\\" );
}
m_consonant_adjustment = new int[m_phonetic_symbol.length];
for ( int i = 0; i < m_phonetic_symbol.length; i++ ) {
if ( VsqPhoneticSymbol.IsConsonant( m_phonetic_symbol[i] ) ) {
m_consonant_adjustment[i] = 64;
} else {
m_consonant_adjustment[i] = 0;
}
}
}
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];
}
return ret;
}
/// <summary>
/// 文字列からのコンストラクタ
/// </summary>
/// <param name="_line">生成元の文字列</param>
public Lyric( String _line ) {
if ( _line.length() <= 0 ) {
Phrase = "a";
setPhoneticSymbol( "a" );
UnknownFloat = 1.0f;
m_protected = false;
} else {
String[] spl = _line.split( "," );
int c_length = spl.length - 3;
if ( spl.length < 4 ) {
Phrase = "a";
setPhoneticSymbol( "a" );
UnknownFloat = 0.0f;
m_protected = false;
} else {
Phrase = decode( spl[0] );
setPhoneticSymbol( decode( spl[1] ) );
UnknownFloat = Float.valueOf( spl[2] );
m_protected = (spl[spl.length - 1] == "0") ? false : true;
}
}
}
/// <summary>
/// mIndexOfのテストメソッドsearch, valueをいろいろ変えてテストする事
/// </summary>
/// <returns></returns>
public static boolean test_mIndexOf() {
byte[] search = { 0, 12, 3, 5, 16, 34 };
byte[] value = { 16, 34 };
if ( mIndexOf( search, value ) == 4 ) {
return true;
} else {
return false;
}
}
/// <summary>
/// バイト並びsearchの中に含まれるバイト並びvalueの位置を探します
/// </summary>
/// <param name="search">検索対象のバイト並び</param>
/// <param name="value">検索するバイト並び</param>
/// <returns>valueが見つかればそのインデックスを見つからなければ-1を返します</returns>
private static int mIndexOf( byte[] search, byte[] value ) {
int i, j;
int search_length = search.length;
int value_length = value.length;
// 検索するバイト並びが検索対象のバイト並びより長いとき
// 見つかるわけない
if ( value_length > search_length ) {
return -1;
}
// i : 検索の基点
for ( i = 0; i <= search_length - value_length; i++ ) {
boolean failed = false;
for ( j = 0; j < value_length; j++ ) {
if ( search[i + j] != value[j] ) {
failed = true;
break;
}
}
if ( !failed ) {
return i;
}
}
return -1;
}
/**
* エスケープされた\"や、\x**を復帰させます
* @param _String デコード対象の文字列
* @returns デコード後の文字列
*/
public static String decode( String _String ) {
String result = _String;
result = result.replace( "\\\"", "" );
//Encoding sjis = Encoding.GetEncoding( 932 );
//Encoding sjis = Encoding.GetEncoding( "Shift_JIS" );
byte[] str = result.getBytes();
//Console.WriteLine( "Lyric.decode; sjis.GetString( str )=" + sjis.GetString( str ) );
byte[] x16 = "\\x".getBytes();
int index = mIndexOf( str, x16 );
while ( index >= 0 ) {
//Console.WriteLine( "Lyric.decode; index=" + index );
byte[] chr_byte = new byte[2];
chr_byte[0] = str[index + 2];
chr_byte[1] = str[index + 3];
String chr;
try {
chr = new String( chr_byte, "UTF-8" );
} catch ( Exception e ) {
chr = "";
}
//Console.WriteLine( "Lyric.decode; chr=" + chr );
int chrcode = Integer.parseInt( chr, 16 );
str[index] = (byte) chrcode;
for ( int i = index + 4; i < str.length; i++ ) {
str[i - 3] = str[i];
}
int length = str.length - 3;
byte[] new_str = new byte[length];
for ( int i = 0; i < length; i++ ) {
new_str[i] = str[i];
}
str = new_str;
index = mIndexOf( str, x16 );
}
//return sjis.GetString( str );
return cp932.convert( str );
}
/// <summary>
/// 与えられた文字列の中の2バイト文字を\x**の形式にエンコードします
/// </summary>
/// <param name="item">エンコード対象</param>
/// <returns>エンコードした文字列</returns>
public static char[] encode( String item ) {
//Encoding sjis = Encoding.GetEncoding( 932 );
byte[] bytea = cp932.convert( item );// sjis.GetBytes( item );
String result = "";
for ( int i = 0; i <
bytea.length; i++ ) {
if ( isprint( (char) bytea[i] ) ) {
result += (char) bytea[i];
} else {
int a = bytea[i];
result += "\\x" + Integer.toHexString( (int) bytea[i] );
}
}
char[] res = result.toCharArray();
return res;
}
/// <summary>
/// 与えられた文字列をShift_JISとみなしbyte[]に変換しさらにchar[]に変換したもの返します
/// </summary>
/// <param name="item">変換元の文字列</param>
/// <returns>変換後のchar[]</returns>
public static char[] encodeEx( String item ) {
//Encoding sjis = Encoding.GetEncoding( 932 );
byte[] dat = cp932.convert( item );// sjis.GetBytes( item );
char[] result = new char[dat.length];
for ( int i = 0; i < dat.length; i++ ) {
result[i] = (char) dat[i];
}
return result;
}
/// <summary>
/// このインスタンスを文字列に変換します
/// </summary>
/// <param name="a_encode">2バイト文字をエンコードするか否かを指定するフラグ</param>
/// <returns>変換後の文字列</returns>
public String toString( boolean a_encode ) {
String result;
if ( a_encode ) {
String njp = new String( encode( this.Phrase ) );
result = "\"" + njp + "\",\"" + getPhoneticSymbol() + "\"," + String.format( "0.000000", UnknownFloat );
} else {
result = "\"";
//Encoding sjis = Encoding.GetEncoding( 932 );
byte[] dat = cp932.convert( this.Phrase );// sjis.GetBytes( this.Phrase );
for ( int i = 0; i < dat.length; i++ ) {
result += (char) dat[i];
}
result += "\",\"" + getPhoneticSymbol() + "\"," + String.format( "0.000000", UnknownFloat );
result = result.replace( "\\\\", "\\" );
}
for ( int i = 0; i < m_consonant_adjustment.length; i++ ) {
result += "," + m_consonant_adjustment[i];
}
if ( m_protected ) {
result += ",1";
} else {
result += ",0";
}
return result;
}
/// <summary>
/// 文字がプリント出力可能かどうかを判定します
/// </summary>
/// <param name="ch"></param>
/// <returns></returns>
private static boolean isprint( char ch ) {
if ( 32 <= (int) ch && (int) ch <= 126 ) {
return true;
} else {
return false;
}
}
/// <summary>
/// Lyricインスタンスを構築するテストを行います
/// </summary>
/// <returns>テストに成功すればtrueそうでなければfalseを返します</returns>
public static boolean test() {
String line = "\\\"\\x82\\xe7\\\",\\\"4 a\\\",1.000000,64,1,1";
//Console.WriteLine( "Lyric.test; line=" + line );
Lyric lyric = new Lyric( line );
if ( lyric.Phrase == "" &&
lyric.getPhoneticSymbol() == "4 a" &&
lyric.UnknownFloat == 1.0 &&
lyric.m_consonant_adjustment[0] == 64 &&
lyric.m_consonant_adjustment[1] == 1 &&
lyric.m_consonant_adjustment[2] == 1 ) {
return true;
} else {
return false;
}
}
}

View File

@ -1,47 +0,0 @@
/*
* LyricHandle.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public class LyricHandle extends VsqHandle implements Cloneable {
public LyricHandle() {
}
/// <summary>
/// type = Lyric用のhandleのコンストラクタ
/// </summary>
/// <param name="phrase">歌詞</param>
/// <param name="phonetic_symbol">発音記号</param>
public LyricHandle( String phrase, String phonetic_symbol ) {
Type = VsqHandleType.Lyric;
L0 = new Lyric( phrase, phonetic_symbol );
}
/*public property Lyric L0 {
get {
return m_lyric;
}
set {
m_lyric = value;
}
}*/
public Object clone() {
LyricHandle ret = new LyricHandle();
ret.Type = Type;
ret.Index = Index;
ret.L0 = (Lyric)L0.clone();
return ret;
}
}

View File

@ -1,122 +0,0 @@
/*
* MidiEvent.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public class MidiEvent implements Comparable<MidiEvent>, Cloneable {
public int index;
public MidiEventType type;
public int[] intValue;
public String stringValue;
public byte[] byteValue;
public static MidiEvent TempoChange( int clock, int tempo ) {
MidiEvent res = new MidiEvent();
res.index = clock;
res.type = MidiEventType.tempo;
res.intValue = new int[1];
res.intValue[0] = tempo;
return res;
}
public static MidiEvent TimeSig( int clock, int numerator, int denominator ) {
MidiEvent res = new MidiEvent();
res.index = clock;
res.type = MidiEventType.time_signal;
res.intValue = new int[2];
res.intValue[0] = numerator;
res.intValue[1] = denominator;
return res;
}
public Object clone() {
MidiEvent res = new MidiEvent();
res.index = index;
res.type = type;
if ( intValue != null ) {
res.intValue = new int[intValue.length];
for ( int i = 0; i < intValue.length; i++ ) {
res.intValue[i] = intValue[i];
}
}
res.stringValue = stringValue;
if ( byteValue != null ) {
res.byteValue = new byte[byteValue.length];
for ( int i = 0; i < byteValue.length; i++ ) {
res.byteValue[i] = byteValue[i];
}
}
return res;
}
public int compareTo( MidiEvent obj ) {
return this.index - obj.index;
}
public boolean Equals( MidiEvent obj ) {
if ( this.index == obj.index ) {
return true;
} else {
return false;
}
}
private MidiEvent() {
}
/**
* かきかけメタテキスト以外のmidiイベントを取り扱う
* @param line
*/
public MidiEvent( String line ) {
index = -1;
type = MidiEventType.unknown;
//intValue = new int[1];
//intValue[0] = -9000;
stringValue = "";
byteValue = null;
String[] spl = line.split( " " );
index = Integer.parseInt( spl[0] );
if ( spl[1].equals( "Tempo" ) ) {
type = MidiEventType.tempo;
intValue = new int[1];
intValue[0] = Integer.parseInt( spl[2] );
} else if ( spl[1].equals( "TimeSig" ) ) {
type = MidiEventType.time_signal;
intValue = new int[4];
String[] spl2 = spl[2].split( "/" );
intValue[0] = Integer.parseInt( spl2[0] );
intValue[1] = Integer.parseInt( spl2[1] );
intValue[2] = Integer.parseInt( spl[3] );
intValue[3] = Integer.parseInt( spl[4] );
} else if ( spl[1].equals( "Par" ) ) {
type = MidiEventType.parameter;
intValue = new int[3];
String[] spl3 = spl[2].split( "=" );
intValue[0] = Integer.parseInt( spl3[1] );
spl3 = spl[3].split( "=" );
intValue[1] = Integer.parseInt( spl3[1] );
spl3 = spl[4].split( "=" );
intValue[2] = Integer.parseInt( spl3[1] );
} else {
type = MidiEventType.unknown;
stringValue = spl[2];
for ( int i = 1; i < spl.length; i++ ) {
stringValue += " " + spl[i];
}
}
}
}

View File

@ -1,71 +0,0 @@
/*
* MidiEvent.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public enum MidiEventType {
/// <summary>
/// channel = 015の値
/// </summary>
channel,
/// <summary>
/// note = 0127の値
/// </summary>
note,
/// <summary>
/// dtime = 0268,435,455 (0x0FFFFFFF)の値
/// </summary>
dtime,
/// <summary>
/// velocity = 0127の値
/// </summary>
velocity,
/// <summary>
/// patch = 0127の値
/// </summary>
patch,
/// <summary>
/// sequence = 0-65,535 (0xFFFF)の値
/// </summary>
sequence,
/// <summary>
/// text = 0byte以上のASCII文字列
/// </summary>
text,
/// <summary>
/// raw = 0byte以上のバイナリデータの文字列
/// </summary>
raw,
/// <summary>
/// pitch_wheel = -81928191 (0x1FFF)の値
/// </summary>
pitch_wheel,
/// <summary>
/// song_pos = 016,383 (0x3FFF)の値
/// </summary>
song_pos,
/// <summary>
/// song_number = 0127の値
/// </summary>
song_number,
/// <summary>
/// tempo = マイクロ秒, 016,777,215 (0x00FFFFFF)の値
/// </summary>
tempo,
time_signal,
unknown,
/// <summary>
/// 勝手に追加スイマセン
/// </summary>
parameter,
}

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
/*
* NrpnData.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public class NrpnData {
//private int m_clock;
public int Clock;
//private byte m_parameter;
public byte Parameter;
//private byte m_value;
public byte Value;
public NrpnData( int clock, byte parameter, byte value ) {
Clock = clock;
Parameter = parameter;
Value = value;
}
/*public property int Clock {
get {
return m_clock;
}
};*/
/*public property byte Parameter {
get {
return m_parameter;
}
};*/
/*public property byte Value {
get {
return m_value;
}
set {
m_value = value;
}
};*/
}

View File

@ -1,50 +0,0 @@
/*
* SMFReader.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
/// SMFファイルを解析しテキストファイル形式のデータに変換します
/// </summary>
public class SMFReader {
//private StreamReader sr = null;
private MidiFile m_midi = null;
//private String _result = "";
private Vector<String> m_lines;
/// <summary>
/// デフォルトコンストラクタコンストラクトと同時に解析を行い指定されたファイルに結果を格納します
/// </summary>
/// <param name="_path">解析対象のファイルへのパス</param>
public SMFReader( String _path ) {
//_result = Path.GetTempFileName();
m_midi = new MidiFile( _path );//, _result, Mode.Read );
//sr = new StreamReader( _result );
m_lines = new Vector<String>();
String[] splitted = m_midi.ReadToEnd().split( "\n" );
for( int i = 0; i < splitted.length; i++ ){
String spl = splitted[i];
m_lines.add( spl );
}
}
public void dispose() {
m_midi.close();
}
public Vector<String> getLines() {
return m_lines;
}
}

View File

@ -1,327 +0,0 @@
/*
* SingerConfig.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
import java.io.*;
import jp.sourceforge.lipsync.bocoree.*;
public class SingerConfig {
public String ID = "VOCALOID:VIRTUAL:VOICE";
public String FORMAT = "2.0.0.0";
public String VOICEIDSTR = "";
public String VOICENAME = "Miku";
public int Breathiness = 0;
public int Brightness = 0;
public int Clearness = 0;
public int Opening = 0;
public int GenderFactor = 0;
public int Original = 0;
public static void decode_vvd_bytes( Vector dat ) {
for ( int i = 0; i < dat.size(); i++ ) {
byte b = (Byte)dat.get( i );
byte M = (byte)(b >> 4);
byte L = (byte)(b - (M << 4));
byte newM = endecode_vvd_m( M );
byte newL = endecode_vvd_l( L );
dat.set( i, (byte)((newM << 4) | newL) );
}
}
private static byte endecode_vvd_l( byte value ) {
switch ( value ) {
case 0x0:
return 0xa;
case 0x1:
return 0xb;
case 0x2:
return 0x8;
case 0x3:
return 0x9;
case 0x4:
return 0xe;
case 0x5:
return 0xf;
case 0x6:
return 0xc;
case 0x7:
return 0xd;
case 0x8:
return 0x2;
case 0x9:
return 0x3;
case 0xa:
return 0x0;
case 0xb:
return 0x1;
case 0xc:
return 0x6;
case 0xd:
return 0x7;
case 0xe:
return 0x4;
case 0xf:
return 0x5;
}
return 0x0;
}
private static byte endecode_vvd_m( byte value ) {
switch ( value ) {
case 0x0:
return 0x1;
case 0x1:
return 0x0;
case 0x2:
return 0x3;
case 0x3:
return 0x2;
case 0x4:
return 0x5;
case 0x5:
return 0x4;
case 0x6:
return 0x7;
case 0x7:
return 0x6;
case 0x8:
return 0x9;
case 0x9:
return 0x8;
case 0xa:
return 0xb;
case 0xb:
return 0xa;
case 0xc:
return 0xd;
case 0xd:
return 0xc;
case 0xe:
return 0xf;
case 0xf:
return 0xe;
}
return 0x0;
}
public SingerConfig( String file, int original ) throws FileNotFoundException, IOException {
Original = original;
FileInputStream fs = new FileInputStream( file );
File f = new File( file );
int length = (int)f.length();
byte[] tdat = new byte[length];
fs.read( tdat, 0, length );
Vector dat = new Vector();
decode_vvd_bytes( dat );
for ( int i = 0; i < dat.size() - 1; i++ ) {
tdat[i] = (Byte)dat.get( i );
}
for ( int i = 0; i < tdat.length - 1; i++ ) {
byte b = tdat[i];
if ( b == 0x17 && b == 0x10 ) {
tdat[i] = 0x0d;
tdat[i + 1] = 0x0a;
}
}
String str = cp932.convert( tdat );
String crlf = Character.toString( (char)0x0d ) + Character.toString( (char)0x0a );
String[] spl = str.split( crlf );
for ( int i = 0; i < spl.length; i++ ) {
String s = spl[i];
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 );
id = id.substring( 1, id.length() - 2 );
value = value.substring( 1, value.length() - 2 );
value = value.replace( "\\\"", "\"" );
if ( id.equals( "ID" ) ) {
ID = value;
} else if ( id.equals( "FORMAT" ) ) {
FORMAT = value;
} else if ( id.equals( "VOICEIDSTR" ) ) {
VOICEIDSTR = value;
} else if ( id.equals( "VOICENAME" ) ) {
VOICENAME = value;
} else if ( id.equals( "Breathiness" ) ) {
try {
Breathiness = Integer.parseInt( value );
} catch ( Exception e ) {
}
} else if ( id.equals( "Brightness" ) ) {
try {
Brightness = Integer.parseInt( value );
} catch ( Exception e ) {
}
} else if ( id.equals( "Clearness" ) ) {
try {
Clearness = Integer.parseInt( value );
} catch ( Exception e ) {
}
} else if ( id.equals( "Opening" ) ) {
try {
Opening = Integer.parseInt( value );
} catch ( Exception e ) {
}
} else if ( id.equals( "Gender:Factor" ) ) {
try {
GenderFactor = Integer.parseInt( value );
} catch ( Exception e ) {
}
}
}
}
/// <summary>
/// 位置positionにある'"'から次に現れる'"'の位置を調べるエスケープされた\"はスキップされる.'"'が見つからなかった場合-1を返す
/// </summary>
/// <param name="s"></param>
/// <param name="position"></param>
/// <returns></returns>
private static int get_quated_String( String s, int position ) {
if ( position < 0 ) {
return -1;
}
char[] chs = s.toCharArray();
if ( position >= chs.length ) {
return -1;
}
if ( chs[position] != '"' ) {
return -1;
}
int end = -1;
for ( int i = position + 1; i <
chs.length; i++ ) {
if ( chs[i] == '"' && chs[i - 1] != '\\' ) {
end = i;
break;
}
}
return end;
}
// ここ注意
public String[] toStringEx() {
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 property int Original {
get {
return m_original;
}
set {
m_original = value;
}
};*/
/*public property String ID {
get {
return m_id;
}
set {
m_id = value;
}
};*/
/*public property String FORMAT {
get {
return m_format;
}
set {
m_format = value;
}
};*/
/*public property String VOICEIDSTR {
get {
return m_voiceidstr;
}
set {
m_voiceidstr = value;
}
};*/
/*public proprety String VOICENAME {
get {
return m_voicename;
}
set {
m_voicename = value;
}
};*/
/*public property int Breathiness {
get {
return m_breathiness;
}
set {
m_breathiness = value;
}
};*/
/*public property int Brightness {
get {
return m_brightness;
}
set {
m_brightness = value;
}
};*/
/*public property int Clearness {
get {
return m_clearness;
}
set {
m_clearness = value;
}
};*/
/*public proprety int Opening {
get {
return m_opening;
}
set {
m_opening = value;
}
};*/
/*public property int GenderFactor {
get {
return m_gender_factor;
}
set {
m_gender_factor = value;
}
};*/
}

View File

@ -1,70 +0,0 @@
/*
* BPPair.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public class TempoTableEntry implements Comparable<TempoTableEntry>, Cloneable {
//private int m_clock;
public int Clock;
//private int m_tempo;
public int Tempo;
//private double m_time;
public double Time;
/*public property int Tempo {
get {
return m_tempo;
}
set {
m_tempo = value;
}
};*/
/*public property double Time {
get {
return m_time;
}
set {
m_time = value;
}
};*/
/*public property int Clock {
get {
return m_clock;
}
set {
m_clock = value;
}
};*/
public Object clone() {
return new TempoTableEntry( Clock, Tempo, Time );
}
public TempoTableEntry( int _index, int _tempo, double _time ) {
this.Clock = _index;
this.Tempo = _tempo;
this.Time = _time;
}
public int compareTo( TempoTableEntry entry ) {
return this.Clock - entry.Clock;
}
public boolean equals( TempoTableEntry entry ) {
if ( this.Clock == entry.Clock ) {
return true;
} else {
return false;
}
}
}

View File

@ -1,112 +0,0 @@
/*
* TextMemoryStream.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.io.*;
import java.util.*;
/**
*
* @author kbinani
*/
public class TextMemoryStream {
StringBuilder m_ms = null;
int m_position;
/// <summary>
///
/// </summary>
/// <param name="s"></param>
public void write( String value ) {
m_ms.append( value );
m_position = m_ms.length();
}
public void rewind() {
m_position = 0;
}
public void writeLine( String s ) {
m_ms.append( s + "\n" );
}
public void close() {
if ( m_ms != null ) {
m_ms = null;
}
}
public int peek() {
if ( m_position >= m_ms.length() ) {
return -1;
} else {
return (int)m_ms.charAt( m_position );
}
}
private int readByte() {
if ( m_position >= m_ms.length() ) {
return -1;
} else {
m_position++;
return (int)m_ms.charAt( m_position );
}
}
public String readLine() {
int ret;
ret = readByte();
ArrayList buffer = new ArrayList();
while ( ret >= 0 ) {
char ch = (char)ret;
if ( ch == '\n' ) {
int next;
long current = m_position; //0x0Dを検出した直後のストリームの位置
break;
}
buffer.add( ch );
ret = readByte();
}
String ans = "";
for ( int i = 0; i < buffer.size(); i++ ) {
ans += buffer.get( i );
}
return ans;
}
public void dispose() {
close();
}
public TextMemoryStream( String path, String encoding ) throws Exception {
m_ms = new StringBuilder();
File f = new File( path );
if ( f.exists() ) {
FileReader fis = new FileReader( f );
BufferedReader br = new BufferedReader( fis );
while ( br.ready() ) {
String line = br.readLine();
m_ms.append( line + "\n" );
}
}
m_position = 0;
}
public TextMemoryStream() {
m_ms = new StringBuilder();
m_position = 0;
}
}

View File

@ -1,43 +0,0 @@
/*
* TextResult.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public class TextResult {
private String m_value;
/**
*
* @param value
*/
public TextResult( String value ) {
m_value = value;
}
/**
*
* @return
*/
public String get() {
return m_value;
}
public void set( String value ) {
m_value = value;
}
}

View File

@ -1,90 +0,0 @@
/*
* BPPair.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public class TimeSigTableEntry implements Comparable<TimeSigTableEntry>, Cloneable {
//int m_clock;
public int Clock;
//int m_numerator;
public int Numerator;
//int m_denominator;
public int Denominator;
//int m_bar_count;
public int BarCount;
public Object clone() {
return new TimeSigTableEntry( Clock, Numerator, Denominator, BarCount );
}
public int compareTo( TimeSigTableEntry item ) {
return this.BarCount - item.BarCount;
}
/*// <summary>
/// クロック数
/// </summary>
public property int Clock {
get {
return m_clock;
}
set {
m_clock = value;
}
};*/
/*// <summary>
/// 拍子の分母
/// </summary>
public property int Numerator {
get {
return m_numerator;
}
set {
m_numerator = value;
}
};*/
/*// <summary>
/// 拍子の分母
/// </summary>
public property int Denominator {
get {
return m_denominator;
}
set {
m_denominator = value;
}
};*/
/*// <summary>
/// Clockの時点で何小節目かを取得します
/// </summary>
public property int BarCount {
get {
return m_bar_count;
}
set {
m_bar_count = value;
}
};*/
public TimeSigTableEntry(
int clock,
int numerator,
int denominator,
int bar_count ) {
Clock = clock;
Numerator = numerator;
Denominator = denominator;
BarCount = bar_count;
}
}

View File

@ -1,156 +0,0 @@
/*
* VibratoHandle.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public class VibratoHandle extends VsqHandle implements Cloneable {
public Object clone() {
VibratoHandle result = new VibratoHandle();
result.Type = Type;
result.Index = Index;
result.IconID = IconID;
result.IDS = this.IDS;
result.Original = this.Original;
result.Caption = this.Caption;
result.Length = this.Length;
result.StartDepth = this.StartDepth;
result.DepthBPNum = this.DepthBPNum;
if ( DepthBPX != null ) {
result.DepthBPX = (float[])this.DepthBPX.clone();
}
if ( DepthBPY != null ) {
result.DepthBPY = (int[])this.DepthBPY.clone();
}
result.StartRate = this.StartRate;
result.RateBPNum = this.RateBPNum;
if ( this.RateBPX != null ) {
result.RateBPX = (float[])this.RateBPX.clone();
}
if ( this.RateBPY != null ) {
result.RateBPY = (int[])this.RateBPY.clone();
}
return result;
}
/*public int Original {
get {
return m_original;
}
set {
m_original = value;
}
}*/
/*public int Length {
get {
return m_length;
}
set {
m_length = value;
}
}*/
/*public string Caption {
get {
return m_caption;
}
set {
m_caption = value;
}
}*/
/*public property String IDS {
get {
return m_ids;
}
set {
m_ids = value;
}
};*/
/*public string IconID {
get {
return m_icon_id;
}
set {
m_icon_id = value;
}
}*/
/*public int StartDepth {
get {
return m_start_depth;
}
set {
m_start_depth = value;
}
}*/
/*public int StartRate {
get {
return m_start_rate;
}
set {
m_start_rate = value;
}
}*/
/*public int DepthBPNum {
get {
return m_depth_bp_num;
}
set {
m_depth_bp_num = value;
}
}*/
/*public property int RateBPNum {
get {
return m_rate_bp_num;
}
set {
m_rate_bp_num = value;
}
};*/
/*public property float[] DepthBPX {
get {
return m_depth_bp_x;
}
set {
m_depth_bp_x = value;
}
};*/
/*public property int[] DepthBPY {
get {
return m_depth_bp_y;
}
set {
m_depth_bp_y = value;
}
};*/
/*public property float[] RateBPX {
get {
return m_rate_bp_x;
}
set {
m_rate_bp_x = value;
}
};*/
/*public property int[] RateBPY {
get {
return m_rate_bp_y;
}
set {
m_rate_bp_y = value;
}
};*/
}

View File

@ -1,33 +0,0 @@
/*
* VibratoType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public enum VibratoType{
NormalType1,
NormalType2,
NormalType3,
NormalType4,
ExtremeType1,
ExtremeType2,
ExtremeType3,
ExtremeType4,
FastType1,
FastType2,
FastType3,
FastType4,
SlightType1,
SlightType2,
SlightType3,
SlightType4,
}

View File

@ -1,253 +0,0 @@
/*
* VibratoType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public class VibratoTypeUtil {
public static VibratoType FromIconID( String icon_id ) {
if ( icon_id.equals( "$04040001" ) ) {
return VibratoType.NormalType1;
} else if ( icon_id.equals( "$04040002" ) ) {
return VibratoType.NormalType2;
} else if ( icon_id.equals( "$04040003" ) ) {
return VibratoType.NormalType3;
} else if ( icon_id.equals( "$0400004" ) ) {
return VibratoType.NormalType4;
} else if ( icon_id.equals( "$04040005" ) ) {
return VibratoType.ExtremeType1;
} else if ( icon_id.equals( "$04040006" ) ) {
return VibratoType.ExtremeType2;
} else if ( icon_id.equals( "$04040007" ) ) {
return VibratoType.ExtremeType3;
} else if ( icon_id.equals( "$04040008" ) ) {
return VibratoType.ExtremeType4;
} else if ( icon_id.equals( "$04040009" ) ) {
return VibratoType.FastType1;
} else if ( icon_id.equals( "$0404000a" ) ) {
return VibratoType.FastType2;
} else if ( icon_id.equals( "$0404000b" ) ) {
return VibratoType.FastType3;
} else if ( icon_id.equals( "$0404000c" ) ) {
return VibratoType.FastType4;
} else if ( icon_id.equals( "$0404000d" ) ) {
return VibratoType.SlightType1;
} else if ( icon_id.equals( "$0404000e" ) ) {
return VibratoType.SlightType2;
} else if ( icon_id.equals( "$0404000f" ) ) {
return VibratoType.SlightType3;
} else if ( icon_id.equals( "$04040010" ) ) {
return VibratoType.SlightType4;
}
return VibratoType.NormalType1;
}
public static String GetIconID( VibratoType type ) {
switch ( type ) {
case NormalType1:
return "$04040001";
case NormalType2:
return "$04040002";
case NormalType3:
return "$04040003";
case NormalType4:
return "$0400004";
case ExtremeType1:
return "$04040005";
case ExtremeType2:
return "$04040006";
case ExtremeType3:
return "$04040007";
case ExtremeType4:
return "$04040008";
case FastType1:
return "$04040009";
case FastType2:
return "$0404000a";
case FastType3:
return "$0404000b";
case FastType4:
return "$0404000c";
case SlightType1:
return "$0404000d";
case SlightType2:
return "$0404000e";
case SlightType3:
return "$0404000f";
case SlightType4:
return "$04040010";
}
return "";
}
public static VibratoHandle GetDefaultVibratoHandle( VibratoType type, int vibrato_clocks ) {
VibratoHandle res = new VibratoHandle();
res.Type = VsqHandleType.Vibrato;
res.Length = vibrato_clocks;
res.Original = 1;
res.DepthBPNum = 0;
res.RateBPNum = 0;
res.Caption = toString( type );
res.IconID = GetIconID( type );
switch ( type ) {
case NormalType1:
res.IDS = "normal";
res.StartDepth = 64;
res.StartRate = 50;
break;
case NormalType2:
res.IDS = "normal";
res.StartDepth = 40;
res.StartRate = 40;
break;
case NormalType3:
res.IDS = "normal";
res.StartDepth = 127;
res.StartRate = 50;
break;
case NormalType4:
res.IDS = "normal";
res.StartDepth = 64;
res.DepthBPNum = 57;
res.DepthBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.DepthBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
res.StartRate = 50;
res.RateBPNum = 52;
res.RateBPX = new float[]{ 0.600000f, 0.612500f, 0.616400f, 0.621100f, 0.628900f, 0.633600f, 0.637500f, 0.641400f, 0.653900f, 0.658600f, 0.662500f, 0.666400f, 0.675000f, 0.683600f, 0.687500f, 0.691400f, 0.700000f, 0.703900f, 0.708600f, 0.712500f, 0.725000f, 0.728900f, 0.732800f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.771100f, 0.775000f, 0.778900f, 0.783600f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.816400f, 0.821100f, 0.828900f, 0.833600f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.866400f, 0.871100f, 0.875000f, 0.878900f, 0.887500f, 0.891400f, 0.900000f, 1.000000f };
res.RateBPY = new int[]{ 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
break;
case ExtremeType1:
res.IDS = "extreme";
res.StartDepth = 64;
res.StartRate = 64;
break;
case ExtremeType2:
res.IDS = "extreme";
res.StartDepth = 32;
res.StartRate = 32;
break;
case ExtremeType3:
res.IDS = "extreme";
res.StartDepth = 100;
res.StartRate = 50;
break;
case ExtremeType4:
res.IDS = "extreme";
res.StartDepth = 64;
res.DepthBPNum = 57;
res.DepthBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.DepthBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
res.StartRate = 64;
res.RateBPNum = 57;
res.RateBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.RateBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
break;
case FastType1:
res.IDS = "fast";
res.StartDepth = 64;
res.StartRate = 64;
break;
case FastType2:
res.IDS = "fast";
res.StartDepth = 40;
res.StartRate = 50;
break;
case FastType3:
res.IDS = "fast";
res.StartDepth = 80;
res.StartRate = 70;
break;
case FastType4:
res.IDS = "fast";
res.StartDepth = 64;
res.DepthBPNum = 57;
res.DepthBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.DepthBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
res.StartRate = 64;
res.RateBPNum = 57;
res.RateBPX = new float[]{ 0.603900f, 0.612500f, 0.616400f, 0.621100f, 0.625000f, 0.633600f, 0.637500f, 0.641400f, 0.646100f, 0.653900f, 0.658600f, 0.666400f, 0.670300f, 0.675000f, 0.678900f, 0.683600f, 0.691400f, 0.696100f, 0.703900f, 0.708600f, 0.712500f, 0.716400f, 0.721100f, 0.725000f, 0.728900f, 0.737500f, 0.746100f, 0.750000f, 0.758600f, 0.762500f, 0.766400f, 0.771100f, 0.775000f, 0.783600f, 0.791400f, 0.795300f, 0.800000f, 0.803900f, 0.808600f, 0.812500f, 0.821100f, 0.828900f, 0.837500f, 0.841400f, 0.846100f, 0.850000f, 0.853900f, 0.862500f, 0.866400f, 0.875000f, 0.878900f, 0.883600f, 0.887500f, 0.891400f, 0.896100f, 0.900000f, 1.000000f };
res.RateBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
break;
case SlightType1:
res.IDS = "slight";
res.StartDepth = 64;
res.StartRate = 64;
break;
case SlightType2:
res.IDS = "slight";
res.StartDepth = 40;
res.StartRate = 64;
break;
case SlightType3:
res.IDS = "slight";
res.StartDepth = 72;
res.StartRate = 64;
break;
case SlightType4:
res.IDS = "slight";
res.StartDepth = 64;
res.DepthBPNum = 57;
res.DepthBPX = new float[]{ 0.604300f, 0.612500f, 0.616800f, 0.620700f, 0.625000f, 0.633200f, 0.637500f, 0.641800f, 0.645700f, 0.654300f, 0.658200f, 0.666800f, 0.670700f, 0.675000f, 0.679300f, 0.683200f, 0.691800f, 0.695700f, 0.704300f, 0.708200f, 0.712500f, 0.716800f, 0.720700f, 0.725000f, 0.729300f, 0.737500f, 0.745700f, 0.750000f, 0.758200f, 0.762500f, 0.766800f, 0.770700f, 0.775000f, 0.783200f, 0.791800f, 0.795700f, 0.800000f, 0.804300f, 0.808200f, 0.812500f, 0.820700f, 0.829300f, 0.837500f, 0.841800f, 0.845700f, 0.850000f, 0.854300f, 0.862500f, 0.866800f, 0.875000f, 0.879300f, 0.883200f, 0.887500f, 0.891800f, 0.895700f, 0.900000f, 1.000000f };
res.DepthBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
res.StartRate = 64;
res.RateBPNum = 57;
res.RateBPX = new float[]{ 0.604300f, 0.612500f, 0.616800f, 0.620700f, 0.625000f, 0.633200f, 0.637500f, 0.641800f, 0.645700f, 0.654300f, 0.658200f, 0.666800f, 0.670700f, 0.675000f, 0.679300f, 0.683200f, 0.691800f, 0.695700f, 0.704300f, 0.708200f, 0.712500f, 0.716800f, 0.720700f, 0.725000f, 0.729300f, 0.737500f, 0.745700f, 0.750000f, 0.758200f, 0.762500f, 0.766800f, 0.770700f, 0.775000f, 0.783200f, 0.791800f, 0.795700f, 0.800000f, 0.804300f, 0.808200f, 0.812500f, 0.820700f, 0.829300f, 0.837500f, 0.841800f, 0.845700f, 0.850000f, 0.854300f, 0.862500f, 0.866800f, 0.875000f, 0.879300f, 0.883200f, 0.887500f, 0.891800f, 0.895700f, 0.900000f, 1.000000f };
res.RateBPY = new int[]{ 64, 63, 62, 61, 59, 58, 57, 56, 55, 54, 52, 51, 50, 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, 38, 37, 35, 34, 32, 31, 30, 29, 28, 27, 25, 24, 23, 22, 21, 20, 19, 17, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0 };
break;
}
return res;
}
public static String toString( VibratoType value ) {
switch ( value ) {
case NormalType1:
return "[Normal] Type 1";
case NormalType2:
return "[Normal] Type 2";
case NormalType3:
return "[Normal] Type 3";
case NormalType4:
return "[Normal] Type 4";
case ExtremeType1:
return "[Extreme] Type 1";
case ExtremeType2:
return "[Extreme] Type 2";
case ExtremeType3:
return "[Extreme] Type 3";
case ExtremeType4:
return "[Extreme] Type 4";
case FastType1:
return "[Fast] Type 1";
case FastType2:
return "[Fast] Type 2";
case FastType3:
return "[Fast] Type 3";
case FastType4:
return "[Fast] Type 4";
case SlightType1:
return "[Slight] Type 1";
case SlightType2:
return "[Slight] Type 2";
case SlightType3:
return "[Slight] Type 3";
case SlightType4:
return "[Slight] Type 4";
}
return "";
}
}

View File

@ -1,203 +0,0 @@
/*
* VsqBPList.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
import java.io.*;
/**
* BPListのデータ部分を取り扱うためのクラス
*@author kbinani
*/
public class VsqBPList implements Cloneable {
TreeMap<Integer, Integer> _list = new TreeMap<Integer, Integer>();
int _default = 0;
int _maximum = 127;
int _minimum = 0;
public Object clone() {
VsqBPList res = new VsqBPList( _default, _minimum, _maximum );
Set<Integer> enumerator = _list.keySet();
for ( Iterator itr = enumerator.iterator(); itr.hasNext();) {
Integer key = (Integer)itr.next();
res._list.put( key, _list.get( key ) );
}
return res;
}
/**
* コンストラクタデフォルト値はココで指定する
* @param default_value
*/
public VsqBPList( int default_value, int minimum, int maximum ) {
_default = default_value;
_maximum = maximum;
_minimum = minimum;
}
/**
* このリストに設定された最大値を取得します
*/
public int getMaximum() {
return _maximum;
}
/**
* このリストに設定された最小値を取得します
/*
public int getMinimum() {
return _minimum;
}
/* // <summary>
/// _listへのアクセッサ
/// </summary>
public SortedList<int, int> List {
get {
return _list;
}
}*/
public Set<Integer> keyClockSet() {
return _list.keySet();
}
public Iterator<Integer> keyClockIterator(){
return _list.keySet().iterator();
}
public void remove( int clock ) {
if ( _list.containsKey( clock ) ) {
_list.remove( clock );
}
}
public boolean containsKey( int clock ) {
return _list.containsKey( clock );
}
public int size() {
return _list.size();
}
public void clear() {
_list.clear();
}
/**
* 新しいデータ点を追加します
*
* @param clock
* @param value
*/
public void add( int clock, int value ) {
_list.put( clock, value );
}
public int get( int clock ) {
if ( _list.size() == 0 ) {
return _default;
} else {
if ( _list.containsKey( clock ) ) {
return _list.get( clock );
} else {
int index = 0;
int prev = 0;
for ( Iterator itr = _list.keySet().iterator(); itr.hasNext();) {
Integer key = (Integer)itr.next();
if ( clock < key ) {
index = prev;
break;
}
prev = key;
}
if ( _list.containsKey( index ) ) {
return _list.get( index );
} else {
return _default;
}
}
}
}
/**
* このBPListのデフォルト値を取得します
*/
public int getDefault() {
return _default;
}
/**
* このBPListの内容をテキストファイルに書き出します
*
* @param writer
*/
public void print( BufferedWriter writer ) throws IOException {
boolean first = true;
for ( Iterator itr = _list.keySet().iterator(); itr.hasNext();) {
Integer key = (Integer)itr.next();
int val = _list.get( key );
if ( first ) {
writer.write( key + "=" + val + "\n" );
first = false;
} else {
writer.write( key + "=" + val + "\n" );
}
}
}
/**
* このBPListの内容をテキストファイルに書き出します
*
* @param writer
*/
public void print( TextMemoryStream writer, int start, String header ) {
boolean first = true;
for ( Iterator itr = _list.keySet().iterator(); itr.hasNext();) {
Integer key = (Integer)itr.next();
if ( start <= key ) {
if ( first ) {
writer.writeLine( header );
first = false;
}
int val = _list.get( key );
writer.writeLine( key + "=" + val );
}
}
}
/**
* テキストファイルからデータ点を読込み現在のリストに追加します
*
* @param reader
* @returns
*/
public String readFrom( TextMemoryStream reader ) {
String last_line = reader.readLine();
while ( !last_line.startsWith( "[" ) ) {
String[] spl = last_line.split( "=" );
int i1 = Integer.parseInt( spl[0] );
int i2 = Integer.parseInt( spl[1] );
_list.put( i1, i2 );
if ( reader.peek() < 0 ) {
break;
} else {
last_line = reader.readLine();
}
}
return last_line;
}
}

View File

@ -1,126 +0,0 @@
/*
* VsqBarLineEnumeration.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/**
*
* @author kbinani
*/
public class VsqBarLineEnumeration implements Enumeration {
Vector<TimeSigTableEntry> TimeSigTable;
int end_clock;
int m_index = 0;
int m_last_clock = -1;
public VsqBarLineEnumeration( Vector<TimeSigTableEntry> time_sig_table, int t_end_clock ) {
TimeSigTable = time_sig_table;
end_clock = t_end_clock;
m_index = 0;
m_last_clock = -1;
}
public boolean hasMoreElements() {
if ( m_last_clock < 0 ) {
return true;
}
for ( int i = m_index; i < TimeSigTable.size(); i++ ) {
int denominator = TimeSigTable.get( i ).Denominator;
int numerator = TimeSigTable.get( i ).Numerator;
int local_clock = TimeSigTable.get( i ).Clock;
int bar_count = TimeSigTable.get( i ).BarCount;
int clock_step = 480 * 4 / denominator;
int mod = clock_step * numerator;
int bar_counter = bar_count - 1;
int t_end = end_clock;
if ( i + 1 < TimeSigTable.size() ) {
t_end = TimeSigTable.get( i + 1 ).Clock;
}
int t_start = m_last_clock + clock_step;
for ( int clock = t_start; clock < t_end; clock += clock_step ) {
if ( (clock - local_clock) % mod == 0 ) {
bar_counter++;
return true;
} else {
return true;
}
}
}
return false;
}
public Object nextElement() {
if ( m_last_clock < 0 ) {
m_last_clock = 0;
return new VsqBarLineType( 0, true, TimeSigTable.get( 0 ).Denominator, TimeSigTable.get( 0 ).Numerator, 0 );
}
int last = m_index;
for ( m_index = last; m_index < TimeSigTable.size(); m_index++ ) {
int denominator = TimeSigTable.get( m_index ).Denominator;
int numerator = TimeSigTable.get( m_index ).Numerator;
int local_clock = TimeSigTable.get( m_index ).Clock;
int bar_count = TimeSigTable.get( m_index ).BarCount;
int clock_step = 480 * 4 / denominator;
int mod = clock_step * numerator;
int bar_counter = bar_count - 1;
int t_end = end_clock;
if ( m_index + 1 < TimeSigTable.size() ) {
t_end = TimeSigTable.get( m_index + 1 ).Clock;
}
int t_start = m_last_clock + clock_step;
for ( int clock = t_start; clock < t_end; clock += clock_step ) {
if ( (clock - local_clock) % mod == 0 ) {
bar_counter++;
m_last_clock = clock;
return new VsqBarLineType( clock, true, denominator, numerator, bar_counter );
} else {
m_last_clock = clock;
return new VsqBarLineType( clock, false, denominator, numerator, bar_counter );
}
}
}
return null;
}
/*private Object imp_nextElement() {
int local_denominator;
int local_numerator;
int local_clock;
int local_bar_count;
int clock_step;
for ( int i = 0; i < TimeSigTable.size(); i++ ) {
local_denominator = TimeSigTable.get( i ).Denominator;
local_numerator = TimeSigTable.get( i ).Numerator;
local_clock = TimeSigTable.get( i ).Clock;
local_bar_count = TimeSigTable.get( i ).BarCount;
clock_step = 480 * 4 / local_denominator;
int mod = clock_step * local_numerator;
int bar_counter = local_bar_count - 1;
int t_end = end_clock;
if ( i + 1 < TimeSigTable.size() ) {
t_end = TimeSigTable.get( i + 1 ).Clock;
}
for ( int clock = local_clock; clock < t_end; clock += clock_step ) {
if ( (clock - local_clock) % mod == 0 ) {
bar_counter++;
return new VsqBarLineType( clock, true, local_denominator, local_numerator, bar_counter );
} else {
return new VsqBarLineType( clock, false, local_denominator, local_numerator, bar_counter );
}
}
}
}*/
}

View File

@ -1,56 +0,0 @@
/*
* VibratoType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public class VsqBarLineType {
public int Clock = 0;
public boolean IsSeparator = true;
public int Denominator;
public int Numerator;
public int BarCount;
/*public property int BarCount {
get {
return m_bar_count;
}
};*/
/*public property int LocalDenominator {
get {
return m_denominator;
}
};*/
/*public property int LocalNumerator {
get {
return m_numerator;
}
};*/
/*public property int Clock {
get {
return m_clock;
}
};*/
/*public boolean property IsSeparator {
get {
return m_is_separator;
}
};*/
public VsqBarLineType( int clock, boolean is_separator, int denominator, int numerator, int bar_count ) {
Clock = clock;
IsSeparator = is_separator;
Denominator = denominator;
Numerator = numerator;
BarCount = bar_count;
}
}

View File

@ -1,44 +0,0 @@
/*
* VsqCommand.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
///
/// </summary>
public class VsqCommand {
public VsqCommandType Type;
/**
* コマンドの処理内容を保持しますArgs具体的な内容は処理するクラスごとに異なります
*/
public Object[] Args;
/**
* 後続するコマンド
*/
public Vector<VsqCommand> Children = new Vector<VsqCommand>();
/**
* このコマンドの親
*/
public VsqCommand Parent = null;
/**
* VsqCommandは各クラスのGenerateCommandからコンストラクトしなければならない
* なので無引数のコンストラクタを隠蔽するためのもの
*/
protected VsqCommand() {
//throw new Exception( "このコンストラクトは呼び出しちゃいけませんよ" );
}
}

View File

@ -1,45 +0,0 @@
/*
* VsqCommandType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public enum VsqCommandType {
Root,
ChangePreMeasure,
EventAdd,
EventDelete,
EventChangeClock,
EventChangeLyric,
EventChangeNote,
EventChangeClockAndNote,
TrackEditCurve,
TrackEditCurveRange,
EventChangeVelocity,
EventChangeLength,
EventChangeClockAndLength,
EventChangeIDContaints,
EventChangeClockAndIDContaints,
TrackChangeName,
AddTrack,
DeleteTrack,
EventChangeClockAndIDContaintsRange,
EventDeleteRange,
EventAddRange,
UpdateTempo,
UpdateTempoRange,
UpdateTimesig,
UpdateTimesigRange,
EventChangeIDContaintsRange,
TrackReplace,
Replace,
}

View File

@ -1,103 +0,0 @@
/*
* VsqCommon.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.awt.*;
/**
* vsqファイルのメタテキストの[Common]セクションに記録される内容を取り扱う
* @author kbinani
*/
public class VsqCommon implements Cloneable {
public String m_version;
public String m_name;
public String m_color;
public int m_dynamics_mode;
public int m_play_mode;
public Object clone() {
String[] spl = m_color.split( ",", 3 );
int r = Integer.parseInt( spl[0] );
int g = Integer.parseInt( spl[1] );
int b = Integer.parseInt( spl[2] );
Color color = new Color( r, g, b );
VsqCommon res = new VsqCommon( m_name, color, m_dynamics_mode, m_play_mode );
res.m_version = m_version;
return res;
}
/**
* 各パラメータを指定したコンストラクタ
* @param name トラック名
* @param color Color値意味は不明
* @param dynamics_mode DynamicsModeデフォルトは1
* @param play_mode PlayModeデフォルトは1
*/
public VsqCommon( String name, Color color, int dynamics_mode, int play_mode ) {
m_version = "DSB301";
m_name = name;
m_color = color.getRed() + "," + color.getGreen() + "," + color.getBlue();
m_dynamics_mode = dynamics_mode;
m_play_mode = play_mode;
}
/**
* MetaTextのテキストファイルからのコンストラクタ
* @param sr 読み込むテキストファイル
* @param last_line 読み込んだ最後の行が返される
*/
public VsqCommon( TextMemoryStream sr, TextResult last_line ) {
m_version = "";
m_name = "";
m_color = "0,0,0";
m_dynamics_mode = 0;
m_play_mode = 0;
last_line.set( sr.readLine() );
String[] spl;
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "Version" ) ) {
this.m_version = spl[1];
} else if ( spl[0].equals( "Name" ) ) {
this.m_name = spl[1];
break;
} else if ( spl[0].equals( "Color" ) ) {
this.m_color = spl[1];
} else if ( spl[0].equals( "DynamicsMode" ) ) {
this.m_dynamics_mode = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "PlayMode" ) ) {
this.m_play_mode = Integer.parseInt( spl[1] );
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
}
/**
* インスタンスの内容をテキストファイルに出力します
*
* @param sw 出力先
*/
public void write( TextMemoryStream sw ) {
sw.writeLine( "[Common]" );
sw.writeLine( "Version=" + m_version );
sw.writeLine( "Name=" + m_name );
sw.writeLine( "Color=" + m_color );
sw.writeLine( "DynamicsMode=" + m_dynamics_mode );
sw.writeLine( "PlayMode=" + this.m_play_mode );
}
}

View File

@ -1,60 +0,0 @@
/*
* VsqCurveType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/// <summary>
/// vsqファイルで編集可能なカーブプロパティの種類
/// </summary>
public enum VsqCurveType {
/// <summary>
/// ベロシティ
/// </summary>
VEL,
/// <summary>
/// ダイナミクス 64
/// </summary>
DYN,
/// <summary>
/// ブレシネス 0
/// </summary>
BRE,
/// <summary>
/// ブライトネス 64
/// </summary>
BRI,
/// <summary>
/// クリアネス 0
/// </summary>
CLE,
/// <summary>
/// オープニング 127
/// </summary>
OPE,
/// <summary>
/// ジェンダーファクター 64
/// </summary>
GEN,
/// <summary>
/// ポルタメントタイミング 64
/// </summary>
POR,
/// <summary>
/// ピッチベンド 0
/// </summary>
PIT,
/// <summary>
/// ピッチベンドセンシティビティ 2
/// </summary>
PBS,
}

View File

@ -1,110 +0,0 @@
/*
* VsqEvent.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/**
* vsqファイルのメタテキスト内に記述されるイベント
*/
public class VsqEvent implements Comparable<VsqEvent>, Cloneable {
//int m_internal_id;
/**
* 内部で使用するインスタンス固有のID<br>
* for furutre implement:<pre>
* public property int InternalID {
* get {
* return m_internal_id;
* }
* set {
* m_internal_id = value;
* }
* };</pre>
*/
public int InternalID;
//int m_clock;
public int Clock;
//VsqID m_id;
public VsqID ID;
/**
* このオブジェクトのコピーを作成します
* @returns>
*/
public Object clone() {
VsqEvent ret = new VsqEvent( Clock, ID );
ret.InternalID = InternalID;
return ret;
}
/* // <summary>
/// このイベントが発生するクロック
/// </summary>
public property int Clock {
get {
return m_clock;
}
set {
m_clock = value;
}
};*/
/* // <summary>
/// 発生するイベントの内容を表したID
/// </summary>
public property VsqID ID {
get {
return m_id;
}
set {
m_id = value;
}
};*/
public int compareTo( VsqEvent item ) {
int ret = this.Clock - item.Clock;
if ( ret == 0 ) {
if ( this.ID != null && item.ID != null ) {
if ( this.ID == item.ID ) {
return 0;
} else {
if ( this.ID.type == VsqIDType.Singer ) {
return -1;
} else if ( item.ID.type == VsqIDType.Anote ) {
return 1;
}
}
} else {
return ret;
}
} else {
return ret;
}
return 0;
}
public VsqEvent( String line ) {
String[] spl = line.split( "=" );
Clock = Integer.parseInt( spl[0] );
if ( spl[1].equals( "EOS" ) ) {
ID = VsqID.EOS;
}
}
public VsqEvent( int clock, VsqID id /*, int internal_id*/ ) {
Clock = clock;
ID = (VsqID)id.clone();
//InternalID = internal_id;
InternalID = 0;
}
}

View File

@ -1,84 +0,0 @@
/*
* VsqEventIterator.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/**
*
* @author kbinani
*/
public class VsqEventIterator implements Iterator {
private Vector<VsqEvent> m_list;
private int m_index = 0;
private VsqEventIteratorMode m_mode;
public VsqEventIterator( Vector<VsqEvent> list, VsqEventIteratorMode mode ) {
m_list = list;
m_index = 0;
m_mode = mode;
}
public void remove() {
m_list.remove( m_index );
}
public Object next() {
int last = m_index;
for ( m_index = last; m_index < m_list.size(); m_index++ ) {
VsqEvent ret = m_list.get( m_index );
if ( m_mode == VsqEventIteratorMode.All ) {
return ret;
} else if ( m_mode == VsqEventIteratorMode.Anote ) {
if ( ret.ID.type == VsqIDType.Anote ) {
return ret;
} else {
continue;
}
} else if ( m_mode == VsqEventIteratorMode.Singer ) {
if ( ret.ID.type == VsqIDType.Singer ) {
return ret;
} else {
continue;
}
}
}
return null;
}
public boolean hasNext() {
if ( m_mode == VsqEventIteratorMode.All ) {
return (m_index + 1 < m_list.size());
} else {
for ( int i = m_index; i < m_list.size(); i++ ) {
VsqEvent ret = m_list.get( i );
if ( m_mode == VsqEventIteratorMode.Anote ) {
if ( ret.ID.type == VsqIDType.Anote ) {
return true;
} else {
continue;
}
} else if ( m_mode == VsqEventIteratorMode.Singer ) {
if ( ret.ID.type == VsqIDType.Singer ) {
return true;
} else {
continue;
}
}
}
return false;
}
}
}

View File

@ -1,24 +0,0 @@
/*
* VsqEventIterator.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public enum VsqEventIteratorMode {
Anote,
Singer,
All,
}

View File

@ -1,97 +0,0 @@
/*
* VsqEventList.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
/// 固有ID付きのVsqEventのリストを取り扱う
/// </summary>
public class VsqEventList {
private Vector<VsqEvent> m_list;
private Vector<Integer> m_ids;
/// <summary>
/// コンストラクタ
/// </summary>
public VsqEventList() {
m_list = new Vector<VsqEvent>();
m_ids = new Vector<Integer>();
}
public VsqEventIterator iterator( VsqEventIteratorMode mode ) {
return new VsqEventIterator( m_list, mode );
}
public VsqEventIterator iterator(){
return iterator( VsqEventIteratorMode.All );
}
public void add( VsqEvent item ) {
int new_id = GetNextId( 0 );
item.InternalID = new_id;
m_list.add( item );
m_ids.add( new_id );
boolean changed = true;
while ( changed ) {
changed = false;
for ( int i = 0; i < m_list.size() - 1; i++ ) {
if ( m_list.get( i ).compareTo( m_list.get( i + 1 ) ) > 0 ) {
VsqEvent t = (VsqEvent)m_list.get( i ).clone();
m_list.set( i, m_list.get( i + 1 ) );
m_list.set( i + 1, t );
changed = true;
}
}
}
for ( int i = 0; i < m_list.size(); i++ ) {
m_ids.set( i, m_list.get( i ).InternalID );
}
}
public void removeAt( int index ) {
m_list.remove( index );
m_ids.remove( index );
}
private int GetNextId( int next ) {
int index = -1;
Vector<Integer> current = new Vector<Integer>( m_ids );
int nfound = 0;
while ( true ) {
index++;
if ( !current.contains( index ) ) {
nfound++;
if ( nfound == next + 1 ) {
return index;
} else {
current.add( index );
}
}
}
}
public int size() {
return m_list.size();
}
public VsqEvent get( int index ) {
return m_list.get( index );
}
public void set( int index, VsqEvent value ) {
m_list.add( index, value );
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,391 +0,0 @@
/*
* VsqHandle.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.io.*;
import java.text.*;
/// <summary>
/// ハンドルを取り扱いますハンドルにはLyricHandleVibratoHandleおよびIconHandleがある
/// </summary>
public class VsqHandle {
public VsqHandleType Type;
public int Index;
/*protected String m_icon_id;
protected String m_ids;
protected Lyric m_lyric;
protected int m_original;
protected String m_caption;
protected int m_length;
protected int m_start_depth;
protected int DepthBPNum;
protected float[] DepthBPX;
protected int[] DepthBPY;
protected int m_start_rate;
protected int RateBPNum;
protected float[] RateBPX;
protected int[] RateBPY;
protected int m_language;
protected int m_program;*/
public String IconID;
public String IDS;
public Lyric L0;
public int Original;
public String Caption;
public int Length;
public int StartDepth;
public int DepthBPNum;
public float[] DepthBPX;
public int[] DepthBPY;
public int StartRate;
public int RateBPNum;
public float[] RateBPX;
public int[] RateBPY;
public int Language;
public int Program;
public LyricHandle ConvertToLyricHandle() {
LyricHandle ret = new LyricHandle();
ret.L0 = (Lyric)L0.clone();
ret.Type = Type;//m_type;
ret.Index = Index;// m_index;
return ret;
}
public VibratoHandle ConvertToVibratoHandle() {
VibratoHandle ret = new VibratoHandle();
ret.Type = Type;
ret.Index = Index;
ret.Caption = Caption;
ret.DepthBPNum = DepthBPNum;
ret.DepthBPX = DepthBPX;
ret.DepthBPY = DepthBPY;
;
ret.IconID = IconID;
ret.IDS = IDS;
ret.Length = Length;
ret.Original = Original;
ret.RateBPNum = RateBPNum;
ret.RateBPX = RateBPX;
ret.RateBPY = RateBPY;
ret.StartDepth = StartDepth;
ret.StartRate = StartRate;
return ret;
}
public IconHandle ConvertToIconHandle() {
IconHandle ret = new IconHandle();
ret.Type = Type;
ret.Index = Index;
ret.Caption = Caption;
ret.IconID = IconID;
ret.IDS = IDS;
ret.Language = Language;
ret.Length = Length;
ret.Original = Original;
ret.Program = Program;
return ret;
}
/*public VsqHandleType Type {
get {
return m_type;
}
set {
m_type = value;
}
}
public int Index {
get {
return m_index;
}
set {
m_index = value;
}
}*/
/*// <summary>
/// このインスタンスの簡易コピーを取得します
/// </summary>
/// <returns></returns>
public object Clone() {
VsqHandle result = new VsqHandle();
result.m_type = m_type;
result.m_index = m_index;
result.m_icon_id = m_icon_id;
result.IDS = this.IDS;
if ( this.L0 != null ) {
result.L0 = this.L0.Clone();
}
result.Original = this.Original;
result.Caption = this.Caption;
result.Length = this.Length;
result.StartDepth = this.StartDepth;
result.DepthBPNum = this.DepthBPNum;
if ( this.DepthBPX != null ) {
result.DepthBPX = (float[])this.DepthBPX.Clone();
}
if ( this.DepthBPY != null ) {
result.DepthBPY = (int[])this.DepthBPY.Clone();
}
result.StartRate = this.StartRate;
result.RateBPNum = this.RateBPNum;
if ( this.RateBPX != null ) {
result.RateBPX = (float[])this.RateBPX.Clone();
}
if ( this.RateBPY != null ) {
result.RateBPY = (int[])this.RateBPY.Clone();
}
result.Language = this.Language;
result.Program = this.Program;
return result;
}*/
public VsqHandle() {
}
/// <summary>
/// インスタンスをストリームに書き込みます
/// encode=trueの場合2バイト文字をエンコードして出力します
/// </summary>
/// <param name="sw">書き込み対象</param>
/// <param name="encode">2バイト文字をエンコードするか否かを指定するフラグ</param>
public void write( TextMemoryStream sw, boolean encode ) {
sw.writeLine( this.toString( encode ) );
}
/// <summary>
/// FileStreamから読み込みながらコンストラクト
/// </summary>
/// <param name="sr">読み込み対象</param>
public VsqHandle( TextMemoryStream sr, int value, TextResult last_line ) {
this.Index = value;
String[] spl;
String[] spl2;
// default値で梅
this.Type = VsqHandleType.Vibrato;
IconID = "";
IDS = "normal";
L0 = new Lyric( "" );
Original = 0;
Caption = "";
Length = 0;
StartDepth = 0;
DepthBPNum = 0;
DepthBPX = null;
DepthBPY = null;
StartRate = 0;
RateBPNum = 0;
RateBPX = null;
RateBPY = null;
Language = 0;
Program = 0;
String tmpDepthBPX = "";
String tmpDepthBPY = "";
String tmpRateBPX = "";
String tmpRateBPY = "";
// "["にぶち当たるまで読込む
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "Language" ) ) {
Language = Integer.parseInt( spl[1] );
} else if ( spl[0].endsWith( "Program" ) ) {
Program = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "IconID" ) ) {
IconID = spl[1];
} else if ( spl[0].equals( "IDS" ) ) {
IDS = spl[1];
} else if ( spl[0].equals( "Original" ) ) {
Original = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "Caption" ) ) {
Caption = spl[1];
for ( int i = 2; i < spl.length; i++ ) {
Caption += "=" + spl[i];
}
} else if ( spl[0].equals( "Length" ) ) {
Length = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "StartDepth" ) ) {
StartDepth = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "DepthBPNum" ) ) {
DepthBPNum = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "DepthBPX" ) ) {
tmpDepthBPX = spl[1];
} else if ( spl[0].equals( "DepthBPY" ) ) {
tmpDepthBPY = spl[1];
} else if ( spl[0].equals( "StartRate" ) ) {
StartRate = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "RateBPNum" ) ) {
RateBPNum = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "RateBPX" ) ) {
tmpRateBPX = spl[1];
} else if ( spl[0].equals( "RateBPY" ) ) {
tmpRateBPY = spl[1];
} else if ( spl[0].equals( "L0" ) ) {
Type = VsqHandleType.Lyric;
L0 = new Lyric( spl[1] );
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
if ( IDS != "normal" ) {
Type = VsqHandleType.Singer;
} else if ( IconID != "" ) {
Type = VsqHandleType.Vibrato;
} else {
Type = VsqHandleType.Lyric;
}
// RateBPX, RateBPYの設定
if ( this.Type == VsqHandleType.Vibrato ) {
if ( RateBPNum > 0 ) {
RateBPX = new float[RateBPNum];
spl2 = tmpRateBPX.split( "," );
for ( int i = 0; i < RateBPNum; i++ ) {
RateBPX[i] = Float.parseFloat( spl2[i] );
}
RateBPY = new int[RateBPNum];
spl2 = tmpRateBPY.split( "," );
for ( int i = 0; i < RateBPNum; i++ ) {
RateBPY[i] = Integer.parseInt( spl2[i] );
}
} else {
RateBPX = null;
RateBPY = null;
}
// DepthBPX, DepthBPYの設定
if ( DepthBPNum > 0 ) {
DepthBPX = new float[DepthBPNum];
spl2 = tmpDepthBPX.split( "," );
for ( int i = 0; i < DepthBPNum; i++ ) {
DepthBPX[i] = Float.parseFloat( spl2[i] );
}
DepthBPY = new int[DepthBPNum];
spl2 = tmpDepthBPY.split( "," );
for ( int i = 0; i < DepthBPNum; i++ ) {
DepthBPY[i] = Integer.parseInt( spl2[i] );
}
} else {
DepthBPX = null;
DepthBPY = null;
}
}
}
/// <summary>
/// ハンドル指定子例えば"h#0123"という文字列からハンドル番号を取得します
/// </summary>
/// <param name="_String">ハンドル指定子</param>
/// <returns>ハンドル番号</returns>
public static int HandleIndexFromString( String _String ) {
String[] spl = _String.split( "#" );
return Integer.parseInt( spl[1] );
}
/// <summary>
/// インスタンスをテキストファイルに出力します
/// </summary>
/// <param name="sw">出力先</param>
public void Print( java.io.BufferedWriter sw ) throws IOException {
String result = this.toString();
sw.write( result + "\n" );
}
/// <summary>
/// インスタンスをコンソール画面に出力します
/// </summary>
private void Print() {
String result = this.toString();
System.out.println( result );
}
/// <summary>
/// インスタンスを文字列に変換します
/// </summary>
/// <param name="encode">2バイト文字をエンコードするか否かを指定するフラグ</param>
/// <returns>インスタンスを変換した文字列</returns>
public String toString( boolean encode ) {
String result = "";
result += "[h#" + (new DecimalFormat( "0000" )).format( Index ) + "]";
switch ( Type ) {
case Lyric:
result += "\nL0=" + L0.toString( encode );
break;
case Vibrato:
DecimalFormat df = new DecimalFormat( "0.000000" );
result += "\nIconID=" + IconID + "\n";
result += "IDS=" + IDS + "\n";
result += "Original=" + Original + "\n";
result += "Caption=" + Caption + "\n";
result += "Length=" + Length + "\n";
result += "StartDepth=" + StartDepth + "\n";
result += "DepthBPNum=" + DepthBPNum + "\n";
if ( DepthBPNum > 0 ) {
result += "DepthBPX=" + df.format( DepthBPX[0] );
for ( int i = 1; i < DepthBPNum; i++ ) {
result += "," + df.format( DepthBPX[i] );
}
result += "\n" + "DepthBPY=" + DepthBPY[0];
for ( int i = 1; i < DepthBPNum; i++ ) {
result += "," + DepthBPY[i];
}
result += "\n";
}
result += "StartRate=" + StartRate + "\n";
result += "RateBPNum=" + RateBPNum;
if ( RateBPNum > 0 ) {
result += "\n" + "RateBPX=" + df.format( RateBPX[0] );
for ( int i = 1; i < RateBPNum; i++ ) {
result += "," + df.format( RateBPX[i] );
}
result += "\n" + "RateBPY=" + RateBPY[0];
for ( int i = 1; i < RateBPNum; i++ ) {
result += "," + RateBPY[i];
}
}
break;
case Singer:
result += "\n" + "IconID=" + IconID + "\n";
result += "IDS=" + IDS + "\n";
result += "Original=" + Original + "\n";
result += "Caption=" + Caption + "\n";
result += "Length=" + Length + "\n";
result += "Language=" + Language + "\n";
result += "Program=" + Program;
break;
default:
break;
}
return result;
}
}

View File

@ -1,24 +0,0 @@
/*
* VibratoHandleType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public enum VsqHandleType {
Lyric,
Vibrato,
Singer
}

View File

@ -1,209 +0,0 @@
/*
* VsqID.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.text.*;
/// <summary>
/// メタテキストに埋め込まれるIDを表すクラス
/// </summary>
public class VsqID implements Cloneable {
public int value;
public VsqIDType type;
public int IconHandle_index;
public IconHandle IconHandle;
public int Length;
public int Note;
public int Dynamics;
public int PMBendDepth;
public int PMBendLength;
public int PMbPortamentoUse;
public int DEMdecGainRate;
public int DEMaccent;
public int LyricHandle_index;
public LyricHandle LyricHandle;
public int VibratoHandle_index;
public VibratoHandle VibratoHandle;
public int VibratoDelay;
public static VsqID EOS = new VsqID( -1 );
/// <summary>
/// このインスタンスの簡易コピーを取得します
/// </summary>
/// <returns>このインスタンスの簡易コピー</returns>
public Object clone() {
VsqID result = new VsqID( this.value );
result.type = this.type;
if ( this.IconHandle != null ) {
result.IconHandle = (IconHandle)this.IconHandle.clone();
}
result.Length = this.Length;
result.Note = this.Note;
result.Dynamics = this.Dynamics;
result.PMBendDepth = this.PMBendDepth;
result.PMBendLength = this.PMBendLength;
result.PMbPortamentoUse = this.PMbPortamentoUse;
result.DEMdecGainRate = this.DEMdecGainRate;
result.DEMaccent = this.DEMaccent;
if ( this.LyricHandle != null ) {
result.LyricHandle = (LyricHandle)this.LyricHandle.clone();
}
if ( this.VibratoHandle != null ) {
result.VibratoHandle = (VibratoHandle)this.VibratoHandle.clone();
}
result.VibratoDelay = this.VibratoDelay;
return result;
}
/// <summary>
/// IDの番号ID#********を指定したコンストラクタ
/// </summary>
/// <param name="a_value">IDの番号</param>
public VsqID( int a_value ) {
value = a_value;
}
/// <summary>
/// テキストファイルからのコンストラクタ
/// </summary>
/// <param name="sr">読み込み対象</param>
/// <param name="value"></param>
/// <param name="last_line">読み込んだ最後の行が返されます</param>
public VsqID( TextMemoryStream sr, int value, TextResult last_line ) {
String[] spl;
this.value = value;
this.type = VsqIDType.Unknown;
this.IconHandle_index = -2;
this.LyricHandle_index = -1;
this.VibratoHandle_index = -1;
this.Length = 0;
this.Note = 0;
this.Dynamics = 0;
this.PMBendDepth = 0;
this.PMBendLength = 0;
this.PMbPortamentoUse = 0;
this.DEMdecGainRate = 0;
this.DEMaccent = 0;
//this.LyricHandle_index = -2;
//this.VibratoHandle_index = -2;
this.VibratoDelay = 0;
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "Type" ) ) {
if ( spl[1].equals( "Anote" ) ) {
type = VsqIDType.Anote;
} else if ( spl[1].equals( "Singer" ) ) {
type = VsqIDType.Singer;
} else {
type = VsqIDType.Unknown;
}
} else if ( spl[0].equals( "Length" ) ) {
this.Length = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "Note#" ) ) {
this.Note = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "Dynamics" ) ) {
this.Dynamics = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "PMBendDepth" ) ) {
this.PMBendDepth = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "PMBendLength" ) ) {
this.PMBendLength = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "DEMdecGainRate" ) ) {
this.DEMdecGainRate = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "DEMaccent" ) ) {
this.DEMaccent = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "LyricHandle" ) ) {
this.LyricHandle_index = VsqHandle.HandleIndexFromString( spl[1] );
} else if ( spl[0].equals( "IconHandle" ) ) {
this.IconHandle_index = VsqHandle.HandleIndexFromString( spl[1] );
} else if ( spl[0].equals( "VibratoHandle" ) ) {
this.VibratoHandle_index = VsqHandle.HandleIndexFromString( spl[1] );
} else if ( spl[0].equals( "VibratoDelay" ) ) {
this.VibratoDelay = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "PMbPortamentoUse" ) ) {
PMbPortamentoUse = Integer.parseInt( spl[1] );
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
}
public String toString() {
String ret = "{Type=" + type;
DecimalFormat df = new DecimalFormat( "0000" );
switch ( type ) {
case Anote:
ret += ", Length=" + Length;
ret += ", Note#=" + Note;
ret += ", Dynamics=" + Dynamics;
ret += ", PMBendDepth=" + PMBendDepth;
ret += ", PMBendLength=" + PMBendLength;
ret += ", PMbPortamentoUse=" + PMbPortamentoUse;
ret += ", DEMdecGainRate=" + DEMdecGainRate;
ret += ", DEMaccent=" + DEMaccent;
if ( LyricHandle != null ) {
ret += ", LyricHandle=h#" + df.format( LyricHandle_index );
}
if ( VibratoHandle != null ) {
ret += ", VibratoHandle=h#" + df.format( VibratoHandle_index );
ret += ", VibratoDelay=" + VibratoDelay;
}
break;
case Singer:
ret += ", IconHandle=h#" + df.format( IconHandle_index );
break;
}
ret += "}";
return ret;
}
/// <summary>
/// インスタンスをテキストファイルに出力します
/// </summary>
/// <param name="sw">出力先</param>
public void write( TextMemoryStream sw ) {
DecimalFormat df = new DecimalFormat( "0000" );
sw.writeLine( "[ID#" + df.format( value ) + "]" );
sw.writeLine( "Type=" + type );
switch ( type ) {
case Anote:
sw.writeLine( "Length=" + Length );
sw.writeLine( "Note#=" + Note );
sw.writeLine( "Dynamics=" + Dynamics );
sw.writeLine( "PMBendDepth=" + PMBendDepth );
sw.writeLine( "PMBendLength=" + PMBendLength );
sw.writeLine( "PMbPortamentoUse=" + PMbPortamentoUse );
sw.writeLine( "DEMdecGainRate=" + DEMdecGainRate );
sw.writeLine( "DEMaccent=" + DEMaccent );
if ( LyricHandle != null ) {
sw.writeLine( "LyricHandle=h#" + df.format( LyricHandle_index ) );
}
if ( VibratoHandle != null ) {
sw.writeLine( "VibratoHandle=h#" + df.format( VibratoHandle_index ) );
sw.writeLine( "VibratoDelay=" + VibratoDelay );
}
break;
case Singer:
sw.writeLine( "IconHandle=h#" + df.format( IconHandle_index ) );
break;
}
}
}

View File

@ -1,24 +0,0 @@
/*
* VsqIDType.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
public enum VsqIDType {
Singer,
Anote,
Unknown
}

View File

@ -1,69 +0,0 @@
/*
* VsqMaster.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.io.*;
/**
*
* @author kbinani
*/
public class VsqMaster implements Cloneable {
public int PreMeasure;
public Object clone() {
VsqMaster res = new VsqMaster( PreMeasure );
return res;
}
/**
* プリメジャー値を指定したコンストラクタ
*/
public VsqMaster( int pre_measure ) {
this.PreMeasure = pre_measure;
}
/**
* テキストファイルからのコンストラクタ
* @param sr 読み込み元
* @param last_line 最後に読み込んだ行が返されます
* @throws java.lang.Exception
*/
public VsqMaster( TextMemoryStream sr, TextResult last_line ) {
PreMeasure = 0;
String[] spl;
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "PreMeasure" ) ) {
this.PreMeasure = Integer.valueOf( spl[1] );
break;
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
}
/**
* インスタンスの内容をテキストファイルに出力します
* @param sw出力先
*/
public void write( TextMemoryStream sw ){
sw.writeLine( "[Master]" );
sw.writeLine( "PreMeasure=" + PreMeasure );
}
}

View File

@ -1,911 +0,0 @@
/*
* VsqMetaText.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
import java.text.*;
import java.awt.*;
/**
* vsqのメタテキストの中身を処理するためのクラス
* @author kbinani
*/
public class VsqMetaText implements Cloneable {
protected VsqCommon common;
protected VsqMaster master;
protected VsqMixer mixer;
//private List<VsqEvent> m_events;
private VsqEventList m_events;
//private List<VsqEvent> m_another_events;
/// <summary>
/// PITピッチベンドdefault=0
/// </summary>
private VsqBPList pitchBendBPList;
/// <summary>
/// PBSピッチベンドセンシティビティdfault=2
/// </summary>
private VsqBPList pitchBendSensBPList;
/// <summary>
/// DYNダイナミクスdefault=64
/// </summary>
private VsqBPList dynamicsBPList;
/// <summary>
/// BREブレシネスdefault=0
/// </summary>
private VsqBPList epRResidualBPList;
/// <summary>
/// BRIブライトネスdefault=64
/// </summary>
private VsqBPList epRESlopeBPList;
/// <summary>
/// CLEクリアネスdefault=0
/// </summary>
private VsqBPList epRESlopeDepthBPList;
private VsqBPList reso1FreqBPList;
private VsqBPList reso2FreqBPList;
private VsqBPList reso3FreqBPList;
private VsqBPList reso4FreqBPList;
private VsqBPList reso1BWBPList;
private VsqBPList reso2BWBPList;
private VsqBPList reso3BWBPList;
private VsqBPList reso4BWBPList;
private VsqBPList reso1AmpBPList;
private VsqBPList reso2AmpBPList;
private VsqBPList reso3AmpBPList;
private VsqBPList reso4AmpBPList;
/// <summary>
/// GENジェンダーファクターdefault=64
/// </summary>
private VsqBPList genderFactorBPList;
/// <summary>
/// PORポルタメントタイミングdefault=64
/// </summary>
private VsqBPList portamentoTimingBPList;
/// <summary>
/// OPEオープニングdefault=127
/// </summary>
private VsqBPList openingBPList;
public Object clone() {
VsqMetaText res = new VsqMetaText();
if ( common != null ) {
res.common = (VsqCommon)common.clone();
}
if ( master != null ) {
res.master = (VsqMaster)master.clone();
}
if ( mixer != null ) {
res.mixer = (VsqMixer)mixer.clone();
}
if ( m_events != null ) {
res.m_events = new VsqEventList();// List<VsqEvent>();
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
VsqEvent item = (VsqEvent)itr.next();
res.m_events.add( (VsqEvent)item.clone() );
}
}
/*if ( m_another_events != null ) {
res.m_another_events = new List<VsqEvent>();
foreach ( VsqEvent item in m_another_events ) {
res.m_another_events.Add( (VsqEvent)item.clone() );
}
}*/
if ( pitchBendBPList != null ) {
res.pitchBendBPList = (VsqBPList)pitchBendBPList.clone();
}
if ( pitchBendSensBPList != null ) {
res.pitchBendSensBPList = (VsqBPList)pitchBendSensBPList.clone();
}
if ( dynamicsBPList != null ) {
res.dynamicsBPList = (VsqBPList)dynamicsBPList.clone();
}
if ( epRResidualBPList != null ) {
res.epRResidualBPList = (VsqBPList)epRResidualBPList.clone();
}
if ( epRESlopeBPList != null ) {
res.epRESlopeBPList = (VsqBPList)epRESlopeBPList.clone();
}
if ( epRESlopeDepthBPList != null ) {
res.epRESlopeDepthBPList = (VsqBPList)epRESlopeDepthBPList.clone();
}
if ( reso1FreqBPList != null ) {
res.reso1FreqBPList = (VsqBPList)reso1FreqBPList.clone();
}
if ( reso2FreqBPList != null ) {
res.reso2FreqBPList = (VsqBPList)reso2FreqBPList.clone();
}
if ( reso3FreqBPList != null ) {
res.reso3FreqBPList = (VsqBPList)reso3FreqBPList.clone();
}
if ( reso4FreqBPList != null ) {
res.reso4FreqBPList = (VsqBPList)reso4FreqBPList.clone();
}
if ( reso1BWBPList != null ) {
res.reso1BWBPList = (VsqBPList)reso1BWBPList.clone();
}
if ( reso2BWBPList != null ) {
res.reso2BWBPList = (VsqBPList)reso2BWBPList.clone();
}
if ( reso3BWBPList != null ) {
res.reso3BWBPList = (VsqBPList)reso3BWBPList.clone();
}
if ( reso4BWBPList != null ) {
res.reso4BWBPList = (VsqBPList)reso4BWBPList.clone();
}
if ( reso1AmpBPList != null ) {
res.reso1AmpBPList = (VsqBPList)reso1AmpBPList.clone();
}
if ( reso2AmpBPList != null ) {
res.reso2AmpBPList = (VsqBPList)reso2AmpBPList.clone();
}
if ( reso3AmpBPList != null ) {
res.reso3AmpBPList = (VsqBPList)reso3AmpBPList.clone();
}
if ( reso4AmpBPList != null ) {
res.reso4AmpBPList = (VsqBPList)reso4AmpBPList.clone();
}
if ( genderFactorBPList != null ) {
res.genderFactorBPList = (VsqBPList)genderFactorBPList.clone();
}
if ( portamentoTimingBPList != null ) {
res.portamentoTimingBPList = (VsqBPList)portamentoTimingBPList.clone();
}
if ( openingBPList != null ) {
res.openingBPList = (VsqBPList)openingBPList.clone();
}
return res;
}
// public List<VsqEvent> Events {
public VsqEventList getEventList() {
return m_events;
}
/*public List<VsqEvent> AnotherEvents {
get {
return m_another_events;
}
}*/
public VsqBPList getVsqBPList( VsqCurveType type ) {
switch ( type ) {
case BRE:
return this.epRResidualBPList;
case BRI:
return this.epRESlopeBPList;
case CLE:
return this.epRESlopeDepthBPList;
case DYN:
return this.dynamicsBPList;
case GEN:
return this.genderFactorBPList;
case OPE:
return this.openingBPList;
case PBS:
return this.pitchBendSensBPList;
case PIT:
return this.pitchBendBPList;
case POR:
return this.portamentoTimingBPList;
default:
return null;
}
}
public void setVsqBPList( VsqCurveType type, VsqBPList value ) {
switch ( type ) {
case BRE:
this.epRResidualBPList = value;
break;
case BRI:
this.epRESlopeBPList = value;
break;
case CLE:
this.epRESlopeDepthBPList = value;
break;
case DYN:
this.dynamicsBPList = value;
break;
case GEN:
this.genderFactorBPList = value;
break;
case OPE:
this.openingBPList = value;
break;
case PBS:
this.pitchBendSensBPList = value;
break;
case PIT:
this.pitchBendBPList = value;
break;
case POR:
this.portamentoTimingBPList = value;
break;
}
}
/*// <summary>
/// LyricEvents用に使用できる空きID番号を取得しますnext=0の時は次に利用可能なIDnext=1はnext=0として得られるIDを使用した後利用可能なIDetc..
/// </summary>
/// <returns></returns>
private int GetNextId_( int next ) {
int index = -1;
int count = m_events.Count;
boolean[] list = new boolean[count];
for ( int i = 0; i < count; i++ ) {
list[i] = false;
}
for ( int i = 0; i < count; i++ ) {
if ( 0 <= m_events[i].InternalID && m_events[i].InternalID < count ) {
list[i] = true;
}
}
int j = -1;
for ( int i = 0; i < count; i++ ) {
if ( !list[i] ) {
j++;
if ( j == next ) {
return i;
}
}
}
return count + next + 1;
}
private int GetNextId( int next ) {
int index = -1;
List<int> current = new List<int>();
for ( int i = 0; i < m_events.Count; i++ ) {
current.Add( m_events[i].InternalID );
}
int nfound = 0;
while ( true ) {
index++;
boolean found = false;
for ( int i = 0; i < current.Count; i++ ) {
if ( index == current[i] ) {
found = true;
break;
}
}
if ( !found ) {
nfound++;
if ( nfound == next + 1 ) {
return index;
} else {
current.Add( index );
}
}
}
}*/
/*// <summary>
/// AnotherEvents用に使用できる次の空きID番号を取得します
/// </summary>
/// <returns></returns>
public int GetNextIdForAnotherEvent( int next ) {
int index = -1;
List<int> current = new List<int>();
for ( int i = 0; i < m_another_events.Count; i++ ) {
current.Add( m_another_events[i].InternalID );
}
int nfound = 0;
while ( true ) {
index++;
boolean found = false;
for ( int i = 0; i < current.Count; i++ ) {
if ( index == current[i] ) {
found = true;
break;
}
}
if ( !found ) {
nfound++;
if ( nfound == next + 1 ) {
return index;
} else {
current.Add( index );
}
}
}
}*/
/// <summary>
/// Editor画面上で上からindex番目のカーブを表すBPListを求めます
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
/*public VsqBPList GetCurve(
int index ) {
switch ( index ) {
case 1:
return DYN;
case 2:
return BRE;
case 3:
return BRI;
case 4:
return CLE;
case 5:
return OPE;
case 6:
return GEN;
case 7:
return POR;
case 8:
return PIT;
case 9:
return PBS;
default:
return null;
}
}*/
/// <summary>
/// Editor画面上で上からindex番目のカーブの名前を調べます
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public static String getCurveName( int index ) {
switch ( index ) {
case 0:
return "VEL";
case 1:
return "DYN";
case 2:
return "BRE";
case 3:
return "BRI";
case 4:
return "CLE";
case 5:
return "OPE";
case 6:
return "GEN";
case 7:
return "POR";
case 8:
return "PIT";
case 9:
return "PBS";
default:
return "";
}
}
/// <summary>
/// Singerプロパティに指定されている
/// </summary>
public String getSinger() {
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
VsqEvent item = (VsqEvent)itr.next();
if ( item.ID.type == VsqIDType.Singer ) {
return item.ID.IconHandle.IDS;
}
}
return "";
}
public void setSinger( String value ) {
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
VsqEvent item = (VsqEvent)itr.next();
if ( item.ID.type == VsqIDType.Singer ) {
item.ID.IconHandle.IDS = value;
break;
}
}
}
/// <summary>
/// EOSイベントが記録されているクロックを取得します
/// </summary>
/// <returns></returns>
public int getIndexOfEos() {
int result;
if ( m_events.size() > 0 ) {
int ilast = m_events.size() - 1;
result = m_events.get( ilast ).Clock;
} else {
result = -1;
}
return result;
}
/**
* このインスタンスからIDとHandleのリストを構築します
*
*@param id
*@param handle
**/
private void buildIdHandleList( Vector<VsqID> id, Vector<VsqHandle> handle ) {
id = new Vector<VsqID>();
handle = new Vector<VsqHandle>();
int current_id = -1;
int current_handle = -1;
Vector<VsqEvent> events = new Vector<VsqEvent>();
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
VsqEvent item = (VsqEvent)itr.next();
events.add( item );
}
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;
// IconHandle
if ( item.ID.IconHandle != null ) {
current_handle++;
VsqHandle handle_item = (VsqHandle)item.ID.IconHandle.clone();
handle_item.Index = current_handle;
handle.add( handle_item );
id_item.IconHandle_index = current_handle;
}
// LyricHandle
if ( item.ID.LyricHandle != null ) {
current_handle++;
VsqHandle handle_item = (VsqHandle)item.ID.LyricHandle.clone();
handle_item.Index = current_handle;
handle.add( handle_item );
id_item.LyricHandle_index = current_handle;
}
// VibratoHandle
if ( item.ID.VibratoHandle != null ) {
current_handle++;
VsqHandle handle_item = (VsqHandle)item.ID.VibratoHandle.clone();
handle_item.Index = current_handle;
handle.add( handle_item );
id_item.VibratoHandle_index = current_handle;
}
id.add( id_item );
}
}
/// <summary>
/// このインスタンスの内容を指定されたファイルに出力します
/// </summary>
/// <param name="sw"></param>
/// <param name="encode"></param>
public void print( TextMemoryStream sw, boolean encode, long eos, int start ) {
//using ( StreamWriter sw = new StreamWriter( fpath ) ) {
if ( common != null ) {
common.write( sw );
}
if ( master != null ) {
master.write( sw );
}
if ( mixer != null ) {
mixer.write( sw );
}
Vector<VsqID> id = null;
Vector<VsqHandle> handle = null;
buildIdHandleList( id, handle );
writeEventList( sw, eos );
int i;
for ( i = 0; i < id.size(); i++ ) {
id.get( i ).write( sw );
}
for ( i = 0; i < handle.size(); i++ ) {
handle.get( i ).write( sw, encode );
}
if ( pitchBendBPList.size() > 0 ) {
pitchBendBPList.print( sw, start, "[PitchBendBPList]" );
}
if ( pitchBendSensBPList.size() > 0 ) {
pitchBendSensBPList.print( sw, start, "[PitchBendSensBPList]" );
}
if ( dynamicsBPList.size() > 0 ) {
dynamicsBPList.print( sw, start, "[DynamicsBPList]" );
}
if ( epRResidualBPList.size() > 0 ) {
epRResidualBPList.print( sw, start, "[EpRResidualBPList]" );
}
if ( epRESlopeBPList.size() > 0 ) {
epRESlopeBPList.print( sw, start, "[EpRESlopeBPList]" );
}
if ( epRESlopeDepthBPList.size() > 0 ) {
epRESlopeDepthBPList.print( sw, start, "[EpRESlopeDepthBPList]" );
}
if ( reso1FreqBPList.size() > 0 ) {
reso1FreqBPList.print( sw, start, "[Reso1FreqBPList]" );
}
if ( reso2FreqBPList.size() > 0 ) {
reso2FreqBPList.print( sw, start, "[Reso2FreqBPList]" );
}
if ( reso3FreqBPList.size() > 0 ) {
reso3FreqBPList.print( sw, start, "[Reso3FreqBPList]" );
}
if ( reso4FreqBPList.size() > 0 ) {
reso4FreqBPList.print( sw, start, "[Reso4FreqBPList]" );
}
if ( reso1BWBPList.size() > 0 ) {
reso1BWBPList.print( sw, start, "[Reso1BWBPList]" );
}
if ( reso2BWBPList.size() > 0 ) {
reso2BWBPList.print( sw, start, "[Reso2BWBPList]" );
}
if ( reso3BWBPList.size() > 0 ) {
reso3BWBPList.print( sw, start, "[Reso3BWBPList]" );
}
if ( reso4BWBPList.size() > 0 ) {
reso4BWBPList.print( sw, start, "[Reso4BWBPList]" );
}
if ( reso1AmpBPList.size() > 0 ) {
reso1AmpBPList.print( sw, start, "[Reso1AmpBPList]" );
}
if ( reso2AmpBPList.size() > 0 ) {
reso2AmpBPList.print( sw, start, "[Reso2AmpBPList]" );
}
if ( reso3AmpBPList.size() > 0 ) {
reso3AmpBPList.print( sw, start, "[Reso3AmpBPList]" );
}
if ( reso4AmpBPList.size() > 0 ) {
reso4AmpBPList.print( sw, start, "[Reso4AmpBPList]" );
}
if ( genderFactorBPList.size() > 0 ) {
genderFactorBPList.print( sw, start, "[GenderFactorBPList]" );
}
if ( portamentoTimingBPList.size() > 0 ) {
portamentoTimingBPList.print( sw, start, "[PortamentoTimingBPList]" );
}
if ( openingBPList.size() > 0 ) {
openingBPList.print( sw, start, "[OpeningBPList]" );
}
//}
}
private void writeEventList( TextMemoryStream sw, long eos ) {
sw.writeLine( "[EventList]" );
Vector<VsqEvent> temp = new Vector<VsqEvent>();
/*foreach ( VsqEvent item in m_another_events ) {
temp.Add( item );
}*/
for ( Iterator itr = m_events.iterator(); itr.hasNext();) {
temp.add( (VsqEvent)itr.next() );
}
Collections.sort( temp );
int i = 0;
DecimalFormat df = new DecimalFormat( "0000" );
while ( i < temp.size() ) {
VsqEvent item = temp.get( i );
if ( !item.ID.equals( VsqID.EOS ) ) {
String ids = "ID#" + df.format( i );
int clock = temp.get( i ).Clock;
while ( i + 1 < temp.size() && clock == temp.get( i + 1 ).Clock ) {
i++;
ids += ",ID#" + df.format( i );
}
sw.writeLine( clock + "=" + ids );
}
i++;
}
sw.writeLine( eos + "=EOS" );
}
/// <summary>
/// 何も無いVsqMetaTextを構築するこれはMaster Track用のMetaTextとしてのみ使用されるべき
/// </summary>
public VsqMetaText() {
}
/// <summary>
/// 最初のトラック以外の一般のメタテキストを構築(Masterが作られない)
/// </summary>
public VsqMetaText( String name, String singer ) {
this( name, 0, singer, false );
}
/// <summary>
/// 最初のトラックのメタテキストを構築(Masterが作られる)
/// </summary>
/// <param name="pre_measure"></param>
public VsqMetaText( String name, String singer, int pre_measure ) {
this( name, pre_measure, singer, true );
}
private VsqMetaText( String name, int pre_measure, String singer, boolean is_first_track ) {
common = new VsqCommon( name, new Color( 179, 181, 123 ), 1, 1 );
pitchBendBPList = new VsqBPList( 0, -8192, 8192 );
pitchBendBPList.add( 0, pitchBendBPList.getDefault() );
pitchBendSensBPList = new VsqBPList( 2, 0, 24 );
pitchBendSensBPList.add( 0, pitchBendSensBPList.getDefault() );
dynamicsBPList = new VsqBPList( 64, 0, 127 );
dynamicsBPList.add( 0, dynamicsBPList.getDefault() );
epRResidualBPList = new VsqBPList( 0, 0, 127 );
epRResidualBPList.add( 0, epRResidualBPList.getDefault() );
epRESlopeBPList = new VsqBPList( 64, 0, 127 );
epRESlopeBPList.add( 0, epRESlopeBPList.getDefault() );
epRESlopeDepthBPList = new VsqBPList( 0, 0, 127 );
epRESlopeDepthBPList.add( 0, epRESlopeDepthBPList.getDefault() );
reso1FreqBPList = new VsqBPList( 255, 0, 255 );
reso1FreqBPList.add( 0, reso1FreqBPList.getDefault() );
reso2FreqBPList = new VsqBPList( 255, 0, 255 );
reso2FreqBPList.add( 0, reso2FreqBPList.getDefault() );
reso3FreqBPList = new VsqBPList( 255, 0, 255 );
reso3FreqBPList.add( 0, reso3FreqBPList.getDefault() );
reso4FreqBPList = new VsqBPList( 255, 0, 255 );
reso4FreqBPList.add( 0, reso4FreqBPList.getDefault() );
reso1BWBPList = new VsqBPList( 255, 0, 255 );
reso1BWBPList.add( 0, reso1BWBPList.getDefault() );
reso2BWBPList = new VsqBPList( 255, 0, 255 );
reso2BWBPList.add( 0, reso2BWBPList.getDefault() );
reso3BWBPList = new VsqBPList( 255, 0, 255 );
reso3BWBPList.add( 0, reso3BWBPList.getDefault() );
reso4BWBPList = new VsqBPList( 255, 0, 255 );
reso4BWBPList.add( 0, reso4BWBPList.getDefault() );
reso1AmpBPList = new VsqBPList( 255, 0, 255 );
reso1AmpBPList.add( 0, reso1AmpBPList.getDefault() );
reso2AmpBPList = new VsqBPList( 255, 0, 255 );
reso2AmpBPList.add( 0, reso2AmpBPList.getDefault() );
reso3AmpBPList = new VsqBPList( 255, 0, 255 );
reso3AmpBPList.add( 0, reso3AmpBPList.getDefault() );
reso4AmpBPList = new VsqBPList( 255, 0, 255 );
reso4AmpBPList.add( 0, reso4AmpBPList.getDefault() );
genderFactorBPList = new VsqBPList( 64, 0, 127 );
genderFactorBPList.add( 0, genderFactorBPList.getDefault() );
portamentoTimingBPList = new VsqBPList( 64, 0, 127 );
portamentoTimingBPList.add( 0, portamentoTimingBPList.getDefault() );
openingBPList = new VsqBPList( 127, 0, 127 );
openingBPList.add( 0, openingBPList.getDefault() );
if ( is_first_track ) {
master = new VsqMaster( pre_measure );
} else {
master = null;
}
m_events = new VsqEventList();
//m_another_events = new List<VsqEvent>();
VsqID id = new VsqID( 0 );
id.type = VsqIDType.Singer;
id.IconHandle = new IconHandle();
id.IconHandle.Type = VsqHandleType.Singer;
id.IconHandle.IconID = "$07010000";
id.IconHandle.IDS = singer;
id.IconHandle.Original = 0;
id.IconHandle.Caption = "";
id.IconHandle.Length = 1;
id.IconHandle.Language = 0;
id.IconHandle.Program = 0;
m_events.add( new VsqEvent( 0, id ) );
}
public VsqMetaText( TextMemoryStream sr ) {
Vector<KeyValuePair<Integer, Integer>> t_event_list = new Vector<KeyValuePair<Integer, Integer>>();
//SortedDictionary<int, int> t_event_list = new SortedDictionary<int, int>();
TreeMap<Integer, VsqID> __id = new TreeMap<Integer, VsqID>();
TreeMap<Integer, VsqHandle> __handle = new TreeMap<Integer, VsqHandle>();
pitchBendBPList = new VsqBPList( 0, -8192, 8192 );
pitchBendSensBPList = new VsqBPList( 2, 0, 24 );
dynamicsBPList = new VsqBPList( 64, 0, 127 );
epRResidualBPList = new VsqBPList( 0, 0, 127 );
epRESlopeBPList = new VsqBPList( 64, 0, 127 );
epRESlopeDepthBPList = new VsqBPList( 0, 0, 127 );
reso1FreqBPList = new VsqBPList( 255, 0, 255 );
reso2FreqBPList = new VsqBPList( 255, 0, 255 );
reso3FreqBPList = new VsqBPList( 255, 0, 255 );
reso4FreqBPList = new VsqBPList( 255, 0, 255 );
reso1BWBPList = new VsqBPList( 255, 0, 255 );
reso2BWBPList = new VsqBPList( 255, 0, 255 );
reso3BWBPList = new VsqBPList( 255, 0, 255 );
reso4BWBPList = new VsqBPList( 255, 0, 255 );
reso1AmpBPList = new VsqBPList( 255, 0, 255 );
reso2AmpBPList = new VsqBPList( 255, 0, 255 );
reso3AmpBPList = new VsqBPList( 255, 0, 255 );
reso4AmpBPList = new VsqBPList( 255, 0, 255 );
genderFactorBPList = new VsqBPList( 64, 0, 127 );
portamentoTimingBPList = new VsqBPList( 64, 0, 127 );
openingBPList = new VsqBPList( 127, 0, 127 );
TextResult last_line = new TextResult( "" );
last_line.set( sr.readLine() );
while ( true ) {
if ( last_line.get().length() == 0 ) {
break;
}
if ( last_line.get().equals( "[Common]" ) ) {
common = new VsqCommon( sr, last_line );
} else if ( last_line.get().equals( "[Master]" ) ) {
master = new VsqMaster( sr, last_line );
} else if ( last_line.get().equals( "[Mixer]" ) ) {
mixer = new VsqMixer( sr, last_line );
} else if ( last_line.get().equals( "[EventList]" ) ) {
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
String[] spl2 = last_line.get().split( "=" );
int clock = Integer.parseInt( spl2[0] );
int id_number = -1;
if ( spl2[1] != "EOS" ) {
String[] ids = spl2[1].split( "," );
for ( int i = 0; i < ids.length; i++ ) {
String[] spl3 = ids[i].split( "#" );
id_number = Integer.parseInt( spl3[1] );
t_event_list.add( new KeyValuePair<Integer, Integer>( clock, id_number ) );
}
} else {
t_event_list.add( new KeyValuePair<Integer, Integer>( clock, -1 ) );
}
if ( sr.peek() < 0 ) {
break;
} else {
last_line.set( sr.readLine() );
}
}
} else if ( last_line.get().equals( "[PitchBendBPList]" ) ) {
last_line.set( pitchBendBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[PitchBendSensBPList]" ) ) {
last_line.set( pitchBendSensBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[DynamicsBPList]" ) ) {
last_line.set( dynamicsBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[EpRResidualBPList]" ) ) {
last_line.set( epRResidualBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[EpRESlopeBPList]" ) ) {
last_line.set( epRESlopeBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[EpRESlopeDepthBPList]" ) ) {
last_line.set( epRESlopeDepthBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso1FreqBPList]" ) ) {
last_line.set( reso1FreqBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso2FreqBPList]" ) ) {
last_line.set( reso2FreqBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso3FreqBPList]" ) ) {
last_line.set( reso3FreqBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso4FreqBPList]" ) ) {
last_line.set( reso4FreqBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso1BWBPList]" ) ) {
last_line.set( reso1BWBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso2BWBPList]" ) ) {
last_line.set( reso2BWBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso3BWBPList]" ) ) {
last_line.set( reso3BWBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso4BWBPList]" ) ) {
last_line.set( reso4BWBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso1AmpBPList]" ) ) {
last_line.set( reso1AmpBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso2AmpBPList]" ) ) {
last_line.set( reso2AmpBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso3AmpBPList]" ) ) {
last_line.set( reso3AmpBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[Reso4AmpBPList]" ) ) {
last_line.set( reso4AmpBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[GenderFactorBPList]" ) ) {
last_line.set( genderFactorBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[PortamentoTimingBPList]" ) ) {
last_line.set( portamentoTimingBPList.readFrom( sr ) );
} else if ( last_line.get().equals( "[OpeningBPList]" ) ) {
last_line.set( openingBPList.readFrom( sr ) );
} else {
String buffer = last_line.get();
buffer =
buffer.replace( "[", "" );
buffer =
buffer.replace( "]", "" );
String[] spl = buffer.split( "#" );
int index = Integer.parseInt( spl[1] );
if ( last_line.get().startsWith( "[ID#" ) ) {
__id.put( index, new VsqID( sr, index, last_line ) );
} else if ( last_line.get().startsWith( "[h#" ) ) {
__handle.put( index, new VsqHandle( sr, index, last_line ) );
}
}
if ( sr.peek() < 0 ) {
break;
}
}
// まずhandleをidに埋め込み
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 ).ConvertToIconHandle();
}
if ( __handle.containsKey( __id.get( i ).LyricHandle_index ) ) {
__id.get( i ).LyricHandle = __handle.get( __id.get( i ).LyricHandle_index ).ConvertToLyricHandle();
}
if ( __handle.containsKey( __id.get( i ).VibratoHandle_index ) ) {
__id.get( i ).VibratoHandle = __handle.get( __id.get( i ).VibratoHandle_index ).ConvertToVibratoHandle();
}
}
// idをeventListに埋め込み
m_events = new VsqEventList();// List<VsqEvent>();
//m_another_events = new List<VsqEvent>();
for ( int i = 0; i < t_event_list.size(); i++ ) {
KeyValuePair<Integer, Integer> item = t_event_list.get( i );
int clock = item.Key;
int id_number = item.Value;
if ( __id.containsKey( id_number ) ) {
//if ( __id[id_number].type == VsqIDType.Anote ) {
m_events.add( new VsqEvent( clock, (VsqID)__id.get( id_number ).clone() ) );
//} else {
// m_another_events.Add( new VsqEvent( clock, (VsqID)__id[id_number].clone(), GetNextIdForAnotherEvent( 0 ) ) );
//}
}
}
}
}

View File

@ -1,219 +0,0 @@
/*
* VsqMixer.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
/// vsqファイルのメタテキストの[Mixer]セクションに記録される内容を取り扱う
/// </summary>
public class VsqMixer implements Cloneable {
//private int MasterFeder;
public int MasterFeder;
//private int MasterPanpot;
public int MasterPanpot;
//private int MasterMute;
public int MasterMute;
//private int OutputMode;
public int OutputMode;
//public int Tracks;
/// <summary>
/// vsqファイルの各トラックのfader, panpot, muteおよびoutputmode値を保持します
/// </summary>
public Vector<VsqMixerEntry> Slave = new Vector<VsqMixerEntry>();
/// <summary>
/// このインスタンスのSlave要素に保持されるアイテムの個数vsqファイルの"トラック数 - 1"に等しい
/// </summary>
public int getTracks() {
return Slave.size();
}
/*public property Vector<VsqMixerEntry> Slave {
get {
return m_slave;
}
set {
m_slave = value;
}
};*/
/*public property int MasterFeder {
get {
return MasterFeder;
}
set {
MasterFeder = value;
}
};*/
/*public property int MasterPanpot {
get {
return MasterPanpot;
}
set {
MasterPanpot = value;
}
};*/
/*public property int MasterMute {
get {
return MasterMute;
}
set {
MasterMute = value;
}
};*/
/*public property int OutputMode {
get {
return MasterMute;
}
set {
MasterMute = value;
}
};*/
public Object clone() {
VsqMixer res = new VsqMixer( MasterFeder, MasterPanpot, MasterMute, OutputMode );
res.Slave = new Vector<VsqMixerEntry>();
//res.Tracks = Tracks;
for ( int i = 0; i < Slave.size(); i++ ) {
VsqMixerEntry item = Slave.get( i );
res.Slave.add( (VsqMixerEntry) item.clone() );
}
return res;
}
/// <summary>
/// 各パラメータを指定したコンストラクタ
/// </summary>
/// <param name="master_fader">MasterFader値</param>
/// <param name="master_panpot">MasterPanpot値</param>
/// <param name="master_mute">MasterMute値</param>
/// <param name="output_mode">OutputMode値</param>
public VsqMixer( int master_fader, int master_panpot, int master_mute, int output_mode ) {
this.MasterFeder = master_fader;
this.MasterMute = master_mute;
this.MasterPanpot = master_panpot;
this.OutputMode = output_mode;
Slave = new Vector<VsqMixerEntry>();
}
/// <summary>
/// テキストファイルからのコンストラクタ
/// </summary>
/// <param name="sr">読み込み対象</param>
/// <param name="last_line">最後に読み込んだ行が返されます</param>
public VsqMixer( TextMemoryStream sr, TextResult last_line ) {
MasterFeder = 0;
MasterPanpot = 0;
MasterMute = 0;
OutputMode = 0;
//Tracks = 1;
int tracks = 0;
String[] spl;
String buffer = "";
last_line.set( sr.readLine() );
while ( !last_line.get().startsWith( "[" ) ) {
spl = last_line.get().split( "=" );
if ( spl[0].equals( "MasterFeder" ) ) {
MasterFeder = Integer.parseInt( spl[1] );
} else if ( spl[0].equals( "MasterPanpot" ) ) {
MasterPanpot = Integer.parseInt(
spl[1] );
} else if ( spl[0].equals( "MasterMute" ) ) {
MasterMute = Integer.parseInt(
spl[1] );
} else if ( spl[0].equals( "OutputMode" ) ) {
OutputMode = Integer.parseInt(
spl[1] );
} else if ( spl[0].equals( "Tracks" ) ) {
tracks = Integer.parseInt(
spl[1] );
} else {
if ( spl[0].startsWith( "Feder" ) ||
spl[0].startsWith( "Panpot" ) ||
spl[0].startsWith( "Mute" ) ||
spl[0].startsWith( "Solo" ) ) {
buffer += spl[0] + "=" + spl[1] + "\n";
}
}
if ( sr.peek() < 0 ) {
break;
}
last_line.set( sr.readLine() );
}
Slave = new Vector<VsqMixerEntry>();
for ( int i = 0; i < tracks; i++ ) {
Slave.add( new VsqMixerEntry( 0, 0, 0, 0 ) );
}
spl = buffer.split( "\n" );
String[] spl2;
for ( int i = 0; i < spl.length; i++ ) {
String ind = "";
int index;
spl2 = spl[i].split( "=" );
if ( spl2[0].startsWith( "Feder" ) ) {
ind = spl2[0].replace( "Feder", "" );
index = Integer.parseInt(
ind );
Slave.get( index ).Feder = Integer.parseInt(
spl2[1] );
} else if ( spl2[0].startsWith( "Panpot" ) ) {
ind = spl2[0].replace( "Panpot", "" );
index = Integer.parseInt(
ind );
Slave.get( index ).Panpot = Integer.parseInt(
spl2[1] );
} else if ( spl2[0].startsWith( "Mute" ) ) {
ind = spl2[0].replace( "Mute", "" );
index = Integer.parseInt(
ind );
Slave.get( index ).Mute = Integer.parseInt(
spl2[1] );
} else if ( spl2[0].startsWith( "Solo" ) ) {
ind = spl2[0].replace( "Solo", "" );
index = Integer.parseInt(
ind );
Slave.get( index ).Solo = Integer.parseInt(
spl2[1] );
}
}
}
/// <summary>
/// このインスタンスをテキストファイルに出力します
/// </summary>
/// <param name="sw">出力対象</param>
public void write( TextMemoryStream sw ) {
sw.writeLine( "[Mixer]" );
sw.writeLine( "MasterFeder=" + MasterFeder );
sw.writeLine( "MasterPanpot=" + MasterPanpot );
sw.writeLine( "MasterMute=" + MasterMute );
sw.writeLine( "OutputMode=" + OutputMode );
sw.writeLine( "Tracks=" + getTracks() );
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 );
}
}
}

View File

@ -1,40 +0,0 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jp.sourceforge.lipsync.vsq;
/**
*
* @author kbinani
*/
/// <summary>
/// VsqMixerのSlave要素に格納される各エントリ
/// </summary>
public class VsqMixerEntry implements Cloneable {
public int Feder;
public int Panpot;
public int Mute;
public int Solo;
public Object clone() {
VsqMixerEntry res = new VsqMixerEntry( Feder, Panpot, Mute, Solo );
return res;
}
/// <summary>
/// 各パラメータを指定したコンストラクタ
/// </summary>
/// <param name="feder">Feder値</param>
/// <param name="panpot">Panpot値</param>
/// <param name="mute">Mute値</param>
/// <param name="solo">Solo値</param>
public VsqMixerEntry( int feder, int panpot, int mute, int solo ) {
this.Feder = feder;
this.Panpot = panpot;
this.Mute = mute;
this.Solo = solo;
}
}

View File

@ -1,239 +0,0 @@
/*
* VsqMixer.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/// <summary>
/// 音階を表現するためのクラス
/// </summary>
public class VsqNote {
int _note;
private static final boolean[] _KEY_TYPE = new boolean[]{
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
false,
true,
true,
false,
true,
false,
true,
true,
false,
true,
};
/// <summary>
/// 音階のノート値からのコンストラクタ
/// </summary>
/// <param name="note">この音階を初期化するためのノート値</param>
public VsqNote( int note ) {
_note = note;
}
/*// <summary>
/// このインスタンスが表す音階のノート値
/// </summary>
public property int Value {
get {
return _note;
}
set {
_note = value;
}
}*/
/// <summary>
/// このインスタンスが表す音階がピアノの白鍵かどうかを返します
/// </summary>
public boolean getIsWhiteKey() {
return NoteIsWhiteKey( _note );
}
/// <summary>
/// 指定した音階がピアノの白鍵かどうかを返します
/// </summary>
/// <param name="note"></param>
/// <returns></returns>
public static boolean NoteIsWhiteKey( int note ) {
if ( 0 <= note && note <= 127 ) {
return _KEY_TYPE[note];
} else {
int odd = note % 12;
switch ( odd ) {
case 1:
case 3:
case 6:
case 8:
case 10:
return false;
default:
return true;
}
}
}
public static String NoteToString( int note ) {
int odd = note % 12;
int order = (note - odd) / 12 - 2;
switch ( odd ) {
case 0:
return "C" + order;
case 1:
return "C#" + order;
case 2:
return "D" + order;
case 3:
return "Eb" + order;
case 4:
return "E" + order;
case 5:
return "F" + order;
case 6:
return "F#" + order;
case 7:
return "G" + order;
case 8:
return "G#" + order;
case 9:
return "A" + order;
case 10:
return "Bb" + order;
case 11:
return "B" + order;
default:
return "";
}
}
public String toString() {
return NoteToString( _note );
}
}

View File

@ -1,143 +0,0 @@
/*
* VsqMixer.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
public class VsqNrpn implements Comparable<VsqNrpn> {
/**
* <pre>
* public property int Clock {
* get {
* return m_clock;
* }
* set {
* m_clock = value;
* }
*};</pre>
*/
public int Clock;
private int m_nrpn;
private byte m_datamsb;
private byte m_datalsb;
private boolean m_datalsb_specified = false;
private Vector<VsqNrpn> m_list;
public VsqNrpn( int clock, int nrpn, byte data_msb ) {
Clock = clock;
m_nrpn = nrpn;
m_datamsb = data_msb;
m_datalsb_specified = false;
m_list = new Vector<VsqNrpn>();
}
public VsqNrpn( int clock, int nrpn, byte data_msb, byte data_lsb ) {
Clock = clock;
m_nrpn = nrpn;
m_datamsb = data_msb;
m_datalsb = data_lsb;
m_datalsb_specified = true;
m_list = new Vector<VsqNrpn>();
}
private VsqNrpn() {
}
public VsqNrpn[] expand() {
Vector<VsqNrpn> ret = new Vector<VsqNrpn>();
if ( m_datalsb_specified ) {
ret.add( new VsqNrpn( Clock, m_nrpn, m_datamsb, m_datalsb ) );
} else {
ret.add( new VsqNrpn( Clock, m_nrpn, m_datamsb ) );
}
for ( int i = 0; i < m_list.size(); i++ ) {
VsqNrpn item = m_list.get( i );
if ( item.m_datalsb_specified ) {
ret.add( new VsqNrpn( item.Clock, item.m_nrpn, item.m_datamsb, item.m_datalsb ) );
} else {
ret.add( new VsqNrpn( item.Clock, item.m_nrpn, item.m_datamsb ) );
}
}
return ret.toArray( new VsqNrpn[0] );
}
public static VsqNrpn[] merge( VsqNrpn[] src1, VsqNrpn[] src2 ) {
Vector<VsqNrpn> ret = new Vector<VsqNrpn>();
for ( int i = 0; i < src1.length; i++ ) {
ret.add( src1[i] );
}
for ( int i = 0; i < src2.length; i++ ) {
ret.add( src2[i] );
}
Collections.sort( ret );
return ret.toArray( new VsqNrpn[0] );
}
public static NrpnData[] convert( VsqNrpn[] source ) {
int nrpn = source[0].getNrpn();
byte msb = (byte)(nrpn >> 8);
byte lsb = (byte)(nrpn - (nrpn << 8));
Vector<NrpnData> ret = new Vector<NrpnData>();
ret.add( new NrpnData( source[0].Clock, (byte)0x63, msb ) );
ret.add( new NrpnData( source[0].Clock, (byte)0x62, lsb ) );
ret.add( new NrpnData( source[0].Clock, (byte)0x06, source[0].getDataMsb() ) );
if ( source[0].getDataLsbSpecified() ) {
ret.add( new NrpnData( source[0].Clock, (byte)0x26, source[0].getDataLsb() ) );
}
for ( int i = 1; i < source.length; i++ ) {
int tnrpn = source[i].getNrpn();
byte tmsb = (byte)(tnrpn >> 8);
byte tlsb = (byte)(tnrpn - (tnrpn << 8));
if ( tmsb != msb ) {
ret.add( new NrpnData( source[i].Clock, (byte)0x63, tmsb ) );
msb = tmsb;
}
ret.add( new NrpnData( source[i].Clock, (byte)0x62, tlsb ) );
ret.add( new NrpnData( source[i].Clock, (byte)0x06, source[i].getDataMsb() ) );
if ( source[i].getDataLsbSpecified() ) {
ret.add( new NrpnData( source[i].Clock, (byte)0x26, source[i].getDataLsb() ) );
}
}
return ret.toArray( new NrpnData[0] );
}
public int compareTo( VsqNrpn item ) {
return Clock - item.Clock;
}
public void append( int nrpn, byte data_msb ) {
m_list.add( new VsqNrpn( Clock, nrpn, data_msb ) );
}
public void append( int nrpn, byte data_msb, byte data_lsb ) {
m_list.add( new VsqNrpn( Clock, nrpn, data_msb, data_lsb ) );
}
public int getNrpn() {
return m_nrpn;
}
public byte getDataMsb() {
return m_datamsb;
}
public byte getDataLsb() {
return m_datalsb;
}
private boolean getDataLsbSpecified() {
return m_datalsb_specified;
}
}

View File

@ -1,146 +0,0 @@
/*
* VsqPhoneticSymbol.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
public class VsqPhoneticSymbol {
private static final String[] _SYMBOL_VOWEL_JP = new String[] {
"a",
"i",
"M",
"e",
"o",
};
private static String[] _SYMBOL_CONSONANT_JP = new String[] {
"k",
"k'",
"g",
"g'",
"N",
"N'",
"s",
"S",
"z",
"Z",
"dz",
"dZ",
"t",
"t'",
"ts",
"tS",
"d",
"d'",
"n",
"J",
"h",
"h\\",
"C",
"p\\",
"p\\'",
"b",
"b'",
"p",
"p'",
"m",
"m'",
"j",
"4",
"4'",
"w",
"N\\",
};
private static String[] _SYMBOL_EN = new String[] {
"@",
"V",
"e",
"e",
"I",
"i:",
"{",
"O:",
"Q",
"U",
"u:",
"@r",
"eI",
"aI",
"OI",
"@U",
"aU",
"I@",
"e@",
"U@",
"O@",
"Q@",
"w",
"j",
"b",
"d",
"g",
"bh",
"dh",
"gh",
"dZ",
"v",
"D",
"z",
"Z",
"m",
"n",
"N",
"r",
"l",
"l0",
"p",
"t",
"k",
"ph",
"th",
"kh",
"tS",
"f",
"T",
"s",
"S",
"h",
};
public static boolean IsConsonant( String symbol ) {
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.length; i++ ) {
if ( _SYMBOL_CONSONANT_JP[i].equals( symbol ) ) {
return true;
}
}
return false;
}
public static boolean IsValidSymbol( String symbol ) {
for ( int i = 0; i < _SYMBOL_VOWEL_JP.length; i++ ) {
if ( _SYMBOL_VOWEL_JP[i].equals( symbol ) ) {
return true;
}
}
for ( int i = 0; i < _SYMBOL_CONSONANT_JP.length; i++ ) {
if ( _SYMBOL_CONSONANT_JP[i].equals( symbol ) ) {
return true;
}
}
for ( int i = 0; i < _SYMBOL_EN.length; i++ ) {
if ( _SYMBOL_EN[i].equals( symbol ) ) {
return true;
}
}
return false;
}
}

View File

@ -1,307 +0,0 @@
/*
* VsqTrack.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
import java.io.*;
public class VsqTrack implements Cloneable {
private String m_name;
private VsqMetaText m_meta_text;
private Vector<MidiEvent> m_midi_event;
private int m_edited_start = Integer.MAX_VALUE;
private int m_edited_end = Integer.MIN_VALUE;
public VsqEventIterator singerEventEnumerator() {
return m_meta_text.getEventList().iterator( VsqEventIteratorMode.Singer );
}
public VsqEventIterator noteEventEnumerator() {
return m_meta_text.getEventList().iterator( VsqEventIteratorMode.Anote );
}
public void printMetaText( TextMemoryStream sw, boolean encode, long eos, int start ) {
m_meta_text.print( sw, encode, eos, start );
}
public void printMetaText( String file ) throws IOException {
TextMemoryStream tms = new TextMemoryStream();
int count = m_meta_text.getEventList().size();
int clLast = m_meta_text.getEventList().get( count - 1 ).Clock + 480;
m_meta_text.print( tms, true, (long)clLast, 0 );
BufferedWriter sw = new BufferedWriter( new FileWriter( file ) );
tms.rewind();
while ( tms.peek() >= 0 ) {
String line = tms.readLine();
sw.write( line + "\n" );
}
}
/**
* for future implement:<pre>
*property VsqMaster Master {
* public get {
* return m_meta_text.master;
* }
* protected set {
* m_meta_text.master = value;
* }
*};</pre>
* @return
*/
public VsqMaster getMaster() {
return m_meta_text.master;
}
protected void setMaster( VsqMaster value ) {
m_meta_text.master = value;
}
/**
* for future implement:<pre>
*property VsqMixer Mixer {
* public get {
* return m_meta_text.mixer;
* }
* protected set {
* m_meta_text.mixer = value;
* }
*};</pre>
* @return
*/
public VsqMixer getMixer() {
return m_meta_text.mixer;
}
protected void setMixer( VsqMixer value ) {
m_meta_text.mixer = value;
}
public VsqBPList getVsqBPList( VsqCurveType curveType ) {
return m_meta_text.getVsqBPList( curveType );
}
public void setVsqBPList( VsqCurveType curveType, VsqBPList value ) {
m_meta_text.setVsqBPList( curveType, value );
}
public VsqEventList getEvents() {
return m_meta_text.getEventList();
}
/**
* for future implement:<pre>
* property int EditedStart {
* public get {
* return m_edited_start;
* }
* protected set {
* if ( value &lt; m_edited_start ) {
* m_edited_start = value;
* }
* }
* };</pre>
*/
public int getEditedStart(){
return m_edited_start;
}
protected void setEditedStart( int value ){
m_edited_start = value;
}
public int getEditedEnd() {
return m_edited_end;
}
protected void setEditedEnd( int value ) {
if ( m_edited_end < value ) {
m_edited_end = value;
}
}
public void resetEditedArea() {
m_edited_start = Integer.MAX_VALUE;
m_edited_end = Integer.MIN_VALUE;
}
public Object clone() {
VsqTrack res = new VsqTrack();
res.m_name = m_name;
if ( m_meta_text != null ) {
res.m_meta_text = (VsqMetaText)m_meta_text.clone();
}
if ( m_midi_event != null ) {
res.m_midi_event = new Vector<MidiEvent>();
for ( int i = 0; i < m_midi_event.size(); i++ ) {
MidiEvent item = m_midi_event.get( i );
res.m_midi_event.add( (MidiEvent)item.clone() );
}
}
res.m_edited_start = m_edited_start;
res.m_edited_end = m_edited_end;
return res;
}
private VsqTrack() {
}
/**
* Master Trackを構築
* @param tempo
* @param numerator
* @param denominator
*/
public VsqTrack( int tempo, int numerator, int denominator ) {
this.m_name = "Master Track";
this.m_meta_text = null;
this.m_midi_event = new Vector<MidiEvent>();
this.m_midi_event.add( new MidiEvent( "0 Tempo " + tempo ) );
this.m_midi_event.add( new MidiEvent( "0 TimeSig " + numerator + "/" + denominator + " 24 8" ) );
}
/**
* Master Trackでないトラックを構築
* @param name
* @param singer
*/
public VsqTrack( String name, String singer ) {
m_name = name;
m_meta_text = new VsqMetaText( name, singer );
m_midi_event = new Vector<MidiEvent>();
}
/**
*
* メタテキスト
* private property VsqMetaText MetaText {
* get {
* return m_meta_text;
* }
* };
*/
protected VsqMetaText getVsqMetaText() {
return m_meta_text;
}
/**
* トラックの名前
* public property String Name {
* get {
* return m_name;
* }
* set {
* m_name = value;
* }
* };
*/
public String getName() {
return m_name;
}
public void setName( String value ) {
m_name = value;
}
/**
* 歌詞の文字数を調べます
* @returns
*/
public int getLyricLength() {
int counter = 0;
VsqEventList list = m_meta_text.getEventList();
for ( int i = 0; i < list.size(); i++ ) {
if ( list.get( i ).ID.type == VsqIDType.Anote ) {
counter++;
}
}
return counter;
}
/**
* vsqファイルをmf2t形式にテキスト化されたファイルからコンストラクト
* @param lines
*/
public VsqTrack( Vector<String> lines ) throws IOException {
m_midi_event = new Vector<MidiEvent>();
m_name = "";
String meta_text_path;
File temp_file = File.createTempFile( "temp", ".bin" );
meta_text_path = temp_file.getPath();
TextMemoryStream sw = new TextMemoryStream();
int signal;
for ( int j = 0; j < lines.size(); j++ ) {
String s = lines.get( j );
String line = s;
// signalを取得
int index = line.indexOf( ' ' );
String str_signal = line.substring( 0, index );
signal = Integer.parseInt( str_signal );
String remain = line.substring( index + 1 );
// イベントの種類で処理を分岐
String[] spl = remain.split( " " );
if ( spl[0] == "Meta" && spl[1] == "Text" ) {
line = line.replace( signal + " Meta Text \"", "" );
int second_colon = line.indexOf( ":", 3 );
line = line.substring( second_colon + 1 );
line = line.substring( 0, line.length() - 1 );
line = line.replace( "\\n", "\n" );
sw.write( line );
} else if ( spl[0] == "Meta" && (spl[1] == "TrkName" || spl[1] == "SeqName") ) {
m_name = spl[2];
for ( int i = 3; i < spl.length; i++ ) {
m_name += " " + spl[i];
}
m_name = m_name.replace( "\"", "" );
m_name = Lyric.decode( m_name );
} else {
m_midi_event.add( new MidiEvent( line ) );
}
}
sw.rewind();
m_meta_text = new VsqMetaText( sw );
temp_file.delete();
}
/**
* MidiEventの中からテンポ情報を抽出します
* @returns
*/
public Vector<MidiEvent> getTempoList() {
Vector<MidiEvent> list = new Vector<MidiEvent>();
for ( int i = 0; i < m_midi_event.size(); i++ ) {
if ( m_midi_event.get( i ).type == MidiEventType.tempo ) {
list.add( m_midi_event.get( i ) );
}
}
Collections.sort( list );
return list;
}
/**
* MidiEventの中から拍子情報を抽出します
* @returns
*/
public Vector<MidiEvent> getTimeSigList() {
Vector<MidiEvent> list = new Vector<MidiEvent>();
for ( int i = 0; i < m_midi_event.size(); i++ ) {
if ( m_midi_event.get( i ).type == MidiEventType.time_signal ) {
list.add( m_midi_event.get( i ) );
}
}
Collections.sort( list );
return list;
}
}

View File

@ -1,326 +0,0 @@
/*
* VsqUtil.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
import java.util.*;
/// <summary>
/// コンピュータにインストールされたVOCALOID2システムについての情報を取得するためのスタティックライブラリ
/// </summary>
public class VsqUtil {
/// <summary>
/// VOCALOIDシステムの仕様上設定可能な歌手の最大数
/// </summary>
public final int MAX_SINGERS = 0x4000;
private static String s_dll_path = "";
private static boolean s_dll_path_done = false;
private static String s_exp_db_dir = "";
private static boolean s_exp_db_dir_done = false;
private static Dictionary<int, SingerConfig> s_singer_configs = null;
private static Vector<SingerConfig> s_installed_singers = new Vector<SingerConfig>();
/// <summary>
/// 指定したプログラムチェンジが担当する歌手の歌唱言語を表すインデクスを取得します
/// </summary>
/// <param name="program_change"></param>
/// <returns></returns>
public static VsqVoiceLanguage GetLanguage( int program_change ) {
String name = GetOriginalSinger( program_change );
switch ( name ) {
case "Miku":
case "Rin":
case "Len":
case "Rin_ACT2":
case "Len_ACT2":
case "Gackpoid":
return VsqVoiceLanguage.Japanese;
}
return VsqVoiceLanguage.Default;
}
/// <summary>
/// 指定したプログラムチェンジが担当する歌手のオリジナルの歌手名を取得します
/// </summary>
/// <param name="program_change"></param>
/// <returns></returns>
public static String GetOriginalSinger( int program_change ) {
if ( s_singer_configs == null ) {
LoadSingerConfigs();
}
if ( s_singer_configs.ContainsKey( program_change ) ) {
SingerConfig sc = GetSingerInfo( program_change );
String voiceidstr = sc.VOICEIDSTR;
foreach ( SingerConfig installed in s_installed_singers ) {
if ( installed.VOICEIDSTR == voiceidstr ) {
return installed.VOICENAME;
}
}
}
return "";
}
/// <summary>
/// 指定したプログラムチェンジが担当する歌手の情報をVsqIDに変換した物を取得します
/// </summary>
/// <param name="program_change"></param>
/// <returns></returns>
public static VsqID GetSingerID( int program_change ) {
VsqID ret = new VsqID( 0 );
ret.type = VsqIDType.Singer;
SingerConfig sc = GetSingerInfo( program_change );
int language = 0;
foreach ( SingerConfig sc2 in s_installed_singers ) {
if ( sc.VOICEIDSTR == sc2.VOICEIDSTR ) {
switch ( sc2.VOICENAME ) {
case "Miku":
language = 0;
break;
}
}
}
ret.IconHandle = new IconHandle();
ret.IconHandle.IconID = "$0701" + program_change.ToString( "0000" );
ret.IconHandle.IDS = sc.VOICENAME;
ret.IconHandle.Index = 0;
ret.IconHandle.Language = language;
ret.IconHandle.Length = 1;
ret.IconHandle.Original = sc.Original;
ret.IconHandle.Program = program_change;
ret.IconHandle.Type = VsqHandleType.Singer;
ret.IconHandle.Caption = "";
return ret;
}
/// <summary>
/// 指定したプログラムチェンジの歌手情報を取得します
/// </summary>
/// <param name="program_change"></param>
/// <returns></returns>
public static SingerConfig GetSingerInfo( int program_change ) {
if ( s_singer_configs == null ) {
LoadSingerConfigs();
}
if ( s_singer_configs.ContainsKey( program_change ) ) {
return s_singer_configs[program_change];
} else {
return null;
}
}
/// <summary>
/// 歌手設定を読み込むGetSingerInfo, GetSingerIDが最初に呼ばれた時に自動的に呼び出されるが明示的に呼び出しても良い
/// </summary>
public static void LoadSingerConfigs() {
if ( s_singer_configs == null ) {
LoadSingerConfigs( GetExpDbPath() );
}
}
/// <summary>
/// SingerEditorによって設定された歌手のリストを取得するリストのキーはプログラムチェンジの値に対応する
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
private static void LoadSingerConfigs( String path ) {
s_singer_configs = new Dictionary<int, SingerConfig>();
String map_file = Path.Combine( path, "voice.map" );
if ( !File.Exists( map_file ) ) {
return;
}
using ( FileStream fs = new FileStream( map_file, FileMode.Open, FileAccess.Read ) ) {
byte[] dat = new byte[8];
fs.Seek( 0x20, SeekOrigin.Begin );
for ( int i = 0; i < MAX_SINGERS; i++ ) {
fs.Read( dat, 0, 8 );
ulong value = makelong_le( dat );
if ( value >= 1 ) {
#if DEBUG
Console.WriteLine( " value=" + value );
#endif
String file = Path.Combine( path, "vvoice" + value + ".vvd" );
if ( File.Exists( file ) ) {
s_singer_configs.Add( i, new SingerConfig( file, (int)(value - 1) ) );
}
}
}
}
Vector<String> voiceidstrs = new Vector<String>();
foreach ( SingerConfig sc in s_singer_configs.Values ) {
if ( !voiceidstrs.Contains( sc.VOICEIDSTR ) ) {
voiceidstrs.Add( sc.VOICEIDSTR );
}
}
foreach ( String s in voiceidstrs ) {
String dir = Path.Combine( path, s );
String[] files = Directory.GetFiles( dir, "*.vvd" );
foreach ( String s2 in files ) {
String file = Path.Combine( dir, s2 );
if ( File.Exists( file ) ) {
s_installed_singers.Add( new SingerConfig( file, -1 ) );
}
}
}
}
/// <summary>
/// 長さ8のバイト列をリトルエンディアンとみなしunsigned longに変換します
/// </summary>
/// <param name="oct"></param>
/// <returns></returns>
private static long makelong_le( byte[] oct ) {
return (ulong)oct[7] << 56 | (ulong)oct[6] << 48 | (ulong)oct[5] << 40 | (ulong)oct[4] << 32 | (ulong)oct[3] << 24 | (ulong)oct[2] << 16 | (ulong)oct[1] << 8 | (ulong)oct[0];
}
/// <summary>
/// VOCALOID2 VSTiのdllへのフルパスを取得します
/// </summary>
/// <returns></returns>
public static unsafe String GetVstiDllPath() {
if ( s_dll_path_done ) {
return s_dll_path;
}
try {
uint hKey;
int ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2\\APPLICATION", 0, windows.KEY_READ, &hKey );
if ( ret != windows.ERROR_SUCCESS ) {
ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2_DEMO\\APPLICATION", 0, windows.KEY_READ, &hKey );
if ( ret != windows.ERROR_SUCCESS ) {
return s_dll_path;
}
}
FILETIME ft;
for ( uint i = 0; ; i++ ) {
String lpszName = new String( new char[64] );
String pClass = new String( new char[64] );
uint dwNameSize = (uint)lpszName.Length;
uint pcbClass = 64;
int lRes = windows.RegEnumKeyExW( hKey, i, lpszName, &dwNameSize, (uint*)0, pClass, &pcbClass, &ft );
if ( lRes != windows.ERROR_SUCCESS ) {
break;
}
uint hChildKey;
ret = windows.RegOpenKeyExW( hKey, lpszName, 0, windows.KEY_READ, &hChildKey );
if ( ret != windows.ERROR_SUCCESS ) {
continue;
}
uint dwType = windows.REG_SZ;
uint dwSize = windows.MAX_PATH;
byte[] tszVSTPlugin = new byte[windows.MAX_PATH];
tszVSTPlugin[0] = (byte)'\0';
fixed ( byte* pData = &tszVSTPlugin[0] ) {
ret = windows.RegQueryValueExW( hChildKey, "PATH", (uint*)0, &dwType, pData, &dwSize );
}
windows.RegCloseKey( hChildKey );
if ( ret != windows.ERROR_SUCCESS ) {
continue;
}
String name = Encoding.Unicode.GetString( tszVSTPlugin, 0, (int)dwSize );
if ( name.EndsWith( "\0" ) ) {
name = name.SubString( 0, name.Length - 1 );
}
// 製品版
if ( name.EndsWith( "\\vocaloid2.dll" ) ) {
s_dll_path = name;
break;
}
// デモ版
if ( name.EndsWith( "\\vocaloid2_demo.dll" ) ) {
s_dll_path = name;
break;
}
}
windows.RegCloseKey( hKey );
} catch {
} finally {
s_dll_path_done = true;
}
return s_dll_path;
}
/// <summary>
/// 歌唱データベースが保存されているディレクトリのフルパスを取得します
/// </summary>
/// <returns></returns>
public static unsafe String GetExpDbPath() {
if ( s_exp_db_dir_done ) {
return s_exp_db_dir;
}
try {
uint hKey;
int ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2\\DATABASE\\VOICE", 0, windows.KEY_READ, &hKey );
if ( ret != windows.ERROR_SUCCESS ) {
ret = windows.RegOpenKeyExW( windows.HKEY_LOCAL_MACHINE, "SOFTWARE\\VOCALOID2_DEMO\\DATABASE\\VOICE", 0, windows.KEY_READ, &hKey );
if ( ret != windows.ERROR_SUCCESS ) {
return s_exp_db_dir;
}
}
FILETIME ft;
for ( uint i = 0; ; i++ ) {
String lpszName = new String( new char[64] );
String pClass = new String( new char[64] );
uint dwNameSize = (uint)lpszName.Length;
uint pcbClass = 64;
int lRes = windows.RegEnumKeyExW( hKey, i, lpszName, &dwNameSize, (uint*)0, pClass, &pcbClass, &ft );
if ( lRes != windows.ERROR_SUCCESS ) {
break;
}
uint hChildKey;
ret = windows.RegOpenKeyExW( hKey, lpszName, 0, windows.KEY_READ, &hChildKey );
if ( ret != windows.ERROR_SUCCESS ) {
continue;
}
uint dwType = windows.REG_SZ;
uint dwSize = windows.MAX_PATH;
byte[] tszVSTPlugin = new byte[windows.MAX_PATH];
tszVSTPlugin[0] = (byte)'\0';
fixed ( byte* pData = &tszVSTPlugin[0] ) {
ret = windows.RegQueryValueExW( hChildKey, "INSTALLDIR", (uint*)0, &dwType, pData, &dwSize );
}
windows.RegCloseKey( hChildKey );
if ( ret != windows.ERROR_SUCCESS ) {
continue;
}
String name = Encoding.Unicode.GetString( tszVSTPlugin, 0, (int)dwSize );
if ( name.EndsWith( "\0" ) ) {
name = name.SubString( 0, name.Length - 1 );
}
if ( name.EndsWith( "\\voicedbdir" ) ) {
s_exp_db_dir = name;
break;
}
}
windows.RegCloseKey( hKey );
} catch {
} finally {
s_exp_db_dir_done = true;
}
return s_exp_db_dir;
}
}

View File

@ -1,29 +0,0 @@
/*
* VsqVoiceLanguage.java
* Copyright (c) 2008 kbinani
*
* This file is part of jp.sourceforge.lipsync.vsq.
*
* jp.sourceforge.lipsync.vsq is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* jp.sourceforge.lipsync.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.
*/
package jp.sourceforge.lipsync.vsq;
/**
*VOCALOID2の歌唱言語
* @author kbinani
*/
public enum VsqVoiceLanguage {
/**
* デフォルトJapaneseと同値
*/
Default,
/**
* 日本語
*/
Japanese,
}

View File

@ -1,86 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C# Express 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LipSync", "LipSync\LipSync.csproj", "{15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPlugin", "IPlugin\IPlugin.csproj", "{FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NicoComment", "NicoComment\NicoComment.csproj", "{6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VFlip", "VFlip\VFlip.csproj", "{E5F9AD85-0C02-4286-AC4C-F5B34EA10650}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Background", "Background\Background.csproj", "{F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevUtl", "DevUtl\DevUtl.csproj", "{A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lang2po", "lang2po\lang2po.csproj", "{D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boare.Lib.AppUtil", "..\Boare.Lib.AppUtil\Boare.Lib.AppUtil.csproj", "{0C58B068-272F-4390-A14F-3D72AFCF3DFB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boare.Lib.Media", "..\Boare.Lib.Media\Boare.Lib.Media.csproj", "{F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boare.Lib.Vsq", "..\Boare.Lib.Vsq\Boare.Lib.Vsq.csproj", "{673347F3-6FC2-4F82-9273-BF158E0F8CB1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bocoree", "..\bocoree\bocoree.csproj", "{C8AAE632-9C6C-4372-8175-811528A66742}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Boare.Lib.Swf", "..\Boare.Lib.Swf\Boare.Lib.Swf.csproj", "{D861973B-3BC6-4F52-83BE-49A8C269C09F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15B51EEA-0D7F-4B59-AC7B-879A7BDB4A56}.Release|Any CPU.Build.0 = Release|Any CPU
{FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB0C1FBD-3CB7-46BF-8E39-57BE2C8D1F00}.Release|Any CPU.Build.0 = Release|Any CPU
{6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CBD22A6-34C4-4444-8F90-9EE0D150CEC1}.Release|Any CPU.Build.0 = Release|Any CPU
{E5F9AD85-0C02-4286-AC4C-F5B34EA10650}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5F9AD85-0C02-4286-AC4C-F5B34EA10650}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5F9AD85-0C02-4286-AC4C-F5B34EA10650}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5F9AD85-0C02-4286-AC4C-F5B34EA10650}.Release|Any CPU.Build.0 = Release|Any CPU
{F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3B0AB64-CEEE-4003-9DA1-BCD4109ECBA9}.Release|Any CPU.Build.0 = Release|Any CPU
{A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7798205-28BD-4DCD-A4EC-56FD23EE7AB9}.Release|Any CPU.Build.0 = Release|Any CPU
{D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D60A11E0-8FFA-4CBC-A2F9-7365AFDF47A9}.Release|Any CPU.Build.0 = Release|Any CPU
{0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C58B068-272F-4390-A14F-3D72AFCF3DFB}.Release|Any CPU.Build.0 = Release|Any CPU
{F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4F8F601-4E3D-43F5-A8A8-AA1FB7F48452}.Release|Any CPU.Build.0 = Release|Any CPU
{673347F3-6FC2-4F82-9273-BF158E0F8CB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{673347F3-6FC2-4F82-9273-BF158E0F8CB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{673347F3-6FC2-4F82-9273-BF158E0F8CB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{673347F3-6FC2-4F82-9273-BF158E0F8CB1}.Release|Any CPU.Build.0 = Release|Any CPU
{C8AAE632-9C6C-4372-8175-811528A66742}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8AAE632-9C6C-4372-8175-811528A66742}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8AAE632-9C6C-4372-8175-811528A66742}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8AAE632-9C6C-4372-8175-811528A66742}.Release|Any CPU.Build.0 = Release|Any CPU
{D861973B-3BC6-4F52-83BE-49A8C269C09F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D861973B-3BC6-4F52-83BE-49A8C269C09F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D861973B-3BC6-4F52-83BE-49A8C269C09F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D861973B-3BC6-4F52-83BE-49A8C269C09F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,45 +0,0 @@
using System.Runtime.InteropServices;
namespace Boare.Lib.AviutlPlugin{
/*class aviutl {
[DllImport( "Invoke", EntryPoint="GetFilterTable")]
public extern static FILTER_DLL GetFilterTable();
}
struct FILTER_DLL {
int flag;
int x,y;
TCHAR *name;
int track_n;
TCHAR **track_name;
int* track_default;
int* track_s;
int* track_e;
int check_n;
TCHAR **check_name;
int* check_default;
BOOL (*func_proc)( FILTER *fp,FILTER_PROC_INFO *fpip );
BOOL (*func_init)( FILTER *fp );
BOOL (*func_exit)( FILTER *fp );
BOOL (*func_update)( FILTER *fp,int status );
BOOL (*func_WndProc)( HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam,void *editp,FILTER *fp );
int* track;
int* check;
void* ex_data_ptr;
int ex_data_size;
TCHAR *information;
BOOL (*func_save_start)( FILTER *fp,int s,int e,void *editp );
BOOL (*func_save_end)( FILTER *fp,void *editp );
EXFUNC *exfunc;
HWND hwnd;
HINSTANCE dll_hinst;
void* ex_data_def;
BOOL (*func_is_saveframe)( FILTER *fp,void *editp,int saveno,int frame,int fps,int edit_flag,int inter );
int[] reserve = new int[6];
}*/
}

View File

@ -1,264 +0,0 @@
/*
* Common.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace LipSync {
/// <summary>
/// LipSync共用の関数
/// </summary>
public class Common {
private static string m_log_file = "";
private static StreamWriter m_sw = null;
private static SaveFileDialog s_dialog = null;
public static Color CURVE_X = Color.Black;
public static Color CURVE_Y = Color.White;
public static Color CURVE_SCALE = Color.Orange;
public static Color CURVE_ALPHA = Color.Red;
public static Color CURVE_ROTATE = Color.Navy;
/// <summary>
/// ファイルダイアログのFilterに指定しようとしている文字列がエラーを起こさないかどうかを確かめます
/// </summary>
/// <param name="filter"></param>
/// <returns></returns>
public static bool CheckFilterValidity( string filter ) {
if ( s_dialog == null ) {
s_dialog = new SaveFileDialog();
}
try {
s_dialog.Filter = filter;
return true;
} catch {
return false;
}
}
public static void DebugWriteLine( string s ) {
#if DEBUG
#if MONO
Console.WriteLine( s );
System.Diagnostics.Trace.WriteLine( s );
System.Diagnostics.Debug.WriteLine( s );
#else
//System.Diagnostics.Debug.WriteLine( s );
Console.WriteLine( s );
#endif
#endif
}
public static Image GetThumbnailImage( Image image, int width, int height ) {
Bitmap res = new Bitmap( width, height, PixelFormat.Format32bppArgb );
if ( image == null ) {
return res;
}
int w = image.Width;
int h = image.Height;
float ASPECTO = (float)width / (float)height;
float aspecto = (float)w / (float)h;
float order = 1f; //拡大率
int top = 0; //描画位置y座標
int left = 0; //描画位置x座標
if ( ASPECTO > aspecto ) {
// サムネイルのほうが横長
order = (float)height / (float)h;
left = (int)(width - order * w) / 2;
} else {
// サムネイルのほうが縦長
order = (float)width / (float)w;
top = (int)(height - order * h) / 2;
}
using ( Graphics g = Graphics.FromImage( res ) ) {
g.Clear( Color.Transparent );
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage( image, left, top, w * order, h * order );
}
return res;
}
/// <summary>
/// 2つの整数の最大公約数を返します。
/// </summary>
/// <param name="m"></param>
/// <param name="n"></param>
/// <returns></returns>
public static long GetGCD( long m, long n ) {
if ( n > m ) {
long a = n;
n = m;
m = a;
}
while ( true ) {
if ( n == 0 ) {
return m;
}
long quotient = m / n;
long odd = m - n * quotient;
if ( odd == 0 ) {
return n;
}
m = n;
n = odd;
}
}
public static Point PointFromPointF( PointF point_f ) {
return new Point( (int)point_f.X, (int)point_f.Y );
}
public static Size SizeFromSizeF( SizeF size_f ) {
return new Size( (int)size_f.Width, (int)size_f.Height );
}
/// <summary>
/// 画像から不透明領域を検出する。
/// </summary>
/// <param name="bmp"></param>
/// <returns></returns>
public static Rectangle GetNonTransparentRegion( Bitmap bmp ) {
if ( bmp.PixelFormat != PixelFormat.Format32bppArgb ) {
return new Rectangle();
}
BitmapData bmpdat = bmp.LockBits(
new Rectangle( 0, 0, bmp.Width, bmp.Height ),
ImageLockMode.ReadOnly,
PixelFormat.Format32bppArgb
);
int stride = bmpdat.Stride;
int ymax = 0;
int ymin = (bmp.Height - 1) * stride;
int xmax = 0;
int xmin = (bmp.Width - 1) * 4;
const byte ZERO = 0;
unsafe {
byte* dat = (byte*)(void*)bmpdat.Scan0;
int xend = bmp.Width * 4;
int yend;
for ( int x = 0; x < xend; x += 4 ) {
// yminを決める
yend = ymin;//ymin* stride;
for ( int y = 0; y <= yend; y += stride ) {
if ( dat[x + y + 3] != ZERO ) {
//ymin = Math.Min( ymin, y / stride );
ymin = Math.Min( ymin, y );
break;
}
}
// ymaxを決める
yend = ymax;// ymax * stride;
for ( int y = (bmp.Height - 1) * stride; y >= yend; y -= stride ) {
if ( dat[x + y + 3] != ZERO ) {
//ymax = Math.Max( ymax, y / stride );
ymax = Math.Max( ymax, y );
break;
}
}
}
yend = ymax;// ymax * stride;
for ( int y = ymin; y <= yend; y += stride ) {
// xminを決める
for ( int x = 0; x < xmin; x += 4 ) {
if ( dat[x + y + 3] != ZERO ) {
//xmin = Math.Min( xmin, x / 4 );
xmin = Math.Min( xmin, x );
break;
}
}
// xmaxを決める
for ( int x = (bmp.Width - 1) * 4; x >= xmax; x -= 4 ) {
if ( dat[x + y + 3] != ZERO ) {
//xmax = Math.Max( xmax, x / 4 );
xmax = Math.Max( xmax, x );
break;
}
}
}
if ( xmax <= xmin || ymax <= ymin ) {
xmin = 0;
xmax = bmp.Width - 1;
ymin = 0;
ymax = bmp.Height - 1;
} else {
xmin = xmin / 4;
xmax = xmax / 4;
ymin = ymin / stride;
ymax = ymax / stride;
}
}
bmp.UnlockBits( bmpdat );
return new Rectangle( xmin, ymin, xmax - xmin + 1, ymax - ymin + 1 );
}
public static void LogPush( Exception ex ) {
LogPush( ex.Source + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace );
}
public static void LogPush( string procedure, string message_type, string message ) {
LogPush( procedure + ";" + message_type + ";" + message );
}
static void LogPush( string message ) {
if ( m_sw == null ) {
m_log_file = Path.Combine( Application.StartupPath, "error.log" );
m_sw = new StreamWriter( m_log_file, true, Encoding.Unicode );
m_sw.WriteLine( "************************************************************************" );
m_sw.WriteLine( "Logger started : " + DateTime.Now.ToString() );
m_sw.WriteLine( "------------------------------------------------------------------------" );
}
m_sw.WriteLine( DateTime.Now.ToString() + ";" + message );
m_sw.Flush();
}
public static void LogClose() {
if ( m_sw != null ) {
m_sw.Close();
m_sw = null;
}
}
/// <summary>
/// 指定したパスのファイルからイメージを読み込みます
/// </summary>
/// <param name="fpath">イメージファイルへのパス</param>
/// <returns></returns>
public static Image ImageFromFile( string fpath ) {
Bitmap result = null;
if ( File.Exists( fpath ) ) {
using ( FileStream fs = new FileStream( fpath, FileMode.Open, FileAccess.Read ) ) {
Image temp = Image.FromStream( fs );
result = new Bitmap( temp.Width, temp.Height, PixelFormat.Format32bppArgb );
using ( Graphics g = Graphics.FromImage( result ) ) {
g.DrawImage( temp, 0, 0, temp.Width, temp.Height );
}
temp.Dispose();
}
}
return result;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,68 +0,0 @@
/*
* CurveEditor.designer.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 CurveEditor {
partial class CurveEditor {
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose( bool disposing ) {
if ( disposing && (components != null) ) {
components.Dispose();
}
base.Dispose( disposing );
}
#region
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent() {
this.SuspendLayout();
//
// CurveEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.Name = "CurveEditor";
this.Size = new System.Drawing.Size( 333, 120 );
this.Paint += new System.Windows.Forms.PaintEventHandler( this.CurveEditor_Paint );
this.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler( this.CurveEditor_PreviewKeyDown );
this.MouseMove += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseMove );
this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseDoubleClick );
this.FontChanged += new System.EventHandler( this.CurveEditor_FontChanged );
this.KeyUp += new System.Windows.Forms.KeyEventHandler( this.CurveEditor_KeyUp );
this.MouseClick += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseClick );
this.MouseDown += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseDown );
this.Resize += new System.EventHandler( this.CurveEditor_Resize );
this.MouseUp += new System.Windows.Forms.MouseEventHandler( this.CurveEditor_MouseUp );
this.KeyDown += new System.Windows.Forms.KeyEventHandler( this.CurveEditor_KeyDown );
this.ResumeLayout( false );
}
#endregion
}
}

View File

@ -1,290 +0,0 @@
/*================================================================================
File: NativeMethods.cs
Summary: This is part of a sample showing how to place Windows Forms controls
inside one of the common file dialogs.
----------------------------------------------------------------------------------
Copyright (C) Microsoft Corporation. All rights reserved.
This source code is intended only as a supplement to Microsoft Development Tools
and/or on-line documentation. See these other materials for detailed information
regarding Microsoft code samples.
This sample is not intended for production use. Code and policy for a production
application must be developed to meet the specific data and security requirements
of the application.
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
================================================================================*/
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace ExtensibleDialogs
{
/// <summary>
/// Defines the shape of hook procedures that can be called by the OpenFileDialog
/// </summary>
internal delegate IntPtr OfnHookProc( IntPtr hWnd, UInt16 msg, Int32 wParam, Int32 lParam );
/// <summary>
/// Values that can be placed in the OPENFILENAME structure, we don't use all of them
/// </summary>
internal class OpenFileNameFlags
{
public const Int32 ReadOnly = 0x00000001;
public const Int32 OverWritePrompt = 0x00000002;
public const Int32 HideReadOnly = 0x00000004;
public const Int32 NoChangeDir = 0x00000008;
public const Int32 ShowHelp = 0x00000010;
public const Int32 EnableHook = 0x00000020;
public const Int32 EnableTemplate = 0x00000040;
public const Int32 EnableTemplateHandle = 0x00000080;
public const Int32 NoValidate = 0x00000100;
public const Int32 AllowMultiSelect = 0x00000200;
public const Int32 ExtensionDifferent = 0x00000400;
public const Int32 PathMustExist = 0x00000800;
public const Int32 FileMustExist = 0x00001000;
public const Int32 CreatePrompt = 0x00002000;
public const Int32 ShareAware = 0x00004000;
public const Int32 NoReadOnlyReturn = 0x00008000;
public const Int32 NoTestFileCreate = 0x00010000;
public const Int32 NoNetworkButton = 0x00020000;
public const Int32 NoLongNames = 0x00040000;
public const Int32 Explorer = 0x00080000;
public const Int32 NoDereferenceLinks = 0x00100000;
public const Int32 LongNames = 0x00200000;
public const Int32 EnableIncludeNotify = 0x00400000;
public const Int32 EnableSizing = 0x00800000;
public const Int32 DontAddToRecent = 0x02000000;
public const Int32 ForceShowHidden = 0x10000000;
};
/// <summary>
/// Values that can be placed in the FlagsEx field of the OPENFILENAME structure
/// </summary>
internal class OpenFileNameFlagsEx
{
public const Int32 NoPlacesBar = 0x00000001;
};
/// <summary>
/// A small subset of the window messages that can be sent to the OpenFileDialog
/// These are just the ones that this implementation is interested in
/// </summary>
internal class WindowMessage
{
public const UInt16 InitDialog = 0x0110;
public const UInt16 Size = 0x0005;
public const UInt16 Notify = 0x004E;
};
/// <summary>
/// The possible notification messages that can be generated by the OpenFileDialog
/// We only look for CDN_SELCHANGE
/// </summary>
internal class CommonDlgNotification
{
private const UInt16 First = unchecked((UInt16)((UInt16)0 - (UInt16)601));
public const UInt16 InitDone = (First - 0x0000);
public const UInt16 SelChange = (First - 0x0001);
public const UInt16 FolderChange = (First - 0x0002);
public const UInt16 ShareViolation = (First - 0x0003);
public const UInt16 Help = (First - 0x0004);
public const UInt16 FileOk = (First - 0x0005);
public const UInt16 TypeChange = (First - 0x0006);
public const UInt16 IncludeItem = (First - 0x0007);
}
/// <summary>
/// Messages that can be send to the common dialogs
/// We only use CDM_GETFILEPATH
/// </summary>
internal class CommonDlgMessage {
private const UInt16 User = 0x0400;
private const UInt16 First = User + 100;
private const UInt16 Last = User + 200;
public const UInt16 GetSpec = First;
public const UInt16 GetFilePath = First + 0x0001;
public const UInt16 GetFolderPath = First + 0x0002;
public const UInt16 GetFolderIDList = First + 0x0003;
public const UInt16 SetControlText = First + 0x0004;
public const UInt16 HideControl = First + 0x0005;
public const UInt16 SetDefExt = First + 0x0006;
};
/// <summary>
/// See the documentation for OPENFILENAME
/// </summary>
internal struct OpenFileName
{
public Int32 lStructSize;
public IntPtr hwndOwner;
public IntPtr hInstance;
public IntPtr lpstrFilter;
public IntPtr lpstrCustomFilter;
public Int32 nMaxCustFilter;
public Int32 nFilterIndex;
public IntPtr lpstrFile;
public Int32 nMaxFile;
public IntPtr lpstrFileTitle;
public Int32 nMaxFileTitle;
public IntPtr lpstrInitialDir;
public IntPtr lpstrTitle;
public Int32 Flags;
public Int16 nFileOffset;
public Int16 nFileExtension;
public IntPtr lpstrDefExt;
public Int32 lCustData;
public OfnHookProc lpfnHook;
public IntPtr lpTemplateName;
public IntPtr pvReserved;
public Int32 dwReserved;
public Int32 FlagsEx;
};
/// <summary>
/// Part of the notification messages sent by the common dialogs
/// </summary>
[StructLayout(LayoutKind.Explicit)]
internal struct NMHDR
{
[FieldOffset(0)] public IntPtr hWndFrom;
[FieldOffset(4)] public UInt16 idFrom;
[FieldOffset(8)] public UInt16 code;
};
/// <summary>
/// Part of the notification messages sent by the common dialogs
/// </summary>
[StructLayout(LayoutKind.Explicit)]
internal struct OfNotify
{
[FieldOffset(0)] public NMHDR hdr;
[FieldOffset(12)] public IntPtr ipOfn;
[FieldOffset(16)] public IntPtr ipFile;
};
/// <summary>
/// Win32 window style constants
/// We use them to set up our child window
/// </summary>
internal class DlgStyle
{
public const Int32 DsSetFont = 0x00000040;
public const Int32 Ds3dLook = 0x00000004;
public const Int32 DsControl = 0x00000400;
public const Int32 WsChild = 0x40000000;
public const Int32 WsClipSiblings = 0x04000000;
public const Int32 WsVisible = 0x10000000;
public const Int32 WsGroup = 0x00020000;
public const Int32 SsNotify = 0x00000100;
};
/// <summary>
/// Win32 "extended" window style constants
/// </summary>
internal class ExStyle
{
public const Int32 WsExNoParentNotify = 0x00000004;
public const Int32 WsExControlParent = 0x00010000;
};
/// <summary>
/// An in-memory Win32 dialog template
/// Note: this has a very specific structure with a single static "label" control
/// See documentation for DLGTEMPLATE and DLGITEMTEMPLATE
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internal class DlgTemplate
{
// The dialog template - see documentation for DLGTEMPLATE
public Int32 style = DlgStyle.Ds3dLook | DlgStyle.DsControl | DlgStyle.WsChild | DlgStyle.WsClipSiblings | DlgStyle.SsNotify;
public Int32 extendedStyle = ExStyle.WsExControlParent;
public Int16 numItems = 1;
public Int16 x = 0;
public Int16 y = 0;
public Int16 cx = 0;
public Int16 cy = 0;
public Int16 reservedMenu = 0;
public Int16 reservedClass = 0;
public Int16 reservedTitle = 0;
// Single dlg item, must be dword-aligned - see documentation for DLGITEMTEMPLATE
public Int32 itemStyle = DlgStyle.WsChild;
public Int32 itemExtendedStyle = ExStyle.WsExNoParentNotify;
public Int16 itemX = 0;
public Int16 itemY = 0;
public Int16 itemCx = 0;
public Int16 itemCy = 0;
public Int16 itemId = 0;
public UInt16 itemClassHdr = 0xffff; // we supply a constant to indicate the class of this control
public Int16 itemClass = 0x0082; // static label control
public Int16 itemText = 0x0000; // no text for this control
public Int16 itemData = 0x0000; // no creation data for this control
};
/// <summary>
/// The rectangle structure used in Win32 API calls
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internal struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
};
/// <summary>
/// The point structure used in Win32 API calls
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internal struct POINT
{
public int X;
public int Y;
};
/// <summary>
/// Contains all of the p/invoke declarations for the Win32 APIs used in this sample
/// </summary>
public class NativeMethods
{
[DllImport("User32.dll", CharSet = CharSet.Unicode)]
internal static extern IntPtr GetDlgItem( IntPtr hWndDlg, Int16 Id );
[DllImport("User32.dll", CharSet = CharSet.Unicode)]
internal static extern IntPtr GetParent( IntPtr hWnd );
[DllImport("User32.dll", CharSet = CharSet.Unicode)]
internal static extern IntPtr SetParent( IntPtr hWndChild, IntPtr hWndNewParent );
[DllImport("User32.dll", CharSet = CharSet.Unicode)]
internal static extern UInt32 SendMessage( IntPtr hWnd, UInt32 msg, UInt32 wParam, StringBuilder buffer );
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
internal static extern int GetWindowRect( IntPtr hWnd, ref RECT rc );
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
internal static extern int GetClientRect( IntPtr hWnd, ref RECT rc );
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
internal static extern bool ScreenToClient( IntPtr hWnd, ref POINT pt );
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
internal static extern bool MoveWindow( IntPtr hWnd, int X, int Y, int Width, int Height, bool repaint );
[DllImport("ComDlg32.dll", CharSet = CharSet.Unicode)]
internal static extern bool GetOpenFileName( ref OpenFileName ofn );
[DllImport("ComDlg32.dll", CharSet = CharSet.Unicode)]
internal static extern Int32 CommDlgExtendedError();
}
}

View File

@ -1,45 +0,0 @@
/*
* NumericUpDownEx.Designer.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
partial class NumericUpDownEx {
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose( bool disposing ) {
if ( disposing && (components != null) ) {
components.Dispose();
}
base.Dispose( disposing );
}
#region
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent() {
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

View File

@ -1,44 +0,0 @@
/*
* NumericUpDownEx.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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;
using System.ComponentModel;
using System.Drawing;
//using System.Data;
using System.Text;
using System.Windows.Forms;
namespace LipSync {
/// <summary>
/// MouseWheelでIncrementずつ値を増減させることのできるNumericUpDown
/// </summary>
public partial class NumericUpDownEx : NumericUpDown {
public NumericUpDownEx() {
InitializeComponent();
}
protected override void OnMouseWheel( MouseEventArgs e ) {
decimal new_val;
if ( e.Delta > 0 ) {
new_val = this.Value + this.Increment;
} else if ( e.Delta < 0 ) {
new_val = this.Value - this.Increment;
} else {
return;
}
if ( this.Minimum <= new_val && new_val <= this.Maximum ) {
this.Value = new_val;
}
}
}
}

View File

@ -1,506 +0,0 @@
/*================================================================================
File: OpenFileDialog.cs
Summary: This is part of a sample showing how to place Windows Forms controls
inside one of the common file dialogs.
----------------------------------------------------------------------------------
Copyright (C) Microsoft Corporation. All rights reserved.
This source code is intended only as a supplement to Microsoft Development Tools
and/or on-line documentation. See these other materials for detailed information
regarding Microsoft code samples.
This sample is not intended for production use. Code and policy for a production
application must be developed to meet the specific data and security requirements
of the application.
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
================================================================================*/
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
using System.IO;
namespace ExtensibleDialogs {
/// <summary>
/// The extensible OpenFileDialog
/// </summary>
public class OpenFileDialog : IDisposable {
// The maximum number of characters permitted in a path
private const int _MAX_PATH = 260;
// The "control ID" of the content window inside the OpenFileDialog
// See the accompanying article to learn how I discovered it
private const int _CONTENT_PANEL_ID = 0x0461;
// A constant that determines the spacing between panels inside the OpenFileDialog
private const int _PANEL_GAP_FACTOR = 3;
/// <summary>
/// Clients can implement handlers of this type to catch "selection changed" events
/// </summary>
public delegate void SelectionChangedHandler( string path );
/// <summary>
/// This event is fired whenever the user selects an item in the dialog
/// </summary>
public event SelectionChangedHandler SelectionChanged;
public delegate void FolderChangedHandler( string path );
public event FolderChangedHandler FolderChanged;
// unmanaged memory buffers to hold the file name (with and without full path)
private IntPtr _fileNameBuffer;
private IntPtr _fileTitleBuffer;
private IntPtr _initialDirBuffer;
// user-supplied control that gets placed inside the OpenFileDialog
private System.Windows.Forms.Control _userControl;
// unmanaged memory buffer that holds the Win32 dialog template
private IntPtr _ipTemplate;
private string _filter;
private string _fileName;
private string _defaultExtension;
private int _filterIndex;
private short _fileOffset;
private short _fileExtension;
private string _initialDir;
public string InitialDirectory {
get {
return _initialDir;
}
set {
_initialDir = value;
if ( !Path.IsPathRooted( _initialDir ) ) {
if ( !Directory.Exists( _initialDir ) ) {
_initialDir = Path.GetDirectoryName( _initialDir );
}
}
_fileName = "";
UnicodeEncoding ue = new UnicodeEncoding();
byte[] zero = new byte[2 * _MAX_PATH];
for ( int i = 0; i < 2 * _MAX_PATH; i++ ) {
zero[i] = 0;
}
Marshal.Copy( zero, 0, _initialDirBuffer, 2 * _MAX_PATH );
Marshal.Copy( zero, 0, _fileNameBuffer, 2 * _MAX_PATH );
if ( _initialDir.Length > 0 ) {
byte[] initial_dir_buffer = ue.GetBytes( _initialDir );
Marshal.Copy( initial_dir_buffer, 0, _initialDirBuffer, initial_dir_buffer.Length );
}
}
}
public int FilterIndex {
get {
return _filterIndex;
}
set {
_filterIndex = value;
}
}
public OpenFileDialog( System.Windows.Forms.Control userControl )
: this( "", "", "", userControl ) {
}
/// <summary>
/// Sets up the data structures necessary to display the OpenFileDialog
/// </summary>
/// <param name="defaultExtension">The file extension to use if the user doesn't specify one (no "." required)</param>
/// <param name="fileName">You can specify a filename to appear in the dialog, although the user can change it</param>
/// <param name="filter">See the documentation for the OPENFILENAME structure for a description of filter strings</param>
/// <param name="userPanel">Any Windows Forms control, it will be placed inside the OpenFileDialog</param>
private OpenFileDialog( string defaultExtension, string fileName, string filter, System.Windows.Forms.Control userControl ) {
_filter = filter;
_fileName = fileName;
_defaultExtension = defaultExtension;
// LipSync Character Config(*.lsc,content.xml)|*.lsc;content.xml|All Files(*.*)|*.*
// ↁE
// LipSync Character Config(*.lsc,content.xml)\0*.lsc;content.xml\0All Files(*.*)\0*.*\0\0
filter = filter.Replace( "|", "\0" ) + "\0\0";
// Need two buffers in unmanaged memory to hold the filename
// Note: the multiplication by 2 is to allow for Unicode (16-bit) characters
_fileNameBuffer = Marshal.AllocCoTaskMem( 2 * _MAX_PATH );
_fileTitleBuffer = Marshal.AllocCoTaskMem( 2 * _MAX_PATH );
_initialDirBuffer = Marshal.AllocCoTaskMem( 2 * _MAX_PATH );
// Zero these two buffers
byte[] zeroBuffer = new byte[2 * (_MAX_PATH + 1)];
for ( int i = 0; i < 2 * (_MAX_PATH + 1); i++ ) {
zeroBuffer[i] = 0;
}
Marshal.Copy( zeroBuffer, 0, _fileNameBuffer, 2 * _MAX_PATH );
Marshal.Copy( zeroBuffer, 0, _fileTitleBuffer, 2 * _MAX_PATH );
Marshal.Copy( zeroBuffer, 0, _initialDirBuffer, 2 * _MAX_PATH );
_filterIndex = 0;
_fileOffset = 0;
_fileExtension = 0;
// keep a reference to the user-supplied control
_userControl = userControl;
}
public string FileName {
get {
return _fileName;
}
set {
if ( value == null ) {
return;
}
_fileName = value;
string folder;
if ( Path.IsPathRooted( _fileName ) ) {
folder = _fileName;
_fileName = "";
} else {
if ( Directory.Exists( _fileName ) ) {
folder = _fileName;
_fileName = "";
} else {
if ( _fileName != "" ) {
folder = Path.GetDirectoryName( _fileName );
} else {
folder = "";
}
}
}
#if DEBUG
LipSync.Common.DebugWriteLine( "FileName.set(); folder=" + folder );
LipSync.Common.DebugWriteLine( "FileName.set(); _fileName=" + _fileName );
#endif
byte[] zero = new byte[2 * _MAX_PATH];
for ( int i = 0; i < 2 * _MAX_PATH; i++ ) {
zero[i] = 0;
}
Marshal.Copy( zero, 0, _fileNameBuffer, 2 * _MAX_PATH );
Marshal.Copy( zero, 0, _initialDirBuffer, 2 * _MAX_PATH );
UnicodeEncoding ue = new UnicodeEncoding();
if ( _fileName.Length > 0 ) {
byte[] file_name_bytes = ue.GetBytes( _fileName );
Marshal.Copy( file_name_bytes, 0, _fileNameBuffer, file_name_bytes.Length );
}
if ( folder.Length > 0 ) {
byte[] initial_dir_bytes = ue.GetBytes( folder );
Marshal.Copy( initial_dir_bytes, 0, _initialDirBuffer, initial_dir_bytes.Length );
}
#if DEBUG
LipSync.Common.DebugWriteLine( "FileName.set(); _fileNameBuffer=" + Marshal.PtrToStringUni( _fileNameBuffer ) );
LipSync.Common.DebugWriteLine( "FileName.set(); _initialDir=" + Marshal.PtrToStringUni( _initialDirBuffer ) );
#endif
}
}
public string Filter {
get {
return _filter;
}
set {
_filter = value;
}
}
public string DefaultExt {
get {
return _defaultExtension;
}
set {
_defaultExtension = value;
}
}
/// <summary>
/// The finalizer will release the unmanaged memory, if I should forget to call Dispose
/// </summary>
~OpenFileDialog() {
Dispose( false );
}
/// <summary>
/// Display the OpenFileDialog and allow user interaction
/// </summary>
/// <returns>true if the user clicked OK, false if they clicked cancel (or close)</returns>
public System.Windows.Forms.DialogResult ShowDialog() {
// Create an in-memory Win32 dialog template; this will be a "child" window inside the FileOpenDialog
// We have no use for this child window, except that its presence allows us to capture events when
// the user interacts with the FileOpenDialog
_ipTemplate = BuildDialogTemplate();
// Populate the OPENFILENAME structure
// The flags specified are the minimal set to get the appearance and behaviour we need
OpenFileName ofn = new OpenFileName();
ofn.lStructSize = Marshal.SizeOf( ofn );
ofn.lpstrFile = _fileNameBuffer;
ofn.nMaxFile = _MAX_PATH;
ofn.lpstrDefExt = Marshal.StringToCoTaskMemUni( _defaultExtension );
ofn.lpstrFileTitle = _fileTitleBuffer;
ofn.nMaxFileTitle = _MAX_PATH;
string filter = _filter.Replace( "|", "\0" ) + "\0\0";
ofn.lpstrFilter = Marshal.StringToCoTaskMemUni( filter );
ofn.Flags = OpenFileNameFlags.EnableHook | OpenFileNameFlags.EnableTemplateHandle | OpenFileNameFlags.EnableSizing | OpenFileNameFlags.Explorer;
ofn.hInstance = _ipTemplate;
ofn.lpfnHook = new OfnHookProc( MyHookProc );
ofn.lpstrInitialDir = _initialDirBuffer;
ofn.nFilterIndex = _filterIndex;
ofn.nFileOffset = _fileOffset;
ofn.nFileExtension = _fileExtension;
// copy initial file name into unmanaged memory buffer
UnicodeEncoding ue = new UnicodeEncoding();
byte[] fileNameBytes = ue.GetBytes( _fileName );
Marshal.Copy( fileNameBytes, 0, _fileNameBuffer, fileNameBytes.Length );
Marshal.Copy( fileNameBytes, 0, _initialDirBuffer, fileNameBytes.Length );
if ( NativeMethods.GetOpenFileName( ref ofn ) ) {
_fileName = Marshal.PtrToStringUni( _fileNameBuffer );
_filterIndex = ofn.nFilterIndex;
byte[] file_name_buffer = ue.GetBytes( _fileName );
Marshal.Copy( file_name_buffer, 0, _initialDirBuffer, file_name_buffer.Length );
_fileOffset = ofn.nFileOffset;
_fileExtension = ofn.nFileExtension;
return System.Windows.Forms.DialogResult.OK;
} else {
return System.Windows.Forms.DialogResult.Cancel;
}
}
/// <summary>
/// Builds an in-memory Win32 dialog template. See documentation for DLGTEMPLATE.
/// </summary>
/// <returns>a pointer to an unmanaged memory buffer containing the dialog template</returns>
private IntPtr BuildDialogTemplate() {
// We must place this child window inside the standard FileOpenDialog in order to get any
// notifications sent to our hook procedure. Also, this child window must contain at least
// one control. We make no direct use of the child window, or its control.
// Set up the contents of the DLGTEMPLATE
DlgTemplate template = new DlgTemplate();
// Allocate some unmanaged memory for the template structure, and copy it in
IntPtr ipTemplate = Marshal.AllocCoTaskMem( Marshal.SizeOf( template ) );
Marshal.StructureToPtr( template, ipTemplate, true );
return ipTemplate;
}
/// <summary>
/// The hook procedure for window messages generated by the FileOpenDialog
/// </summary>
/// <param name="hWnd">the handle of the window at which this message is targeted</param>
/// <param name="msg">the message identifier</param>
/// <param name="wParam">message-specific parameter data</param>
/// <param name="lParam">mess-specific parameter data</param>
/// <returns></returns>
public IntPtr MyHookProc( IntPtr hWnd, UInt16 msg, Int32 wParam, Int32 lParam ) {
if ( hWnd == IntPtr.Zero )
return IntPtr.Zero;
// Behaviour is dependant on the message received
switch ( msg ) {
// We're not interested in every possible message; just return a NULL for those we don't care about
default: {
return IntPtr.Zero;
}
// WM_INITDIALOG - at this point the OpenFileDialog exists, so we pull the user-supplied control
// into the FileOpenDialog now, using the SetParent API.
case WindowMessage.InitDialog: {
if( _userControl != null ){
IntPtr hWndParent = NativeMethods.GetParent( hWnd );
NativeMethods.SetParent( _userControl.Handle, hWndParent );
}
return IntPtr.Zero;
}
// WM_SIZE - the OpenFileDialog has been resized, so we'll resize the content and user-supplied
// panel to fit nicely
case WindowMessage.Size: {
FindAndResizePanels( hWnd );
return IntPtr.Zero;
}
// WM_NOTIFY - we're only interested in the CDN_SELCHANGE notification message:
// we grab the currently-selected filename and fire our event
case WindowMessage.Notify: {
IntPtr ipNotify = new IntPtr( lParam );
OfNotify ofNot = (OfNotify)Marshal.PtrToStructure( ipNotify, typeof( OfNotify ) );
UInt16 code = ofNot.hdr.code;
if ( code == CommonDlgNotification.SelChange ) {
// This is the first time we can rely on the presence of the content panel
// Resize the content and user-supplied panels to fit nicely
FindAndResizePanels( hWnd );
// get the newly-selected path
IntPtr hWndParent = NativeMethods.GetParent( hWnd );
StringBuilder pathBuffer = new StringBuilder( _MAX_PATH );
UInt32 ret = NativeMethods.SendMessage( hWndParent, CommonDlgMessage.GetFilePath, _MAX_PATH, pathBuffer );
string path = pathBuffer.ToString();
// copy the string into the path buffer
byte[] zero = new byte[2 * _MAX_PATH];
for ( int i = 0; i < 2 * _MAX_PATH; i++ ) {
zero[i] = 0;
}
Marshal.Copy( zero, 0, _fileNameBuffer, 2 * _MAX_PATH );
UnicodeEncoding ue = new UnicodeEncoding();
byte[] pathBytes = ue.GetBytes( path );
Marshal.Copy( pathBytes, 0, _fileNameBuffer, pathBytes.Length );
_fileName = path;
#if DEBUG
LipSync.Common.DebugWriteLine( "ExtensibleDialog.OpenFiledialog.MyHookProc; SelChange; _fileName=" + path );
#endif
// fire selection-changed event
if ( SelectionChanged != null ) {
SelectionChanged( path );
}
} else if ( code == CommonDlgNotification.FolderChange ) {
// This is the first time we can rely on the presence of the content panel
// Resize the content and user-supplied panels to fit nicely
FindAndResizePanels( hWnd );
// get the newly-selected path
IntPtr hWndParent = NativeMethods.GetParent( hWnd );
StringBuilder pathBuffer = new StringBuilder( _MAX_PATH );
UInt32 ret = NativeMethods.SendMessage( hWndParent, CommonDlgMessage.GetFolderPath, _MAX_PATH, pathBuffer );
string path = pathBuffer.ToString();
// copy the string into the path buffer
byte[] zero = new byte[2 * _MAX_PATH];
for ( int i = 0; i < 2 * _MAX_PATH; i++ ) {
zero[i] = 0;
}
Marshal.Copy( zero, 0, _initialDirBuffer, 2 * _MAX_PATH );
Marshal.Copy( zero, 0, _fileNameBuffer, 2 * _MAX_PATH );
UnicodeEncoding ue = new UnicodeEncoding();
byte[] pathBytes = ue.GetBytes( path );
Marshal.Copy( pathBytes, 0, _initialDirBuffer, pathBytes.Length );
// fire selection-changed event
if ( FolderChanged != null ) {
FolderChanged( path );
}
}
return IntPtr.Zero;
}
}
}
/// <summary>
/// Layout the content of the OpenFileDialog, according to the overall size of the dialog
/// </summary>
/// <param name="hWnd">handle of window that received the WM_SIZE message</param>
private void FindAndResizePanels( IntPtr hWnd ) {
// The FileOpenDialog is actually of the parent of the specified window
IntPtr hWndParent = NativeMethods.GetParent( hWnd );
// The "content" window is the one that displays the filenames, tiles, etc.
// The _CONTENT_PANEL_ID is a magic number - see the accompanying text to learn
// how I discovered it.
IntPtr hWndContent = NativeMethods.GetDlgItem( hWndParent, _CONTENT_PANEL_ID );
Rectangle rcClient = new Rectangle( 0, 0, 0, 0 );
Rectangle rcContent = new Rectangle( 0, 0, 0, 0 );
// Get client rectangle of dialog
RECT rcTemp = new RECT();
NativeMethods.GetClientRect( hWndParent, ref rcTemp );
rcClient.X = rcTemp.left;
rcClient.Y = rcTemp.top;
rcClient.Width = rcTemp.right - rcTemp.left;
rcClient.Height = rcTemp.bottom - rcTemp.top;
// The content window may not be present when the dialog first appears
if ( hWndContent != IntPtr.Zero ) {
// Find the dimensions of the content panel
RECT rc = new RECT();
NativeMethods.GetWindowRect( hWndContent, ref rc );
// Translate these dimensions into the dialog's coordinate system
POINT topLeft;
topLeft.X = rc.left;
topLeft.Y = rc.top;
NativeMethods.ScreenToClient( hWndParent, ref topLeft );
POINT bottomRight;
bottomRight.X = rc.right;
bottomRight.Y = rc.bottom;
NativeMethods.ScreenToClient( hWndParent, ref bottomRight );
rcContent.X = topLeft.X;
rcContent.Width = bottomRight.X - topLeft.X;
rcContent.Y = topLeft.Y;
rcContent.Height = bottomRight.Y - topLeft.Y;
// Shrink content panel's width
int width = rcClient.Right - rcContent.Left;
if ( _userControl != null ) {
rcContent.Width = (width / 2) + _PANEL_GAP_FACTOR;
} else {
rcContent.Width = width + _PANEL_GAP_FACTOR;
}
NativeMethods.MoveWindow( hWndContent, rcContent.Left, rcContent.Top, rcContent.Width, rcContent.Height, true );
}
if( _userControl != null ){
// Position the user-supplied control alongside the content panel
Rectangle rcUser = new Rectangle( rcContent.Right + (2 * _PANEL_GAP_FACTOR), rcContent.Top, rcClient.Right - rcContent.Right - (3 * _PANEL_GAP_FACTOR), rcContent.Bottom - rcContent.Top );
NativeMethods.MoveWindow( _userControl.Handle, rcUser.X, rcUser.Y, rcUser.Width, rcUser.Height, true );
}
}
/// <summary>
/// returns the path currently selected by the user inside the OpenFileDialog
/// </summary>
public string SelectedPath {
get {
return Marshal.PtrToStringUni( _fileNameBuffer );
}
}
#region IDisposable Members
public void Dispose() {
Dispose( true );
}
/// <summary>
/// Free any unamanged memory used by this instance of OpenFileDialog
/// </summary>
/// <param name="disposing">true if called by Dispose, false otherwise</param>
public void Dispose( bool disposing ) {
if ( disposing ) {
GC.SuppressFinalize( this );
}
Marshal.FreeCoTaskMem( _fileNameBuffer );
Marshal.FreeCoTaskMem( _fileTitleBuffer );
Marshal.FreeCoTaskMem( _initialDirBuffer );
Marshal.FreeCoTaskMem( _ipTemplate );
}
#endregion
}
}

View File

@ -1,14 +0,0 @@
$file = $ARGV[0];
$index = rindex( $file, "." );
$newfile = substr( $file, 0, $index ) . "_.resx";
open( FILE, $file );
open( EDIT, ">" . $newfile );
while( $line = <FILE> ){
# chomp $line;
$line =~ s/[\\]/\//g;
print EDIT $line;
}
close( FILE );
close( EDIT );

View File

@ -1,468 +0,0 @@
/*
* AppManager.cs
* Copyright (c) 2008-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace LipSync {
public static class AppManager {
public static bool Playing = false;
public static SettingsEx SaveData;
public static EnvSettings Config;
internal static List<Command> m_commands = new List<Command>();
internal static int m_command_position = -1;
private static readonly Bitmap m_author_list = null;
/// <summary>
/// telopの描画に必要な最大のトラック数
/// </summary>
public static int MaxTelopLanes = 0;
private static bool m_edited;
/// <summary>
/// Editedプロパティが変更された時発生します
/// </summary>
public static event EventHandler EditedChanged;
#region _AUTHOR_LIST
private const string _AUTHOR_LSIT = "iVBORw0KGgoAAAANSUhEUgAAATIAAAKQCAYAAAAc+va9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYA" +
"AICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAOCZJREFUeF7tnc/LRW1X1yUiREQQQRQHgkS8BOLAiRDJE1SDEKFZieRM" +
"IifhIEiCl5pa2CwKtSQImhQ1iKShgqX+BeaP9z95O+vtrMf1fJ+1rh9773PO3vv63HC4zzn7+rHW59r7e6917Wtf93d9Fz8QgAAE" +
"IAABCEAAAhCAAAQgAAEIQGATgT961LJX62ekTFb/Zx9f/s6zfWvD3v/KJiupBAEIQKBBYESkRspoFz//+OLbz5fX98+/yohAAAIQ" +
"OJKAi8yPPRq1V+tnpIzX93a/eHzxvY/Xjz5e33y8/uzx+tPH6weOdIK2IACBtQmMCJmW8c+/9EDn7y0Ciz/2vUVg//zx+sbz5ULo" +
"n//3s/4PPyvab09B7avYtqeo9vsnpS/r28v++trDifcQWJPAjJA5IRcpE6r43ubE/MfSR08lLQr714+XC9b3P96bqP3nZxkXQU9H" +
"XYyqfkzM/Mf6dDu8PPNwa57LeL0wgRkh84jKBcOEyL77j08x+YPH7+8LLE1QTMTiXFmMmFy4/ueznf/6LPsLz8+Wglpd7+fvPT9b" +
"m5aqfvfjZaJmZb54vH762Z/Z8UMLjymuQ2A5AluFzOr91ONlaeJffwrIt56fbU7Mf37w8ebXHi875oL2m8+Dnkr+ybPeHz9+W7sm" +
"htaufW+fTSw9HTUR835MzNx+69PKxPSVebjlTmccXpXAEUL2E09BcUEygYk/JigmMCZoJmYmRh4xeUT1T57H7POPiLC5kFkds9cE" +
"z0XL7bc+7bvvebwsUrM6aseqY4zfELg9ga1CFlO+f/UUod8NEVG8IeAQbT4rRlQmTD6XZumgtWmfYwrrEZnfUVV7XQh/8VHP2vfj" +
"tx84HIQABP6cgM93mcDYy4XAfvuPikechI9zYH83iJDNj8W5sVjnHz6jJxOnL0I5K/93nsdi2hiXfagtPtnv9lsb3LnkDIfAYgRc" +
"GGaFzOp98/H61uNlKaVN3Nt8mKV3ntKZmFmkZW1bOmjRkwmPpX8qTiZA1paniNZWFi1m31nfdmPA6v/W4+WpZW9d3GJDjbsQuD8B" +
"n4dygYm/3fss5YtrxPx9nOy3+bFqHZnf4fT08A9DWRM77TeOgi7OzSb7uXN5//MWDyHwFQKZgKlYVHNXvi7MjsflF96BiZlFWl7f" +
"3kexcyH75aeQaSSVPVGQfWd9+/eIGCc4BCAwRGDmkaWRBj2t5G7jCC3KQAAChxB4lZBlUd0hBtMIBCAAAQhAAAIQgAAEIAABCEAA" +
"AhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEI" +
"QAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABDYT" +
"+Pbmml+teFQ7mTmvbHvW/ZYtZ7Jz1i/KQwACDwKvvIhf2fbs4CFks8QoD4E3EvjGjr7ixb2nncoEb/8Vbc+43fLz1Qxm7KQsBJYi" +
"oNGFffZXD0Qspxdx1k4WycTvqr5H2jZbvVxmf+uY1638bvkZGWkf6pvyjOV7rDkOAQg0CLQuttEUKl7oFjFl4hiFxs0Z7XumXFVW" +
"RWqmzWhvKzL0PmLUWIlViy0nLAQgMEkgXpgqSHZBZqmcXoRRvKpjsYy3GS/y2I+XzcpF96pysZ62ocdG7PU+Mx+yiMz7iPapAGqU" +
"ae18Om2ePHUoDoHzEMgiDE3x9ALLLkL7zi/cWD+L1jRqy8qrwGpE1xI5F+AsGsqOVfa2/GwJfPwDoDao74jXea4FLLkogSq90ou9" +
"mttRMYlik12gWYQyWqcqV4lVLF8JUq/vkSgqS5NbqSVCdtGLBbPPS6A1T+QXeZZeVumoCkMUriiOHr15OhXb0zqZjZWAxna1XuuY" +
"21H1HSPNmGZqWtkSvpbgnvcMwTIIXIBAduFpWlnN3cSUsdVOL5qLohTbrCKdzD6NvqKI9Y5pOpzZm6WHlV+VfZUYqq0XOG0wEQLn" +
"JBBToSolzCzXeq12tN0s0svKZBGQltPUMUvtYtQ10mblS2Z3ZNPySyPRc54NWAWBixKoRKZ30ao4tNpRNNUkt/fZErXYbzXnFFNZ" +
"Fa7Kr6rvnp8qZGqfRpcjIn7RUwmzIQCBrQQ0tY3ttI5t7W+2nqbMlYjPtkt5CEDghgRaAnEm8TiTLTc8DXAJAtcmcHYhG0nVrz0C" +
"WA8BCEAAAhCAAAQgAAEIQAACEIAABCAwSqC1CHTrsdG+W+VYnHoERdqAwCIEPilWiyDGTQhA4NUE9q77evXyhVe3/2q+tA8BCLyB" +
"wOjD1dUzk2ZifP4xi/D2PJP5BgR0AQEIXJ1AFLJMrHo7VbiQ6Q4XzqUngKP1rs4Z+yEAgRcSyLa0se7ic5Oe3mWi1isXTfeysT3v" +
"ywWxOvZCBDQNAQhcnUBrq6AYralgZZGcPhweRUn70fZa7V+dMfZDAAIvJqCCFCfXq/mznuj00tVWxFcdezEGmocABK5M4J1C5lFZ" +
"K3JDyK58NmE7BD5EIIu6WilhJjStyM3nvnQurppbQ8g+dCLQLQTuQCCmlCMbKbrPo/W03JZ6d+CMDxCAwAsJtMQr7tbaKxdNzMr6" +
"dwjZCweTpiEAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCDwcQKf2GPsFRshvqLNjw8OBkAAAmMEXi1k1VY9Y9aNlzpK" +
"yI5qZ9xySkIAArsIxIs225RQV+Fv6awlZEdthNjzY8ZuhGyGFmUhsJNAthOFNRkf76lEJNuOR0VltJ1eRBefmZyxT9tt2aNC1vJ7" +
"1l632f2Iw4bo7TyJqb42geoijxedE4pl9X0r4ooXbnzWMYpR1oeOjPaxtV0VkswvtbOyrydmVk/3Ohvxde2zEu8hsIPA6AaEevFm" +
"D2Jn0Ua8oDOh0P4zIYuPLWXClqWYo35plBf71wfaXaDcngy72ac7bni5ytejUuQdpwFVIXA9AjGtrCIcvRizeaR40bYiqShgWd9V" +
"ZFf1GQUl1t3il9vmvoxEmaP29uy/3pmDxRA4CYFeWhmjhyxayVKman7MBadK4xTJTDsz6WpLUPSYC1qWClaRVlU2E7yWUJ7kFMEM" +
"CJyfQHXhqjBUQhEjGBW93gUdhTGKQkwde+mppmmtPjPhaQmg2hTtVbuy9DJLe13MtS3SyfNfK1h4cgKagmnkVEVdMQ3tpWDZBaxz" +
"Tq1Jc7/wY4Q0IhTRtxG/qqgpCk3GK/oXxTSL6CK3THhPfrpgHgTOS0Ajgvh59Fhr0ju70Ef76KWco/apDTP1enUz/6oItdXvec8Q" +
"LIPARQjElG5GZKKAtVKk3gVcpZSZkG2xT4V2j5C5cI3YnAl8VY8U8yIXC2ZCAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAA" +
"AQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAE" +
"IAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAROQKD337lfYWL2n7Jf1c9R7bY4bWX47npHsaAdCHyU" +
"QHbhbL2Ytjryzv6O7Ash+/8jfiTTrecQ9RYn0BKyd/2H6mhD9h+0jxoi7WdPu622tvaztV4Uk3eNWWSHkO05k6j7NQKenumJVX2O" +
"5f0C8LJVqtfroxelaLuZDdnQjvQb+87sV98qEe/5rlGIsYt1VJAq272daJf7ngnSLANva6Rer2y0NeNs30WbZ/rkUobAlwRa4jVy" +
"LAqZl/cLNJ7k1V/i6uIfrWvlqmiiZ39LwLJjesHN2KjikzGq+KkAVnZXIjbCfs+Y9Ti3+o/j12un9ceOSxoCXxLwk1mjrOyz/yX1" +
"lC5ehH7h6cXhJ238K6z1KrGo6nr/ehHrST/im/ZdcYhttfqpjqkwRd9ax1o8M0HP+o8peDVmekn02EVuPTbav54/MbIcPU+4hCHw" +
"ZWqjIX28aLL0MZ5w8eLTE1PTJS0bL6aWGFViWkVk0Z+eb+qrfs5s9O9a/VS+qyBF3/xY1q6KnNYb4adC4fwyn9UGFdw41lnZzP8s" +
"iu35nI0Ply4EviTQC+Wzkz67mPSE1dRHxSaKgApiloZkUVrrIlGx1CFv2asiU/WjPqiIZDa0uPSYqQCosLcispZtKk5ZRJjZltXT" +
"uhrxZWObiWNvvLiEIfAVAtkFnYX6/td29GKavWBbUVU81rqgqpM/+pP5lkVH2k+WgmUsYlpVRThZvRbfmTariCwTvZE/PlFkZthp" +
"2Vb/WaRd+VydJ1zWEPhaaqnCkUUefuFlJ2EViejF2oua4gX/6rqVUEUxiqlTPG00LcoEtYreol+ZDZnfzm0kIoxlq+i7NYbqs4pz" +
"Nkajfug5NGMrly0EUgL6lzx+1vfVseyv5WjZLPVRsag+H1m3x6F3fMRGj1a87Fa+rXo6yEfYrePbanOm7J52uJwh8DUCfoHpheYn" +
"pZ9wWy+82E7v5M2GJ9rXErk9dUcu+MqOln8thqPHMsGOYzUi6NXY9v5oZD637GmdQxnj6rst5wmXNgQgAAEIQAACEIAABCAAAQhA" +
"AAIQgAAEIAABCEDgKwR0yUKFZ7QceCEAAQi8ncCoQI2WcweqBbdvd5AOIQCBNQiY6PgygGwFflw0qgtcK4HTxaxGclYM16CPlxCA" +
"wCEEqhX9sXFdza7HslX1USCtvIklYnbIkNEIBCDg0ZFGV62FwC5K2aLibHGoPp4TI77ewlZGCAIQgMBmAlGstJEqIosRVhS0WD4K" +
"Vyuy22w4FSEAgbUJ6KM5WeqnYpWlnC3hQ8jWPsfwHgIvJ5BN5Fe7SPg818jcWS+CI718+dDSAQTWINCaeNflE3GyXsXvCIFbgzhe" +
"QgAChxJQEdNJfP+cCZpGZHp3Mh7XyIs5skOHkcYgsDaB1rxXNQeWTey7iFXRHUK29nmG9xB4OYFWJKWdxzVg1eR9b95rVDxf7jgd" +
"QAAC9yKQTfZnHurK/7gGLc6RZRGYls3m1O5FFW8gAIG3E+hFUll0NvJd5chsf28HQocQgMA1CWST/S1PshX+o+WvSQirIQABCEAA" +
"AhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEI" +
"QAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEI7CIQ/1t4fL+r" +
"USpDAAIQOIrArDDNlnc7t9Y7yk/agQAEbkxgRmBi2dn/HD7Tz41x4xoEIGAETBD8pUSqYy4iWi+Wd2GKZb0/jap6/bTKRwHstaMp" +
"beU3ZwYEIHAhAhrVtOauMhHI0jwvF4WsateFRMWoSh+zdlQwK5tGfbvQ8GEqBCCgImaC4K/smH2nohE/63ttK6uromdlev3YyMVy" +
"/j6O6Eg7sW+3lbMCAhC4GIHW/FR2LF74KgKaPrrYxFQyEzZtR8tn0Z2mpypkPcFspaKz83QXG3LMhcD9CKhIRA+zYyNipQLY+lwJ" +
"adVPlRpGIctS1J5NWUR3v9HGIwjclEAV7WhUpBHQiDhl81YqGD4/lkVvWZ8j82NZvy1743wa6eVNT3Tcuj8BFxOdE3MhiWITL/qW" +
"+MzMcbX6ceHTCC1+P3PHsirbSrHvfwbgIQRuQkDnheLnVxyLIujvR/vRqKlVL+snDlk2H8Yc2U1OatxYk4ALRHVxZ2lXT3xmBXHE" +
"hlERHLE3iihp5ZrnPV5DAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACELg3" +
"gew5Tn2mU5+j1Gc7s2c9700N7yAAgdMQ6AmWGxqFTHe3qLbtOY2TGAIBCNybQLZ1TtxiJ9vSx4homSh4PNB973MG7yBwOgIxrdR9" +
"x3ybn2p/Md0osdo48XROYxAEIHAvArppo3sXRSmWqTZ51I0SicrudZ7gDQROTSAKk4tX3Conbr6YRVw9YTu18xgHAQjch0Bv91mP" +
"rhCy+4w5nkDglgRmdnCNk/0xFY1gSC1veZrgFATOT6C382tLqHpCeH7vsRACEIAABCAAAQhAAAIQgAAEIAABCEDgjgSy/4Fpfo48" +
"F1nVdU6t4/o4U7bottf+HccDnyAAgUkC+pB3JkAjYlR1O1sX4ZocQIpDYHUCow+C63OUMVrTtWVVVFX1ZW15+1nd1h3S1ccP/yEA" +
"gZA6xhRSBScul8iiperRJY3sdNlF9hB6HJRMPBk0CEAAAiWBTLw0OvLKmSDFqCmu7tdHmbycCmcrihuZp2NoIQABCHxnUl9TuNaK" +
"+/jgtwtNVb6K2Kq5uSqNZZggAAEIpASySEgLZtFWTBtVkKq5sFYk50IaBTX7jseZOJEhAIFuaplFWjqZr3NfWTQXxWw0Issm/Nny" +
"h5MWAhDoEojRVLU1jwpXS8jsWGzHPveELLuZEL+Lc25dhygAAQisR2AkLYwT9P4+kmrdtYzzXdVdy14UmInaeiOFxxCAQDelVDHK" +
"UrqZyMo7HBUyFVTtnyGEAAQg0CWg82AqJHEJRC+y0s5mBTDaondSu45QAAIQWI9AJWA6D9ZK71qp5agAtoSUdWTrnZd4DIFdBKoI" +
"KE64V0sgeksjZusRje0aSipDYD0CPdHoiZQRa5XJbhLEebT4Pivbs2+9EcNjCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQWJJA" +
"a6ucDEhVfqasPkBudWfaXXKgcBoCEJgjkAlNq4WZ8keURfTmxpPSEFiGQPbsZG95hD5Q3loTlpXNyld2xIGoxHBGJJcZWByFwGoE" +
"VAh668Rmyh9ZNj41ENeS2fc9m1cbU/yFwFIEZoQmm9NqCchM25o2Zu3OPqe51EDiLARWI9Ca6G89y5gJk363pe2Rdl1E7ffsg+qr" +
"jS/+QmBJAiMPYmdiE+e1KnC9tmfa7U32k14uefri9OoEqol4fZaxlyJmc1Qjbc+2W6WWPo4I2epnNP4vSaCKhlowRueuZtseabea" +
"7G/dZV1yYHEaAisRiGIzEs1UZbJIaabt0XZ7EdlKY4evEIDAk8BeYdD5ryhIe9qu2t3TJoMOAQjcmEA2gd6buK8m8LO7idp+1nav" +
"jLY7Ej3eeMhwDQIQyAjsFYbekwBbqVft7rV3qz3UgwAETk4g3qnsTZ5r2Z5ro23Pttvrl+MQgAAEIAABCEAAAhCAAAQgAAEIQAAC" +
"ENhCQBeyWhv+XfZc5ZY+qAMBCEBgE4FMoLKGELJNeKkEAQi8gsDW6EkXnWYr9H35Qywb14LN+LNHYLWf3nq0GbsoCwEInIBATAdn" +
"LvBMkDJxi4tiZ0Vz1J7RcjH9jehHRfIEw4UJEIBAlSLahVxFT3rBq4D57hUuEtVD3bEPKzuytU8mNr1Frq3Hk1Sw4no0xIzrAwIX" +
"JpBFUb0LXNNIFcLsEaS4eFafteyJk4vlyAJct6W1S4YLqQplz44LDzOmQ+DeBKKQxegqRmgtYdI6GnnFdC4TolYE9aqIrCVyiNm9" +
"z3e8uyGBOD8WBSlGLCOT+jqZr/VH0r2egBwheEfYccPTAJcgcG0CCNmfj9+oUF57xLEeAjckoJGUR0U6h9WK0DR1dEzZTYCYrmY3" +
"DVqIR4Vma9Q12v4NTwNcgsC1CaiQZRdzljbqZHlWrxIyvTvogvaO1NJFN5vziwJ87VHFeggsRiCmltlFnt2ddETxWC+aaYlh6y7j" +
"0ZP90XaNCBGyxU5+3L0XAb3L6JGURk4xitEUsScC2Q0DF5JYtxeVaSTYGoleW9nxXp17jTzeQOBmBHRuTC/o1udM4Co8rbKjInJk" +
"OV8Oki0LudkQ4w4E1iBQRSgjwjEqBJkgjtZdYxTwEgIQgAAEIAABCEAAAhCAAAQaBPTmQQtWVja7SwpwCEAAAm8lMCpkVTmE7K3D" +
"RWcQgEBGoLfWzOqoWMVlHt5m/G7kRgSjAQEIQOAwAiNCFsVMF+v6sezxqcOMpCEIQAACI/NeI1GUPlHg7WZp50h7jAwEIACBQwjE" +
"R4Kqx4NiROZPGGTpZeupg0OMpREIQAACe+bIVPBc3OL38YF0aEMAAhB4G4E4R6aPBmW7UVSPM808EvU25+gIAhBYg8DoZH+c1I+C" +
"5w+3624ZzJGtcf7gJQROQWBEyPROZbZ2LLubeQoHMQICELg/gS1CFufCtD7zZPc/Z/AQAqcjsEfIomjFu5m6l9rpnMYgCEDgmgSq" +
"ZRat79XTajFstWyDebJrnitYDYHLEhgRHS+T3aHsfXdZMBgOAQicj0C2xKL3nXpRCVps53yeYxEEIAABCEAAAhCAAAQgAAEIQAAC" +
"EIAABCAAAQhAAAIQgAAEIPA+AiPbUrs12a4W0dLRrazjGrPRrYHeR4SeIACByxFwIVHDVeAywWuVGRHIqszlIGIwBCDwWQLVA9zx" +
"caRsE0RfB5ZFYfo4UozosgiutTbts3ToHQIQuASBKGTZXvr6YHdr37FM/LLdYQ1MJXaXgIaREIDAuQio+Kjw9ASnEq9eRGcUZp7d" +
"PBc1rIEABE5F4NVCpnNwVdR3KigYAwEIXIuAbs3j2+q00sRqnkvrxC164nudM2OO7FrnDNZC4HQEXilkPhemc2KZkJ0ODAZBAALX" +
"IaBCFueuohC1IioVKp1Xy9JJ7yf2cR1qWAoBCJyKQCZklci0FsRmO8BWIsWC2FOdAhgDgfsQyDZL9Lmr6GVVripTbcKYba54H5p4" +
"AgEIfITAiOC4YTo5rwaPilTcdLGa8P8IDDqFAAQgAAEIQAACEIAABCAAAQhAAAIQWIZAb4eK2d0pZss76K31lhkoHIUABNoEWtvz" +
"zArMbPmekG1tjzGHAAQWJKAPiuvWProDRoWoWpOWle89MI6ILXgi4jIE9hKIYqZCpqLSEqHqWMu+7DGpWL5aGrLXZ+pDAAI3JpBF" +
"ZO5u9bjRVuHxaC9u1BgX4iJiNz7RcA0CewnEyCm25d+7wPhnK1NtqtjavUKPHR3N7eVAfQhA4AYE9LlHc2l0jmxmTmwmtcxE8wao" +
"cQECEHgVAd/VorczbPbc5R4hi6lkFaX1HoV6FRPahQAELkYgm2jviZq7uEfIYso6M/92MbyYCwEIvINAFKN4d1LnyFrrzWYm5KOA" +
"9ebLsijwHUzoAwIQuBiBKqqqdrDI7lrOCFnEo2mtHmOu7GInE+ZC4BME4qR+a+udaq5qT2oZF9lmdz1bIvcJVvQJAQickMCWRa6Z" +
"G730sLVCv1eXiOyEJw4mQeCsBOIGh1ts3JpaZpP82v/etrf4Qx0IQOBiBFQoRha3Zi5uredRV6v+xZBiLgQgAAEIQAACEIAABCAA" +
"AQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAE" +
"IAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgMCDQOs/jQMIAhCA" +
"wBSBTwnKSL8jZaacpTAEIHBPAp8SC+9X/6N5pPwp2+450ngFgZsSMKHwlwuKi0cUkVguExo/rph69ay89ZuVy2yz8r02Eb+bnqy4" +
"BYEWAY2MVJRUGDKB8/b1WBVdzZZTka36Q8Q41yGwKAG7+E0o/KXCFlM/j55UWOLn+D625e17VOXRWMSeta92efmeLa2UddGhxm0I" +
"3JNAjGAycdK0L0ZrfswFST/HqKlVL6aKsZza1rNVRfOeI4ZXEIDA1wj0xKKXVsboKEZa2m4Uuapc/F7ft0QyK8tQQwACCxHI5sc0" +
"dctSORWmSqgiSk9hq/mxmCpmwtWyNYvWFhpGXIXA2gQ8lavmvDza0TuFLaHxVFNTxphqqjhW7bv4VWmqtsm82NrnM94vTkAFYOZz" +
"q2wmLP6d3kSIQzB6zEVTU9zFhxP3IbAmgXhHUcUhioSXmxWa0XpVuUws1ebK7jVHFK8hAAEIQAACEIAABCAAAQhAAAIQgAAEIAAB" +
"CEAAAhCAAAQgcDYC2WNA+nB4y+ajHsY+qp2z8cUeCEDgDQT2CIjX3dOGu3hEG2/ARRcQgMAZCWS7UMQ1W60V8VHI9q6c18eMzsgK" +
"myAAgZMS2CMgGpHp40xZtKWPHGmZ2EaW4sY+syiuat/6aR076fBgFgQgMEJg6xyZPowdn31UgalS0OwhcX3I3AUoCl5WT8tl9SIP" +
"UtmRs4MyELgIga0RWUvIXESynTAcS9zRIopO9shRJpIxcssiQX2kqWfvRYYLMyEAgYxAb44sS8daUZwKTCYg2ma1Y0avnNarRNnL" +
"qd3GY+/cHmcVBCBwAgJbIjIVp5j2aXQU269SzkqQsvkztTdrPxOnlsidYBgwAQIQ2ENgVMg8VVMR0zucmgbGrXl0bsvLtoTMoyjt" +
"XwWziuoyMYxpLRHZnrOHuhA4CYFWmthKRau0rCVkPhemk/+t1FLnz1oRWWw/m8zP0uSTDANmQAACRxCYjUx65ePxbALfbfZIK36u" +
"3s+0GZmM1juCI21AAAIfJKApot71U9P2CJlHczHtzMRrtpyKl4qkimfPhw8OB11DAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAA" +
"BCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQ" +
"gAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgcAIC2X+sPoFZm0y4ky8O4I4+bRpcKkGgReBO" +
"F8rVfbm6/VuutBV93sKJOg0C8SS6+n+lvoMvrYv66uNTnYYIGRK1m4CfRPbbX7FRPcmyz7ENrZu1mRnd679qJ37fE7JeH1UqV/Vh" +
"5UeOZRdqZkv8zkWr4l2NS49TTzSysexxm+0zO+fsuyjUI33G8Ro9z3ZfMDRwTgJ+AuhJ1Lqos2N6IvUEcFQsW+3GPmK5LHJp2TN6" +
"rGeL2lP5ONJfJmS9elX/s2Mx48eWPiuOLfFW0Ro5P895xWHVSwj4iegnkf2Ofx31ePYX2wzzevF9rGvHR1Kjkf5jXw5F+1dYKnTR" +
"ni0+qjjE/qtj8UKt2Dh7t6/HWy/++Hmkv4xTHMM4ZnvHpmdra1xbdbecZy+5mGj0cwT0JPB0KROneCxerHrxtFKEKlpyoVHBUfuy" +
"C7vVfyVosd0RIdM+Wv6rL+pTlRJVbUbuPi6tcapEPdoV28kiR28j8yWzpxLyTIAy9voHcPR8qFiO/NH83FVHz4cSyC6cllhlaUQv" +
"BdLIoooA4gmZvdd+KvHJLlD1s3XRzfrY8r8S7RhFbrVl5I9KT3BaYzES4UY/Mnv0D1pmj46NjmsmsvpH1j9nEd2hFwyNnZNAFilk" +
"F7KfgLMXuZ6EMZ2rxCqmVtVJnkUjlSjrxRP71RM/8tA+tJ2WkGZRZEvQ3efRNitbsgs8clHfVWhbohLTyhitjQh5dU5lYjnKrhKt" +
"eP6c86rDqsMJ+EmjKUf8Sxsv7uxCq9KVLDXIoqUokiqsvairZVsWbWR+xouyEq8ZH+OFrcIYhSSzxb/rzQepOI1yUnsqIWtNDegf" +
"oMxHTUuzqEo5zfRZlW39MTv84qHB8xHIIqV4suj77JheTJVoZelWVrbqX8u2bFPSWd/+3V4fR/xv+RT9Uju3sGhxin+osrOx1b9G" +
"g3ruHGHrnvOh59v5rj4sOoxAvJgzUfMTK0sj/MT2etlFUB3LhCYr27uwos2VUMYTvGerXqzqYxYR9dqsRLTytycIvT8+lRiMjEXP" +
"1izy6Z03M2OYjVU8V3r29c6Bwy4cGro+gZnU8aretnxcwf9q3LLo86pjjN0Q+Nq6sDv+Jdya5q1wetxxvFcYN3xMCMRU5a4ndsvH" +
"FfyvTvy7jjcXOgQgAAEIQAAC7yJQLWHQ7/fYc2Rbe+ygLgQgcFMCW4RsVphmy4+gfkWbI/1SBgIQOBEBvduoC1Nbd+RmReQVd/dm" +
"bTgRekyBAASOJlCJTFxTF/scXTXeEspMhPy7EYEateFoVrQHAQiclICJgt5xbC2snRWR0fKxXE/MRts8KXLMggAEjiSg4lEtbs0i" +
"stElBy2h1Da8bM+OV6SqR3KlLQhA4I0EZiObmP71oiZ3Q+u06rmAWV0XNX9ftfdGXHQFAQickUAW2WRpZhSRWEdFqZr7iqKkwuSf" +
"o4iZDTGSU1GbteGM7LEJAhA4iMBsiqblRwTKTY03D1yoMjeigNnxWFbfa+SWieRBqGgGAhA4IwFNK3upopavRMXFR0VFd4VQEYyi" +
"5W3HKK1qLxPXaMMZ2WMTBCBwEAGd6O81m82njYpIdmOgigZbUeIeG3r+cRwCELgggWqeqbobmQnMaBvZ3UlNOSPCGK3FObs9Nlxw" +
"iDAZAhAYJeAi42lc/K3ikqVsmv5VaV3VbhWtzUZxmhqPLg8Z5UQ5CEDgxATiBT9y8WdlZttoRWMRVWXPkTaceGgwDQIQ2Eqgtfyi" +
"irb8+1Eh1In/ytYZIZuxYSsb6kEAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEliGQLeVofbcMGByFAASuQ6D3uNN1PMFSCEBg" +
"WQJxBb6uzK82cRxZurEsUByHAATeT6B6dEkjNSK3948NPUIAAoMEekIWH4sabJJiEIAABN5LwIWs2ipI9yMjrXzv+NAbBCAwQCDb" +
"pSLbv8ybQsgGoFIEAhB4LwEVsihiuqEiIvbesaE3CEBgkEBr3zAVssEmKQYBCEDgvQSqnWPNCo/OiMTeOyb0BgEITBCoJvh1Poyl" +
"FxNQKQoBCLyXQLxj2du1Ndtd9r3W0hsEIACBBgFNHWc3SQQuBCAAgY8TcOEa2Q12pMzHHcIACEAAAhCAAAQgAAEIQAACEIAABCAA" +
"AQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACCxOI/zhEMVTHWiv8db+y3s6xrf4XHhZchwAERgm0RKZ3LB7X99Uxs2v02KgPlIMA" +
"BBYnoA+BV6vwdVeLbAcM3eI6rv737X1aD52zc8biJyPuQ2APgSy1i6Kkx3U3WP0cRS62k22BXW0JxDZAe0aUuhBYlED2D0Oq1DLb" +
"1joKUm/jRUNcRW9Z3UWHBLchAIFRAlmqV4map4dbhMznxmK6GefLKmEb9YNyEIDA4gRGUksVnVZKWEVVLoQxIvN2de8yUsvFT0rc" +
"h8AWAq39xeIxvRkwWi+LvqKdo/ubbfGNOhCAwEIEXKSyaCgKmApbJUjaTm/+q9X/QsOAqxCAwBkJkDaecVSwCQIQ2EWA+a9d+KgM" +
"AQh8kgBbXn+SPn1DAAIQgAAEIHBOArrgddTKaqFs1V72vX/Xep5z1B7KQQACNyHQehC7cvGMQma2xnVtmdDpzYObDCFuQAACM5GN" +
"CkUUhlGRyMSmtRDWRih7YkBX+vtIjtwQyBbyciZAAAIXJxBXzreiGnezta4rEzRts1rEmq0f0/a079batewmAWvOLn6yYj4EWqmi" +
"RldZFBSFLAqCLnptRUVRiFRU/FlMjZjiM5pRdNWfXmqp5RE1rgkI3IBAJhg+1xQv8ir9rFbgezqYRV6VWGWiFNNFjRpj21Vau2X+" +
"7wbDigsQWJeAC0X2SJGKSDUfld0EqObVenNZak+M5FpRWRTRzG7mx9Y9x/H85gQ8SqrmrlREekLWE6ks6tMIS/vIbKgiPp3L87oq" +
"gJnw3nyocQ8C9yYQL/boabzY41xVliKO3ASIEVEleNqnC59HW61+Mttj6hnvdkZ/7j26eAeBRQhoxJPNO/XmnLxOa+5MhSYTs0yo" +
"su96kZ+KcxSxGLX12lnkFMBNCNyDQEy9srStEjKfV/P6mrJphKV3PFsRoKaJ0a6Ru6MexcW5s6w/xOwe5zBeQOA7K+NVKOLkf5y3" +
"6kVN2ZxXJRbV/FgmnCOCo0JaRWJZCstpAAEIXJzA6NyTC0Oc78pEIVsiEeu0cGkfUUSrelk6XNmgbYwI5MWHF/MhsBaBmYs6KzsS" +
"efWIVinkXtsyAZtps2c3xyEAgZMQmL2wW3NelXDEOiNuZyluVa9XdrbvEfsoAwEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhBY" +
"gkDr2Uaee1ziFMBJCFyfQOsRJ4Ts+uOLBxBYgoA+zxmdHl2MuwQonIQABD5PoFq9Hx/i1gfM9Vgmcv4d0dvnxxgLIHBrAq0HxrOI" +
"TB9Fip8r4ULIbn0K4RwEPk9An7mMD6KrkMUV9ppa6gPs2c4as08gfJ4OFkAAApcgoA+SV1FYJlzmoItbJWzsWHGJ0wAjIXBtAtWk" +
"vQlUL7V0IbPfldBxU+Da5wfWQ+ASBKLQuHhlUVYrIsuEzL/L9ha7BBiMhAAErkWgd9fSBa6aP0PIrjXeWAuB2xLQifjR/cVa9Ugr" +
"b3u64BgEzkug2vdLRa0SuThnVkVp5/UeyyAAAQgEAp6q+lcsu+D0gAAELk8AIbv8EOIABNYl0NvCel0yeA4BCEAAAhCAAAQgAAEI" +
"QAACEIAABCBwdgJ617Gyd7Tc2f3FPghA4GYERrfcGS13Mzy4AwEIXIGA7lZRLZ0YLXcFn7ERAhC4EYH4zGXc/cJddPEaLXcjNLgC" +
"AQhciUC2dY8KmX0eLXcl37EVAhC4CQHf4SJu5aPRmW73Ez+zkeJNTgTcgMCVCYzu9Dpa7sossB0CELgogdGdXkfLXRQDZkMAAlcm" +
"kO0hFjdU1P+aFO9qZuWuzALbIQCBixJAyC46cJgNAQh8nYBGWlYiW1M2Wg7GEIAABN5OYFSgRsu93QE6hAAEIGAERnd6HS0HVQhA" +
"AAIfJzC60+touY87hAEQgMA6BEZ3eh0ttw45PIUABCAAAQhAAAIQgAAEIAABCEAAAhA4O4FXbY74qnbPzhP7IACBDxB4leC8qt0P" +
"IKJLCEDg7ASyx5GOsPlV7R5hG21AAAI3I1DtYJG5GXeH9eNxp9hYR3eSvRk23IEABM5EoLXLq9qpq/c1fYyfvazulHEm37EFAhC4" +
"CYEsyjLXspX5regt7hBr9atNF2+CDTcgAIEzEchSQxelKgKLW2BH0cuiu6rsmRhgCwQgcHECKj6tZySriCzbaLFX9uLYMB8CEDgT" +
"gZ6QeUQV//lItUNsFZFlqeaZGGALBCBwcQIzc1nVzrHZFj5EZBc/MTAfAlckEFPK3hY8erz1uVf2iqywGQIQOCmBGcGptrvOtvCZ" +
"afekaDALAhCAAAQgAAEIQAACEIAABCAAAQhAYEECoztXjJZbECEuQwACnyYwI1DxyYCZep/2kf4hAIEFCJgoxYWvLZHqLddYABcu" +
"QgACZyRQbc9T2RqfAEDYzjii2ASBRQioeMWozBDEdWKaUs4K3yJIcRMCEDgDARezkSiLObIzjBg2QAAC3yEQ00T73Jsfi3uRaV2Q" +
"QgACEPgIgSptrIxRoRuJ3j7iGJ1CAAJrEGhFX9kxnRtDxNY4T/ASAqclkEVWejdShSrWYY7stEOLYRBYh0AUolZkpRsr+rya3uVc" +
"hxyeQgACpyIwI0YqfNnGi6dyDmMgAIF1CGST/ep9Fb2xnmyd8wRPIXB6AjOT9myeePrhxEAIrEugN9Hvc2MZIdaTrXve4DkEIAAB" +
"CEAAAhCAAAQgAAEIQAACELgLgZnFrdWKf2cx09Zd+OEHBCBwAgKj4lOVY8X/CQYREyCwOoGRxa0qVtWKf2M5s9B2dfb4DwEIHERg" +
"RMhcoLLfmXiNRnkHuUAzEIDA6gRGhSyKmL2Pi2Mz4ZpZaLv6GOA/BCCwk8DonmRR8GL62JojQ8x2Dg7VIQCBMQIjEVn1TKZ+7zvI" +
"jvVMKQhAAAIHEYhC1ntUSSfyY8RVvT/ITJqBAAQgUBMYici8tgtZFDz/Lh7TOTT4QwACEHgpgREh8zL6O94AyI691HAahwAEIBCj" +
"rF4EpSIV58JUCJkn49yCAATeTmBLRBb/LVx2N5NFsW8fRjqEwBoEqmUWre+VTJVaxjZiHZZfrHFu4SUETkNgRHS8THaHsvfdaRzF" +
"EAhA4PoEsiUWve/U60rQ2C32+ucHHkAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgMCFCfT2EGvtcnFhtzEdAhC4EwFfC5b5pMd6" +
"oncnLvgCAQhciICLVbaeLApZfARpZO3ZhRBgKgQgcHUCcdV+tvtr3N1i5LGmq/PAfghA4IIEELILDhomQwACXyVQPfztpfS4fU9q" +
"yVkEAQicigBCdqrhwBgIQGALgSziqqIw5si2EKYOBCDwcgIqTnFPMb1TiZC9fDjoAAIQ2EIAIdtCjToQgMApCegEfuszk/2nHEKM" +
"ggAEEDLOAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAYB+B+PB39T8rYw+je4u9qt193lIbAhC4JYFKmGa/Vziz" +
"9UcF8paDgFMQgMB2AlE84v+e9EeM9P9XWk8jjxu9qt3tnlITAhC4LYFMcNzZlmDF5yp1W+sodvZeF8zuafe2A4FjEIDAdgK6W0U1" +
"R6ZpXyyX9f6qdrd7Sk0IQOC2BHrRURZRVemlp6G99HO2z9jubQcCxyAAge0EMlFx4fD0UefJNB3NhOZV7W73lJoQgMBtCWRb8Wja" +
"mP1jEQdS7WbxqnZvOxA4BgEIbCegc1mxJRe0SshaW/K8qt3tnlITAhC4LYFKcOLyi5hKjiy90DkyTUU9Zd3S7m0HAscgAIF9BFRY" +
"PNKqRC4uvWj1/Kp293lLbQhA4JYEsjVhGkWZ45pi6lINhfOqdm85CDgFAQgcQyCu7I8tRgGr3rcseFW7x3hNKxCAwK0IqEiNrN/S" +
"pRnZDYBXtXsr+DgDAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAgWUJ6PY8BqK3PizCyur7cW1Hy+7te9lBw3EIQOCr" +
"BEbFJePmdStBatVxweyJYksoGUsIQAAC3yHQerg7rhFriVX2yJI+GaBbA+3tm+GDAAQg8CWB1kPjiqnasjp7kLz3cLk/lG59xPf+" +
"WSO11k4bDCcEILA4gUzIWqKhD5RHIcqEzufJMlEc7bsniosPIe5DAAItMWlN+mvqWO2IEYWvmo/T6ExHBSHjPIUABJoEZqMin9vK" +
"7ki2xCzOkblBs32TXnIyQwACKYERMYmbLLbms6KQVXcbszJEZJycEIDALgKatvXuQFZ3I/WuZEvIdII/pp/VDYXsJsAux6kMAQjc" +
"h0B1xzGmjtFbFbJsPkvnxbK2qiisNS9Hanmf8w5PIPASAioSI/uKtQypNlP0Oq0NGnt9vwQAjUIAAtcnUIlHXBQbvexFR9Vmit5e" +
"r63Yb6+v69PHAwhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAoE+geiQp1qzK+Nqz3iLZvhWUgAAEILCDwIgIVWVU" +
"7Fqfd5hIVQhAAAJtAvEJgLjGq3p2UteB6SNM3lvvSQHGBQIQgMBhBKqtdEYeOlcjXPwQscOGh4YgAIERAqNCNjKXZv1pGsrq/ZFR" +
"oAwEILCLQE+gelvxVFGZfY+I7RoaKkMAAqMEqojM66uQVXNkMRrLtgwatYdyEIAABKYJVJP98SHwnthlKeXInc5pY6kAAQhAICMw" +
"I1KtVFEn+InKON8gAIG3ERgVstZcWnWXEjF72zDSEQQgMDoxPzJ5P7KRI8QhAAEIvITAqEi1JvurNkbafolTNAoBCEAAAhCAAAQg" +
"AAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAA" +
"BCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIAABCAwReAnH6X/" +
"6PH6L1O1KAwBCEDgRAR+6WHLtx+vXz2RTZgCAQhAYIrArz+F7B8/fv/Y4/UjU7UpDAEIQGADgR9+poGWDtrrdx6vnw3tWIpo31uk" +
"Zcfs/c+H4/be63kZi8j+xuP1jcfrB0NZ78O/+uJZ19NQ69f7sLImivHHbbF69uOfLZ3lBwIQWJiAiYWJhomBz2/ZZ/+x954qmuhF" +
"MTJBsWMuOB6NWZkferxMyL4/tGUiZeVdeLy8taNtmUDGtq0ZFUL9vPAw4joEIGAE/uLjZWngnz1fP/r4/ZeDeNixn3q8/vjx+v3H" +
"y9LG//4Um7/y+P19j9fff362MlbfhOy7A16LoEycLPKytvymwPc83v/B85iJ3Pc+67stJorWh9U1MXRb/u+zDfts9sS+Qre8hQAE" +
"7k7AJuVNHP7P42XCYWLx75/C4MJkAmRC8S+ex//Z87OVNzEyITLR8on+//H8bHXiz6886//M4/evPd9/8fhtQvWtx8uEyduy76xt" +
"E0Vr+58+y5u91q7apn1J13yEAATuSsBTPRMYi3hiqmfC8C+f4uHC9e+en3/hKSZ/+hQbi4hMbH7zefybz88qLp4u/qencP23x2+L" +
"BK2ct+WR3I8/23IR/e3n57/5bPvfim0I2V3PUvyCQIeAzzFZKve3nmJigmKiYMJkUZpFaH9NPvtE/u89j//y47eLnJX/6Wd5vWNp" +
"aaMd99fffrz/gWfZ/xBE0Pr3uTsTWPvs0eLPPd7/xuP1J2KbCyGDDgEILEbA7ziaCLg4WHr3E09x8Tmov/r8bOJh4md3Ik3oTLAs" +
"qjORsXkvF0avbyKlP37z4H89Dlj6GJdomHj5vJi1+8Xj9Zeeff2bZ/sWzf2jx8ttc1vctsWGEHchAAEnYGJir7/weNmEuX/24zpx" +
"X322CX8XFp3o97ZcyP7BU6CsnM2L+Y/e7XSxM0GzH48WLYq0vvyzT/Sr7YwyBCCwCAETIBcAFwf7bPNXLh7ZZ8djImLi5ncOvS2v" +
"7+X8ZoBFXi5A2YJZFy8rY+1GoXP7rIyJmQoXQrbISYubEPgEAU87ffGrC1kUqU/YRZ8QgAAENhGwRbKWUlpUxQ8EIACByxHw1I9n" +
"MC83dOc2+P8BipnMHXM09SIAAAAASUVORK5CYII=";
#endregion
/// <summary>
/// rectの中にpointが入っているかどうかを判定
/// </summary>
/// <param name="point"></param>
/// <param name="rect"></param>
/// <returns></returns>
public static bool IsInRectangle( Point point, Rectangle rect ) {
if ( rect.X <= point.X && point.X <= rect.X + rect.Width ) {
if ( rect.Y <= point.Y && point.Y <= rect.Y + rect.Height ) {
return true;
}
}
return false;
}
public static bool Edited {
get {
return m_edited;
}
set {
bool old = m_edited;
m_edited = value;
if ( EditedChanged != null ) {
EditedChanged( typeof( AppManager ), new EventArgs() );
}
}
}
public static string VERSION {
get {
#if DEBUG
return GetAssemblyVersion( typeof( Form1 ) ) + " (build:debug)";
#else
return GetAssemblyVersion( typeof( Form1 ) ) + " (build:release)";
#endif
}
}
private static string GetAssemblyVersion( Type t ) {
Assembly a = Assembly.GetAssembly( t );
AssemblyFileVersionAttribute afva = (AssemblyFileVersionAttribute)Attribute.GetCustomAttribute( a, typeof( AssemblyFileVersionAttribute ) );
return afva.Version;
}
/// <summary>
/// pictureBox1の行の表示状態を表す配列を取得します。
/// </summary>
/// <returns></returns>
public static int[] GetTimeLineLanes() {
List<int> ret = new List<int>();
// vsq
if ( SaveData.m_group_vsq.Folded ) {
ret.Add( 1 );
} else {
ret.Add( SaveData.m_group_vsq.Count + 1 );
}
// character
for ( int i = 0; i < SaveData.m_groups_character.Count; i++ ) {
if ( SaveData.m_groups_character[i].Folded ) {
ret.Add( 1 );
} else {
ret.Add( SaveData.m_groups_character[i].Count + 1 );
}
}
// telop
if ( SaveData.TelopListFolded ) {
ret.Add( 1 );
} else {
ret.Add( MaxTelopLanes + 1 );
}
// another image
if ( SaveData.m_group_another.Folded ) {
ret.Add( 1 );
} else {
ret.Add( SaveData.m_group_another.Count + 1 );
}
// plugin
if ( SaveData.m_group_plugin.Folded ) {
ret.Add( 1 );
} else {
ret.Add( SaveData.m_group_plugin.Count + 1 );
}
return ret.ToArray();
}
/// <summary>
/// アプリケーションのメイン エントリ ポイントです。
/// </summary>
[STAThread]
static void Main( string[] argv ) {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
#if !DEBUG
try {
#endif
string file = "";
if ( argv.Length > 0 ) {
file = argv[0];
}
Form1 form1 = null;
if ( File.Exists( file ) ) {
form1 = new Form1( file );
} else {
form1 = new Form1( "" );
}
Application.Run( form1 );
Common.LogClose();
#if !DEBUG
} catch ( Exception e ) {
Common.LogPush( e );
Common.LogClose();
}
#endif
}
static AppManager() {
using ( MemoryStream ms = new MemoryStream( Convert.FromBase64String( _AUTHOR_LSIT ) ) ) {
m_author_list = new Bitmap( ms );
}
}
/// <summary>
/// 現在保持しているコマンドバッファをクリアします。
/// </summary>
public static void ClearCommandBuffer() {
m_commands.Clear();
m_command_position = -1;
}
/// <summary>
/// 次回アンドゥ処理されるコマンドの種類を調べます
/// </summary>
/// <returns></returns>
public static CommandType GetNextUndoCommandType() {
if ( IsUndoAvailable ) {
return m_commands[m_command_position].type;
} else {
return CommandType.nothing;
}
}
/// <summary>
/// アンドゥ処理を行います
/// </summary>
public static void Undo() {
if ( IsUndoAvailable ) {
Command run = m_commands[m_command_position];
Command inv = SaveData.Execute( run );
m_commands[m_command_position] = inv;
m_command_position--;
}
}
/// <summary>
/// 次回リドゥ処理されるコマンドの種類を調べます
/// </summary>
/// <returns></returns>
public static CommandType GetNextRedoCommandType() {
if ( IsRedoAvailable ) {
return m_commands[m_command_position + 1].type;
} else {
return CommandType.nothing;
}
}
/// <summary>
/// リドゥ処理を行います
/// </summary>
public static void Redo() {
if ( IsRedoAvailable ) {
Command run = m_commands[m_command_position + 1];
Command inv = SaveData.Execute( run );
m_commands[m_command_position + 1] = inv;
m_command_position++;
}
}
/// <summary>
/// リドゥ操作が可能かどうかを表すプロパティ
/// </summary>
public static bool IsRedoAvailable {
get {
if ( m_commands.Count > 0 && 0 <= m_command_position + 1 && m_command_position + 1 < m_commands.Count ) {
return true;
} else {
return false;
}
}
}
/// <summary>
/// アンドゥ操作が可能かどうかを表すプロパティ
/// </summary>
public static bool IsUndoAvailable {
get {
if ( m_commands.Count > 0 && 0 <= m_command_position && m_command_position < m_commands.Count ) {
return true;
} else {
return false;
}
}
}
/// <summary>
/// コマンドバッファに指定されたコマンドを登録します
/// </summary>
/// <param name="command"></param>
public static void Register( Command command ) {
if ( m_command_position == m_commands.Count - 1 ) {
// 新しいコマンドバッファを追加する場合
m_commands.Add( command );
m_command_position = m_commands.Count - 1;
} else {
// 既にあるコマンドバッファを上書きする場合
//m_commands[m_command_position + 1].Dispose();
m_commands[m_command_position + 1] = command;
for ( int i = m_commands.Count - 1; i >= m_command_position + 2; i-- ) {
m_commands.RemoveAt( i );
}
m_command_position++;
}
}
public static Bitmap author_list {
get {
return (Bitmap)m_author_list.Clone();
}
}
}
}

View File

@ -1,220 +0,0 @@
/*
* AviOutput.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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.IO;
using System.Windows.Forms;
using System.Drawing;
using Boare.Lib.AppUtil;
namespace LipSync {
public partial class AviOutput : Form, IMultiLanguageControl {
private bool m_raw_mode = false;
private float m_start = 0f;
private float m_end = 0f;
public AviOutput( bool raw_mode ) {
InitializeComponent();
ApplyLanguage();
ApplyFont( AppManager.Config.Font.GetFont() );
m_raw_mode = raw_mode;
if ( groupAudio.Enabled ) {
if ( File.Exists( AppManager.SaveData.m_audioFile ) ) {
this.chkMergeAudio.Enabled = true;
} else {
this.chkMergeAudio.Enabled = false;
}
}
if ( m_raw_mode ) {
btnVideoCompression.Enabled = false;
txtDescription.Enabled = false;
} else {
btnVideoCompression.Enabled = true;
txtDescription.Enabled = true;
}
txtFile.Text = AppManager.Config.LastAviPath;
JudgeWritable();
}
public void ApplyFont( Font font ) {
this.Font = font;
foreach ( Control c in this.Controls ) {
Boare.Lib.AppUtil.Misc.ApplyFontRecurse( c, font );
}
}
public void ApplyLanguage() {
btnCancel.Text = _( "Cancel" );
btnOK.Text = _( "Save" );
lblFileName.Text = _( "File Name" );
if ( AppManager.Config.PathFFmpeg != "" && File.Exists( AppManager.Config.PathFFmpeg ) ) {
groupAudio.Text = _( "Audio" );
groupAudio.Enabled = true;
} else {
groupAudio.Text = _( "Audio" ) + " (" + _( "Set the path of ffmpeg to enable this option" ) + ")";
groupAudio.Enabled = false;
}
if ( AppManager.Config.PathMEncoder != "" && File.Exists( AppManager.Config.PathMEncoder ) ) {
groupFlv.Text = _( "FLV and MP4" );
groupFlv.Enabled = true;
} else {
groupFlv.Text = _( "FLV and MP4" ) + " (" + _( "Set the path of mencoder and ffmpeg to enable this option" ) + ")";
groupFlv.Enabled = false;
}
chkFLV.Text = _( "Convert to FLV" );
chkMP4.Text = _( "Convert to MP4" );
chkMergeAudio.Text = _( "Merge WAVE to AVI" );
chkDeleteIntermediate.Text = _( "Delete Intermediate File" );
btnVideoCompression.Text = _( "Video Compression" );
groupStartEnd.Text = _( "Specify Output Range" );
chkStart.Text = _( "Start" );
chkEnd.Text = _( "End" );
checkContainsAlpha.Text = _( "Add Alpha" );
}
public static string _( string s ) {
return Messaging.GetMessage( s );
}
public AviOutputArguments Arguments {
get {
AviOutputArguments aoa = new AviOutputArguments();
aoa.AviFile = this.FileName;
aoa.End = m_end;
aoa.EndSpecified = chkEnd.Checked;
aoa.FileNameParser = "";
aoa.ImageFormat = null;
aoa.IsDeleteIntermediateRequired = chkDeleteIntermediate.Checked;
aoa.IsFlvEncodeRequired = chkFLV.Checked;
aoa.IsMp4EncodeRequired = chkMP4.Checked;
if ( aoa.IsMp4EncodeRequired && aoa.IsFlvEncodeRequired ) {
aoa.IsFlvEncodeRequired = false;
}
aoa.IsTransparent = checkContainsAlpha.Checked;
aoa.IsWaveMergeRequired = chkMergeAudio.Checked;
aoa.Start = m_start;
aoa.StartSpecified = chkStart.Checked;
aoa.UseVfwEncoder = radioVfw.Checked;
return aoa;
}
}
private void btnOK_Click( object sender, EventArgs e ) {
//ディレクトリが存在するかどうかを確認
string name = FileName;
if ( !Directory.Exists( Path.GetDirectoryName( name ) ) ) {
MessageBox.Show( string.Format( _( "Directory {0} does not exist." ), Path.GetDirectoryName( name ) ),
_( "Error" ),
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation );
return;
}
//既にファイルが存在することを警告
if ( File.Exists( name ) ) {
if ( MessageBox.Show( string.Format( _( "{0} already exists.\nDo you want to replace it?" ), name ),
"LipSync",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation ) == DialogResult.No ) {
return;
}
}
try {
m_start = float.Parse( txtStart.Text );
m_end = float.Parse( txtEnd.Text );
this.DialogResult = DialogResult.OK;
} catch ( Exception ex ) {
MessageBox.Show( _( "Invalid value has been entered" ),
_( "Error" ),
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation );
Common.LogPush( ex );
}
}
private string FileName {
get {
if ( Path.GetExtension( txtFile.Text ).ToLower() != ".avi" ) {
string name = txtFile.Text;
txtFile.Text = Path.Combine( Path.GetDirectoryName( name ), Path.GetFileNameWithoutExtension( name ) + ".avi" );
}
return txtFile.Text;
}
}
private void btnFile_Click( object sender, EventArgs e ) {
using ( SaveFileDialog dlg = new SaveFileDialog() ) {
if ( AppManager.Config.LastAviPath != "" ) {
try {
dlg.InitialDirectory = Path.GetDirectoryName( AppManager.Config.LastAviPath );
} catch {
}
}
try {
dlg.Filter = _( "Avi file(*.avi)|*.avi" ) + "|" + _( "All Files(*.*)|*.*" );
} catch {
dlg.Filter = "Avi file(*.avi)|*.avi|All Files(*.*)|*.*";
}
dlg.OverwritePrompt = false;
if ( dlg.ShowDialog() == DialogResult.OK ) {
AppManager.Config.LastAviPath = dlg.FileName;
txtFile.Text = dlg.FileName;
JudgeWritable();
}
}
}
private void JudgeWritable() {
if ( txtFile.Text != "" ) {
btnOK.Enabled = true;
} else {
btnOK.Enabled = false;
}
}
private void chkStart_CheckedChanged( object sender, EventArgs e ) {
txtStart.Enabled = chkStart.Checked;
if ( txtStart.Enabled ) {
txtStart.Focus();
}
}
private void checkBox1_CheckedChanged( object sender, EventArgs e ) {
txtEnd.Enabled = chkEnd.Checked;
if ( txtEnd.Enabled ) {
txtEnd.Focus();
}
}
private void chkFLV_CheckedChanged( object sender, EventArgs e ) {
if ( chkFLV.Checked && chkMP4.Checked ) {
chkMP4.Checked = false;
}
this.chkDeleteIntermediate.Enabled = chkFLV.Checked | chkMP4.Checked | chkMergeAudio.Checked;
}
private void chkMP4_CheckedChanged( object sender, EventArgs e ) {
if ( chkMP4.Checked && chkFLV.Checked ) {
chkFLV.Checked = false;
}
this.chkDeleteIntermediate.Enabled = chkFLV.Checked | chkMP4.Checked | chkMergeAudio.Checked;
}
private void chkMergeAudio_CheckedChanged( object sender, EventArgs e ) {
this.chkDeleteIntermediate.Enabled = chkFLV.Checked | chkMP4.Checked | chkMergeAudio.Checked;
}
}
}

View File

@ -1,378 +0,0 @@
/*
* AviOutput.designer.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
partial class AviOutput {
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose( bool disposing ) {
if ( disposing && (components != null) ) {
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent() {
this.txtFile = new System.Windows.Forms.TextBox();
this.lblFileName = new System.Windows.Forms.Label();
this.btnFile = new System.Windows.Forms.Button();
this.btnVideoCompression = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.chkStart = new System.Windows.Forms.CheckBox();
this.groupStartEnd = new System.Windows.Forms.GroupBox();
this.txtEnd = new System.Windows.Forms.TextBox();
this.txtStart = new System.Windows.Forms.TextBox();
this.chkEnd = new System.Windows.Forms.CheckBox();
this.groupFlv = new System.Windows.Forms.GroupBox();
this.chkMP4 = new System.Windows.Forms.CheckBox();
this.chkDeleteIntermediate = new System.Windows.Forms.CheckBox();
this.chkFLV = new System.Windows.Forms.CheckBox();
this.checkContainsAlpha = new System.Windows.Forms.CheckBox();
this.txtDescription = new System.Windows.Forms.Label();
this.groupAudio = new System.Windows.Forms.GroupBox();
this.chkMergeAudio = new System.Windows.Forms.CheckBox();
this.groupAviEncoder = new System.Windows.Forms.GroupBox();
this.radioVcm = new System.Windows.Forms.RadioButton();
this.radioVfw = new System.Windows.Forms.RadioButton();
this.groupStartEnd.SuspendLayout();
this.groupFlv.SuspendLayout();
this.groupAudio.SuspendLayout();
this.groupAviEncoder.SuspendLayout();
this.SuspendLayout();
//
// txtFile
//
this.txtFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtFile.BackColor = System.Drawing.SystemColors.Window;
this.txtFile.Location = new System.Drawing.Point( 73, 14 );
this.txtFile.Name = "txtFile";
this.txtFile.Size = new System.Drawing.Size( 221, 19 );
this.txtFile.TabIndex = 0;
//
// lblFileName
//
this.lblFileName.AutoSize = true;
this.lblFileName.Location = new System.Drawing.Point( 15, 17 );
this.lblFileName.Name = "lblFileName";
this.lblFileName.Size = new System.Drawing.Size( 51, 12 );
this.lblFileName.TabIndex = 4;
this.lblFileName.Text = "ファイル名";
//
// btnFile
//
this.btnFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnFile.Location = new System.Drawing.Point( 300, 12 );
this.btnFile.Name = "btnFile";
this.btnFile.Size = new System.Drawing.Size( 24, 23 );
this.btnFile.TabIndex = 1;
this.btnFile.Text = "...";
this.btnFile.UseVisualStyleBackColor = true;
this.btnFile.Click += new System.EventHandler( this.btnFile_Click );
//
// btnVideoCompression
//
this.btnVideoCompression.Enabled = false;
this.btnVideoCompression.Location = new System.Drawing.Point( 142, 423 );
this.btnVideoCompression.Name = "btnVideoCompression";
this.btnVideoCompression.Size = new System.Drawing.Size( 113, 24 );
this.btnVideoCompression.TabIndex = 14;
this.btnVideoCompression.Text = "ビデオ圧縮";
this.btnVideoCompression.UseVisualStyleBackColor = true;
this.btnVideoCompression.Visible = false;
//
// btnCancel
//
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( 246, 381 );
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size( 75, 23 );
this.btnCancel.TabIndex = 13;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.Enabled = false;
this.btnOK.Location = new System.Drawing.Point( 147, 381 );
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size( 75, 23 );
this.btnOK.TabIndex = 12;
this.btnOK.Text = "保存";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler( this.btnOK_Click );
//
// chkStart
//
this.chkStart.AutoSize = true;
this.chkStart.Location = new System.Drawing.Point( 35, 18 );
this.chkStart.Name = "chkStart";
this.chkStart.Size = new System.Drawing.Size( 48, 16 );
this.chkStart.TabIndex = 8;
this.chkStart.Text = "開始";
this.chkStart.UseVisualStyleBackColor = true;
this.chkStart.CheckedChanged += new System.EventHandler( this.chkStart_CheckedChanged );
//
// groupStartEnd
//
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.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( 12, 293 );
this.groupStartEnd.Name = "groupStartEnd";
this.groupStartEnd.Size = new System.Drawing.Size( 308, 72 );
this.groupStartEnd.TabIndex = 7;
this.groupStartEnd.TabStop = false;
this.groupStartEnd.Text = "出力範囲を指定";
//
// txtEnd
//
this.txtEnd.Enabled = false;
this.txtEnd.Location = new System.Drawing.Point( 103, 40 );
this.txtEnd.Name = "txtEnd";
this.txtEnd.Size = new System.Drawing.Size( 144, 19 );
this.txtEnd.TabIndex = 11;
this.txtEnd.Text = "0";
//
// txtStart
//
this.txtStart.Enabled = false;
this.txtStart.Location = new System.Drawing.Point( 103, 16 );
this.txtStart.Name = "txtStart";
this.txtStart.Size = new System.Drawing.Size( 144, 19 );
this.txtStart.TabIndex = 9;
this.txtStart.Text = "0";
//
// chkEnd
//
this.chkEnd.AutoSize = true;
this.chkEnd.Location = new System.Drawing.Point( 35, 42 );
this.chkEnd.Name = "chkEnd";
this.chkEnd.Size = new System.Drawing.Size( 48, 16 );
this.chkEnd.TabIndex = 10;
this.chkEnd.Text = "終了";
this.chkEnd.UseVisualStyleBackColor = true;
this.chkEnd.CheckedChanged += new System.EventHandler( this.checkBox1_CheckedChanged );
//
// groupFlv
//
this.groupFlv.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupFlv.Controls.Add( this.chkMP4 );
this.groupFlv.Controls.Add( this.chkFLV );
this.groupFlv.Location = new System.Drawing.Point( 13, 148 );
this.groupFlv.Name = "groupFlv";
this.groupFlv.Size = new System.Drawing.Size( 311, 72 );
this.groupFlv.TabIndex = 2;
this.groupFlv.TabStop = false;
this.groupFlv.Text = "FLV";
//
// chkMP4
//
this.chkMP4.AutoSize = true;
this.chkMP4.Location = new System.Drawing.Point( 23, 44 );
this.chkMP4.Name = "chkMP4";
this.chkMP4.Size = new System.Drawing.Size( 104, 16 );
this.chkMP4.TabIndex = 4;
this.chkMP4.Text = "Convert to MP4";
this.chkMP4.UseVisualStyleBackColor = true;
this.chkMP4.CheckedChanged += new System.EventHandler( this.chkMP4_CheckedChanged );
//
// chkDeleteIntermediate
//
this.chkDeleteIntermediate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkDeleteIntermediate.AutoSize = true;
this.chkDeleteIntermediate.Enabled = false;
this.chkDeleteIntermediate.Location = new System.Drawing.Point( 173, 48 );
this.chkDeleteIntermediate.Name = "chkDeleteIntermediate";
this.chkDeleteIntermediate.Size = new System.Drawing.Size( 134, 16 );
this.chkDeleteIntermediate.TabIndex = 3;
this.chkDeleteIntermediate.Text = "中間ファイルを削除する";
this.chkDeleteIntermediate.UseVisualStyleBackColor = true;
//
// chkFLV
//
this.chkFLV.AutoSize = true;
this.chkFLV.Location = new System.Drawing.Point( 23, 22 );
this.chkFLV.Name = "chkFLV";
this.chkFLV.Size = new System.Drawing.Size( 103, 16 );
this.chkFLV.TabIndex = 2;
this.chkFLV.Text = "Convert to FLV";
this.chkFLV.UseVisualStyleBackColor = true;
this.chkFLV.CheckedChanged += new System.EventHandler( this.chkFLV_CheckedChanged );
//
// checkContainsAlpha
//
this.checkContainsAlpha.AutoSize = true;
this.checkContainsAlpha.Location = new System.Drawing.Point( 36, 48 );
this.checkContainsAlpha.Name = "checkContainsAlpha";
this.checkContainsAlpha.Size = new System.Drawing.Size( 110, 16 );
this.checkContainsAlpha.TabIndex = 4;
this.checkContainsAlpha.Text = "アルファ値を含める";
this.checkContainsAlpha.UseVisualStyleBackColor = true;
//
// txtDescription
//
this.txtDescription.AutoSize = true;
this.txtDescription.Enabled = false;
this.txtDescription.Location = new System.Drawing.Point( 294, 429 );
this.txtDescription.Name = "txtDescription";
this.txtDescription.Size = new System.Drawing.Size( 9, 12 );
this.txtDescription.TabIndex = 19;
this.txtDescription.Text = " ";
this.txtDescription.Visible = false;
//
// groupAudio
//
this.groupAudio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupAudio.Controls.Add( this.chkMergeAudio );
this.groupAudio.Location = new System.Drawing.Point( 12, 226 );
this.groupAudio.Name = "groupAudio";
this.groupAudio.Size = new System.Drawing.Size( 311, 61 );
this.groupAudio.TabIndex = 5;
this.groupAudio.TabStop = false;
this.groupAudio.Text = "オーディオ";
//
// chkMergeAudio
//
this.chkMergeAudio.AutoSize = true;
this.chkMergeAudio.Enabled = false;
this.chkMergeAudio.Location = new System.Drawing.Point( 35, 26 );
this.chkMergeAudio.Name = "chkMergeAudio";
this.chkMergeAudio.Size = new System.Drawing.Size( 96, 16 );
this.chkMergeAudio.TabIndex = 6;
this.chkMergeAudio.Text = "AVIに埋め込む";
this.chkMergeAudio.UseVisualStyleBackColor = true;
this.chkMergeAudio.CheckedChanged += new System.EventHandler( this.chkMergeAudio_CheckedChanged );
//
// groupAviEncoder
//
this.groupAviEncoder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupAviEncoder.Controls.Add( this.radioVcm );
this.groupAviEncoder.Controls.Add( this.radioVfw );
this.groupAviEncoder.Location = new System.Drawing.Point( 13, 70 );
this.groupAviEncoder.Name = "groupAviEncoder";
this.groupAviEncoder.Size = new System.Drawing.Size( 311, 72 );
this.groupAviEncoder.TabIndex = 20;
this.groupAviEncoder.TabStop = false;
this.groupAviEncoder.Text = "Avi Encoder";
//
// radioVcm
//
this.radioVcm.AutoSize = true;
this.radioVcm.Location = new System.Drawing.Point( 23, 45 );
this.radioVcm.Name = "radioVcm";
this.radioVcm.Size = new System.Drawing.Size( 169, 16 );
this.radioVcm.TabIndex = 1;
this.radioVcm.TabStop = true;
this.radioVcm.Text = "Video Compression Manager";
this.radioVcm.UseVisualStyleBackColor = true;
//
// radioVfw
//
this.radioVfw.AutoSize = true;
this.radioVfw.Checked = true;
this.radioVfw.Location = new System.Drawing.Point( 23, 23 );
this.radioVfw.Name = "radioVfw";
this.radioVfw.Size = new System.Drawing.Size( 118, 16 );
this.radioVfw.TabIndex = 0;
this.radioVfw.TabStop = true;
this.radioVfw.Text = "Video for Windows";
this.radioVfw.UseVisualStyleBackColor = true;
//
// AviOutput
//
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( 335, 421 );
this.Controls.Add( this.groupAviEncoder );
this.Controls.Add( this.chkDeleteIntermediate );
this.Controls.Add( this.checkContainsAlpha );
this.Controls.Add( this.txtDescription );
this.Controls.Add( this.groupAudio );
this.Controls.Add( this.groupFlv );
this.Controls.Add( this.groupStartEnd );
this.Controls.Add( this.btnVideoCompression );
this.Controls.Add( this.btnCancel );
this.Controls.Add( this.btnOK );
this.Controls.Add( this.btnFile );
this.Controls.Add( this.lblFileName );
this.Controls.Add( this.txtFile );
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AviOutput";
this.ShowInTaskbar = false;
this.Text = "AviOutput";
this.groupStartEnd.ResumeLayout( false );
this.groupStartEnd.PerformLayout();
this.groupFlv.ResumeLayout( false );
this.groupFlv.PerformLayout();
this.groupAudio.ResumeLayout( false );
this.groupAudio.PerformLayout();
this.groupAviEncoder.ResumeLayout( false );
this.groupAviEncoder.PerformLayout();
this.ResumeLayout( false );
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox txtFile;
private System.Windows.Forms.Label lblFileName;
private System.Windows.Forms.Button btnFile;
private System.Windows.Forms.Button btnVideoCompression;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.CheckBox chkStart;
private System.Windows.Forms.GroupBox groupStartEnd;
private System.Windows.Forms.TextBox txtEnd;
private System.Windows.Forms.TextBox txtStart;
private System.Windows.Forms.CheckBox chkEnd;
private System.Windows.Forms.GroupBox groupFlv;
private System.Windows.Forms.CheckBox chkDeleteIntermediate;
private System.Windows.Forms.CheckBox chkFLV;
private System.Windows.Forms.GroupBox groupAudio;
private System.Windows.Forms.CheckBox chkMergeAudio;
private System.Windows.Forms.Label txtDescription;
private System.Windows.Forms.CheckBox checkContainsAlpha;
private System.Windows.Forms.CheckBox chkMP4;
private System.Windows.Forms.GroupBox groupAviEncoder;
private System.Windows.Forms.RadioButton radioVfw;
private System.Windows.Forms.RadioButton radioVcm;
}
}

View File

@ -1,32 +0,0 @@
/*
* AviOutputArguments.cs
* Copyright (c) 2008-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
public class AviOutputArguments {
public string AviFile = "";
public float Start = 0f;
public float End = 0f;
public bool StartSpecified = false;
public bool EndSpecified = false;
public bool IsWaveMergeRequired = false;
public bool IsFlvEncodeRequired = false;
public bool IsMp4EncodeRequired = false;
public bool IsDeleteIntermediateRequired = false;
public bool IsTransparent = false;
public string FileNameParser;
public System.Drawing.Imaging.ImageFormat ImageFormat;
public bool UseVfwEncoder = true;
}
}

View File

@ -1,47 +0,0 @@
/*
* AviReaderEx.cs
* Copyright (c) 2008-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 Boare.Lib.Media;
namespace LipSync {
public class AviReaderEx : AviReader {
private int m_num_openfailed = 0;
/// <summary>
/// aviファイルのOpenに失敗した累積回数を取得します
/// </summary>
public int NumFailed {
get {
return m_num_openfailed;
}
}
public AviReaderEx() : base() {
m_num_openfailed = 0;
}
public new void Open( string file ){
try {
base.Open( file );
} catch {
m_num_openfailed++;
}
}
}
}

View File

@ -1,28 +0,0 @@
/*
* BarLineType.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
public struct BarLineType {
public double Time;
public bool IsSeparator;
public bool NeverUseForSnapPoint;
public BarLineType( double time, bool is_separator, bool never_use_for_snap_point ) {
Time = time;
IsSeparator = is_separator;
NeverUseForSnapPoint = never_use_for_snap_point;
}
}
}

View File

@ -1,75 +0,0 @@
/*
* BugReport.Designer.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
partial class BugReport {
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose( bool disposing ) {
if ( disposing && (components != null) ) {
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent() {
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Font = new System.Drawing.Font( " ゴシック", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)) );
this.textBox1.Location = new System.Drawing.Point( 12, 49 );
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size( 357, 223 );
this.textBox1.TabIndex = 0;
//
// BugReport
//
this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size( 381, 284 );
this.Controls.Add( this.textBox1 );
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "BugReport";
this.ShowIcon = false;
this.Text = "BugReport";
this.ResumeLayout( false );
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
}
}

View File

@ -1,84 +0,0 @@
/*
* BugReport.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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.Windows.Forms;
namespace LipSync {
public partial class BugReport : Form {
public BugReport() {
InitializeComponent();
string runtime_version = System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion();
textBox1.Text = "[ OS ]:" + OsVersion() + Environment.NewLine +
"[.NET runtime]:" + runtime_version + Environment.NewLine +
"[ LipSync ]:v" + AppManager.VERSION;
}
private static string OsVersion() {
OperatingSystem os = System.Environment.OSVersion;
string version = "(" + os.Version.ToString() + ")";
switch ( os.Platform ) {
case PlatformID.Win32Windows:
if ( os.Version.Major >= 4 ) {
switch ( os.Version.Minor ) {
case 0:
return "Windows 95" + version;
case 10:
return "Windows 98" + version;
case 90:
return "Windows Me" + version;
}
}
break;
case PlatformID.Win32NT:
switch ( os.Version.Major ) {
case 3:
switch ( os.Version.Minor ) {
case 0:
return "Windows NT 3" + version;
case 1:
return "Windows NT 3.1" + version;
case 5:
return "Windows NT 3.5" + version;
case 51:
return "Windows NT 3.51" + version;
}
break;
case 4:
if ( os.Version.Minor == 0 ) {
return "Windows NT 4.0" + version;
}
break;
case 5:
if ( os.Version.Minor == 0 ) {
return "Windows 2000" + version;
} else if ( os.Version.Minor == 1 ) {
return "Windows XP" + version;
}
break;
case 6:
if ( os.Version.Minor == 0 ) {
return "Windows Vista" + version;
}
break;
}
break;
case PlatformID.Win32S:
return "Win32s" + version;
}
return os.Platform.ToString() + version;
}
}
}

View File

@ -1,300 +0,0 @@
/*
* Character.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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;
using System.Drawing;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace LipSync {
public enum CharacterType {
def,
plugin
}
[Serializable]
public class Character : IDisposable {
public CharacterType type;
string m_Name;
public PluginConfig m_pluginConfig;
public Size m_plugin_drawarea;
[Obsolete]
public Image Base;
[Obsolete]
public Image a;
[Obsolete]
public Image aa;
[Obsolete]
public Image i;
[Obsolete]
public Image u;
[Obsolete]
public Image e;
[Obsolete]
public Image o;
[Obsolete]
public Image xo;
[Obsolete]
public Image nn;
public List<ImageEntry> Images;
[NonSerialized]
private Bitmap m_cache = null;
[NonSerialized]
private string m_cache_draw = "";
[OptionalField]
public string version;//setDefaultで変更するので、readonlyにしたいけどできん
[OptionalField]
public Size m_size;
[OptionalField]
public Bitmap m_preview = null;
[NonSerialized]
bool internal_operation = false;
[OnDeserializing]
private void onDeserializing( StreamingContext sc ) {
version = "0";
m_size = new Size( 0, 0 );
}
[OnSerialized]
private void onSerialized( StreamingContext sc ) {
if ( m_size.Equals( new Size( 0, 0 ) ) ) {
foreach ( ImageEntry img in Images ) {
if ( img.title == "base" ) {
if ( img.Image != null ) {
m_size = new Size( img.Image.Width, img.Image.Height );
break;
}
}
}
}
}
[OnDeserialized]
private void onDeserialized( StreamingContext sc ){
// 古いバージョンの*.lseとの互換性を保つため。
// base, a, ..., nnのデータをImagesに移動させる
if ( nn != null ) {
Images.Insert( 0, new ImageEntry( "nn", nn, "口", false ) );
nn.Dispose();
}
if ( xo != null ) {
Images.Insert( 0, new ImageEntry( "xo", xo, "口", false ) );
xo.Dispose();
}
if ( o != null ) {
Images.Insert( 0, new ImageEntry( "o", o, "口", false ) );
o.Dispose();
}
if ( e != null ) {
Images.Insert( 0, new ImageEntry( "e", e, "口", false ) );
e.Dispose();
}
if ( u != null ) {
Images.Insert( 0, new ImageEntry( "u", u, "口", false ) );
u.Dispose();
}
if ( i != null ) {
Images.Insert( 0, new ImageEntry( "i", i, "口", false ) );
i.Dispose();
}
if ( aa != null ) {
Images.Insert( 0, new ImageEntry( "aa", aa, "口", false ) );
aa.Dispose();
}
if ( a != null ) {
Images.Insert( 0, new ImageEntry( "a", a, "口", false ) );
a.Dispose();
}
if ( Base != null ) {
Images.Insert( 0, new ImageEntry( "base", Base, "本体", true ) );
Base.Dispose();
}
if ( version == "0" ) {
for ( int k = 0; k < Images.Count; k++ ) {
if ( Images[k].title == "base" ) {
Images[k].IsDefault = true;
m_size = Images[k].Image.Size;
version = "2";
}
}
}
if ( m_size.Width <= 0 || m_size.Height <= 0 ) {
int max_x = 0;
int max_y = 0;
foreach ( ImageEntry img in Images ) {
if ( img.Image != null ) {
max_x = Math.Max( max_x, img.Image.Width + img.XOffset );
max_y = Math.Max( max_y, img.Image.Height + img.YOffset );
}
}
m_size = new Size( max_x, max_y );
}
}
public void Dispose() {
m_Name = null;
m_pluginConfig = null;
if ( Base != null ) {
Base.Dispose();
}
if ( a != null ) {
a.Dispose();
}
if ( aa != null ) {
aa.Dispose();
}
if ( i != null ) {
i.Dispose();
}
if ( u != null ) {
u.Dispose();
}
if ( e != null ) {
e.Dispose();
}
if ( o != null ) {
o.Dispose();
}
if ( xo != null ) {
xo.Dispose();
}
if ( nn != null ) {
nn.Dispose();
}
Images.Clear();
}
public void Write( Stream stream ) {
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize( stream, this );
}
public string GetMD5() {
System.Security.Cryptography.MD5CryptoServiceProvider mcsp = new System.Security.Cryptography.MD5CryptoServiceProvider();
using ( MemoryStream ms = new MemoryStream() ) {
this.Write( ms );
byte[] dat = mcsp.ComputeHash( ms );
string res = "";
foreach ( byte b in dat ) {
res += b.ToString( "x2" );
}
return res;
}
return "";
}
public static Character FromFile( Stream stream ) {
Character result = null;
BinaryFormatter bf = new BinaryFormatter();
result = (Character)bf.Deserialize( stream );
bf = null;
return result;
}
public static Character FromFile( string filepath ) {
Character result = null;
if ( File.Exists( filepath ) ) {
using ( FileStream fs = new FileStream( filepath, FileMode.Open ) ) {
result = FromFile( fs );
}
}
return result;
}
public int Width {
get {
return m_size.Width;
}
}
public int Height {
get {
return m_size.Height;
}
}
public string Name {
get {
return m_Name;
}
set {
m_Name = value;
}
}
public Bitmap DefaultFace {
get {
string type = "";
foreach ( ImageEntry img in this.Images ) {
if ( img.IsDefault ) {
type += img.title + "\n";
}
}
Bitmap res = Face( type );
#if DEBUG
if ( res == null ) {
Common.DebugWriteLine( "Character.DefaultFace.get(); res==null" );
Common.DebugWriteLine( " Width=" + Width );
Common.DebugWriteLine( " Height=" + Height );
Common.DebugWriteLine( " type=" + type );
}
#endif
return res;
}
}
public Bitmap Face( string type ) {
if ( Width <= 0 || Height <= 0 ) {
return null;
}
if ( m_cache != null ) {
if ( m_cache_draw == type ) {
return (Bitmap)m_cache.Clone();
}
}
Bitmap bmp = new Bitmap( Width, Height );
string[] spl = type.Split( "\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries );
using ( Graphics g = Graphics.FromImage( bmp ) ) {
//Image drawing;
for ( int i = 0; i < spl.Length; i++ ) {
for ( int index = 0; index < Images.Count; index++ ) {
if ( Images[index].title == spl[i] ) {
//drawing = Images[index].image;
Images[index].DrawTo( g );
break;
}
}
}
}
m_cache_draw = type;
if ( m_cache != null ) {
m_cache.Dispose();
}
m_cache = (Bitmap)bmp.Clone();
return bmp;
}
}
}

View File

@ -1,739 +0,0 @@
/*
* Character3.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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;
using System.Drawing;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Xml.Serialization;
using LipSync.Properties;
namespace LipSync {
/// <summary>
/// キャラクタを取り扱うクラス。
/// 第3世代
/// </summary>
[Serializable]
public class Character3 : ICloneable, IDisposable {
string m_name;
CharacterType m_type;
ImageEntry[] m_basic = new ImageEntry[9];
List<ImageEntry> m_another;
Size m_size;
[NonSerialized]
Bitmap m_cache = null;
[NonSerialized]
int[] m_cache_draw;
string m_author;
string m_version;
PluginConfig m_plugin_config;
bool m_updated = false; // 第2世代のCharacterからアップデートされたものであることを表すフラグ
bool m_is_build_in = false;
/// <summary>
/// 使用上の注意など
/// </summary>
[OptionalField]
string m_lisence;
#region public static field
/// <summary>
/// ビルトイン・キャラクタ。
/// </summary>
public static readonly Character3 Miku = new Character3(
"Miku",
"さなり",
"",
new ImageEntry[] {
new ImageEntry( "base", Resources.b_miku175_base, "base", true ),
new ImageEntry( "a", Resources.b_miku175_a, "mouth", false ),
new ImageEntry( "aa", Resources.b_miku175_aa, "mouth", false ),
new ImageEntry( "i", Resources.b_miku175_i, "mouth", false ),
new ImageEntry( "u", Resources.b_miku175_u, "mouth", false ),
new ImageEntry( "e", Resources.b_miku175_e, "mouth", false ),
new ImageEntry( "o", Resources.b_miku175_o, "mouth", false ),
new ImageEntry( "xo", Resources.b_miku175_xo, "mouth", false ),
new ImageEntry( "nn", Resources.b_miku175_nn, "mouth", false )
},
new ImageEntry[] {
new ImageEntry( "目閉じ", Resources.b_miku175_eyeclose, "eye", false ),
new ImageEntry( "低目にっこり", Resources.b_miku175_smile, "eye", false ),
new ImageEntry( "目半目", Resources.b_miku175_eyethin, "eye", false ),
new ImageEntry( "こなた", Resources.b_miku175_konata, "eye", false ),
new ImageEntry( "", Resources.b_miku175_kudo, "eye", false ),
new ImageEntry( "哀左ウィンク", Resources.b_miku175_winkleft, "eye", false ),
new ImageEntry( "右ウィンク", Resources.b_miku175_winkright, "eye", false ),
new ImageEntry( "bee", Resources.b_miku175_bee, "mouth", false),
new ImageEntry( "neko", Resources.b_miku175_neko, "mouth", false )
},
true
);
public static readonly Character3 Rin = new Character3(
"Rin",
"さなり",
"",
new ImageEntry[] {
new ImageEntry( "base", Resources.b_rin100_base, "base",true ),
new ImageEntry( "a", Resources.b_rin100_a, "mouth", false ),
new ImageEntry( "aa", Resources.b_rin100_aa, "mouth", false ),
new ImageEntry( "i", Resources.b_rin100_i, "mouth", false ),
new ImageEntry( "u", Resources.b_rin100_u, "mouth", false ),
new ImageEntry( "e", Resources.b_rin100_e, "mouth", false ),
new ImageEntry( "o", Resources.b_rin100_o, "mouth", false ),
new ImageEntry( "xo", Resources.b_rin100_xo, "mouth", false ),
new ImageEntry( "nn", Resources.b_rin100_nn, "mouth", false )
},
new ImageEntry[] {
new ImageEntry( "目閉じ", Resources.b_rin100_eyeclose, "eye", false ),
new ImageEntry( "低目にっこり", Resources.b_rin100_smile, "eye", false ),
new ImageEntry( "目半目", Resources.b_rin100_eyethin, "eye", false ),
new ImageEntry( "", Resources.b_rin100_kudo, "eye", false ),
new ImageEntry( "哀左ウィンク", Resources.b_rin100_winkleft, "eye", false ),
new ImageEntry( "低右ウィンク", Resources.b_rin100_winkright, "eye" , false),
new ImageEntry( "bee", Resources.b_rin100_bee, "mouth", false ),
new ImageEntry( "neko", Resources.b_rin100_neko, "mouth", false ),
new ImageEntry( "きしし", Resources.b_rin100_kisisi, "mouth", false )
},
true
);
public static readonly Character3 Len = new Character3(
"Len",
"さなり",
"",
new ImageEntry[] {
new ImageEntry( "base", Resources.b_len100_base, "本体", true ),
new ImageEntry( "a", Resources.b_len100_a, "mouth", false ),
new ImageEntry( "aa", Resources.b_len100_aa, "mouth", false ),
new ImageEntry( "i", Resources.b_len100_i, "mouth", false ),
new ImageEntry( "u", Resources.b_len100_u, "mouth", false ),
new ImageEntry( "e", Resources.b_len100_e, "mouth", false ),
new ImageEntry( "o", Resources.b_len100_o, "mouth", false ),
new ImageEntry( "xo", Resources.b_len100_xo, "mouth", false ),
new ImageEntry( "nn", Resources.b_len100_nn, "mouth", false )
},
new ImageEntry[] {
new ImageEntry( "目閉じ", Resources.b_len100_eyeclose, "eye", false ),
new ImageEntry( "低目にっこり", Resources.b_len100_smile, "eye", false ),
new ImageEntry( "目半目", Resources.b_len100_eyethin, "eye", false ),
new ImageEntry( "(`・ω・´)", Resources.b_len100_shakin, "eye", false ),
new ImageEntry( "哀左ウィンク", Resources.b_len100_winkleft, "eye", false ),
new ImageEntry( "中右ウィンク", Resources.b_len100_winkright, "eye", false ),
new ImageEntry( "きしし", Resources.b_len100_kisisi, "mouth", false )
},
true
);
#endregion
[OnDeserialized]
private void onDeserialized( StreamingContext sc ) {
SortedList<int, string> slist = new SortedList<int, string>();
foreach ( ImageEntry ie in m_basic ) {
slist.Add( ie.Z, ie.title );
}
foreach ( ImageEntry ie in m_another ) {
slist.Add( ie.Z, ie.title );
}
for ( int i = 0; i < slist.Keys.Count; i++ ) {
string title = slist[slist.Keys[i]];
bool found = false;
for ( int j = 0; j < m_basic.Length; j++ ) {
if ( m_basic[j].title == title ) {
m_basic[j].Z = i;
found = true;
break;
}
}
if ( !found ) {
for ( int j = 0; j < m_another.Count; j++ ) {
if ( m_another[j].title == title ) {
m_another[j].Z = i;
break;
}
}
}
}
}
public bool IsBuildIn {
get {
return m_is_build_in;
}
}
public void Remove( string title ) {
for ( int i = 0; i < m_another.Count; i++ ) {
if ( m_another[i].title == title ) {
m_another.RemoveAt( i );
break;
}
}
}
public void SetImage( Image img, int index ) {
this[index].SetImage( img );
}
public void SetImage( Image img, string title ) {
this[title].SetImage( img );
}
public PluginConfig PluginConfig {
get {
return m_plugin_config;
}
set {
m_plugin_config = value;
}
}
public int Count {
get {
return 9 + m_another.Count;
}
}
public void Dispose() {
m_basic = null;
m_another.Clear();
if ( m_cache != null ) {
m_cache.Dispose();
}
}
public void Add( ImageEntry item ) {
ImageEntry adding = (ImageEntry)item.Clone();
adding.Z = this.Count;
m_another.Add( adding );
}
public string Version {
get {
return m_version;
}
set {
m_version = value;
}
}
public string Author {
get {
return m_author;
}
set {
m_author = value;
}
}
public Character3() {
m_name = "";
m_type = CharacterType.def;
m_basic = new ImageEntry[9];
m_basic[0] = new ImageEntry( "base", null, "base", true );
m_basic[1] = new ImageEntry( "a", null, "mouth", false );
m_basic[2] = new ImageEntry( "aa", null, "mouth", false );
m_basic[3] = new ImageEntry( "i", null, "mouth", false );
m_basic[4] = new ImageEntry( "u", null, "mouth", false );
m_basic[5] = new ImageEntry( "e", null, "mouth", false );
m_basic[6] = new ImageEntry( "o", null, "mouth", false );
m_basic[7] = new ImageEntry( "xo", null, "mouth", false );
m_basic[8] = new ImageEntry( "nn", null, "mouth", false );
for ( int i = 0; i < 9; i++ ) {
m_basic[i].Z = i;
}
m_another = new List<ImageEntry>();
m_size = new Size();
m_author = "";
m_version = "";
}
public void Write( Stream s ) {
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize( s, this );
}
public string GetMD5() {
System.Security.Cryptography.MD5CryptoServiceProvider mcsp = new System.Security.Cryptography.MD5CryptoServiceProvider();
using ( MemoryStream ms = new MemoryStream() ) {
this.Write( ms );
byte[] dat = mcsp.ComputeHash( ms );
string res = "";
foreach ( byte b in dat ) {
res += b.ToString( "x2" );
}
return res;
}
return "";
}
/// <summary>
/// ファイルに保存する
/// </summary>
/// <param name="path"></param>
/// <param name="pack"></param>
public void WriteXml( string path ) {
string f = Path.GetFileName( path );
if ( f != "content.xml" ) {
return;
}
int width = this.Width;
int height = this.Height;
string base_path = Path.GetDirectoryName( path );
string image_path = Path.Combine( base_path, "images" );
if ( !Directory.Exists( image_path ) ) {
Directory.CreateDirectory( Path.Combine( base_path, "images" ) );
}
using ( FileStream fs = new FileStream( Path.Combine( base_path, "content.xml" ), FileMode.Create ) ) {
XmlSerializer xs = new XmlSerializer( typeof( Character3 ) );
xs.Serialize( fs, this );
}
using ( FileStream fs = new FileStream( Path.Combine( base_path, "basic.xml" ), FileMode.Create ) ) {
XmlSerializer xs = new XmlSerializer( typeof( ImageEntry[] ) );
xs.Serialize( fs, m_basic );
}
using ( FileStream fs = new FileStream( Path.Combine( base_path, "another.xml" ), FileMode.Create ) ) {
XmlSerializer xs = new XmlSerializer( typeof( List<ImageEntry> ) );
xs.Serialize( fs, m_another );
}
int count = -1;
foreach ( ImageEntry img in this ) {
count++;
if ( img.Image != null ) {
string file = Path.Combine( Path.Combine( base_path, "images" ), img.Z + ".png" );
Bitmap temp = img.GetImage( width, height );
temp.Save( file );
}
}
}
public Character3( PluginConfig plugin_config ) {
m_name = plugin_config.ID;
m_type = CharacterType.plugin;
m_plugin_config = plugin_config.Clone();
m_updated = false;
}
public static Character3 Read( Stream s ) {
BinaryFormatter bf = new BinaryFormatter();
Character3 res = null;
try {
res = (Character3)bf.Deserialize( s );
return res;
} catch {
return null;
}
}
/// <summary>
/// xmlファイルからのコンストラクタ
/// </summary>
public static Character3 FromXml( string path ) {
#if DEBUG
Common.DebugWriteLine( "Character3.ctor(string);" );
#endif
Character3 res;
string dir = Path.GetDirectoryName( path );
using ( FileStream fs = new FileStream( path, FileMode.Open ) ) {
XmlSerializer xs = new XmlSerializer( typeof( Character3 ) );
res = (Character3)xs.Deserialize( fs );
}
using ( FileStream fs = new FileStream( Path.Combine( dir, "basic.xml" ), FileMode.Open ) ) {
XmlSerializer xs = new XmlSerializer( typeof( ImageEntry[] ) );
res.m_basic = (ImageEntry[])xs.Deserialize( fs );
}
using ( FileStream fs = new FileStream( Path.Combine( dir, "another.xml" ), FileMode.Open ) ) {
XmlSerializer xs = new XmlSerializer( typeof( List<ImageEntry> ) );
res.m_another = (List<ImageEntry>)xs.Deserialize( fs );
}
//res.ZReorder();
for ( int i = 0; i < res.Count; i++ ) {
int z = res[i].Z;
string file = Path.Combine( Path.Combine( dir, "images" ), z + ".png" );
#if DEBUG
Common.DebugWriteLine( "Character3.ctor(String); file=" + file );
#endif
if ( File.Exists( file ) ) {
res[i].SetImage( Common.ImageFromFile( file ) );
}
}
#if DEBUG
Common.DebugWriteLine( "Character3.FromXml()" );
for ( int i = 0; i < res.Count; i++ ) {
Common.DebugWriteLine( "i=" + i + "; title=" + res[i].title + "; (image==null)=" + (res[i].Image == null) );
}
Common.DebugWriteLine( "m_size=" + res.m_size );
#endif
return res;
}
public static Character3 FromFile( string path ) {
Character3 res;
using ( FileStream fs = new FileStream( path, FileMode.Open ) ) {
BinaryFormatter bf = new BinaryFormatter();
res = (Character3)bf.Deserialize( fs );
}
return res;
}
/// <summary>
/// 第2世代目のCharacterからのコンバート
/// </summary>
/// <param name="character"></param>
/// <returns></returns>
public Character3( Character character ) {
List<ImageEntry> basic = new List<ImageEntry>();
List<ImageEntry> another = new List<ImageEntry>();
string[] titles = new string[] { "base", "a", "aa", "i", "u", "e", "o", "xo", "nn" };
// zオーダーを更新しておく
for ( int i = 0; i < character.Images.Count; i++ ) {
character.Images[i].Z = i;
}
#if DEBUG
string t1 = "";
for ( int i = 0; i < character.Images.Count; i++ ) {
t1 += character.Images[i].ToString() + "\n";
}
System.Windows.Forms.MessageBox.Show( t1 );
#endif
foreach ( string title in titles ) {
bool found = false;
foreach ( ImageEntry img in character.Images ) {
if ( img.title == title ) {
ImageEntry cp = new ImageEntry( img.title, null, img.tag, img.IsDefault, img.Z );
cp.SetImage( img.GetImage() );
basic.Add( cp );
found = true;
break;
}
}
if ( !found ) {
if ( title == "base" ) {
basic.Add( new ImageEntry( title, null, "base", true ) );
} else {
basic.Add( new ImageEntry( title, null, "mouth", false ) );
}
}
}
// another
foreach ( ImageEntry img in character.Images ) {
bool is_basic = false;
foreach ( string title in titles ) {
if ( img.title == title ) {
is_basic = true;
break;
}
}
if ( !is_basic ) {
ImageEntry cp = new ImageEntry( img.title, null, img.tag, img.IsDefault, img.Z );
cp.SetImage( img.GetImage() );
another.Add( cp );
}
}
m_name = character.Name;
m_basic = basic.ToArray();
m_another = new List<ImageEntry>( another.ToArray() );
m_size = character.m_size;
m_type = CharacterType.def;
m_author = "";
m_version = "";
m_updated = true;
//ZReorder();
#if DEBUG
string t = "";
for ( int i = 0; i < m_basic.Length; i++ ) {
t += m_basic[i].ToString() + "\n";
}
for ( int i = 0; i < m_another.Count; i++ ) {
t += m_another[i].ToString() + "\n";
}
System.Windows.Forms.MessageBox.Show( t );
#endif
}
[XmlIgnore]
public Bitmap DefaultFace {
get {
List<int> type = new List<int>();
int count = -1;
foreach ( ImageEntry img in this ) {
count++;
if ( img.IsDefault ) {
type.Add( count );
}
}
return Face( type.ToArray() );
}
}
public IEnumerator<ImageEntry> GetEnumerator() {
for ( int i = 0; i < m_basic.Length; i++ ) {
yield return m_basic[i];
}
for ( int i = 0; i < m_another.Count; i++ ) {
yield return m_another[i];
}
}
public Bitmap Face( int[] targets ) {
if ( Width <= 0 || Height <= 0 ) {
return null;
}
// zオーダー順に描画する画像を並べ替える
int[] zorder = new int[targets.Length];
for ( int i = 0; i < targets.Length; i++ ) {
zorder[i] = this[targets[i]].Z;
}
bool c = true;
while ( c ) {
c = false;
for ( int i = 0; i < targets.Length - 1; i++ ) {
if ( zorder[i] > zorder[i + 1] ) {
int b = targets[i];
targets[i] = targets[i + 1];
targets[i + 1] = b;
b = zorder[i];
zorder[i] = zorder[i + 1];
zorder[i + 1] = b;
c = true;
}
}
if ( !c ) {
break;
}
}
// 前回描画したのと同じ描画要求であれば、キャッシュをそのまま返す
if ( m_cache != null && m_cache_draw != null ) {
if ( m_cache_draw.Length == targets.Length ) {
bool match = true;
for ( int i = 0; i < targets.Length; i++ ) {
if ( m_cache_draw[i] != targets[i] ) {
match = false;
break;
}
}
if ( match ) {
return (Bitmap)m_cache.Clone();
}
}
}
m_cache_draw = targets;
Bitmap bmp = new Bitmap( Width, Height );
using ( Graphics g = Graphics.FromImage( bmp ) ) {
for ( int i = 0; i < targets.Length; i++ ) {
ImageEntry img = this[targets[i]];
if ( img != null ) {
img.DrawTo( g );
}
}
}
if ( m_cache != null ) {
m_cache = null;
}
m_cache = (Bitmap)bmp.Clone();
return bmp;
}
public ImageEntry this[string title] {
get {
for ( int i = 0; i < m_basic.Length; i++ ) {
if ( m_basic[i].title == title ) {
return m_basic[i];
}
}
for ( int i = 0; i < m_another.Count; i++ ) {
if ( m_another[i].title == title ) {
return m_another[i];
}
}
return null;
}
/*set {
for ( int i = 0; i < m_basic.Length; i++ ) {
if ( m_basic[i].title == title ) {
m_basic[i] = value;
}
}
for ( int i = 0; i < m_another.Count; i++ ) {
if ( m_another[i].title == title ) {
m_another[i] = value;
}
}
}*/
}
public ImageEntry this[int zorder] {
get {
for ( int i = 0; i < m_basic.Length; i++ ) {
if ( m_basic[i].Z == zorder ) {
return m_basic[i];
}
}
for ( int i = 0; i < m_another.Count; i++ ) {
if ( m_another[i].Z == zorder ) {
return m_another[i];
}
}
return null;
}
set {
for ( int i = 0; i < m_basic.Length; i++ ) {
if ( m_basic[i].Z == zorder ) {
m_basic[i] = value;
m_basic[i].Z = zorder;
return;
}
}
for ( int i = 0; i < m_another.Count; i++ ) {
if ( m_another[i].Z == zorder ) {
m_another[i] = value;
m_another[i].Z = zorder;
return;
}
}
}
}
public Size Size {
get {
if ( m_type == CharacterType.def ) {
return m_size;
} else {
throw new NotImplementedException();
}
}
set {
m_size = value;
}
}
[XmlIgnore]
public int Width {
get {
return m_size.Width;
}
}
[XmlIgnore]
public int Height {
get {
return m_size.Height;
}
}
public object Clone() {
Character3 res = new Character3();
res.m_name = m_name;
res.m_author = m_author;
res.m_version = m_version;
res.m_type = m_type;
if ( m_plugin_config != null ) {
res.m_plugin_config = m_plugin_config.Clone();
}
for ( int i = 0; i < 9; i++ ) {
res.m_basic[i] = (ImageEntry)m_basic[i].Clone();
}
res.m_another.Clear();
for ( int i = 0; i < m_another.Count; i++ ) {
res.m_another.Add( (ImageEntry)m_another[i].Clone() );
}
res.m_updated = m_updated;
res.m_size = m_size;
return res;
}
private Character3( string name, string author, string version, ImageEntry[] basic, ImageEntry[] another, bool is_build_in )
: this( name, author, version, basic, another ) {
m_is_build_in = is_build_in;
}
public Character3( string name, string author, string version, ImageEntry[] basic, ImageEntry[] another ) {
m_type = CharacterType.def;
m_name = name;
m_author = author;
m_version = version;
if ( basic.Length < 9 ) {
throw new ArgumentException( "basic.Length < 9" );
}
int z = -1;
for ( int i = 0; i < 9; i++ ) {
z++;
m_basic[i] = (ImageEntry)basic[i].Clone();
m_basic[i].Z = z;
}
if ( another != null ) {
m_another = new List<ImageEntry>( another );
} else {
m_another = new List<ImageEntry>();
}
for ( int i = 0; i < m_another.Count; i++ ) {
z++;
m_another[i].Z = z;
}
int width = 0;
int height = 0;
if ( basic != null ) {
foreach ( ImageEntry img in basic ) {
if ( img.Image != null ) {
width = Math.Max( width, img.Image.Width );
height = Math.Max( height, img.Image.Height );
}
}
}
if ( another != null ) {
foreach ( ImageEntry img in another ) {
if ( img.Image != null ) {
width = Math.Max( width, img.Image.Width );
height = Math.Max( height, img.Image.Height );
}
}
}
//ZReorder();
m_size = new Size( width, height );
m_updated = false;
}
/// <summary>
/// キャラクタのタイプを取得します
/// </summary>
public CharacterType Type {
get {
return m_type;
}
}
/// <summary>
/// キャラクタの名称を取得します
/// </summary>
public string Name {
get {
return m_name;
}
set {
m_name = value;
}
}
}
}

View File

@ -1,136 +0,0 @@
/*
* CharacterConfigCollection.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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;
using System.Drawing;
using System.IO;
namespace LipSync {
/// <summary>
/// キャラクタ設定ファイルのリストを管理するクラス
/// </summary>
public static class CharacterConfigCollection {
/// <summary>
/// リストの最大長
/// </summary>
const int MAX_DICT_LEN = 128;
static List<CharacterConfigSpecifier> m_list = new List<CharacterConfigSpecifier>();
/// <summary>
/// IDがidであるキャラクタ設定ファイルがリストに登録されているかどうかを返します
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static bool IsRegistered( string id ) {
foreach ( CharacterConfigSpecifier item in m_list ) {
if ( item.ID == id ) {
return true;
}
}
return false;
}
/// <summary>
/// 現在のリストの内容を逐次返すiterator
/// </summary>
/// <returns></returns>
public static IEnumerator<CharacterConfigSpecifier> GetEnumerator() {
foreach ( CharacterConfigSpecifier item in m_list ) {
yield return item;
}
yield break;
}
/// <summary>
/// ファイル名がidであるキャラクタ設定ファイルのプレビューを返します未登録の場合はnullを返します
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static Image GetPreviewImage( string id ) {
foreach ( CharacterConfigSpecifier item in m_list ) {
if ( item.ID == id ) {
return item.Image;
}
}
return null;
}
/// <summary>
/// ファイル名がfileであるキャラクタ設定ファイルを読み込みリストに登録します
/// 既に登録済みであっても,登録された時点よりファイルが新しければ,登録内容を更新します
/// </summary>
/// <param name="file"></param>
public static void Register( string file ) {
#if DEBUG
Common.DebugWriteLine( "CharacterConfigCollection.Register(String); m_list.Count=" + m_list.Count );
#endif
if ( !File.Exists( file ) ) {
return;
}
DateTime date = File.GetLastWriteTimeUtc( file );
DateTime date_registered = new DateTime();
int index = -1;
for( int i = 0; i < m_list.Count; i++ ){
if ( m_list[i].ID == file ) {
index = i;
date_registered = m_list[i].LastModefied;
break;
}
}
// Character, Character3クラスを読み込んで登録
CharacterConfigSpecifier item = null;
if ( Path.GetFileName( file ).ToLower() == "content.xml" ) {
Character3 ch = Character3.FromXml( file );
item = new CharacterConfigSpecifier( ch, file, File.GetLastWriteTimeUtc( file ) );
} else {
try {
Character3 ch = Character3.FromFile( file );
item = new CharacterConfigSpecifier( ch, file, File.GetLastWriteTimeUtc( file ) );
} catch {
try {
Character t = LipSync.Character.FromFile( file );
item = new CharacterConfigSpecifier( t, file, File.GetLastWriteTimeUtc( file ) );
} catch {
item = new CharacterConfigSpecifier( file, File.GetLastWriteTimeUtc( file ) );
}
}
}
if ( item != null ) {
#if DEBUG
string dir = Path.GetDirectoryName( file );
Common.GetThumbnailImage( item.Image, 128, 128 ).Save( Path.Combine( dir, Path.GetFileNameWithoutExtension( file ) ) + ".png" );
#endif
if ( index >= 0 ) {
if ( date > date_registered ) {
m_list.RemoveAt( index );
if ( m_list.Count > MAX_DICT_LEN ) {
m_list.RemoveAt( 0 );
}
m_list.Add( item );
}
} else {
m_list.Add( item );
}
}
}
}
}

View File

@ -1,95 +0,0 @@
/*
* CharacterConfigSpecifier.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
/// <summary>
/// キャラクタ設定ファイルを識別するためのクラス
/// </summary>
public class CharacterConfigSpecifier {
Image m_preview;
string m_id;
DateTime m_last_modefied;
const int w = 256;
const int h = 256;
/// <summary>
/// キャラクタ設定ファイルを特定するID通常はファイルへのフルパス
/// </summary>
public string ID {
get {
return m_id;
}
}
/// <summary>
/// キャラクタ設定ファイルの最終更新時刻
/// </summary>
public DateTime LastModefied {
get {
return m_last_modefied;
}
}
/// <summary>
/// キャラクタ設定ファイルのプレビュー
/// </summary>
public Image Image {
get {
return m_preview;
}
}
public CharacterConfigSpecifier( string id, DateTime date ) {
m_id = id;
m_last_modefied = date;
}
public CharacterConfigSpecifier( Character3 character, string id, DateTime date ) {
if ( character != null ) {
Bitmap bmp = character.DefaultFace;
Rectangle rc = Common.GetNonTransparentRegion( bmp );
using ( Bitmap t = new Bitmap( rc.Width, rc.Height ) )
using ( Graphics g = Graphics.FromImage( t ) ) {
g.DrawImage(
bmp,
0, 0, rc, GraphicsUnit.Pixel );
m_preview = Common.GetThumbnailImage( t, w, h );
}
}
m_id = id;
m_last_modefied = date;
}
public CharacterConfigSpecifier( Character character, string id, DateTime date ) {
if ( character != null ) {
Bitmap bmp = character.DefaultFace;
Rectangle rc = Common.GetNonTransparentRegion( bmp );
using ( Bitmap t = new Bitmap( rc.Width, rc.Height ) )
using ( Graphics g = Graphics.FromImage( t ) ) {
g.DrawImage(
bmp,
0, 0, rc, GraphicsUnit.Pixel );
m_preview = Common.GetThumbnailImage( t, w, h );
}
}
m_id = id;
m_last_modefied = date;
}
}
}

View File

@ -1,95 +0,0 @@
/*
* ColorSet.cs
* Copyright (c) 2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
public class ColorSet {
public int A = 255;
public int R;
public int G;
public int B;
public ColorSet( int alpha, int red, int green, int blue ) {
if ( red < 0 || 255 < red ) {
throw new ArgumentOutOfRangeException( "red" );
}
if ( green < 0 || 255 < green ) {
throw new ArgumentOutOfRangeException( "green" );
}
if ( blue < 0 || 255 < blue ) {
throw new ArgumentOutOfRangeException( "blue" );
}
if ( alpha < 0 || 255 < alpha ) {
throw new ArgumentOutOfRangeException( "alpha" );
}
R = red;
G = green;
B = blue;
A = alpha;
}
public ColorSet()
: this( 255, 255, 255, 255 ) {
}
public ColorSet( int red, int green, int blue )
: this( 255, red, green, blue ) {
}
public ColorSet( Color color )
: this( color.A, color.R, color.G, color.B ) {
}
public ColorSet( int alpha, ColorSet color )
: this( alpha, color.R, color.G, color.B ) {
}
public ColorSet( int alpha, Color color ) :
this( alpha, color.R, color.G, color.B ) {
}
public Color Color {
get {
return Color.FromArgb( A, R, G, B );
}
}
public override bool Equals( object obj ) {
return Equals( obj, false );
}
public bool Equals( object obj, bool ignore_alpha ) {
if ( obj is ColorSet ) {
ColorSet item = (ColorSet)obj;
if ( ignore_alpha ) {
return (item.R == R && item.G == G && item.B == B);
} else {
return (item.A == A && item.R == R && item.G == G && item.B == B);
}
} else if ( obj is Color ) {
Color item = (Color)obj;
if ( ignore_alpha ) {
return (item.R == R && item.G == G && item.B == B);
} else {
return (item.A == A && item.R == R && item.G == G && item.B == B);
}
} else {
return base.Equals( obj );
}
}
}
}

View File

@ -1,316 +0,0 @@
/*
* Command.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
public class Command {
public TimeTableType target;
public CommandType type;
public TimeTableEntry item;
public TimeTable table;
public TimeTableGroup tablegroup;
public Image image;
public Point position;
public int group;
public int track;
public int entry;
public string str;
public float floatValue;
public Size size;
public Telop telop;
public uint dwRate;
public uint dwScale;
public Color color;
public Command child;
public object[] args;
public static Command GCommandChangeBackgroundColor( Color color ){
Command ret = new Command();
ret.target = TimeTableType.whole;
ret.type = CommandType.changeBackgroundColor;
ret.color = color;
return ret;
}
public static Command GCommandAddTelop( Telop telop ) {
Command ret = new Command();
ret.target = TimeTableType.telop;
ret.type = CommandType.addTelop;
if ( telop != null ) {
ret.telop = (Telop)telop.Clone();
}
return ret;
}
public static Command GCommandAddTelopRange( Telop[] telops ) {
Command ret = new Command();
ret.target = TimeTableType.telop;
ret.type = CommandType.addTelopRange;
ret.args = new object[1];
Telop[] add = new Telop[telops.Length];
for ( int i = 0; i < add.Length; i++ ) {
add[i] = (Telop)telops[i].Clone();
}
ret.args[0] = add;
return ret;
}
public static Command GCommandEditTelop( int id, Telop telop ) {
Command ret = new Command();
ret.target = TimeTableType.telop;
ret.type = CommandType.editTelop;
ret.entry = id;
if ( telop != null ) {
ret.telop = (Telop)telop.Clone();
}
return ret;
}
public static Command GCommandDeleteTelop( Telop item ) {
Command ret = new Command();
ret.target = TimeTableType.telop;
ret.type = CommandType.deleteTelop;
ret.telop = (Telop)item.Clone();
return ret;
}
public static Command GCommandDeleteTelopRange( Telop[] items ) {
Command ret = new Command();
ret.target = TimeTableType.telop;
ret.type = CommandType.deleteTelopRange;
ret.args = new object[1];
Telop[] items2 = new Telop[items.Length];
for ( int i = 0; i < items2.Length; i++ ) {
items2[i] = (Telop)items[i].Clone();
}
ret.args[0] = items2;
return ret;
}
public static Command GCommandDeleteTimeTableGroup( TimeTableType target, int group ) {
Command ret = new Command();
ret.target = target;
ret.type = CommandType.deleteGroup;
ret.group = group;
return ret;
}
public static Command GCommandDeleteTimeTable( TimeTableType target, int group, int track ) {
Command ret = new Command();
ret.target = target;
ret.type = CommandType.deleteTimeTable;
ret.group = group;
ret.track = track;
return ret;
}
public static Command GCommandSetMp3( string file_name ){
Command ret = new Command();
ret.target = TimeTableType.whole;
ret.type = CommandType.setMP3;
ret.str = file_name;
return ret;
}
public static Command GCommandChangeVideoSize( Size size ){
Command ret = new Command();
ret.target = TimeTableType.whole;
ret.type = CommandType.changeVideoSize;
ret.size = size;
return ret;
}
public static Command GCommandShiftTimeTable( TimeTableType target, int track, float floatValue ){
Command ret = new Command();
ret.target = target;
if ( target == TimeTableType.character ) {
ret.group = track;
} else {
ret.track = track;
}
ret.type = CommandType.shiftTimeTable;
ret.floatValue = floatValue;
return ret;
}
public static Command GCommandChangeFps( uint rate, uint scale ){
Command ret = new Command();
ret.target = TimeTableType.whole;
ret.type = CommandType.changeFps;
ret.dwRate = rate;
ret.dwScale = scale;
return ret;
}
public static Command GCommandChangeScale( TimeTableType target, int group, int track, float scale ){
Command ret = new Command();
ret.target = target;
ret.type = CommandType.changeScale;
ret.group = group;
ret.track = track;
ret.floatValue = scale;
return ret;
}
public static Command GCommandChangePluginConfig( int track, string config ) {
Command ret = new Command();
ret.target = TimeTableType.whole;
ret.type = CommandType.changePluginConfig;
ret.track = track;
ret.str = config;
return ret;
}
public static Command GCommandSetAvi( int track, string file_name ){
Command ret = new Command();
ret.target = TimeTableType.another;
ret.type = CommandType.setAvi;
ret.track = track;
ret.str = file_name;
return ret;
}
public static Command GCommandEditTimeTableEntry( TimeTableType target, int group, int track, int entry, TimeTableEntry item ) {
Command ret = new Command();
ret.target = target;
ret.type = CommandType.editEntry;
ret.group = group;
ret.track = track;
ret.entry = entry;
if ( item != null ) {
ret.item = (TimeTableEntry)item.Clone();
}
return ret;
}
public static Command GCommandAddTimeTableEntry( TimeTableType target, int group, int track, TimeTableEntry item ) {
Command ret = new Command();
ret.target = target;
ret.type = CommandType.addEntry;
ret.group = group;
ret.track = track;
if ( item != null ) {
ret.item = (TimeTableEntry)item.Clone();
}
return ret;
}
public static Command GCommandDeleteTimeTableEntry( TimeTableType target, int group, int track, TimeTableEntry item ) {
Command ret = new Command();
ret.target = target;
ret.type = CommandType.deleteEntry;
ret.group = group;
ret.track = track;
if ( item != null ) {
ret.item = (TimeTableEntry)item.Clone();
}
return ret;
}
public static Command GCommandEditTimeTable( TimeTableType target, int group, int track, TimeTable table ) {
Command ret = new Command();
ret.target = target;
ret.type = CommandType.editTimeTable;
ret.group = group;
ret.track = track;
if ( table != null ) {
ret.table = (TimeTable)table.Clone();
}
return ret;
}
public static Command GCommandAddTimeTable( TimeTableType target, int group, int track, TimeTable table ){
Command ret = new Command();
ret.target = target;
ret.type = CommandType.addTimeTable;
ret.group = group;
ret.track = track;
if ( table != null ) {
ret.table = (TimeTable)table.Clone();
}
return ret;
}
public static Command GCommandEditGroup( TimeTableType target, int group, TimeTableGroup table_group ) {
Command ret = new Command();
ret.target = target;
ret.type = CommandType.editGroup;
ret.group = group;
ret.tablegroup = (TimeTableGroup)table_group.Clone();
return ret;
}
public static Command GCommandAddGroup( TimeTableType target, int group, TimeTableGroup tablegroup ){
Command ret = new Command();
ret.target = target;
ret.type = CommandType.addGroup;
ret.group = group;
if ( tablegroup != null ) {
ret.tablegroup = (TimeTableGroup)tablegroup.Clone();
} else {
ret.tablegroup = null;
}
return ret;
}
public static Command GCommandSetImage( int track, Image img ){
Command ret = new Command();
ret.target = TimeTableType.another;
ret.type = CommandType.setImage;
ret.track = track;
if ( img != null ) {
ret.image = (Image)img.Clone();
} else {
ret.image = null;
}
return ret;
}
public static Command GCommandSetPosition( TimeTableType target, int group, int track, Point position ){
Command ret = new Command();
ret.target = target;
ret.type = CommandType.setPosition;
ret.group = group;
ret.track = track;
ret.position = position;
return ret;
}
public static Command GCommandNothing() {
Command ret = new Command();
ret.target = TimeTableType.none;
return ret;
}
private Command() {
}
public override string ToString() {
string res = "";
res += target.ToString();
res += "," + type.ToString();
res += ",group=" + group + ",track=" + track + ";entry=" + entry;
if ( item == null ) {
res += ";item=null";
} else {
res += ";item={begin=" + item.begin + ",end=" + item.end + ",body=" + item.body;
}
return res;
}
}
}

View File

@ -1,44 +0,0 @@
/*
* CommandType.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
public enum CommandType {
nothing,
addEntry,
deleteEntry,
editEntry,
addTimeTable,
deleteTimeTable,
editTimeTable,
addGroup, // CommandTarget == characterの時のみ
editGroup, // CommandTarget == characterの時のみ
deleteGroup, // CommandTarget == characterの時のみ
setPosition,
setImage,
changePluginConfig,
changeFps,
changeVideoSize,
shiftTimeTable,
changeScale,
setMP3,
addTelop,
addTelopRange,
editTelop,
deleteTelop,
deleteTelopRange,
setAvi,
changeBackgroundColor,
}
}

View File

@ -1,235 +0,0 @@
/*
* DisplacementControl.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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;
using System.Windows.Forms;
using Boare.Lib.AppUtil;
namespace LipSync {
public partial class DisplacementControl : Form, IMultiLanguageControl {
private PointF m_scaleandoffset_x = new PointF( 1f, 0f );
private PointF m_scaleandoffset_y = new PointF( 1f, 0f );
private PointF m_scaleandoffset_alpha = new PointF( 400f, 0.3f );
private PointF m_scaleandoffset_scale = new PointF( 40f, 0.5f );
private PointF m_scaleandoffset_rotate = new PointF( 1f, 0f );
private bool m_first_scaleandoffset = true;
public DisplacementControl() {
InitializeComponent();
ApplyFont( AppManager.Config.Font.GetFont() );
ApplyLanguage();
Rectangle r = AppManager.Config.CurveWindowPos;
Point pt_lt = new Point( r.Left, r.Top );
Point pt_lb = new Point( r.Left, r.Bottom );
Point pt_rt = new Point( r.Right, r.Top );
Point pt_rb = new Point( r.Right, r.Bottom );
bool visible = false;
foreach ( Screen s in Screen.AllScreens ) {
visible = visible | (IsInRectangle( pt_lt, s.Bounds ) | IsInRectangle( pt_lb, s.Bounds ) | IsInRectangle( pt_rt, s.Bounds ) | IsInRectangle( pt_rb, s.Bounds ));
}
if ( visible ) {
this.Left = r.Left;
this.Top = r.Top;
this.Width = r.Width;
this.Height = r.Height;
} else {
this.Width = Screen.PrimaryScreen.Bounds.Width / 2;
this.Height = Screen.PrimaryScreen.Bounds.Height / 2;
this.Left = this.Width / 2;
this.Top = this.Height / 2;
}
if ( AppManager.Config.CurveMaximized ) {
this.WindowState = FormWindowState.Maximized;
} else {
this.WindowState = FormWindowState.Normal;
}
this.SizeChanged += new EventHandler( DisplacementControl_LocationOrSizeChanged );
this.LocationChanged += new EventHandler( DisplacementControl_LocationOrSizeChanged );
}
/// <summary>
/// どのカーブも選択されていない状態にします
/// </summary>
public void SetSelectedNone() {
curveEditor.Clear();
curveEditor.ClearBuffer();
comboObjects.SelectedIndex = -1;
}
/// <summary>
/// rectの中にpointが入っているかどうかを判定
/// </summary>
/// <param name="point"></param>
/// <param name="rect"></param>
/// <returns></returns>
private static bool IsInRectangle( Point point, Rectangle rect ) {
if ( rect.X <= point.X && point.X <= rect.X + rect.Width ) {
if ( rect.Y <= point.Y && point.Y <= rect.Y + rect.Height ) {
return true;
}
}
return false;
}
public void ApplyLanguage() {
this.Text = _( "Edit Motion Curve" );
menuClose.Text = _( "Close" ) + "(&C)";
menuFile.Text = _( "File" ) + "(&F)";
menuRedo.Text = _( "Redo" );
menuUndo.Text = _( "Undo" );
menuEdit.Text = _( "Edit" ) + "(&E)";
}
public void ApplyFont( Font font ) {
this.Font = font;
foreach ( Control c in this.Controls ) {
Boare.Lib.AppUtil.Misc.ApplyFontRecurse( c, font );
}
}
public static string _( string s ) {
return Messaging.GetMessage( s );
}
/// <summary>
/// 現在の編集情報を破棄します
/// </summary>
public void Clear() {
curveEditor.Clear();
comboObjects.Items.Clear();
comboObjects.Text = "";
}
private void DisplacementControl_FormClosing( object sender, FormClosingEventArgs e ) {
e.Cancel = true;
}
private void menuUndo_Click( object sender, EventArgs e ) {
curveEditor.Undo();
}
private void menuRedo_Click( object sender, EventArgs e ) {
curveEditor.Redo();
}
private void menuEdit_DropDownOpening( object sender, EventArgs e ) {
menuUndo.Enabled = curveEditor.IsUndoAvailable;
menuRedo.Enabled = curveEditor.IsRedoAvailable;
}
private void comboObjects_SelectedIndexChanged( object sender, EventArgs e ) {
int index = comboObjects.SelectedIndex;
#if DEBUG
Console.WriteLine( "DisplacementControl+comboObjects_SelectedIndexChanged" );
Console.WriteLine( " index=" + index );
#endif
if ( m_first_scaleandoffset ) {
float scale, offset;
if ( curveEditor.GetYScaleAndYOffset( "X", out scale, out offset ) ) {
m_scaleandoffset_x = new PointF( scale, offset );
}
if ( curveEditor.GetYScaleAndYOffset( "Y", out scale, out offset ) ) {
m_scaleandoffset_y = new PointF( scale, offset );
}
if ( curveEditor.GetYScaleAndYOffset( "Alpha", out scale, out offset ) ) {
m_scaleandoffset_alpha = new PointF( scale, offset );
#if DEBUG
Console.WriteLine( "Alpha, scale=" + scale + "; offset=" + offset );
#endif
}
if ( curveEditor.GetYScaleAndYOffset( "Scale", out scale, out offset ) ) {
m_scaleandoffset_scale = new PointF( scale, offset );
}
if ( curveEditor.GetYScaleAndYOffset( "Rotate", out scale, out offset ) ) {
m_scaleandoffset_rotate = new PointF( scale, offset );
}
}
curveEditor.Clear();
curveEditor.ClearBuffer();
if ( index >= 0 ) {
TagForTreeNode node = (TagForTreeNode)comboObjects.Items[index];
int id = node.id_or_index;
switch ( node.type ) {
case ZorderItemType.another:
curveEditor.Add( "X", AppManager.SaveData.m_group_another[id].mc_x );
curveEditor.Add( "Y", AppManager.SaveData.m_group_another[id].mc_y );
curveEditor.Add( "Alpha", AppManager.SaveData.m_group_another[id].mc_alpha );
curveEditor.Add( "Scale", AppManager.SaveData.m_group_another[id].mc_scale );
curveEditor.Add( "Roate", AppManager.SaveData.m_group_another[id].mc_rotate );
break;
case ZorderItemType.character:
curveEditor.Add( "X", AppManager.SaveData.m_groups_character[id].mc_x );
curveEditor.Add( "Y", AppManager.SaveData.m_groups_character[id].mc_y );
curveEditor.Add( "Alpha", AppManager.SaveData.m_groups_character[id].mc_alpha );
curveEditor.Add( "Scale", AppManager.SaveData.m_groups_character[id].mc_scale );
curveEditor.Add( "Roate", AppManager.SaveData.m_groups_character[id].mc_rotate );
break;
case ZorderItemType.plugin:
curveEditor.Add( "X", AppManager.SaveData.m_group_plugin[id].mc_x );
curveEditor.Add( "Y", AppManager.SaveData.m_group_plugin[id].mc_y );
curveEditor.Add( "Alpha", AppManager.SaveData.m_group_plugin[id].mc_alpha );
curveEditor.Add( "Scale", AppManager.SaveData.m_group_plugin[id].mc_scale );
curveEditor.Add( "Roate", AppManager.SaveData.m_group_plugin[id].mc_rotate );
break;
case ZorderItemType.telop:
curveEditor.Add( "X", AppManager.SaveData[id].mc_x );
curveEditor.Add( "Y", AppManager.SaveData[id].mc_y );
curveEditor.Add( "Alpha", AppManager.SaveData[id].mc_alpha );
curveEditor.Add( "Scale", AppManager.SaveData[id].mc_scale );
curveEditor.Add( "Roate", AppManager.SaveData[id].mc_rotate );
break;
}
curveEditor.SetYScaleAndYOffset( "X", m_scaleandoffset_x.X, m_scaleandoffset_x.Y );
curveEditor.SetYScaleAndYOffset( "Y", m_scaleandoffset_y.X, m_scaleandoffset_y.Y );
curveEditor.SetYScaleAndYOffset( "Alpha", m_scaleandoffset_alpha.X, m_scaleandoffset_alpha.Y );
curveEditor.SetYScaleAndYOffset( "Scale", m_scaleandoffset_scale.X, m_scaleandoffset_scale.Y );
curveEditor.SetYScaleAndYOffset( "Rotate", m_scaleandoffset_rotate.X, m_scaleandoffset_rotate.Y );
if ( m_first_scaleandoffset ) {
m_first_scaleandoffset = false;
}
curveEditor.Invalidate();
}
}
private void DisplacementControl_VisibleChanged( object sender, EventArgs e ) {
ApplyLanguage();
}
private void menuVisualNumericInput_CheckedChanged( object sender, EventArgs e ) {
this.Invalidate();
}
private void curveEditor_CurveEdited() {
AppManager.Edited = true;
}
private void DisplacementControl_LocationOrSizeChanged( object sender, EventArgs e ) {
if ( AppManager.Config != null ) {
if ( this.WindowState == FormWindowState.Normal ) {
AppManager.Config.CurveWindowPos = this.Bounds;
}
AppManager.Config.CurveMaximized = (this.WindowState == FormWindowState.Maximized);
}
}
private void menuClose_Click( object sender, EventArgs e ) {
this.Close();
}
}
}

View File

@ -1,194 +0,0 @@
/*
* DisplacementControl.designer.cs
* Copyright (c) 2007-2009 kbinani
*
* This file is part of LipSync.
*
* LipSync is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* LipSync 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 LipSync {
partial class DisplacementControl {
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
protected override void Dispose( bool disposing ) {
if ( disposing && (components != null) ) {
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
private void InitializeComponent() {
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuFile = new System.Windows.Forms.ToolStripMenuItem();
this.menuClose = new System.Windows.Forms.ToolStripMenuItem();
this.menuEdit = new System.Windows.Forms.ToolStripMenuItem();
this.menuUndo = new System.Windows.Forms.ToolStripMenuItem();
this.menuRedo = new System.Windows.Forms.ToolStripMenuItem();
this.comboObjects = new System.Windows.Forms.ComboBox();
this.curveEditor = new CurveEditor.CurveEditor();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange( new System.Windows.Forms.ToolStripItem[] {
this.menuFile,
this.menuEdit} );
this.menuStrip1.Location = new System.Drawing.Point( 0, 0 );
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size( 557, 24 );
this.menuStrip1.TabIndex = 7;
this.menuStrip1.Text = "menuStrip1";
//
// menuFile
//
this.menuFile.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] {
this.menuClose} );
this.menuFile.Name = "menuFile";
this.menuFile.Size = new System.Drawing.Size( 66, 20 );
this.menuFile.Text = "ファイル(&F)";
//
// menuClose
//
this.menuClose.Name = "menuClose";
this.menuClose.ShortcutKeys = System.Windows.Forms.Keys.F9;
this.menuClose.Size = new System.Drawing.Size( 152, 22 );
this.menuClose.Text = "閉じる(&C)";
this.menuClose.Click += new System.EventHandler( this.menuClose_Click );
//
// menuEdit
//
this.menuEdit.DropDownItems.AddRange( new System.Windows.Forms.ToolStripItem[] {
this.menuUndo,
this.menuRedo} );
this.menuEdit.Name = "menuEdit";
this.menuEdit.Size = new System.Drawing.Size( 56, 20 );
this.menuEdit.Text = "編集(&E)";
this.menuEdit.DropDownOpening += new System.EventHandler( this.menuEdit_DropDownOpening );
//
// menuUndo
//
this.menuUndo.Name = "menuUndo";
this.menuUndo.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
this.menuUndo.Size = new System.Drawing.Size( 192, 22 );
this.menuUndo.Text = "元に戻す(&U)";
this.menuUndo.Click += new System.EventHandler( this.menuUndo_Click );
//
// menuRedo
//
this.menuRedo.Name = "menuRedo";
this.menuRedo.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.Z)));
this.menuRedo.Size = new System.Drawing.Size( 192, 22 );
this.menuRedo.Text = "やり直し(&R)";
this.menuRedo.Click += new System.EventHandler( this.menuRedo_Click );
//
// comboObjects
//
this.comboObjects.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.comboObjects.FormattingEnabled = true;
this.comboObjects.Location = new System.Drawing.Point( 0, 24 );
this.comboObjects.Margin = new System.Windows.Forms.Padding( 0, 0, 0, 1 );
this.comboObjects.Name = "comboObjects";
this.comboObjects.Size = new System.Drawing.Size( 557, 20 );
this.comboObjects.TabIndex = 8;
this.comboObjects.SelectedIndexChanged += new System.EventHandler( this.comboObjects_SelectedIndexChanged );
//
// curveEditor1
//
this.curveEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.curveEditor.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.curveEditor.ChangeXScaleWithWheel = true;
this.curveEditor.ChangeYScaleWithWheel = true;
this.curveEditor.ControlMaster = System.Drawing.Color.FromArgb( ((int)(((byte)(255)))), ((int)(((byte)(130)))), ((int)(((byte)(0)))) );
this.curveEditor.ControlNormal = System.Drawing.Color.FromArgb( ((int)(((byte)(51)))), ((int)(((byte)(192)))), ((int)(((byte)(64)))) );
this.curveEditor.ControlPointSize = 2;
this.curveEditor.ControlPointType = CurveEditor.PointType.Circle;
this.curveEditor.DataPoint = System.Drawing.Color.Black;
this.curveEditor.DataPointHilight = System.Drawing.Color.Red;
this.curveEditor.DataPointSize = 2;
this.curveEditor.DataPointType = CurveEditor.PointType.Circle;
this.curveEditor.HandleMaster = System.Drawing.Color.FromArgb( ((int)(((byte)(240)))), ((int)(((byte)(144)))), ((int)(((byte)(160)))) );
this.curveEditor.HandleNormal = System.Drawing.Color.FromArgb( ((int)(((byte)(255)))), ((int)(((byte)(130)))), ((int)(((byte)(0)))) );
this.curveEditor.LabelBackground = System.Drawing.Color.FromArgb( ((int)(((byte)(172)))), ((int)(((byte)(172)))), ((int)(((byte)(172)))) );
this.curveEditor.ListBackground = System.Drawing.Color.FromArgb( ((int)(((byte)(143)))), ((int)(((byte)(143)))), ((int)(((byte)(143)))) );
this.curveEditor.Location = new System.Drawing.Point( 0, 45 );
this.curveEditor.MainScaleLine = System.Drawing.Color.FromArgb( ((int)(((byte)(44)))), ((int)(((byte)(44)))), ((int)(((byte)(44)))) );
this.curveEditor.Margin = new System.Windows.Forms.Padding( 0 );
this.curveEditor.MaxXScale = 100F;
this.curveEditor.MaxYScale = 1000F;
this.curveEditor.MinimumSize = new System.Drawing.Size( 100, 100 );
this.curveEditor.MinXScale = 1F;
this.curveEditor.MinYScale = 0.2F;
this.curveEditor.Name = "curveEditor1";
this.curveEditor.RescaleYEnabled = true;
this.curveEditor.ScaleLine = System.Drawing.Color.FromArgb( ((int)(((byte)(94)))), ((int)(((byte)(94)))), ((int)(((byte)(94)))) );
this.curveEditor.ScrollEnabled = true;
this.curveEditor.ShowList = true;
this.curveEditor.Size = new System.Drawing.Size( 557, 340 );
this.curveEditor.SubScaleLine = System.Drawing.Color.FromArgb( ((int)(((byte)(110)))), ((int)(((byte)(110)))), ((int)(((byte)(110)))) );
this.curveEditor.TabIndex = 6;
this.curveEditor.XLabel = CurveEditor.XLabel.Bottom;
this.curveEditor.XOffset = 0F;
this.curveEditor.XScale = 1F;
this.curveEditor.YLabel = CurveEditor.YLabel.Left;
this.curveEditor.YOffset = 0F;
this.curveEditor.YScale = 0.2F;
this.curveEditor.CurveEdited += new CurveEditor.CurveEditor.CurveEditedEventHandler( this.curveEditor_CurveEdited );
//
// DisplacementControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 12F );
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size( 557, 385 );
this.Controls.Add( this.comboObjects );
this.Controls.Add( this.curveEditor );
this.Controls.Add( this.menuStrip1 );
this.MainMenuStrip = this.menuStrip1;
this.Name = "DisplacementControl";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "変位の制御";
this.VisibleChanged += new System.EventHandler( this.DisplacementControl_VisibleChanged );
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler( this.DisplacementControl_FormClosing );
this.menuStrip1.ResumeLayout( false );
this.menuStrip1.PerformLayout();
this.ResumeLayout( false );
this.PerformLayout();
}
#endregion
private CurveEditor.CurveEditor curveEditor;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem menuFile;
private System.Windows.Forms.ToolStripMenuItem menuEdit;
public System.Windows.Forms.ToolStripMenuItem menuUndo;
public System.Windows.Forms.ToolStripMenuItem menuRedo;
public System.Windows.Forms.ComboBox comboObjects;
private System.Windows.Forms.ToolStripMenuItem menuClose;
}
}

Some files were not shown because too many files have changed in this diff Show More