Blame modules/mixer/simple/sbase.h

Packit 4a16fb
/*
Packit 4a16fb
 *  Mixer Interface - simple abstact module - base library
Packit 4a16fb
 *  Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
Packit 4a16fb
 *
Packit 4a16fb
 *
Packit 4a16fb
 *   This library is free software; you can redistribute it and/or modify
Packit 4a16fb
 *   it under the terms of the GNU Lesser General Public License as
Packit 4a16fb
 *   published by the Free Software Foundation; either version 2.1 of
Packit 4a16fb
 *   the License, or (at your option) any later version.
Packit 4a16fb
 *
Packit 4a16fb
 *   This program is distributed in the hope that it will be useful,
Packit 4a16fb
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 4a16fb
 *   GNU Lesser General Public License for more details.
Packit 4a16fb
 *
Packit 4a16fb
 *   You should have received a copy of the GNU Lesser General Public
Packit 4a16fb
 *   License along with this library; if not, write to the Free Software
Packit 4a16fb
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit 4a16fb
 *
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
#ifndef __SMIXER_BASE_H
Packit 4a16fb
Packit 4a16fb
#include "list.h"
Packit 4a16fb
Packit 4a16fb
#define MAX_CHANNEL	6
Packit 4a16fb
Packit 4a16fb
#define SID_MASTER	0
Packit 4a16fb
#define SID_HEADPHONE	1
Packit 4a16fb
#define SID_FRONT	2
Packit 4a16fb
#define SID_PCM		3
Packit 4a16fb
#define SID_CD		4
Packit 4a16fb
Packit 4a16fb
struct melem_sids {
Packit 4a16fb
	unsigned short sid;
Packit 4a16fb
	const char *sname;
Packit 4a16fb
	unsigned short sindex;
Packit 4a16fb
	unsigned short weight;
Packit 4a16fb
	unsigned int chanmap[2];
Packit 4a16fb
	struct sm_elem_ops *sops;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
#define PURPOSE_VOLUME		0
Packit 4a16fb
#define PURPOSE_SWITCH		1
Packit 4a16fb
#define PURPOSE_ENUMLIST	2
Packit 4a16fb
Packit 4a16fb
struct helem_selector {
Packit 4a16fb
	snd_ctl_elem_iface_t iface;
Packit 4a16fb
	const char *name;
Packit 4a16fb
	unsigned short index;
Packit 4a16fb
	unsigned short sid;
Packit 4a16fb
	unsigned short purpose;
Packit 4a16fb
	unsigned short caps;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
struct helem_base {
Packit 4a16fb
	struct list_head list;
Packit 4a16fb
	snd_hctl_elem_t *helem;
Packit 4a16fb
	unsigned short purpose;
Packit 4a16fb
	unsigned int caps;
Packit 4a16fb
	unsigned int inactive: 1;
Packit 4a16fb
	long min, max;
Packit 4a16fb
	unsigned int count;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
struct selem_base {
Packit 4a16fb
	sm_selem_t selem;
Packit 4a16fb
	struct list_head helems;
Packit 4a16fb
	unsigned short sid;
Packit 4a16fb
	struct {
Packit 4a16fb
		unsigned int chanmap;
Packit 4a16fb
		unsigned int forced_range: 1;
Packit 4a16fb
		long min, max;
Packit 4a16fb
		long vol[MAX_CHANNEL];
Packit 4a16fb
	} dir[2];
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
struct bclass_selector {
Packit 4a16fb
	struct list_head list;
Packit 4a16fb
	struct helem_selector *selectors;
Packit 4a16fb
	unsigned int count;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
struct bclass_sid {
Packit 4a16fb
	struct list_head list;
Packit 4a16fb
	struct melem_sids *sids;
Packit 4a16fb
	unsigned int count;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
typedef struct bclass_base_ops {
Packit 4a16fb
	int (*event)(snd_mixer_class_t *class, unsigned int mask,
Packit 4a16fb
		     snd_hctl_elem_t *helem, snd_mixer_elem_t *melem);
Packit 4a16fb
	int (*selreg)(snd_mixer_class_t *class,
Packit 4a16fb
		      struct helem_selector *selectors,
Packit 4a16fb
		      unsigned int count);
Packit 4a16fb
	int (*sidreg)(snd_mixer_class_t *class,
Packit 4a16fb
		      struct melem_sids *sids,
Packit 4a16fb
		      unsigned int count);
Packit 4a16fb
} bclass_base_ops_t;
Packit 4a16fb
Packit 4a16fb
struct bclass_private {
Packit 4a16fb
	struct list_head selectors;
Packit 4a16fb
	struct list_head sids;
Packit 4a16fb
	void *dl_sbase;
Packit 4a16fb
	bclass_base_ops_t ops;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
Packit 4a16fb
			      bclass_base_ops_t **ops);
Packit 4a16fb
Packit 4a16fb
#endif /* __SMIXER_BASE_H */