我正在使用超级功能的sdk播放音频文件。我需要等待SuperpoweredAdvancedAudioPlayer缓存文件。这是我尝试过的伪代码:
void loading (shared_ptr<SuperpoweredAdvancedAudioPlayer> player, string path)
{
player->open(path.c_str());
player->cachePosition(0, 0);
}
int main ()
{
string filePath = "/path/file.wav";
shared_ptr<SuperpoweredAdvancedAudioPlayer> player;
player = make_shared<SuperpoweredAdvancedAudioPlayer>(nullptr, nullptr, 44100, 10, 2, 0);
thread Loading(loading, player, filePath);
char *tmp = (char*)&player->waitingForBuffering;
Loading.join();
while (*tmp) {usleep(10000);}
return 0;
}
这对我不起作用。等待时间为true。 有效的等待方式是什么?