x


iPhone pitch not working?

Okay so here's my code in the update function

   if (sound.isPlaying && stopping == true)
        {
        sound.pitch = sound.pitch-0.01;
        if (sound.pitch <= 0.1)
            {
            sound.Stop();
            sound.pitch = 1;
            stopping = false;
            }
        }

A function is called which makes stopping = true. Then, for every frame, the pitch is reduced to 0.01. When the pitch is less than 0.1, it stops.

On the player inside Unity it works fine. In the iPhone however, the pitch does not change at all, but the music stops when it should. It's as if the pitch value is changing but not affecting the music.

Is this a limitation of compressed music on the iPhone?

Thanks

more ▼

asked Feb 28 '10 at 07:47 PM

Peter B-B gravatar image

Peter B-B
236 13 15 21

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

1 answer: sort voted first

Correct, compressed music played back through hardware does not have support for changing pitch. (As an aside, reducing pitch by .01 per frame makes your code framerate-dependent; you should use Time.deltaTime.)

more ▼

answered Feb 28 '10 at 08:18 PM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

(comments are locked)
10|3000 characters needed characters left
Your answer
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:

x2000
x1029
x171
x10

asked: Feb 28 '10 at 07:47 PM

Seen: 1404 times

Last Updated: Feb 28 '10 at 07:47 PM