asound_fm.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. #ifndef __SOUND_ASOUND_FM_H
  3. #define __SOUND_ASOUND_FM_H
  4. /*
  5. * Advanced Linux Sound Architecture - ALSA
  6. *
  7. * Interface file between ALSA driver & user space
  8. * Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
  9. * 4Front Technologies
  10. *
  11. * Direct FM control
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  26. *
  27. */
  28. #define SNDRV_DM_FM_MODE_OPL2 0x00
  29. #define SNDRV_DM_FM_MODE_OPL3 0x01
  30. struct snd_dm_fm_info {
  31. unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
  32. unsigned char rhythm; /* percussion mode flag */
  33. };
  34. /*
  35. * Data structure composing an FM "note" or sound event.
  36. */
  37. struct snd_dm_fm_voice {
  38. unsigned char op; /* operator cell (0 or 1) */
  39. unsigned char voice; /* FM voice (0 to 17) */
  40. unsigned char am; /* amplitude modulation */
  41. unsigned char vibrato; /* vibrato effect */
  42. unsigned char do_sustain; /* sustain phase */
  43. unsigned char kbd_scale; /* keyboard scaling */
  44. unsigned char harmonic; /* 4 bits: harmonic and multiplier */
  45. unsigned char scale_level; /* 2 bits: decrease output freq rises */
  46. unsigned char volume; /* 6 bits: volume */
  47. unsigned char attack; /* 4 bits: attack rate */
  48. unsigned char decay; /* 4 bits: decay rate */
  49. unsigned char sustain; /* 4 bits: sustain level */
  50. unsigned char release; /* 4 bits: release rate */
  51. unsigned char feedback; /* 3 bits: feedback for op0 */
  52. unsigned char connection; /* 0 for serial, 1 for parallel */
  53. unsigned char left; /* stereo left */
  54. unsigned char right; /* stereo right */
  55. unsigned char waveform; /* 3 bits: waveform shape */
  56. };
  57. /*
  58. * This describes an FM note by its voice, octave, frequency number (10bit)
  59. * and key on/off.
  60. */
  61. struct snd_dm_fm_note {
  62. unsigned char voice; /* 0-17 voice channel */
  63. unsigned char octave; /* 3 bits: what octave to play */
  64. unsigned int fnum; /* 10 bits: frequency number */
  65. unsigned char key_on; /* set for active, clear for silent */
  66. };
  67. /*
  68. * FM parameters that apply globally to all voices, and thus are not "notes"
  69. */
  70. struct snd_dm_fm_params {
  71. unsigned char am_depth; /* amplitude modulation depth (1=hi) */
  72. unsigned char vib_depth; /* vibrato depth (1=hi) */
  73. unsigned char kbd_split; /* keyboard split */
  74. unsigned char rhythm; /* percussion mode select */
  75. /* This block is the percussion instrument data */
  76. unsigned char bass;
  77. unsigned char snare;
  78. unsigned char tomtom;
  79. unsigned char cymbal;
  80. unsigned char hihat;
  81. };
  82. /*
  83. * FM mode ioctl settings
  84. */
  85. #define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
  86. #define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
  87. #define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
  88. #define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
  89. #define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
  90. #define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
  91. /* for OPL3 only */
  92. #define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
  93. /* SBI patch management */
  94. #define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
  95. #define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
  96. #define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
  97. #define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
  98. #define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
  99. #define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
  100. #define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
  101. /*
  102. * Patch Record - fixed size for write
  103. */
  104. #define FM_KEY_SBI "SBI\032"
  105. #define FM_KEY_2OP "2OP\032"
  106. #define FM_KEY_4OP "4OP\032"
  107. struct sbi_patch {
  108. unsigned char prog;
  109. unsigned char bank;
  110. char key[4];
  111. char name[25];
  112. char extension[7];
  113. unsigned char data[32];
  114. };
  115. #endif /* __SOUND_ASOUND_FM_H */