2009-07-30 08:02:59 -07:00
|
|
|
|
/*
|
|
|
|
|
* UstVibrato.cs
|
|
|
|
|
* Copyright (c) 2009 kbinani
|
|
|
|
|
*
|
|
|
|
|
* This file is part of Boare.Lib.Vsq.
|
|
|
|
|
*
|
|
|
|
|
* Boare.Lib.Vsq is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the BSD License.
|
|
|
|
|
*
|
|
|
|
|
* Boare.Lib.Vsq is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
*/
|
|
|
|
|
using System;
|
|
|
|
|
|
2009-09-07 03:44:18 -07:00
|
|
|
|
using bocoree;
|
|
|
|
|
|
2009-07-30 08:02:59 -07:00
|
|
|
|
namespace Boare.Lib.Vsq {
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class UstVibrato : ICloneable {
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 音符の長さに対する、パーセントで表したビブラートの長さ。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float Length;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ミリセカンドで表したビブラートによるピッチ振動の周期
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float Period;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Centで表した、ビブラートによるピッチ振動の振幅。Peak to Peakは2*Depthとなる。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float Depth;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ビブラート長さに対する、パーセントで表したピッチ振動のフェードインの長さ。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float In;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ビブラートの長さに対するパーセントで表したピッチ振動のフェードアウトの長さ。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float Out;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ピッチ振動開始時の位相。2PIに対するパーセントで表す。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float Phase;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ピッチ振動の中心値と、音符の本来の音の高さからのずれ。Depthに対するパーセントで表す。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float Shift;
|
|
|
|
|
public float Unknown = 100;
|
|
|
|
|
|
2009-09-07 03:44:18 -07:00
|
|
|
|
public UstVibrato( String line ) {
|
2009-07-30 08:02:59 -07:00
|
|
|
|
if ( line.ToLower().StartsWith( "vbr=" ) ) {
|
2009-09-07 03:44:18 -07:00
|
|
|
|
String[] spl = line.Split( '=' );
|
2009-07-30 08:02:59 -07:00
|
|
|
|
spl = spl[1].Split( ',' );
|
|
|
|
|
//VBR=65,180,70,20.0,17.6,82.8,49.8,100
|
|
|
|
|
if ( spl.Length >= 8 ) {
|
|
|
|
|
Length = float.Parse( spl[0] );
|
|
|
|
|
Period = float.Parse( spl[1] );
|
|
|
|
|
Depth = float.Parse( spl[2] );
|
|
|
|
|
In = float.Parse( spl[3] );
|
|
|
|
|
Out = float.Parse( spl[4] );
|
|
|
|
|
Phase = float.Parse( spl[5] );
|
|
|
|
|
Shift = float.Parse( spl[6] );
|
|
|
|
|
Unknown = float.Parse( spl[7] );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UstVibrato() {
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-07 03:44:18 -07:00
|
|
|
|
public override String ToString() {
|
2009-07-30 08:02:59 -07:00
|
|
|
|
return "VBR=" + Length + "," + Period + "," + Depth + "," + In + "," + Out + "," + Phase + "," + Shift + "," + Unknown;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object Clone() {
|
|
|
|
|
UstVibrato ret = new UstVibrato();
|
|
|
|
|
ret.Length = Length;
|
|
|
|
|
ret.Period = Period;
|
|
|
|
|
ret.Depth = Depth;
|
|
|
|
|
ret.In = In;
|
|
|
|
|
ret.Out = Out;
|
|
|
|
|
ret.Phase = Phase;
|
|
|
|
|
ret.Shift = Shift;
|
|
|
|
|
ret.Unknown = Unknown;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|