TeamTalk 5 C-API DLL: Audio and Video Transmission

TeamTalk 5 C-API DLL Version 5.18A

Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
Audio and Video Transmission

This section explains how to transmit audio and video to users in a channel. More...

## Typedefs

typedef enum StreamType | StreamType
| The types of streams which are available for transmission.
typedef UINT32 | StreamTypes
| Mask of StreamType.

## Enumerations

enum

StreamType {
STREAMTYPE_NONE = 0x00000000 , STREAMTYPE_VOICE = 0x00000001 , STREAMTYPE_VIDEOCAPTURE = 0x00000002 , STREAMTYPE_MEDIAFILE_AUDIO = 0x00000004 ,
STREAMTYPE_MEDIAFILE_VIDEO = 0x00000008 , STREAMTYPE_DESKTOP = 0x00000010 , STREAMTYPE_DESKTOPINPUT = 0x00000020 , STREAMTYPE_MEDIAFILE ,
STREAMTYPE_CHANNELMSG = 0x00000040 , STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO = 0x00000080 , STREAMTYPE_CLASSROOM_ALL
}

| The types of streams which are available for transmission. More...

## Functions

TEAMTALKDLL_API TTBOOL | TT_InsertAudioBlock (IN TTInstance *lpTTInstance, IN const AudioBlock *lpAudioBlock)
| Transmit application provided raw audio in AudioBlock-structs as STREAMTYPE_VOICE, i.e. microphone input.
TEAMTALKDLL_API TTBOOL | TT_EnableVoiceTransmission (IN TTInstance *lpTTInstance, IN TTBOOL bEnable)
| Start/stop transmitting of voice data from sound input.
TEAMTALKDLL_API TTBOOL | TT_EnableVoiceActivation (IN TTInstance *lpTTInstance, IN TTBOOL bEnable)
| Enable voice activation.
TEAMTALKDLL_API TTBOOL | TT_SetVoiceActivationLevel (IN TTInstance *lpTTInstance, IN INT32 nLevel)
| Set voice activation level.
TEAMTALKDLL_API INT32 | TT_GetVoiceActivationLevel (IN TTInstance *lpTTInstance)
| Get voice activation level.
TEAMTALKDLL_API TTBOOL | TT_SetVoiceActivationStopDelay (IN TTInstance *lpTTInstance, IN INT32 nDelayMSec)
| Set the delay of when voice activation should be stopped.
TEAMTALKDLL_API INT32 | TT_GetVoiceActivationStopDelay (IN TTInstance *lpTTInstance)
| Get the delay of when voice active state should be disabled.
TEAMTALKDLL_API TTBOOL | TT_StartRecordingMuxedAudioFile (IN TTInstance *lpTTInstance, IN const AudioCodec *lpAudioCodec, IN const TTCHAR *szAudioFileName, IN AudioFileFormat uAFF)
| Store all audio conversations with specific AudioCodec settings to a single file.
TEAMTALKDLL_API TTBOOL | TT_StartRecordingMuxedAudioFileEx (IN TTInstance *lpTTInstance, IN INT32 nChannelID, IN const TTCHAR *szAudioFileName, IN AudioFileFormat uAFF)
| Store audio conversations from a specific channel into a single file.
TEAMTALKDLL_API TTBOOL | TT_StartRecordingMuxedStreams (IN TTInstance *lpTTInstance, IN StreamTypes uStreamTypes, IN const AudioCodec *lpAudioCodec, IN const TTCHAR *szAudioFileName, IN AudioFileFormat uAFF)
| Mix multiple StreamTypes into a single audio file.
TEAMTALKDLL_API TTBOOL | TT_StopRecordingMuxedAudioFile (IN TTInstance *lpTTInstance)
| Stop an active muxed audio recording.
TEAMTALKDLL_API TTBOOL | TT_StopRecordingMuxedAudioFileEx (IN TTInstance *lpTTInstance, IN INT32 nChannelID)
| Stop recording conversations from a channel to a single file.
TEAMTALKDLL_API TTBOOL | TT_StartVideoCaptureTransmission (IN TTInstance *lpTTInstance, IN const VideoCodec *lpVideoCodec)
| Start transmitting from video capture device.
TEAMTALKDLL_API TTBOOL | TT_StopVideoCaptureTransmission (IN TTInstance *lpTTInstance)
| Stop transmitting from video capture device.

