AudioEventInfo.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: AudioEventInfo.h /////////////////////////////////////////////////////////////////////////
  24. // AudioEventInfo structure
  25. // Author: John K. McDonald, March 2002
  26. #pragma once
  27. #ifndef _H_AUDIOEVENTINFO_
  28. #define _H_AUDIOEVENTINFO_
  29. #include "Common/AsciiString.h"
  30. #include "Common/GameMemory.h"
  31. #include "Common/STLTypedefs.h"
  32. // DEFINES
  33. #define NO_INTENSIVE_AUDIO_DEBUG
  34. // FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
  35. struct FieldParse;
  36. // USEFUL DECLARATIONS ////////////////////////////////////////////////////////////////////////////
  37. enum AudioType
  38. {
  39. AT_Music,
  40. AT_Streaming,
  41. AT_SoundEffect
  42. };
  43. extern char *theAudioPriorityNames[];
  44. enum AudioPriority
  45. {
  46. AP_LOWEST,
  47. AP_LOW,
  48. AP_NORMAL,
  49. AP_HIGH,
  50. AP_CRITICAL
  51. };
  52. extern char *theSoundTypeNames[];
  53. enum SoundType
  54. {
  55. ST_UI = 0x0001,
  56. ST_WORLD = 0x0002,
  57. ST_SHROUDED = 0x0004,
  58. ST_GLOBAL = 0x0008,
  59. ST_VOICE = 0x0010,
  60. ST_PLAYER = 0x0020,
  61. ST_ALLIES = 0x0040,
  62. ST_ENEMIES = 0x0080,
  63. ST_EVERYONE = 0x0100,
  64. };
  65. extern char *theAudioControlNames[];
  66. enum AudioControl
  67. {
  68. AC_LOOP = 0x0001,
  69. AC_RANDOM = 0x0002,
  70. AC_ALL = 0x0004,
  71. AC_POSTDELAY = 0x0008,
  72. AC_INTERRUPT = 0x0010,
  73. };
  74. class DynamicAudioEventInfo;
  75. struct AudioEventInfo : public MemoryPoolObject
  76. {
  77. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( AudioEventInfo, "AudioEventInfo" )
  78. public:
  79. AsciiString m_audioName; // This name matches the name of the AudioEventRTS
  80. AsciiString m_filename; // For music tracks, this is the filename of the track
  81. Real m_volume; // Desired volume of this audio
  82. Real m_volumeShift; // Desired volume shift of the audio
  83. Real m_minVolume; // Clamped minimum value, useful when muting sound effects
  84. Real m_pitchShiftMin; // minimum pitch shift value
  85. Real m_pitchShiftMax; // maximum pitch shift value
  86. Int m_delayMin; // minimum delay before we'll fire up another one of these
  87. Int m_delayMax; // maximum delay before we'll fire up another one of these
  88. Int m_limit; // Limit to the number of these sounds that can be fired up simultaneously
  89. Int m_loopCount; // number of times to loop this sound
  90. AudioPriority m_priority; // Priority of this sound
  91. UnsignedInt m_type; // Type of sound
  92. UnsignedInt m_control; // control of sound
  93. std::vector<AsciiString> m_soundsMorning; // Sounds to play in the wee hours of the morning
  94. std::vector<AsciiString> m_sounds; // Default sounds to play
  95. std::vector<AsciiString> m_soundsNight; // Sounds to play at night
  96. std::vector<AsciiString> m_soundsEvening; // Sounds to play in the evening
  97. std::vector<AsciiString> m_attackSounds;
  98. std::vector<AsciiString> m_decaySounds;
  99. Real m_lowPassFreq; // When performing low pass filters, what is the maximum frequency heard, expressed as a percentage?
  100. Real m_minDistance; // less than this distance and the sound behaves as though it is at minDistance
  101. Real m_maxDistance; // greater than this distance and the sound behaves as though it is muted
  102. AudioType m_soundType; // This should be either Music, Streaming or SoundEffect
  103. // DynamicAudioEventInfo interfacing functions
  104. virtual Bool isLevelSpecific() const { return false; } ///< If true, this sound is only defined on the current level and can be deleted when that level ends
  105. virtual DynamicAudioEventInfo * getDynamicAudioEventInfo() { return NULL; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class
  106. virtual const DynamicAudioEventInfo * getDynamicAudioEventInfo() const { return NULL; } ///< If this object is REALLY a DynamicAudioEventInfo, return a pointer to the derived class
  107. /// Is this a permenant sound? That is, if I start this sound up, will it ever end
  108. /// "on its own" or only if I explicitly kill it?
  109. Bool isPermanentSound() const { return BitTest( m_control, AC_LOOP ) && (m_loopCount == 0 ); }
  110. static const FieldParse m_audioEventInfo[]; ///< the parse table for INI definition
  111. const FieldParse *getFieldParse( void ) const { return m_audioEventInfo; }
  112. };
  113. #endif /* _H_AUDIOEVENTINFO_ */