LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

play and audio captured

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

0 Kudos
Message 1 of 3
(3,205 Views)

Hello Sna,

 

Are you encountering any warning message? Could you post the sound card model so first i could provide to verify compatibility?

Thanks

Matteo
0 Kudos
Message 2 of 3
(3,189 Views)
this is a duplicate post. see here for the answer.
0 Kudos
Message 3 of 3
(3,187 Views)