我是 iPhone 新手。您能否帮我修改 Apple 的 SpeakHere 应用程序以录制单声道格式。我应该设置mChannelsPerFrame
什么,我还应该设置什么?
我已经更改了一些部分以记录 linearPCM WAVE 格式。
这里是speakHere的链接。
以下是我认为他们允许我改变但我不太了解声音的内容:
void ChangeNumberChannels(UInt32 nChannels, bool interleaved)
// alter an existing format
{
Assert(IsPCM(), "ChangeNumberChannels only works for PCM formats");
UInt32 wordSize = SampleWordSize(); // get this before changing ANYTHING
if (wordSize == 0)
wordSize = (mBitsPerChannel + 7) / 8;
mChannelsPerFrame = nChannels;
mFramesPerPacket = 1;
if (interleaved) {
mBytesPerPacket = mBytesPerFrame = nChannels * wordSize;
mFormatFlags &= ~kAudioFormatFlagIsNonInterleaved;
} else {
mBytesPerPacket = mBytesPerFrame = wordSize;
mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
}
}