## Detailed Description

This section explains how to transmit audio and video to users in a channel.

Once the client instance has joined a channel it can transmit audio, video and desktops to other users in the channel.

To transmit audio the client must have the flag CLIENT_SNDINPUT_READY enabled which is done in the function TT_InitSoundInputDevice. To transmit video requires the flag CLIENT_VIDEOCAPTURE_READY which is enabled by the function TT_InitVideoCaptureDevice. To hear what others users are saying a sound output device must have been configured using TT_InitSoundOutputDevice and thereby have enabled the flag CLIENT_SNDOUTPUT_READY.

Calling TT_EnableVoiceTransmission() will make the client instance start transmitting voice data. Voice transmission can also be activated automatically using voice activation. This is done by called TT_EnableVoiceActivation() and setting a voice activation level using TT_SetVoiceActivationLevel(). Note that voice transmission requires USERRIGHT_TRANSMIT_VOICE.

Calling TT_StartVideoCaptureTransmission() will make the client instance start transmission video data from a video capture device (typically a webcam). Note that video capture transmission requires USERRIGHT_TRANSMIT_VIDEOCAPTURE.

## Typedef Documentation

## ◆ StreamType

typedef enum StreamType StreamType

The types of streams which are available for transmission.

## ◆ StreamTypes

typedef UINT32 StreamTypes

Mask of StreamType.

Definition at line 273 of file TeamTalk.h.

## Enumeration Type Documentation

## ◆ StreamType

enum StreamType

The types of streams which are available for transmission.

Enumerator
STREAMTYPE_NONE | No stream.

STREAMTYPE_VOICE

Voice stream type which is audio recorded from a sound input device.

See also
  TT_InitSoundInputDevice()

STREAMTYPE_VIDEOCAPTURE

Video capture stream type which is video recorded from a webcam.

See also
  TT_InitVideoCaptureDevice()

STREAMTYPE_MEDIAFILE_AUDIO

Audio stream type from a media file which is being streamed.

See also
  TT_StartStreamingMediaFileToChannel()

STREAMTYPE_MEDIAFILE_VIDEO

Video stream type from a media file which is being streamed.

See also
  TT_StartStreamingMediaFileToChannel()

STREAMTYPE_DESKTOP

Desktop window stream type which is a window (or bitmap) being transmitted.

See also
  TT_SendDesktopWindow()

STREAMTYPE_DESKTOPINPUT

Desktop input stream type which is keyboard or mouse input being transmitted.

See also
  TT_SendDesktopInput()

STREAMTYPE_MEDIAFILE | Shortcut to allow both audio and video media files.

STREAMTYPE_CHANNELMSG

Channel text messages as stream type.

       A channel text message is not a stream but is only included
       as a stream type in order to be able to block messages
       using @c transmitUsers in #Channel struct.

       @see TT_DoUpdateChannel()
       @see CHANNEL_CLASSROOM.

STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO

Stream type for audio of local playback.

        TT_EnableAudioBlockEvent() can be used to intercept audio
        from a local media playback.
        @see TT_InitLocalPlayback()

STREAMTYPE_CLASSROOM_ALL | Shortcut to allow voice, media files, desktop, webcamera and channel messages.

Definition at line 221 of file TeamTalk.h.

## Function Documentation

## ◆ TT_InsertAudioBlock()

TEAMTALKDLL_API TTBOOL TT_InsertAudioBlock | ( | IN TTInstance * | lpTTInstance,
|  | IN const AudioBlock * | lpAudioBlock )

Transmit application provided raw audio in AudioBlock-structs as STREAMTYPE_VOICE, i.e. microphone input.

Since STREAMTYPE_VOICE is being replaced by audio input this means that while audio input is active then subsequent calls to TT_EnableVoiceTransmission() or TT_EnableVoiceActivation() will fail until the audio input has ended.

