user3147192
user3147192

Reputation: 99

How to play a WAV file using C++/C program?

I want to know how we can play a WAV file stored in my computer using C++/C program. I'm using sndfile.h header file to read a WAV file. So, it's better if I could use the same library to play the WAV file.

Upvotes: 0

Views: 1135

Answers (1)

user3147192
user3147192

Reputation: 99

Never mind, I solved it myself. I used the following libraries -

#include<windows.h>
#include<mmsystem.h>
#pragma comment( lib, "winmm.lib" )

and used -lwinmm in linker. Then I used PlaySound command.This video can make it clear in case it helps someone - https://www.youtube.com/watch?v=7pTUeSPFhIM

Upvotes: 1

Related Questions