TeamTalk 5 .NET DLL: Client Initialization

TeamTalk 5 .NET DLL Version 5.18A

Loading...
Searching...
No Matches
Classes | Enumerations | Functions | Variables | Properties
Client Initialization

This section explains how to instantiate a new client instance and query its current state. More...

## Classes

class | BearWare.TeamTalkBase
| Abstract class which encapsulates the TeamTalk 5 client. Instantiate either BearWare.TeamTalk5 (TeamTalk 5 SDK Standard Edition) or BearWare.TeamTalk5Pro (TeamTalk 5 SDK Professional Edition) to create the TeamTalk instance. More...
class | BearWare.TeamTalk5
| Class used to load `TeamTalk5.dll` and instantiate a TeamTalk client in TeamTalk 5 SDK Standard Edition. More...
class | BearWare.TeamTalk5Pro
| Class used to load `TeamTalk5Pro.dll` and instantiate a TeamTalk client in TeamTalk 5 SDK Professional Edition. More...

## Enumerations

enum

BearWare.ClientFlag : uint {
BearWare.ClientFlag.CLIENT_CLOSED = 0x00000000 , BearWare.ClientFlag.CLIENT_SNDINPUT_READY = 0x00000001 , BearWare.ClientFlag.CLIENT_SNDOUTPUT_READY = 0x00000002 , BearWare.ClientFlag.CLIENT_SNDINOUTPUT_DUPLEX = 0x00000004 ,
BearWare.ClientFlag.CLIENT_SNDINPUT_VOICEACTIVATED = 0x00000008 , BearWare.ClientFlag.CLIENT_SNDINPUT_VOICEACTIVE = 0x00000010 , BearWare.ClientFlag.CLIENT_SNDOUTPUT_MUTE = 0x00000020 , BearWare.ClientFlag.CLIENT_SNDOUTPUT_AUTO3DPOSITION = 0x00000040 ,
BearWare.ClientFlag.CLIENT_VIDEOCAPTURE_READY = 0x00000080 , BearWare.ClientFlag.CLIENT_TX_VOICE = 0x00000100 , BearWare.ClientFlag.CLIENT_TX_VIDEOCAPTURE = 0x00000200 , BearWare.ClientFlag.CLIENT_TX_DESKTOP = 0x00000400 ,
BearWare.ClientFlag.CLIENT_DESKTOP_ACTIVE = 0x00000800 , BearWare.ClientFlag.CLIENT_MUX_AUDIOFILE = 0x00001000 , BearWare.ClientFlag.CLIENT_CONNECTING = 0x00002000 , BearWare.ClientFlag.CLIENT_CONNECTED = 0x00004000 ,
BearWare.ClientFlag.CLIENT_CONNECTION = CLIENT_CONNECTING | CLIENT_CONNECTED , BearWare.ClientFlag.CLIENT_AUTHORIZED = 0x00008000 , BearWare.ClientFlag.CLIENT_STREAM_AUDIO = 0x00010000 , BearWare.ClientFlag.CLIENT_STREAM_VIDEO = 0x00020000
}

| Flags used to describe the the client instance current state. More...

## Functions

static string | BearWare.TeamTalkBase.GetVersion ()
| Get the DLL's version number.
| BearWare.TeamTalkBase.TeamTalkBase (bool poll_based)
| Create a new TeamTalk client instance.
void | BearWare.TeamTalkBase.Dispose ()
bool | BearWare.TeamTalkBase.GetMessage (ref TTMessage pMsg, int nWaitMs)
| Poll for events in the client instance.
bool | BearWare.TeamTalkBase.PumpMessage (ClientEvent nClientEvent, int nIdentifier)
| Cause client instance event thread to schedule an update event.
BearWare.ClientFlag | BearWare.TeamTalkBase.GetFlags ()
| Get a bitmask describing the client's current state.
static bool | BearWare.TeamTalkBase.SetLicenseInformation (string szRegName, string szRegKey)
| Set license information to disable trial mode.
void | BearWare.TeamTalkBase.ProcessMsg (TTMessage msg)
| Event handler for BearWare.TTMessage.

## Variables

