Getting sound in Windows
Hey,
I need a little help. i can''t use DirectX in my program nor can i use OpenAl to create sounds so does anyone know of any other way? I found out about this function,
sndPlaySound(...);
and it actully works the only problem is that when i call it again for another sound it chucks the previous one.
Michael
PlaySoundEx is the function you should use
----------------------------------------------
Petter Nordlander
"There are only 10 kinds of people in the world. They who understand binary and those who do not"
[edited by - PhiberOptic on October 7, 2003 5:23:10 AM]
----------------------------------------------
Petter Nordlander
"There are only 10 kinds of people in the world. They who understand binary and those who do not"
[edited by - PhiberOptic on October 7, 2003 5:23:10 AM]
isn''t PlaySoundEx a fmod function?
if you need to mix multiple samples in pure win32, without dx, you''ll probably have to do it yourself (through the waveout api).
if you need to mix multiple samples in pure win32, without dx, you''ll probably have to do it yourself (through the waveout api).
Using the basic win32 sound functions limits you to a single channel (one sound playing at a time), as they are designed to support the lowest possible system, not to be used for games. On Win2K or XP it would be possible to play more then one sample at a time, but you''d have to trick the OS in order to do it, an ugly solution that could easily break on unreleased versions of Windows (i.e. Longhorn). To play multiple channels you need to mix it yourself, or use an API to do it for you (the advantage of an API is that it could use hardware acceleration if present, and it''s just a lot easier).
A few free possilibities include:
DirectSound
OpenAL
FMod
A few free possilibities include:
DirectSound
OpenAL
FMod
I''m able to play two sounds at once using the Window Multimedia API. I''m not really sure why that works but it does (i''m using Windows Me BTW). I''ve written a class called "TRACK" which designates a separate handle to the wave audio device (HWAVEOUT) to each TRACK object. If you don''t use a separate HWAVEOUT object for each sound, you won''t be able to stop playback on each channel individually. So, mixing isn''t necessary for playing muliple sounds concurrently.
If you want to use the win32 stuff, you''ll need to learn how to parse wave files yourself. If you just want to play PCM wave files
though, this isn''t really that hard to do. You can easily find info on reading PCM wave files online. Unfortunately, you''ll also need to implement special effects yourself.
If you want to use the win32 stuff, you''ll need to learn how to parse wave files yourself. If you just want to play PCM wave files
though, this isn''t really that hard to do. You can easily find info on reading PCM wave files online. Unfortunately, you''ll also need to implement special effects yourself.
How about using MCI to play them... MCI can play any windows media, including mpeg but also wave. I believe it mixes
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement