RingTone Namespace Reference

Classes

struct  NoteDef
 
class  Parser
 Base parser class. More...
 
class  Player
 Base class to support playback of tunes. More...
 
struct  RtttlHeader
 
struct  RtttlParserState
 
class  RtttlParser
 Class to parse RTTTL files RTTTL (RingTone Text Transfer Language) format. More...
 
class  RtttlWriter
 

Enumerations

enum class  Note {
  MUTE , C , C_Sharp , D_Flat = C_Sharp ,
  D , D_Sharp , E_Flat = D_Sharp , E ,
  F , F_Sharp , G , G_Sharp ,
  A_Flat = G_Sharp , A , A_Sharp , B_Flat = A_Sharp ,
  B
}
 Note numbers, defined here for convenience. More...
 

Functions

template<unsigned octave, unsigned note>
static constexpr unsigned calculateFrequency ()
 
unsigned charToNoteValue (char c)
 Get the corresponding note number for a letter. More...
 
unsigned getNoteFrequency (unsigned octave, unsigned note)
 Convert a scale/note combination into frequency. More...
 
unsigned getClosestNote (unsigned frequency, unsigned &octave)
 Convert a frequency into a scale/note combination into frequency. More...
 
const char * getNoteName (unsigned noteValue)
 Get text for a given note number. More...
 

Variables

static unsigned noteFrequencyA4 = 440
 Reference note frequency. More...
 
static constexpr float frequencyRoot = pow(2, 1.0 / 12)
 

Enumeration Type Documentation

◆ Note

enum RingTone::Note
strong

Note numbers, defined here for convenience.

Enumerator
MUTE 
C_Sharp 
D_Flat 
D_Sharp 
E_Flat 
F_Sharp 
G_Sharp 
A_Flat 
A_Sharp 
B_Flat 

Function Documentation

◆ calculateFrequency()

template<unsigned octave, unsigned note>
static constexpr unsigned RingTone::calculateFrequency ( )
staticconstexpr

◆ charToNoteValue()

unsigned RingTone::charToNoteValue ( char  c)

Get the corresponding note number for a letter.

Parameters
c
Return values
unsignedNotes start at 1, 0 indicates error or pause/mute
Note
To sharpen a note, add 1

◆ getClosestNote()

unsigned RingTone::getClosestNote ( unsigned  frequency,
unsigned octave 
)

Convert a frequency into a scale/note combination into frequency.

Parameters
frequency
octaveOctave for the note
Return values
unsignedThe note number, 0 if out of range

◆ getNoteFrequency()

unsigned RingTone::getNoteFrequency ( unsigned  octave,
unsigned  note 
)

Convert a scale/note combination into frequency.

Parameters
octave
note
Return values
unsignedFrequency, 0 if out of range

◆ getNoteName()

const char* RingTone::getNoteName ( unsigned  noteValue)

Get text for a given note number.

Variable Documentation

◆ frequencyRoot

constexpr float RingTone::frequencyRoot = pow(2, 1.0 / 12)
staticconstexpr

◆ noteFrequencyA4

unsigned RingTone::noteFrequencyA4 = 440
static

Reference note frequency.