I'm not writing a game, but the Forum description indicated that sound libraries are in this domain, so here goes.
I have developed a C Console Application (Visual Studio 2008 Express) that, at this point, is ANSI C99 compliant. What it does is allow the programmer to write custom processing blocks and then use my framework engine to assemble the blocks and connect them together to form what I call a "radio" since the main purpose is to explore Software Defined Radio. But it's a lot more general than that - for instance, the first radio I constructed implemented a Caesar Shift Cipher.
The basic idea is that each block takes data from an input port, performs a bit of processing, and then passes data to an output port. The overall engine repeatedly cycles through all the blocks, with each block expected to perform just a tiny amount on each pass.
Source Blocks get their data from someplace other than another block (such as a file) while Sink Blocks send their data someplace other than another block (such as a file).
I would like to develop two blocks that do the following:
Sound Source Block: Gets data from the PC microphone and pushes it out to other blocks.
Sound Sink Block: Pulls data from a block and sends it to the PC speaker.
The data itself would simply be sound samples.
What I envision for the Sound Source block is that, every time it is called, checks to see if there is a new block of data available from the microphone (and I don't care if a block is one sample or a thousand samples, I can work with either) and pushes out one sample to the next block. If the data from the microphone is availble in 100 sample chunks, then most of the time the block will not have anything to read from the microphone but will usually have data from the last block stored internally to push out.
What I envision for the Sound Sink block is very similar. Every time it is called it pulls a sample value from the block preceding it and stores in internally. It then checks if the speaker is ready to accept another block of data. If so, it pushes the next block of data to it.
One thing that is very important is that the stream of data either from the microphone or to the speaker be continuous - assuming that the engine is able to keep up with the demand (if it can't then that's my problem).
So what I need is a means of, from a C program (Console App, not a Windows program) is a way of interfacing with the microphone and speaker that is compatible with these goals. Note that, while I want to keep the framework engine C99 compliant, I don't care if individual blocks are not compliant.
Any recommendations?
Thanks!