asound_fm.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. #define SNDRV_DM_FM_MODE_OPL2 0x00
  14. #define SNDRV_DM_FM_MODE_OPL3 0x01
  15. struct snd_dm_fm_info {
  16. unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
  17. unsigned char rhythm; /* percussion mode flag */
  18. };
  19. /*
  20. * Data structure composing an FM "note" or sound event.
  21. */
  22. struct snd_dm_fm_voice {
  23. unsigned char op; /* operator cell (0 or 1) */
  24. unsigned char voice; /* FM voice (0 to 17) */
  25. unsigned char am; /* amplitude modulation */
  26. unsigned char vibrato; /* vibrato effect */
  27. unsigned char do_sustain; /* sustain phase */
  28. unsigned char kbd_scale; /* keyboard scaling */
  29. unsigned char harmonic; /* 4 bits: harmonic and multiplier */
  30. unsigned char scale_level; /* 2 bits: decrease output freq rises */
  31. unsigned char volume; /* 6 bits: volume */
  32. unsigned char attack; /* 4 bits: attack rate */
  33. unsigned char decay; /* 4 bits: decay rate */
  34. unsigned char sustain; /* 4 bits: sustain level */
  35. unsigned char release; /* 4 bits: release rate */
  36. unsigned char feedback; /* 3 bits: feedback for op0 */
  37. unsigned char connection; /* 0 for serial, 1 for parallel */
  38. unsigned char left; /* stereo left */
  39. unsigned char right; /* stereo right */
  40. unsigned char waveform; /* 3 bits: waveform shape */
  41. };
  42. /*
  43. * This describes an FM note by its voice, octave, frequency number (10bit)
  44. * and key on/off.
  45. */
  46. struct snd_dm_fm_note {
  47. unsigned char voice; /* 0-17 voice channel */
  48. unsigned char octave; /* 3 bits: what octave to play */
  49. unsigned int fnum; /* 10 bits: frequency number */
  50. unsigned char key_on; /* set for active, clear for silent */
  51. };
  52. /*
  53. * FM parameters that apply globally to all voices, and thus are not "notes"
  54. */
  55. struct snd_dm_fm_params {
  56. unsigned char am_depth; /* amplitude modulation depth (1=hi) */
  57. unsigned char vib_depth; /* vibrato depth (1=hi) */
  58. unsigned char kbd_split; /* keyboard split */
  59. unsigned char rhythm; /* percussion mode select */
  60. /* This block is the percussion instrument data */
  61. unsigned char bass;
  62. unsigned char snare;
  63. unsigned char tomtom;
  64. unsigned char cymbal;
  65. unsigned char hihat;
  66. };
  67. /*
  68. * FM mode ioctl settings
  69. */
  70. #define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
  71. #define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
  72. #define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
  73. #define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
  74. #define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
  75. #define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
  76. /* for OPL3 only */
  77. #define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
  78. /* SBI patch management */
  79. #define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
  80. #define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
  81. #define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
  82. #define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
  83. #define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
  84. #define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
  85. #define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
  86. /*
  87. * Patch Record - fixed size for write
  88. */
  89. #define FM_KEY_SBI "SBI\032"
  90. #define FM_KEY_2OP "2OP\032"
  91. #define FM_KEY_4OP "4OP\032"
  92. struct sbi_patch {
  93. unsigned char prog;
  94. unsigned char bank;
  95. char key[4];
  96. char name[25];
  97. char extension[7];
  98. unsigned char data[32];
  99. };
  100. #endif /* __SOUND_ASOUND_FM_H */