示例#1
0
 public AttackVariation convertFrom(string value)
 {
     if (value.Equals(new AttackVariation().mDescription))
     {
         return(new AttackVariation());
     }
     else
     {
         SynthesizerType type = SynthesizerType.VOCALOID2;
         VsqFileEx       vsq  = AppManager.getVsqFile();
         if (vsq != null)
         {
             string svalue = (string)value;
             foreach (var aconfig in VocaloSysUtil.attackConfigIterator(type))
             {
                 string display_string = aconfig.getDisplayString();
                 if (svalue.Equals(display_string))
                 {
                     return(new AttackVariation(display_string));
                 }
             }
         }
         return(new AttackVariation());
     }
 }
示例#2
0
 public static SingerConfigSys getSingerConfigSys(SynthesizerType type)
 {
     if (s_singer_config_sys.ContainsKey(type))
     {
         return(s_singer_config_sys[type]);
     }
     else
     {
         return(null);
     }
 }
示例#3
0
        public List <Object> getStandardValues()
        {
            SynthesizerType type = SynthesizerType.VOCALOID2;
            VsqFileEx       vsq  = AppManager.getVsqFile();
            List <Object>   list = new List <Object>();

            list.Add(new AttackVariation());
            foreach (var aconfig in VocaloSysUtil.attackConfigIterator(type))
            {
                list.Add(new AttackVariation(aconfig.getDisplayString()));
            }
            return(list);//new StandardValuesCollection( list.toArray( new AttackVariation[] { } ) );
        }
