using tone and ir reciever at the same time

I am trying to play simple melody and at the same time read signal from ir remote, so when the key is pressed the speed of the melody should change. I realized that this is not posible with tone() function, so i'm using another tone library. And instead of delay i use millis. Still, i can't figure out how the code should look like.

This current code compiles normaly but everyting I get from speaker is some noise. Any ideas?

sketch_jan10b.ino (1.03 KB)

so i'm using another tone library.

But, I'm not going to tell you which one, or where I got it, or whether it works without the IR code being present...

Any ideas?

A couple, but I'll keep them to myself for now.

I'm using tone library from this link Google Code Archive - Long-term storage for Google Code Project Hosting.

I also tried the example from this link and it works. IR remote also woks fine when its used without playing tone on the speaker.

Depending on which board you are using, the IR library and that tone library both appear to use timer 2.

PaulS:
Depending on which board you are using, the IR library and that tone library both appear to use timer 2.

Do you know how to solve this problem?