예제 #1
0
    public void StartSound()
    {
        if (!IsPlaying)
        {
            MicrophoneSource      = GetComponent <UnityEngine.AudioSource>();
            MicrophoneSource.clip = UnityEngine.Microphone.Start(null, true, BUFFER_SIZE_IN_SECONDS, SampleRate);
            GetMicrophoneSamples();

            // Since GetData gives a LOT of data, move our ReadPosition closer to the current samples upon first read
            ReadPosition = UnityEngine.Microphone.GetPosition(null) - InitialReadDelayInSamples;
            ReadPosition = (ReadPosition + BufferSizeInSamples) % BufferSizeInSamples;

            m_PlayingID = AkAudioInputManager.PostAudioInputEvent(MicrophoneEvent, gameObject, AudioSamplesDelegate, AudioFormatDelegate);
        }
    }
예제 #2
0
 private void Start()
 {
     // The AudioInputEvent event, that is setup within Wwise to use the Audio Input plug-in, is posted on gameObject.
     // AudioFormatDelegate is called once, and AudioSamplesDelegate is called once per frame until it returns false.
     AkAudioInputManager.PostAudioInputEvent(AudioInputEvent, gameObject, AudioSamplesDelegate, AudioFormatDelegate);
 }