avaudioplayer

Is it OK to mix AudioServicesPlaySystemSound and AVAudioPlayer?

五迷三道 提交于 2019-12-10 03:52:30
问题 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 (they are longer, we need looping and volume control, etc). The sound effects are simply being played with AudioServicesPlaySystemSound (they are very short, we don

How to set volume control using uislider in iphone?

浪子不回头ぞ 提交于 2019-12-09 23:50:41
问题 .h file IBOutlet UISlider *valume; AVAudioPlayer * player; -(IBAction)sliderValueChanged:(UISlider *)slider; .m file -(IBAction)sliderValueChanged:(UISlider *)slider{ } how to set volume maximum and minimum using uislider 回答1: or -(IBAction)sliderValueChanged:(UISlider *)slider{ player.volume=slider.value; } its work for me :) 回答2: -(IBAction)sliderValueChanged:(UISlider *)slider{ player.volume=slider.value; } 来源: https://stackoverflow.com/questions/16435178/how-to-set-volume-control-using

Playing multiple sounds simultaneously with AVAudioPlayer

这一生的挚爱 提交于 2019-12-09 13:32:42
问题 Could someone help me with a function that fires multiple AVAudioPlayer s at the same time? Right now I am trying to get a total of twelve AVAudioPlayer s to fire at once if twelve buttons are activated, but there is a delay and it sounds like someone is running their finger down a piano instead of hitting all the keys at once. I've looked at Audio Queue Services and can't understand how to actually implement that into code, but it says it can play synchronized sounds. I'm not sure sure how

Setting and accessing iOS seek bar on lock screen

♀尐吖头ヾ 提交于 2019-12-09 13:09:03
问题 I am playing a audio file in iOS app using AVQueuePlayer/AVFoundation. i have set the MPNowPlayingInfoCenter's now playing information like album title, artist, Artwork, like this NSMutableDictionary *albumInfo = [[NSMutableDictionary alloc] init]; MPMediaItemArtwork *artworkP; UIImage *artWork = [UIImage imageNamed:album.imageUrl]; [albumInfo setObject:album.title forKey:MPMediaItemPropertyTitle]; [albumInfo setObject:album.auther forKey:MPMediaItemPropertyArtist]; [albumInfo setObject:album

IOS: Play sound while app in background

你说的曾经没有我的故事 提交于 2019-12-09 11:20:39
问题 I working on a little app where i want the phone to play a sound file on an event from my location controller. The problem is when the App is in Background mode the AVAudioPlayer not start the Audio file but the code is scheduled, getting NSLog output. Another thing is it works in the simulator but not on the phone. Whys not? This is my code to play the file: - (void)tryPlayTaleSound:(NSString*)fileName { NSString *backgroundMusicPath = [[NSBundle mainBundle] pathForResource:fileName ofType:@

Set device volume on iPhone

你离开我真会死。 提交于 2019-12-09 06:43:02
问题 I'm writing an app that uses AVAudioPlayers to play sounds and I need the sounds to play at absolute MAX volume. Yes you can set the relative volume for an AVAudioPlayer , but if the user has the device volume turned down, the sound will still play quietly. I know that Apple says that the device volume cannot be overridden, but yet the Alarm Clock apps out there somehow are able to do this - so there must be a way. I believe that this can be done using Audio Queues using the call:

AVAudioPlayer via Speakers

北城以北 提交于 2019-12-09 04:59:20
问题 I got the following code: - (id)init { if (self = [super init]) { UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback; AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory); UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride); [[AVAudioSession sharedInstance] setDelegate:self]; [[AVAudioSession

Fetch All Audio & Video files in ios

こ雲淡風輕ζ 提交于 2019-12-09 03:26:31
问题 I want to fetch all audio files and also video files from device into the app. so that i can listed their names into the different UITableViews. Is there any way in ios, so that i can fetch them. 回答1: Have a look at this,specially on the section " Getting Media Items Programmatically ". If the media item picker doesn’t provide the control you want, you can use the database access classes from this API. These classes are designed to let you create arbitrarily complex queries. You could, for

How to play multiple audio files in sequence by loop in AVAudioPlayer?

半城伤御伤魂 提交于 2019-12-09 01:40:28
问题 I want to play multiple files by using loop. I written code below.. Please help me.!!.. soundList = [[NSArray alloc] initWithObjects:@"mySong1.mp3",@"mySong2.mp3",@"mySong3.mp3",@"mySong4.mp3",@"mySong5.mp3",@"mySong6.mp3",@"mySong7.mp3",@"mySong8.mp3",@"mySong9.mp3", nil]; for (i=0; i<=([soundList count] - 1); ) { while(i<[soundList count]){ NSLog(@"File is : %@",[soundList objectAtIndex:i]); mediaPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[[NSURL alloc] initFileURLWithPath:[

IOS maximum volume level for AVAudioPlayer?

北城余情 提交于 2019-12-08 23:46:56
问题 I use the AVAudioPlayer to play a .caf file. My problem is: it is not loud enough for my purpose. Since the ringer sound of the IPhone is much louder I was wondering how I can archive this volume. I already tried to manipulate the .caf file but with no real success. Any ideas? The code I use so far: AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: url error: nil]; self.appSoundPlayer = newPlayer; [newPlayer release]; [appSoundPlayer prepareToPlay]; [appSoundPlayer