snd_seq_remove_events

Name

snd_seq_remove_events -- remove events on input/output buffers

Synopsis

int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);

Description

Removes matching events with the given condition from input/output buffers. The removal condition is specified in info argument, which takes the following structure:

/* Remove events by specified criteria */
typedef struct snd_seq_remove_events {
	int tick:1; 		/* True when time is in ticks */
	int input:1; 		/* Flush input queues */
	int output:1; 		/* Flush output queues */

	int  remove_mode;	/* Flags that determine what gets removed */

	snd_seq_timestamp_t time;

	unsigned char queue;	/* Queue for REMOVE_DEST */
	snd_seq_addr_t dest;	/* Address for REMOVE_DEST */
	unsigned char channel;	/* Channel for REMOVE_DEST */

	int  type;	/* For REMOVE_EVENT_TYPE */
	char  tag;	/* Tag for REMOVE_TAG */

	int  reserved[10];	/* To allow for future binary compatibility */

} snd_seq_remove_events_t;
If input is set to 1, events on input buffer (on both user and kernel space) are handled. Likewise, if output fields is 1, events on output buffer are handled.

The removal condition is defined in remove_mode field. It is a bit mask which accepts the following bit flags:

ValueDescription
SND_SEQ_REMOVE_DEST Only the events with a certain destination address and queue are removed. The conditional address and queue are given in dest and queue fields, respectively.
SND_SEQ_REMOVE_DEST_CHANNEL Only the events with the channel specified in channel field are removed.
SND_SEQ_REMOVE_TIME_BEFORE Only the events scheduled before the given time in time field are removed. The type of time-stamp is specified in tick field.
SND_SEQ_REMOVE_TIME_AFTER Only the events scheduled after the given time in time field are removed. The type of time-stamp is specified in tick field.
SND_SEQ_REMOVE_EVENT_TYPE Only the events with the given event type in type field are removed.
SND_SEQ_REMOVE_IGNORE_OFF Leaves note-off on buffer events to avoid hang of playing notes.
SND_SEQ_REMOVE_TAG_MATCH Only the events with the tag specified in tag field are removed.

If these flags are defined are an event doesn't match the conditions above, the event is left on buffer without removed. That is, in order to remove all events, give 0 as the condition. So far, the condition for removal of input events is limited only 0 ("remove all").

Function returns zero if successful, or a negative error code.