Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sound processing: Should I use DirectSound or directly Win32 APIs?

I'm making an application where I will:

  • Record from the microphone and do some realtime processing on the input
  • Play an MP3 file (a regular song), but manipulating the output in realtime
  • Every now and then I'll need to play additional sounds over this song too, but I guess I can do that by simply adding the buffers.

In short, I need to have circular buffers for both recording and playing, and I need to be "feeding" the output buffer every 20 ms or so with the new data that is just about to be played.

I've been looking at DirectSound, and it doesn't seem to help a lot. The reading and writing to the output buffers seem very similar to Win32, the only place where it seems it'd help is in playing the "additional sounds" over the main song.

Should I use DirectSound, or should I go straight to raw Windows APIs?
Is DirectSound going to do anything for me?

Thanks in Advance!

like image 521
Daniel Magliola Avatar asked Dec 08 '22 08:12

Daniel Magliola


1 Answers

The Directsound API's give you better realtime control. They are also the supported way to use sound in Windows. I was under the impression that the win32 api's were depracated, but I could be wrong on this.

This question is close to yours

https://stackoverflow.com/questions/314522/what-is-the-best-c-sound-api-for-windows

also

Is DirectSound the best audio abstraction layer for Windows?

last but not least, this is what microsoft has to say http://msdn.microsoft.com/en-us/library/dd370784(VS.85).aspx

like image 146
Gregor Brandt Avatar answered May 14 '23 21:05

Gregor Brandt