PlaySound funtion

C

Cogito

Chaps and Chapettes,

Program in C++.

Im doing a project to detect a defined marker, then play the relevent
sound when it can no longer be seen.
It worked well when using the beep function.

if( config->//not visivle ) Beep(176,20);

But when I run with the code below it either plays the error tone
which suggests it can't find the file (even though its in the local
directiory) or it crashes.
if( config-> //not visivble ) PlaySound('test' , NULL, SND_FILENAME |
SND_ASYNC);

Any suggestions as to where my mistake is?

Thanks for your time.
 
C

Chris Dollin

Cogito said:
Chaps and Chapettes,

Program in C++.

newsgroup in comp.lang.c++.
Im doing a project to detect a defined marker, then play the relevent
sound when it can no longer be seen.
It worked well when using the beep function.

if( config->//not visivle ) Beep(176,20);

Isn't that a syntax error even in C++?
But when I run with the code below it either plays the error tone
which suggests it can't find the file (even though its in the local
directiory) or it crashes.
if( config-> //not visivble ) PlaySound('test' , NULL, SND_FILENAME |
SND_ASYNC);

`PlaySound` isn't a Standard C function. I suspect you need a newsgroup
in which that library is topical.

As a random suggestion, try giving the filename argument a /complete/
filename, including the directory path and any suffix if there's supposed
to be one. (Maybe your directory browser is helpfully suppressing a
..snd suffix, or something like that.)
 
C

Christopher Benson-Manica

Cogito said:
Program in C++.

This is comp.lang.c; comp.lang.c++ is that way -> (but you're still
mostly off-topic there as well).
if( config->//not visivle ) Beep(176,20);

It's "visible", which I feel the need to point out since you failed to
spell it correctly in two separate ways in your post. Cut-and-paste
is your friend.
if( config-> //not visivble ) PlaySound('test' , NULL, SND_FILENAME |
SND_ASYNC);
Any suggestions as to where my mistake is?

Maybe you meant

if( config-> //not visivble ) PlaySound("test" , NULL, SND_FILENAME |

Those double quotes are probably important. If that's not your
problem you'll definitely want to consider

http://www.ungerhu.com/jxh/clc.welcome.txt
http://c-faq.com
http://benpfaff.org/writings/clc/off-topic.html

before posting here again.
 
P

pemo

Cogito said:
Chaps and Chapettes,

Program in C++.

Im doing a project to detect a defined marker, then play the relevent
sound when it can no longer be seen.
It worked well when using the beep function.

if( config->//not visivle ) Beep(176,20);

But when I run with the code below it either plays the error tone
which suggests it can't find the file (even though its in the local
directiory) or it crashes.
if( config-> //not visivble ) PlaySound('test' , NULL, SND_FILENAME |
SND_ASYNC);

Any suggestions as to where my mistake is?

Thanks for your time.

Asking this question on comp.lang.c perhaps?

Try a group that knows something about the OS you're using.
 
C

CBFalconer

pemo said:
Asking this question on comp.lang.c perhaps?

Try a group that knows something about the OS you're using.

Besides which, in C++, the statement:

if (config->
SND_ASYNC);

and in C the statement portion

if (config-> //not

is either a syntax error (C90) or the same as the above (C99).
"/not" is not a valid identifier.

doesn't seem to do much.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top