emux_proc.c 4.4 KB

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