1/* $NetBSD: app.h,v 1.2 2023/06/29 19:06:54 nia Exp $ */
2/*-
3 * Copyright (c) 2021 The NetBSD Foundation, Inc.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Nia Alarie.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 *    notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in the
16 *    documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30#ifndef APP_H
31#define APP_H
32#include <sys/audioio.h>
33#include <stdbool.h>
34
35enum aiomixer_state {
36	STATE_DEVICE_SELECT,
37	STATE_CLASS_SELECT,
38	STATE_CONTROL_SELECT
39};
40
41struct aiomixer_control {
42	struct mixer_devinfo info;
43	/* currently selected index for sets, channel for sliders */
44	int setindex;
45	int widget_y;
46	int height;
47	WINDOW *widgetpad;
48};
49
50struct aiomixer_class {
51	char name[MAX_AUDIO_DEV_LEN];
52	struct aiomixer_control controls[128];
53	unsigned int numcontrols;
54	WINDOW *widgetpad;
55	int index;
56	int height;
57};
58
59struct aiomixer {
60	int fd;
61	enum aiomixer_state state;
62	struct audio_device mixerdev;
63	struct aiomixer_class classes[128];
64	unsigned int numclasses;
65	unsigned int curclass;
66	unsigned int curcontrol;
67	bool channels_unlocked;
68	int class_scroll_y;
69	int last_max_x;
70	bool widgets_resized;
71	WINDOW *header;
72	WINDOW *classbar;
73	bool use_colour;
74};
75
76#define COLOR_CONTROL_SELECTED	1
77#define COLOR_LEVELS		2
78#define COLOR_SET_SELECTED	3
79#define COLOR_ENUM_OFF		4
80#define COLOR_ENUM_ON		5
81#define COLOR_ENUM_MISC		6
82
83#endif
84