本文整理汇总了C++中CAStreamBasicDescription::IsInterleaved方法的典型用法代码示例。如果您正苦于以下问题:C++ CAStreamBasicDescription::IsInterleaved方法的具体用法?C++ CAStreamBasicDescription::IsInterleaved怎么用?C++ CAStreamBasicDescription::IsInterleaved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAStreamBasicDescription
的用法示例。
在下文中一共展示了CAStreamBasicDescription::IsInterleaved方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void AUBufferList::Allocate(const CAStreamBasicDescription &format, UInt32 nFrames)
{
UInt32 nStreams;
if (format.IsInterleaved()) {
nStreams = 1;
} else {
nStreams = format.mChannelsPerFrame;
}
// careful -- the I/O thread could be running!
if (nStreams > mAllocatedStreams) {
size_t theHeaderSize = sizeof(AudioBufferList) - sizeof(AudioBuffer);
mPtrs = (AudioBufferList *)CA_realloc(mPtrs,
SafeMultiplyAddUInt32(nStreams, sizeof(AudioBuffer), theHeaderSize));
mAllocatedStreams = nStreams;
}
UInt32 bytesPerStream = SafeMultiplyAddUInt32(nFrames, format.mBytesPerFrame, 0xF) & ~0xF;
UInt32 nBytes = SafeMultiplyAddUInt32(nStreams, bytesPerStream, 0);
if (nBytes > mAllocatedBytes) {
if (mExternalMemory) {
mExternalMemory = false;
mMemory = NULL;
}
mMemory = (Byte *)CA_realloc(mMemory, nBytes);
mAllocatedBytes = nBytes;
}
mAllocatedFrames = nFrames;
mPtrState = kPtrsInvalid;
}
示例2: offsetof
void AUBufferList::Allocate(const CAStreamBasicDescription &format, UInt32 nFrames)
{
UInt32 nStreams;
UInt32 channelsPerStream;
if (format.IsInterleaved()) {
nStreams = 1;
channelsPerStream = format.mChannelsPerFrame;
} else {
nStreams = format.mChannelsPerFrame;
channelsPerStream = 1;
}
// careful -- the I/O thread could be running!
if (nStreams > mAllocatedStreams) {
mPtrs = (AudioBufferList *)CA_realloc(mPtrs, offsetof(AudioBufferList, mBuffers) + nStreams * sizeof(AudioBuffer));
mAllocatedStreams = nStreams;
}
UInt32 bytesPerStream = (nFrames * format.mBytesPerFrame + 0xF) & ~0xF;
UInt32 nBytes = nStreams * bytesPerStream;
if (nBytes > mAllocatedBytes) {
if (mExternalMemory) {
mExternalMemory = false;
mMemory = NULL;
}
mMemory = (Byte *)CA_realloc(mMemory, nBytes);
mAllocatedBytes = nBytes;
}
mAllocatedFrames = nFrames;
mPtrState = kPtrsInvalid;
}
示例3: GetFormat
OSStatus CAAudioUnit::SetNumberChannels (AudioUnitScope inScope,
AudioUnitElement inEl,
UInt32 inChans)
{
// set this as the output of the AU
CAStreamBasicDescription desc;
OSStatus result = GetFormat (inScope, inEl, desc);
if (result) return result;
desc.SetCanonical (inChans, desc.IsInterleaved());
result = SetFormat (inScope, inEl, desc);
return result;
}