رکورد صدا در یونیتی
يكشنبه, ۲۶ ارديبهشت ۱۳۹۵، ۰۲:۲۴ ق.ظ
gameover.blog.ir
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Start() { AudioSource aud = GetComponent<AudioSource>(); aud.clip = Microphone.Start("Built-in Microphone", true, 10, 44100); aud.Play(); } }
مثال بعدی:
using UnityEngine; using System.Collections; public class recordAudio : MonoBehaviour { void Start() { string deviceName = ""; foreach (string device in Microphone.devices) { deviceName = device; Debug.Log (deviceName); } //================= AudioSource aud = GetComponent<AudioSource>(); aud.clip = Microphone.Start("Microphone (Realtek High Definition Audio)", true, 10, 44100); aud.Play(); } // Update is called once per frame void Update () { } }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Start() { foreach (string device in Microphone.devices) { Debug.Log("Name: " + device); } } }
بررسی در حال رکورد:
Microphone.IsRecording
قطع میکروفون:
Microphone.End