public SoundEffect GetSFX(uint InstanceID)
{
if (SFXCache.ContainsKey(InstanceID)) return SFXCache[InstanceID];
byte[] data = GetAudioFrom(InstanceID, TSOAudio);
if (data == null) data = GetAudioFrom(InstanceID, tsov2);
if (data == null) data = GetAudioFrom(InstanceID, Stings);
if (data == null) data = GetAudioFrom(InstanceID, EP5Samps);
if (data == null) data = GetAudioFrom(InstanceID, EP2);
if (data != null)
{
var stream = new MemoryStream(data);
var sfx = SoundEffect.FromStream(stream);
stream.Close();
SFXCache.Add(InstanceID, sfx);
return sfx; //remember to clear the sfx cache between lots!
}
else
{
//GCHandle pinnedArray = GCHandle.Alloc(new byte[1], GCHandleType.Weak);
return null;// pinnedArray; //we couldn't find anything! can't return null so do this... not the best idea tbh
}
}