Example #1
0
 /// <summary>
 /// コンストラクタ。
 /// </summary>
 /// <param name="lipId">口形状種別ID。</param>
 /// <param name="linkType">前の音からの繋ぎ方を表す列挙値。</param>
 /// <param name="lengthPercent">
 /// フレーム長の基準値に対するパーセント値。
 /// </param>
 public LipSyncUnit(
     LipId lipId,
     LinkType linkType,
     int lengthPercent)
 {
     this.LipId = lipId;
     this.LinkType = linkType;
     this.LengthPercent = lengthPercent;
 }
Example #2
0
        /// <summary>
        /// 口形状種別IDに対応する既定のモーフ情報を作成する。
        /// </summary>
        /// <param name="id">口形状種別ID。</param>
        /// <returns>既定のモーフ情報。</returns>
        public static MorphInfo CreateDefaultLipMorph(LipId id)
        {
            IEnumerable<MorphWeightData> weights = null;

            switch (id)
            {
            case LipId.Closed:
                weights = new MorphWeightData[0];
                break;

            case LipId.A:
                weights = new[] {
                    new MorphWeightData { MorphName = "あ", Weight = 1 } };
                break;

            case LipId.I:
                weights = new[] {
                    new MorphWeightData { MorphName = "い", Weight = 1 } };
                break;

            case LipId.U:
                weights = new[] {
                    new MorphWeightData { MorphName = "う", Weight = 1 } };
                break;

            case LipId.E:
                weights = new[] {
                    new MorphWeightData { MorphName = "え", Weight = 1 } };
                break;

            case LipId.O:
                weights = new[] {
                    new MorphWeightData { MorphName = "お", Weight = 1 } };
                break;

            default:
                throw new InvalidEnumArgumentException(
                    "id",
                    (int)id,
                    typeof(LipId));
            }

            return new MorphInfo(weights);
        }
            /// <summary>
            /// コンストラクタ。
            /// </summary>
            /// <param name="id">口形状ID。</param>
            /// <param name="info">モーフ情報。</param>
            public Item(LipId id, MorphInfo info)
            {
                this.Id = id;
                this.Info = info ?? (new MorphInfo());

                // コマンド作成
                this.AddCommand = new DelegateCommand(this.ExecuteAddCommand);
                this.DeleteCommand =
                    new DelegateCommand(
                        this.ExecuteDeleteCommand,
                        p => (p is int) && (int)p >= 0);
                this.UpCommand =
                    new DelegateCommand(
                        this.ExecuteUpCommand,
                        p => (p is int) && (int)p >= 1);
                this.DownCommand =
                    new DelegateCommand(
                        this.ExecuteDownCommand,
                        p =>
                            (p is int) &&
                            (int)p >= 0 &&
                            (int)p + 1 < this.MorphWeights.Count);
            }
Example #4
0
        /// <summary>
        /// タブページパネルの初期化を行う。
        /// </summary>
        /// <param name="lipId">口形状種別ID。</param>
        /// <param name="panel">パネル。</param>
        private void InitializeTabPagePanel(
            LipId lipId,
            TableLayoutPanel panel)
        {
            try
            {
                panel.SuspendLayout();

                // 規定個数だけ追加
                var ctrlDatas = new List<MorphCtrlData>(MorphCtrlCount);
                for (int i = 0; i < MorphCtrlCount; ++i)
                {
                    // コントロール作成
                    var ctrlData =
                        new MorphCtrlData
                        {
                            NameTextBox = CreateMorphNameTextBox(),
                            WeightUpDown = CreateMorphWeightUpDown(),
                        };

                    // タブインデックス設定
                    ctrlData.NameTextBox.TabIndex = i * 2;
                    ctrlData.WeightUpDown.TabIndex = i * 2 + 1;

                    // パネルに追加
                    int row = MorphCtrlBeginRow + i;
                    panel.Controls.Add(
                        ctrlData.NameTextBox,
                        NameTextBoxColumn,
                        row);
                    panel.Controls.Add(
                        ctrlData.WeightUpDown,
                        WeightUpDownColumn,
                        row);

                    // リストに追加
                    ctrlDatas.Add(ctrlData);
                }

                // テーブルに追加
                this.MorphCtrlTable.Add(lipId, ctrlDatas);
            }
            finally
            {
                panel.ResumeLayout(false);
            }
        }
Example #5
0
 /// <summary>
 /// 口形状種別IDが有効な値か検証する。
 /// </summary>
 /// <param name="id">口形状種別ID。</param>
 /// <exception cref="InvalidEnumArgumentException">
 /// id が有効な値ではない場合。
 /// </exception>
 private void ValidateLipId(LipId id)
 {
     if (!this.Table.ContainsKey(id))
     {
         throw new InvalidEnumArgumentException(
             "id",
             (int)id,
             typeof(LipId));
     }
 }
Example #6
0
 /// <summary>
 /// モーフ情報を取得または設定するインデクサ。
 /// </summary>
 /// <param name="id">口形状種別ID。</param>
 /// <returns>モーフ情報。</returns>
 public MorphInfo this[LipId id]
 {
     get
     {
         ValidateLipId(id);
         return this.Table[id];
     }
     set
     {
         ValidateLipId(id);
         this.Table[id] = value ?? (new MorphInfo());
     }
 }