xref: /freebsd/sys/dev/sound/pcm/feeder_if.m (revision 031beb4e239bfce798af17f5fe8dba8bcaf13d99)
1098ca2bdSWarner Losh#-
200d6c0c6SCameron Grant# KOBJ
30f55ac6cSCameron Grant#
40f55ac6cSCameron Grant# Copyright (c) 2000 Cameron Grant <cg@freebsd.org>
50f55ac6cSCameron Grant# All rights reserved.
60f55ac6cSCameron Grant#
70f55ac6cSCameron Grant# Redistribution and use in source and binary forms, with or without
80f55ac6cSCameron Grant# modification, are permitted provided that the following conditions
90f55ac6cSCameron Grant# are met:
100f55ac6cSCameron Grant# 1. Redistributions of source code must retain the above copyright
110f55ac6cSCameron Grant#    notice, this list of conditions and the following disclaimer.
120f55ac6cSCameron Grant# 2. Redistributions in binary form must reproduce the above copyright
130f55ac6cSCameron Grant#    notice, this list of conditions and the following disclaimer in the
140f55ac6cSCameron Grant#    documentation and/or other materials provided with the distribution.
150f55ac6cSCameron Grant#
160f55ac6cSCameron Grant# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
170f55ac6cSCameron Grant# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
180f55ac6cSCameron Grant# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
190f55ac6cSCameron Grant# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
200f55ac6cSCameron Grant# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
210f55ac6cSCameron Grant# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
220f55ac6cSCameron Grant# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
230f55ac6cSCameron Grant# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
240f55ac6cSCameron Grant# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
250f55ac6cSCameron Grant# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
260f55ac6cSCameron Grant# SUCH DAMAGE.
270f55ac6cSCameron Grant#
280f55ac6cSCameron Grant#
290f55ac6cSCameron Grant
300f55ac6cSCameron Grant#include <dev/sound/pcm/sound.h>
310f55ac6cSCameron Grant
320f55ac6cSCameron GrantINTERFACE feeder;
330f55ac6cSCameron Grant
340f55ac6cSCameron GrantCODE {
350f55ac6cSCameron Grant
360f55ac6cSCameron Grant	static int
3766ef8af5SCameron Grant	feeder_noinit(struct pcm_feeder* feeder)
380f55ac6cSCameron Grant	{
390f55ac6cSCameron Grant		return 0;
400f55ac6cSCameron Grant	}
410f55ac6cSCameron Grant
420f55ac6cSCameron Grant	static int
4366ef8af5SCameron Grant	feeder_nofree(struct pcm_feeder* feeder)
440f55ac6cSCameron Grant	{
450f55ac6cSCameron Grant		return 0;
460f55ac6cSCameron Grant	}
470f55ac6cSCameron Grant
484dce8540SCameron Grant	static int
494dce8540SCameron Grant	feeder_noset(struct pcm_feeder* feeder, int what, int value)
504dce8540SCameron Grant	{
514dce8540SCameron Grant		return -1;
524dce8540SCameron Grant	}
534dce8540SCameron Grant
544dce8540SCameron Grant	static int
554dce8540SCameron Grant	feeder_noget(struct pcm_feeder* feeder, int what)
564dce8540SCameron Grant	{
574dce8540SCameron Grant		return -1;
584dce8540SCameron Grant	}
594dce8540SCameron Grant
600f55ac6cSCameron Grant};
610f55ac6cSCameron Grant
620f55ac6cSCameron GrantMETHOD int init {
6366ef8af5SCameron Grant	struct pcm_feeder* feeder;
640f55ac6cSCameron Grant} DEFAULT feeder_noinit;
650f55ac6cSCameron Grant
660f55ac6cSCameron GrantMETHOD int free {
6766ef8af5SCameron Grant	struct pcm_feeder* feeder;
680f55ac6cSCameron Grant} DEFAULT feeder_nofree;
690f55ac6cSCameron Grant
700f55ac6cSCameron GrantMETHOD int set {
7166ef8af5SCameron Grant	struct pcm_feeder* feeder;
720f55ac6cSCameron Grant	int what;
730f55ac6cSCameron Grant	int value;
744dce8540SCameron Grant} DEFAULT feeder_noset;
754dce8540SCameron Grant
764dce8540SCameron GrantMETHOD int get {
774dce8540SCameron Grant	struct pcm_feeder* feeder;
784dce8540SCameron Grant	int what;
794dce8540SCameron Grant} DEFAULT feeder_noget;
800f55ac6cSCameron Grant
810f55ac6cSCameron GrantMETHOD int feed {
8266ef8af5SCameron Grant	struct pcm_feeder* feeder;
8366ef8af5SCameron Grant	struct pcm_channel* c;
840f55ac6cSCameron Grant	u_int8_t* buffer;
850f55ac6cSCameron Grant	u_int32_t count;
8666ef8af5SCameron Grant	void* source;
870f55ac6cSCameron Grant};
88