Torque3D Documentation / _generateds / sfxNullVoice.cpp

sfxNullVoice.cpp

Engine/source/sfx/null/sfxNullVoice.cpp

More...

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#include "sfx/null/sfxNullVoice.h"
 25#include "sfx/null/sfxNullBuffer.h"
 26#include "sfx/sfxInternal.h"
 27
 28
 29SFXNullVoice::SFXNullVoice( SFXNullBuffer* buffer )
 30   : Parent( buffer ),
 31     mIsLooping( false )
 32{
 33}
 34
 35SFXNullVoice::~SFXNullVoice()
 36{
 37}
 38
 39SFXStatus SFXNullVoice::_status() const
 40{
 41   if( !mIsLooping
 42       && mPlayTimer.isStarted()
 43       && !mPlayTimer.isPaused()
 44       && mPlayTimer.getPosition() >= mBuffer->getDuration() )
 45      mPlayTimer.stop();
 46
 47   if( mPlayTimer.isPaused() )
 48      return SFXStatusPaused;
 49   else if( mPlayTimer.isStarted() )
 50      return SFXStatusPlaying;
 51   else
 52      return SFXStatusStopped;
 53}
 54
 55void SFXNullVoice::_play()
 56{
 57   mPlayTimer.start();
 58}
 59
 60void SFXNullVoice::_pause()
 61{
 62   mPlayTimer.pause();
 63}
 64
 65void SFXNullVoice::_stop()
 66{
 67   mPlayTimer.stop();
 68}
 69
 70void SFXNullVoice::_seek( U32 sample )
 71{
 72   const U32 sampleTime = mBuffer->getFormat().getDuration( sample );
 73   mPlayTimer.setPosition( sampleTime );
 74}
 75
 76void SFXNullVoice::play( bool looping )
 77{
 78   mIsLooping = looping;
 79   mPlayTimer.start();
 80}
 81
 82U32 SFXNullVoice::_tell() const
 83{
 84   U32 ms = _getPlayTime();
 85   
 86   const SFXFormat& format = mBuffer->getFormat();
 87   return ( format.getDataLength( ms ) / format.getBytesPerSample() );
 88}
 89
 90SFXStatus SFXNullVoice::getStatus() const
 91{
 92   return _status();
 93}
 94
 95void SFXNullVoice::setPosition( U32 sample )
 96{
 97   _seek( sample );
 98}
 99
100void SFXNullVoice::setMinMaxDistance( F32 min, F32 max )
101{
102}
103
104void SFXNullVoice::setVelocity( const VectorF& velocity )
105{
106}
107
108void SFXNullVoice::setTransform( const MatrixF& transform )
109{
110}
111
112void SFXNullVoice::setVolume( F32 volume )
113{
114}
115
116void SFXNullVoice::setPitch( F32 pitch )
117{ 
118}
119
120void SFXNullVoice::setCone( F32 innerAngle, F32 outerAngle, F32 outerVolume )
121{
122}
123