Hey,

So, I'm trying to learn DirectSound, and imagine my delight to learn that DirectSound doesn't have any interface for loading wave files! So MSDN refers me to the DXUT.h file that can be used to load .wav files and even to take care of some DirectSound stuff for you. Neato! Unfortunately, it requires a unicode build instead of multi-byte. Now I'm not exactly sure what that means, but all I know is I don't want to have to cast every string I have with (LPCWSTR).

So, is there some other interface that I can use with DirectSound to load .wav files (or some other sound file format), or some other API I can use all together (would prefer it if I didn't need to switch to a whole other API)? Basically just looking for advice on what's best for playing sounds.

Recommended Answers

All 2 Replies

Probably not what you want to hear, but the multiplatform SDL library ( simple directmedia layer ) has routines for loading in Wav files. I'm not sure how it holds the data internally, since SDL has its own playback routines aswell, but worth a look maybe.

I never work with platform-specific libs directly, so I can't really help you much more there. Have you looked at the samples in the DX SDK directory though? There's a PlaySound demo, although that might be the technique you're already considering.

Ehh... I may switch to another API if I can't figure this out.

I do believe the sample uses the file I was referring to. Does anyone know of any tutorials for DirectSound? I'm curious to see how they will do it. I may trying to switch to more open APIs like OpenGL, because the only real thing I use DirectX for is Direct3D. I do use DirectInput, but I can get key presses with GetAsyncKeyState() and I'm sure there's a way to get mouse input. DirectPlay is deprecated, and I can't really get DirectSound to work.

So anyway, any DirectSound tutorials appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.