1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#include <sound/driver.h>
22#include <linux/wait.h>
23#include <linux/slab.h>
24#include <sound/core.h>
25#include <sound/emux_synth.h>
26#include <sound/info.h>
27#include "emux_voice.h"
28
29#ifdef CONFIG_PROC_FS
30
31static void
32snd_emux_proc_info_read(struct snd_info_entry *entry,
33 struct snd_info_buffer *buf)
34{
35 struct snd_emux *emu;
36 int i;
37
38 emu = entry->private_data;
39 mutex_lock(&emu->register_mutex);
40 if (emu->name)
41 snd_iprintf(buf, "Device: %s\n", emu->name);
42 snd_iprintf(buf, "Ports: %d\n", emu->num_ports);
43 snd_iprintf(buf, "Addresses:");
44 for (i = 0; i < emu->num_ports; i++)
45 snd_iprintf(buf, " %d:%d", emu->client, emu->ports[i]);
46 snd_iprintf(buf, "\n");
47 snd_iprintf(buf, "Use Counter: %d\n", emu->used);
48 snd_iprintf(buf, "Max Voices: %d\n", emu->max_voices);
49 snd_iprintf(buf, "Allocated Voices: %d\n", emu->num_voices);
50 if (emu->memhdr) {
51 snd_iprintf(buf, "Memory Size: %d\n", emu->memhdr->size);
52 snd_iprintf(buf, "Memory Available: %d\n", snd_util_mem_avail(emu->memhdr));
53 snd_iprintf(buf, "Allocated Blocks: %d\n", emu->memhdr->nblocks);
54 } else {
55 snd_iprintf(buf, "Memory Size: 0\n");
56 }
57 if (emu->sflist) {
58 mutex_lock(&emu->sflist->presets_mutex);
59 snd_iprintf(buf, "SoundFonts: %d\n", emu->sflist->fonts_size);
60 snd_iprintf(buf, "Instruments: %d\n", emu->sflist->zone_counter);
61 snd_iprintf(buf, "Samples: %d\n", emu->sflist->sample_counter);
62 snd_iprintf(buf, "Locked Instruments: %d\n", emu->sflist->zone_locked);
63 snd_iprintf(buf, "Locked Samples: %d\n", emu->sflist->sample_locked);
64 mutex_unlock(&emu->sflist->presets_mutex);
65 }
66#if 0
67 if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) {
68 struct snd_emux_voice *vp = &emu->voices[0];
69 snd_iprintf(buf, "voice 0: on\n");
70 snd_iprintf(buf, "mod delay=%x, atkhld=%x, dcysus=%x, rel=%x\n",
71 vp->reg.parm.moddelay,
72 vp->reg.parm.modatkhld,
73 vp->reg.parm.moddcysus,
74 vp->reg.parm.modrelease);
75 snd_iprintf(buf, "vol delay=%x, atkhld=%x, dcysus=%x, rel=%x\n",
76 vp->reg.parm.voldelay,
77 vp->reg.parm.volatkhld,
78 vp->reg.parm.voldcysus,
79 vp->reg.parm.volrelease);
80 snd_iprintf(buf, "lfo1 delay=%x, lfo2 delay=%x, pefe=%x\n",
81 vp->reg.parm.lfo1delay,
82 vp->reg.parm.lfo2delay,
83 vp->reg.parm.pefe);
84 snd_iprintf(buf, "fmmod=%x, tremfrq=%x, fm2frq2=%x\n",
85 vp->reg.parm.fmmod,
86 vp->reg.parm.tremfrq,
87 vp->reg.parm.fm2frq2);
88 snd_iprintf(buf, "cutoff=%x, filterQ=%x, chorus=%x, reverb=%x\n",
89 vp->reg.parm.cutoff,
90 vp->reg.parm.filterQ,
91 vp->reg.parm.chorus,
92 vp->reg.parm.reverb);
93 snd_iprintf(buf, "avol=%x, acutoff=%x, apitch=%x\n",
94 vp->avol, vp->acutoff, vp->apitch);
95 snd_iprintf(buf, "apan=%x, aaux=%x, ptarget=%x, vtarget=%x, ftarget=%x\n",
96 vp->apan, vp->aaux,
97 vp->ptarget,
98 vp->vtarget,
99 vp->ftarget);
100 snd_iprintf(buf, "start=%x, end=%x, loopstart=%x, loopend=%x\n",
101 vp->reg.start, vp->reg.end, vp->reg.loopstart, vp->reg.loopend);
102 snd_iprintf(buf, "sample_mode=%x, rate=%x\n", vp->reg.sample_mode, vp->reg.rate_offset);
103 }
104#endif
105 mutex_unlock(&emu->register_mutex);
106}
107
108
109void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device)
110{
111 struct snd_info_entry *entry;
112 char name[64];
113
114 sprintf(name, "wavetableD%d", device);
115 entry = snd_info_create_card_entry(card, name, card->proc_root);
116 if (entry == NULL)
117 return;
118
119 entry->content = SNDRV_INFO_CONTENT_TEXT;
120 entry->private_data = emu;
121 entry->c.text.read = snd_emux_proc_info_read;
122 if (snd_info_register(entry) < 0)
123 snd_info_free_entry(entry);
124 else
125 emu->proc = entry;
126}
127
128void snd_emux_proc_free(struct snd_emux *emu)
129{
130 snd_info_free_entry(emu->proc);
131 emu->proc = NULL;
132}
133
134#endif
135