SDL_mixer plays good sound only once after a reboot

I wrote a small SDL_mixer program, when I run it the first time, I get following

“ALSA lib pcm_dmix.c:802:(snd_pcm_dmix_open) unable to open slave”

But the program plays sound with good quality — that time only.

After that, when I run this program again, I dont get this message, but sound
quality is terrible.

What is going on?

Laeeq_M_Khan at