LMMS
Loading...
Searching...
No Matches
lmms::BandLimitedWave Class Reference

#include <BandLimitedWave.h>

Public Types

enum class  Waveform {
  BLSaw , BLSquare , BLTriangle , BLMoog ,
  Count
}

Public Member Functions

 BandLimitedWave ()=default
virtual ~BandLimitedWave ()=default

Static Public Member Functions

static float freqToLen (float f)
 This method converts frequency to wavelength. The oscillate function takes wavelength as argument so use this to convert your note frequency to wavelength before using it.
static float freqToLen (float f, sample_rate_t sr)
 This method converts frequency to wavelength, but you can use any custom sample rate with it.
static float pdToLen (float pd)
 This method converts phase delta to wavelength. It assumes a phase scale of 0 to 1.
static sample_t oscillate (float _ph, float _wavelen, Waveform _wave)
 This method provides interpolated samples of bandlimited waveforms.
static void generateWaves ()

Static Public Attributes

static constexpr auto NumWaveforms = static_cast<std::size_t>(Waveform::Count)
static bool s_wavesGenerated = false
static std::array< WaveMipMap, NumWaveformss_waveforms = { }
static QString s_wavetableDir = ""

Member Enumeration Documentation

◆ Waveform

Enumerator
BLSaw 
BLSquare 
BLTriangle 
BLMoog 
Count 

Constructor & Destructor Documentation

◆ BandLimitedWave()

lmms::BandLimitedWave::BandLimitedWave ( )
default

◆ ~BandLimitedWave()

virtual lmms::BandLimitedWave::~BandLimitedWave ( )
virtualdefault

Member Function Documentation

◆ freqToLen() [1/2]

float lmms::BandLimitedWave::freqToLen ( float f)
inlinestatic

This method converts frequency to wavelength. The oscillate function takes wavelength as argument so use this to convert your note frequency to wavelength before using it.

◆ freqToLen() [2/2]

float lmms::BandLimitedWave::freqToLen ( float f,
sample_rate_t sr )
inlinestatic

This method converts frequency to wavelength, but you can use any custom sample rate with it.

◆ generateWaves()

void lmms::BandLimitedWave::generateWaves ( )
static

◆ oscillate()

sample_t lmms::BandLimitedWave::oscillate ( float _ph,
float _wavelen,
Waveform _wave )
inlinestatic

This method provides interpolated samples of bandlimited waveforms.

Parameters
_phThe phase of the sample.
_wavelenThe wavelength (length of one cycle, ie. the inverse of frequency) of the wanted oscillation, measured in sample frames
_waveThe wanted waveform. Options currently are saw, triangle, square and moog saw.

◆ pdToLen()

float lmms::BandLimitedWave::pdToLen ( float pd)
inlinestatic

This method converts phase delta to wavelength. It assumes a phase scale of 0 to 1.

Member Data Documentation

◆ NumWaveforms

auto lmms::BandLimitedWave::NumWaveforms = static_cast<std::size_t>(Waveform::Count)
staticconstexpr

◆ s_waveforms

std::array< WaveMipMap, BandLimitedWave::NumWaveforms > lmms::BandLimitedWave::s_waveforms = { }
static

◆ s_wavesGenerated

bool lmms::BandLimitedWave::s_wavesGenerated = false
static

◆ s_wavetableDir

QString lmms::BandLimitedWave::s_wavetableDir = ""
static

The documentation for this class was generated from the following files: