Blame view

sound/synth/emux/emux_proc.c 4.41 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  /*
   *  Copyright (C) 2000 Takashi Iwai <tiwai@suse.de>
   *
   *  Proc interface for Emu8k/Emu10k1 WaveTable synth
   *
   *   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
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
  #include <linux/wait.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
23
24
  #include <sound/core.h>
  #include <sound/emux_synth.h>
  #include <sound/info.h>
  #include "emux_voice.h"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25
  static void
03da312ac   Takashi Iwai   [ALSA] Remove xxx...
26
27
  snd_emux_proc_info_read(struct snd_info_entry *entry, 
  			struct snd_info_buffer *buf)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
28
  {
03da312ac   Takashi Iwai   [ALSA] Remove xxx...
29
  	struct snd_emux *emu;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
31
32
  	int i;
  
  	emu = entry->private_data;
ef9f0a42d   Ingo Molnar   [ALSA] semaphore ...
33
  	mutex_lock(&emu->register_mutex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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
  	if (emu->name)
  		snd_iprintf(buf, "Device: %s
  ", emu->name);
  	snd_iprintf(buf, "Ports: %d
  ", emu->num_ports);
  	snd_iprintf(buf, "Addresses:");
  	for (i = 0; i < emu->num_ports; i++)
  		snd_iprintf(buf, " %d:%d", emu->client, emu->ports[i]);
  	snd_iprintf(buf, "
  ");
  	snd_iprintf(buf, "Use Counter: %d
  ", emu->used);
  	snd_iprintf(buf, "Max Voices: %d
  ", emu->max_voices);
  	snd_iprintf(buf, "Allocated Voices: %d
  ", emu->num_voices);
  	if (emu->memhdr) {
  		snd_iprintf(buf, "Memory Size: %d
  ", emu->memhdr->size);
  		snd_iprintf(buf, "Memory Available: %d
  ", snd_util_mem_avail(emu->memhdr));
  		snd_iprintf(buf, "Allocated Blocks: %d
  ", emu->memhdr->nblocks);
  	} else {
  		snd_iprintf(buf, "Memory Size: 0
  ");
  	}
  	if (emu->sflist) {
ef9f0a42d   Ingo Molnar   [ALSA] semaphore ...
62
  		mutex_lock(&emu->sflist->presets_mutex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
63
64
65
66
67
68
69
70
71
72
  		snd_iprintf(buf, "SoundFonts: %d
  ", emu->sflist->fonts_size);
  		snd_iprintf(buf, "Instruments: %d
  ", emu->sflist->zone_counter);
  		snd_iprintf(buf, "Samples: %d
  ", emu->sflist->sample_counter);
  		snd_iprintf(buf, "Locked Instruments: %d
  ", emu->sflist->zone_locked);
  		snd_iprintf(buf, "Locked Samples: %d
  ", emu->sflist->sample_locked);
ef9f0a42d   Ingo Molnar   [ALSA] semaphore ...
73
  		mutex_unlock(&emu->sflist->presets_mutex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
75
76
  	}
  #if 0  /* debug */
  	if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) {
03da312ac   Takashi Iwai   [ALSA] Remove xxx...
77
  		struct snd_emux_voice *vp = &emu->voices[0];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
  		snd_iprintf(buf, "voice 0: on
  ");
  		snd_iprintf(buf, "mod delay=%x, atkhld=%x, dcysus=%x, rel=%x
  ",
  			    vp->reg.parm.moddelay,
  			    vp->reg.parm.modatkhld,
  			    vp->reg.parm.moddcysus,
  			    vp->reg.parm.modrelease);
  		snd_iprintf(buf, "vol delay=%x, atkhld=%x, dcysus=%x, rel=%x
  ",
  			    vp->reg.parm.voldelay,
  			    vp->reg.parm.volatkhld,
  			    vp->reg.parm.voldcysus,
  			    vp->reg.parm.volrelease);
  		snd_iprintf(buf, "lfo1 delay=%x, lfo2 delay=%x, pefe=%x
  ",
  			    vp->reg.parm.lfo1delay,
  			    vp->reg.parm.lfo2delay,
  			    vp->reg.parm.pefe);
  		snd_iprintf(buf, "fmmod=%x, tremfrq=%x, fm2frq2=%x
  ",
  			    vp->reg.parm.fmmod,
  			    vp->reg.parm.tremfrq,
  			    vp->reg.parm.fm2frq2);
  		snd_iprintf(buf, "cutoff=%x, filterQ=%x, chorus=%x, reverb=%x
  ",
  			    vp->reg.parm.cutoff,
  			    vp->reg.parm.filterQ,
  			    vp->reg.parm.chorus,
  			    vp->reg.parm.reverb);
  		snd_iprintf(buf, "avol=%x, acutoff=%x, apitch=%x
  ",
  			    vp->avol, vp->acutoff, vp->apitch);
  		snd_iprintf(buf, "apan=%x, aaux=%x, ptarget=%x, vtarget=%x, ftarget=%x
  ",
  			    vp->apan, vp->aaux,
  			    vp->ptarget,
  			    vp->vtarget,
  			    vp->ftarget);
  		snd_iprintf(buf, "start=%x, end=%x, loopstart=%x, loopend=%x
  ",
  			    vp->reg.start, vp->reg.end, vp->reg.loopstart, vp->reg.loopend);
  		snd_iprintf(buf, "sample_mode=%x, rate=%x
  ", vp->reg.sample_mode, vp->reg.rate_offset);
  	}
  #endif
ef9f0a42d   Ingo Molnar   [ALSA] semaphore ...
124
  	mutex_unlock(&emu->register_mutex);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
125
  }
03da312ac   Takashi Iwai   [ALSA] Remove xxx...
126
  void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
127
  {
03da312ac   Takashi Iwai   [ALSA] Remove xxx...
128
  	struct snd_info_entry *entry;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
129
130
131
132
133
134
135
136
137
  	char name[64];
  
  	sprintf(name, "wavetableD%d", device);
  	entry = snd_info_create_card_entry(card, name, card->proc_root);
  	if (entry == NULL)
  		return;
  
  	entry->content = SNDRV_INFO_CONTENT_TEXT;
  	entry->private_data = emu;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
138
139
140
141
142
143
  	entry->c.text.read = snd_emux_proc_info_read;
  	if (snd_info_register(entry) < 0)
  		snd_info_free_entry(entry);
  	else
  		emu->proc = entry;
  }
03da312ac   Takashi Iwai   [ALSA] Remove xxx...
144
  void snd_emux_proc_free(struct snd_emux *emu)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
145
  {
746d4a02e   Takashi Iwai   [ALSA] Fix discon...
146
147
  	snd_info_free_entry(emu->proc);
  	emu->proc = NULL;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
148
  }