public static VsqHandle castFromLyricHandle(LyricHandle handle) { VsqHandle ret = new VsqHandle(); ret.m_type = VsqHandleType.Lyric; ret.L0 = (Lyric)handle.L0.clone(); ret.Trailing = handle.Trailing; ret.Index = handle.Index; return(ret); }
/// <summary> /// 歌手設定のインスタンスを、VsqHandleに型キャストします。 /// </summary> /// <returns></returns> public static VsqHandle castFromIconHandle(IconHandle handle) { VsqHandle ret = new VsqHandle(); ret.m_type = VsqHandleType.Singer; ret.Caption = handle.Caption; ret.IconID = handle.IconID; ret.IDS = handle.IDS; ret.Index = handle.Index; ret.Language = handle.Language; ret.setLength(handle.getLength()); ret.Program = handle.Program; return(ret); }
public VsqHandle castToVsqHandle() { VsqHandle ret = new VsqHandle(); ret.m_type = VsqHandleType.NoteHeadHandle; ret.Index = Index; ret.IconID = IconID; ret.IDS = IDS; ret.Original = Original; ret.Caption = getCaption(); ret.setLength(getLength()); ret.Duration = getDuration(); ret.Depth = getDepth(); return(ret); }
/// <summary> /// この強弱記号設定のインスタンスを、VsqHandleに型キャストします。 /// </summary> /// <returns></returns> public VsqHandle castToVsqHandle() { VsqHandle ret = new VsqHandle(); ret.m_type = VsqHandleType.DynamicsHandle; ret.IconID = IconID; ret.IDS = IDS; ret.Original = Original; ret.Caption = getCaption(); ret.DynBP = getDynBP(); ret.EndDyn = getEndDyn(); ret.setLength(getLength()); ret.StartDyn = getStartDyn(); return(ret); }
public VsqHandle castToVsqHandle() { VsqHandle ret = new VsqHandle(); ret.m_type = VsqHandleType.Vibrato; ret.Index = Index; ret.IconID = IconID; ret.IDS = IDS; ret.Original = Original; ret.Caption = caption; ret.setLength(getLength()); ret.StartDepth = startDepth; ret.StartRate = startRate; ret.DepthBP = (VibratoBPList)depthBP.clone(); ret.RateBP = (VibratoBPList)rateBP.clone(); return(ret); }
/// <summary> /// テキストファイルからのコンストラクタ /// </summary> /// <param name="sr">読み込み対象</param> /// <param name="value"></param> /// <param name="last_line">読み込んだ最後の行が返されます</param> public VsqID(TextStream sr, int value, ByRef <string> last_line) { string[] spl; this.value = value; this.type = VsqIDType.Unknown; this.IconHandle_index = -2; this.LyricHandle_index = -1; this.VibratoHandle_index = -1; this.NoteHeadHandle_index = -1; this.setLength(0); this.Note = 0; this.Dynamics = 64; this.PMBendDepth = 8; this.PMBendLength = 0; this.PMbPortamentoUse = 0; this.DEMdecGainRate = 50; this.DEMaccent = 50; //this.LyricHandle_index = -2; //this.VibratoHandle_index = -2; this.VibratoDelay = 0; last_line.value = sr.readLine(); while (!last_line.value.StartsWith("[")) { spl = PortUtil.splitString(last_line.value, new char[] { '=' }); string search = spl[0]; if (search.Equals("Type")) { if (spl[1].Equals("Anote")) { type = VsqIDType.Anote; } else if (spl[1].Equals("Singer")) { type = VsqIDType.Singer; } else if (spl[1].Equals("Aicon")) { type = VsqIDType.Aicon; } else { type = VsqIDType.Unknown; } } else if (search.Equals("Length")) { this.setLength(int.Parse(spl[1])); } else if (search.Equals("Note#")) { this.Note = int.Parse(spl[1]); } else if (search.Equals("Dynamics")) { this.Dynamics = int.Parse(spl[1]); } else if (search.Equals("PMBendDepth")) { this.PMBendDepth = int.Parse(spl[1]); } else if (search.Equals("PMBendLength")) { this.PMBendLength = int.Parse(spl[1]); } else if (search.Equals("DEMdecGainRate")) { this.DEMdecGainRate = int.Parse(spl[1]); } else if (search.Equals("DEMaccent")) { this.DEMaccent = int.Parse(spl[1]); } else if (search.Equals("LyricHandle")) { this.LyricHandle_index = VsqHandle.HandleIndexFromString(spl[1]); } else if (search.Equals("IconHandle")) { this.IconHandle_index = VsqHandle.HandleIndexFromString(spl[1]); } else if (search.Equals("VibratoHandle")) { this.VibratoHandle_index = VsqHandle.HandleIndexFromString(spl[1]); } else if (search.Equals("VibratoDelay")) { this.VibratoDelay = int.Parse(spl[1]); } else if (search.Equals("PMbPortamentoUse")) { PMbPortamentoUse = int.Parse(spl[1]); } else if (search.Equals("NoteHeadHandle")) { NoteHeadHandle_index = VsqHandle.HandleIndexFromString(spl[1]); } if (!sr.ready()) { break; } last_line.value = sr.readLine(); } }
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(); } }
/// <summary> /// このインスタンスから、Handleのリストを作成すると同時に、Eventsに登録されているVsqEventのvalue値および各ハンドルのvalue値を更新します /// </summary> /// <returns></returns> private List <VsqHandle> buildHandleList() { List <VsqHandle> handle = new List <VsqHandle>(); int current_id = -1; int current_handle = -1; bool add_quotation_mark = true; bool is_vocalo1 = Common.Version.StartsWith("DSB2"); bool is_vocalo2 = Common.Version.StartsWith("DSB3"); foreach (var item in Events.iterator()) { current_id++; item.ID.value = current_id; // IconHandle if (item.ID.IconHandle != null) { if (item.ID.IconHandle is IconHandle) { IconHandle ish = (IconHandle)item.ID.IconHandle; current_handle++; VsqHandle handle_item = VsqHandle.castFromIconHandle(ish); handle_item.Index = current_handle; handle.Add(handle_item); item.ID.IconHandle_index = current_handle; if (is_vocalo1) { VsqVoiceLanguage lang = VocaloSysUtil.getLanguageFromName(ish.IDS); add_quotation_mark = lang == VsqVoiceLanguage.Japanese; } else if (is_vocalo2) { VsqVoiceLanguage lang = VocaloSysUtil.getLanguageFromName(ish.IDS); add_quotation_mark = lang == VsqVoiceLanguage.Japanese; } } } // LyricHandle if (item.ID.LyricHandle != null) { current_handle++; VsqHandle handle_item = VsqHandle.castFromLyricHandle(item.ID.LyricHandle); handle_item.Index = current_handle; handle_item.addQuotationMark = add_quotation_mark; handle.Add(handle_item); item.ID.LyricHandle_index = current_handle; } // VibratoHandle if (item.ID.VibratoHandle != null) { current_handle++; VsqHandle handle_item = item.ID.VibratoHandle.castToVsqHandle(); handle_item.Index = current_handle; handle.Add(handle_item); item.ID.VibratoHandle_index = current_handle; } // NoteHeadHandle if (item.ID.NoteHeadHandle != null) { current_handle++; VsqHandle handle_item = item.ID.NoteHeadHandle.castToVsqHandle(); handle_item.Index = current_handle; handle.Add(handle_item); item.ID.NoteHeadHandle_index = current_handle; } // IconDynamicsHandle if (item.ID.IconDynamicsHandle != null) { current_handle++; VsqHandle handle_item = item.ID.IconDynamicsHandle.castToVsqHandle(); handle_item.Index = current_handle; handle_item.setLength(item.ID.getLength()); handle.Add(handle_item); item.ID.IconHandle_index = current_handle; } } return(handle); }