Fixed AudFormat and WavFormat implementations of ISoundFormat.LengthInSeconds
- Fixed a rounding issue in `WavReader.WaveLength()`. - Fixed `AudReader.SoundLength()` not resetting the stream position. - Fixed crashes caused by disposed streams because `LengthInSeconds` would try and calculate the length on the fly. It is now precalculated and cached (making it consistent across all 5 current `ISoundFormat` implementations). - Fixed a crash in `AudReader.LoadSound()`'s `out Func<Stream> result` because that func would try and access the disposed stream's `Length` property. That works for `SegmentStream`, but not for `FileStream`. - Fixed frameCount/soundLength label positioning in the AssetBrowser window to avoid text clipping .
This commit is contained in:
committed by
Matthias Mailänder
parent
8b944e9c82
commit
abea3a0f74
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
var bitsPerSample = s.ReadInt16();
|
||||
var length = s.Length * 8;
|
||||
|
||||
return length / (channels * sampleRate * bitsPerSample);
|
||||
return (float)length / (channels * sampleRate * bitsPerSample);
|
||||
}
|
||||
|
||||
sealed class WavStreamImaAdpcm : ReadOnlyAdapterStream
|
||||
|
||||
Reference in New Issue
Block a user