Original Post
I am trying to compile this code but I am having an error that says "error C2601: 'fillWaveFormat' : local function definitions are illegal" and "error C2063: 'fillWaveFormat' : not a function". How and where can I define fillWaveFormat correctly? Here is my code... #include #include "resource.h" #include "DSUtil.h" #include "DXUtil.h" #include "mmreg.h" HRESULT INITDIRECTSOUND( HWND hDlg, GUID* pDeviceGuid ); HRESULT CreateCaptureBuffer( WAVEFORMATEX* pwfxInput ); LPDIRECTSOUNDCAPTURE dsCapture = NULL; LPDIRECTSOUNDCAPTUREBUFFER g_pDSBCapture = NULL; DWORD g_dwCaptureBufferSize; HRESULT INITDIRECTSOUND( HWND hDlg, GUID* pDeviceGuid ) { HRESULT hr; dsCapture=NULL; hr = DirectSoundCaptureCreate(NULL,&dsCapture,NULL); return IDOK; } HRESULT CreateCaptureBuffer( WAVEFORMATEX* pwfxInput ) { typedef fillWaveFormat { ZeroMemory(&w,sizeof(WAVEFORMATEX)); wFormatTag = WAVE_FORMAT_PCM; nChannels = 2; nSamplesPerSec= 44100; nAvgBytesPerSec = 44100 * 4; nBlockAlign = 4; wBitsPerSample = 16; cbSize = 0; } WAVEFORMATEX; HRESULT hr; DSCBUFFERDESC dscbd; WAVEFORMATEX w; // Create the capture buffer ZeroMemory( &dscbd, sizeof(dscbd) ); dscbd.dwSize = sizeof(dscbd); dscbd.dwBufferBytes = g_dwCaptureBufferSize; dscbd.lpwfxFormat = pwfxInput; // Set the format during creatation if( FAILED( hr = dsCapture->CreateCaptureBuffer( &dscbd, &g_pDSBCapture, NULL ) ) ) return IDOK; }