09-17-2009 12:12 PM
Hi,
my problem is to send 2 signals to the sound card and later captured. Sending a signal to turn the sound card and using a jack male male I can acqusirli. Here are the two functions used
int AudioOut(int samples, short int wave[])
{
HWAVEOUT handle;
WAVEFORMATEX formato;
WAVEHDR BufferSuono;
char ErrorString[200];
formato.wFormatTag = WAVE_FORMAT_PCM;
formato.nChannels = 1;
formato.nSamplesPerSec = sampling;
formato.wBitsPerSample = 16;
formato.nBlockAlign = formato.nChannels * formato.wBitsPerSample / 8;
formato.nAvgBytesPerSec = formato.nSamplesPerSec * formato.nBlockAlign;
formato.cbSize = 0;
errore = waveOutOpen(&handle, WAVE_MAPPER, &formato, 0, 0, CALLBACK_NULL);
if (errore)
waveOutGetErrorText(errore, ErrorString, 500);
BufferSuono.lpData = (LPSTR)wave;
BufferSuono.dwBufferLength = samples * 2;
BufferSuono.dwFlags = 0;
errore = waveOutPrepareHeader(handle, &BufferSuono, sizeof(WAVEHDR));
if (errore)
waveOutGetErrorText(errore, ErrorString, 500);
errore = waveOutWrite(handle, &BufferSuono, sizeof(WAVEHDR));
if (errore)
waveOutGetErrorText(errore, ErrorString, 500);
while (!(BufferSuono.dwFlags & WHDR_DONE));
errore = waveOutReset(handle);
if (errore)
waveOutGetErrorText(errore, ErrorString, 500);
errore = waveOutClose(handle);
if (errore)
waveOutGetErrorText(errore, ErrorString, 500);
return (0);
}
nt AudioInAndReturn(int samples, short int wave[])
{
WAVEFORMATEX formato;
char ErrorString[200];
formato.wFormatTag = WAVE_FORMAT_PCM;
formato.nChannels = 1;
formato.nSamplesPerSec = sampling;
formato.wBitsPerSample = 16;
formato.nBlockAlign = formato.nChannels * formato.wBitsPerSample / 8;
formato.nAvgBytesPerSec = formato.nSamplesPerSec * formato.nBlockAlign;
formato.cbSize = 0;
errore = waveInOpen(&handle, WAVE_MAPPER, &formato, 0, 0, CALLBACK_NULL);
if (errore)
waveInGetErrorText(errore, ErrorString, 500);
BufferSuono.lpData = (LPSTR)wave;
BufferSuono.dwBufferLength = samples * 2;
BufferSuono.dwFlags = 0;
errore = waveInPrepareHeader(handle, &BufferSuono, sizeof(WAVEHDR));
if (errore)
waveInGetErrorText(errore, ErrorString, 500);
errore = waveInAddBuffer(handle, &BufferSuono, sizeof(WAVEHDR));
if (errore)
waveInGetErrorText(errore, ErrorString, 500);
errore = waveInStart(handle);
if (errore)
waveInGetErrorText(errore, ErrorString, 500);
return(0);
}
My problem is to send 2 signals simultaneously,with a stereo transmission,and then acquire them.
Help me. I do not know how to do
09-18-2009 03:44 AM
Hello Sna,
Are you encountering any warning message? Could you post the sound card model so first i could provide to verify compatibility?
Thanks
09-18-2009 04:10 AM