Posts

Post not yet marked as solved
1 Replies
1.6k Views
Our question is about an AudioToolbox framework:In what time interval is measured the "mAveragePower" value in "AudioQueueLevelMeterState struct" ?Our app shows a decibel value to user.The code that we use for init an AudioQueue:fmt.mFormatID = kAudioFormatLinearPCM;fmt.mSampleRate = 8000.0;fmt.mChannelsPerFrame = 1;fmt.mBitsPerChannel = 16;fmt.mChannelsPerFrame = 1;fmt.mFramesPerPacket = 1;fmt.mBytesPerFrame = sizeof (SInt16);fmt.mBytesPerPacket = sizeof (SInt16);fmt.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; __block OSStatus status = AudioQueueNewInput ( &fmt, HandleInputBuffer, &isWrite, NULL, kCFRunLoopCommonModes, 0, &queue ); AudioQueueBufferRef buffers[kNumberBuffers]; UInt32 bufferByteSize = kSamplesSize; for (int i = 0; i < kNumberBuffers; ++i) { OSStatus allocateStatus; allocateStatus = AudioQueueAllocateBuffer ( queue, bufferByteSize, &buffers[i] ); OSStatus enqueStatus; NSLog(@"allocateStatus = %d" , allocateStatus); enqueStatus = AudioQueueEnqueueBuffer ( queue, buffers[i], 0, NULL ); NSLog(@"enqueStatus = %d" , enqueStatus); } UInt32 d = 1; status = AudioQueueSetProperty (queue, kAudioQueueProperty_EnableLevelMetering, &d, sizeof(UInt32)); NSLog(@"audio enable metrics status = %d" , status); dispatch_async(dispatch_get_main_queue(), ^{ status = AudioQueueStart ( queue, NULL ); NSLog(@"status of audio queue start = %ld" , status); });Once in 1/2 second we get metrics with mAveragePower value:UInt32 dataSize = sizeof(AudioQueueLevelMeterState) * 1 ;AudioQueueLevelMeterState *levels = (AudioQueueLevelMeterState*)malloc(dataSize);OSStatus status = AudioQueueGetProperty(queue, kAudioQueueProperty_CurrentLevelMeterDB, levels, &dataSize);float decibelValue = levels->mAveragePower;free(levels);So, as I wrote in beginning, we don't understand on what time interval is computed an average in mAveragePower? If it is computed from last time we asked the metrics (a half second ago) or on some other time interval?
Posted Last updated
.
Post not yet marked as solved
1 Replies
691 Views
Our app uses VoiP.For both cases, when app is terminated and when app runs, if device is in active phone call, this active phone call is terminated when device receives Voip Push notification.It happens before there are triggered the Voip listener"- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type"So, despite on Voip Notification we are reporting an incoming call to CallKit, the current phone call is terminated before.If did somebody else tried to send the Voip Push Notification during the active phone call? Thanks
Posted Last updated
.