tone function on the atmega8 not generating corrrect tones

Hi
Right now I have issues with the tone function not generating the correct tones using an atmega 8. Works perfectly fine on the 328p.
After some googling I know some changes were made to fix issues with the mega8. In order to have those changes only affect mega 8 they have
done this

#if defined(__AVR_ATmega8__)
#define TCCR2A TCCR2
#define TCCR2B TCCR2
#define COM2A1 COM21
#define COM2A0 COM20
#define OCR2A OCR2
#define TIMSK2 TIMSK
#define OCIE2A OCIE2
#define TIMER2_COMPA_vect TIMER2_COMP_vect
#define TIMSK1 TIMSK
#endif

I was wondering do I need to define that variable(AVR_ATmega8) in my sketch or does that get included automatically when I tell it to compile for the Arduino NG?

That variable is set by the Arduino software when running the compiler.
So the compiler knows what the target is, and which code to generate.

The standard Tone library will not work well with an ATmega8.

There is Tone library made for the ATmega8 and there is the toneAC library that will work with the ATmega8.
http://code.google.com/p/arduino-tone-ac/

Let me know if you want that Tone library for the ATmega8, I have used it somewhere, but I have to look for it.

Hi Erdin,
Could you please provide a link to this library? The problem I'm having is it's either doesn't do anything or it sounds nothing like what I expect. The felix (cat food) theme tune sounded nothing like it. It would be useful to use my atmega 8 instead since am only using one pin. A bit of a waste to use a 328p. It would be even better if I could use my attiny44 since thats even cheaper.

If it is possible to use toneAC, please use that one. It has fixed pins, but is easier and better.

There are two versions of the tone library, fixed for ATmega8.
One fixed by "Pete62", and "B Hagman" also changed his tone library with the fix by Pete62.
This is the "B Hagman" version: Google Code Archive - Long-term storage for Google Code Project Hosting.
But i used the "Pete62" version. Look for Tone.zip, Google Code Archive - Long-term storage for Google Code Project Hosting.

The ATmega8(L) is 1 dollar. At 16MHz it is compatible with a standard Arduino board. The ATtiny44 is not compatible.