Hiển thị các bài đăng có nhãn using microphone. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn using microphone. Hiển thị tất cả bài đăng

Chủ Nhật, 31 tháng 1, 2016

Blow game in Unity - Using Microphone

Hi,

This month, I make game like Flappy bird, and using Microphone in Unity.
And now, I write about blow game.

First, I use code from thread: http://forum.unity3d.com/threads/blow-detection-using-ios-microphone.118215/#post-802891

And when use code from post #15, It always crash on android, It use more 1GB ram and crash.


And I fix like #28
/// Starts the Mic, and plays the audio back in (near) real-time.
In AudioSource (I use AudioSource), I set:


private void StartMicListener() {

audio.clip = Microphone.Start(null, true, 1, AudioSettings.outputSampleRate);
// HACK - Forces the function to wait until the microphone has started, before moving onto the play function.
while (!(Microphone.GetPosition(null) > 0)) {
} audio.Play();

}




And, if you need use AudioMixer

Because, when your game recording, the Audiosource will play, and it play with sound in game.

Thanks for reading!!! :D
-- Tuấn Vũ --