/// <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;
            }
        }
Esempio n. 2
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));
     }
 }
Esempio n. 3
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);
        }
        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;
                    }
                }
            }
        }
Esempio n. 5
0
        public Preference()
        {
            InitializeComponent();
            fontDialog = new FontDialog();
            fontDialog.AllowVectorFonts   = false;
            fontDialog.AllowVerticalFonts = false;
            fontDialog.FontMustExist      = true;
            fontDialog.ShowEffects        = false;
            openUtauCore = new OpenFileDialog();

            folderBrowserSingers = new FolderBrowserDialog();
            folderBrowserSingers.ShowNewFolderButton = false;
            applyLanguage();

            comboVibratoLength.Items.Clear();
            foreach (DefaultVibratoLengthEnum dvl in Enum.GetValues(typeof(DefaultVibratoLengthEnum)))
            {
                comboVibratoLength.Items.Add(DefaultVibratoLengthUtil.toString(dvl));
            }
            comboVibratoLength.SelectedIndex = 1;

            txtAutoVibratoThresholdLength.Text = "480";

            comboAutoVibratoType1.Items.Clear();
            foreach (var vconfig in VocaloSysUtil.vibratoConfigIterator(SynthesizerType.VOCALOID1))
            {
                comboAutoVibratoType1.Items.Add(vconfig);
            }
            if (comboAutoVibratoType1.Items.Count > 0)
            {
                comboAutoVibratoType1.SelectedIndex = 0;
            }

            comboAutoVibratoType2.Items.Clear();
            foreach (var vconfig in VocaloSysUtil.vibratoConfigIterator(SynthesizerType.VOCALOID2))
            {
                comboAutoVibratoType2.Items.Add(vconfig);
            }
            if (comboAutoVibratoType2.Items.Count > 0)
            {
                comboAutoVibratoType2.SelectedIndex = 0;
            }

            updateCustomVibrato();

            comboResolControlCurve.Items.Clear();
            foreach (var cr in ClockResolutionUtility.iterator())
            {
                comboResolControlCurve.Items.Add(ClockResolutionUtility.toString(cr));
            }
            comboResolControlCurve.SelectedIndex = 0;

            comboLanguage.Items.Clear();
            string[] list  = Messaging.getRegisteredLanguage();
            int      index = 0;

            comboLanguage.Items.Add("Default");
            int count = 0;

            foreach (string s in list)
            {
                count++;
                comboLanguage.Items.Add(s);
                if (s.Equals(Messaging.getLanguage()))
                {
                    index = count;
                }
            }
            comboLanguage.SelectedIndex = index;

            SingerConfig[] dict = VocaloSysUtil.getSingerConfigs(SynthesizerType.VOCALOID2);
            m_program_change = new List <string>();
            comboDefualtSinger.Items.Clear();
            foreach (SingerConfig kvp in dict)
            {
                m_program_change.Add(kvp.VOICENAME);
                comboDefualtSinger.Items.Add(kvp.VOICENAME);
            }
            comboDefualtSinger.Enabled = (comboDefualtSinger.Items.Count > 0);
            if (comboDefualtSinger.Items.Count > 0)
            {
                comboDefualtSinger.SelectedIndex = 0;
            }

            updateMidiDevice();

            listSingers.Columns[0].Width = columnWidthHeaderProgramChange;
            listSingers.Columns[1].Width = columnWidthHeaderName;
            listSingers.Columns[2].Width = columnWidthHeaderPath;


            numBuffer.Maximum = EditorConfig.MAX_BUFFER_MILLISEC;
            numBuffer.Minimum = EditorConfig.MIN_BUFFER_MILLIXEC;

            registerEventHandlers();
            setResources();
        }