Skip to main content
gamedev.net
🔒 Locked

Please help... Syntax error

Started by spirit0306 Jan 15, 2007 at 12:39 AM 1 replies 500+ views
Original Post
spirit0306
spirit0306
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; }
LessBread
LessBread
typedef fillWaveFormat {
ZeroMemory(&w,sizeof(WAVEFORMATEX));
wFormatTag = WAVE_FORMAT_PCM;
nChannels = 2;
nSamplesPerSec= 44100;
nAvgBytesPerSec = 44100 * 4;
nBlockAlign = 4;
wBitsPerSample = 16;
cbSize = 0;
} WAVEFORMATEX;

Remove the function call and member instances from the typedef.

WAVEFORMATEX wave;
ZeroMemory(&wave,sizeof(WAVEFORMATEX));
wave.wFormatTag = WAVE_FORMAT_PCM;
wave.nChannels = 2;
wave.nSamplesPerSec= 44100;
wave.nAvgBytesPerSec = 44100 * 4;
wave.nBlockAlign = 4;
wave.wBitsPerSample = 16;
wave.cbSize = 0;






"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.