const int | BearWare.TeamTalkBase.TT_STRLEN = 512
| The maximum length of all strings used in TeamTalkBase. This value includes the zero terminator, so 511 characters. Note that Unicode characters are converted to UTF-8 internally and limited once again to 512 if the string gets longer.
const int | BearWare.TeamTalkBase.TT_USERID_MAX = 0xFFF
| The highest user ID.
const int | BearWare.TeamTalkBase.TT_CHANNELID_MAX = 0xFFF
| The highest channel ID. Also used for BearWare.TeamTalkBase.TT_CLASSROOM_FREEFORALL.
const int | BearWare.TeamTalkBase.TT_LOCAL_USERID = 0
| User ID passed to TeamTalkBase.EnableAudioBlockEvent() in order to receive BearWare.AudioBlock directly from sound input device after joining a channel.
const int | BearWare.TeamTalkBase.TT_LOCAL_TX_USERID = 0x1002
| User ID passed to TeamTalkBase.EnableAudioBlockEvent() in order to receive BearWare.AudioBlock when voice transmission is activated.
const int | BearWare.TeamTalkBase.TT_MUXED_USERID = 0x1001
| User ID used to identify muxed audio that has been mixed into a single stream.

## Properties

ClientFlag | BearWare.TeamTalkBase.Flags`[get]`
| Same as GetFlags().

## Detailed Description

This section explains how to instantiate a new client instance and query its current state.

To instantiate a client in TeamTalk 5 SDK Standard Edition call the constructor TeamTalk5.TeamTalk5() and in TeamTalk 5 Professional Edition call TeamTalk5Pro.TeamTalk5Pro(). In both cases the constructor has the parameter poll_events which should be 'false' for Windows Forms applications and 'true' for console applications. The poll_events parameter tells how the client instance should post its events. Since a Windows Forms application has its own message-loop it does not need to "poll" for events. This is, however, needed by console applications which should call TeamTalkBase.GetMessage() to get events.

When a new client instance is created a user application can call to TeamTalkBase.GetFlags() to query the client instance's current state. Initially the client instance's state will be ClientFlag ClientFlag.CLIENT_CLOSED. This means that no operation has been performed on the client.

## Enumeration Type Documentation

## ◆ ClientFlag

enum BearWare.ClientFlag : uint

Flags used to describe the the client instance current state.

The client's state is a bitmask of the flags in BearWare.ClientFlag.

The state of the client instance can be retrieved by calling TeamTalkBase.GetFlags() This enables the user application to display the possible options to the end user. If e.g. the flag BearWare.ClientFlag.CLIENT_AUTHORIZED is not set it will not be possible to perform any other commands except TeamTalkBase.DoLogin(). Doing so will make the server return an error message to the client.

Enumerator
CLIENT_CLOSED | The client instance is in closed state, i.e. no operations has been performed on it.
CLIENT_SNDINPUT_READY | If set the client instance's sound input device has been initialized, i.e. TeamTalkBase.InitSoundInputDevice() has been called successfully.
CLIENT_SNDOUTPUT_READY | If set the client instance's sound output device has been initialized, i.e. TeamTalkBase.InitSoundOutputDevice() has been called successfully.
CLIENT_SNDINOUTPUT_DUPLEX | If set the client instance is running in sound duplex mode where multiple audio output streams are mixed into a single stream. This option must be enabled to support echo cancellation (see BearWare.SpeexDSP). Call TeamTalkBase.InitSoundDuplexDevices() to enable duplex mode.

CLIENT_SNDINPUT_VOICEACTIVATED

If set the client instance will start transmitting audio if the sound level is above the voice activation level. The event BearWare.ClientEvent.CLIENTEVENT_VOICE_ACTIVATION is posted when voice activation initiates transmission.

See also
  TeamTalkBase.SetVoiceActivationLevel()
  TeamTalkBase.EnableVoiceActivation()

CLIENT_SNDINPUT_VOICEACTIVE

If set GetSoundInputLevel() is higher than the voice activation level. To enable voice transmission if voice level is higher than actication level also enable BearWare.ClientFlag.CLIENT_SNDINPUT_VOICEACTIVATED.

See also
  TeamTalkBase.SetVoiceActivationLevel()
  TeamTalkBase.EnableVoiceActivation()

CLIENT_SNDOUTPUT_MUTE

If set the client instance has muted all users.

See also
  TeamTalkBase.SetSoundOutputMute()

CLIENT_SNDOUTPUT_AUTO3DPOSITION

If set the client instance will auto position users in a 180 degree circle using 3D-sound. This option is only available with BearWare.SoundSystem.SOUNDSYSTEM_DSOUND.

See also
  TeamTalkBase.SetUserPosition()
  TeamTalkBase.Enable3DSoundPositioning()

CLIENT_VIDEOCAPTURE_READY | If set the client instance's video device has been initialized, i.e. TeamTalkBase.InitVideoCaptureDevice() has been called successfuly.

CLIENT_TX_VOICE

If set the client instance is currently transmitting audio.

See also
  TeamTalkBase.EnableVoiceTransmission()

