Click here to Skip to main content
15,906,333 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,welcome to here.
I only want to get the Device handle.what's wrong with my Code?


WAVEFORMATEX waveFormat;
    HWAVEIN hWaveIn;

    waveFormat.wFormatTag = WAVE_FORMAT_PCM;
    waveFormat.nChannels = 1;
    waveFormat.nSamplesPerSec = 11025L;
    waveFormat.nAvgBytesPerSec = 11025L;
    waveFormat.nBlockAlign = 1;
    waveFormat.wBitsPerSample = 1000;
    waveFormat.cbSize = 8;

    err = waveInOpen(&hWaveIn,1,&waveFormat,NULL,0,CALLBACK_NULL );


thanks.
Posted
Updated 14-Feb-11 15:44pm
v2

 
Share this answer
 
Comments
wzq000000 14-Feb-11 22:21pm    
Thanks.
I solve it with your help
unsigned long nResult;
HWAVEOUT waveHandle;
WAVEFORMATEX waveFormat;

/* Initialize the WAVEFORMATEX for 16-bit, 44KHz, stereo */
waveFormat.wFormatTag = WAVE_FORMAT_PCM;
waveFormat.nChannels = 2;
waveFormat.nSamplesPerSec = 44100;
waveFormat.wBitsPerSample = 16;
waveFormat.nBlockAlign = waveFormat.nChannels * (waveFormat.wBitsPerSample/8);
waveFormat.nAvgBytesPerSec = waveFormat.nSamplesPerSec * waveFormat.nBlockAlign;
waveFormat.cbSize = 0;

/* Open the preferred Digital Audio Out device.*/
nResult = waveOutOpen(&waveHandle, WAVE_MAPPER, &waveFormat, (DWORD)myWindow, 0, CALLBACK_WINDOW);
if (nResult)
printf("There was an error opening device!");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900