yes, thank so much, this is my solution:
unsigned int period_size = 4096;
Mix_Chunk* sound = (Mix_Chunk*) malloc(sizeof(Mix_Chunk);
sound->alen = 4096;
sound->abuf = (uint8_t*) malloc(period_size);
sound->allocated = true;
void play(data, len)
{
while (len) {
if (len > period_size) {
memcpy(sound->abuf, data + index, sound->alen);
len -= sound->alen;
index += sound->alen;
}
else {
memcpy(sound->abuf, data + index, len);
len -= len;
index += len;
}
channel2 = Mix_PlayChannel(-1, sound2, 0);
if (channel2 == -1) {
printf("Unable to play WAV file: %s\n", Mix_GetError());
exit(-1);
}
while(Mix_Playing(channel2) != 0);
}
}
Sequentially, I has copied data from stream by block (4096 bytes), then waiting finished play it . It work ok. But i think this is not good ideal. Do you think so