Exemple #1
0
 public VsqEvent(int clock, VsqID id /*, int internal_id*/)
 {
     Clock = clock;
     ID    = id;
     //InternalID = internal_id;
     InternalID = 0;
 }
        /// <summary>
        /// Gets the VsqID of program change.
        /// </summary>
        /// <param name="program_change"></param>
        /// <returns></returns>
        public VsqID getSingerID(int language, int program)
        {
            VsqID ret = new VsqID(0);

            ret.type = VsqIDType.Singer;
            SingerConfig sc = null;

            for (int i = 0; i < m_singer_configs.Count; i++)
            {
                SingerConfig itemi = m_singer_configs[i];
                if (itemi.Language == language && itemi.Program == program)
                {
                    sc = itemi;
                    break;
                }
            }
            if (sc == null)
            {
                sc = new SingerConfig();
            }
            ret.IconHandle          = new IconHandle();
            ret.IconHandle.IconID   = "$0701" + PortUtil.toHexString(sc.Language, 2) + PortUtil.toHexString(sc.Program, 2);
            ret.IconHandle.IDS      = sc.VOICENAME;
            ret.IconHandle.Index    = 0;
            ret.IconHandle.Language = sc.Language;
            ret.IconHandle.setLength(1);
            ret.IconHandle.Original = sc.Language << 8 | sc.Program;
            ret.IconHandle.Program  = sc.Program;
            ret.IconHandle.Caption  = "";
            return(ret);
        }
Exemple #3
0
 public VsqEvent(string line)
 {
     string[] spl = PortUtil.splitString(line, new char[] { '=' });
     Clock = int.Parse(spl[0]);
     if (spl[1].Equals("EOS"))
     {
         ID = VsqID.EOS;
     }
 }
Exemple #4
0
        private VsqMetaText(string name, int pre_measure, string singer, bool is_first_track)
        {
            Common          = new VsqCommon(name, 179, 181, 123, 1, 1);
            PIT             = new VsqBPList("pit", 0, -8192, 8191);
            PBS             = new VsqBPList("pbs", 2, 0, 24);
            DYN             = new VsqBPList("dyn", 64, 0, 127);
            BRE             = new VsqBPList("bre", 0, 0, 127);
            BRI             = new VsqBPList("bri", 64, 0, 127);
            CLE             = new VsqBPList("cle", 0, 0, 127);
            reso1FreqBPList = new VsqBPList("reso1freq", 64, 0, 127);
            reso2FreqBPList = new VsqBPList("reso2freq", 64, 0, 127);
            reso3FreqBPList = new VsqBPList("reso3freq", 64, 0, 127);
            reso4FreqBPList = new VsqBPList("reso4freq", 64, 0, 127);
            reso1BWBPList   = new VsqBPList("reso1bw", 64, 0, 127);
            reso2BWBPList   = new VsqBPList("reso2bw", 64, 0, 127);
            reso3BWBPList   = new VsqBPList("reso3bw", 64, 0, 127);
            reso4BWBPList   = new VsqBPList("reso4bw", 64, 0, 127);
            reso1AmpBPList  = new VsqBPList("reso1amp", 64, 0, 127);
            reso2AmpBPList  = new VsqBPList("reso2amp", 64, 0, 127);
            reso3AmpBPList  = new VsqBPList("reso3amp", 64, 0, 127);
            reso4AmpBPList  = new VsqBPList("reso4amp", 64, 0, 127);
            harmonics       = new VsqBPList("harmonics", 64, 0, 127);
            fx2depth        = new VsqBPList("fx2depth", 64, 0, 127);
            GEN             = new VsqBPList("gen", 64, 0, 127);
            POR             = new VsqBPList("por", 64, 0, 127);
            OPE             = new VsqBPList("ope", 127, 0, 127);
            if (is_first_track)
            {
                master = new VsqMaster(pre_measure);
            }
            else
            {
                master = null;
            }
            Events = new VsqEventList();
            VsqID id = new VsqID(0);

            id.type = VsqIDType.Singer;
            IconHandle ish = new IconHandle();

            ish.IconID   = "$07010000";
            ish.IDS      = singer;
            ish.Original = 0;
            ish.Caption  = "";
            ish.setLength(1);
            ish.Language  = 0;
            ish.Program   = 0;
            id.IconHandle = ish;
            Events.add(new VsqEvent(0, id));
        }
