public virtual bool Record(float duration) { currentlyRecording = true; bool didRecord = false; #if AUDIO_RECORDER_USE_UNITY currentRecordedClip = Microphone.Start(currentDeviceName, false, (int)duration, 44100); didRecord = true; #elif #if UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_WIN #elif UNITY_ANDROID string pathAndroid = FilterPersistentPathAndroid(GetPersistentPath(currentFileName)); LogUtil.Log("currentFileName pathAndroid: " + pathAndroid); AudioRecorderAndroid.startRecording(pathAndroid); didRecord = true; #elif UNITY_WEBPLAYER #elif UNITY_IPHONE didRecord = AudioRecorderBinding.recordForDuration(duration); currentlyRecording = false; lastRecordingSucceeded = didRecord; #elif UNITY_EDITOR #endif #endif LogUtil.Log("Record: " + didRecord); return(didRecord); }
public virtual void PrepareAudioFilename(string filename) { string error = "No recorder"; currentFileName = filename; #if AUDIO_RECORDER_USE_UNITY currentFileName = GetPersistentPath(filename); error = ""; #elif #if UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_WIN #elif UNITY_ANDROID //error = AudioRecorderAndroid.prepareToRecordFile( filename ); currentFileName = GetPersistentPath(filename); error = ""; #elif UNITY_WEBPLAYER #elif UNITY_IPHONE error = AudioRecorderBinding.prepareToRecordFile(filename); #elif UNITY_EDITOR #endif #endif if (error.Length > 0) { LogUtil.Log("failed to prepare audio recorder: " + error); } else { LogUtil.Log("File Prepared:" + filename); } }
public virtual void Pause() { #if AUDIO_RECORDER_USE_UNITY Microphone.End(currentDeviceName); #elif #if UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_WIN #elif UNITY_ANDROID AudioRecorderAndroid.pause(); #elif UNITY_WEBPLAYER #elif UNITY_IPHONE AudioRecorderBinding.pause(); #elif UNITY_EDITOR #endif #endif }
public virtual void Stop(bool finish) { #if AUDIO_RECORDER_USE_UNITY Microphone.End(currentDeviceName); AudioSystem.Save(currentFileName, currentRecordedClip); #elif #if UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_WIN #elif UNITY_ANDROID AudioRecorderAndroid.stopRecording(); #elif UNITY_WEBPLAYER #elif UNITY_IPHONE AudioRecorderBinding.stop(finish); #elif UNITY_EDITOR #endif #endif LogUtil.Log("Stop finish: " + finish); }
public virtual float GetRecordedTime() { float duration = 0f; #if AUDIO_RECORDER_USE_UNITY duration = 5.5f; #elif #if UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_WIN #elif UNITY_ANDROID duration = 5.5f; #elif UNITY_WEBPLAYER #elif UNITY_IPHONE duration = AudioRecorderBinding.getCurrentTime(); #elif UNITY_EDITOR #endif #endif LogUtil.Log("AudioRecorder GetRecordedTime duration: " + duration); return(duration); }
public virtual bool IsRecording() { bool isRecording = false; #if AUDIO_RECORDER_USE_UNITY isRecording = Microphone.IsRecording(currentDeviceName); #elif #if UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_WIN #elif UNITY_ANDROID isRecording = currentlyRecording; #elif UNITY_WEBPLAYER #elif UNITY_IPHONE isRecording = AudioRecorderBinding.isRecording(); #elif UNITY_EDITOR #endif #endif LogUtil.Log("AudioRecorder IsRecording: " + isRecording); return(isRecording); }