Ладно взглянул я.
Для того что ты хочешь, нухно создавать звуковой объект с поддержкой полного дуплекса. На 6 - ке это можно. Вот только примеров нет.
Смотри документацию - по ключевым слова Full Duplex, и по API которые я привел.
DirectX8.DirectSoundCaptureCreate
Creates a DirectSoundCapture8 object.
object.DirectSoundCaptureCreate( _
guid As String _
) As DirectSoundCapture8
Parts
object
Object expression that resolves to a DirectX8 object.
guid
A GUID string that identifies the sound capture device. The value of this parameter must be one of the GUIDs returned by DirectX8.getDSCaptureEnum, vbNullString for the default device, or one of the following values:
DSDEVID_DEFAULTCAPTURE
System-wide default audio capture device.
DSDEVID_DEFAULTVOICECAPTURE
Default voice capture device.
Return Values
Returns a DirectSoundCapture8 object.
Error Codes
If the method fails, an error is raised and Err.Number may be set to one of the following Microsoft® DirectSound® error codes:
DSERR_INVALIDPARAM
DSERR_NOAGGREGATION
DSERR_OUTOFMEMORY
Remarks
This method could fail on some sound cards that do not support full duplex. Calling DirectX8.DirectSoundCreate may set the capture device to an unsupported capture frequency, which will cause DirectX8.DirectSoundCaptureCreate to fail.
The DirectSound8 object is released as soon as it has been created. On systems that do not support full duplex, the creation of DirectSoundCapture8 could fail if the DirectSound8 object exists.
You create the DirectSoundCapture8 object by calling the DirectX8.DirectSoundCaptureCreate method.
The guid parameter to DirectSoundCaptureCreate can be a GUID obtained by enumeration, or it can be one of the following values:
DSDEVID_DefaultCapture
The default system capture device. You can also specify this device by passing vbNullString in the device GUID parameter.
DSDEVID_DefaultVoiceCapture
The default voice communications capture device. Typically, this is a secondary device such as a USB headset with microphone.
If no device driver is present, the call raises an error.
If you want DirectSound8 and DirectSoundCapture8 objects to coexist, then you should create the DirectSound8 object before creating the DirectSoundCapture8 object.
Some audio devices aren't configured for full duplex audio by default. If your application has problems creating both a DirectSound8 object and a DirectSoundCapture8 object, you should advise the user to check the audio device properties to ensure that full duplex is enabled.
DirectPlayVoiceTest8.CheckAudioSetup
Runs the Audio Setup Wizard on the specified devices. This wizard runs a series of tests on the devices to determine if they are capable of full duplex audio and to ensure that the microphone is plugged in and working correctly on the capture device.
CheckAudioSetup( _
guidPlaybackDevice As String, _
guidCaptureDevice As String, _
hwndOwner As Long, _
lFlags As Long) As Long
Parts
guidPlaybackDevice
GUID that identifies the playback device to test. If an empty string is passed for this parameter, Microsoft® DirectPlay® Voice tests the default voice playback device defined by Microsoft® DirectSound®.
guidCaptureDevice
GUID that identifies the capture device to test. If an empty string is passed for this parameter, DirectPlay Voice tests the default voice capture device defined by DirectSound.
hwndOwner
The test wizard invoked by this method is modal. If the calling application has a window that should be the parent window of the wizard, it should pass a handle to that window in this parameter. If the calling application does not have a window, it can pass 0. If the DVFLAGS_QUERYONLY flag is specified, this parameter is not used and the application can pass 0.
lFlags
Flags. The following flags can be set.
DVFLAGS_QUERYONLY
Audio setup is not run. Instead, the method checks the registry to see if the devices have been tested. If the devices have not been tested, the method returns DVERR_RUNSETUP. If the devices have been tested, the method returns DV_FULLDUPLEX if the devices support full duplex audio, or DV_HALFDUPLEX if the devices do not support full duplex audio.
DVFLAGS_ALLOWBACK
Enable the Back button on the Welcome page of the wizard. If the user clicks the Back button on the Welcome page, the wizard exits, and CheckAudioSetup returns DVERR_USERBACK.
Error Codes
Audio Device Testing
Microphone setup is supported by the DirectPlayVoiceTest8.CheckAudioSetup method.
Calling this method invokes the DirectX audio setup wizard, which runs tests and confirms that the system properly supports full duplex operation and ensures microphone and playback settings are correct. You need to run the wizard only once for each combination of playback and capture device you select. Each time your application starts, you should test the configuration by calling DirectPlayVoiceTest8.CheckAudioSetup with the lFlags parameter set to DVFLAGS_QUERYONLY. This enables you to quickly test whether the device configuration has changed since your devices were last tested. If your devices have not been tested, you should run DirectPlayVoiceTest8.CheckAudioSetup again to invoke the wizard. If the configuration has changed since the last test and you have not run the wizard again, DirectPlayVoiceClient8.Connect will return DVERR_RUNSETUP, and you will not be able to initialize DirectPlay Voice.
If the user's sound card does not have full duplex capability, it can only listen to voice communications. It cannot send voice communications because the game typically holds the audio card in playback mode. To prevent problems, DirectX 8.0 does not enable switching dynamically between playback and capturing. The DirectX audio setup wizard provides feedback to the user on the duplexing capabilities of the system.
Note that there are still many computer systems in active use that do not include a full duplex sound card. Full duplex sound cards came into popular use in 1998, although at the time few of the audio card drivers had full duplex operation enabled. Customers who purchased new systems in 1999 or upgraded drivers in 1999 are more likely to have full duplex capability.
То есть устройство должно быть сконфигурировано для дуплексной работы (и поддерживать дуплекс).
Ответить
|