TeamTalk 5 Java DLL Version 5.15A
|
This section explains how to record and playback audio in the client instance. More...
Classes | |
struct | BearWare.SoundDevice |
A struct containing the properties of a sound device for either playback or recording. More... | |
struct | BearWare.SoundDeviceEffects |
Set up audio effects supported by the sound device. More... | |
struct | BearWare.SoundDeviceConstants |
IDs for sound devices. More... | |
struct | BearWare.SoundLevel |
An enum encapsulation the minimum, maximum and default sound levels for input and output sound devices. More... | |
struct | BearWare.AudioBlock |
An audio block containing the raw audio from a user who was talking. More... | |
Functions | |
static bool | BearWare.TeamTalkBase.GetDefaultSoundDevices (ref int lpnInputDeviceID, ref int lpnOutputDeviceID) |
Get the default sound devices. | |
static bool | BearWare.TeamTalkBase.GetDefaultSoundDevicesEx (SoundSystem nSndSystem, ref int lpnInputDeviceID, ref int lpnOutputDeviceID) |
Get the default sound devices for the specified sound system. | |
static bool | BearWare.TeamTalkBase.GetSoundDevices (out SoundDevice[] lpSoundDevices) |
Retrieve list of sound devices for recording and playback. | |
static bool | BearWare.TeamTalkBase.RestartSoundSystem () |
Reinitialize sound system (in order to detect new/removed devices). | |
static IntPtr | BearWare.TeamTalkBase.StartSoundLoopbackTest (int nInputDeviceID, int nOutputDeviceID, int nSampleRate, int nChannels, bool bDuplexMode, SpeexDSP lpSpeexDSP) |
Perform a record and playback test of specified sound devices along with an audio configuration and ability to try echo cancellation. | |
static IntPtr | BearWare.TeamTalkBase.StartSoundLoopbackTest (int nInputDeviceID, int nOutputDeviceID, int nSampleRate, int nChannels, bool bDuplexMode, AudioPreprocessor lpAudioPreprocessor, BearWare.SoundDeviceEffects lpSoundDeviceEffects) |
Perform a record and playback test of specified sound devices along with an audio configuration and ability to try echo cancellation. | |
static bool | BearWare.TeamTalkBase.CloseSoundLoopbackTest (IntPtr lpTTSoundLoop) |
Stop recorder and playback test. | |
bool | BearWare.TeamTalkBase.InitSoundInputDevice (int nInputDeviceID) |
Initialize the sound input device (for recording audio). | |
bool | BearWare.TeamTalkBase.InitSoundInputSharedDevice (int nSampleRate, int nChannels, int nFrameSize) |
Setup sample rate, channels and frame size of shared sound input device. | |
bool | BearWare.TeamTalkBase.InitSoundOutputDevice (int nOutputDeviceID) |
Initialize the sound output device (for audio playback). | |
bool | BearWare.TeamTalkBase.InitSoundOutputSharedDevice (int nSampleRate, int nChannels, int nFrameSize) |
Setup sample rate, channels and frame size of shared sound output device. | |
bool | BearWare.TeamTalkBase.InitSoundDuplexDevices (int nInputDeviceID, int nOutputDeviceID) |
Enable duplex mode where multiple audio streams are mixed into a single stream using software. | |
bool | BearWare.TeamTalkBase.CloseSoundInputDevice () |
Shutdown the input sound device. | |
bool | BearWare.TeamTalkBase.CloseSoundOutputDevice () |
Shutdown the output sound device. | |
bool | BearWare.TeamTalkBase.CloseSoundDuplexDevices () |
Shut down sound devices running in duplex mode. | |
bool | BearWare.TeamTalkBase.SetSoundDeviceEffects (SoundDeviceEffects lpSoundDeviceEffect) |
Set up audio effects on a sound device. | |
bool | BearWare.TeamTalkBase.GetSoundDeviceEffects (ref SoundDeviceEffects lpSoundDeviceEffect) |
Get the audio effects that are currently enabled. | |
int | BearWare.TeamTalkBase.GetSoundInputLevel () |
Get the volume level of the current recorded audio. | |
bool | BearWare.TeamTalkBase.SetSoundInputGainLevel (int nLevel) |
Set voice gaining of recorded audio. | |
int | BearWare.TeamTalkBase.GetSoundInputGainLevel () |
Get voice gain level of outgoing audio. | |
bool | BearWare.TeamTalkBase.SetSoundInputPreprocess (SpeexDSP lpSpeexDSP) |
Enable sound preprocessor which should be used for processing audio recorded by the sound input device (voice input). | |
bool | BearWare.TeamTalkBase.GetSoundInputPreprocess (ref SpeexDSP lpSpeexDSP) |
Get the sound preprocessor settings which are currently in use for recorded sound input device (voice input). | |
bool | BearWare.TeamTalkBase.SetSoundInputPreprocess (AudioPreprocessor lpAudioPreprocessor) |
Enable sound preprocessor which should be used for processing audio recorded by the sound input device (voice input). | |
bool | BearWare.TeamTalkBase.GetSoundInputPreprocess (ref AudioPreprocessor lpAudioPreprocessor) |
Get the sound preprocessor settings which are currently in use for recorded sound input device (voice input). | |
bool | BearWare.TeamTalkBase.SetSoundOutputVolume (int nVolume) |
Set master volume. | |
int | BearWare.TeamTalkBase.GetSoundOutputVolume () |
Get master volume. | |
bool | BearWare.TeamTalkBase.SetSoundOutputMute (bool bMuteAll) |
Set all users mute. | |
bool | BearWare.TeamTalkBase.Enable3DSoundPositioning (bool bEnable) |
Enable automatically position users using 3D-sound. | |
bool | BearWare.TeamTalkBase.AutoPositionUsers () |
Automatically position users using 3D-sound. | |
bool | BearWare.TeamTalkBase.EnableAudioBlockEvent (int nUserID, StreamType uStreamTypes, bool bEnable) |
Enable/disable access to raw audio from individual users, local microphone input or muxed stream of all users. | |
bool | BearWare.TeamTalkBase.EnableAudioBlockEvent (int nUserID, StreamType uStreamTypes, AudioFormat lpAudioFormat, bool bEnable) |
Same as TeamTalkBase.EnableAudioBlockEvent() but option to specify audio output format. | |
bool | BearWare.TeamTalkBase.SetUserVolume (int nUserID, StreamType nStreamType, int nVolume) |
Set the volume of a user. | |
bool | BearWare.TeamTalkBase.SetUserMute (int nUserID, StreamType nStreamType, bool bMute) |
Mute a user. | |
bool | BearWare.TeamTalkBase.SetUserStoppedPlaybackDelay (int nUserID, StreamType nStreamType, int nDelayMSec) |
Set the delay of when a user should no longer be considered as playing audio (either voice or audio from media file). | |
bool | BearWare.TeamTalkBase.SetUserJitterControl (int nUserID, StreamType nStreamType, JitterConfig lpJitterConfig) |
Set the configuration for de-jitter measures for a user. | |
bool | BearWare.TeamTalkBase.GetUserJitterControl (int nUserID, StreamType nStreamType, ref JitterConfig lpJitterConfig) |
Get the de-jitter configuration for a user. | |
bool | BearWare.TeamTalkBase.SetUserPosition (int nUserID, StreamType nStreamType, float x, float y, float z) |
Set the position of a user. | |
bool | BearWare.TeamTalkBase.SetUserStereo (int nUserID, StreamType nStreamType, bool bLeftSpeaker, bool bRightSpeaker) |
Set whether a user should speak in the left, right or both speakers. This function only works if BearWare.AudioCodec has been set to use stereo. | |
bool | BearWare.TeamTalkBase.SetUserMediaStorageDir (int nUserID, string szFolderPath, string szFileNameVars, AudioFileFormat uAFF) |
Store user's audio to disk. | |
bool | BearWare.TeamTalkBase.SetUserMediaStorageDir (int nUserID, string szFolderPath, string szFileNameVars, AudioFileFormat uAFF, int nStopRecordingExtraDelayMSec) |
Store user's audio to disk. | |
bool | BearWare.TeamTalkBase.SetUserAudioStreamBufferSize (int nUserID, StreamType uStreamType, int nMSec) |
Change the amount of media data which can be buffered in the user's playback queue. | |
AudioBlock | BearWare.TeamTalkBase.AcquireUserAudioBlock (StreamType uStreamTypes, int nUserID) |
Extract the raw audio associated with the event TeamTalkBase.OnUserAudioBlock(). | |
bool | BearWare.TeamTalkBase.ReleaseUserAudioBlock (AudioBlock lpAudioBlock) |
Release the shared memory of an BearWare.AudioBlock. | |
Variables | |
const int | BearWare.TeamTalkBase.TT_SAMPLERATES_MAX = 16 |
This section explains how to record and playback audio in the client instance.
Before being able to initialize the sound devices to use for recording and playback the computer's available sound devices must first be queried. This is done using the functions TeamTalkBase.GetSoundInputDevices() and TeamTalkBase.GetSoundOutputDevices(). These two functions return arrays of BearWare.SoundDevice-structs which contains a description of the sound device. In the BearWare.SoundDevice-struct there's a member variable called nDeviceID. This ID should be passed to the client instance's two sound initialization functions TeamTalkBase.InitSoundInputDevice() and TeamTalkBase.InitSoundOutputDevice(). Once this has been done the TeamTalkBase.GetFlags() call will return a value containing the mask bits ClientFlag ClientFlag.CLIENT_SNDINPUT_READY and ClientFlag ClientFlag.CLIENT_SNDOUTPUT_READY.
A computer's default sound devices can be queried using TeamTalkBase.GetDefaultSoundDevices(). A loop-back test of the selected sound devices can be performed using TeamTalkBase.StartSoundLoopbackTest().
Be aware that the sound devices might fail if e.g. a USB sound device is unplugged while the client is talking in a channel. In this case ensure the application is processing the errors ClientError.INTERR_SNDINPUT_FAILURE and ClientError.INTERR_SNDOUTPUT_FAILURE in the TeamTalkBase.OnInternalError() event.
Read section Audio and Video Transmission to see how to transmit recorded audio to other users.
enum BearWare.SoundSystem : uint |
The supported sound systems.
Enumerator | |
---|---|
SOUNDSYSTEM_NONE | Sound system denoting invalid or not found. |
SOUNDSYSTEM_WINMM | Windows legacy audio system. Should be used on Windows Mobile. |
SOUNDSYSTEM_DSOUND | DirectSound audio system. Should be used on Windows. |
SOUNDSYSTEM_ALSA | Advanced Linux Sound Architecture (ALSA). Should be used on Linux. Often ALSA sound devices only support a limited number of sample rates so TeamTalk internally use software filters to resample the audio to the sample rate used by the selected audio codecs. |
SOUNDSYSTEM_COREAUDIO | Core Audio. Should be used on MacOS. |
SOUNDSYSTEM_WASAPI | Windows Audio Session API (WASAPI). Should be used on Windows Vista/7/8/10. WASAPI audio devices typically only support a single sample rate so internally TeamTalk uses software filters to resample audio to the sample rate used by the selected audio codecs. Check |
SOUNDSYSTEM_OPENSLES_ANDROID | Android sound API. |
SOUNDSYSTEM_AUDIOUNIT | iOS sound API. The following sound devices will appear when calling TeamTalkBase.GetSoundDevices(). Sound device ID 0 will be AudioUnit subtype Remote I/O Unit and sound device ID 1 will be AudioUnit subtype Voice-Processing I/O Unit. Note that iOS only supports one active Voice-Processing I/O Unit, i.e. only one #BearWare.TeamTalkBase instance can use the Voice-Processing I/O Unit. Add libraries @c AVFoundation.framework and @c AudioToolbox.framework. Duplex mode is not supported by AudioUnit iOS sound API. |
SOUNDSYSTEM_AUDIOUNIT_IOS | |
SOUNDSYSTEM_PULSEAUDIO | PulseAudio API. PulseAudio is typically used on Ubuntu 22. |
Definition at line 106 of file TeamTalk.cs.
enum BearWare.SoundDeviceFeature : uint |
Features available on a sound device. Checkout uSoundDeviceFeatures
on BearWare.SoundDevice.
Enumerator | |
---|---|
SOUNDDEVICEFEATURE_NONE | |
SOUNDDEVICEFEATURE_AEC | The BearWare.SoundDevice can enable Acoustic Echo Canceler (AEC). Enable AEC use property |
SOUNDDEVICEFEATURE_AGC | The BearWare.SoundDevice can enable Automatic Gain Control (AGC). Enable AGC use property |
SOUNDDEVICEFEATURE_DENOISE | The BearWare.SoundDevice can enable denoising. Enable denoising use property |
SOUNDDEVICEFEATURE_3DPOSITION | The BearWare.SoundDevice can position user in 3D.
|
SOUNDDEVICEFEATURE_DUPLEXMODE | The BearWare.SoundDevice can run in duplex mode. |
SOUNDDEVICEFEATURE_DEFAULTCOMDEVICE | The BearWare.SoundDevice is the default communication device. This feature is only supported on BearWare.SoundSystem.SOUNDSYSTEM_WASAPI. |
Definition at line 165 of file TeamTalk.cs.
|
static |
Get the default sound devices.
lpnInputDeviceID | The ID of the default input device. |
lpnOutputDeviceID | The ID of the default output device. |
Definition at line 4729 of file TeamTalk.cs.
|
static |
Get the default sound devices for the specified sound system.
Definition at line 4738 of file TeamTalk.cs.
|
static |
Retrieve list of sound devices for recording and playback.
lpSoundDevices | An output array of BearWare.SoundDevice-structs which will receive the available sound devices. |
Definition at line 4752 of file TeamTalk.cs.
|
static |
Reinitialize sound system (in order to detect new/removed devices).
When the TeamTalk client is first initialized all the sound devices are detected and stored in a list inside the client instance. If a user adds or removes e.g. a USB sound device then it's not picked up automatically by the client instance. TeamTalkBase.RestartSoundSystem() can be used to reinitialize the sound system and thereby detect if sound devices have been removed or added.
In order to restart the sound system all sound devices in all client instances must be closed using TeamTalkBase.CloseSoundInputDevice(), TeamTalkBase.CloseSoundoutputDevice() and TeamTalkBase.CloseSoundDuplexDevices().
Definition at line 4776 of file TeamTalk.cs.
|
static |
Perform a record and playback test of specified sound devices along with an audio configuration and ability to try echo cancellation.
Definition at line 4784 of file TeamTalk.cs.
|
static |
Perform a record and playback test of specified sound devices along with an audio configuration and ability to try echo cancellation.
This function allows the use of BearWare.SpeexDSP to enable AGC and echo cancellation.
nInputDeviceID | Should be the nDeviceID extracted through TeamTalkBase.GetSoundDevices(). |
nOutputDeviceID | Should be the nDeviceID extracted through TeamTalkBase.GetSoundDevices(). |
nSampleRate | The sample rate the client's recorder should use. |
nChannels | Number of channels to use, i.e. 1 = mono, 2 = stereo. |
bDuplexMode | Both input and output devices MUST support the specified sample rate since this loop back test uses duplex mode ( |
supportedSampleRates
of BearWare.SoundDevice to see which sample rates are supported. The BearWare.SoundDevice must have the feature BearWare.SoundDeviceFeature.SOUNDDEVICEFEATURE_DUPLEXMODE. lpAudioPreprocessor | The preprocessing settings to use, i.e. AGC and denoising properties. Pass NULL to ignore AGC, denoise and AEC. |
lpSoundDeviceEffects | The sound device effects which should be applied before the loopback test is started. |
Definition at line 4823 of file TeamTalk.cs.
|
static |
Stop recorder and playback test.
Definition at line 4838 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.InitSoundInputDevice | ( | int | nInputDeviceID | ) |
Initialize the sound input device (for recording audio).
The nDeviceID of the BearWare.SoundDevice should be used as nInputDeviceID.
The nInputDeviceID
can be or'ed with BearWare.SoundDeviceConstants.TT_SOUNDDEVICE_ID_SHARED_FLAG if the TeamTalk instance should share recording device with other instances.
Notice fixed sound device ID for some platforms:
Calling this function will set the flag BearWare.ClientFlag.CLIENT_SNDINPUT_READY.
nInputDeviceID | The nDeviceID of BearWare.SoundDevice extracted through GetSoundDevices(). |
Definition at line 4870 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.InitSoundInputSharedDevice | ( | int | nSampleRate, |
int | nChannels, | ||
int | nFrameSize | ||
) |
Setup sample rate, channels and frame size of shared sound input device.
By default a shared sound device (checkout BearWare.SoundDeviceConstants.TT_SOUNDDEVICE_ID_SHARED_FLAG) initialized by TeamTalkBase.InitSoundInputDevice will use the sound device's nDefaultSampleRate
, nMaxInputChannels
of BearWare.SoundDevice and a frame size (callback buffer) of nDefaultSampleRate * 0.04.
TeamTalkBase.InitSoundInputSharedDevice() can be used to override these default settings.
Note that TeamTalkBase.InitSoundInputSharedDevice() must be called prior to TeamTalkBase.InitSoundInputDevice(). Also ensure no shared sound input device is currently active.
nSampleRate | The sample rate to use on the shared device. Must exist in BearWare.SoundDevice's inputSampleRates . Pass zero to reset to default behaviour. |
nChannels | The number of channels to use (mono, stereo). Must be less or equals to BearWare.SoundDevice's nMaxInputChannels . Pass zero to reset to default behaviour. |
nFrameSize | The number of samples in each callback from the shared sound device. A 40 msec callback on a 48 KHz input is calculated like this: nFrameSize = 48000 * 0.04. Pass zero to reset to default behaviour. |
Definition at line 4905 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.InitSoundOutputDevice | ( | int | nOutputDeviceID | ) |
Initialize the sound output device (for audio playback).
The nDeviceID of the BearWare.SoundDevice should be used as nOutputDeviceID.
The nOutputDeviceID
can be or'ed with BearWare.SoundDeviceConstants.TT_SOUNDDEVICE_ID_SHARED_FLAG if the TeamTalk instance should share output device with other instances.
Notice fixed sound device ID for some platforms:
Calling this function will set the flag BearWare.ClientFlag.CLIENT_SNDOUTPUT_READY.
nOutputDeviceID | Should be the nDeviceID of BearWare.SoundDevice extracted through GetSoundDevices(). |
Definition at line 4938 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.InitSoundOutputSharedDevice | ( | int | nSampleRate, |
int | nChannels, | ||
int | nFrameSize | ||
) |
Setup sample rate, channels and frame size of shared sound output device.
By default a shared sound device (checkout BearWare.SoundDeviceConstants.TT_SOUNDDEVICE_ID_SHARED_FLAG) initialized by TeamTalkBase.InitSoundOutputDevice will use the sound device's nDefaultSampleRate
, nMaxOutputChannels
of BearWare.SoundDevice and a frame size (callback buffer) of nDefaultSampleRate * 0.04.
TeamTalkBase.InitSoundOutputSharedDevice() can be used to override these default settings.
Note that TeamTalkBase.InitSoundOutputSharedDevice() must be called prior to TeamTalkBase.InitSoundOutputDevice(). Also ensure no shared sound output device is currently active.
nSampleRate | The sample rate to use on the shared device. Must exist in BearWare.SoundDevice's outputSampleRates . Pass zero to reset to default behaviour. |
nChannels | The number of channels to use (mono, stereo). Must be less or equals to BearWare.SoundDevice's nMaxOutputChannels . Pass zero to reset to default behaviour. |
nFrameSize | The number of samples in each callback from the shared sound device. A 40 msec callback on a 48KHz output is calculated like this: nFrameSize = 48000 * 0.04. Pass zero to reset to default behaviour. |
Definition at line 4972 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.InitSoundDuplexDevices | ( | int | nInputDeviceID, |
int | nOutputDeviceID | ||
) |
Enable duplex mode where multiple audio streams are mixed into a single stream using software.
To use duplex mode the feature BearWare.SoundDeviceFeature.SOUNDDEVICEFEATURE_DUPLEXMODE must be available on the BearWare.SoundDevice.
If TeamTalkBase.InitSoundDuplexDevices() is successful the following flags will be set:
Call TeamTalkBase.CloseSoundDuplexDevices() to shut down duplex mode.
Note that it is only the audio streams from users in the local client instance's current channel which will be mixed. If the local client instance calls TeamTalkBase.DoSubscribe() with BearWare.Subscription BearWare.Subscription.SUBSCRIBE_INTERCEPT_VOICE on a user in another channel then the audio from this user will be started in a separate stream. The reason for this is that the other user may use an audio codec with a different sample rate or number of audio channels.
nInputDeviceID | The nDeviceID of BearWare.SoundDevice extracted through GetSoundDevices(). |
nOutputDeviceID | The nDeviceID of BearWare.SoundDevice extracted through GetSoundDevices(). |
Definition at line 5009 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.CloseSoundInputDevice | ( | ) |
Shutdown the input sound device.
Callling this function will clear the flag BearWare.ClientFlag.CLIENT_SNDINPUT_READY.
If the local client instance is running in duplex mode (flag BearWare.ClientFlag.CLIENT_SNDINOUTPUT_DUPLEX is set) then trying to close the sound device will fail since duplex mode require that both input and output sound devices are active at the same time. Therefore in order to close sound devices running in duplex mode call TeamTalkBase.CloseSoundDuplexDevices().
Definition at line 5032 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.CloseSoundOutputDevice | ( | ) |
Shutdown the output sound device.
Callling this function will clear set the flag BearWare.ClientFlag.CLIENT_SNDOUTPUT_READY.
If the local client instance is running in duplex mode (flag BearWare.ClientFlag.CLIENT_SNDINOUTPUT_DUPLEX is set) then trying to close the sound device will fail since duplex mode require that both input and output sound devices are active at the same time. Therefore in order to close sound devices running in duplex mode call TeamTalkBase.CloseSoundDuplexDevices().
Definition at line 5054 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.CloseSoundDuplexDevices | ( | ) |
Shut down sound devices running in duplex mode.
Calling this function only applies if sound devices has been initialized with TeamTalkBase.InitSoundDuplexDevices().
Definition at line 5064 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetSoundDeviceEffects | ( | SoundDeviceEffects | lpSoundDeviceEffect | ) |
Set up audio effects on a sound device.
Some devices, like Android, enable the user to toggle certain audio effects on their device to improve audio quality. The BearWare.SoundDeviceEffects-struct can be used to toggle these audio effects on the device.
The following sound systems support TeamTalkBase.SetSoundDeviceEffects():
This setting should not be confused with TeamTalkBase.SetSoundInputPreprocessEx() which runs entirely in software and is specific to the BearWare.TeamTalkBase instance.
Investigate BearWare.SoundDeviceFeature to see what audio effects are supported by the available BearWare.SoundDevice.
Note that the sound effects may not be immediately applied since an sound device is not active until the BearWare.TeamTalkBase instance joins a channel where the sound device knowns the sample rate and number of channels (mono/stereo). BearWare.ClientError.INTERR_SNDEFFECT_FAILURE will be posted if the BearWare.SoundDeviceEffects was unable to initialize.
Definition at line 5103 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.GetSoundDeviceEffects | ( | ref SoundDeviceEffects | lpSoundDeviceEffect | ) |
Get the audio effects that are currently enabled.
Definition at line 5111 of file TeamTalk.cs.
int BearWare.TeamTalkBase.GetSoundInputLevel | ( | ) |
Get the volume level of the current recorded audio.
The current level is updated at an interval specified in a channel's BearWare.AudioCodec.
Note that the volume level will not be available until the client instance joins a channel, i.e. it knows what sample rate to use.
If BearWare.WebRTCAudioPreprocessor is active with levelestimation
enabled then the current input level is based on WebRTC's level estimater.
Definition at line 5131 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetSoundInputGainLevel | ( | int | nLevel | ) |
Set voice gaining of recorded audio.
The gain level ranges from BearWare.SoundLevel.SOUND_GAIN_MIN to BearWare.SoundLevel.SOUND_GAIN_MAX where BearWare.SoundLevel.SOUND_GAIN_DEFAULT is no gain. So 100 is 1/10 of the original volume and 8000 is 8 times the original volume.
Note that using TeamTalkBase.SetSoundInputPreprocess() will override settings on input gain level. This is because automatic gain control will adjust the volume level.
nLevel | A value from BearWare.SoundLevel.SOUND_GAIN_MIN to BearWare.SoundLevel.SOUND_GAIN_MAX. |
Definition at line 5150 of file TeamTalk.cs.
int BearWare.TeamTalkBase.GetSoundInputGainLevel | ( | ) |
Get voice gain level of outgoing audio.
Definition at line 5160 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetSoundInputPreprocess | ( | SpeexDSP | lpSpeexDSP | ) |
Enable sound preprocessor which should be used for processing audio recorded by the sound input device (voice input).
To ensure common settings for all users in a channel it's possible to use the audiocfg
member of BearWare.Channel as shared source for audio settings.
In order for echo cancellation to work best it's important to also enable AGC in the BearWare.SpeexDSP.
lpSpeexDSP | The sound preprocessor settings to use. Preferably from the BearWare.Channel's audiocfg member to ensure common settings for all users. |
Definition at line 5180 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.GetSoundInputPreprocess | ( | ref SpeexDSP | lpSpeexDSP | ) |
Get the sound preprocessor settings which are currently in use for recorded sound input device (voice input).
lpSpeexDSP | A preallocated SpeexDSP which will receive the settings that is currently in effect. |
Definition at line 5193 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetSoundInputPreprocess | ( | AudioPreprocessor | lpAudioPreprocessor | ) |
Enable sound preprocessor which should be used for processing audio recorded by the sound input device (voice input).
It is recommended to use the sound device's native echo cancellor, denoising and automatic gain control instead of BearWare.SpeexDSP. Checkout TeamTalkBase.SetSoundDeviceEffects().
lpAudioPreprocessor | The sound preprocessor settings to use. |
Definition at line 5208 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.GetSoundInputPreprocess | ( | ref AudioPreprocessor | lpAudioPreprocessor | ) |
Get the sound preprocessor settings which are currently in use for recorded sound input device (voice input).
lpAudioPreprocessor | A preallocated BearWare.AudioPreprocessor which will receive the settings that is currently in effect. |
Definition at line 5220 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetSoundOutputVolume | ( | int | nVolume | ) |
Set master volume.
If still not loud enough use SetUserVolume().
nVolume | A value from BearWare.SoundLevel.SOUND_VOLUME_MIN to BearWare.SoundLevel.SOUND_VOLUME_MAX. |
Definition at line 5231 of file TeamTalk.cs.
int BearWare.TeamTalkBase.GetSoundOutputVolume | ( | ) |
bool BearWare.TeamTalkBase.SetSoundOutputMute | ( | bool | bMuteAll | ) |
Set all users mute.
To stop receiving audio from a user call DoUnsubscribe().
bMuteAll | Whether to mute or unmute all users. |
Definition at line 5252 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.Enable3DSoundPositioning | ( | bool | bEnable | ) |
Enable automatically position users using 3D-sound.
3D sound position requires BearWare.SoundDeviceFeature.SOUNDDEVICEFEATURE_3DPOSITION.
Note that 3d-sound does not work if sound is running in duplex mode (BearWare.ClientFlag.CLIENT_SNDINOUTPUT_DUPLEX) or in stereo.
bEnable | TRUE to enable, otherwise FALSE. |
Definition at line 5266 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.AutoPositionUsers | ( | ) |
Automatically position users using 3D-sound.
3D sound position requires BearWare.SoundDeviceFeature.SOUNDDEVICEFEATURE_3DPOSITION.
Note that 3d-sound does not work if sound is running in duplex mode (BearWare.ClientFlag.CLIENT_SNDINOUTPUT_DUPLEX) or in stereo.
Definition at line 5279 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.EnableAudioBlockEvent | ( | int | nUserID, |
StreamType | uStreamTypes, | ||
bool | bEnable | ||
) |
Enable/disable access to raw audio from individual users, local microphone input or muxed stream of all users.
With audio callbacks enabled all audio which has been played will be accessible by calling TeamTalkBase.AcquireUserAudioBlock(). Every time a new BearWare.AudioBlock is available the event OnUserAudioBlock() is generated.
Special user IDs can be used to retrieve certain types of audio from the client instance:
nUserID | User ID has different meanings depending on the BearWare.StreamType being passed. |
For BearWare.StreamType.STREAMTYPE_VOICE:
When using BearWare.TeamTalkBase.TT_MUXED_USERID as user ID the instance must be in a channel with a configured BearWare.AudioCodec. Alternatively use lpAudioFormat
to specify the audio properties.
uStreamTypes | Either BearWare.StreamType.STREAMTYPE_VOICE, BearWare.StreamType.STREAMTYPE_MEDIAFILE_AUDIO or BearWare.StreamType.STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO. For BearWare.TeamTalkBase.TT_MUXED_USERID it's possible to mix BearWare.StreamType so e.g. BearWare.StreamType.STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO or'ed with BearWare.StreamType.STREAMTYPE_VOICE) will return an BearWare.AudioBlock where these two stream types have been mixed together. |
bEnable | Whether to enable the OnUserAudioBlock() event. |
Definition at line 5347 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.EnableAudioBlockEvent | ( | int | nUserID, |
StreamType | uStreamTypes, | ||
AudioFormat | lpAudioFormat, | ||
bool | bEnable | ||
) |
Same as TeamTalkBase.EnableAudioBlockEvent() but option to specify audio output format.
When using BearWare.TeamTalkBase.TT_MUXED_USERID as user ID in combination with lpAudioFormat
will cause BearWare.AudioBlock to contain 20 msec of audio. If lpAudioFormat
is NULL then the instance will use the audio format that is configured in the channel's BearWare.AudioCodec.
uStreamTypes | Either BearWare.StreamType.STREAMTYPE_VOICE, BearWare.StreamType.STREAMTYPE_MEDIAFILE_AUDIO or BearWare.StreamType.STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO. For BearWare.TeamTalkBase.TT_MUXED_USERID it's possible to mix BearWare.StreamType so e.g. BearWare.StreamType.STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO or'ed with BearWare.StreamType.STREAMTYPE_VOICE) will return an BearWare.AudioBlock where these two stream types have been mixed together. |
nUserID | The user ID to monitor for audio callback. Pass special user ID BearWare.TeamTalkBase.TT_LOCAL_USERID to monitor local recorded audio prior to encoding/processing. Pass special user ID BearWare.TeamTalkBase.TT_MUXED_USERID to get a single audio stream of all audio that is being played from users. |
lpAudioFormat | Resample audio format from user to this BearWare.AudioFormat. Currently only BearWare.AudioFileFormat.AFF_WAVE_FORMAT is supported. Specify NULL to get original audio format. |
bEnable | Whether to enable the OnUserAudioBlock() event. |
Definition at line 5380 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetUserVolume | ( | int | nUserID, |
StreamType | nStreamType, | ||
int | nVolume | ||
) |
Set the volume of a user.
Note that it's a virtual volume which is being set since the master volume affects the user volume.
nUserID | The ID of the user whose volume will be changed. |
nStreamType | The type of stream to change, either BearWare.StreamType.STREAMTYPE_VOICE or BearWare.StreamType.STREAMTYPE_MEDIAFILE_AUDIO. |
nVolume | Must be between BearWare.SoundLevel.SOUND_VOLUME_MIN and BearWare.SoundLevel.SOUND_VOLUME_MAX. |
Definition at line 7825 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetUserMute | ( | int | nUserID, |
StreamType | nStreamType, | ||
bool | bMute | ||
) |
Mute a user.
To stop receiving audio from a user call TeamTalkBase.DoUnsubscribe() with BearWare.Subscription.SUBSCRIBE_VOICE.
nUserID | The user ID of the user to mute (or unmute). |
nStreamType | The type of stream to change, either BearWare.StreamType.STREAMTYPE_VOICE or BearWare.StreamType.STREAMTYPE_MEDIAFILE_AUDIO. |
bMute | TRUE will mute, FALSE will unmute. |
Definition at line 7840 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetUserStoppedPlaybackDelay | ( | int | nUserID, |
StreamType | nStreamType, | ||
int | nDelayMSec | ||
) |
Set the delay of when a user should no longer be considered as playing audio (either voice or audio from media file).
When a user starts talking the TeamTalkBase.OnUserStateChange() is triggered with uUserState
changing. A user will remain in this active state until no packets are received from this user, plus a delay (due to network interruptions). This delay is by default set to 500 msec but can be changed by calling TeamTalkBase.SetUserStoppedTalkingDelay().
Definition at line 7856 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetUserJitterControl | ( | int | nUserID, |
StreamType | nStreamType, | ||
JitterConfig | lpJitterConfig | ||
) |
Set the configuration for de-jitter measures for a user.
TeamTalk can add a fixed delay at the start of the playout of a user stream. This delay acts as a buffer to smooth out jittering (non-constant delays) in the reception of network packets. The fixed delay is applied at the start of every new stream, such as a new PTT session. The default fixed delay is zero.
TeamTalk can also apply adaptive jitter buffering where the actual jitter is measured and the delay at the start of a stream is adapted based on those measurements. The adaptive delay will not go below the fixed delay. The parameter nMaxAdaptiveDelayMSec maximizes the total adaptive delay. By default, the adaptive mechanism is OFF
By default, all jitter control is OFF
The result of jitter buffering is that playout frames will get buffered in the playout buffer. Make sure to also size the playout buffer for the expected jitter via TeamTalkBase.SetUserAudioStreamBufferSize()
nUserID | The user ID of the user to apply the configuration to. |
nStreamType | The type of stream to change, currently only BearWare.StreamType.STREAMTYPE_VOICE is supported. Other types are a no-op. |
lpJitterConfig | The jitter buffer configuration. |
Definition at line 7887 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.GetUserJitterControl | ( | int | nUserID, |
StreamType | nStreamType, | ||
ref JitterConfig | lpJitterConfig | ||
) |
Get the de-jitter configuration for a user.
nUserID | The user ID of the user to apply the configuration to. |
nStreamType | The type of stream to change, currently only BearWare.StreamType.STREAMTYPE_VOICE is supported. Other types are a no-op. |
lpJitterConfig | Pointer to an application-provided jitter buffer configuration that will be filled upon return. |
Definition at line 7904 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetUserPosition | ( | int | nUserID, |
StreamType | nStreamType, | ||
float | x, | ||
float | y, | ||
float | z | ||
) |
Set the position of a user.
3D sound position requires BearWare.SoundDeviceFeature.SOUNDDEVICEFEATURE_3DPOSITION.
This can only be done using DirectSound (BearWare.SoundSystem.SOUNDSYSTEM_DSOUND), a mono channel and with sound duplex mode (BearWare.ClientFlag.CLIENT_SNDINOUTPUT_DUPLEX) disabled.
nUserID | ID of user. |
nStreamType | The type of stream to change, either BearWare.StreamType.STREAMTYPE_VOICE or BearWare.StreamType.STREAMTYPE_MEDIAFILE_AUDIO. |
x | Distance in meters to user (left/right). |
y | Distance in meters to user (back/forward). |
z | Distance in meters to user (up/down). |
Definition at line 7926 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetUserStereo | ( | int | nUserID, |
StreamType | nStreamType, | ||
bool | bLeftSpeaker, | ||
bool | bRightSpeaker | ||
) |
Set whether a user should speak in the left, right or both speakers. This function only works if BearWare.AudioCodec has been set to use stereo.
nUserID | ID of user. |
nStreamType | The type of stream to change, either BearWare.StreamType.STREAMTYPE_VOICE or BearWare.StreamType.STREAMTYPE_MEDIAFILE_AUDIO. |
bLeftSpeaker | TRUE if user should be played in left speaker. |
bRightSpeaker | TRUE if user should be played in right speaker. |
Definition at line 7942 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetUserMediaStorageDir | ( | int | nUserID, |
string | szFolderPath, | ||
string | szFileNameVars, | ||
AudioFileFormat | uAFF | ||
) |
Store user's audio to disk.
Set the path of where to store audio from a user to disk. Event #OnUserRecordMediaFile is triggered when recording starts/stops.
To stop recording set szFolderPath
to an empty string and uAFF to BearWare.AudioFileFormat.AFF_NONE.
To store audio of other channels than the client instance check out the section Spying on Users.
nUserID | The ID of the BearWare.User which should store audio to disk. Pass 0 to store local instance's media stream. |
szFolderPath | The path on disk to where files should be stored. This value will be stored in szMediaStorageDir of BearWare.User. |
szFileNameVars | The file name used for audio files can consist of the following variables: %nickname%, %username%, %userid%, %counter%, %starttick% and a specified time based on strftime (google 'strftime' for a description of the format. The default format used by TeamTalk is: '%Y%m%d-%H%M%S #%userid% %username%'. The %counter% variable is a 9 digit integer which is incremented for each audio file. The file extension is automatically appended based on the file type (.wav for BearWare.AudioFileFormat BearWare.AudioFileFormat.AFF_WAVE_FORMAT and .mp3 for AFF_MP3_*_FORMAT). Pass NULL or empty string to revert to default format. |
uAFF | The BearWare.AudioFileFormat to use for storing audio files. Passing BearWare.AudioFileFormat BearWare.AudioFileFormat.AFF_NONE will cancel/reset the current recording. |
Definition at line 7981 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetUserMediaStorageDir | ( | int | nUserID, |
string | szFolderPath, | ||
string | szFileNameVars, | ||
AudioFileFormat | uAFF, | ||
int | nStopRecordingExtraDelayMSec | ||
) |
Store user's audio to disk.
This extension has an extra parameter for an aditional delay that will be waited before closing the per-user recording. This allows the recording to still capture all voice of a stream in a single file even if there's heavy network jitter. A recording will always be started if a different stream is received for the user. The delay is added on top of the standard playout delay that can be set via
Note that the delay starts after the last packet was written to the playout and thus the delay is already 'counting' when the jitter-buffered playout is still playing
Only supported for BearWare.StreamType.STREAMTYPE_VOICE.
nUserID | See description in TeamTalkBase.SetUserMediaStorageDir() |
szFolderPath | See description in TeamTalkBase.SetUserMediaStorageDir() |
szFileNameVars | See description in TeamTalkBase.SetUserMediaStorageDir() |
uAFF | See description in TeamTalkBase.SetUserMediaStorageDir() |
nStopRecordingExtraDelayMSec | Extra delay before closing the recording file default is 0. |
Definition at line 8011 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.SetUserAudioStreamBufferSize | ( | int | nUserID, |
StreamType | uStreamType, | ||
int | nMSec | ||
) |
Change the amount of media data which can be buffered in the user's playback queue.
Increasing the media buffer size is especially important when the user is currently streaming a media file using TeamTalkBase.StartStreamingMediaFileToChannel(). Once streaming has finished it is recommended to reset the media buffer, i.e. setting it to zero.
A simple way to notify users that the client instance is streaming a media file is to change the status of the local client instance using TeamTalkBase.DoChangeStatus() or to send a BearWare.TextMessage using TeamTalkBase.DoTextMessage().
nUserID | The ID of the user who should have changed the size of the media buffer. |
uStreamType | The stream type to apply the buffer for, i.e. either BearWare.StreamType.STREAMTYPE_VOICE or BearWare.StreamType.STREAMTYPE_MEDIAFILE_AUDIO. |
nMSec | The number of miliseconds of audio and video which should be allowed to be stored in the media buffer. 2000 - 3000 msec is a good size for a media buffer. Set the media buffer size to 0 msec to reset the media buffer to its default value. |
Definition at line 8041 of file TeamTalk.cs.
AudioBlock BearWare.TeamTalkBase.AcquireUserAudioBlock | ( | StreamType | uStreamTypes, |
int | nUserID | ||
) |
Extract the raw audio associated with the event TeamTalkBase.OnUserAudioBlock().
To enable access to user's raw audio first call TeamTalkBase.EnableAudioBlockEvent(). Whenever new audio becomes available the event TeamTalkBase.OnUserAudioBlock() is generated and TeamTalkBase.AcquireUserAudioBlock() can be called to extract the audio.
The BearWare.AudioBlock contains shared memory with the local client instance therefore always remember to call TeamTalkBase.ReleaseUserAudioBlock() to release the shared memory.
uStreamTypes | The stream type to extract, either BearWare.StreamType.STREAMTYPE_VOICE BearWare.StreamType.STREAMTYPE_MEDIAFILE_AUDIO, BearWare.StreamType.STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO. |
nUserID | The user ID to monitor for audio callback. Pass 0 to monitor local audio. |
Definition at line 8065 of file TeamTalk.cs.
bool BearWare.TeamTalkBase.ReleaseUserAudioBlock | ( | AudioBlock | lpAudioBlock | ) |
Release the shared memory of an BearWare.AudioBlock.
All BearWare.AudioBlock-structures extracted through TeamTalkBase.AcquireUserAudioBlock() must be released again since they share memory with the local client instance.
Never access lpAudioBlock
after releasing its BearWare.AudioBlock. This will cause the application to crash with a memory exception.
Definition at line 8090 of file TeamTalk.cs.
|
static |
The maximum number of sample rates supported by a BearWare.SoundDevice.
Definition at line 4308 of file TeamTalk.cs.