CLIENT_TX_VIDEOCAPTURE

If set the client instance is currently transmitting video.

See also
  TeamTalkBase.StartVideoCaptureTransmission()

CLIENT_TX_DESKTOP | If set the client instance is currently transmitting a desktop window. A desktop window update is issued by calling TeamTalkBase.SendDesktopWindow(). The event BearWare.ClientEvent.CLIENTEVENT_DESKTOPWINDOW_TRANSFER is triggered when a desktop window transmission completes.
CLIENT_DESKTOP_ACTIVE | If set the client instance current have an active desktop session, i.e. TeamTalkBase.SendDesktopWindow() has been called. Call TeamTalkBase.CloseDesktopWindow() to close the desktop session.
CLIENT_MUX_AUDIOFILE | If set the client instance is currently muxing audio streams into a single file. This is enabled by calling TeamTalkBase.StartRecordingMuxedAudioFile().
CLIENT_CONNECTING | If set the client instance is currently try to connect to a server, i.e. TeamTalkBase.Connect() has been called.
CLIENT_CONNECTED | If set the client instance is connected to a server, i.e. BearWare.ClientEvent.CLIENTEVENT_CON_SUCCESS event has been issued after doing a TeamTalkBase.Connect(). Valid commands in this state: TeamTalkBase.DoLogin()
CLIENT_CONNECTION | Helper for BearWare.ClientFlag.CLIENT_CONNECTING and BearWare.ClientFlag.CLIENT_CONNECTED to see if TeamTalkBase.Disconnect() should be called.
CLIENT_AUTHORIZED | If set the client instance is logged on to a server, i.e. got BearWare.ClientEvent.CLIENTEVENT_CMD_MYSELF_LOGGEDIN event after issueing TeamTalkBase.DoLogin().

CLIENT_STREAM_AUDIO

If set the client is currently streaming the audio of a media file. When streaming a video file the BearWare.ClientFlag.CLIENT_STREAM_VIDEO flag is also typically set.

See also
  TeamTalkBase.StartStreamingMediaFileToChannel()

CLIENT_STREAM_VIDEO

If set the client is currently streaming the video of a media file. When streaming a video file the BearWare.ClientFlag.CLIENT_STREAM_AUDIO flag is also typically set.

See also
  TeamTalkBase.StartStreamingMediaFileToChannel()

Definition at line 4070 of file TeamTalk.cs.

## Function Documentation

## ◆ GetVersion()

static string BearWare.TeamTalkBase.GetVersion | ( |  | ) |

static

Get the DLL's version number.

Definition at line 4297 of file TeamTalk.cs.

## ◆ TeamTalkBase()

BearWare.TeamTalkBase.TeamTalkBase | ( | bool | poll_based | ) |

protected

Create a new TeamTalk client instance.

Parameters

  poll_based | If the application using this class is a Windows Forms application poll_based should be 'false' since events will be posted using the Windows message loop. In Console applications on the other hand, the user application will have to 'poll' for events using GetMessage(). Remember to put the ``[STAThread] macro on the `Main` method if building a console application.

Definition at line 4309 of file TeamTalk.cs.

## ◆ Dispose()

void BearWare.TeamTalkBase.Dispose | ( |  | ) |

Definition at line 4392 of file TeamTalk.cs.

## ◆ GetMessage()

bool BearWare.TeamTalkBase.GetMessage | ( | ref TTMessage | pMsg,
|  | int | nWaitMs )

Poll for events in the client instance.

In a Windows Forms application events can be processed using the application message-loop, but in Console application the application must process the events itself. The most common way to do this is to start a timer which calls TeamTalkBase.GetMessage() every now and then to ensure the UI is updated with the latest events.

Parameters

  pMsg | Reference to a TTMessage instance which will hold the event that has occured.
  nWaitMs | The amount of time to wait for the event. If -1 the function will block forever or until the next event occurs.

Returns
  Returns TRUE if an event has occured otherwise FALSE.

See also
  TeamTalk()
  ClientEvent

Definition at line 4425 of file TeamTalk.cs.

## ◆ PumpMessage()

bool BearWare.TeamTalkBase.PumpMessage | ( | ClientEvent | nClientEvent,
|  | int | nIdentifier )

Cause client instance event thread to schedule an update event.

Normally all events are due to a state change in the client instance. The state change (BearWare.ClientEvent) is submitted by the client instance's internal thread. In some cases it's, however, convenient to make the internal thread submit the latest properties of an object. One example is after having changed the volume of a BearWare.User. Then your local copy of BearWare.User will no longer contain the latest `nVolumeVoice`.

