XJ music engine  1.9.6
In-game runtime engine for XJ music.
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
XJ::Tuning Class Reference

#include <Tuning.h>

Public Member Functions

 Tuning ()
 
 Tuning (const Note &rootNote, const float &rootPitch)
 
float pitch (Note note)
 
Note getTones (float pitch)
 
int deltaFromRootPitch (float pitch)
 
float pitchAtDelta (int delta) const
 
void validate () const
 

Static Public Member Functions

static Tuning atA4 (float a4)
 
static Tuning at (Note note, float pitch)
 

Public Attributes

Note rootNote
 
float rootPitch
 

Detailed Description

Provides exact pitch for any Note, in Hz. A Tuning instance is fixed to a given tuning of note A4, in Hz. Computations for notes at that tuning are cached in memory.

[#255] Note pitch is calculated at 32-bit floating point precision, based on root note configured in environment parameters.

Reference: http://www.phy.mtu.edu/~suits/notefreqs.html

Constructor & Destructor Documentation

◆ Tuning() [1/2]

Tuning::Tuning ( )

Default constructor

◆ Tuning() [2/2]

Tuning::Tuning ( const Note rootNote,
const float &  rootPitch 
)

constructor

Member Function Documentation

◆ at()

Tuning Tuning::at ( Note  note,
float  pitch 
)
static

A Tuning instance, fixed to a given tuning of note A4, in Hz.

Parameters
noteto use as the root of the tuning
pitchof the root note
Returns
a Tuning instance ready to provide exact pitch for any note, in Hz

◆ atA4()

Tuning Tuning::atA4 ( float  a4)
static

A Tuning instance, fixed to a given tuning of note A4, in Hz.

Parameters
a4tuning of note A4, in Hz
Returns
a Tuning instance ready to provide exact pitch for any note, in Hz

◆ deltaFromRootPitch()

int Tuning::deltaFromRootPitch ( float  pitch)

delta, +/- semitones, from the root pitch to the target pitch

Parameters
pitchto get delta of
Returns
delta +/- semitones

◆ getTones()

Note Tuning::getTones ( float  pitch)

Closest Note, for any pitch in Hz

Parameters
pitchto get octave of

◆ pitch()

float Tuning::pitch ( Note  note)

Pitch for any Note, in Hz (caches results by octave and pitch class)

Parameters
noteto get pitch for
Returns
pitch of note, in Hz

◆ pitchAtDelta()

float Tuning::pitchAtDelta ( int  delta) const

Pitch in Hz, for +/- semitones from known root pitch

Parameters
delta+/- semitones from root pitch
Returns
pitch

◆ validate()

void Tuning::validate ( ) const

validate after construction

@ if any properties are invalid

Member Data Documentation

◆ rootNote

Note XJ::Tuning::rootNote

◆ rootPitch

float XJ::Tuning::rootPitch

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