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 <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 mutex_unlock(&emu->register_mutex); 67} 68 69 70void snd_emux_proc_init(struct snd_emux *emu, struct snd_card *card, int device) 71{ 72 struct snd_info_entry *entry; 73 char name[64]; 74 75 sprintf(name, "wavetableD%d", device); 76 entry = snd_info_create_card_entry(card, name, card->proc_root); 77 if (entry == NULL) 78 return; 79 80 entry->content = SNDRV_INFO_CONTENT_TEXT; 81 entry->private_data = emu; 82 entry->c.text.read = snd_emux_proc_info_read; 83 if (snd_info_register(entry) < 0) 84 snd_info_free_entry(entry); 85 else 86 emu->proc = entry; 87} 88 89void snd_emux_proc_free(struct snd_emux *emu) 90{ 91 snd_info_free_entry(emu->proc); 92 emu->proc = NULL; 93} 94 95#endif /* CONFIG_PROC_FS */ 96