asound_fm.h 4.2 KB

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