我使用ExtAudioFileRead函数将音频文件加载到内存.但我发现代码-50总是出错.这意味着我将错误的参数传递给函数.但我不知道哪一个是错误的参数.
音频文件的数据格式为alac,sampleRate 44100k,有2个通道.
我的代码如下所示:
ExtAudioFileRef recordFile;
OSStatus error = noErr;
error = ExtAudioFileOpenURL((CFURLRef)file, &recordFile);
checkError(error, "open file");
SInt64 frameCount;
UInt32 size = sizeof(frameCount);
error = ExtAudioFileGetProperty(recordFile, kExtAudioFileProperty_FileLengthFrames, &size, &frameCount);
checkError(error, "get frameTotlal");
soundStruct *sound = &_sound;
sound->frameCount = frameCount;
sound->isStereo = true;
sound->audioDataLeft = (SInt16 *)calloc(frameCount, sizeof(SInt16));
sound->audioDataRight = (SInt16 *)calloc(frameCount, sizeof(SInt16));
AudioStreamBasicDescription desc;
UInt32 descSize = sizeof(desc);
error = ExtAudioFileGetProperty(recordFile, kExtAudioFileProperty_FileDataFormat, &descSize, &desc);
[self printASBD:desc];
UInt32 channels = desc.mChannelsPerFrame;
error = ExtAudioFileSetProperty(recordFile, kExtAudioFileProperty_ClientDataFormat, sizeof(inFormat), &inFormat);
AudioBufferList *bufferList;
bufferList = …Run Code Online (Sandbox Code Playgroud) 我有一个message_message包含3000000条记录的表。
当我进行count(*)查询时,它非常慢...:
mysql> select count(*) from message_message;
+ ---------- +
| count(*)|
+ ---------- +
| 2819416 |
+ ---------- +
一组1列(2分35.35秒)
解释一下:mysql> explain select count(*) from message_message;
| id | select_type | 桌子| 类型 可能的钥匙| 关键 key_len | 参考| 行|额外|
| 1 | 简单 message_message | 索引| NULL | 主要| 4 | NULL | 2939870 | 使用索引
设置1行(0.02秒)
发生什么事?