void InitDevices() { string[] devices = Microphone.devices; int minFreq, maxFreq; Microphones = new GATMicInfo[devices.Length]; int i; for (i = 0; i < devices.Length; i++) { Microphone.GetDeviceCaps(devices[i], out minFreq, out maxFreq); Microphones[i] = new GATMicInfo(devices[i], minFreq, maxFreq); } }
/// <summary> /// Prepares and starts a stream with /// mic input. This method starts a coroutine: /// when mic input goes live, callback will be fired. /// </summary> public void StartMicrophone(GATMicInfo micInfo, ReadyToRecordHandler callback = null) { if (IsActive) { return; } CurrentMic = micInfo; if (CurrentMic.SupportsRate(GATInfo.OutputSampleRate) == false) { throw new GATException("The current microphone does not support output sample rate of " + GATInfo.OutputSampleRate); } _onReadyToRecord = callback; StartCoroutine(InitMicrophonedRoutine()); }
void InitDevices() { string[] devices = Microphone.devices; int minFreq, maxFreq; Microphones = new GATMicInfo[ devices.Length ]; int i; for( i = 0; i < devices.Length; i++ ) { Microphone.GetDeviceCaps( devices[i], out minFreq, out maxFreq ); Microphones[i] = new GATMicInfo( devices[i], minFreq, maxFreq ); } }
/// <summary> /// Prepares and starts a stream with /// mic input. This method starts a coroutine: /// when mic input goes live, callback will be fired. /// </summary> public void StartMicrophone( GATMicInfo micInfo, ReadyToRecordHandler callback = null ) { if( IsActive ) return; CurrentMic = micInfo; if( CurrentMic.SupportsRate( GATInfo.OutputSampleRate ) == false ) { throw new GATException( "The current microphone does not support output sample rate of " + GATInfo.OutputSampleRate ); } _onReadyToRecord = callback; StartCoroutine( InitMicrophonedRoutine() ); }