How do you play a wav file?
source code wise i mean
Of all the things I've lost I miss my mind the most
Printable View
How do you play a wav file?
source code wise i mean
Of all the things I've lost I miss my mind the most
Have a look in the multimedia section of this site.
There should be something there to help you get started.
You can play a wave file using the PlaySound function
e.g.
PlaySound("fmast.wav", NULL, SND_FILENAME | SND_ASYNC);
with, obviously, your file in place of fmast.wav
FUNKMASTER P
can this function play wav's directly from the hardrive or does the wav have to be in the project's workspace?
Of all the things I've lost I miss my mind the most
when i try to use this function it says:
error LNK2001: unresolved external symbol __imp__PlaySoundA@12
how do i fix this? im including mmsystem.h in my dialog's cpp file
Of all the things I've lost I miss my mind the most
If you specify the absolute path i.e. (C:msdevstd/bin/fmast.wav) then your file can be anywhere on the hard drive, however if you use the path (or lack there of :)) that i included in the snippet, I believe the files has to be in the same directory as the code
FUNKMASTER P
oh yeah sorry forgot...
this is a pretty old function not MFC you know
trying including windows.s
i.e.
#include windows.h
FUNKMASTER P
nope including windows.h doesnt help, still has the same linking error, any other ideas?
Of all the things I've lost I miss my mind the most
link with winmm.lib
Do everything that you have been (using the PlaySound() function), and linking to the .lib file that was given, but include the following line of code at the top of your .cpp file that you're calling the PlaySound() function in..
#include "mmsystem.h"
Have fun!
- Troy