mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Update sfxSound.cpp
This commit is contained in:
parent
23ded86100
commit
70d417a402
1 changed files with 10 additions and 0 deletions
|
|
@ -81,6 +81,7 @@ SFXSound::SFXSound( SFXProfile *profile, SFXDescription* desc )
|
||||||
: Parent( profile, desc ),
|
: Parent( profile, desc ),
|
||||||
mVoice( NULL )
|
mVoice( NULL )
|
||||||
{
|
{
|
||||||
|
mSetPositionValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -411,6 +412,9 @@ void SFXSound::_play()
|
||||||
Platform::outputDebugString( "[SFXSound] virtualizing playback of source '%i'", getId() );
|
Platform::outputDebugString( "[SFXSound] virtualizing playback of source '%i'", getId() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if(getPosition() != mSetPositionValue)
|
||||||
|
setPosition(mSetPositionValue);
|
||||||
|
mSetPositionValue = 0; //Non looping sounds need this to reset.
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -421,6 +425,7 @@ void SFXSound::_stop()
|
||||||
|
|
||||||
if( mVoice )
|
if( mVoice )
|
||||||
mVoice->stop();
|
mVoice->stop();
|
||||||
|
mSetPositionValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -431,6 +436,7 @@ void SFXSound::_pause()
|
||||||
|
|
||||||
if( mVoice )
|
if( mVoice )
|
||||||
mVoice->pause();
|
mVoice->pause();
|
||||||
|
mSetPositionValue = getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -511,6 +517,8 @@ void SFXSound::_updatePriority()
|
||||||
|
|
||||||
U32 SFXSound::getPosition() const
|
U32 SFXSound::getPosition() const
|
||||||
{
|
{
|
||||||
|
if( getLastStatus() == SFXStatusStopped)
|
||||||
|
return mSetPositionValue;
|
||||||
if( mVoice )
|
if( mVoice )
|
||||||
return mVoice->getFormat().getDuration( mVoice->getPosition() );
|
return mVoice->getFormat().getDuration( mVoice->getPosition() );
|
||||||
else
|
else
|
||||||
|
|
@ -522,6 +530,8 @@ U32 SFXSound::getPosition() const
|
||||||
void SFXSound::setPosition( U32 ms )
|
void SFXSound::setPosition( U32 ms )
|
||||||
{
|
{
|
||||||
AssertFatal( ms < getDuration(), "SFXSound::setPosition() - position out of range" );
|
AssertFatal( ms < getDuration(), "SFXSound::setPosition() - position out of range" );
|
||||||
|
mSetPositionValue = ms;
|
||||||
|
|
||||||
if( mVoice )
|
if( mVoice )
|
||||||
mVoice->setPosition( mVoice->getFormat().getSampleCount( ms ) );
|
mVoice->setPosition( mVoice->getFormat().getSampleCount( ms ) );
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue