It looks like you're new here. If you want to get involved, click one of these buttons!
architectpianist
Posts: 128Registered Users
NSString *path = [[NSBundle mainBundle] pathForResource:@\"MyBackgroundMusic\" ofType:@\"wav\"];
NSData *data = [[NSData alloc] initWithContentsOfFile:path]; //temporary (for the below line)
NSLog(@\"Data: %@\", data); //SKIPS!!!
NSError *err;
NSLog(@\"Path = %@\", path);
player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:&err];
if (player == nil)
NSLog(@\"%@\", [err description]);
else
{
[player prepareToPlay];
player.numberOfLoops = -1;
[player play];
NSLog(@\"Duration: %10.4f Current Time: %10.4f Playing? %i\", player.duration, player.currentTime, player.playing);
}
2011-04-02 16:58:36.602 mathematics[10699:207] Path = /Users/architectpianist/Library/Application Support/iPhone Simulator/4.2/Applications/33B3F7B0-74ED-4DD1-8965-BDF0CD957C66/mathematics.app/MyBackgroundMusic.wav
2011-04-02 16:58:48.590 mathematics[10699:207] Duration: 173.7525 Current Time: 0.0000 Playing? 1