[PATCH] W1: cleanups
[linux-2.6/verdex.git] / sound / synth / emux / emux_proc.c
blob1ba68ce302793c411867a3d8a7bc0b26f837b7d0
1 /*
2 * Copyright (C) 2000 Takashi Iwai <tiwai@suse.de>
4 * Proc interface for Emu8k/Emu10k1 WaveTable synth
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <sound/driver.h>
22 #include <linux/wait.h>
23 #include <linux/sched.h>
24 #include <linux/slab.h>
25 #include <sound/core.h>
26 #include <sound/emux_synth.h>
27 #include <sound/info.h>
28 #include "emux_voice.h"
30 #ifdef CONFIG_PROC_FS
32 static void
33 snd_emux_proc_info_read(struct snd_info_entry *entry,
34 struct snd_info_buffer *buf)
36 struct snd_emux *emu;
37 int i;
39 emu = entry->private_data;
40 mutex_lock(&emu->register_mutex);
41 if (emu->name)
42 snd_iprintf(buf, "Device: %s\n", emu->name);
43 snd_iprintf(buf, "Ports: %d\n", emu->num_ports);
44 snd_iprintf(buf, "Addresses:");
45 for (i = 0; i < emu->num_ports; i++)
46 snd_iprintf(buf, " %d:%d", emu->client, emu->ports[i]);
47 snd_iprintf(buf, "\n");
48 snd_iprintf(buf, "Use Counter: %d\n", emu->used);
49 snd_iprintf(buf, "Max Voices: %d\n", emu->max_voices);
50 snd_iprintf(buf, "Allocated Voices: %d\n", emu->num_voices);
51 if (emu->memhdr) {
52 snd_iprintf(buf, "Memory Size: %d\n", emu->memhdr->size);
53 snd_iprintf(buf, "Memory Available: %d\n", snd_util_mem_avail(emu->memhdr));
54 snd_iprintf(buf, "Allocated Blocks: %d\n", emu->memhdr->nblocks);
55 } else {
56 snd_iprintf(buf, "Memory Size: 0\n");
58 if (emu->sflist) {
59 mutex_lock(&emu->sflist->presets_mutex);
60 snd_iprintf(buf, "SoundFonts: %d\n", emu->sflist->fonts_size);
61 snd_iprintf(buf, "Instruments: %d\n", emu->sflist->zone_counter);
62 snd_iprintf(buf, "Samples: %d\n", emu->sflist->sample_counter);
63 snd_iprintf(buf, "Locked Instruments: %d\n", emu->sflist->zone_locked);
64 snd_iprintf(buf, "Locked Samples: %d\n", emu->sflist->sample_locked);
65 mutex_unlock(&emu->sflist->presets_mutex);
67 #if 0 /* debug */
68 if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) {
69 struct snd_emux_voice *vp = &emu->voices[0];
70 snd_iprintf(buf, "voice 0: on\n");
71 snd_iprintf(buf, "mod delay=%x, atkhld=%x, dcysus=%x, rel=%x\n",
72 vp->reg.parm.moddelay,
73 vp->reg.parm.modatkhld,
74 vp->reg.parm.moddcysus,
75 vp->reg.parm.modrelease);
76 snd_iprintf(buf, "vol delay=%x, atkhld=%x, dcysus=%x, rel=%x\n",
77 vp->reg.parm.voldelay,
78 vp->reg.parm.volatkhld,
79 vp->reg.parm.voldcysus,
80 vp->reg.parm.volrelease);
81 snd_iprintf(buf, "lfo1 delay=%x, lfo2 delay=%x, pefe=%x\n",
82 vp->reg.parm.lfo1delay,
83 vp->reg.parm.lfo2delay,
84 vp->reg.parm.pefe);
85 snd_iprintf(buf, "fmmod=%x, tremfrq=%x, fm2frq2=%x\n",
86 vp->reg.parm.fmmod,
87 vp->reg.parm.tremfrq,
88 vp->reg.parm.fm2frq2);
89 snd_iprintf(buf, "cutoff=%x, filterQ=%x, chorus=%x, reverb=%x\n",
90 vp->reg.parm.cutoff,
91 vp->reg.parm.filterQ,
92 vp->reg.parm.chorus,
93 vp->reg.parm.reverb);
94 snd_iprintf(buf, "avol=%x, acutoff=%x, apitch=%x\n",
95 vp->avol, vp->acutoff, vp->apitch);
96 snd_iprintf(buf, "apan=%x, aaux=%x, ptarget=%x, vtarget=%x, ftarget=%x\n",
97 vp->apan, vp->aaux,
98 vp->ptarget,
99 vp->vtarget,
100 vp->ftarget);
101 snd_iprintf(buf, "start=%x, end=%x, loopstart=%x, loopend=%x\n",
102 vp->reg.start, vp->reg.end, vp->reg.loopstart, vp->reg.loopend);
103 snd_iprintf(buf, "sample_mode=%x, rate=%x\n", vp->reg.sample_mode, vp->reg.rate_offset);
105 #endif
106 mutex_unlock(&emu->register_mutex);
110 void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device)
112 struct snd_info_entry *entry;
113 char name[64];
115 sprintf(name, "wavetableD%d", device);
116 entry = snd_info_create_card_entry(card, name, card->proc_root);
117 if (entry == NULL)
118 return;
120 entry->content = SNDRV_INFO_CONTENT_TEXT;
121 entry->private_data = emu;
122 entry->c.text.read_size = 1024;
123 entry->c.text.read = snd_emux_proc_info_read;
124 if (snd_info_register(entry) < 0)
125 snd_info_free_entry(entry);
126 else
127 emu->proc = entry;
130 void snd_emux_proc_free(struct snd_emux *emu)
132 if (emu->proc) {
133 snd_info_unregister(emu->proc);
134 emu->proc = NULL;
138 #endif /* CONFIG_PROC_FS */