Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I an receiving audio from the cloud and saving into the wav file. But not able to play the same file at that time.

Please anyone suggest that how can I write and play the wav file at the same time in c++

What I have tried:

if (!pcm_data.empty()) 
				{
					
					fwrite(&pcm_data[0], 1, pcm_count, output_wav_file);
PlaySound(output_wav_file, NULL, SND_FILENAME | SND_LOOP); //SND_FILENAME or SND_LOOP

				}
Posted
Updated 9-Sep-21 0:49am

1 solution

I think you need to specify the async flag.
C++
PlaySound(output_wav_file, NULL, SND_FILENAME | SND_LOOP | SND_ASYNC);
Read the documentation for details.

If that doesnt work as expected you may create thread for each file to play.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900