Пример #1
0
        IEnumerator InitMicrophonedRoutine()
        {
            int micPos;

            _source.clip = Microphone.Start(CurrentMic.name, true, 1, GATInfo.OutputSampleRate);

            micPos = 0;

            while (micPos == 0)
            {
                yield return(null);

                micPos = CurrentMic.GetPosition();
            }

            _source.timeSamples = micPos;
            _source.Play();

            while (_source.timeSamples == 0)
            {
                yield return(null);
            }

            IsActive     = true;
            _initialized = true;

            if (_onReadyToRecord != null)
            {
                _onReadyToRecord();
            }
        }
Пример #2
0
 void OnEnable()
 {
     if (_initialized && _source.clip != null)
     {
         _source.timeSamples = CurrentMic.GetPosition();
         _source.Play();
         IsActive = true;
     }
 }