AudioInputInitialize

From TrillWiki

Jump to: navigation, search

The audioInputInitialize function sets up an audio input session (from microphone) in preparation to sending it out to a remote destination.

Compatibility: 3.0 and higher

Contents

Syntax

plugin_send(MYGUID,"audioInputInitialize",audio_t *);

Note that all Trillian functions and notifications begin with a lower-case letter, despite the Wiki requirement that all pages start with a capital letter.

Parameters

AudioInputInitialize utilitizes the audio_t structure.

struct audio_t 
{ 
    unsigned int                struct_size; 

    int                         connection_id;
    int                         window_id;

    char                        *medium;
    char                        *name;
    char                        *location;

    char                        *section;

    int                         initiated;
    int                         ask_confirmation;

    /* Audio Information
     */

    int                         codec; 

    int                         audio_sample_size;
    int                         audio_sample_rate;
    int                         audio_block_size;
    int                         audio_quality;

    int                         audio_data_length; 

    unsigned char               *audio_data; 

    ttkCallback                 callback; 
    void                        *data; 
};



medium
The medium this audio stream is being hosted over.
connection_id
The connection with which this is associated.
name
The contact with which this chat is associated.
window_id
Optionally, the window ID with which this chat is associated. (If provided, you don't need the above things for looking it up.)
initiated
Should be 1 if the local user started this chat, 0 if the remote did.
ask_confirmation
Should the user be asked whether or not to accept this chat?
codec
What audio codec to use. As of 3.0, only AUDIO_CODEC_UNCOMPRESSED and AUDIO_CODEC_TRUESPEECH are supported.
audio_sample_size
Size of each sample, in bits.
audio_sample_rate
Number of samples per second.
audio_block_size
How many samples Trillian should collect before notifying the callback below.
audio_quality
The target audio quality, from 1-100 percent. Lower quality is lower CPU impact.
callback
The callback all audio notifications for this session should go to.
data
The user data for this audio session.


Return Value

This function returns a negative value on failure, or the ID of the audio session on success. It is worth noting that the ID of the audio session will be the same as the window_id, as only one session can be associated with each window.

Remarks

This is only one half of the stream; you will also need audioOutputInitialize to listen to a remote stream. In addition, you will also need to audioInputStart this audio session when actually using it. And remember to use audioInputUninitialize when you are done with the audio input session.


Personal tools