gpt4 book ai didi

core-audio - 这有意义吗(Apple 文档)?

转载 作者:行者123 更新时间:2023-12-04 01:08:09 25 4
gpt4 key购买 nike

这是 official Apple Documentation of AudioBufferList (Core Audio Data Types Reference) 的片段:

AudioBufferList
Holds a variable length array of AudioBuffer structures.

struct AudioBufferList {
UInt32 mNumberBuffers;
AudioBuffer mBuffers[1];
};
typedef struct AudioBufferList AudioBufferList;

Fields

mNumberBuffers
The number of AudioBuffer structures in the mBuffers array.

mBuffers
A variable length array of AudioBuffer structures.

如果 mBuffers 被定义为 AudioBuffer[1] 它不是可变长度的,因此 mNumberBuffers 被隐式定义为 1 .

我在这里错过了什么还是这只是胡说八道?

最佳答案

那是因为 C99 之前的 C 需要一个非零的常量数组大小。

并且 mBuffers 不能声明为 AudioBuffer*,因为列表是就地的。

并且mBuffers不能声明为AudioBuffer,因为需要mBuffers[x]语法。

所以使用了AudioBuffer[1]

如果该结构是为 C99 编写的,那么声明将是

struct AudioBufferList {
UInt32 mNumberBuffers;
AudioBuffer mBuffers[];
};

(另见 Is using flexible array members in C bad practice?。)

关于core-audio - 这有意义吗(Apple 文档)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2449716/

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