[color="#1C2837"]Does the function fail? If so, try checking the result of GetLastError().[/quote]
How exactly would I do that?
I'm not that great with Windows API function calls and such.
I don't know if it fails, but it sure fails to play the sound when I call on the function.
Windows API "Playsound" not working.......
[color="#1C2837"]CAudio requres you to put only 2 dlls into your folder, caudio and mp3plugin, + you need to link it with lib file, like that
#pragma comment(lib,"caudio.lib")
and add that line #include <cAudio.h>
put caudio include files into your search paths or put lib file and caudio files into your source directory
after that it's just
[source] cAudio::IAudioManager* manager; cAudio::IAudioSource *jumpS; manager = cAudio::createAudioManager(true); jumpS=manager->create("test1","Res/Audio/jump.wav",true); [/source]
that's it [/quote]
Sounds like a lot of crap for just "that's it". >.< Also, dude, you put the slash the wrong way for the source code closing tag ...
Not that I can't do it, but I want to resolve the stupid Windows API sound issue before just moving on elsewhere.
EDIT: Someone mentioned before, also, this:
[color="#1C2837"]Also in your code you never initialize any sound system, which is like to wanna play dvd, but without dvd player [/quote]
So basically, what is a sound system and what do I do about that then? The tutorial said nary a thing about such a thing.
PlaySound returns FALSE when it fails.
GetLastError returns an DWORD, which you can put into the error lookup tool (On Extras in Visual Studio). This should give a hint on what went wrong.
Note that PlaySound is not really that useful for gaming. It only allows one sound playing concurrently and no control over volume, pan or other effects.
GetLastError returns an DWORD, which you can put into the error lookup tool (On Extras in Visual Studio). This should give a hint on what went wrong.
Note that PlaySound is not really that useful for gaming. It only allows one sound playing concurrently and no control over volume, pan or other effects.
So basically there is a class where is all the stuff wrapped for playing sound, loading sound, managind sound and etc.
This is sound system and it must be initialized somewhere in your code. Otherwise you cant play anything.
Now if you are truly hardcore you can check out the example in DirectX Sample browser about xact.
If you are not i again recomment you to look at FMOD.
And if you still dont trust me here is link with all commercial games that uses fmod:
Link , including crysis zomg.
End this topic already!
This is sound system and it must be initialized somewhere in your code. Otherwise you cant play anything.
Now if you are truly hardcore you can check out the example in DirectX Sample browser about xact.
If you are not i again recomment you to look at FMOD.
And if you still dont trust me here is link with all commercial games that uses fmod:
Link , including crysis zomg.
End this topic already!
So basically there is a class where is all the stuff wrapped for playing sound, loading sound, managind sound and etc.
This is sound system and it must be initialized somewhere in your code. Otherwise you cant play anything.
Now if you are truly hardcore you can check out the example in DirectX Sample browser about xact.
If you are not i again recomment you to look at FMOD.
And if you still dont trust me here is link with all commercial games that uses fmod:
Link , including crysis zomg.
End this topic already!
Okay, I downloaded FMOD because Windows API PlaySound continually fails no matter what.....How do I actually use it? It just installs a folder filled with tons of jibberish FOBJ files and I don't have any idea on what to do next.
I wanted something simple, like with installation as well....Downloading these APIs just makes it even harder because some are just so difficult to even compile/link because the files are disorganized and I have no idea on where to put them, what kind of files does what, etc.
That's why I tried PlaySound on Windows API, but it fails so forget it....
PS: Just so you know I read the documentation and the site and neither offers installation advice.
To add, I'm also very angry and upset and unsatisfied at the help I've been getting here.
I provided the complete code, all-around info, and no help. I've been at this for 3 weeks now and still can't even hear a sound being played in a window, sadly....It really pisses me off and I'm tired of not getting any real help.
I provided the complete code, all-around info, and no help. I've been at this for 3 weeks now and still can't even hear a sound being played in a window, sadly....It really pisses me off and I'm tired of not getting any real help.
Most waveform-audio files use the .WAV filename extension.
The following statement plays the C:\SOUNDS\BELLS.WAV file:
PlaySound("C:\\SOUNDS\\BELLS.WAV", NULL, SND_SYNC);
If the specified file does not exist, or if the file does not fit into the available memory, PlaySound plays the default system sound. If no default system sound has been defined, PlaySound fails without producing any sound. If you do not want the default system sound to play, specify the SND_NODEFAULT flag, as shown in the following example:
PlaySound("C:\\SOUNDS\\BELLS.WAV", NULL, SND_SYNC | SND_NODEFAULT);
Try changing the flags you should start with the system sound and see if it beeps. And also the wave file may be to big and it will fail.
I would go for xact
The following statement plays the C:\SOUNDS\BELLS.WAV file:
PlaySound("C:\\SOUNDS\\BELLS.WAV", NULL, SND_SYNC);
If the specified file does not exist, or if the file does not fit into the available memory, PlaySound plays the default system sound. If no default system sound has been defined, PlaySound fails without producing any sound. If you do not want the default system sound to play, specify the SND_NODEFAULT flag, as shown in the following example:
PlaySound("C:\\SOUNDS\\BELLS.WAV", NULL, SND_SYNC | SND_NODEFAULT);
Try changing the flags you should start with the system sound and see if it beeps. And also the wave file may be to big and it will fail.
I would go for xact
Most waveform-audio files use the .WAV filename extension.
The following statement plays the C:\SOUNDS\BELLS.WAV file:
PlaySound("C:\\SOUNDS\\BELLS.WAV", NULL, SND_SYNC);
If the specified file does not exist, or if the file does not fit into the available memory, PlaySound plays the default system sound. If no default system sound has been defined, PlaySound fails without producing any sound. If you do not want the default system sound to play, specify the SND_NODEFAULT flag, as shown in the following example:
PlaySound("C:\\SOUNDS\\BELLS.WAV", NULL, SND_SYNC | SND_NODEFAULT);
Try changing the flags you should start with the system sound and see if it beeps. And also the wave file may be to big and it will fail.
I would go for xact
I tried...It still doesn't work. It just eithers plays the default noise or no noise at all. And the .wav file I'm using is 1 second or like 4 bytes....It can't be too large.
I changed the flags around, changed the directories, added search directories, etc. It still doesn't play any .wav file and I tried over 16 of them.
And yes, the simple Beep(100,1000) function works, but PlaySound does not.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement