mediastreamer2 2.12.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Functions
Sound Card Filter API
Mediastreamer2's base APIs » Sound Card API - Manage audio capture/play filters

## Functions
struct _MSFilter * | ms_snd_card_create_reader (MSSndCard *obj)
struct _MSFilter * | ms_snd_card_create_writer (MSSndCard *obj)
MSSndCard * | ms_snd_card_new (MSSndCardDesc *desc)
MSSndCard * | ms_snd_card_new_with_name (MSSndCardDesc *desc, const char *name)
void | ms_snd_card_destroy (MSSndCard *obj)
MSSndCard * | ms_snd_card_dup (MSSndCard *card)
const char * | ms_snd_card_get_driver_type (const MSSndCard *obj)
const char * | ms_snd_card_get_name (const MSSndCard *obj)
const char * | ms_snd_card_get_string_id (MSSndCard *obj)
unsigned int | ms_snd_card_get_capabilities (const MSSndCard *obj)
int | ms_snd_card_get_minimal_latency (MSSndCard *obj)
void | ms_snd_card_set_level (MSSndCard *obj, MSSndCardMixerElem e, int percent)
int | ms_snd_card_get_level (MSSndCard *obj, MSSndCardMixerElem e)
void | ms_snd_card_set_capture (MSSndCard *obj, MSSndCardCapture c)
int | ms_snd_card_set_control (MSSndCard *obj, MSSndCardControlElem e, int val)
int | ms_snd_card_get_control (MSSndCard *obj, MSSndCardControlElem e)
int | ms_snd_card_get_preferred_sample_rate (const MSSndCard *obj)
int | ms_snd_card_set_preferred_sample_rate (MSSndCard *obj, int rate)
void | ms_snd_card_set_usage_hint (MSSndCard *obj, bool_t is_going_to_be_used)
MSSndCard * | ms_alsa_card_new_custom (const char *pcmdev, const char *mixdev)
void | ms_alsa_card_set_forced_sample_rate (int samplerate)

## Detailed Description

## Function Documentation

struct _MSFilter* ms_snd_card_create_reader | ( | MSSndCard * | obj | ) |

Create an INPUT filter based on the selected sound card.

Parameters

  obj | A sound card object.

Returns: A MSFilter if successfull, NULL otherwise.

struct _MSFilter* ms_snd_card_create_writer | ( | MSSndCard * | obj | ) |

Create an OUPUT filter based on the selected sound card.

Parameters

  obj | A sound card object.

Returns: A MSFilter if successfull, NULL otherwise.

MSSndCard* ms_snd_card_new | ( | MSSndCardDesc * | desc | ) |

Create a new sound card object.

Parameters

  desc | A sound card description object.

Returns: MSSndCard if successfull, NULL otherwise.

MSSndCard* ms_snd_card_new_with_name | ( | MSSndCardDesc * | desc,
|  | const char * | name
| ) |  |

Create a new sound card object.

Parameters

  desc | A sound card description object.
  name | The card name

Returns: MSSndCard if successfull, NULL otherwise.

<This sound card can capture sound

<This sound card can playback sound

void ms_snd_card_destroy | ( | MSSndCard * | obj | ) |

Destroy sound card object.

Parameters

  obj | A MSSndCard object.

MSSndCard* ms_snd_card_dup | ( | MSSndCard * | card | ) |

Duplicate a sound card object.

This helps to open several time a sound card.

Parameters

  card | A sound card object.

Returns: MSSndCard if successfull, NULL otherwise.

const char* ms_snd_card_get_driver_type | ( | const MSSndCard * | obj | ) |

Retreive a sound card's driver type string.

Internal driver types are either: "OSS, ALSA, WINSND, PASND, CA"

Parameters

  obj | A sound card object.

Returns: a string if successfull, NULL otherwise.

const char* ms_snd_card_get_name | ( | const MSSndCard * | obj | ) |

Retreive a sound card's name.

Parameters

  obj | A sound card object.

Returns: a string if successfull, NULL otherwise.

const char* ms_snd_card_get_string_id | ( | MSSndCard * | obj | ) |

Retreive sound card's name (

driver_type

name).

Parameters

  obj | A sound card object.

Returns: A string if successfull, NULL otherwise.

unsigned int ms_snd_card_get_capabilities | ( | const MSSndCard * | obj | ) |

Retreive sound card's capabilities.

      MS_SND_CARD_CAP_CAPTURE
      MS_SND_CARD_CAP_PLAYBACK
      MS_SND_CARD_CAP_CAPTURE|MS_SND_CARD_CAP_PLAYBACK
      MS_SND_CARD_CAP_BUILTIN_ECHO_CANCELLER

