Add AudioDataInfo.Length
This commit is contained in:
12
Source/Engine/Audio/Audio.cs
Normal file
12
Source/Engine/Audio/Audio.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
namespace FlaxEngine
|
||||
{
|
||||
partial struct AudioDataInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the length of the audio data (in seconds).
|
||||
/// </summary>
|
||||
public float Length => (float)NumSamples / (float)Mathf.Max(1U, SampleRate * NumChannels);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user