- snd_pcm_prepare(handle);
- snd_pcm_writei(handle,pSound, lBytes / 4);
+ {
+ memset(sbuf, 0, sizeof(sbuf));
+ snd_pcm_prepare(handle);
+ snd_pcm_writei(handle, sbuf, sizeof(sbuf) / 4);
+ snd_pcm_writei(handle, sbuf, sizeof(sbuf) / 4);
+ snd_pcm_writei(handle, sbuf, sizeof(sbuf) / 4);
+ }
+ else
+ {
+ int l = snd_pcm_avail(handle);
+ if (l < lBytes / 4)
+ {
+ if (l == 0)
+ return;
+
+ lBytes = l * 4;
+ }
+ }
+
+ snd_pcm_writei(handle, pSound, lBytes / 4);