Click here to Skip to main content
15,899,126 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have MFC application which takes the input(text) from another application convert the it to speech(using WaveoutOpen),My mfc application will get continuoes inputs from the second application not the problem is my MFC application closes abromally and doesnot voice out. it happens randomly out of 10 inputs it will closes some 2 times approx.couldn't figure out the problem.Some times application doesnt even call waveoutopen and closes.any kind of suggestion is appreciated.

What I have tried:

C++
InitializeSpeak(hTtsInst, pInText, hEditBox, &stSpeak);
	
    /*-- Open audio channel. --*/
    pcmWaveFormat.wf.wFormatTag      = WAVE_FORMAT_PCM;
    pcmWaveFormat.wf.nChannels       = 1;
    pcmWaveFormat.wf.nBlockAlign     = 2;
    pcmWaveFormat.wf.nSamplesPerSec  = freq;
    pcmWaveFormat.wf.nAvgBytesPerSec = pcmWaveFormat.wf.nSamplesPerSec * pcmWaveFormat.wf.nBlockAlign;
    pcmWaveFormat.wBitsPerSample     = pcmWaveFormat.wf.nBlockAlign * 8;
	
#ifdef USE_SEMAPHORES
	
	
    char a[20];
    nMmRes = waveOutOpen (&(stSpeak.hWaveOut), WAVE_MAPPER,  (LPWAVEFORMATEX)                  &pcmWaveFormat,(DWORD) SpeakCallBack, (DWORD)(stSpeak.hPcmSema4), CALLBACK_FUNCTION|WAVE_ALLOWSYNC);
itoa(nMmRes,a,20);
LOG(a);///TO log the return value of waveOutOpen
		
#else	
    nMmRes = waveOutOpen (&(stSpeak.hWaveOut), WAVE_MAPPER,  (LPWAVEFORMATEX) &pcmWaveFormat,0, 0, CALLBACK_NULL);
	
#endif
	
    if (MMSYSERR_NOERROR != nMmRes) 
{       waveOutGetErrorText (nMmRes, szErr, sizeof (szErr) / sizeof (TCHAR));
		// Notify(hwnd, szErr);
        return NUAN_E_NOK;
    }
Posted
Updated 5-May-16 2:20am
v2
Comments
Richard MacCutchan 5-May-16 8:36am    
The problem could be anything, and it is likely that only the debugger will help to find it.

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