Linux Audio

Check our new training course

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