PDA

View Full Version : DirectPlayVoice



Ilich
30-09-2005, 09:49 AM
Hi! I have some problem with DirectPlayVoice.


FillChar(dvDeviceConfig, sizeof(dvSoundDeviceConfig), 0);
dvDeviceConfig.dwSize := sizeof(DVSOUNDDEVICECONFIG);
dvDeviceConfig.dwFlags := DVSOUNDCONFIG_AUTOSELECT;
dvDeviceConfig.guidPlaybackDevice := DSDEVID_DefaultVoicePlayback;

//dvDeviceConfig.lpdsPlaybackDevice := id ;

dvDeviceConfig.guidCaptureDevice := DSDEVID_DefaultVoiceCapture;
//dvDeviceConfig.lpdsCaptureDevice := idc;
dvDeviceConfig.hwndAppWindow := MainForm.Handle;
//dvDeviceConfig.lpdsMainBuffer := buf;
dvDeviceConfig.dwMainBufferFlags := 0;
dvDeviceConfig.dwMainBufferPriority := 0;


Fillchar(ClientConfig, sizeof(DVClientConfig), 0);
ClientConfig.dwFlags := DVCLIENTCONFIG_AUTOVOICEACTIVATED or DVCLIENTCONFIG_AUTORECORDVOLUME;
ClientConfig.lRecordVolume := DVRECORDVOLUME_LAST;
ClientConfig.lPlaybackVolume := DVPLAYBACKVOLUME_DEFAULT;
ClientConfig.dwThreshold := DVTHRESHOLD_UNUSED;
ClientConfig.dwBufferQuality := DVBUFFERQUALITY_DEFAULT;
ClientConfig.dwBufferAggressiveness := DVBUFFERAGGRESSIVENESS_DEFAULT;
ClientConfig.dwNotifyPeriod := 0;


hr := g_pVoiceClient.Connect(dvDeviceConfig, ClientConfig, DVFLAGS_SYNC );
if failed(hr) then
Begin
showerror(hr, 'clientvoice');
result := e_fail;
Exit;
End;


On g_pVoiceClient.Connect error: one or more of the parametrs passed to the mehtod are invalid. Why? May be problem in commented strings (sorry for my english). At the ms directplay help (for c++) told that it is optional parametrs. I have always created idirectsound and idirectsoundcapture objects and passed it to the mehod but not successfull. I cant find solution of this problem. Please help!

Sly
30-09-2005, 11:13 AM
If you have the DirectX SDK installed, open the DirectX control panel applet and turn on the debug version. Run the application again in the Delphi debugger and open the event log (View/Debug Windows/Event Log). It should list in there the exact reason for the command failure.

By the way, cross-posting is considered rude in many forums.