If the flags CLIENT_TX_VOICE or CLIENT_SNDINPUT_VOICEACTIVATED are active then calling TT_InputAudioBlock() will fail because STREAMTYPE_VOICE is already in use.

TT_InsertAudioBlock() can be called multiple times until the client instance's internal queue is full. When the queue has been filled then monitor CLIENTEVENT_AUDIOINPUT to see when more data can be queued.

To end raw audio input set parameter `lpAudioBlock` to NULL and then TT_EnableVoiceTransmission() or TT_StartStreamingMediaFileToChannel() will be available again.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.
  lpAudioBlock | The audio to submit as audio input. The member `nStreamID` of AudioBlock is used to identify the audio input session which is currently in progress and is posted as the `nSource` of CLIENTEVENT_AUDIOINPUT. The member `uSampleIndex` of AudioBlock is ignored.

## ◆ TT_EnableVoiceTransmission()

TEAMTALKDLL_API TTBOOL TT_EnableVoiceTransmission | ( | IN TTInstance * | lpTTInstance,
|  | IN TTBOOL | bEnable )

Start/stop transmitting of voice data from sound input.

Sound input is initialized using TT_InitSoundInputDevice() or TT_InitSoundDuplexDevices().

Voice transmission is stream type STREAMTYPE_VOICE.

User rights required:

- USERRIGHT_TRANSMIT_VOICE

Note that voice activation cannot be enabled when TT_InsertAudioBlock() is active.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.
  bEnable | Enable/disable transmission.

Returns
  TRUE on success. FALSE if voice transmission could not be activated on the client instance.

## ◆ TT_EnableVoiceActivation()

TEAMTALKDLL_API TTBOOL TT_EnableVoiceActivation | ( | IN TTInstance * | lpTTInstance,
|  | IN TTBOOL | bEnable )

Enable voice activation.

The client instance will start transmitting audio if the recorded audio level is above or equal to the voice activation level set by TT_SetVoiceActivationLevel(). Once the voice activation level is reached the event CLIENTEVENT_VOICE_ACTIVATION is posted.

The current volume level can be queried calling TT_GetSoundInputLevel.

Voice transmission is stream type STREAMTYPE_VOICE.

User rights required:

- USERRIGHT_TRANSMIT_VOICE

Note that voice activation cannot be enabled when TT_InsertAudioBlock() is active.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.
  bEnable | TRUE to enable, otherwise FALSE.

Returns
  TRUE on success. FALSE if voice activation cannot be enabled on the client instance.

See also
  CLIENT_SNDINPUT_VOICEACTIVATION
  TT_SetVoiceActivationStopDelay

## ◆ TT_SetVoiceActivationLevel()

TEAMTALKDLL_API TTBOOL TT_SetVoiceActivationLevel | ( | IN TTInstance * | lpTTInstance,
|  | IN INT32 | nLevel )

Set voice activation level.

The current volume level can be queried calling TT_GetSoundInputLevel(). When TT_GetSoundInputLevel() is greater or equal to voice activation level then CLIENTEVENT_VOICE_ACTIVATION is triggered.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.
  nLevel | Must be between SOUND_VU_MIN and SOUND_VU_MAX

See also
  TT_EnableVoiceActivation
  TT_GetVoiceActivationLevel
  TT_SetVoiceActivationStopDelay

## ◆ TT_GetVoiceActivationLevel()

TEAMTALKDLL_API INT32 TT_GetVoiceActivationLevel | ( | IN TTInstance * | lpTTInstance | ) |

Get voice activation level.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.

Returns
  Returns A value between SOUND_VU_MIN and SOUND_VU_MAX

See also
  TT_EnableVoiceActivation
  TT_SetVoiceActivationLevel

## ◆ TT_SetVoiceActivationStopDelay()

TEAMTALKDLL_API TTBOOL TT_SetVoiceActivationStopDelay | ( | IN TTInstance * | lpTTInstance,
|  | IN INT32 | nDelayMSec )

Set the delay of when voice activation should be stopped.

When TT_GetSoundInputLevel() becomes higher than the specified voice activation level the client instance will start transmitting until TT_GetSoundInputLevel() becomes lower than the voice activation level, plus a delay. This delay is by default set to 1500 msec but this value can be changed by calling TT_SetVoiceActivationStopDelay().

