sfxTrack.h

Engine/source/sfx/sfxTrack.h

More...

Classes:

class

A datablock that describes sound data for playback.

Detailed Description

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 25// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
 26// Copyright (C) 2015 Faust Logic, Inc.
 27//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 28#ifndef _SFXTRACK_H_
 29#define _SFXTRACK_H_
 30
 31#ifndef _SIMDATABLOCK_H_
 32   #include "console/simDatablock.h"
 33#endif
 34#ifndef _CONSOLETYPES_H_
 35   #include "console/consoleTypes.h"
 36#endif
 37
 38
 39class SFXDescription;
 40
 41
 42/// A datablock that describes sound data for playback.
 43class SFXTrack : public SimDataBlock
 44{
 45   public:
 46      
 47      typedef SimDataBlock Parent;
 48      
 49      enum
 50      {
 51         /// Maximum numbers of parameters that can be pre-assigned to tracks.
 52         MaxNumParameters = 8
 53      };
 54      
 55   protected:
 56   
 57      /// The description which controls playback settings.
 58      SFXDescription *mDescription;
 59
 60      /// Name of the parameters to which sources playing this track should
 61      /// connect.
 62      StringTableEntry mParameters[ MaxNumParameters ];
 63   
 64      /// Overload this to disable direct instantiation of this class via script 'new'.
 65      virtual bool processArguments( S32 argc, ConsoleValueRef *argv );
 66
 67   public:
 68         
 69      ///
 70      SFXTrack();
 71      
 72      ///
 73      SFXTrack( SFXDescription* description );
 74      
 75      /// Returns the description object for this sound profile.
 76      SFXDescription* getDescription() const { return mDescription; }
 77
 78      ///
 79      StringTableEntry getParameter( U32 index ) const
 80      {
 81         AssertFatal( index < MaxNumParameters, "SFXTrack::getParameter() - index out of range" );
 82         return mParameters[ index ];
 83      }
 84      
 85      ///
 86      void setParameter( U32 index, const char* name );
 87      
 88      // SimDataBlock.
 89      virtual void packData( BitStream* stream );
 90      virtual void unpackData( BitStream* stream );
 91      virtual bool preload( bool server, String& errorStr );
 92      virtual bool onAdd();
 93      virtual void inspectPostApply();
 94      
 95      static void initPersistFields();
 96      
 97      DECLARE_CONOBJECT( SFXTrack );
 98      DECLARE_CATEGORY( "SFX" );
 99      DECLARE_DESCRIPTION( "Abstract base class for any kind of data that can be turned into SFXSources." );
100   public:
101      /*C*/ SFXTrack(const SFXTrack&, bool = false);
102};
103
104#endif // !_SFXTRACK_H_
105