0

I am using Xcode 4.3 and i have a problem with playing sound... I downloaded this project from an answer i found here from but when i change his file with mine http://dl.dropbox.com/u/63377498/AudioText.zip i can't hear anything. Can be a problem of my simulator? Settings of my mac? I don't know... That's the code i use:

@interface ViewController ()
@property (nonatomic, strong) AVAudioPlayer *theAudio;
@end

@implementation ViewController
@synthesize theAudio = _theAudio;

- (void)viewDidLoad
{
[super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.
NSString *soundPath =[[NSBundle mainBundle] pathForResource:@"sad" ofType:@"caf"];
NSURL *soundURL = [NSURL fileURLWithPath:soundPath];

NSError *error;
self.theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:&error];
}

- (IBAction)pushBell {
[self.theAudio play];
}
Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
arniotaki
  • 2,175
  • 2
  • 23
  • 26
  • i found out that my sound file has a problem but i do not know why i do have this problem. I tried to change the sound file with another sound and it worked. – arniotaki Jun 22 '12 at 13:04
  • Unless the sound file was composed by [Django Reinhardt](http://en.wikipedia.org/wiki/Django_Reinhardt) this doesn't have to do with django models. Removing the tag. – Burhan Khalid Jun 25 '12 at 09:30

1 Answers1

0

Finally i found the answer on my own. I was doing everything right but i used a sound file downloaded from youtube in mp3 format and i converted to .caf format by changing the extension....Thats the reason why i can't play that sound!

arniotaki
  • 2,175
  • 2
  • 23
  • 26