Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  *  Copyright (C) 2000 Takashi Iwai <tiwai@suse.de>
0004  *
0005  *  Proc interface for Emu8k/Emu10k1 WaveTable synth
0006  */
0007 
0008 #include <linux/wait.h>
0009 #include <sound/core.h>
0010 #include <sound/emux_synth.h>
0011 #include <sound/info.h>
0012 #include "emux_voice.h"
0013 
0014 static void
0015 snd_emux_proc_info_read(struct snd_info_entry *entry, 
0016             struct snd_info_buffer *buf)
0017 {
0018     struct snd_emux *emu;
0019     int i;
0020 
0021     emu = entry->private_data;
0022     mutex_lock(&emu->register_mutex);
0023     if (emu->name)
0024         snd_iprintf(buf, "Device: %s\n", emu->name);
0025     snd_iprintf(buf, "Ports: %d\n", emu->num_ports);
0026     snd_iprintf(buf, "Addresses:");
0027     for (i = 0; i < emu->num_ports; i++)
0028         snd_iprintf(buf, " %d:%d", emu->client, emu->ports[i]);
0029     snd_iprintf(buf, "\n");
0030     snd_iprintf(buf, "Use Counter: %d\n", emu->used);
0031     snd_iprintf(buf, "Max Voices: %d\n", emu->max_voices);
0032     snd_iprintf(buf, "Allocated Voices: %d\n", emu->num_voices);
0033     if (emu->memhdr) {
0034         snd_iprintf(buf, "Memory Size: %d\n", emu->memhdr->size);
0035         snd_iprintf(buf, "Memory Available: %d\n", snd_util_mem_avail(emu->memhdr));
0036         snd_iprintf(buf, "Allocated Blocks: %d\n", emu->memhdr->nblocks);
0037     } else {
0038         snd_iprintf(buf, "Memory Size: 0\n");
0039     }
0040     if (emu->sflist) {
0041         mutex_lock(&emu->sflist->presets_mutex);
0042         snd_iprintf(buf, "SoundFonts: %d\n", emu->sflist->fonts_size);
0043         snd_iprintf(buf, "Instruments: %d\n", emu->sflist->zone_counter);
0044         snd_iprintf(buf, "Samples: %d\n", emu->sflist->sample_counter);
0045         snd_iprintf(buf, "Locked Instruments: %d\n", emu->sflist->zone_locked);
0046         snd_iprintf(buf, "Locked Samples: %d\n", emu->sflist->sample_locked);
0047         mutex_unlock(&emu->sflist->presets_mutex);
0048     }
0049 #if 0  /* debug */
0050     if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) {
0051         struct snd_emux_voice *vp = &emu->voices[0];
0052         snd_iprintf(buf, "voice 0: on\n");
0053         snd_iprintf(buf, "mod delay=%x, atkhld=%x, dcysus=%x, rel=%x\n",
0054                 vp->reg.parm.moddelay,
0055                 vp->reg.parm.modatkhld,
0056                 vp->reg.parm.moddcysus,
0057                 vp->reg.parm.modrelease);
0058         snd_iprintf(buf, "vol delay=%x, atkhld=%x, dcysus=%x, rel=%x\n",
0059                 vp->reg.parm.voldelay,
0060                 vp->reg.parm.volatkhld,
0061                 vp->reg.parm.voldcysus,
0062                 vp->reg.parm.volrelease);
0063         snd_iprintf(buf, "lfo1 delay=%x, lfo2 delay=%x, pefe=%x\n",
0064                 vp->reg.parm.lfo1delay,
0065                 vp->reg.parm.lfo2delay,
0066                 vp->reg.parm.pefe);
0067         snd_iprintf(buf, "fmmod=%x, tremfrq=%x, fm2frq2=%x\n",
0068                 vp->reg.parm.fmmod,
0069                 vp->reg.parm.tremfrq,
0070                 vp->reg.parm.fm2frq2);
0071         snd_iprintf(buf, "cutoff=%x, filterQ=%x, chorus=%x, reverb=%x\n",
0072                 vp->reg.parm.cutoff,
0073                 vp->reg.parm.filterQ,
0074                 vp->reg.parm.chorus,
0075                 vp->reg.parm.reverb);
0076         snd_iprintf(buf, "avol=%x, acutoff=%x, apitch=%x\n",
0077                 vp->avol, vp->acutoff, vp->apitch);
0078         snd_iprintf(buf, "apan=%x, aaux=%x, ptarget=%x, vtarget=%x, ftarget=%x\n",
0079                 vp->apan, vp->aaux,
0080                 vp->ptarget,
0081                 vp->vtarget,
0082                 vp->ftarget);
0083         snd_iprintf(buf, "start=%x, end=%x, loopstart=%x, loopend=%x\n",
0084                 vp->reg.start, vp->reg.end, vp->reg.loopstart, vp->reg.loopend);
0085         snd_iprintf(buf, "sample_mode=%x, rate=%x\n", vp->reg.sample_mode, vp->reg.rate_offset);
0086     }
0087 #endif
0088     mutex_unlock(&emu->register_mutex);
0089 }
0090 
0091 
0092 void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device)
0093 {
0094     struct snd_info_entry *entry;
0095     char name[64];
0096 
0097     sprintf(name, "wavetableD%d", device);
0098     entry = snd_info_create_card_entry(card, name, card->proc_root);
0099     if (entry == NULL)
0100         return;
0101 
0102     entry->content = SNDRV_INFO_CONTENT_TEXT;
0103     entry->private_data = emu;
0104     entry->c.text.read = snd_emux_proc_info_read;
0105 }
0106 
0107 void snd_emux_proc_free(struct snd_emux *emu)
0108 {
0109     snd_info_free_entry(emu->proc);
0110     emu->proc = NULL;
0111 }