mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
SFXResource multi read
SFXResource was always creating a new file for each sound resource. Sometimes this would happen 3 times since the asset was creating a resource, then the profile, then the object that was using it. Now if the sfxResource exists and we call openStream it returns the sfxFileStream linked to that file instead of just creating a new one.
This commit is contained in:
parent
36fa51da3a
commit
352afa3f0f
2 changed files with 12 additions and 9 deletions
|
|
@ -64,10 +64,11 @@ Resource< SFXResource > SFXResource::load( String filename )
|
|||
return ResourceManager::get().load( filename );
|
||||
}
|
||||
|
||||
SFXResource::SFXResource( String fileName, SFXStream *stream )
|
||||
SFXResource::SFXResource( String fileName, const ThreadSafeRef<SFXStream>& stream)
|
||||
: mFileName( fileName ),
|
||||
mFormat( stream->getFormat() ),
|
||||
mDuration( stream->getDuration() )
|
||||
mDuration( stream->getDuration() ),
|
||||
mStream(stream)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +77,7 @@ bool SFXResource::exists( String filename )
|
|||
return SFXFileStream::exists( filename );
|
||||
}
|
||||
|
||||
SFXStream* SFXResource::openStream()
|
||||
ThreadSafeRef<SFXStream> SFXResource::openStream()
|
||||
{
|
||||
return SFXFileStream::create( mFileName );
|
||||
return mStream;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue