source: mainline/uspace/drv/audio/sb16/mixer_iface.c

Last change on this file was 1433ecda, checked in by Jiri Svoboda <jiri@…>, 7 years ago

Fix cstyle: make ccheck-fix and commit only files where all the changes are good.

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 * Copyright (c) 2011 Jan Vesely
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28/** @addtogroup drvaudiosb16
29 * @{
30 */
31/** @file
32 * Main routines of Creative Labs SoundBlaster 16 driver
33 */
34
35#include <ddf/driver.h>
36#include <errno.h>
37#include <audio_mixer_iface.h>
38
39#include "mixer.h"
40#include "sb16.h"
41
42static sb_mixer_t *fun_to_mixer(ddf_fun_t *fun)
43{
44 sb16_t *sb = (sb16_t *)ddf_dev_data_get(ddf_fun_get_dev(fun));
45 return &sb->mixer;
46}
47
48static errno_t sb_get_info(ddf_fun_t *fun, const char **name, unsigned *items)
49{
50 sb_mixer_t *mixer = fun_to_mixer(fun);
51
52 if (name)
53 *name = sb_mixer_type_str(mixer->type);
54 if (items)
55 *items = sb_mixer_get_control_item_count(mixer);
56
57 return EOK;
58}
59
60static errno_t sb_get_item_info(ddf_fun_t *fun, unsigned item, const char **name,
61 unsigned *max_level)
62{
63 sb_mixer_t *mixer = fun_to_mixer(fun);
64 return sb_mixer_get_control_item_info(mixer, item, name, max_level);
65}
66
67static errno_t sb_set_item_level(ddf_fun_t *fun, unsigned item, unsigned value)
68{
69 sb_mixer_t *mixer = fun_to_mixer(fun);
70 return sb_mixer_set_control_item_value(mixer, item, value);
71}
72
73static errno_t sb_get_item_level(ddf_fun_t *fun, unsigned item, unsigned *value)
74{
75 sb_mixer_t *mixer = fun_to_mixer(fun);
76 return sb_mixer_get_control_item_value(mixer, item, value);
77}
78
79audio_mixer_iface_t sb_mixer_iface = {
80 .get_info = sb_get_info,
81 .get_item_info = sb_get_item_info,
82
83 .get_item_level = sb_get_item_level,
84 .set_item_level = sb_set_item_level,
85};
86/**
87 * @}
88 */
Note: See TracBrowser for help on using the repository browser.