Hi,
I have to play a streaming audio. So in a thread I play audio as follow
thread{
//some code
for(;;){
//some code
waveOutPrepareH eader(hwo, &(whdr), sizeof(WAVEHDR) );
waveOutWrite(hw o, &(whdr), sizeof(WAVEHDR) );
while(finish == 0){} //will set in callback func
waveOutUnprepar eHeader(hwo, &(whdr), sizeof(WAVEHDR) );
}
}
However, the sound is played not smooth. I think that the PrepareHeader and
UnPrepareHeader should not be called so frequntly. Am I right?
Also, otherthan using the while(finish==0 ){}, is there any method that I can
make sure the previous stream has been playbed before I play the next stream?
}
I have to play a streaming audio. So in a thread I play audio as follow
thread{
//some code
for(;;){
//some code
waveOutPrepareH eader(hwo, &(whdr), sizeof(WAVEHDR) );
waveOutWrite(hw o, &(whdr), sizeof(WAVEHDR) );
while(finish == 0){} //will set in callback func
waveOutUnprepar eHeader(hwo, &(whdr), sizeof(WAVEHDR) );
}
}
However, the sound is played not smooth. I think that the PrepareHeader and
UnPrepareHeader should not be called so frequntly. Am I right?
Also, otherthan using the while(finish==0 ){}, is there any method that I can
make sure the previous stream has been playbed before I play the next stream?
}
Comment