Class NativeSpeexDSP
Native speexdsp handler that directly calls the exported opus functions.
Inherited Members
Namespace: SpeexDSPSharp.Core
Assembly: SpeexDSPSharp.Core.dll
Syntax
public static class NativeSpeexDSP
Methods
jitter_buffer_ctl(SpeexDSPJitterBufferSafeHandler, int, void*)
Used like the ioctl function to control the jitter buffer parameters.
Declaration
public static extern int jitter_buffer_ctl(SpeexDSPJitterBufferSafeHandler jitter, int request, void* ptr)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPJitterBufferSafeHandler | jitter | Jitter buffer state. |
int | request | ioctl-type request (one of the JitterBufferCtl macros). |
void* | ptr | Data exchanged to-from function. |
Returns
Type | Description |
---|---|
int | 0 if no error, -1 if request is unknown. |
jitter_buffer_destroy(IntPtr)
Destroys jitter buffer.
Declaration
public static extern void jitter_buffer_destroy(IntPtr jitter)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | jitter | Jitter buffer state. |
jitter_buffer_get(SpeexDSPJitterBufferSafeHandler, ref SpeexDSPJitterBufferPacket, int, int*)
Get one packet from the jitter buffer.
Declaration
public static extern int jitter_buffer_get(SpeexDSPJitterBufferSafeHandler jitter, ref SpeexDSPJitterBufferPacket packet, int desired_span, int* start_offset)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPJitterBufferSafeHandler | jitter | Jitter buffer state. |
SpeexDSPJitterBufferPacket | packet | Returned packet. |
int | desired_span | Number of samples (or units) we wish to get from the buffer (no guarantee). |
int* | start_offset | Timestamp for the returned packet. |
Returns
Type | Description |
---|---|
int |
jitter_buffer_get_another(SpeexDSPJitterBufferSafeHandler, ref SpeexDSPJitterBufferPacket)
Used right after jitter_buffer_get(SpeexDSPJitterBufferSafeHandler, ref SpeexDSPJitterBufferPacket, int, int*) to obtain another packet that would have the same timestamp. This is mainly useful for media where a single "frame" can be split into several packets.
Declaration
public static extern int jitter_buffer_get_another(SpeexDSPJitterBufferSafeHandler jitter, ref SpeexDSPJitterBufferPacket packet)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPJitterBufferSafeHandler | jitter | Jitter buffer state. |
SpeexDSPJitterBufferPacket | packet | Returned packet. |
Returns
Type | Description |
---|---|
int |
jitter_buffer_get_pointer_timestamp(SpeexDSPJitterBufferSafeHandler)
Get pointer timestamp of jitter buffer.
Declaration
public static extern int jitter_buffer_get_pointer_timestamp(SpeexDSPJitterBufferSafeHandler jitter)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPJitterBufferSafeHandler | jitter | Jitter buffer state. |
Returns
Type | Description |
---|---|
int | The pointer timestamp. |
jitter_buffer_init(int)
Initializes jitter buffer.
Declaration
public static extern SpeexDSPJitterBufferSafeHandler jitter_buffer_init(int step_size)
Parameters
Type | Name | Description |
---|---|---|
int | step_size | Starting value for the size of concealment packets and delay adjustment steps. Can be changed at any time using JITTER_BUFFER_SET_DELAY_STEP and JITTER_BUFFER_GET_CONCEALMENT_SIZE. |
Returns
Type | Description |
---|---|
SpeexDSPJitterBufferSafeHandler | Newly created jitter buffer state. |
jitter_buffer_put(SpeexDSPJitterBufferSafeHandler, ref SpeexDSPJitterBufferPacket)
Put one packet into the jitter buffer.
Declaration
public static extern void jitter_buffer_put(SpeexDSPJitterBufferSafeHandler jitter, ref SpeexDSPJitterBufferPacket packet)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPJitterBufferSafeHandler | jitter | Jitter buffer state. |
SpeexDSPJitterBufferPacket | packet | Incoming packet. |
jitter_buffer_remaining_span(SpeexDSPJitterBufferSafeHandler, int)
Telling the jitter buffer about the remaining data in the application buffer.
Declaration
public static extern void jitter_buffer_remaining_span(SpeexDSPJitterBufferSafeHandler jitter, int rem)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPJitterBufferSafeHandler | jitter | Jitter buffer state. |
int | rem | Amount of data buffered by the application (timestamp units). |
jitter_buffer_reset(SpeexDSPJitterBufferSafeHandler)
Restores jitter buffer to its original state.
Declaration
public static extern void jitter_buffer_reset(SpeexDSPJitterBufferSafeHandler jitter)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPJitterBufferSafeHandler | jitter | Jitter buffer state. |
jitter_buffer_tick(SpeexDSPJitterBufferSafeHandler)
Advance by one tick.
Declaration
public static extern void jitter_buffer_tick(SpeexDSPJitterBufferSafeHandler jitter)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPJitterBufferSafeHandler | jitter | Jitter buffer state. |
jitter_buffer_update_delay(SpeexDSPJitterBufferSafeHandler, ref SpeexDSPJitterBufferPacket, int*)
N.A.
Declaration
public static extern int jitter_buffer_update_delay(SpeexDSPJitterBufferSafeHandler jitter, ref SpeexDSPJitterBufferPacket packet, int* start_offset)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPJitterBufferSafeHandler | jitter | |
SpeexDSPJitterBufferPacket | packet | |
int* | start_offset |
Returns
Type | Description |
---|---|
int |
speex_echo_cancellation(SpeexDSPEchoStateSafeHandler, short*, short*, short*)
Performs echo cancellation a frame, based on the audio sent to the speaker (no delay is added to playback in this form).
Declaration
public static extern void speex_echo_cancellation(SpeexDSPEchoStateSafeHandler st, short* rec, short* play, short* output)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPEchoStateSafeHandler | st | Echo canceler state. |
short* | rec | Signal from the microphone (near end + far end echo). |
short* | play | Signal played to the speaker (received from far end). |
short* | output | Returns near-end signal with echo removed. |
speex_echo_capture(SpeexDSPEchoStateSafeHandler, short*, short*)
Perform echo cancellation using internal playback buffer, which is delayed by two frames to account for the delay introduced by most sound cards (but it could be off!).
Declaration
public static extern void speex_echo_capture(SpeexDSPEchoStateSafeHandler st, short* rec, short* output)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPEchoStateSafeHandler | st | Echo canceler state. |
short* | rec | Signal from the microphone (near end + far end echo). |
short* | output | Returns near-end signal with echo removed. |
speex_echo_ctl(SpeexDSPEchoStateSafeHandler, int, void*)
Used like the ioctl function to control the echo canceler parameters.
Declaration
public static extern int speex_echo_ctl(SpeexDSPEchoStateSafeHandler st, int request, void* ptr)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPEchoStateSafeHandler | st | Echo canceler state. |
int | request | ioctl-type request (one of the EchoCancellationCtl macros). |
void* | ptr | Data exchanged to-from function. |
Returns
Type | Description |
---|---|
int | 0 if no error, -1 if request in unknown. |
speex_echo_playback(SpeexDSPEchoStateSafeHandler, short*)
Let the echo canceler know that a frame was just queued to the sound card.
Declaration
public static extern void speex_echo_playback(SpeexDSPEchoStateSafeHandler st, short* play)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPEchoStateSafeHandler | st | Echo canceler state. |
short* | play | Signal played to the speaker (received from far end). |
speex_echo_state_destroy(IntPtr)
Destroys an echo canceler state.
Declaration
public static extern void speex_echo_state_destroy(IntPtr st)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | st | Echo canceler state. |
speex_echo_state_init(int, int)
Creates a new echo canceler state.
Declaration
public static extern SpeexDSPEchoStateSafeHandler speex_echo_state_init(int frame_size, int filter_length)
Parameters
Type | Name | Description |
---|---|---|
int | frame_size | Number of samples to process at one time (should correspond to 10-20 ms). |
int | filter_length | Number of samples of echo to cancel (should generally correspond to 100-500 ms). |
Returns
Type | Description |
---|---|
SpeexDSPEchoStateSafeHandler | Newly-created echo canceler state. |
speex_echo_state_init_mc(int, int, int, int)
Creates a new multi-channel echo canceler state.
Declaration
public static extern SpeexDSPEchoStateSafeHandler speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speaker)
Parameters
Type | Name | Description |
---|---|---|
int | frame_size | Number of samples to process at one time (should correspond to 10-20 ms). |
int | filter_length | Number of samples of echo to cancel (should generally correspond to 100-500 ms). |
int | nb_mic | Number of microphone channels. |
int | nb_speaker | Number of speaker channels. |
Returns
Type | Description |
---|---|
SpeexDSPEchoStateSafeHandler | Newly-created echo canceler state. |
speex_echo_state_reset(SpeexDSPEchoStateSafeHandler)
Reset the echo canceler to its original state.
Declaration
public static extern void speex_echo_state_reset(SpeexDSPEchoStateSafeHandler st)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPEchoStateSafeHandler | st | Echo canceler state. |
speex_preprocess_ctl(SpeexDSPPreprocessStateSafeHandler, int, void*)
Used like the ioctl function to control the preprocessor parameters.
Declaration
public static extern int speex_preprocess_ctl(SpeexDSPPreprocessStateSafeHandler st, int request, void* ptr)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPPreprocessStateSafeHandler | st | Preprocessor state. |
int | request | request ioctl-type request (one of the SPEEX_PREPROCESS_* macros). |
void* | ptr | Data exchanged to-from function. |
Returns
Type | Description |
---|---|
int | 0 if no error, -1 if request in unknown. |
speex_preprocess_estimate_update(SpeexDSPPreprocessStateSafeHandler, short*)
Update preprocessor state, but do not compute the output.
Declaration
public static extern void speex_preprocess_estimate_update(SpeexDSPPreprocessStateSafeHandler st, short* x)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPPreprocessStateSafeHandler | st | Preprocessor state. |
short* | x | Audio sample vector (in only). Must be same size as specified in speex_preprocess_state_init(int, int). |
speex_preprocess_run(SpeexDSPPreprocessStateSafeHandler, short*)
Preprocess a frame.
Declaration
public static extern int speex_preprocess_run(SpeexDSPPreprocessStateSafeHandler st, short* x)
Parameters
Type | Name | Description |
---|---|---|
SpeexDSPPreprocessStateSafeHandler | st | Preprocessor state. |
short* | x | Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init(int, int). |
Returns
Type | Description |
---|---|
int | Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on. |
speex_preprocess_state_destroy(IntPtr)
Destroys a preprocessor state.
Declaration
public static extern void speex_preprocess_state_destroy(IntPtr st)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | st | Preprocessor state to destroy. |
speex_preprocess_state_init(int, int)
Creates a new preprocessing state. You MUST create one state per channel processed.
Declaration
public static extern SpeexDSPPreprocessStateSafeHandler speex_preprocess_state_init(int frame_size, int sampling_rate)
Parameters
Type | Name | Description |
---|---|---|
int | frame_size | Number of samples to process at one time (should correspond to 10-20 ms). Must be the same value as that used for the echo canceler for residual echo cancellation to work. |
int | sampling_rate | Sampling rate used for the input. |
Returns
Type | Description |
---|---|
SpeexDSPPreprocessStateSafeHandler | Newly created preprocessor state. |