示例#4
0
        /// <summary>
        /// SAPIな発声エンジンを設定するメソッド。
        /// </summary>
        /// <param name="voice">readonlyなメンバーinstalledVoiceの中のうちの1つ。</param>
        public bool SetSpeakingSAPIMethod(InstalledVoice voice)
        {
            try
            {
                synthesizer.SelectVoice(voice.VoiceInfo.Name);

                SpeakingType = SynthesizerType.SAPI;
            }
            catch
            {
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// ビブラートの選択肢の状態を更新します
        /// </summary>
        private void updateComboBoxStatus()
        {
            // 選択位置
            int old = comboVibratoType.SelectedIndex;

            // 全部削除
            comboVibratoType.Items.Clear();

            // 「ビブラート無し」を表すアイテムを追加
            VibratoHandle empty = new VibratoHandle();

            empty.setCaption("[Non Vibrato]");
            empty.IconID = "$04040000";
            comboVibratoType.Items.Add(empty);

            // 選択元を元に,選択肢を追加する
            if (radioUserDefined.Checked)
            {
                // ユーザー定義のを使う場合
                int size = AppManager.editorConfig.AutoVibratoCustom.Count;
                for (int i = 0; i < size; i++)
                {
                    VibratoHandle handle = AppManager.editorConfig.AutoVibratoCustom[i];
                    comboVibratoType.Items.Add(handle);
                }
            }
            else
            {
                // VOCALOID1/VOCALOID2のシステム定義のを使う場合
                SynthesizerType type = radioVocaloid1.Checked ? SynthesizerType.VOCALOID1 : SynthesizerType.VOCALOID2;
                foreach (var vconfig in VocaloSysUtil.vibratoConfigIterator(type))
                {
                    comboVibratoType.Items.Add(vconfig);
                }
            }

            // 選択位置を戻せるなら戻す
            int index = old;

            if (index >= comboVibratoType.Items.Count)
            {
                index = comboVibratoType.Items.Count - 1;
            }
            if (0 <= index)
            {
                comboVibratoType.SelectedIndex = index;
            }
        }
示例#6
0
 /// <summary>
 /// 指定された歌声合成システムに登録されている歌手設定のリストを取得します。
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static SingerConfig[] getSingerConfigs(SynthesizerType type)
 {
     if (!isInitialized)
     {
         serr.println("VocaloSysUtil#getSingerConfigs; not initialized yet");
         return(new SingerConfig[] { });
     }
     if (!s_singer_config_sys.ContainsKey(type))
     {
         return(new SingerConfig[] { });
     }
     else
     {
         return(s_singer_config_sys[type].getSingerConfigs());
     }
 }
示例#7
0
 /// <summary>
 /// 指定した歌声合成システムの、エディタの実行ファイルのパスを取得します。
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string getEditorPath(SynthesizerType type)
 {
     if (!isInitialized)
     {
         serr.println("VocaloSysUtil#getEditorPath; not initialized yet");
         return("");
     }
     if (!s_path_editor.ContainsKey(type))
     {
         return("");
     }
     else
     {
         return(s_path_editor[type]);
     }
 }
示例#8
0
 /// <summary>
 /// 指定した歌声合成システムの、VSTi DLL本体のパスを取得します。
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string getDllPathVsti(SynthesizerType type)
 {
     if (!isInitialized)
     {
         serr.println("VocaloSysUtil#getDllPathVsti; not initialized yet");
         return("");
     }
     if (!s_path_vsti.ContainsKey(type))
     {
         return("");
     }
     else
     {
         return(s_path_vsti[type]);
     }
 }
示例#9
0
 /// <summary>
 /// 指定した歌声合成システムに登録されている指定した名前の歌手について、その歌手を表現するVsqIDのインスタンスを取得します。
 /// </summary>
 /// <param name="language"></param>
 /// <param name="program"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static VsqID getSingerID(int language, int program, SynthesizerType type)
 {
     if (!isInitialized)
     {
         serr.println("VocaloSysUtil#getSingerID; not initialized yet");
         return(null);
     }
     if (!s_singer_config_sys.ContainsKey(type))
     {
         return(null);
     }
     else
     {
         return(s_singer_config_sys[type].getSingerID(language, program));
     }
 }
示例#10
0
 /// <summary>
 /// 強弱記号設定を順に返す反復子を取得します。
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static IEnumerable <IconDynamicsHandle> dynamicsConfigIterator(SynthesizerType type)
 {
     if (!isInitialized)
     {
         serr.println("VocaloSysUtil#dynamicsConfigIterator; not initialized yet");
         return(null);
     }
     if (s_exp_config_sys.ContainsKey(type))
     {
         return(s_exp_config_sys[type].dynamicsConfigIterator());
     }
     else
     {
         return(new List <IconDynamicsHandle>());
     }
 }
示例#11
0
 public VibratoVariation convertFrom(string value)
 {
     if (value.Equals(VibratoVariation.empty.description))
     {
         return(new VibratoVariation(VibratoVariation.empty.description));
     }
     else
     {
         if (AppManager.editorConfig.UseUserDefinedAutoVibratoType)
         {
             int size = AppManager.editorConfig.AutoVibratoCustom.Count;
             for (int i = 0; i < size; i++)
             {
                 string display_string = AppManager.editorConfig.AutoVibratoCustom[i].getDisplayString();
                 if (value.Equals(display_string))
                 {
                     return(new VibratoVariation(display_string));
                 }
             }
         }
         else
         {
             SynthesizerType type = SynthesizerType.VOCALOID2;
             VsqFileEx       vsq  = AppManager.getVsqFile();
             if (vsq != null)
             {
                 /*
                  * RendererKind kind = VsqFileEx.getTrackRendererKind(vsq.Track[AppManager.getSelected()]);
                  * if (kind == RendererKind.VOCALOID1) {
                  *  type = SynthesizerType.VOCALOID1;
                  * }*/
                 foreach (var vconfig in VocaloSysUtil.vibratoConfigIterator(type))
                 {
                     string display_string = vconfig.getDisplayString();
                     if (value.Equals(display_string))
                     {
                         return(new VibratoVariation(display_string));
                     }
                 }
             }
         }
         return(new VibratoVariation(VibratoVariation.empty.description));
     }
 }
示例#12
0
        public List <VibratoVariation> getStandardValues()
        {
            // ビブラート種類の候補値を列挙
            List <VibratoVariation> list = new List <VibratoVariation>();

            list.Add(new VibratoVariation(VibratoVariation.empty.description));

            if (AppManager.editorConfig.UseUserDefinedAutoVibratoType)
            {
                // ユーザー定義の中から選ぶ場合
                int size = AppManager.editorConfig.AutoVibratoCustom.Count;
#if DEBUG
                sout.println("VibratoVariationConverter#GetStandardValues; size=" + size);
#endif
                for (int i = 0; i < size; i++)
                {
                    VibratoHandle handle = AppManager.editorConfig.AutoVibratoCustom[i];
#if DEBUG
                    sout.println("VibratoVariationConverter#GetStandardValues; handle.getDisplayString()=" + handle.getDisplayString());
#endif
                    list.Add(new VibratoVariation(handle.getDisplayString()));
                }
            }
            else
            {
                // VOCALOID1, VOCALOID2のシステム定義の中から選ぶ場合
                SynthesizerType type = SynthesizerType.VOCALOID1;

                /*
                 * VsqFileEx vsq = AppManager.getVsqFile();
                 * if (vsq != null) {
                 *  RendererKind kind = VsqFileEx.getTrackRendererKind(vsq.Track[AppManager.getSelected()]);
                 *  if (kind == RendererKind.VOCALOID1) {
                 *      type = SynthesizerType.VOCALOID1;
                 *  }
                 * }*/
                foreach (var vconfig in VocaloSysUtil.vibratoConfigIterator(type))
                {
                    list.Add(new VibratoVariation(vconfig.getDisplayString()));
                }
            }
            return(list);
        }
示例#13
0
        /// <summary>
        /// 指定した歌声合成システムに登録されている指定した名前の歌手について、その派生元の歌手名を取得します。
        /// </summary>
        /// <param name="language"></param>
        /// <param name="program"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string getOriginalSinger(int language, int program, SynthesizerType type)
        {
            if (!isInitialized)
            {
                serr.println("VocaloSysUtil#getOriginalSinger; not initialized yet");
                return(null);
            }
            string voiceidstr = "";

            if (!s_singer_config_sys.ContainsKey(type))
            {
                return("");
            }
            SingerConfigSys scs = s_singer_config_sys[type];

            SingerConfig[] singer_configs = scs.getSingerConfigs();
            for (int i = 0; i < singer_configs.Length; i++)
            {
                if (language == singer_configs[i].Language && program == singer_configs[i].Program)
                {
                    voiceidstr = singer_configs[i].VOICEIDSTR;
                    break;
                }
            }
            if (voiceidstr.Equals(""))
            {
                return("");
            }
            SingerConfig[] installed_singers = scs.getInstalledSingers();
            for (int i = 0; i < installed_singers.Length; i++)
            {
                if (voiceidstr.Equals(installed_singers[i].VOICEIDSTR))
                {
                    return(installed_singers[i].VOICENAME);
                }
            }
            return("");
        }
示例#14
0
        public FormNoteExpressionConfig(SynthesizerType type, NoteHeadHandle note_head_handle)
        {
            InitializeComponent();
            registerEventHandlers();
            setResources();
            Util.applyFontRecurse(this, AppManager.editorConfig.getBaseFont());
            applyLanguage();

            if (note_head_handle != null)
            {
                m_note_head_handle = (NoteHeadHandle)note_head_handle.clone();
            }

            if (type == SynthesizerType.VOCALOID1)
            {
                flowLayoutPanel.Controls.Remove(groupDynamicsControl);
                flowLayoutPanel.Controls.Remove(panelVocaloid2Template);
                flowLayoutPanel.Controls.Remove(groupPitchControl);
            }
            else
            {
                flowLayoutPanel.Controls.Remove(groupAttack);
            }

            //comboAttackTemplateを更新
            NoteHeadHandle empty = new NoteHeadHandle();

            comboAttackTemplate.Items.Clear();
            empty.IconID = "$01010000";
            empty.setCaption("[Non Attack]");
            comboAttackTemplate.Items.Add(empty);
            comboAttackTemplate.SelectedItem = empty;
            string icon_id = "";

            if (m_note_head_handle != null)
            {
                icon_id          = m_note_head_handle.IconID;
                txtDuration.Text = m_note_head_handle.getDuration() + "";
                txtDepth.Text    = m_note_head_handle.getDepth() + "";
            }
            else
            {
                txtDuration.Enabled   = false;
                txtDepth.Enabled      = false;
                trackDuration.Enabled = false;
                trackDepth.Enabled    = false;
            }
            foreach (var item in VocaloSysUtil.attackConfigIterator(SynthesizerType.VOCALOID1))
            {
                comboAttackTemplate.Items.Add(item);
                if (item.IconID.Equals(icon_id))
                {
                    comboAttackTemplate.SelectedItem = comboAttackTemplate.Items[comboAttackTemplate.Items.Count - 1];
                }
            }
            comboAttackTemplate.SelectedIndexChanged += new EventHandler(comboAttackTemplate_SelectedIndexChanged);

            comboTemplate.Items.Clear();
            string[] strs = new string[] {
                "[Select a template]",
                "normal",
                "accent",
                "strong accent",
                "legato",
                "slow legate",
            };
            for (int i = 0; i < strs.Length; i++)
            {
                comboTemplate.Items.Add(strs[i]);
            }

            Size current_size = this.ClientSize;

            this.ClientSize      = new Size(current_size.Width, flowLayoutPanel.ClientSize.Height + flowLayoutPanel.Top * 2);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
        }
示例#15
0
        /// <summary>
        /// 自動ビブラートを作成します
        /// </summary>
        /// <param name="type"></param>
        /// <param name="vibrato_clocks"></param>
        /// <returns></returns>
        public VibratoHandle createAutoVibrato(SynthesizerType type, int vibrato_clocks)
        {
            if (UseUserDefinedAutoVibratoType)
            {
                if (AutoVibratoCustom == null)
                {
                    AutoVibratoCustom = new List <VibratoHandle>();
                }

                // 下4桁からインデックスを取得
                int index = 0;
                if (this.AutoVibratoTypeCustom == null)
                {
                    index = 0;
                }
                else
                {
                    int trimlen = 4;
                    int len     = PortUtil.getStringLength(this.AutoVibratoTypeCustom);
                    if (len < 4)
                    {
                        trimlen = len;
                    }
                    if (trimlen > 0)
                    {
                        string s = this.AutoVibratoTypeCustom.Substring(len - trimlen, trimlen);
                        try {
                            index = (int)PortUtil.fromHexString(s);
                            index--;
                        } catch (Exception ex) {
                            serr.println(typeof(EditorConfig) + ".createAutoVibrato; ex=" + ex + "; AutoVibratoTypeCustom=" + AutoVibratoTypeCustom + "; s=" + s);
                            index = 0;
                        }
                    }
                }

#if DEBUG
                sout.println("EditorConfig.createAutoVibrato; AutoVibratoTypeCustom=" + AutoVibratoTypeCustom + "; index=" + index);
#endif
                VibratoHandle ret = null;
                if (0 <= index && index < this.AutoVibratoCustom.Count)
                {
                    ret = this.AutoVibratoCustom[index];
                    if (ret != null)
                    {
                        ret = (VibratoHandle)ret.clone();
                    }
                }
                if (ret == null)
                {
                    ret = new VibratoHandle();
                }
                ret.IconID = "$0404" + PortUtil.toHexString(index + 1, 4);
                ret.setLength(vibrato_clocks);
                return(ret);
            }
            else
            {
                string        iconid = type == SynthesizerType.VOCALOID1 ? AutoVibratoType1 : AutoVibratoType2;
                VibratoHandle ret    = VocaloSysUtil.getDefaultVibratoHandle(iconid,
                                                                             vibrato_clocks,
                                                                             type);
                if (ret == null)
                {
                    ret        = new VibratoHandle();
                    ret.IconID = "$04040001";
                    ret.setLength(vibrato_clocks);
                }
                return(ret);
            }
        }
        public void comboVibratoType_SelectedIndexChanged(Object sender, EventArgs e)
        {
            int index = comboVibratoType.SelectedIndex;

#if DEBUG
            sout.println("FormVibratoConfig#comboVibratoType_SelectedIndexChanged; index=" + index);
#endif
            if (index >= 0)
            {
                string s = ((VibratoHandle)comboVibratoType.Items[index]).IconID;
#if DEBUG
                sout.println("FormVibratoConfig#comboVibratoType_SelectedIndexChanged; index=" + index + "; iconid=" + s);
#endif
                if (s.Equals("$04040000"))
                {
#if DEBUG
                    sout.println("FormVibratoConfig#comboVibratoType_SelectedIndexChanged; B; m_vibrato -> null");
#endif
                    m_vibrato = null;
                    txtVibratoLength.Enabled = false;
                    return;
                }
                else
                {
                    txtVibratoLength.Enabled = true;
                    VibratoHandle src = null;
                    if (radioUserDefined.Checked)
                    {
                        int size = AppManager.editorConfig.AutoVibratoCustom.Count;
                        for (int i = 0; i < size; i++)
                        {
                            VibratoHandle handle = AppManager.editorConfig.AutoVibratoCustom[i];
                            if (s == handle.IconID)
                            {
                                src = handle;
                                break;
                            }
                        }
                    }
                    else
                    {
                        SynthesizerType type = radioVocaloid1.Checked ? SynthesizerType.VOCALOID1 : SynthesizerType.VOCALOID2;
                        foreach (var vconfig in VocaloSysUtil.vibratoConfigIterator(type))
                        {
                            if (s == vconfig.IconID)
                            {
                                src = vconfig;
                                break;
                            }
                        }
                    }
#if DEBUG
                    sout.println("FormVibratoConfig#comboVibratoType_SelectedIndexChanged; (src==null)=" + (src == null));
#endif
                    if (src != null)
                    {
                        int percent;
                        try {
                            percent = int.Parse(txtVibratoLength.Text);
                        } catch (Exception ex) {
                            return;
                        }
                        m_vibrato = (VibratoHandle)src.clone();
                        m_vibrato.setLength((int)(m_note_length * percent / 100.0f));
                        return;
                    }
                }
            }
        }
        /// <summary>
        /// コンストラクタ.引数vibrato_handleには,Cloneしたものを渡さなくてよい.
        /// </summary>
        /// <param name="vibrato_handle"></param>
        /// <param name="note_length"></param>
        /// <param name="default_vibrato_length"></param>
        /// <param name="type"></param>
        /// <param name="use_original"></param>
        public FormVibratoConfig(
            VibratoHandle vibrato_handle,
            int note_length,
            DefaultVibratoLengthEnum default_vibrato_length,
            SynthesizerType type,
            bool use_original)
        {
            InitializeComponent();

#if DEBUG
            AppManager.debugWriteLine("FormVibratoConfig.ctor(Vsqhandle,int,DefaultVibratoLength)");
            AppManager.debugWriteLine("    (vibrato_handle==null)=" + (vibrato_handle == null));
            sout.println("    type=" + type);
#endif
            if (use_original)
            {
                radioUserDefined.Checked = true;
            }
            else
            {
                if (type == SynthesizerType.VOCALOID1)
                {
                    radioVocaloid1.Checked = true;
                }
                else
                {
                    radioVocaloid2.Checked = true;
                }
            }
            if (vibrato_handle != null)
            {
                m_vibrato = (VibratoHandle)vibrato_handle.clone();
            }

            // 選択肢の状態を更新
            updateComboBoxStatus();
            // どれを選ぶか?
            if (vibrato_handle != null)
            {
#if DEBUG
                sout.println("FormVibratoConfig#.ctor; vibrato_handle.IconID=" + vibrato_handle.IconID);
#endif
                for (int i = 0; i < comboVibratoType.Items.Count; i++)
                {
                    VibratoHandle handle = (VibratoHandle)comboVibratoType.Items[i];
#if DEBUG
                    sout.println("FormVibratoConfig#.ctor; handle.IconID=" + handle.IconID);
#endif
                    if (vibrato_handle.IconID.Equals(handle.IconID))
                    {
                        comboVibratoType.SelectedIndex = i;
                        break;
                    }
                }
            }

            txtVibratoLength.Enabled = (vibrato_handle != null);
            if (vibrato_handle != null)
            {
                txtVibratoLength.Text = (int)((float)vibrato_handle.getLength() / (float)note_length * 100.0f) + "";
            }
            else
            {
                string s = "";
                if (default_vibrato_length == DefaultVibratoLengthEnum.L100)
                {
                    s = "100";
                }
                else if (default_vibrato_length == DefaultVibratoLengthEnum.L50)
                {
                    s = "50";
                }
                else if (default_vibrato_length == DefaultVibratoLengthEnum.L66)
                {
                    s = "66";
                }
                else if (default_vibrato_length == DefaultVibratoLengthEnum.L75)
                {
                    s = "75";
                }
                txtVibratoLength.Text = s;
            }

            m_note_length = note_length;

            registerEventHandlers();
            setResources();
            applyLanguage();

            Util.applyFontRecurse(this, AppManager.editorConfig.getBaseFont());
        }
示例#18
0
        /// <summary>
        /// ビブラートのプリセットタイプから,VibratoHandleを作成します
        /// </summary>
        /// <param name="icon_id"></param>
        /// <param name="vibrato_length"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static VibratoHandle getDefaultVibratoHandle(string icon_id, int vibrato_length, SynthesizerType type)
        {
            if (!isInitialized)
            {
                serr.println("VocaloSysUtil#getDefaultVibratoHandle; not initialized yet");
                return(null);
            }
            if (s_exp_config_sys.ContainsKey(type))
            {
                foreach (var vconfig in s_exp_config_sys[type].vibratoConfigIterator())
                {
                    if (vconfig.IconID.Equals(icon_id))
                    {
                        VibratoHandle ret = (VibratoHandle)vconfig.clone();
                        ret.setLength(vibrato_length);
                        return(ret);
                    }
                }
            }
            VibratoHandle empty = new VibratoHandle();

            empty.IconID = "$04040000";
            return(empty);
        }