emux_proc.c 3.6 KB

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