Exemplo n.º 1
0
 /// <summary>
 /// イベントのリストと、反復する時間の区間を指定して初期化する。
 /// 引数 start, end はそれぞれ「以上」、「以下」を意味する。
 /// </summary>
 /// <param name="list">イベントのリスト</param>
 /// <param name="start">区間の開始位置。省略可能。省略した場合は int.MinValue と見做される</param>
 /// <param name="end">区間の終了位置。省略可能。省略した場合は int.MaxValue と見做される</param>
 public SingerEventIterator(VsqEventList list, int start = int.MinValue, int end = int.MaxValue)
 {
     source     = list;
     lastIndex  = -1;
     this.start = start;
     this.end   = end;
 }
Exemplo n.º 2
0
 public IndexIterator(VsqEventList list, int iterator_kind)
 {
     this.list      = list;
     pos            = -1;
     kindSinger     = (iterator_kind & IndexIteratorKind.SINGER) == IndexIteratorKind.SINGER;
     kindNote       = (iterator_kind & IndexIteratorKind.NOTE) == IndexIteratorKind.NOTE;
     kindCrescend   = (iterator_kind & IndexIteratorKind.CRESCEND) == IndexIteratorKind.CRESCEND;
     kindDecrescend = (iterator_kind & IndexIteratorKind.DECRESCEND) == IndexIteratorKind.DECRESCEND;
     kindDynaff     = (iterator_kind & IndexIteratorKind.DYNAFF) == IndexIteratorKind.DYNAFF;
 }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
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();
            }
        }
Exemplo n.º 5
0
 public EventIterator(VsqEventList list)
 {
     m_list = list;
     m_pos  = -1;
 }
Exemplo n.º 6
0
 public NoteEventEnumerator(VsqEventList list)
 {
     m_list = list;
     m_pos  = -1;
 }