External I/O plugin SDK

Overview

See the PCM (digital audio) interface page for more details. Moreā€¦

// typedefs

typedef snd_pcm_ioplug snd_pcm_ioplug_t;
typedef snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;

// enums

enum {
    @6::SND_PCM_IOPLUG_HW_ACCESS       = 0,
    @6::SND_PCM_IOPLUG_HW_FORMAT,
    @6::SND_PCM_IOPLUG_HW_CHANNELS,
    @6::SND_PCM_IOPLUG_HW_RATE,
    @6::SND_PCM_IOPLUG_HW_PERIOD_BYTES,
    @6::SND_PCM_IOPLUG_HW_BUFFER_BYTES,
    @6::SND_PCM_IOPLUG_HW_PERIODS,
    @6::SND_PCM_IOPLUG_HW_PARAMS,
};

// structs

struct snd_pcm_ioplug;
struct snd_pcm_ioplug_callback;

// global functions

int
snd_pcm_ioplug_create(
    snd_pcm_ioplug_t* io,
    const char* name,
    snd_pcm_stream_t stream,
    int mode
);

int
snd_pcm_ioplug_delete(snd_pcm_ioplug_t* io);

int
snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t* ioplug);

const snd_pcm_channel_area_t*
snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t* ioplug);

void
snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t* io);

int
snd_pcm_ioplug_set_param_minmax(
    snd_pcm_ioplug_t* io,
    int type,
    unsigned int min,
    unsigned int max
);

int
snd_pcm_ioplug_set_param_list(
    snd_pcm_ioplug_t* io,
    int type,
    unsigned int num_list,
    const unsigned int* list
);

int
snd_pcm_ioplug_set_state(
    snd_pcm_ioplug_t* ioplug,
    snd_pcm_state_t state
);

// macros

#define SND_PCM_IOPLUG_FLAG_LISTED
#define SND_PCM_IOPLUG_FLAG_MONOTONIC
#define SND_PCM_IOPLUG_VERSION
#define SND_PCM_IOPLUG_VERSION_MAJOR
#define SND_PCM_IOPLUG_VERSION_MINOR
#define SND_PCM_IOPLUG_VERSION_TINY

Detailed Documentation

See the PCM (digital audio) interface page for more details.

Enum Values

SND_PCM_IOPLUG_HW_ACCESS

access type

SND_PCM_IOPLUG_HW_FORMAT

format

SND_PCM_IOPLUG_HW_CHANNELS

channels

SND_PCM_IOPLUG_HW_RATE

rate

SND_PCM_IOPLUG_HW_PERIOD_BYTES

period bytes

SND_PCM_IOPLUG_HW_BUFFER_BYTES

buffer bytes

SND_PCM_IOPLUG_HW_PERIODS

number of periods

SND_PCM_IOPLUG_HW_PARAMS

max number of hw constraints

Typedefs

typedef snd_pcm_ioplug snd_pcm_ioplug_t

I/O plugin handle

typedef snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t

Callback table of ioplug

Global Functions

int
snd_pcm_ioplug_create(
    snd_pcm_ioplug_t* io,
    const char* name,
    snd_pcm_stream_t stream,
    int mode
)

Create an ioplug instance.

Creates the ioplug instance.

The callback is the mandatory field of ioplug handle. At least, start, stop and pointer callbacks must be set before calling this function.

Parameters:

ioplug

the ioplug handle

name

name of PCM

stream

stream direction

mode

PCM open mode

Returns:

0 if successful, or a negative error code

int
snd_pcm_ioplug_delete(snd_pcm_ioplug_t* io)

Delete the ioplug instance.

Parameters:

ioplug

the ioplug handle

Returns:

0 if successful, or a negative error code

int
snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t* ioplug)

Reinitialize the poll and mmap status.

Reinitializes the poll and the mmap status of the PCM. Call this function to propagate the status change in the ioplug instance to its PCM internals.

Parameters:

ioplug

the ioplug handle

Returns:

0 if successful, or a negative error code

const snd_pcm_channel_area_t*
snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t* ioplug)

Get mmap area of ioplug.

Returns the mmap channel areas if available. When mmap_rw field is not set, this function always returns NULL.

Parameters:

ioplug

the ioplug handle

Returns:

the mmap channel areas if available, or NULL

void
snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t* io)

Reset ioplug parameters.

Resets the all parameters for the given ioplug handle.

Parameters:

ioplug

the ioplug handle

int
snd_pcm_ioplug_set_param_minmax(
    snd_pcm_ioplug_t* io,
    int type,
    unsigned int min,
    unsigned int max
)

Set parameter as the min/max values.

Sets the parameter as the min/max values. The available values of the given parameter type is restricted between the given minimum and maximum values.

Parameters:

ioplug

the ioplug handle

type

parameter type

min

the minimum value

max

the maximum value

Returns:

0 if successful, or a negative error code

int
snd_pcm_ioplug_set_param_list(
    snd_pcm_ioplug_t* io,
    int type,
    unsigned int num_list,
    const unsigned int* list
)

Set parameter as the list.

Sets the parameter as the list. The available values of the given parameter type is restricted to the ones of the given list.

Parameters:

ioplug

the ioplug handle

type

parameter type

num_list

number of available values

list

the list of available values

Returns:

0 if successful, or a negative error code

int
snd_pcm_ioplug_set_state(
    snd_pcm_ioplug_t* ioplug,
    snd_pcm_state_t state
)

Change the ioplug PCM status.

Changes the PCM status of the ioplug to the given value. This function can be used for external plugins to notify the status change, e.g. XRUN.

Parameters:

ioplug

the ioplug handle

state

the PCM status

Returns:

zero if successful or a negative error code

Macros

#define SND_PCM_IOPLUG_FLAG_LISTED

list up this PCM

#define SND_PCM_IOPLUG_FLAG_MONOTONIC

monotonic timestamps

#define SND_PCM_IOPLUG_VERSION

IO-plugin protocol version

#define SND_PCM_IOPLUG_VERSION_MAJOR

Protocol major version

#define SND_PCM_IOPLUG_VERSION_MINOR

Protocol minor version

#define SND_PCM_IOPLUG_VERSION_TINY

Protocol tiny version