gpt4 book ai didi

iphone - iPhone开发者-后台录音的AudioQueue Services

转载 作者:行者123 更新时间:2023-12-03 02:25:50 24 4
gpt4 key购买 nike

我已经构建了一个录音应用程序(例如Apple的“SpeakHere”演示),我想知道如何修改它才能在Background上使用。

每次进入后台时,AudioQueue回调都会冻结,并且我没有收到一个音频字节。

我已经看到iPhone上的Voice Memos应用程序可以在后台录制。

这是我的回调在后台不起作用:

OSStatus AQRecorder::BufferFilled_callback( 
void * inUserData,
SInt64 inPosition,
UInt32 requestCount,
const void * buffer,
UInt32 * actualCount) {


AQRecorder *aqr = (AQRecorder *)inUserData;

NSLog(@"THIS METHOD IS NOT CALLED ON BACKGROUND");

int fd = open(aqr->mWriteFile, O_WRONLY|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if (fd) {

*actualCount = (int)write( fd, buffer, requestCount);
close(fd);

[aqr->mi setToread:[aqr->mi toread] + requestCount];

} else {
perror("Fopen");
}

return 0;

有什么想法吗?

最佳答案

您是否使用应用程序的info.plist“必需的背景模式”键下的适当值启用了背景记录?

关于iphone - iPhone开发者-后台录音的AudioQueue Services,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5010835/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com