// Methods public void Start() { // Load an existing replay file from the specified file path ReplayFileTarget replayFile = ReplayFileTarget.ReadReplayFile("C:/ReplayFiles/Example.replay"); // Start replaying ReplayManager.BeginPlayback(replayFile); }
/// <summary> /// changes the filepath for the recording files /// </summary> /// <param name="filePath"></param> public static void SetTargetFilePath(string filePath) { SavWav.FilePath = filePath; ReplayFileTarget target = ReplayManager.Target as ReplayFileTarget; // Set the location/name of the replay file to load target.FileOutputDirectory = filePath; }
// Methods public IEnumerator Start() { // Create a replay file target for the specified file path ReplayFileTarget recordFile = ReplayFileTarget.CreateReplayFile("C:/ReplayFiles/Example.replay"); // Start recording to the file ReplayHandle recordHandle = ReplayManager.BeginRecording(recordFile); // Allow some data to be recorded for 1 second yield return(new WaitForSeconds(1f)); // Stop recording - This will finalize the replay file, commit any buffered data and dispose of any open file streams. ReplayManager.StopRecording(ref recordHandle); }
/// <summary> /// make a new recording /// </summary> /// <param name="name"></param> public void createRecording(string name) { ReplayFileTarget target = ReplayManager.Target as ReplayFileTarget; // Set the location/name of the replay file to load target.FileOutputName = name + ".replay"; Debug.Log(name); //add it to the dictionary and save to a file. GetComponent <micRecorder>().StartRecording(name); RecordingDictionaryClass.addRecording(name, name + ".replay", name + ".wav"); RecordingDictionaryClass.SaveDictionary(); ReplayManager.BeginRecording(); Debug.Log("Recording"); }
/// <summary> /// playback an old recording /// </summary> /// <param name="name"></param> public void SelectandStartReplay(string name) { //check for valid name if (!RecordingDictionaryClass.RecordingDictionary.ContainsKey(name)) { Debug.Log("name dose not exist"); return; } string replayname; string replayAudio; string data = RecordingDictionaryClass.RecordingDictionary[name]; string[] Data = data.Split(','); replayname = Data[0]; replayAudio = Data[1]; Debug.Log(replayAudio); AudioClip clip = Resources.Load <AudioClip>(name); Debug.Log(clip); AudioSource.clip = clip; // Get the active record target from the replay manager ReplayFileTarget target = ReplayManager.Target as ReplayFileTarget; // Set the location/name of the replay file to load if (!replayname.EndsWith(".replay")) { replayname += ".replay"; } Debug.Log(name); target.FileOutputName = replayname; // Begin playback as normal and the file will be loaded ReplayManager.BeginPlayback(); AudioSource.Play(); // Instantiate(replayprefab); }