Sound Operations

Table of Contents

Synopsis
Description
Details

Sound Operations - play and capture audio frames

Synopsis

#define EDNET_SOUND_VOLUME_MAX
#define EDNET_SOUND_SAMPLE_RATE
#define EDNET_SOUND_SAMPLE_BITS
#define EDNET_SOUND_SAMPLE_CHANNELS
#define ednet_sound_destroy

typedef EDNetSound;
typedef EDNetSoundCaptureFunc;

EDNetSound *ednet_sound_new_play         (int                   skip_delay);
EDNetSound *ednet_sound_new_capture      (int                   encode);
void        ednet_sound_ref              (EDNetSound           *s);
void        ednet_sound_unref            (EDNetSound           *s);
void        ednet_sound_play             (EDNetSound           *s,
                                          EDNetBuf             *frame);
void        ednet_sound_clear_play_queue (EDNetSound           *s);
void        ednet_sound_set_volume       (EDNetSound           *s,
                                          int                   volume);
void        ednet_sound_set_mute         (EDNetSound           *s,
                                          int                   mute);
void        ednet_sound_start_capture    (EDNetSound           *s);
void        ednet_sound_stop_capture     (EDNetSound           *s);
void        ednet_sound_set_capture_func (EDNetSound           *s,
                                          EDNetSoundCaptureFunc callback,
                                          void                 *callback_data);

Description

You can play audio frames received from EDNetClient with these functions, and capture audio frames in order to send them via EDNetSoundStream.

Details

EDNET_SOUND_VOLUME_MAX

#define EDNET_SOUND_VOLUME_MAX      128

EDNET_SOUND_SAMPLE_RATE

#define EDNET_SOUND_SAMPLE_RATE     8000

EDNET_SOUND_SAMPLE_BITS

#define EDNET_SOUND_SAMPLE_BITS     16

EDNET_SOUND_SAMPLE_CHANNELS

#define EDNET_SOUND_SAMPLE_CHANNELS 1

ednet_sound_destroy

#define ednet_sound_destroy (s)     (s)

EDNetSound

typedef struct _EDNetSound EDNetSound;

A sound object to play or capture audio frames

EDNetSoundCaptureFunc

typedef int (*EDNetSoundCaptureFunc) (EDNetFrame *frame, void *user_data);

ednet_sound_new_play ()

EDNetSound *ednet_sound_new_play         (int                   skip_delay);

Creates a new EDNetSound for playing audio frames.

skip_delay :

TRUE if skip delayed frames, used for live streaming.

Returns :

a new EDNetSound, NULL if errors occurred.

ednet_sound_new_capture ()

EDNetSound *ednet_sound_new_capture      (int                   encode);

Creates a new EDNetSound for capturing audio frames.

encode :

TRUE to get encoded frames

Returns :

a new EDNetSound, NULL if errors occurred.

ednet_sound_ref ()

void        ednet_sound_ref              (EDNetSound           *s);

Adds a reference to the sound object.

s :

a EDNetSound

ednet_sound_unref ()

void        ednet_sound_unref            (EDNetSound           *s);

Removes a reference from the sound object, deallocating the sound object if no references remain.

s :

a EDNetSound

ednet_sound_play ()

void        ednet_sound_play             (EDNetSound           *s,
                                          EDNetBuf             *frame);

Enqueues a frame to the internal play queue for playing.

s :

a EDNetSound

frame :

an audio frame

ednet_sound_clear_play_queue ()

void        ednet_sound_clear_play_queue (EDNetSound           *s);

Clears the internal play queue.

s :

a EDNetSound

ednet_sound_set_volume ()

void        ednet_sound_set_volume       (EDNetSound           *s,
                                          int                   volume);

Adjusts the volume of the sound.

s :

a EDNetSound

volume :

between 0 and EDNET_SOUND_VOLUME_MAX

ednet_sound_set_mute ()

void        ednet_sound_set_mute         (EDNetSound           *s,
                                          int                   mute);

Determines whether it should mute the sound.

s :

a EDNetSound

mute :

TRUE if mute should be on

ednet_sound_start_capture ()

void        ednet_sound_start_capture    (EDNetSound           *s);

Starts to capture audio frames.

s :

a EDNetSound

ednet_sound_stop_capture ()

void        ednet_sound_stop_capture     (EDNetSound           *s);

Stops to capture audio frames.

s :

a EDNetSound

ednet_sound_set_capture_func ()

void        ednet_sound_set_capture_func (EDNetSound           *s,
                                          EDNetSoundCaptureFunc callback,
                                          void                 *callback_data);

Sets the callback function which should be called when audio frames are captured from devices.

s :

a EDNetSound

callback :

callback function

callback_data :

user data