我们有一段 C 代码如下。任何解决方案都已声明并初始化
void fillProcess(void *unused, Uint8 *stream, int len)
{
Uint8 *waveptr;
int waveleft=0;
waveptr = wave.sound + wave.soundpos;
waveleft = wave.soundlen - wave.soundpos;
while ( waveleft <= len ) {
/* Process samples */
Uint8 process_buf[waveleft];
SDL_memcpy(process_buf, waveptr, waveleft);
/* do processing here, e.g. */
/* processing the audio samples in process_buf[*] */
// play the processed audio samples
SDL_memcpy(stream, process_buf, waveleft);
stream += waveleft;
len -= waveleft;
// ready to repeat play the audio
waveptr = wave.sound;
waveleft = wave.soundlen;
wave.soundpos = 0;
}
}
得到3个错误如下
Error 1 error C2057: expected constant expression
Error 2 error C2466: cannot allocate an array of constant size 0
Error 3 error C2133: 'process_buf' : unknown size