x


How to detect that Unity engine plays an audio from iPhone Objective-C plug-in?

I am working on iPhone app that records a user voice. From time to time this game plays sounds using Unity3d engine. An Objective-C recorder should stop recording when it detects that unity engine plays the sound. Is there any way using OpenAL apis or Native iPhone SDK to detect the fact that the sound is currently playing on this device?

PS:

I have tried to send notification right from Unity after playing the sound

    source.Play();
    float lengthOfClip = source.clip.length;
    yield return new WaitForSeconds(lengthOfClip);
    .
    while (source.isPlaying)
    {
        yield return new WaitForSeconds(0.1f);
    }

    Call Objective-C plugin - > BlockRecordingThread

But still, sometimes it records a small chunk of sound. Any idea why it happens? I thought it would be much easier if I could detect on API level and block recording if device currently is playing audio, but I cant find such API.

Thanks

more ▼

asked Dec 13 '10 at 03:10 PM

stubbornmoose gravatar image

stubbornmoose
54 3 4 11

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1060

asked: Dec 13 '10 at 03:10 PM

Seen: 640 times

Last Updated: Dec 13 '10 at 05:28 PM