public void OnSliderValueChanged() { if (!TimeControlSystem.isPlaying) { TimeControlSystem.CurrentTimeMillis = (int)(PlaybackSystem.GetMillisTotal() * Slider.value); } }
IEnumerator RecordOneFrame() { TimeControlSystem.CurrentTimeMillis = lastTime; lastTime += 40; yield return(new WaitForEndOfFrame()); d.ReadPixels(rect, 0, 0, false); count++; File.WriteAllBytes(Application.dataPath + "/video_temp/" + count.ToString("00000") + ".jpg", d.EncodeToJPG()); if (TimeControlSystem.CurrentTimeMillis > PlaybackSystem.GetMillisTotal()) { IsRecording = false; TimeControlSystem.isPlaying = false; TimeControlSystem.CurrentTimeMillis = 0; ProcessStartInfo inf = new ProcessStartInfo(Application.dataPath + "/ffmpeg.exe", " -threads 4 -y -r 25 -i " + Application.dataPath + "/video_temp/%05d.jpg -s " + Screen.width + "x" + Screen.height + " -vcodec copy " + Application.dataPath + "/latent.avi"); inf.UseShellExecute = true; Process pro = Process.Start(inf); pro.WaitForExit(); Directory.Delete(Application.dataPath + "/video_temp", true); inf = new ProcessStartInfo(Application.dataPath + "/ffmpeg.exe", "-i " + Application.dataPath + "/latent.avi -i \"" + PlaybackSystem.FileName + "\" -vcodec copy -acodec aac -map 0:v:0 -map 1:a:0 -shortest " + Application.dataPath + "/output.avi"); inf.UseShellExecute = true; pro = Process.Start(inf); pro.WaitForExit(); System.Windows.Forms.MessageBox.Show("Output Completed!"); HotkeySystem.IsWorking = true; } }
public void RecordOnce() { GridManager.Instance.GridDir = 2; GridManager.Instance.NumRows = 0; HotkeySystem.IsWorking = false; Directory.CreateDirectory(Application.dataPath + "/video_temp"); IsRecording = true; count = 0; lastTime = -ChartInfoManager.Offset; TimeControlSystem.isPlaying = true; PlaybackSystem.Stop(); }
public void KeysWithControlAlt() { if (Input.GetKeyDown(KeyCode.O)) { Dialogs.OpenXml(); } else if (Input.GetKeyDown(KeyCode.I)) { Dialogs.OpenMusic(); } else if (Input.GetKeyDown(KeyCode.R)) { if (PlaybackSystem.GetMillisTotal() < 500) { MessageBox.Show("You Should Load A Music First!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (MessageBox.Show("Confirm Exporting Video?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) { ExportVideoSystem.Instance.RecordOnce(); } } else if (Input.GetKeyDown(KeyCode.K)) { Instantiate(Resources.Load("UI/FormChartInfo"), Canvas.transform); } else if (Input.GetKeyDown(KeyCode.S)) { Dialogs.SaveXml(); } else if (Input.GetKeyDown(KeyCode.V)) { if (TimeControl.Instance == null) { Instantiate(Resources.Load <GameObject> ("UI/TimeControl"), Canvas.transform); } else { NoteSelection.MouseInterfaceID = -1; DestroyObject(TimeControl.Instance.gameObject); TimeControl.Instance = null; } } else if (Input.GetKeyDown(KeyCode.Z)) { UndoSystem.Undo(); } else if (Input.GetKeyDown(KeyCode.Y) || Input.GetKeyDown(KeyCode.X)) { UndoSystem.Redo(); } }
public static void OpenMusic() { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Choose an Audio File to read"; dlg.Filter = "Audio File (*.wav, *.mp3)|*.wav;*.mp3"; dlg.CheckFileExists = true; dlg.CheckPathExists = true; DialogResult result = dlg.ShowDialog(); if (result == DialogResult.OK || result == DialogResult.Yes) { PlaybackSystem.Load(dlg.FileName); } }
// Update is called once per frame void Update() { DateTime c; if (TimeControlSystem.CurrentTimeMillis < 0) { c = new DateTime(0); } else { c = new DateTime(TimeControlSystem.CurrentTimeMillis * 10000L); } DateTime t = new DateTime(PlaybackSystem.GetMillisTotal() * 10000L); Info.text = c.ToString("m:ss") + "/" + t.ToString("m:ss"); if (PlaybackSystem.GetMillisTotal() > 0) { Slider.value = TimeControlSystem.CurrentTimeMillis / (float)PlaybackSystem.GetMillisTotal(); } }