public void PraseCueTest() { string path = @"..\..\[cue_Sample]\ARCHIVES 2.cue"; if (!File.Exists(path)) { path = @"..\" + path; } var expectResult = new[] { new { Name = "オーディオドラマ・1stパート", Time = "00:00:00.000" }, new { Name = "初色bloomy [初春飾利(豊崎愛生)]", Time = "00:15:19.280" }, new { Name = "オーディオドラマ・2ndパート", Time = "00:19:15.093" }, new { Name = "ナミダ御免のGirls Beat [佐天涙子(伊藤かな恵)]", Time = "00:32:12.173" } }; var result = CueData.PraseCue(File.ReadAllText(path)); Assert.IsTrue(result.Chapters.Count == 4); int index = 0; foreach (var chapter in result.Chapters) { Console.WriteLine(chapter.ToString()); expectResult[index].Name.Should().Be(chapter.Name); expectResult[index].Time.Should().Be(chapter.Time.Time2String()); ++index; } }
/** * Flushes pending content to disk and starts a new cluster. This is typically not necessary to call manually. */ public void Flush() { ulong clusterPos = (ulong)Writer.Position; CueData.AddCue(clusterPos, Cluster.ClusterTimecode, (List <int>)Cluster.Tracks); Cluster.Flush(Writer); }
/** * Finalizes the file by writing the final headers, index, and flushing data to the writer. */ public void Close() { Flush(); CueData.Write(Writer, MetaSeek); MetaSeek.Update(Writer); SegmentInfoElement.Update(Writer); Tracks.Update(Writer); }
public void InsertCue() { CueData newCueData = new CueData(); newCueData.channelCues = new List <ChannelCueData>(); float currentCueId = cuesListData.cues[currentCueIndex].cueId; if (cuesListData.cues.Count > currentCueIndex + 1) // There is a next index { float newCueId = 0f; float attempt = 0.5f; if ((currentCueId + attempt) < Mathf.Floor(cuesListData.cues[currentCueIndex + 1].cueId)) { newCueId = (currentCueId + attempt); } else { attempt = 0.1f; if ((currentCueId + attempt) < cuesListData.cues[currentCueIndex + 1].cueId) { newCueId = Mathf.Round((currentCueId + attempt) * 10f) / 10f; } else { attempt = 0.01f; if ((currentCueId + attempt) < cuesListData.cues[currentCueIndex + 1].cueId) { newCueId = Mathf.Round((currentCueId + attempt) * 100f) / 100f; } else { //Debug.Log("No cue name found: use 0 as placeholder."); } } } // Insert the new cue newCueData.cueId = newCueId; cuesListData.cues.Insert(currentCueIndex + 1, newCueData); // Insert new cue into cuesMasterList, and copy values from previous (current) cue cuesMasterList.Add(newCueId, new SortedDictionary <int, float>()); foreach (KeyValuePair <int, float> entry in cuesMasterList[currentCueId]) { cuesMasterList[newCueId][entry.Key] = entry.Value; } LoadCuesMenu(); } else { AddCue(); } }
public void AddCue() { CueData newCueData = new CueData(); newCueData.channelCues = new List <ChannelCueData>(); newCueData.cueId = cuesListData.cues[cuesListData.cues.Count - 1].cueId + 1f; cuesListData.cues.Add(newCueData); // Add new cue to cuesMasterList, and copy values from previous cue cuesMasterList.Add(newCueData.cueId, new SortedDictionary <int, float>()); foreach (KeyValuePair <int, float> entry in cuesMasterList[newCueData.cueId - 1]) { cuesMasterList[newCueData.cueId][entry.Key] = entry.Value; } LoadCuesMenu(); }
void AddChannelCue(int lightFixtureChannelId, float lightIntensityValue, CueData cuesList) { ChannelCueData newChannelCue = new ChannelCueData { channelID = lightFixtureChannelId }; CueParameterData newCueParameter = new CueParameterData { parameterType = 1, parameterTypeAsText = "Intens", level = lightIntensityValue }; newChannelCue.cueParameters = new List <CueParameterData>(); newChannelCue.cueParameters.Add(newCueParameter); cuesList.channelCues.Add(newChannelCue); }
public void IntensityChangeCommit() { CuesManager cuesManager = gameManager.cuesManager; if (cuesManager.cuesListData != null) // In case we have not loaded any cues { bool foundCue = false; CueData cuesList = cuesManager.cuesListData.cues[cuesManager.currentCueIndex]; foreach (ChannelCueData channelCue in cuesList.channelCues) { if (channelCue.channelID == lightFixture.captureData.channel) { channelCue.cueParameters[0].level = lightIntensity.value; foundCue = true; } if (foundCue) { break; } } if (!foundCue) { AddChannelCue(lightFixture.captureData.channel, lightIntensity.value, cuesList); } } // Save this value to cuesMasterList cuesManager.cuesMasterList[cuesManager.cuesListData.cues[cuesManager.currentCueIndex].cueId][lightFixture.captureData.channel] = lightIntensity.value; // If the option to affect all later cues is toggled on, save this value for future cues as well if (cuesManager.affectLaterCues.isOn) { int i = 0; foreach (CueData cue in cuesManager.cuesListData.cues) { if (i >= cuesManager.currentCueIndex) { cuesManager.cuesMasterList[cuesManager.cuesListData.cues[i].cueId][lightFixture.captureData.channel] = lightIntensity.value; } i++; } } //Debug.LogWarning("CHANNEL CUE SAVED."); }