File: driverevents.c

package info (click to toggle)
mudita24 1.0.3%2Bsvn13-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 600 kB
  • ctags: 625
  • sloc: ansic: 8,577; makefile: 5
file content (88 lines) | stat: -rw-r--r-- 3,354 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*****************************************************************************
   driverevents.c - Events from the driver processing
   Copyright (C) 2000 by Jaroslav Kysela <perex@perex.cz>
   
   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.
******************************************************************************/

#include "envy24control.h"

void control_input_callback(gpointer data, gint source, GdkInputCondition condition)
{
	snd_ctl_t *ctl = (snd_ctl_t *)data;
	snd_ctl_event_t *ev;
	const char *name;
	int index;
	unsigned int mask;

	snd_ctl_event_alloca(&ev);
	if (snd_ctl_read(ctl, ev) < 0)
		return;
	name = snd_ctl_event_elem_get_name(ev);
	index = snd_ctl_event_elem_get_index(ev);
	mask = snd_ctl_event_elem_get_mask(ev);
	if (! (mask & (SND_CTL_EVENT_MASK_VALUE | SND_CTL_EVENT_MASK_INFO)))
		return;

	switch (snd_ctl_event_elem_get_interface(ev)) {
	case SND_CTL_ELEM_IFACE_MIXER:
		if (!strcmp(name, "Word Clock Sync"))
			master_clock_update();
		else if (!strcmp(name, "Multi Track Volume Rate"))
			volume_change_rate_update();
		else if (!strcmp(name, "IEC958 Input Optical"))
			spdif_input_update();
		else if (!strcmp(name, "Delta IEC958 Output Defaults"))
			spdif_output_update();
		else if (!strcmp(name, "Multi Track Internal Clock"))
			master_clock_update();
		else if (!strcmp(name, "Multi Track Internal Clock Default"))
			master_clock_update();
		else if (!strcmp(name, "Multi Track Rate Locking"))
			rate_locking_update();
		else if (!strcmp(name, "Multi Track Rate Reset"))
			rate_reset_update();
		else if (!strcmp(name, "Multi Playback Volume"))
			mixer_update_stream(index + 1, 1, 0);
		else if (!strcmp(name, "H/W Multi Capture Volume"))
			mixer_update_stream(index + 11, 1, 0);
		else if (!strcmp(name, "IEC958 Multi Capture Volume"))
			mixer_update_stream(index + 19, 1, 0);
		else if (!strcmp(name, "Multi Playback Switch"))
			mixer_update_stream(index + 1, 0, 1);
		else if (!strcmp(name, "H/W Multi Capture Switch"))
			mixer_update_stream(index + 11, 0, 1);
		else if (!strcmp(name, "IEC958 Multi Capture Switch"))
			mixer_update_stream(index + 19, 0, 1);
		else if (!strcmp(name, "H/W Playback Route"))
			patchbay_update();
		else if (!strcmp(name, "IEC958 Playback Route"))
			patchbay_update();
		else if (!strcmp(name, "DAC Volume"))
			dac_volume_update(index);
		else if (!strcmp(name, "ADC Volume"))
			adc_volume_update(index);
		else if (!strcmp(name, "IPGA Analog Capture Volume"))
			ipga_volume_update(index);
		else if (!strcmp(name, "Output Sensitivity Switch"))
			dac_sense_update(index);
		else if (!strcmp(name, "Input Sensitivity Switch"))
			adc_sense_update(index);
		break;
	default:
		break;
	}
}