0

我有一个功能:

-(void)ADPCMDecode:(char *)indata : (short *)outdata :(long)len {

indata是一个字符,该函数执行指针算术以迭代长度为 len,修改 outdata,这是一个简短的,我将需要执行指针算术以从中获取值。

我正在尝试使用以下方法调用该函数:

const char *modulatedBytes1 = [modulatedAudio bytes];
char *modulatedBytes [] =  modulatedBytes1;
unsigned int moduleatedLength = [modulatedAudio length];
short *decompressedBytes = NULL;

[self ADPCMDecode:modulatedBytes :decompressedBytes :moduleatedLength];

DLog(@"%hi",decompressedBytes[1]);

我在这一行收到 BAD ACCESS 错误:*outp++ = valprev;在函数内,因为我传递的是 aconstant char *而不是 achar *

我应该如何调用该函数,以及如何从中获取输出?我没有 C 语言背景,这就是为什么我不明白如何去做。

这是同一问题的唯一 C 版本: https ://pastee.org/d3y3z

4

0 回答 0