Does volunteering matter more than AP classes and high grades?

The devil is in detail. If you are going to be taking a a lot AP or otherwise challenging courses, perhaps it would be better to take a few less (because your academic strength will still show) and spend more time on volunteering.