Torque3D Documentation / _generateds / sfxFMODEventSource.h

sfxFMODEventSource.h

Engine/source/sfx/fmod/sfxFMODEventSource.h

More...

Classes:

class

An SFXSource that controls the playback of an SFXFMODEvent.

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#ifndef _SFXFMODEVENTSOURCE_H_
 25#define _SFXFMODEVENTSOURCE_H_
 26
 27#ifndef _SFXSOURCE_H_
 28   #include "sfx/sfxSource.h"
 29#endif
 30
 31#include "fmod_event.h"
 32
 33
 34class SFXFMODEvent;
 35
 36
 37/// An SFXSource that controls the playback of an SFXFMODEvent.
 38///
 39/// SFXFMODEvents can be played back directly through their console methods.
 40/// However, this class integrates them with the remaining SFX system and makes
 41/// events usable wherever SFX tracks are usable though with the important
 42/// distinction that there can only ever be a single source for a given event.
 43///
 44/// Note that calling playback methods directly on an event will cause a source
 45/// for the event to be created if there is not already one.
 46///
 47/// Be aware that using fade-outs in events in combination with play-once sources
 48/// does not work well at the moment.
 49///
 50class SFXFMODEventSource : public SFXSource
 51{
 52   public:
 53   
 54      typedef SFXSource Parent;
 55      
 56   protected:
 57   
 58      /// The event instance handle for this source.
 59      FMOD_EVENT* mHandle;
 60   
 61      ///
 62      SFXFMODEventSource( SFXFMODEvent* event );
 63            
 64      /// Update 3D position, velocity, and orientation from current source transform.
 65      void _update3DAttributes();
 66      
 67      // SFXSource.
 68      virtual void _updateStatus();
 69      virtual void _updateVolume( const MatrixF& listener );
 70      virtual void _updatePitch();
 71      virtual void _updatePriority();
 72      virtual void _onParameterEvent( SFXParameter* parameter, SFXParameterEvent event );
 73      virtual void _setMinMaxDistance( F32 min, F32 max );
 74      virtual void _setCone( F32 innerAngle, F32 outerAngle, F32 outerVolume );
 75      virtual void _setFadeTimes( F32 fadeInTime, F32 fadeOutTime );
 76   
 77   public:
 78   
 79      ///
 80      SFXFMODEventSource();
 81      
 82      virtual ~SFXFMODEventSource();
 83   
 84      /// Return the FMOD event object that is being played back by this source.
 85      SFXFMODEvent* getEvent() const { return ( SFXFMODEvent* ) mTrack.getPointer(); }
 86
 87      /// Create a new source for the given event.
 88      static SFXFMODEventSource* create( SFXFMODEvent* event );
 89      
 90      // SFXSource.
 91      virtual void play( F32 fadeInTime = -1.f ); // fadeInTime ignored when resuming from paused
 92      virtual void stop( F32 fadeOutTime = -1.f ); // fadeOutTime!=0 ignored
 93      virtual void pause( F32 fadeOutTime = -1.f ); // fadeOutTime currently ignored
 94      virtual void setTransform( const MatrixF& transform );
 95      virtual void setVelocity( const VectorF& velocity );
 96      
 97      DECLARE_CONOBJECT( SFXFMODEventSource );
 98      DECLARE_CATEGORY( "SFX FMOD" );
 99      DECLARE_DESCRIPTION( "An SFX source controlling the playback of an FMOD Designer event." );
100};
101
102#endif // !_SFXFMODEVENTSOURCE_H_
103