avaudiosession

Enable ring/silent switch with AVAudioSessionCategoryPlayAndRecord

感情迁移 提交于 2020-01-07 04:55:12
问题 How do I make physical ring/silent switch work again when I want to play and record audio at the same time using AVAudioSessionCategoryPlayAndRecord? I just cannot find an answer to that anywhere. 回答1: AVAudioSessionCategoryPlayAndRecord is designed for audio-centric apps, where the purpose of the app is to play music. When this category is set, audio will not be silenced by the mute switch or the screen lock. VOIP apps and music apps desire this behavior. If you want audio to be silenced by

AVAssetReader reads audio, then fails

流过昼夜 提交于 2020-01-05 00:52:29
问题 My app reads audio and plays it back in a producer / consumer setup. The consumer thread requests new samples to render to hardware. The producer thread reads audio data from disk into its buffer using AVAssetReader. The producer thread runs in a loop, checking if more samples need to be read. The producer's buffer size is equal to 4 seconds of audio. When I instruct my app to buffer audio, samples are read successfully without error. When I trigger my producer thread to begin rendering audio

iOS 9 detect silent mode

南楼画角 提交于 2020-01-04 06:28:12
问题 I've been looking for a long time, posting here as a final try before giving up. I want to detect if I'm currently on Silent mode or not. I found a workaround (playing a fake sound and checking the completion) that works fine but only when I'm not in AVAudioSessionCategoryPlayAndRecord mode. This is precisely on a screen where I can record audio and video that I want to achieve this in order to know whether I should play UI sounds or not. To sum up, I trying to find a way to detect silent

Sounds in UILocalNotification louder than AVAudioPlayer at max volume

旧时模样 提交于 2020-01-03 03:13:06
问题 For purposes of this question, imagine my app plays an audio clip every 10 seconds. This audio plays/mixes with the iPod music player on the device (using ducking), using AVAudioPlayer. When the app is sent to the background, I schedule UILocalNotification objects with the audio file referenced (and no text), so the sounds continue to play at 10 second intervals. What is bothering me is that the volume of the audio clips played as part of a notification on iOS 6 seem to be twice as loud as

Audio Session: Using measurement mode causes low volume / no sound in iOS 7.1

僤鯓⒐⒋嵵緔 提交于 2020-01-02 03:01:10
问题 Using AVAudioSessionModeMeasurement with AVAudioSessionCategoryPlayAndRecord used to work fine under iOS 5.x, 6.x, and 7.0, but it now results in low volume / no sound from the speaker on some (not all) devices under iOS 7.1. Here's the code: NSError* error = nil; // Set Aduio Session category [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:&error]; if( error ) ... // Set Audio Session mode [audioSession setMode

OSStatus NSOSStatusErrorDomain

拜拜、爱过 提交于 2020-01-01 09:26:11
问题 I received the following error when I get the property using AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareSampleRate,&size, &myAudioDescription.mSampleRate) Error Produced by above statement is Error Domain=NSOSStatusErrorDomain Code=560557673 "The operation couldn’t be completed. (OSStatus error 560557673.)" Now, here what does 560557673 mean and where can I find its explanation? Documentation only provides NSOSStatusErrorDomain as one of the errors. 回答1: That code means the

OSStatus NSOSStatusErrorDomain

半城伤御伤魂 提交于 2020-01-01 09:26:11
问题 I received the following error when I get the property using AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareSampleRate,&size, &myAudioDescription.mSampleRate) Error Produced by above statement is Error Domain=NSOSStatusErrorDomain Code=560557673 "The operation couldn’t be completed. (OSStatus error 560557673.)" Now, here what does 560557673 mean and where can I find its explanation? Documentation only provides NSOSStatusErrorDomain as one of the errors. 回答1: That code means the

iOS AudioUnits pass through

拈花ヽ惹草 提交于 2019-12-31 17:57:41
问题 I am trying to write an iOS application that will pass the sound received from microphone to speaker without any changes. I've read apple docs and guides. I choosed the first pattern from this guide. But nothing happening - silence. As you can see I've tried to use the AUAudioGraph (commented) - same result (do I need it in this simple example at all?). I saw few examples in the internet where callbacks are used, but I do not want use any. Is it possible? Any suggestions? Thanks for attention

iOS AudioUnits pass through

我是研究僧i 提交于 2019-12-31 17:57:11
问题 I am trying to write an iOS application that will pass the sound received from microphone to speaker without any changes. I've read apple docs and guides. I choosed the first pattern from this guide. But nothing happening - silence. As you can see I've tried to use the AUAudioGraph (commented) - same result (do I need it in this simple example at all?). I saw few examples in the internet where callbacks are used, but I do not want use any. Is it possible? Any suggestions? Thanks for attention

AVAudioSessionInterruptionNotification not fired when Video/Camera is used

六眼飞鱼酱① 提交于 2019-12-31 04:03:25
问题 I have some SIP application. Until I've used audio only evrything was working correctly, I was receiving AVAudioSessionInterruptionNotification when it was necessary. Problem appeared when video was used (receiving and sending camera feed). Once I use session with video, notification is never fired again, even if later audio is used only. How can I fix that? I've found similar topic, but answer is to prompt and I don't fully get it. Also I do not have "camera/capture device" and