Skip to content

Commit

Permalink
Ok
Browse files Browse the repository at this point in the history
  • Loading branch information
realcoloride committed Apr 13, 2024
1 parent 1ef236e commit 8147578
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions VoiceUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ public static class VoiceUtilities
/// <param name="channels">Set 1 for mono and 2 for stereo</param>
/// <param name="float32">Float32 size is half</param>
/// <returns></returns>
public static int GetSampleSize(int sampleRate, int timeLengthMs, int channels, bool float32 = false)
=> (int)(sampleRate * 16f / 8f * (timeLengthMs / 1000f) * channels) / (float32 ? 2 : 1);
public static int GetSampleSize(int sampleRate, int timeLengthMs, int channels)
=> ((int)(sampleRate * 16f / 8f * (timeLengthMs / 1000f) * channels));

/// <summary>
/// Gets the sample size for a frame.
/// </summary>
/// <param name="channels">Set 1 for mono and 2 for stereo</param>
/// <param name="float32">Float32 size is half</param>
/// <returns></returns>
public static int GetSampleSize(int channels, bool float32 = false)
=> GetSampleSize(VoiceChatInterface.SampleRate, VoiceChatInterface.FrameLength, channels, float32);
public static int GetSampleSize(int channels)
=> GetSampleSize(VoiceChatInterface.SampleRate, VoiceChatInterface.FrameLength, channels);

/// <summary>
/// Converts 16 bit PCM data into float 32.
Expand Down

0 comments on commit 8147578

Please sign in to comment.