Convenience class for wrapping microphone information.
示例#1
0
        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);
            }
        }
示例#2
0
        /// <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());
        }
示例#3
0
        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 );
            }
        }
示例#4
0
        /// <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() );
        }