Ejemplo n.º 1
0
        public Object clone()
        {
            VsqMetaText res = new VsqMetaText();

            if (Common != null)
            {
                res.Common = (VsqCommon)Common.clone();
            }
            if (master != null)
            {
                res.master = (VsqMaster)master.clone();
            }
            if (mixer != null)
            {
                res.mixer = (VsqMixer)mixer.clone();
            }
            if (Events != null)
            {
                res.Events = new VsqEventList();
                foreach (var item in Events.iterator())
                {
                    res.Events.add((VsqEvent)item.clone(), item.InternalID);
                }
            }
            if (PIT != null)
            {
                res.PIT = (VsqBPList)PIT.clone();
            }
            if (PBS != null)
            {
                res.PBS = (VsqBPList)PBS.clone();
            }
            if (DYN != null)
            {
                res.DYN = (VsqBPList)DYN.clone();
            }
            if (BRE != null)
            {
                res.BRE = (VsqBPList)BRE.clone();
            }
            if (BRI != null)
            {
                res.BRI = (VsqBPList)BRI.clone();
            }
            if (CLE != null)
            {
                res.CLE = (VsqBPList)CLE.clone();
            }
            if (reso1FreqBPList != null)
            {
                res.reso1FreqBPList = (VsqBPList)reso1FreqBPList.clone();
            }
            if (reso2FreqBPList != null)
            {
                res.reso2FreqBPList = (VsqBPList)reso2FreqBPList.clone();
            }
            if (reso3FreqBPList != null)
            {
                res.reso3FreqBPList = (VsqBPList)reso3FreqBPList.clone();
            }
            if (reso4FreqBPList != null)
            {
                res.reso4FreqBPList = (VsqBPList)reso4FreqBPList.clone();
            }
            if (reso1BWBPList != null)
            {
                res.reso1BWBPList = (VsqBPList)reso1BWBPList.clone();
            }
            if (reso2BWBPList != null)
            {
                res.reso2BWBPList = (VsqBPList)reso2BWBPList.clone();
            }
            if (reso3BWBPList != null)
            {
                res.reso3BWBPList = (VsqBPList)reso3BWBPList.clone();
            }
            if (reso4BWBPList != null)
            {
                res.reso4BWBPList = (VsqBPList)reso4BWBPList.clone();
            }
            if (reso1AmpBPList != null)
            {
                res.reso1AmpBPList = (VsqBPList)reso1AmpBPList.clone();
            }
            if (reso2AmpBPList != null)
            {
                res.reso2AmpBPList = (VsqBPList)reso2AmpBPList.clone();
            }
            if (reso3AmpBPList != null)
            {
                res.reso3AmpBPList = (VsqBPList)reso3AmpBPList.clone();
            }
            if (reso4AmpBPList != null)
            {
                res.reso4AmpBPList = (VsqBPList)reso4AmpBPList.clone();
            }
            if (harmonics != null)
            {
                res.harmonics = (VsqBPList)harmonics.clone();
            }
            if (fx2depth != null)
            {
                res.fx2depth = (VsqBPList)fx2depth.clone();
            }
            if (GEN != null)
            {
                res.GEN = (VsqBPList)GEN.clone();
            }
            if (POR != null)
            {
                res.POR = (VsqBPList)POR.clone();
            }
            if (OPE != null)
            {
                res.OPE = (VsqBPList)OPE.clone();
            }
            return(res);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Master Trackでないトラックを構築。
 /// </summary>
 /// <param name="name"></param>
 /// <param name="singer"></param>
 public VsqTrack(string name, string singer)
 {
     MetaText = new VsqMetaText(name, singer);
 }
Ejemplo n.º 3
0
        public VsqTrack(List <MidiEvent> midi_event, string encoding)
        {
            string track_name = "";

            TextStream sw = null;

            try {
                sw = new TextStream();
                int        count  = midi_event.Count;
                List <int> buffer = new List <int>();
                for (int i = 0; i < count; i++)
                {
                    MidiEvent item = midi_event[i];
                    if (item.firstByte == 0xff && item.data.Length > 0)
                    {
                        // meta textを抽出
                        int type = item.data[0];
                        if (type == 0x01 || type == 0x03)
                        {
                            if (type == 0x01)
                            {
                                int colon_count = 0;
                                for (int j = 0; j < item.data.Length - 1; j++)
                                {
                                    int d = item.data[j + 1];
                                    if (d == 0x3a)
                                    {
                                        colon_count++;
                                        if (colon_count <= 2)
                                        {
                                            continue;
                                        }
                                    }
                                    if (colon_count < 2)
                                    {
                                        continue;
                                    }
                                    buffer.Add(d);
                                }

                                int index_0x0a = buffer.IndexOf(0x0a);
                                while (index_0x0a >= 0)
                                {
                                    int[] cpy = new int[index_0x0a];
                                    for (int j = 0; j < index_0x0a; j++)
                                    {
                                        cpy[j] = 0xff & (int)buffer[0];
                                        buffer.RemoveAt(0);
                                    }

                                    string line = PortUtil.getDecodedString(encoding, cpy);
                                    sw.writeLine(line);
                                    buffer.RemoveAt(0);
                                    index_0x0a = buffer.IndexOf(0x0a);
                                }
                            }
                            else
                            {
                                for (int j = 0; j < item.data.Length - 1; j++)
                                {
                                    buffer.Add(item.data[j + 1]);
                                }
                                int   c = buffer.Count;
                                int[] d = new int[c];
                                for (int j = 0; j < c; j++)
                                {
                                    d[j] = 0xff & buffer[j];
                                }
                                track_name = PortUtil.getDecodedString(encoding, d);
                                buffer.Clear();
                            }
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                // oketa ketaoさんありがとう =>
                int remain = buffer.Count;
                if (remain > 0)
                {
                    int[] cpy = new int[remain];
                    for (int j = 0; j < remain; j++)
                    {
                        cpy[j] = 0xff & buffer[j];
                    }
                    string line = PortUtil.getDecodedString(encoding, cpy);
                    sw.writeLine(line);
                }
                // <=
                //sw.rewind();
                MetaText = new VsqMetaText(sw);
                setName(track_name);
            } catch (Exception ex) {
                serr.println("org.kbinani.vsq.VsqTrack#.ctor; ex=" + ex);
            } finally {
                if (sw != null)
                {
                    try {
                        sw.close();
                    } catch (Exception ex2) {
                        serr.println("org.kbinani.vsq.VsqTrack#.ctor; ex2=" + ex2);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Master Trackを構築
 /// </summary>
 /// <param name="tempo"></param>
 /// <param name="numerator"></param>
 /// <param name="denominator"></param>
 public VsqTrack(int tempo, int numerator, int denominator)
 {
     //this.Name = "Master Track";
     // metatextがnullのとき,トラック名はMaster Track
     this.MetaText = null;
 }