473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PlaySound funtion

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.

Jan 30 '07 #1
4 2136
Cogito wrote:
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.
>Any suggestions as to where my mistake is?
Asking this question on comp.lang.c perhaps?

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

Jan 30 '07 #2
Cogito wrote:
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.)

--
Chris "electric hedgehog" Dollin
"Reaching out for mirrors hidden in the web." - Renaissance, /Running Hard/

Jan 30 '07 #3
Cogito <se*********@gmail.comwrote:
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.

--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
Jan 30 '07 #4
pemo wrote:
Cogito wrote:
>>
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?

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
Jan 30 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: bballmitch | last post by:
Why won't the following code work? char soundfile2 = "C:/Windows/Media/pinky and the brain.wav"; PlaySound(soundfile2,NULL,SND_FILENAME|SND_SYNC|SND_ASYNC); getchar(); i put libwinmm.a in...
5
by: MLH | last post by:
I have a line of code that works when called from a procedure in Access 2.0 form... PlaySound("C:\cr\help\Help0018.wav", 0) I imported what I thought was needed into A97. However, running it...
3
by: Harry J. Smith | last post by:
I added some sounds to my application, but the example in the msdn Library did not work. It had: public static extern bool PlaySound( string szSound, IntPtr hMod, PlaySoundFlags flags ); The...
4
by: rcattral | last post by:
Has anybody been using the PlaySound() function to play WAV files from within a DLL? Here is what I normally do. Since upgrading to 7.1 NET after using VC 6.0 for quite some time, I found that I...
2
by: Joe Thompson | last post by:
Hi, I am trying to use PlaySound in a VC++.net Windows app (VS 2003). I can use it to play a file but now I want to play it from a resource. I have two questions: How do I add a wav file to...
10
by: Ot | last post by:
I found information on PlaySound. I implemented it in my program and it works just dandy. The only little problem is that I have to package the ..wav files and send them along since PlaySound...
9
by: Andy | last post by:
Hi, I have an application that has several forms. Each form acts as a monitor of a gateway system. If the gateway appears to be dead, the application should play a .wav file (not resource)...
3
by: Jared | last post by:
I'm using the first code sample below to play WAV files stored as embedded resources. For some reason I *occasionally* get scratching and crackling. I'm using a couple WAVs that ship with...
0
by: poppy | last post by:
I tried to play a wav file with function Playsound() but it played only the first seconds of the song.I would like to play whole the song.What might de be wrong?Here is my code in case someone can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.