Calling PumpMessage() will make the client instance's internal thread queue an update of BearWare.User so the latest properties of the user can be retrieved from GetMessage().

It's also possible to simply use GetUser() but the problem with this approach is that this call is from a separate thread and therefore doesn't take the event queue into account.

Parameters

  nClientEvent | The event which should be queued. Currently only BearWare.ClientEvent.CLIENTEVENT_USER_STATECHANGE is supported.
  nIdentifier | The ID of the object to retrieve. Currently only nUserID is supported.

Returns
  Returns true if the event has been scheduled.

Definition at line 4456 of file TeamTalk.cs.

## ◆ GetFlags()

BearWare.ClientFlag BearWare.TeamTalkBase.GetFlags | ( |  | ) |

Get a bitmask describing the client's current state.

Checks whether the client is connecting, connected, authorized, etc. The current state can be checked by and'ing the returned bitmask which is based on BearWare.ClientFlag.

Returns
  A bitmask describing the current state.

Definition at line 4470 of file TeamTalk.cs.

## ◆ SetLicenseInformation()

static bool BearWare.TeamTalkBase.SetLicenseInformation | ( | string | szRegName,
|  | string | szRegKey )

static

Set license information to disable trial mode.

This function must be called before instantiating either the BearWare.TeamTalk5 or BearWare.TeamTalk5Pro-class.

Parameters

  szRegName | The registration name provided by BearWare.dk.
  szRegKey | The registration key provided by BearWare.dk.

Returns
  True if the provided registration is acceptable.

Definition at line 4492 of file TeamTalk.cs.

## ◆ ProcessMsg()

void BearWare.TeamTalkBase.ProcessMsg | ( | TTMessage | msg | ) |

Event handler for BearWare.TTMessage.

Parameters

  msg | The BearWare.TTMessage retrieved by TeamTalkBase.GetMessage()

Definition at line 4501 of file TeamTalk.cs.

## Variable Documentation

## ◆ TT_STRLEN

const int BearWare.TeamTalkBase.TT_STRLEN = 512

static

The maximum length of all strings used in TeamTalkBase. This value includes the zero terminator, so 511 characters. Note that Unicode characters are converted to UTF-8 internally and limited once again to 512 if the string gets longer.

Definition at line 4181 of file TeamTalk.cs.

## ◆ TT_USERID_MAX

const int BearWare.TeamTalkBase.TT_USERID_MAX = 0xFFF

static

The highest user ID.

Definition at line 4184 of file TeamTalk.cs.

## ◆ TT_CHANNELID_MAX

const int BearWare.TeamTalkBase.TT_CHANNELID_MAX = 0xFFF

static

The highest channel ID. Also used for BearWare.TeamTalkBase.TT_CLASSROOM_FREEFORALL.

Definition at line 4188 of file TeamTalk.cs.

## ◆ TT_LOCAL_USERID

const int BearWare.TeamTalkBase.TT_LOCAL_USERID = 0

static

User ID passed to TeamTalkBase.EnableAudioBlockEvent() in order to receive BearWare.AudioBlock directly from sound input device after joining a channel.

When this user ID is passed then the BearWare.AudioBlock received will be prior to audio preprocessing (BearWare.AudioPreprocessor).

Note, however, that BearWare.ClientEvent.CLIENTEVENT_USER_AUDIOBLOCK will not be triggered until the TeamTalk instance is in a channel. This is because the sound input device is not started until it knows the BearWare.AudioCodec's sample rate, number of channels and transmit interval.

Definition at line 4244 of file TeamTalk.cs.

## ◆ TT_LOCAL_TX_USERID

const int BearWare.TeamTalkBase.TT_LOCAL_TX_USERID = 0x1002

static

User ID passed to TeamTalkBase.EnableAudioBlockEvent() in order to receive BearWare.AudioBlock when voice transmission is activated.

Either through TeamTalkBase.EnableVoiceActivation() or TeamTalkBase.EnableVoiceTransmission().

Definition at line 4253 of file TeamTalk.cs.

## ◆ TT_MUXED_USERID

const int BearWare.TeamTalkBase.TT_MUXED_USERID = 0x1001

static

User ID used to identify muxed audio that has been mixed into a single stream.

This user ID is passed to TeamTalkBase.EnableAudioBlockEvent() in order to receive BearWare.AudioBlock of audio that is played in the TeamTalk instance.

Definition at line 4262 of file TeamTalk.cs.

## Properties

## ◆ Flags

ClientFlag BearWare.TeamTalkBase.Flags

get

Same as GetFlags().

Definition at line 4478 of file TeamTalk.cs.