alMidi.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #ifndef ALMIDI_H
  2. #define ALMIDI_H
  3. #include "alMain.h"
  4. #include "atomic.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. typedef struct ALsfmodulator {
  9. struct {
  10. ALenum Input;
  11. ALenum Type;
  12. ALenum Form;
  13. } Source[2];
  14. ALint Amount;
  15. ALenum TransformOp;
  16. ALenum Dest;
  17. } ALsfmodulator;
  18. typedef struct ALenvelope {
  19. ALint DelayTime;
  20. ALint AttackTime;
  21. ALint HoldTime;
  22. ALint DecayTime;
  23. ALint SustainAttn;
  24. ALint ReleaseTime;
  25. ALint KeyToHoldTime;
  26. ALint KeyToDecayTime;
  27. } ALenvelope;
  28. typedef struct ALfontsound {
  29. volatile RefCount ref;
  30. ALint MinKey, MaxKey;
  31. ALint MinVelocity, MaxVelocity;
  32. ALint ModLfoToPitch;
  33. ALint VibratoLfoToPitch;
  34. ALint ModEnvToPitch;
  35. ALint FilterCutoff;
  36. ALint FilterQ;
  37. ALint ModLfoToFilterCutoff;
  38. ALint ModEnvToFilterCutoff;
  39. ALint ModLfoToVolume;
  40. ALint ChorusSend;
  41. ALint ReverbSend;
  42. ALint Pan;
  43. struct {
  44. ALint Delay;
  45. ALint Frequency;
  46. } ModLfo;
  47. struct {
  48. ALint Delay;
  49. ALint Frequency;
  50. } VibratoLfo;
  51. ALenvelope ModEnv;
  52. ALenvelope VolEnv;
  53. ALint Attenuation;
  54. ALint CoarseTuning;
  55. ALint FineTuning;
  56. ALenum LoopMode;
  57. ALint TuningScale;
  58. ALint ExclusiveClass;
  59. ALuint Start;
  60. ALuint End;
  61. ALuint LoopStart;
  62. ALuint LoopEnd;
  63. ALuint SampleRate;
  64. ALubyte PitchKey;
  65. ALbyte PitchCorrection;
  66. ALenum SampleType;
  67. struct ALfontsound *Link;
  68. UIntMap ModulatorMap;
  69. ALuint id;
  70. } ALfontsound;
  71. void ALfontsound_Destruct(ALfontsound *self);
  72. void ALfontsound_setPropi(ALfontsound *self, ALCcontext *context, ALenum param, ALint value);
  73. void ALfontsound_setModStagei(ALfontsound *self, ALCcontext *context, ALsizei stage, ALenum param, ALint value);
  74. ALfontsound *NewFontsound(ALCcontext *context);
  75. inline struct ALfontsound *LookupFontsound(ALCdevice *device, ALuint id)
  76. { return (struct ALfontsound*)LookupUIntMapKey(&device->FontsoundMap, id); }
  77. inline struct ALfontsound *RemoveFontsound(ALCdevice *device, ALuint id)
  78. { return (struct ALfontsound*)RemoveUIntMapKey(&device->FontsoundMap, id); }
  79. inline struct ALsfmodulator *LookupModulator(ALfontsound *sound, ALuint id)
  80. { return (struct ALsfmodulator*)LookupUIntMapKey(&sound->ModulatorMap, id); }
  81. inline struct ALsfmodulator *RemoveModulator(ALfontsound *sound, ALuint id)
  82. { return (struct ALsfmodulator*)RemoveUIntMapKey(&sound->ModulatorMap, id); }
  83. void ReleaseALFontsounds(ALCdevice *device);
  84. typedef struct ALsfpreset {
  85. volatile RefCount ref;
  86. ALint Preset; /* a.k.a. MIDI program number */
  87. ALint Bank; /* MIDI bank 0...127, or percussion (bank 128) */
  88. ALfontsound **Sounds;
  89. ALsizei NumSounds;
  90. ALuint id;
  91. } ALsfpreset;
  92. ALsfpreset *NewPreset(ALCcontext *context);
  93. void DeletePreset(ALsfpreset *preset, ALCdevice *device);
  94. inline struct ALsfpreset *LookupPreset(ALCdevice *device, ALuint id)
  95. { return (struct ALsfpreset*)LookupUIntMapKey(&device->PresetMap, id); }
  96. inline struct ALsfpreset *RemovePreset(ALCdevice *device, ALuint id)
  97. { return (struct ALsfpreset*)RemoveUIntMapKey(&device->PresetMap, id); }
  98. void ReleaseALPresets(ALCdevice *device);
  99. typedef struct ALsoundfont {
  100. volatile RefCount ref;
  101. ALsfpreset **Presets;
  102. ALsizei NumPresets;
  103. ALshort *Samples;
  104. ALint NumSamples;
  105. RWLock Lock;
  106. volatile ALenum Mapped;
  107. ALuint id;
  108. } ALsoundfont;
  109. void ALsoundfont_Construct(ALsoundfont *self);
  110. void ALsoundfont_Destruct(ALsoundfont *self);
  111. ALsoundfont *ALsoundfont_getDefSoundfont(ALCcontext *context);
  112. void ALsoundfont_deleteSoundfont(ALsoundfont *self, ALCdevice *device);
  113. inline struct ALsoundfont *LookupSfont(ALCdevice *device, ALuint id)
  114. { return (struct ALsoundfont*)LookupUIntMapKey(&device->SfontMap, id); }
  115. inline struct ALsoundfont *RemoveSfont(ALCdevice *device, ALuint id)
  116. { return (struct ALsoundfont*)RemoveUIntMapKey(&device->SfontMap, id); }
  117. void ReleaseALSoundfonts(ALCdevice *device);
  118. #ifdef __cplusplus
  119. }
  120. #endif
  121. #endif /* ALMIDI_H */