Reworked ISoundFormat.LengthInSeconds implementations
This commit is contained in:
committed by
Matthias Mailänder
parent
631297417c
commit
87b92b53a4
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.AudioLoaders
|
||||
public int Channels => channels;
|
||||
public int SampleBits => sampleBits;
|
||||
public int SampleRate => sampleRate;
|
||||
public float LengthInSeconds { get; }
|
||||
public float LengthInSeconds => lengthInSeconds;
|
||||
public Stream GetPCMInputStream() { return wavStreamFactory(); }
|
||||
public void Dispose() { sourceStream.Dispose(); }
|
||||
|
||||
@@ -62,15 +62,14 @@ namespace OpenRA.Mods.Common.AudioLoaders
|
||||
readonly short channels;
|
||||
readonly int sampleBits;
|
||||
readonly int sampleRate;
|
||||
readonly float lengthInSeconds;
|
||||
|
||||
public WavFormat(Stream stream)
|
||||
{
|
||||
sourceStream = stream;
|
||||
|
||||
if (!WavReader.LoadSound(stream, out wavStreamFactory, out channels, out sampleBits, out sampleRate))
|
||||
if (!WavReader.LoadSound(stream, out wavStreamFactory, out channels, out sampleBits, out sampleRate, out lengthInSeconds))
|
||||
throw new InvalidDataException();
|
||||
|
||||
LengthInSeconds = WavReader.WaveLength(sourceStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user