See also
  TT_EnableVoiceActivation
  TT_SetVoiceActivationLevel

## ◆ TT_GetVoiceActivationStopDelay()

TEAMTALKDLL_API INT32 TT_GetVoiceActivationStopDelay | ( | IN TTInstance * | lpTTInstance | ) |

Get the delay of when voice active state should be disabled.

Returns
  The number of miliseconds before voice activated state should be turned back to inactive.

See also
  TT_SetVoiceActivationStopDelay
  TT_EnableVoiceActivation
  TT_SetVoiceActivationLevel

## ◆ TT_StartRecordingMuxedAudioFile()

TEAMTALKDLL_API TTBOOL TT_StartRecordingMuxedAudioFile | ( | IN TTInstance * | lpTTInstance,
|  | IN const AudioCodec * | lpAudioCodec,
|  | IN const TTCHAR * | szAudioFileName,
|  | IN AudioFileFormat | uAFF )

Store all audio conversations with specific AudioCodec settings to a single file.

To record conversations from a specific channel to a single file call TT_StartRecordingMuxedAudioFileEx().

TT_StartRecordingMuxedAudioFile() can be used to record conversations "across" channels given that the channels use the same AudioCodec properties (i.e. `audiocodec` member of Channel). To receive audio outside the TeamTalk instance's channel use TT_DoSubscribe() and SUBSCRIBE_INTERCEPT_VOICE.

If the user changes to a channel which uses a different audio codec then the recording will continue but simply be silent until the user again joins a channel with the same audio codec as was used for initializing muxed audio recording.

Calling TT_StartRecordingMuxedAudioFile() will enable the CLIENT_MUX_AUDIOFILE flag from TT_GetFlags().

Call TT_StopRecordingMuxedAudioFile() to stop recording. Note that only one muxed audio recording can be active at the same time.

Only STREAMTYPE_VOICE is stored into the audio file, not STREAMTYPE_MEDIAFILE_AUDIO. To record other stream types use TT_StartRecordingMuxedStreams().

TT_StartRecordingMuxedAudioFile() is mutually exclusive with TT_StartRecordingMuxedStreams().

Use TT_SetUserMediaStorageDir() to store users' audio streams in separate files.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.
  lpAudioCodec | The audio codec which should be used as reference for muxing users' audio streams. In most situations this is the AudioCodec of the current channel, i.e. TT_GetMyChannelID().
  szAudioFileName | The file to store audio to, e.g. C:\MyFiles\Conf.mp3.
  uAFF | The audio format which should be used in the recorded file. The muxer will convert to this format.

See also
  TT_SetUserMediaStorageDir()
  TT_StartRecordingMuxedAudioFileEx()
  TT_StartRecordingMuxedStreams()
  TT_StopRecordingMuxedAudioFile()

## ◆ TT_StartRecordingMuxedAudioFileEx()

TEAMTALKDLL_API TTBOOL TT_StartRecordingMuxedAudioFileEx | ( | IN TTInstance * | lpTTInstance,
|  | IN INT32 | nChannelID,
|  | IN const TTCHAR * | szAudioFileName,
|  | IN AudioFileFormat | uAFF )

Store audio conversations from a specific channel into a single file.

To record audio outside the TTInstance's current channel use the TT_DoSubscribe() with the SUBSCRIBE_INTERCEPT_VOICE on all the user's in the channel.

Unlike TT_StartRecordingMuxedAudioFile() this function does not toggle the flag CLIENT_MUX_AUDIOFILE.

Use TT_StartRecordingMuxedAudioFile() to record conversations from many different channels with the same AudioCodec settings.

Only STREAMTYPE_VOICE is stored into the audio file, not STREAMTYPE_MEDIAFILE_AUDIO.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.
  nChannelID | The recording will contain the conversations from this channel ID.
  szAudioFileName | The file to store audio to, e.g. C:\MyFiles\Conf.mp3.
  uAFF | The audio format which should be used in the recorded file. The muxer will convert to this format.

