Code/SFXRFrequency.cs
using System;
namespace SFXR;
public class SFXRFrequency
{
/// <summary>
/// Base tone of the sound, before sliding
/// (Default: 400, Range: 0 - 3000)
/// </summary>
public SFXRFloat Start { get; set; } = 400;
/// <summary>
/// Amount by which the frequency is increased or decreased over time
/// (Default: 0, Range: -3000 - 3000)
/// </summary>
public SFXRFloat Slide { get; set; } = 0;
/// <summary>
/// Amount by which the slide is increased or decreased over time
/// (Default: 0, Range: -3000 - 3000)
/// </summary>
public SFXRFloat DeltaSlide { get; set; } = 0;
/// <summary>
/// Gets the frequency at a given time
/// </summary>
/// <param name="time"></param>
/// <returns>The frequency in Hz</returns>
public float GetFrequency( float time )
{
// Calculate the frequency
float frequency = Start + Slide * time + DeltaSlide * time * time;
return frequency;
}
}