Parameters

  obj | A sound card object.

Returns: A unsigned int if successfull, 0 otherwise.

int ms_snd_card_get_minimal_latency | ( | MSSndCard * | obj | ) |

Returns the sound card minimal latency (playback+record), in milliseconds. This value is to be used by the software echo cancellers to know where to search for the echo (optimization). Typically, an echo shall not be found before the value returned by this function. If this value is not known, then it should return 0.

Parameters

  obj | A sound card object.

void ms_snd_card_set_level | ( | MSSndCard * | obj,
|  | MSSndCardMixerElem | e,
|  | int | percent
| ) |  |

Set some mixer level value.

      MS_SND_CARD_MASTER,
      MS_SND_CARD_PLAYBACK,
      MS_SND_CARD_CAPTURE

Note: not implemented on all sound card filters.

Parameters

  obj | A sound card object.
  e | A sound card mixer object.
  percent | A volume level.

int ms_snd_card_get_level | ( | MSSndCard * | obj,
|  | MSSndCardMixerElem | e
| ) |  |

Get some mixer level value.

      MS_SND_CARD_MASTER,
      MS_SND_CARD_PLAYBACK,
      MS_SND_CARD_CAPTURE

Note: not implemented on all sound card filters.

Parameters

  obj | A sound card object.
  e | A sound card mixer object.

Returns: A int if successfull, <0 otherwise.

void ms_snd_card_set_capture | ( | MSSndCard * | obj,
|  | MSSndCardCapture | c
| ) |  |

Set some source for capture.

      MS_SND_CARD_MIC,
      MS_SND_CARD_LINE

Note: not implemented on all sound card filters.

Parameters

  obj | A sound card object.
  c | A sound card capture value.

Returns: A int if successfull, 0 otherwise.

int ms_snd_card_set_control | ( | MSSndCard * | obj,
|  | MSSndCardControlElem | e,
|  | int | val
| ) |  |

Set some mixer control.

      MS_SND_CARD_MASTER_MUTE, -> 0: unmute, 1: mute
      MS_SND_CARD_PLAYBACK_MUTE, -> 0: unmute, 1: mute
      MS_SND_CARD_CAPTURE_MUTE -> 0: unmute, 1: mute

Note: not implemented on all sound card filters.

Parameters

  obj | A sound card object.
  e | A sound card control object.
  val | A value for control.

Returns: 0 if successfull, <0 otherwise.

int ms_snd_card_get_control | ( | MSSndCard * | obj,
|  | MSSndCardControlElem | e
| ) |  |

Get some mixer control.

      MS_SND_CARD_MASTER_MUTE, -> return 0: unmute, 1: mute
      MS_SND_CARD_PLAYBACK_MUTE, -> return 0: unmute, 1: mute
      MS_SND_CARD_CAPTURE_MUTE -> return 0: unmute, 1: mute

Note: not implemented on all sound card filters.

Parameters

  obj | A sound card object.
  e | A sound card mixer object.

Returns: A int if successfull, <0 otherwise.

int ms_snd_card_get_preferred_sample_rate | ( | const MSSndCard * | obj | ) |

Get preferred sample rate

Parameters

  obj | A sound card object.

Returns: return sample rate in khz

int ms_snd_card_set_preferred_sample_rate | ( | MSSndCard * | obj,
|  | int | rate
| ) |  |

set preferred sample rate. The underlying card will try to avoid any resampling for this samplerate.

Parameters

  obj | A sound card object.
  rate | sampling rate.

Returns: 0 if successfull, <0 otherwise.

void ms_snd_card_set_usage_hint | ( | MSSndCard * | obj,
|  | bool_t | is_going_to_be_used
| ) |  |

Enable application to tell that the soundcard is going to be used or will cease to be used. This is recommended for cards which are known to be slow (see flag MS_SND_CARD_CAP_IS_SLOW ).

MSSndCard* ms_alsa_card_new_custom | ( | const char * | pcmdev,
|  | const char * | mixdev
| ) |  |

Create a alsa card with user supplied pcm name and mixer name.

Parameters

  pcmdev | The pcm device name following alsa conventions (ex: plughw:0)
  mixdev | The mixer device name following alsa conventions.

Returns: a MSSndCard object, NULL if alsa support is not available.

void ms_alsa_card_set_forced_sample_rate | ( | int | samplerate | ) |

Use supplied sample rate to open alsa devices (forced rate). Has no interest except workarouding driver bugs. Use -1 to revert to normal behavior.