Exemple #5
0
        /// <summary>
        /// 指定したトラックのレンダラーを変更します
        /// </summary>
        /// <param name="track"></param>
        /// <param name="new_renderer"></param>
        /// <param name="singers"></param>
        public void changeRenderer(string new_renderer, List <VsqID> singers)
        {
            VsqID default_id   = null;
            int   singers_size = singers.Count;

            if (singers_size <= 0)
            {
                default_id      = new VsqID();
                default_id.type = VsqIDType.Singer;
                IconHandle singer_handle = new IconHandle();
                singer_handle.IconID   = "$0701" + PortUtil.toHexString(0, 4);
                singer_handle.IDS      = "Unknown";
                singer_handle.Index    = 0;
                singer_handle.Language = 0;
                singer_handle.setLength(1);
                singer_handle.Original = 0;
                singer_handle.Program  = 0;
                singer_handle.Caption  = "";
                default_id.IconHandle  = singer_handle;
            }
            else
            {
                default_id = singers[0];
            }

            for (Iterator <VsqEvent> itr = getSingerEventIterator(); itr.hasNext();)
            {
                VsqEvent   ve            = itr.next();
                IconHandle singer_handle = (IconHandle)ve.ID.IconHandle;
                int        program       = singer_handle.Program;
                bool       found         = false;
                for (int i = 0; i < singers_size; i++)
                {
                    VsqID id = singers[i];
                    if (program == singer_handle.Program)
                    {
                        ve.ID = (VsqID)id.clone();
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    VsqID add = (VsqID)default_id.clone();
                    add.IconHandle.Program = program;
                    ve.ID = add;
                }
            }
            MetaText.Common.Version = new_renderer;
        }
Exemple #6
0
        /// <summary>
        /// VsqIDの内容を変更するコマンドを発行します。
        /// </summary>
        /// <param name="track"></param>
        /// <param name="internal_ids"></param>
        /// <param name="values"></param>
        /// <returns></returns>
        public static VsqCommand generateCommandEventChangeIDContaintsRange(int track, int[] internal_ids, VsqID[] values)
        {
            VsqCommand command = new VsqCommand();

            command.Type    = VsqCommandType.EVENT_CHANGE_ID_CONTAINTS_RANGE;
            command.Args    = new Object[3];
            command.Args[0] = track;
            command.Args[1] = copyIntArray(internal_ids);
            VsqID[] list = new VsqID[values.Length];
            for (int i = 0; i < values.Length; i++)
            {
                list[i] = (VsqID)values[i].clone();
            }
            command.Args[2] = list;
            return(command);
        }
Exemple #7
0
        /// <summary>
        /// VsqIDとClockを同時に変更するコマンドを発行します
        /// </summary>
        /// <param name="track"></param>
        /// <param name="internal_ids"></param>
        /// <param name="clocks"></param>
        /// <param name="values"></param>
        /// <returns></returns>
        public static VsqCommand generateCommandEventChangeClockAndIDContaintsRange(int track, int[] internal_ids, int[] clocks, VsqID[] values)
        {
            VsqCommand command = new VsqCommand();

            command.Type = VsqCommandType.EVENT_CHANGE_CLOCK_AND_ID_CONTAINTS_RANGE;
            int count = internal_ids.Length;

            command.Args    = new Object[4];
            command.Args[0] = track;
            command.Args[1] = copyIntArray(internal_ids);
            command.Args[2] = copyIntArray(clocks);
            VsqID[] cp_values = new VsqID[values.Length];
            for (int i = 0; i < values.Length; i++)
            {
                cp_values[i] = (VsqID)values[i].clone();
            }
            command.Args[3] = cp_values;
            return(command);
        }
Exemple #8
0
        /// <summary>
        /// このインスタンスの簡易コピーを取得します。
        /// </summary>
        /// <returns>このインスタンスの簡易コピー</returns>
        public Object clone()
        {
            VsqID result = new VsqID(this.value);

            result.type = this.type;
            if (this.IconHandle != null)
            {
                result.IconHandle = (IconHandle)IconHandle.clone();
            }
            result.setLength(getLength());
            result.Note                = this.Note;
            result.Dynamics            = this.Dynamics;
            result.PMBendDepth         = this.PMBendDepth;
            result.PMBendLength        = this.PMBendLength;
            result.PMbPortamentoUse    = this.PMbPortamentoUse;
            result.DEMdecGainRate      = this.DEMdecGainRate;
            result.DEMaccent           = this.DEMaccent;
            result.d4mean              = this.d4mean;
            result.pMeanOnsetFirstNote = this.pMeanOnsetFirstNote;
            result.vMeanNoteTransition = this.vMeanNoteTransition;
            result.pMeanEndingNote     = this.pMeanEndingNote;
            if (this.LyricHandle != null)
            {
                result.LyricHandle = (LyricHandle)this.LyricHandle.clone();
            }
            if (this.VibratoHandle != null)
            {
                result.VibratoHandle = (VibratoHandle)this.VibratoHandle.clone();
            }
            result.VibratoDelay = this.VibratoDelay;
            if (NoteHeadHandle != null)
            {
                result.NoteHeadHandle = (NoteHeadHandle)NoteHeadHandle.clone();
            }
            if (IconDynamicsHandle != null)
            {
                result.IconDynamicsHandle = (IconDynamicsHandle)IconDynamicsHandle.clone();
            }
            return(result);
        }
Exemple #9
0
        public VsqMetaText(TextStream sr)
        {
            List <ValuePair <int, int> >      t_event_list = new List <ValuePair <int, int> >();
            SortedDictionary <int, VsqID>     __id         = new SortedDictionary <int, VsqID>();
            SortedDictionary <int, VsqHandle> __handle     = new SortedDictionary <int, VsqHandle>();

            PIT             = new VsqBPList("pit", 0, -8192, 8191);
            PBS             = new VsqBPList("pbs", 2, 0, 24);
            DYN             = new VsqBPList("dyn", 64, 0, 127);
            BRE             = new VsqBPList("bre", 0, 0, 127);
            BRI             = new VsqBPList("bri", 64, 0, 127);
            CLE             = new VsqBPList("cle", 0, 0, 127);
            reso1FreqBPList = new VsqBPList("reso1freq", 64, 0, 127);
            reso2FreqBPList = new VsqBPList("reso2freq", 64, 0, 127);
            reso3FreqBPList = new VsqBPList("reso3freq", 64, 0, 127);
            reso4FreqBPList = new VsqBPList("reso4freq", 64, 0, 127);
            reso1BWBPList   = new VsqBPList("reso1bw", 64, 0, 127);
            reso2BWBPList   = new VsqBPList("reso2bw", 64, 0, 127);
            reso3BWBPList   = new VsqBPList("reso3bw", 64, 0, 127);
            reso4BWBPList   = new VsqBPList("reso4bw", 64, 0, 127);
            reso1AmpBPList  = new VsqBPList("reso1amp", 64, 0, 127);
            reso2AmpBPList  = new VsqBPList("reso2amp", 64, 0, 127);
            reso3AmpBPList  = new VsqBPList("reso3amp", 64, 0, 127);
            reso4AmpBPList  = new VsqBPList("reso4amp", 64, 0, 127);
            harmonics       = new VsqBPList("harmonics", 64, 0, 127);
            fx2depth        = new VsqBPList("fx2depth", 64, 0, 127);
            GEN             = new VsqBPList("gen", 64, 0, 127);
            POR             = new VsqBPList("por", 64, 0, 127);
            OPE             = new VsqBPList("ope", 127, 0, 127);

            ByRef <string> last_line = new ByRef <string>(sr.readLine());

            while (true)
            {
                #region "TextMemoryStreamから順次読込み"
                if (last_line.value.Length == 0)
                {
                    break;
                }
                if (last_line.value == "[Common]")
                {
                    Common = new VsqCommon(sr, last_line);
                }
                else if (last_line.value == "[Master]")
                {
                    master = new VsqMaster(sr, last_line);
                }
                else if (last_line.value == "[Mixer]")
                {
                    mixer = new VsqMixer(sr, last_line);
                }
                else if (last_line.value == "[EventList]")
                {
                    last_line.value = sr.readLine();
                    while (!last_line.value.StartsWith("["))
                    {
                        string[] spl2      = PortUtil.splitString(last_line.value, new char[] { '=' });
                        int      clock     = int.Parse(spl2[0]);
                        int      id_number = -1;
                        if (spl2[1] != "EOS")
                        {
                            string[] ids = PortUtil.splitString(spl2[1], ',');
                            for (int i = 0; i < ids.Length; i++)
                            {
                                string[] spl3 = PortUtil.splitString(ids[i], new char[] { '#' });
                                id_number = int.Parse(spl3[1]);
                                t_event_list.Add(new ValuePair <int, int>(clock, id_number));
                            }
                        }
                        else
                        {
                            t_event_list.Add(new ValuePair <int, int>(clock, -1));
                        }
                        if (!sr.ready())
                        {
                            break;
                        }
                        else
                        {
                            last_line.value = sr.readLine();
                        }
                    }
                }
                else if (last_line.value == "[PitchBendBPList]")
                {
                    last_line.value = PIT.appendFromText(sr);
                }
                else if (last_line.value == "[PitchBendSensBPList]")
                {
                    last_line.value = PBS.appendFromText(sr);
                }
                else if (last_line.value == "[DynamicsBPList]")
                {
                    last_line.value = DYN.appendFromText(sr);
                }
                else if (last_line.value == "[EpRResidualBPList]")
                {
                    last_line.value = BRE.appendFromText(sr);
                }
                else if (last_line.value == "[EpRESlopeBPList]")
                {
                    last_line.value = BRI.appendFromText(sr);
                }
                else if (last_line.value == "[EpRESlopeDepthBPList]")
                {
                    last_line.value = CLE.appendFromText(sr);
                }
                else if (last_line.value == "[EpRSineBPList]")
                {
                    last_line.value = harmonics.appendFromText(sr);
                }
                else if (last_line.value == "[VibTremDepthBPList]")
                {
                    last_line.value = fx2depth.appendFromText(sr);
                }
                else if (last_line.value == "[Reso1FreqBPList]")
                {
                    last_line.value = reso1FreqBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso2FreqBPList]")
                {
                    last_line.value = reso2FreqBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso3FreqBPList]")
                {
                    last_line.value = reso3FreqBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso4FreqBPList]")
                {
                    last_line.value = reso4FreqBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso1BWBPList]")
                {
                    last_line.value = reso1BWBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso2BWBPList]")
                {
                    last_line.value = reso2BWBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso3BWBPList]")
                {
                    last_line.value = reso3BWBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso4BWBPList]")
                {
                    last_line.value = reso4BWBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso1AmpBPList]")
                {
                    last_line.value = reso1AmpBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso2AmpBPList]")
                {
                    last_line.value = reso2AmpBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso3AmpBPList]")
                {
                    last_line.value = reso3AmpBPList.appendFromText(sr);
                }
                else if (last_line.value == "[Reso4AmpBPList]")
                {
                    last_line.value = reso4AmpBPList.appendFromText(sr);
                }
                else if (last_line.value == "[GenderFactorBPList]")
                {
                    last_line.value = GEN.appendFromText(sr);
                }
                else if (last_line.value == "[PortamentoTimingBPList]")
                {
                    last_line.value = POR.appendFromText(sr);
                }
                else if (last_line.value == "[OpeningBPList]")
                {
                    last_line.value = OPE.appendFromText(sr);
                }
                else
                {
                    string buffer = last_line.value;
                    buffer = buffer.Replace("[", "");
                    buffer = buffer.Replace("]", "");
#if DEBUG
                    sout.println("VsqMetaText#.ctor; buffer=" + buffer);
#endif
                    string[] spl   = PortUtil.splitString(buffer, new char[] { '#' });
                    int      index = int.Parse(spl[1]);
                    if (last_line.value.StartsWith("[ID#"))
                    {
                        __id[index] = new VsqID(sr, index, last_line);
                    }
                    else if (last_line.value.StartsWith("[h#"))
                    {
                        __handle[index] = new VsqHandle(sr, index, last_line);
                    }
                }
                #endregion

                if (!sr.ready())
                {
                    break;
                }
            }

            // まずhandleをidに埋め込み
            int c = __id.Count;
            for (int i = 0; i < c; i++)
            {
                VsqID id = __id[i];
                if (__handle.ContainsKey(id.IconHandle_index))
                {
                    if (id.type == VsqIDType.Singer)
                    {
                        id.IconHandle = __handle[id.IconHandle_index].castToIconHandle();
                    }
                    else if (id.type == VsqIDType.Aicon)
                    {
                        id.IconDynamicsHandle = __handle[id.IconHandle_index].castToIconDynamicsHandle();
                    }
                }
                if (__handle.ContainsKey(id.LyricHandle_index))
                {
                    id.LyricHandle = __handle[id.LyricHandle_index].castToLyricHandle();
                }
                if (__handle.ContainsKey(id.VibratoHandle_index))
                {
                    id.VibratoHandle = __handle[id.VibratoHandle_index].castToVibratoHandle();
                }
                if (__handle.ContainsKey(id.NoteHeadHandle_index))
                {
                    id.NoteHeadHandle = __handle[id.NoteHeadHandle_index].castToNoteHeadHandle();
                }
            }

            // idをeventListに埋め込み
            Events = new VsqEventList();
            int count = 0;
            for (int i = 0; i < t_event_list.Count; i++)
            {
                ValuePair <int, int> item = t_event_list[i];
                int clock     = item.getKey();
                int id_number = item.getValue();
                if (__id.ContainsKey(id_number))
                {
                    count++;
                    Events.add(new VsqEvent(clock, (VsqID)__id[id_number].clone()), count);
                }
            }
            Events.sort();

            if (Common == null)
            {
                Common = new VsqCommon();
            }
        }
Exemple #10
0
        /// <summary>
        /// VsqIDの内容を変更するコマンドを発行します。
        /// </summary>
        /// <param name="track"></param>
        /// <param name="internal_id"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static VsqCommand generateCommandEventChangeIDContaints(int track, int internal_id, VsqID value)
        {
            VsqCommand command = new VsqCommand();

            command.Type    = VsqCommandType.EVENT_CHANGE_ID_CONTAINTS;
            command.Args    = new Object[3];
            command.Args[0] = track;
            command.Args[1] = internal_id;
            command.Args[2] = (VsqID)value.clone();
            return(command);
        }