T3D 1.1 Final - don't stop use looping audio in shapebaseimage state - RESOLVED (THREED-2617)
by Mquaker · in Torque 3D Professional · 09/13/2011 (11:16 pm) · 5 replies
Thread Titles:
apply looping audioprofile to shapebaseimagedata's 'ready' state, when change state don't stop playing audio.
Build: 1.1 Final, etc.
Platform: Windows 7/XP, 32 & 64 bit
Target: In Game
Issues:
When use looping audioprofile for specific state, don't stop playing audio when change other state.
but, mount other imagedata, stop playing audio.
example) current state is ready. and recover ready state after change fire state.
start new looping audio on the playing old looping audio.
apply looping audioprofile to shapebaseimagedata's 'ready' state, when change state don't stop playing audio.
Build: 1.1 Final, etc.
Platform: Windows 7/XP, 32 & 64 bit
Target: In Game
Issues:
When use looping audioprofile for specific state, don't stop playing audio when change other state.
but, mount other imagedata, stop playing audio.
example) current state is ready. and recover ready state after change fire state.
start new looping audio on the playing old looping audio.
About the author
visit : http://www.quakedev.net
#2
this trick check laststate sound description's mIsLooping variable.
find this block in 'shapebase::setimagestate()'
replace to below..
09/21/2011 (9:39 pm)
i find one trick..this trick check laststate sound description's mIsLooping variable.
find this block in 'shapebase::setimagestate()'
// Play sound
if( stateData.sound && isGhost() )
{
const Point3F& velocity = getVelocity();
image.addSoundSource(SFX->createSource( stateData.sound, &getRenderTransform(), &velocity ));
}replace to below..
// Play sound
if( stateData.sound && isGhost() )
{
// Mquaker :: resolve looping sound problem >>>
if (lastState.sound && lastState.sound->getDescription()->mIsLooping)
{
Con::errorf("last state using looping sound. i'll delete last sound source!");
for(Vector<SFXSource*>::iterator i = image.mSoundSources.begin(); i != image.mSoundSources.end(); i++)
{
SFX_DELETE((*i));
}
image.mSoundSources.clear();
}
// Mquaker :: resolve looping sound problem <<<
const Point3F& velocity = getVelocity();
image.addSoundSource(SFX->createSource( stateData.sound, &getRenderTransform(), &velocity ));
}
#3
09/30/2011 (12:44 pm)
Good work, Mquaker. Just one little tweak.. You don't want to do it in that "if ( stateData.Sound && isGhost())" loop, because then we'll only be deleting sounds if the state we're transitioning to HAS a sound. Really, we want to delete a looping sound once it's state has been transitioned out of (Which is when this entire function is called.) That and a small typo or two. To resolve the issue it should look a bit more like...// Delete any loooping sounds that may have been in the previous state.
if (lastState->sound && lastState->sound->getDescription()->mIsLooping)
{
for(Vector<SFXSource*>::iterator i = image.mSoundSources.begin(); i != image.mSoundSources.end(); i++)
SFX_DELETE((*i));
image.mSoundSources.clear();
}
// Play sound
if( stateData.sound && isGhost() )
{
const Point3F& velocity = getVelocity();
image.addSoundSource(SFX->createSource( stateData.sound, &getRenderTransform(), &velocity ));
}
#4
10/11/2011 (2:18 pm)
Fixed in 1.2
#5
maybe need fix for only looping state sound..
04/12/2012 (7:52 pm)
looping state sound also non-looping state sound stop when change state on Fixed 1.2.maybe need fix for only looping state sound..
Torque 3D Owner Christopher Tauscher
Default Studio