WaveDeviceLib

Top  Previous  Next

ASTA VoIP includes a WaveDeviceLib.dll that was designed to allow mainage Win32 wave-out and wave-in devices in an easy and understandable way.

 

Please remember: the most often used audio format in VoIP is 16 bit per sample, 1 channel, 8000 samples per second. You should use these values for OpenMicrophone and OpenSpeaker calls.

 

 

GetMicrophoneCount: Cardinal;

Returns the number of installed wave-in devices (usually microphones) in system.

 

GetSpeakerCount: Cardinal;

Returns the number of installed wave-out devices (usually speakers) in system.

 

GetMicrophoneName (Ind: Integer; Buffer: PChar; BufferSize: Cardinal): LongBool;

Fetches the name of wave-in device to Buffer. Returns True on success and False when failed. Device is specified by Ind parameter. Ind is zero-count index of all wave-in installed devices.

 

GetSpeakerName (Ind: Integer; Buffer: PChar; BufferSize: Cardinal): LongBool;

Fetches the name of wave-out device to Buffer. Returns True on success and False when failed. Device is specified by Ind parameter. Ind is zero-count index of all wave-out installed devices.

 

OpenSpeaker (Ind: Integer; Bits, Channels, Samples: Cardinal): LongBool;

Opens the wave-out device with the specified audio parameters - Bits, Channels, Samples.

Returns True on success and False when failed. Device is specified by Ind parameter. Ind is zero-count index of all wave-out installed devices.

 

OpenMicrophone (Ind: Integer; BufferSize, Bits, Channels, Samples: Cardinal): LongBool;

Opens the wave-in device with the specified audio parameters - Bits, Channels, Samples. Returns True on success and False when failed. Device is specified by Ind parameter. Ind is zero-count index of all wave-in installed devices. BufferSize specifies the the size of audio data returned in the following ReadFromMicrophone calls.

 

WriteToSpeaker (Samples: Pointer; Sz: Cardinal): LongBool;

Sends audio data to opened wave-out device.

Returns True on success and False when failed.

 

ReadFromMicrophone (Buffer: PChar; BufferSize: Cardinal; var WasRead: Cardinal): LongBool;

Reads audio data from opened microphone. BufferSize should be equal to value used in OpenMicrophone call.

Returns True on success and False when failed.

 

CloseSpeaker : LongBool;

Closes the opened wave-out device.

Returns True on success and False when failed.

 

CloseMicrophone: LongBool;

Closes the opened wave-in device.

Returns True on success and False when failed.

 

SetSpeakerVolume (Ind: Integer; AVolume: Integer): LongBool;

Sets the sound volume for wave-out device. Volume is specified by AVolume parameter in percents. Returns True on success and False when failed. If wave-out device is not opened then device specified by parameter Ind will be used. If wave-out device is opened - volume will be adjusted for this device and Ind parameter will be ignored.

 

SetMicrophoneVolume (Ind: Integer; AVolume: Integer): LongBool;

Sets the sound volume for wave-in device. Volume is specified by AVolume parameter in percents. Returns True on success and False when failed. If wave-in device is not opened then device specified by parameter Ind will be used. If wave-in device is opened - volume will be adjusted for this device and Ind parameter will be ignored.

 

GetSpeakerVolume (Ind: Integer; var AVolume: Integer): LongBool;

Gets the sound volume for wave-out device. Volume value will be stored to AVolume parameter in percents. Returns True on success and False when failed. If wave-out device is not opened then device specified by parameter Ind will be used. If wave-out device is opened - volume will be adjusted for this device and Ind parameter will be ignored.

 

GetMicrophoneVolume (Ind: Integer; var AVolume: Integer): LongBool;

Gets the sound volume for wave-in device. Volume will be stored to AVolume parameter in percents. Returns True on success and False when failed. If wave-in device is not opened then device specified by parameter Ind will be used. If wave-in device is opened - volume will be adjusted for this device and Ind parameter will be ignored.