avaudioplayer

AVAudioPlayer is not rentrant correct?

It appears that AVAudioPlayer is not reentent. So in the following would soundfx play to completion, delay 1 second, then play again, rather then the 1 second delay - and resultant overlapping playback I desire: // ... AVAudioPlayer* soundfx = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:nil]; (void) makeSomeNoise { ...

AVAudioPlayer memory leak

Hi there, I'm stuck on some weird memory leak problem related to the AVAudioPlayer and I need help after trying everything that came to mind. Here is the short description of the problem - code appears right after. I initialize my player and start to play the sound track in an endless loop (and endless loop or one time play did not cha...

playing a .caf file: works fine in simulator but not in iPhone

Hi, I'm building a voice recorder. Recoding and playing works fine on simulator. But on iphone it doesn't work. (I followed the exact steps as mentioned in iPhoneOSProgrammingGuide/AudioandVideoTechnologies) printf("%s(player)\n",[[self.soundFileURL absoluteString] UTF8String]); AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] ...

iPhone programming: avaudioplayer leaks memory on play

I'm new to using avadioplayer and I seems to have a memory when ever I play a sound. I cannot figure out what I am missing to get rid of it inside Instrument. could this be a false positive? ViewController.h : @interface ISpectatorViewController : UIViewController <UIAccelerometerDelegate>{ AVAudioPlayer *massCheerSoundID; } @proper...

AVAudioPlayer can play while iPhone screen is locked; can it record at that time too?

You can easily play sounds and record sounds using the high level AVAudioPlayer. And you can play sounds using the same framework, while the iPhone screen is locked. Can you record sounds at that time? ...

AVAudioPlayer initialization error

Hello, I initialize my AVAudioPlayer instance like: [self.audioPlayer initWithContentsOfURL:url error:&err]; url contains the path of an .m4a file The following error is displayed in the console when this line is called :"Error Domain=NSOSStatusErrorDomain Code=1685348671 "Operation could not be completed. (OSStatus error 1685348671...

iPhone - AVAudioPlayer - convert decibel level into percent

Hi developers, I like to update an existing iPhone application which is using AudioQueue for playing audio files. The levels (peakPowerForChannel, averagePowerForChannel) were linear form 0.0f to 1.0f. Now I like to use the simpler class AVAudioPlayer which works fine, the only issue is that the levels which are now in decibel, not li...

[iPhone] AvAudioPlayer setting delegate to nil releases the delegate object?

@implementation MyClass -(id) init { NSString *path0 = [ [NSBundle mainBundle] pathForResource:@"myfile" ofType:@"m4a" ]; mSound = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:path0] error:NULL]; mSound.delegate = self; } -(void) release { mSound.delegate = nil; //<- this line causes MyClass r...

AVAudioPlayer Output to Speaker Problem

After searching around for how to send AVAudioPlayer output to the iPhone's speaker, I found this: http://stackoverflow.com/questions/1064846/iphone-audio-playback-force-through-internal-speaker Despite setting the category correctly to AVAudioSessionCategoryPlayAndRecord, this solution doesn't seem to be working for me and won't even ...

iPhone SDK: AVAudioPlayer making noise when paused or finishes

Hi, I'm playing multiple wav files (I tried using caf but same thing happen) with AVAudioPlayer. All the files are less than 2 sec, and 16 bit sound - file size is ~40kb. I found it makes small noise (it's hard to describe, but a small sound like 'dub') in two cases: 1) when a play is paused or stopped while playing. 2) when a play fin...

AVAudioPlayer with external URL to *.m4p

My Problem is the following. I got this code and i guess a corrupt NSURL since the AVAudioPlayer is nil after initializing: NSString *dummyURLString = @"http://a825.phobos.apple.com/us/r2000/005/Music/d8/a8/d2/mzi.jelhjoev.aac.p.m4p"; NSError *error; NSURL *url = [NSURL URLWithString:dummyURLString]; AVAudioPlayer *player = [[AVAudioPl...

Play downloaded m4p with AVAudioPlayer or MPMusicPlayerController?

Hey guys, I got an *.m4p-file reachable via a http-URL and want to play this in my iPhone App. First I tried to use the [CODE]AVAudioPlayer[/CODE], but it does not seem to support m4p-format. Am I right here? Then I wanted to use the [CODE]MPMusicPlayerController[/CODE], but this one only can play songs located within you iTunes Librar...

Is it OK to mix AudioServicesPlaySystemSound and AVAudioPlayer?

We have a game that is very close to being released, but we have one extremely annoying problem. One on of our Beta testers phones, he can't hear any of the in game sound effects. He can, however, hear the background music and the title screen music just fine. The background and title music are both being played via AVAudioPlayer (t...

iPhone AVAudioPlayer stopping background music

So I've just noticed that on my iPod Touch, when my app triggers a short wav file to play using AVAudioPlayer, the music gets paused. Is this normal? I can't find any reference to this, and it seems like it would be noted somewhere. Is there a way to keep the music going while I play my sounds? Thanks ever so much! ...

How to determine length of audio file associated with AVAudioPlayer

Does anyone know how to get attributes from a file associated with an instance of AVAudioPlayer..specifically I am looking how to determine the length of a WAV file. ...

imagepickercontroller hangs when playing sound using avaudioplayer?

I am playing sound using avaudioplayer.but when i open imagepickercontroller it hangs?does someone knows about it? ...

iPhone - start multiple instances of AVAudioPlayer simultaneously

Hi I am using multiple instances of AVAudioPlayer to play multiple audio files simultaneously. I run a loop to start playing the audio files (prepareToPlay is called beforehand and the loop only makes a call to the play method) But invariably, one of the players does not play in sync. How can I ensure that all the 4 players start playi...

why AVAudioplayer doesn't stop/pause when viewWillDisappear?

I am using avaudioplayer in my app. on viewwilldisappear i want to pause/stop the sound and on viewwill appear i want to play sound again.how do i do this? i'm using this code on viewWillAppear:- if(self.TickPlayer) { [self.TickPlayer play]; } if(self.TickPlayer.volume<0) { self.TickPlayer.volume=1.0; } and this on viewWillD...

Checking earphones connected to device programmatically?

I am using the AVAudioPlayer class to play .mp3 files in my App. Is it possible to check whether the earphones are connected to the device programmatically? In first generation iPod devices, the volume control bar is hidden (for music and videos) when no earphones are connected. ...

Why Xcode shows warning when use AVAudioPlayer Delegate protocol in appdelegate.h file?

//---------MyAppDelegate.h @interface MyAppDelegate : NSObject <UIApplicationDelegate, AVAudioPlayerDelegate> { //---in some other .m file, trying to acess the device token residing in MyAppDelegate ---------- MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; // Results in // warning: type 'id ' does not c...