eas_fmsynth.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*----------------------------------------------------------------------------
  2. *
  3. * File:
  4. * eas_fmsynth.h
  5. *
  6. * Contents and purpose:
  7. * Implements the FM synthesizer functions.
  8. *
  9. * Copyright Sonic Network Inc. 2004
  10. * Licensed under the Apache License, Version 2.0 (the "License");
  11. * you may not use this file except in compliance with the License.
  12. * You may obtain a copy of the License at
  13. *
  14. * http://www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an "AS IS" BASIS,
  18. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. * See the License for the specific language governing permissions and
  20. * limitations under the License.
  21. *
  22. *----------------------------------------------------------------------------
  23. * Revision Control:
  24. * $Revision: 90 $
  25. * $Date: 2006-07-11 20:18:13 -0700 (Tue, 11 Jul 2006) $
  26. *----------------------------------------------------------------------------
  27. */
  28. #ifndef fmsynthH
  29. #define fmsynthH
  30. #include "eas_data.h"
  31. #if defined (_FM_SYNTH)
  32. /* FM envelope state */
  33. typedef enum {
  34. eFMEnvelopeStateAttack = 0,
  35. eFMEnvelopeStateDecay,
  36. eFMEnvelopeStateSustain,
  37. eFMEnvelopeStateRelease,
  38. eFMEnvelopeStateMuted,
  39. eFMEnvelopeStateInvalid /* should never be in this state! */
  40. } E_FM_ENVELOPE_STATE;
  41. /*------------------------------------
  42. * S_OPERATOR data structure
  43. *------------------------------------
  44. */
  45. typedef struct s_operator_tag
  46. {
  47. EAS_I16 pitch; /* operator pitch in cents */
  48. EAS_U16 envGain; /* envelope target */
  49. EAS_I16 baseGain; /* patch gain (inc. vel & key scale) */
  50. EAS_U16 outputGain; /* current output gain */
  51. EAS_U16 envRate; /* calculated envelope rate */
  52. EAS_U8 envState; /* envelope state */
  53. EAS_U8 pad; /* pad to 16-bits */
  54. } S_OPERATOR;
  55. #endif
  56. typedef struct s_fm_voice_tag
  57. {
  58. S_OPERATOR oper[4]; /* operator data */
  59. EAS_I16 voiceGain; /* LFO + channel parameters */
  60. EAS_U16 lfoPhase; /* LFO current phase */
  61. EAS_I16 lfoValue; /* LFO current value */
  62. EAS_U16 lfoDelay; /* keeps track of elapsed delay time */
  63. EAS_I8 pan; /* stereo pan value (-64 to +64) */
  64. EAS_I8 pad; /* reserved to maintain alignment */
  65. } S_FM_VOICE;
  66. #ifdef _FM_EDITOR
  67. extern S_FM_REGION newPatch;
  68. extern S_FM_REGION OriginalPatch;
  69. #endif
  70. extern EAS_U32 freqTable[];
  71. #endif