core-audio

Keep playing sound with MPMoviePlayerController and locked screen?

五迷三道 提交于 2019-12-01 20:40:50
When you're watching a video with MPMoviePlayerController and the user presses the top button to lock the screen, the app goes to sleep and so does the sound from the video. Is there any way to prevent the lock from stopping the sound? If not, is there a way to intercept the lock, to create a "custom lock", to save some battery but keep playing the video? Sounds like you haven't set your audio session category . Set the AVAudioSession 's category property to AVAudioSessionCategoryPlayback to indicate that the app's major purpose is to play back audio, and it therefore should ignore the screen

Converting an AudioBufferList to a CMSampleBuffer Produces Unexpected Results

允我心安 提交于 2019-12-01 19:32:52
I'm trying to convert an AudioBufferList that I get from an Audio Unit into a CMSampleBuffer that I can pass into an AVAssetWriter to save audio from the microphone. This conversion works, in that the calls I'm making to perform the transformation don't fail, but recording ultimately does fail, and I'm seeing some output in the logs that seems to be cause for concern. The code I'm using looks like this: - (void)handleAudioSamples:(AudioBufferList*)samples numSamples:(UInt32)numSamples hostTime:(UInt64)hostTime { // Create a CMSampleBufferRef from the list of samples, which we'll own

Intermittent crash in recordingCallback() on app launch

一世执手 提交于 2019-12-01 14:42:27
My iOS app (using openFrameworks) crashes 30-40% of the time on launch on this line: if(soundInputPtr!=NULL) soundInputPtr->audioIn(tempBuffer, ioData->mBuffers[i].mDataByteSize/2, 1); which is inside the larger function in ofxiPhoneSoundStream.m static OSStatus recordingCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { I am doing audio setup with ofSoundStreamSetup(0, 1, this, 44100, 256, 4); in setup() . In the simulator this crash happens 100% of the time. Any idea (a)

AudioQueue does not output any sound

a 夏天 提交于 2019-12-01 14:20:27
I have trouble getting sound output on my iPhone experiment and I'm out of ideas. Here is my callback to fill the Audio Queue buffer void AudioOutputCallback(void *user, AudioQueueRef refQueue, AudioQueueBufferRef inBuffer) { NSLog(@"callback called"); inBuffer->mAudioDataByteSize = 1024; gme_play((Music_Emu*)user, 1024, (short *)inBuffer->mAudioData); AudioQueueEnqueueBuffer(refQueue, inBuffer, 0, NULL); } I setup the audio queue using the following snippet // Create stream description AudioStreamBasicDescription streamDescription; streamDescription.mSampleRate = 44100; streamDescription

How can I detect if headphones are connected to an iPod touch G1?

耗尽温柔 提交于 2019-12-01 13:31:33
There are many articles on how to detect if a microphone is connected to an iPod touch G2 via AudioSessionGetProperty / kAudioSessionProperty_AudioInputAvailable , but I have not seen any articles related to detection of headphones connected to an iPod touch G1. To review: iPod touch G2 hardware differs from iPod touch G1 hardware in the following ways: iPod touch G2 has an internal speaker iPod touch G2 is able to use microphone off of headphone port I have an app that needs to play sound to be useful and I want to be nice and have a detector that shows that the app is useful once they

AudioQueue does not output any sound

ぃ、小莉子 提交于 2019-12-01 12:29:36
问题 I have trouble getting sound output on my iPhone experiment and I'm out of ideas. Here is my callback to fill the Audio Queue buffer void AudioOutputCallback(void *user, AudioQueueRef refQueue, AudioQueueBufferRef inBuffer) { NSLog(@"callback called"); inBuffer->mAudioDataByteSize = 1024; gme_play((Music_Emu*)user, 1024, (short *)inBuffer->mAudioData); AudioQueueEnqueueBuffer(refQueue, inBuffer, 0, NULL); } I setup the audio queue using the following snippet // Create stream description

Audio Unit Graph pause and repeating

不羁的心 提交于 2019-12-01 12:13:29
I've been trying to implement Audio Unit Graph using Apple provided code: IphoneMixerEQGraphTest . So far I have encountered two problems: 1.) I can't find any way to pause playing 2.) Provided example repeats endlessly. Is There a way I can disable repeat or or stop it - using a timer, intercept some kind of buffer value, when playing is almost at the end? Thank You. NO REPEATING FUNCTIONALITY So far I have found a way to deal with audio stopping - although it's not pretty: I load same audio file in AVAudioPlayer - and get from it sound file duration. Then, using performSelector:withObject

Mac OS X Simple Voice Recorder

青春壹個敷衍的年華 提交于 2019-12-01 11:46:04
Does anyone have some sample code for a SIMPLE voice recorder for Mac OS X? I would just like to record my voice coming from the internal microphone on my MacBook Pro and save it to a file. That is all. I have been searching for hours and yes, there are some examples that will record voice and save it to a file such as http://developer.apple.com/library/mac/#samplecode/MYRecorder/Introduction/Intro.html . The sample code for Mac OS X seems to be about 10 times more complicated than similar sample code for the iPhone. For iOS the commands are as simple as: soundFile =[NSURL FileURLWithPath:

How can I detect if headphones are connected to an iPod touch G1?

独自空忆成欢 提交于 2019-12-01 11:42:59
问题 There are many articles on how to detect if a microphone is connected to an iPod touch G2 via AudioSessionGetProperty / kAudioSessionProperty_AudioInputAvailable , but I have not seen any articles related to detection of headphones connected to an iPod touch G1. To review: iPod touch G2 hardware differs from iPod touch G1 hardware in the following ways: iPod touch G2 has an internal speaker iPod touch G2 is able to use microphone off of headphone port I have an app that needs to play sound to

AVAssetReader to AudioQueueBuffer

白昼怎懂夜的黑 提交于 2019-12-01 11:15:33
Currently, I'm doing a little test project to see if I can get samples from an AVAssetReader to play back using an AudioQueue on iOS. I've read this: ( Play raw uncompressed sound with AudioQueue, no sound ) and this: ( How to correctly read decoded PCM samples on iOS using AVAssetReader -- currently incorrect decoding ), Which both actually did help. Before reading, I was getting no sound at all. Now, I'm getting sound, but the audio is playing SUPER fast. This is my first foray into audio programming, so any help is greatly appreciated. I initialize the reader thusly: NSDictionary *