GameSounds.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. ** Command & Conquer Generals(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. //----------------------------------------------------------------------------
  24. //
  25. // Westwood Studios Pacific.
  26. //
  27. // Confidential Information
  28. // Copyright (C) 2001 - All Rights Reserved
  29. //
  30. //----------------------------------------------------------------------------
  31. //
  32. // Project: RTS 3
  33. //
  34. // File name: Common/GameSounds.h
  35. //
  36. // Created: 5/02/01
  37. //
  38. //----------------------------------------------------------------------------
  39. #pragma once
  40. #ifndef __COMMON_GAMESOUNDS_H_
  41. #define __COMMON_GAMESOUNDS_H_
  42. #include "Common/SubsystemInterface.h"
  43. #include "Common/GameAudio.h"
  44. #include "Common/GameType.h"
  45. // Forward declarations
  46. class AudioEventRTS;
  47. class SoundManager : public SubsystemInterface
  48. {
  49. public:
  50. SoundManager();
  51. virtual ~SoundManager();
  52. virtual void init( void ); ///< Initializes the sounds system
  53. virtual void postProcessLoad();
  54. virtual void update( void ); ///< Services sounds tasks. Called by AudioInterface
  55. virtual void reset( void ); ///< Reset the sounds system
  56. virtual void loseFocus( void ); ///< Called when application loses focus
  57. virtual void regainFocus( void ); ///< Called when application regains focus
  58. virtual void setListenerPosition( const Coord3D *position ); ///< Set the listener position for map3DSound() calculations
  59. virtual void setViewRadius( Real viewRadius );///< Sets the radius of the view from the center of the screen in world coordinate units
  60. virtual void setCameraAudibleDistance( Real audibleDistance );
  61. virtual Real getCameraAudibleDistance( void );
  62. virtual void addAudioEvent(AudioEventRTS *eventToAdd); // pre-copied
  63. virtual void notifyOf2DSampleStart( void );
  64. virtual void notifyOf3DSampleStart( void );
  65. virtual void notifyOf2DSampleCompletion( void );
  66. virtual void notifyOf3DSampleCompletion( void );
  67. virtual Int getAvailableSamples( void );
  68. virtual Int getAvailable3DSamples( void );
  69. // empty string means that this sound wasn't found or some error occurred. CHECK FOR EMPTY STRING.
  70. virtual AsciiString getFilenameForPlayFromAudioEvent( const AudioEventRTS *eventToGetFrom );
  71. // called by this class and MilesAudioManager to determine if a sound can still be played
  72. virtual Bool canPlayNow( AudioEventRTS *event );
  73. protected:
  74. virtual Bool violatesVoice( AudioEventRTS *event );
  75. virtual Bool isInterrupting( AudioEventRTS *event );
  76. protected:
  77. UnsignedInt m_num2DSamples;
  78. UnsignedInt m_num3DSamples;
  79. UnsignedInt m_numPlaying2DSamples;
  80. UnsignedInt m_numPlaying3DSamples;
  81. };
  82. #endif // __COMMON_GAMESOUNDS_H_