add snd_seq_client_info_event_filter_*() functions

Added snd_seq_client_info_event_filter_{clear,add,del,check} to alsa
sequencer API

Signed-off-by: Aldrin Martoq <amartoq@dcc.uchile.cl>
This commit is contained in:
Aldrin Martoq 2008-02-22 17:46:50 +01:00 committed by Takashi Iwai
parent 882f93ac26
commit 75ecdac6f4
2 changed files with 86 additions and 0 deletions

View File

@ -153,6 +153,11 @@ void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int v
void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);
void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);
void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info);
void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type);
void snd_seq_client_info_event_filter_del(snd_seq_client_info_t *info, int event_type);
int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int event_type);
int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);
int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);

View File

@ -1537,6 +1537,87 @@ const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_i
return NULL;
}
/**
* \brief Disable event filtering of a client_info container
* \param info client_info container
*
* Remove all event types added with #snd_seq_client_info_event_filter_add and clear
* the event filtering flag of this client_info container.
*
* \sa snd_seq_client_info_event_filter_add(),
* snd_seq_client_info_event_filter_del(),
* snd_seq_client_info_event_filter_check(),
* snd_seq_get_client_info(),
* snd_seq_set_client_info()
*/
void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info)
{
assert(info);
info->filter &= ~SNDRV_SEQ_FILTER_USE_EVENT;
memset(info->event_filter, 0, sizeof(info->event_filter));
}
/**
* \brief Add an event type to the event filtering of a client_info container
* \param info client_info container
* \param event_type event type to be added
*
* Set the event filtering flag of this client_info and add the specified event type to the
* filter bitmap of this client_info container.
*
* \sa snd_seq_get_client_info(),
* snd_seq_set_client_info(),
* snd_seq_client_info_event_filter_del(),
* snd_seq_client_info_event_filter_check(),
* snd_seq_client_info_event_filter_clear()
*/
void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type)
{
assert(info);
info->filter |= SNDRV_SEQ_FILTER_USE_EVENT;
snd_seq_set_bit(event_type, info->event_filter);
}
/**
* \brief Remove an event type from the event filtering of a client_info container
* \param info client_info container
* \param event_type event type to be removed
*
* Removes the specified event from the filter bitmap of this client_info container. It will
* not clear the event filtering flag, use #snd_seq_client_info_event_filter_clear instead.
*
* \sa snd_seq_get_client_info(),
* snd_seq_set_client_info(),
* snd_seq_client_info_event_filter_add(),
* snd_seq_client_info_event_filter_check(),
* snd_seq_client_info_event_filter_clear()
*/
void snd_seq_client_info_event_filter_del(snd_seq_client_info_t *info, int event_type)
{
assert(info);
snd_seq_unset_bit(event_type, info->event_filter);
}
/**
* \brief Check if an event type is present in the event filtering of a client_info container
* \param info client_info container
* \param event_type event type to be checked
* \return 1 if the event type is present, 0 otherwise
*
* Test if the event type is in the filter bitamp of this client_info container.
*
* \sa snd_seq_get_client_info(),
* snd_seq_set_client_info(),
* snd_seq_client_info_event_filter_add(),
* snd_seq_client_info_event_filter_del(),
* snd_seq_client_info_event_filter_clear()
*/
int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int event_type)
{
assert(info);
return snd_seq_get_bit(event_type, info->event_filter);
}
/**
* \brief Get the number of opened ports of a client_info container
* \param info client_info container