home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 March / Gamestar_82_2006-03_dvd.iso / DVDStar / Editace / quake4_sdkv10.exe / source / sound / sound.h
C/C++ Source or Header  |  2005-11-14  |  21KB  |  520 lines

  1.  
  2. #ifndef __SOUND__
  3. #define __SOUND__
  4.  
  5. // Resolution of sound shakes in fps
  6. #define SHAKE_FPS            30
  7. #define SHAKE_MS            ( 1000 / SHAKE_FPS )
  8.  
  9. /*
  10. ===============================================================================
  11.  
  12.     SOUND WORLD IDS
  13.  
  14. ===============================================================================
  15. */
  16.  
  17. #define SOUNDWORLD_ANY        -1
  18. #define SOUNDWORLD_NONE        0
  19. #define SOUNDWORLD_GAME        1
  20. #define SOUNDWORLD_MENU        2
  21. #define SOUNDWORLD_EDITOR    3
  22. #define SOUNDWORLD_MAX        4
  23.  
  24. /*
  25. ===============================================================================
  26.  
  27.     SOUND SHADER DECL
  28.  
  29. ===============================================================================
  30. */
  31.  
  32. // RAVEN BEGIN
  33. class rvCommonSample
  34. {
  35. public:
  36.                             rvCommonSample( void );
  37.     virtual                    ~rvCommonSample( void ) {}
  38.  
  39.     virtual const byte        *GetSampleData( void ) const { return( NULL ); }
  40.     virtual int                GetNumChannels( void ) const { return( 0 ); }
  41.     virtual int                GetSampleRate( void ) const { return( 0 ); }
  42.     virtual int                GetMemoryUsed( void ) const { return( 0 ); }
  43.     virtual    int                GetDurationMS( void ) const { return( 0 ); }
  44.     virtual    float            GetDuration( void ) const { return( 0.0f ); }
  45.     virtual    void            Load( int langIndex = -1 ) {}
  46.     virtual void            PurgeSoundSample( void ) {}
  47.     virtual    bool            IsOgg( void ) const { return false; }        // is false for an expanded ogg
  48.     virtual    void            Expand( bool force ) {}                        // expand oggs to pcm
  49.  
  50.             void            SetReferencedThisLevel( void ) { levelLoadReferenced = true; }
  51.  
  52.     idStr                    name;                                // name of the sample file
  53.     unsigned int             timestamp;                            // the most recent of all images used in creation, for reloadImages command
  54.  
  55.     bool                    defaultSound;                        // error during loading, now a beep
  56.     bool                    purged;
  57.     bool                    levelLoadReferenced;                // so we can tell which samples aren't needed any more
  58. // RAVEN BEGIN
  59. // mwhitlock: Dynamic memory consolidation
  60. #if defined(_RV_MEM_SYS_SUPPORT)
  61.     bool                    referencedOutsideLevelLoad;
  62. #endif
  63. // RAVEN END
  64. };
  65. // RAVEN END
  66.  
  67. // sound shader flags
  68. static const int    SSF_PRIVATE_SOUND =        BIT(0);        // only plays for the current listenerId
  69. static const int    SSF_ANTI_PRIVATE_SOUND =BIT(1);        // plays for everyone but the current listenerId
  70. static const int    SSF_NO_OCCLUSION =        BIT(2);        // don't flow through portals, only use straight line
  71. static const int    SSF_GLOBAL =            BIT(3);        // play full volume to all speakers and all listeners
  72. static const int    SSF_OMNIDIRECTIONAL =    BIT(4);        // fall off with distance, but play same volume in all speakers
  73. static const int    SSF_LOOPING =            BIT(5);        // repeat the sound continuously
  74. static const int    SSF_PLAY_ONCE =            BIT(6);        // never restart if already playing on any channel of a given emitter
  75. static const int    SSF_UNCLAMPED =            BIT(7);        // don't clamp calculated volumes at 1.0
  76. static const int    SSF_NO_FLICKER =        BIT(8);        // always return 1.0 for volume queries
  77. static const int    SSF_NO_DUPS =            BIT(9);        // try not to play the same sound twice in a row
  78. // RAVEN BEGIN
  79. static const int    SSF_USEDOPPLER =        BIT(10);    // try not to play the same sound twice in a row
  80. static const int    SSF_NO_RANDOMSTART =    BIT(11);    // don't offset the start position for looping sounds
  81. static const int    SSF_VO_FOR_PLAYER =        BIT(12);    // Notifies a funcRadioChatter that this shader is directed at the player
  82. static const int    SSF_IS_VO =                BIT(13);    // this sound is VO
  83. static const int    SSF_HILITE =            BIT(21);    // display debug info for this emitter
  84. // RAVEN END
  85.  
  86. // these options can be overriden from sound shader defaults on a per-emitter and per-channel basis
  87. typedef struct {
  88.     float                    minDistance;
  89.     float                    maxDistance;
  90.     float                    volume;
  91.     float                    attenuatedVolume;
  92.     float                    shakes;
  93.     int                        soundShaderFlags;        // SSF_* bit flags
  94.     int                        soundClass;                // for global fading of sounds
  95. // RAVEN BEGIN
  96. // bdube: frequency shift
  97.     float                    frequencyShift;
  98.     float                    wetLevel;
  99.     float                    dryLevel;
  100. // RAVEN END    
  101. } soundShaderParms_t;
  102.  
  103. const int        SOUND_MAX_LIST_WAVS        = 32;
  104.  
  105. // sound classes are used to fade most sounds down inside cinematics, leaving dialog
  106. // flagged with a non-zero class full volume
  107. const int        SOUND_CLASS_MUSICAL        = 3;
  108. const int        SOUND_MAX_CLASSES        = 4;
  109.  
  110. // it is somewhat tempting to make this a virtual class to hide the private
  111. // details here, but that doesn't fit easily with the decl manager at the moment.
  112. // RAVEN BEGIN
  113. // jsinger: added to support serialization/deserialization of binary decls
  114. #ifdef RV_BINARYDECLS
  115. class idSoundShader : public idDecl, public Serializable<'ISS '> {
  116. public:
  117.     virtual void            Write( SerialOutputStream &stream ) const;
  118.     virtual void            AddReferences() const;
  119.                             idSoundShader( SerialInputStream &stream );
  120. #else
  121. class idSoundShader : public idDecl {
  122. #endif
  123. public:
  124.                             idSoundShader( void ) { Init(); }
  125.     virtual                    ~idSoundShader( void ) {}
  126.  
  127.     virtual size_t            Size( void ) const;
  128.     virtual bool            SetDefaultText( void );
  129.     virtual const char *    DefaultDefinition( void ) const;
  130.     virtual bool            Parse( const char *text, const int textLength, bool noCaching );
  131.     virtual void            FreeData( void );
  132. // RAVEN BEGIN
  133.     virtual    void            SetReferencedThisLevel( void );
  134. // RAVEN END
  135.     virtual void            List( void ) const;
  136.  
  137.     virtual const char *    GetDescription( void ) const { return( desc ); }
  138.  
  139.     // so the editor can draw correct default sound spheres
  140.     // this is currently defined as meters, which sucks, IMHO.
  141.     virtual float            GetMinDistance( void ) const { return( parms.minDistance ); }
  142.     virtual float            GetMaxDistance( void ) const { return( parms.maxDistance ); }
  143.  
  144. // RAVEN BEGIN
  145. // scork: for detailed error-reporting
  146.     virtual bool            Validate( const char *psText, int iTextLength, idStr &strReportTo ) const;
  147.  
  148. // jscott: implemented id's code
  149.     virtual    bool            RebuildTextSource( void );
  150.  
  151. // jscott: required access functions
  152.             bool            IsPrivateSound( void ) const { return( !!( parms.soundShaderFlags & SSF_PRIVATE_SOUND ) ); }
  153.             bool            IsAntiPrivateSound( void ) const { return( !!( parms.soundShaderFlags & SSF_ANTI_PRIVATE_SOUND ) ); }
  154.             bool            IsNoOcclusion( void ) const { return( !!( parms.soundShaderFlags & SSF_NO_OCCLUSION ) ); }
  155.             bool            IsGlobal( void ) const { return( !!( parms.soundShaderFlags & SSF_GLOBAL ) ); }
  156.             bool            IsOmnidirectional( void ) const { return( !!( parms.soundShaderFlags & SSF_OMNIDIRECTIONAL ) ); }
  157.             bool            IsLooping( void ) const { return( !!( parms.soundShaderFlags & SSF_LOOPING ) ); }
  158.             bool            IsPlayOnce( void ) const { return( !!( parms.soundShaderFlags & SSF_PLAY_ONCE ) ); }
  159.             bool            IsUnclamped( void ) const { return( !!( parms.soundShaderFlags & SSF_UNCLAMPED ) ); }
  160.             bool            IsNoFlicker( void ) const { return( !!( parms.soundShaderFlags & SSF_NO_FLICKER ) ); }
  161.             bool            IsNoDupes( void ) const { return( !!( parms.soundShaderFlags & SSF_NO_DUPS ) ); }
  162.             bool            IsNoRandomStart( void ) const { return( !!( parms.soundShaderFlags & SSF_NO_RANDOMSTART ) ); }
  163.             bool            IsVO_ForPlayer( void ) const { return( !!( parms.soundShaderFlags & SSF_VO_FOR_PLAYER ) ); }
  164.  
  165.             float            GetVolume( void ) const { return( parms.volume ); }
  166.             float            GetShakes( void ) const { return( parms.shakes ); }
  167.             float            GetTimeLength( void ) const;
  168.             void            GetParms( soundShaderParms_t *out ) const { *out = parms; }
  169.             void            SetNoShakes( bool in ) { noShakes = in; }
  170.             bool            GetNoShakes( void ) const { return( noShakes ); }
  171.  
  172.             void            IncPlayCount( void ) { playCount++; }
  173.             int                GetPlayCount( void ) const { return( playCount ); }
  174. // RAVEN END
  175.  
  176.             float            GetLeadinVolume( void ) const { return( leadinVolume ); }
  177.             int                GetNumEntries( void ) const { return( numEntries ); }
  178.             rvCommonSample    *GetLeadin( int index ) const { return( leadins[index] ); }
  179.             rvCommonSample    *GetEntry( int index ) const { return( entries[index] ); }
  180.             const char        *GetShakeData( int index ) const;
  181.             void            SetShakeData( int index, const char *ampData );
  182.             void            Purge( bool freeBaseBlocks );
  183.             void            LoadSampleData( int langIndex = -1 );
  184.  
  185.             const char *    GetSampleName( int index ) const;
  186.             int                GetSamplesPerSec( int index ) const;
  187.             int                GetNumChannels( int index ) const;
  188.             int                GetMemorySize( int index ) const;
  189.             const byte *    GetNonCacheData( int index ) const;
  190.  
  191.             void            ExpandSmallOggs( bool force );
  192. // RAVEN END
  193.  
  194.     // returns NULL if an AltSound isn't defined in the shader.
  195.     // we use this for pairing a specific broken light sound with a normal light sound
  196.     virtual const idSoundShader *GetAltSound( void ) const { return( altSound ); }
  197.  
  198.     virtual bool            HasDefaultSound( void ) const;
  199.  
  200.     virtual const soundShaderParms_t *GetParms( void ) const { return( &parms ); }
  201.     virtual int                GetNumSounds( void ) const;
  202.     virtual const char *    GetSound( int index ) const;
  203.  
  204. private:
  205.     friend class idSoundEmitterLocal;
  206.     friend class idSoundChannel;
  207.     friend class idSoundCache;
  208.  
  209.     // options from sound shader text
  210.     soundShaderParms_t        parms;                        // can be overriden on a per-channel basis
  211.  
  212.     const idSoundShader *    altSound;
  213.     idStr                    desc;                        // description
  214.     bool                    errorDuringParse;
  215. // RAVEN BEGIN
  216.     bool                    noShakes;                    // Don't generate shake data
  217.     bool                    frequentlyUsed;                // Expand this to pcm data no matter how long it is
  218. // RAVEN END
  219.     float                    leadinVolume;                // allows light breaking leadin sounds to be much louder than the broken loop
  220.  
  221. // RAVEN BEGIN
  222.     rvCommonSample *        leadins[SOUND_MAX_LIST_WAVS];
  223. // RAVEN END
  224.     int                        numLeadins;
  225. // RAVEN BEGIN
  226.     rvCommonSample *        entries[SOUND_MAX_LIST_WAVS];
  227.     idStrList                shakes;
  228. // RAVEN END
  229.     int                        numEntries;
  230.  
  231. // RAVEN BEGIN
  232. // bdube: frequency shift code from splash
  233.     float                    minFrequencyShift;    
  234.     float                    maxFrequencyShift;
  235.  
  236.     int                        playCount;                    // For profiling
  237. // RAVEN END
  238.  
  239. private:
  240.     void                    Init( void );
  241.     bool                    ParseShader( idLexer &src );
  242. };
  243.  
  244. class rvSoundShaderEdit
  245. {
  246. public:
  247.     virtual    const char *    GetSampleName( const idSoundShader *sound, int index ) const = 0;
  248.     virtual    int                GetSamplesPerSec( const idSoundShader *sound, int index ) const = 0;
  249.     virtual    int                GetNumChannels( const idSoundShader *sound, int index ) const = 0;
  250.     virtual    int                GetMemorySize( const idSoundShader *sound, int index ) const = 0;
  251.     virtual    const byte *    GetNonCacheData( const idSoundShader *sound, int index ) const = 0;
  252.     virtual void            LoadSampleData( idSoundShader *sound, int langIndex = -1 ) = 0;
  253.     virtual    void            ExpandSmallOggs( idSoundShader *sound, bool force ) = 0;
  254.     virtual    const char        *GetShakeData( idSoundShader *sound, int index ) = 0;
  255.     virtual    void            SetShakeData( idSoundShader *sound, int index, const char *ampData ) = 0;
  256.     virtual    void            Purge( idSoundShader *sound, bool freeBaseBlocks ) = 0;
  257. };
  258.  
  259. extern rvSoundShaderEdit    *soundShaderEdit;
  260.  
  261. /*
  262. ===============================================================================
  263.  
  264.     SOUND EMITTER
  265.  
  266. ===============================================================================
  267. */
  268.  
  269. // sound channels
  270. static const int SCHANNEL_ANY = 0;    // used in queries and commands to effect every channel at once, in
  271.                                     // startSound to have it not override any other channel
  272. static const int SCHANNEL_ONE = 1;    // any following integer can be used as a channel number
  273. typedef int s_channelType;    // the game uses its own series of enums, and we don't want to require casts
  274.  
  275.  
  276. class idSoundEmitter {
  277. public:
  278.     virtual                    ~idSoundEmitter( void ) {}
  279.  
  280.     // the parms specified will be the default overrides for all sounds started on this emitter.
  281.     // NULL is acceptable for parms
  282.     virtual void            UpdateEmitter( const idVec3 &origin, const idVec3 &velocity, int listenerId, const soundShaderParms_t *parms ) = 0;
  283.  
  284.     // returns the length of the started sound in msec
  285.     virtual int                StartSound( const idSoundShader *shader, const s_channelType channel, float diversity = 0.0f, int shaderFlags = 0 ) = 0;
  286.  
  287.     // pass SCHANNEL_ANY to effect all channels
  288.     virtual void            ModifySound( const s_channelType channel, const soundShaderParms_t *parms ) = 0;
  289.     virtual void            StopSound( const s_channelType channel ) = 0;
  290.     // to is in Db (sigh), over is in seconds
  291.     virtual void            FadeSound( const s_channelType channel, float to, float over ) = 0;
  292.  
  293.     // returns true if there are any sounds playing from this emitter.  There is some conservative
  294.     // slop at the end to remove inconsistent race conditions with the sound thread updates.
  295.     // FIXME: network game: on a dedicated server, this will always be false
  296.     virtual bool            CurrentlyPlaying( const s_channelType channel = SCHANNEL_ANY ) const = 0;
  297.  
  298.     // returns a 0.0 to 1.0 value based on the current sound amplitude, allowing
  299.     // graphic effects to be modified in time with the audio.
  300.     // just samples the raw wav file, it doesn't account for volume overrides in the
  301.     virtual    float            CurrentAmplitude( void ) = 0;
  302.  
  303.     // Returns true if the emitter is in the passed in world
  304.     virtual bool            AttachedToWorld( int id ) const = 0;
  305.  
  306.     // for save games.  Index will always be > 0
  307.     virtual    int                Handle( void ) const = 0;
  308. };
  309.  
  310. /*
  311. ===============================================================================
  312.  
  313.     SOUND SYSTEM
  314.  
  315. ===============================================================================
  316. */
  317.  
  318. typedef struct {
  319.     idStr                    name;
  320.     idStr                    format;
  321.     int                        numChannels;
  322.     int                        numSamplesPerSecond;
  323.     int                        num44kHzSamples;
  324.     int                        numBytes;
  325.     bool                    looping;
  326.     float                    lastVolume;
  327.     int                        start44kHzTime;
  328.     int                        current44kHzTime;
  329. } soundDecoderInfo_t;
  330.  
  331. typedef struct soundPortalTrace_s {
  332.     int        portalArea;
  333.     const struct soundPortalTrace_s    *prevStack;
  334. } soundPortalTrace_t;
  335.  
  336. class idSoundSystem {
  337. public:
  338.     virtual                    ~idSoundSystem( void ) {}
  339.  
  340.     // all non-hardware initialization
  341.     virtual void            Init( void ) = 0;
  342.  
  343.     // shutdown routine
  344.     virtual    void            Shutdown( void ) = 0;
  345.  
  346.     // call ClearBuffer if there is a chance that the AsyncUpdate won't get called
  347.     // for 20+ msec, which would cause a stuttering repeat of the current
  348.     // buffer contents
  349.     virtual void            ClearBuffer( void ) = 0;
  350.  
  351.     // sound is attached to the window, and must be recreated when the window is changed
  352.     virtual bool            InitHW( void ) = 0;
  353.     virtual void            InitVoiceComms( void ) = 0;
  354.     virtual bool            ShutdownHW( void ) = 0;
  355.     virtual void            ShutdownVoiceComms( void ) = 0;
  356.  
  357.     // Called once per common frame to check on changes to the sound system
  358.     virtual void            Frame( void ) = 0;
  359.     // Service the sound system
  360.     virtual void            ForegroundUpdate( void ) = 0;
  361.  
  362.     // asyn loop, called at 60Hz
  363.     virtual int                AsyncUpdate( int time ) = 0;
  364.  
  365.     // direct mixing for OSes that support it
  366.     virtual int                AsyncMix( int soundTime, float *mixBuffer ) = 0;
  367.  
  368.     // async loop, when the sound driver uses a write strategy
  369.     virtual int                AsyncUpdateWrite( int time ) = 0;
  370.  
  371.     // it is a good idea to mute everything when starting a new level,
  372.     // because sounds may be started before a valid listener origin
  373.     // is specified
  374.     virtual void            SetMute( bool mute ) = 0;
  375.  
  376.     // for the sound level meter window
  377.     virtual cinData_t        ImageForTime( const int milliseconds, const bool waveform ) = 0;
  378.  
  379.     // get sound decoder info
  380.     virtual int                GetSoundDecoderInfo( int index, soundDecoderInfo_t &decoderInfo ) = 0;
  381.  
  382.     // Mark all soundSamples as currently unused,
  383.     // but don't free anything.
  384.     virtual    void            BeginLevelLoad( const char *mapName ) = 0;
  385.  
  386.     // Free all soundSamples marked as unused
  387.     // We might want to defer the loading of new sounds to this point,
  388.     // as we do with images, to avoid having a union in memory at one time.
  389.     virtual    void            EndLevelLoad( const char *mapName ) = 0;
  390.  
  391. // RAVEN BEGIN
  392. // jnewquist: Free all sounds
  393. #ifdef _XENON
  394.     virtual void            FlushLevelSoundSamples( void ) = 0;
  395. #endif
  396. // RAVEN END
  397.  
  398.     // Frees the empty base blocks in the appropriate soundCache
  399.     virtual void            CleanCache( void ) = 0;
  400.  
  401.     // prints memory info
  402.     virtual void            PrintMemInfo( MemInfo *mi ) = 0;
  403. #ifdef _USE_OPENAL
  404.     // is EAX support present - -1: disabled at compile time. 0: no suitable hardwre 1: ok
  405.     virtual int                IsEAXAvailable( void ) = 0;
  406.     virtual const char *    GetDeviceName( int index ) = 0;
  407.     virtual const char *    GetDefaultDeviceName( void ) = 0;
  408. #endif
  409.  
  410.     // SoundWorld stuff
  411.  
  412.     // call at each map start
  413.     virtual void            SetRenderWorld( idRenderWorld *rw ) = 0;
  414.     virtual void            StopAllSounds( int worldId ) = 0;
  415.  
  416. // RAVEN BEGIN
  417.     // dissociate all virtual channels from hardware
  418.     virtual    void            DisableAllSounds( void ) = 0;
  419.  
  420.     // get a new emitter that can play sounds in this world
  421.     virtual int                AllocSoundEmitter( int worldId ) = 0;
  422.     virtual void            FreeSoundEmitter( int worldId, int handle, bool immediate ) = 0;
  423. // RAVEN END
  424.  
  425.     // for load games, index 0 will return NULL
  426.     virtual idSoundEmitter *EmitterForIndex( int worldId, int index ) = 0;
  427.     virtual int                GetNumEmitters( void ) const = 0;
  428.  
  429.     // query sound samples from all emitters reaching a given position
  430.     virtual    float            CurrentShakeAmplitudeForPosition( int worldId, const int time, const idVec3 &listenerPosition ) = 0;
  431.  
  432.     // where is the camera/microphone
  433.     // listenerId allows listener-private and antiPrivate sounds to be filtered
  434.     // gameTime is in msec, and is used to time sound queries and removals so that they are independent
  435.     // of any race conditions with the async update
  436.     virtual    void            PlaceListener( const idVec3 &origin, const idMat3 &axis, const int listenerId, const int gameTime, const idStr &areaName ) = 0;
  437.  
  438.     // reset the listener portal to invalid during level transitions
  439.     virtual void            ResetListener( void ) = 0;
  440.  
  441.     // fade all sounds in the world with a given shader soundClass
  442.     // to is in Db (sigh), over is in seconds
  443.     virtual void            FadeSoundClasses( int worldId, const int soundClass, float to, const float over ) = 0;
  444.  
  445.     // background music
  446.     virtual    void            PlayShaderDirectly( int worldId, const char *name, int channel = -1 ) = 0;
  447.  
  448.     // dumps the current state and begins archiving commands
  449.     virtual void            StartWritingDemo( int worldId, idDemoFile *demo ) = 0;
  450.     virtual void            StopWritingDemo( int worldId ) = 0;
  451.  
  452.     // read a sound command from a demo file
  453.     virtual void            ProcessDemoCommand( int worldId, idDemoFile *demo ) = 0;
  454.  
  455.     virtual int                GetHardwareTime( void ) const = 0;
  456.  
  457.     // unpauses the selected soundworld, pauses all others
  458.     virtual int                SetActiveSoundWorld( bool on ) = 0;
  459. // RAVEN BEGIN
  460. // jnewquist: Accessor for active sound world
  461.     virtual int                GetActiveSoundWorld( void ) = 0;
  462. // RAVEN END
  463.  
  464.     // Write the sound output to multiple wav files.  Note that this does not use the
  465.     // work done by AsyncUpdate, it mixes explicitly in the foreground every PlaceOrigin(),
  466.     // under the assumption that we are rendering out screenshots and the gameTime is going
  467.     // much slower than real time.
  468.     // path should not include an extension, and the generated filenames will be:
  469.     // <path>_left.raw, <path>_right.raw, or <path>_51left.raw, <path>_51right.raw, 
  470.     // <path>_51center.raw, <path>_51lfe.raw, <path>_51backleft.raw, <path>_51backright.raw, 
  471.     // If only two channel mixing is enabled, the left and right .raw files will also be
  472.     // combined into a stereo .wav file.
  473.     virtual void            AVIOpen( int worldId, const char *path, const char *name ) = 0;
  474.     virtual void            AVIClose( int worldId ) = 0;
  475.  
  476.     // SaveGame / demo Support
  477.     virtual void            WriteToSaveGame( int worldId, idFile *savefile ) = 0;
  478.     virtual void            ReadFromSaveGame( int worldId, idFile *savefile ) = 0;
  479.  
  480. // RAVEN BEGIN
  481. // rjohnson: added list active sounds
  482.     virtual void            ListActiveSounds( int worldId ) = 0;
  483. // RAVEN END
  484.     // End SoundWorld stuff
  485.  
  486. // RAVEN BEGIN
  487. // jscott: added
  488.     virtual size_t            ListSoundSummary( void ) = 0;
  489.  
  490.     virtual bool            HasCache( void ) const = 0;
  491.     virtual rvCommonSample    *FindSample( const idStr &filename ) = 0;
  492.     virtual    int                SamplesToMilliseconds( int samples ) const = 0;
  493.     virtual void *            AllocSoundSample( int size ) = 0;
  494.     virtual void            FreeSoundSample( const byte *address ) = 0;
  495.  
  496.     virtual bool            GetInsideLevelLoad( void ) const = 0;
  497.     virtual    bool            ValidateSoundShader( idSoundShader *shader ) = 0;
  498.  
  499. // jscott: voice comm support
  500.     virtual    bool            EnableRecording( bool enable, bool test, float &micLevel ) = 0;
  501.     virtual int                GetVoiceData( byte *buffer, int maxSize ) = 0;
  502.     virtual void            PlayVoiceData( int clientNum, const byte *buffer, int bytes ) = 0;
  503. // ddynerman: voice comm utility
  504.     virtual    int                GetCommClientNum( int channel ) const = 0;
  505.     virtual int                GetNumVoiceChannels( void ) const = 0;
  506.  
  507. // jscott: reverb editor support
  508.     virtual    const char        *GetReverbName( int reverb ) = 0;
  509.     virtual    int                GetNumAreas( void ) = 0;
  510.     virtual    int                GetReverb( int area ) = 0;
  511.     virtual    bool            SetReverb( int area, const char *reverbName, const char *fileName ) = 0;
  512. // RAVEN END
  513. };
  514.  
  515. extern idSoundSystem    *soundSystem;
  516.  
  517. void S_InitSoundSystem( void );
  518.  
  519. #endif /* !__SOUND__ */
  520.