Example #1
0
        public void SetCevioTalker(
            CevioTalkerModel talkerModel)
        {
            this.StartCevio();

            if (this.cevioTalker == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(talkerModel.Cast) ||
                !Talker.AvailableCasts.Contains(talkerModel.Cast))
            {
                return;
            }

            lock (this)
            {
                // キャストを最初に指定する
                this.cevioTalker.Cast = talkerModel.Cast;

                this.cevioTalker.Volume    = talkerModel.Volume;
                this.cevioTalker.Speed     = talkerModel.Speed;
                this.cevioTalker.Tone      = talkerModel.Tone;
                this.cevioTalker.Alpha     = talkerModel.Alpha;
                this.cevioTalker.ToneScale = talkerModel.ToneScale;

                if (this.cevioTalker.Components != null)
                {
                    // Components にはインデックスでしかアクセスできない
                    for (int i = 0; i < this.cevioTalker.Components.Length; i++)
                    {
                        var component = this.cevioTalker.Components[i];
                        var src       = talkerModel.Components.FirstOrDefault(x => x.Id == component.Id);
                        if (src != null)
                        {
                            component.Value = src.Value;
                        }
                    }
                }
            }
        }
Example #2
0
        public CevioTalkerModel GetCevioTalker()
        {
            var talkerModel = new CevioTalkerModel();

            this.StartCevio();

            if (this.cevioTalker == null)
            {
                return(talkerModel);
            }

            // キャストを最初に取得する
            talkerModel.Cast = this.cevioTalker.Cast;

            talkerModel.Volume         = this.cevioTalker.Volume;
            talkerModel.Speed          = this.cevioTalker.Speed;
            talkerModel.Tone           = this.cevioTalker.Tone;
            talkerModel.Alpha          = this.cevioTalker.Alpha;
            talkerModel.ToneScale      = this.cevioTalker.ToneScale;
            talkerModel.AvailableCasts = Talker.AvailableCasts;

            if (this.cevioTalker.Components != null)
            {
                // Components にはインデックスでしかアクセスできない
                for (int i = 0; i < this.cevioTalker.Components.Length; i++)
                {
                    var component = new CevioTalkerModel.CevioTalkerComponent()
                    {
                        Id    = this.cevioTalker.Components[i].Id,
                        Name  = this.cevioTalker.Components[i].Name,
                        Value = this.cevioTalker.Components[i].Value,
                    };

                    talkerModel.Components.Add(component);
                }
            }

            return(talkerModel);
        }
Example #3
0
 public void SetCevioTalker(CevioTalkerModel talker) =>
 CevioModel.Instance.SetCevioTalker(talker);