See also
  TT_StartRecordingMuxedAudioFile()
  TT_StartRecordingMuxedStreams()
  TT_StopRecordingMuxedAudioFileEx()

## ◆ TT_StartRecordingMuxedStreams()

TEAMTALKDLL_API TTBOOL TT_StartRecordingMuxedStreams | ( | IN TTInstance * | lpTTInstance,
|  | IN StreamTypes | uStreamTypes,
|  | IN const AudioCodec * | lpAudioCodec,
|  | IN const TTCHAR * | szAudioFileName,
|  | IN AudioFileFormat | uAFF )

Mix multiple StreamTypes into a single audio file.

Both voice, media streams, etc. can be mixed together into a single file using this feature.

Streams that can be mixed into a single file are:

- STREAMTYPE_VOICE
- STREAMTYPE_MEDIAFILE_AUDIO
- STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO

TT_StartRecordingMuxedAudioFile() is mutually exclusive with TT_StartRecordingMuxedStreams().

Use TT_StopRecordingMuxedAudioFile() to stop the recording.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.

  uStreamTypes

  The StreamTypes to mix together. Streams that can be mixed into a single file are:
  - STREAMTYPE_VOICE
  - STREAMTYPE_MEDIAFILE_AUDIO
  - STREAMTYPE_LOCALMEDIAPLAYBACK_AUDIO

  lpAudioCodec | The reference codec for the recording. The recording will use the sample rate and number of channels specified by the AudioCodec.
  szAudioFileName | The file to store audio to, e.g. C:\MyFiles\Conf.mp3.
  uAFF | The audio format which should be used in the recorded file. The muxer will convert to this format.

See also
  TT_StartRecordingMuxedAudioFile()
  TT_StartRecordingMuxedAudioFileEx()
  TT_StopRecordingMuxedAudioFileE()

## ◆ TT_StopRecordingMuxedAudioFile()

TEAMTALKDLL_API TTBOOL TT_StopRecordingMuxedAudioFile | ( | IN TTInstance * | lpTTInstance | ) |

Stop an active muxed audio recording.

A muxed audio recording started with TT_StartRecordingMuxedAudioFile() can be stopped using this function.

Calling TT_StopRecordingMuxedAudioFile() will clear the CLIENT_MUX_AUDIOFILE flag from TT_GetFlags().

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.

See also
  TT_StartRecordingMuxedAudioFile()

## ◆ TT_StopRecordingMuxedAudioFileEx()

TEAMTALKDLL_API TTBOOL TT_StopRecordingMuxedAudioFileEx | ( | IN TTInstance * | lpTTInstance,
|  | IN INT32 | nChannelID )

Stop recording conversations from a channel to a single file.

Stop a recording initiated by TT_StartRecordingMuxedAudioFileEx().

See also
  TT_StopRecordingMuxedAudioFile()

## ◆ TT_StartVideoCaptureTransmission()

TEAMTALKDLL_API TTBOOL TT_StartVideoCaptureTransmission | ( | IN TTInstance * | lpTTInstance,
|  | IN const VideoCodec * | lpVideoCodec )

Start transmitting from video capture device.

The video capture device is initiated by calling TT_InitVideoCaptureDevice(). After joining a channel and calling this function the other users will see the video from the capture device.

Video capture data is transmitted with stream type STREAMTYPE_VIDEOCAPTURE and is subscribed/unsubscribed using SUBSCRIBE_VIDEOCAPTURE.

To stop transmitting call TT_StopVideoCaptureTransmission()

User rights required:

- USERRIGHT_TRANSMIT_VIDEOCAPTURE.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.
  lpVideoCodec | The video codec settings to use for transmission.

See also
  TT_StartStreamingMediaFileToChannel()
  TT_EnableVoiceTransmission()

## ◆ TT_StopVideoCaptureTransmission()

TEAMTALKDLL_API TTBOOL TT_StopVideoCaptureTransmission | ( | IN TTInstance * | lpTTInstance | ) |

Stop transmitting from video capture device.

Parameters

  lpTTInstance | Pointer to client instance created by TT_InitTeamTalk.

See also
  TT_StartVideoCaptureTransmission()