Streaming Data to Sound Card Using C on Windows [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
开发者_运维知识库 Improve this questionAs part of a university project I have to do some signal processing and would like to output the results using the PC sound card. The software has to be written in C and needs to work with Windows (preferably 7 and XP).
I have found code examples for outputting .wav and similar files, but I am interested in continuously outputting data rather than outputting from files. It is likely that the data for output will be presented as an array although some sound APIs seem to have their own ways of dealing with buffers.
Any suggestions would be great, as would code examples or even the best API. I have looked at DirectSound and OpenAL but am still unsure how to get started.
PortAudio is a C library that should suit your needs. There is a tutorial to get you started.
PortAudio is a free, cross-platform, open-source, audio I/O library. It lets you write simple audio programs in 'C' or C++ that will compile and run on many platforms including Windows, Macintosh OS X, and Unix (OSS/ALSA). It is intended to promote the exchange of audio software between developers on different platforms. Many applications use PortAudio for Audio I/O.
PortAudio provides a very simple API for recording and/or playing sound using a simple callback function or a blocking read/write interface. Example programs are included that play sine waves, process audio input (guitar fuzz), record and playback audio, list available audio devices, etc.
https://github.com/rdp/directshow-demo-audio-input-open-source might help, if you want to use directshow.
精彩评论