mixer_api.h 1.92 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * Copyright (C) 2003-2009 The Music Player Daemon Project
 * http://www.musicpd.org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
18 19 20 21 22 23

#ifndef MPD_MIXER_H
#define MPD_MIXER_H

#include "conf.h"

Viliam Mateicka's avatar
Viliam Mateicka committed
24 25
/*
 * list of currently implemented mixers
26 27
 */

28 29
extern const struct mixer_plugin alsa_mixer;
extern const struct mixer_plugin oss_mixer;
Viliam Mateicka's avatar
Viliam Mateicka committed
30 31

struct mixer_plugin {
32 33
	/**
         * Alocates and configures a mixer device.
Viliam Mateicka's avatar
Viliam Mateicka committed
34
	 */
35
	struct mixer *(*init)(const struct config_param *param);
Viliam Mateicka's avatar
Viliam Mateicka committed
36 37 38 39

        /**
	 * Finish and free mixer data
         */
40
        void (*finish)(struct mixer *data);
Viliam Mateicka's avatar
Viliam Mateicka committed
41 42 43 44

        /**
    	 * Open mixer device
	 */
45
	bool (*open)(struct mixer *data);
Viliam Mateicka's avatar
Viliam Mateicka committed
46 47 48 49

        /**
	 * Control mixer device.
         */
50
	bool (*control)(struct mixer *data, int cmd, void *arg);
Viliam Mateicka's avatar
Viliam Mateicka committed
51 52 53 54

        /**
    	 * Close mixer device
	 */
55
	void (*close)(struct mixer *data);
Viliam Mateicka's avatar
Viliam Mateicka committed
56 57 58
};

struct mixer {
59
	const struct mixer_plugin *plugin;
Viliam Mateicka's avatar
Viliam Mateicka committed
60 61
};

62 63 64 65 66
static inline void
mixer_init(struct mixer *mixer, const struct mixer_plugin *plugin)
{
	mixer->plugin = plugin;
}
67 68

struct mixer *
69
mixer_new(const struct mixer_plugin *plugin, const struct config_param *param);
70 71 72 73

void
mixer_free(struct mixer *mixer);

Viliam Mateicka's avatar
Viliam Mateicka committed
74 75 76
bool mixer_open(struct mixer *mixer);
bool mixer_control(struct mixer *mixer, int cmd, void *arg);
void mixer_close(struct mixer *mixer);
77 78

#endif