I've written an App supposed to BE run both on iPad and on iPhone. I'm using AVAudioPlayer for playing back sound. Now I've run into some problems with the volume levels.
When running on the iPad, everything is fine, the volume level of the sound being played is fine, also when running in the iPad simulator.
The problem arises when the app is being run on the iPhone: whereas the volume levels in the iPhone simulator are fine, the levels on the device are very low.
Here's the code I'm using on both devices:
if (audioPlayerAtmo==nil)
{
NSString *filename = [NSString stringWithFormat:@"Atmo_%i", currentPage];
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:filename ofType:@"mp3"]];
AVAudioPlayer *tempPlayer =[[AVAudioPlayer alloc] initWithContentsOfURL:url error:NULL];
tempPlayer.delegate = self;
//NSLog(@"tempPlayer.volume: %f", [tempPlayer volume]);
[tempPlayer setVolume:1.0f];
//NSLog(@"tempPlayer.volume: %f", [tempPlayer volume]);
self.audioPlayerAtmo = tempPlayer;
[tempPlayer release];
[audioPlayerAtmo play];
btAtmo.selected = YES;
}
else // player exists
{
// ...
}
Does someone have an idea why the level is so low on the iPhone while everything is fine in the simulator and on the iPad?
Thanks in advance for your help.
Tech data: XCode 3.2.4 iPhone 4 (Vers. 4.1)