soundcard input

finding very few sources dealing with apps with audio input and output happening simultaneously.. conceptually i'd have thought there was some link, it's taken a while..

i've added a wavein routine to an app that successfully generates sound. it's for my niece's birthday party this weekend, and it only needs to handle 16/44.1 stereo, so i'm not bothering with the "check hardware" stuff.

the problem i'm having is passing the input to my main audio (out) routine.. 16 bits = 2 bytes, and i'm presuming the second is the larger, since output is this way.

in MM_WIM_DATA i am setting an integer phasor/counter to 0 which is incremented through the input buffer in the "populate audio out/main synthesis" routine.

i'm getting a signal but the amplitude does not relate to mic input, and, without adding stupid extra routines to write wav samples or anything to analyse it, it does seem like my input block is not aligning.


so, conceptually, how can i understand what i need to do to pass the inut to the output before the birthday party? :)



this is a really cheesy way of chucking the data from the local input reading array to the output function (which is in a header and out of pBuffer's scope). it produces a tone which modulates at block rate but if i switch significant bits, it still doesn't respond or vary when i tap the mic et c...


it would be great to know if i'm on the right track with turning the input into a float.... i seem to recall seeing some function to read the current pointer position of the input buffer but conceptually, it'd be a whole lot nice to have a freaking parseable example of rt input + output..

case MM_WIM_DATA:
waveInAddBuffer(hWaveIn, pWaveHdr3, sizeof (WAVEHDR));
waveInAddBuffer(hWaveIn, pWaveHdr4, sizeof (WAVEHDR));
for (i = 0; i < IN_BUFFER_SIZE; i += 2) {
input[i] = (float)(pBuffer3[i] + pBuffer3[i + 1] << 8) / 16384.f;
}
pr = 0;
return TRUE;
Last edited on
i have managed to place the incoming audio in a buffer! :p

(if it's 16 bits, use shorts for the array.. don't use bytes and try and sort it out like me)

but i still am not aligning my input buffer iwth my output buffer.

i know i saw an API designed to test the position of the input, but i'm still looking for it.

if anyone has any information on this, or advice for aligning the input buffer with the output, detecting the current position et c., i'd really appreciate a few words of advice, ty.
if anyone would like to help, the source/exe is here -
http://xoxos.net/temp/soundin.zip

as can be heard i have sorted it out except for aligning the input buffer with the output buffer correctly.. i'd love some insight on how to accomplish that..

it's a very, very short simple app and (after adding a few gui controls) i'd love to open source it for others, because this process is really a blow to the gonads.
Registered users can post here. Sign in or register to post.