AnaMark Tuning Library
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TUN::CSingleScale Class Reference

#include <TUN_Scale.h>

Public Types

enum  eSection {
  SEC_Unknown, SEC_ScaleBegin, SEC_ScaleEnd, SEC_Info,
  SEC_EditorSpecifics, SEC_Tuning, SEC_ExactTuning, SEC_FunctionalTuning,
  SEC_Mapping, SEC_Assignment, SEC_DataSet, SEC_NumOfSections
}
 
enum  eKey {
  KEY_Unknown, KEY_Format, KEY_FormatVersion, KEY_FormatSpecs,
  KEY_Name, KEY_ID, KEY_Filename, KEY_Author,
  KEY_Location, KEY_Contact, KEY_Date, KEY_Editor,
  KEY_EditorSpecs, KEY_Description, KEY_Keyword, KEY_History,
  KEY_Geography, KEY_Instrument, KEY_Composition, KEY_Comments,
  KEY_Note, KEY_BaseFreq, KEY_InitEqual, KEY_LoopSize,
  KEY_Keyboard, KEY_MIDIChannel, KEY_AllData, KEY_NumOfKeys
}
 

Public Member Functions

 CSingleScale ()
 
virtual ~CSingleScale ()
 
const CErrErr () const
 
void Reset ()
 
void InitEqual (long lBaseNote=69, double dblBaseFreqHz=440)
 
long GetBaseNote () const
 
double GetBaseFreqHz () const
 
const std::vector< double > & GetNoteFrequenciesHz () const
 
double GetMIDINoteFreqHz (long lMIDINoteNumber) const
 
void AddFormula (CFormula formula)
 
std::vector< long > & GetMapping ()
 
const std::vector< long > & GetMapping () const
 
long GetMappingLoopSize () const
 
void SetMappingLoopSize (long lMappingLoopSize)
 
long MapMIDI2Scale (long lMIDINoteNumber) const
 
std::list< CMIDIChannelRange > & GetChannels ()
 
const std::list< CMIDIChannelRange > & GetChannels () const
 
bool Write (const char *szFilepath, long lVersionFrom=0, long lVersionTo=200, bool bWriteHeaderComment=true)
 
bool Write (std::ostream &os, long lVersionFrom=0, long lVersionTo=200, bool bWriteHeaderComment=true)
 
long Read (const char *szFilepath)
 
long Read (std::istream &istr, CStringParser &strparser)
 
const char * Format () const
 
long FormatVersion () const
 
const char * FormatVersionAsStr () const
 
std::string GetDate () const
 
bool SetDate (std::string strDate)
 
bool SetDate (long lYear, long lMonth, long lDay)
 
std::string GetMIDIChannelsAssignment () const
 
bool SetMIDIChannelsAssignment (std::string strMIDIChannels)
 
bool AppliesToChannel (long lMIDIChannel) const
 

Static Public Member Functions

static const std::vector< std::string > & GetSections ()
 
static const std::vector< std::string > & GetKeys ()
 
static eSection FindSection (const std::string &strSection)
 
static eKey FindKey (const std::string &strKey, long &lKeyIndex)
 
static const char * FormatSpecs ()
 
static bool IsDateFormatOK (const std::string &strDate)
 

Public Attributes

std::string m_strName
 
std::string m_strID
 
std::string m_strFilename
 
std::string m_strAuthor
 
std::string m_strLocation
 
std::string m_strContact
 
std::string m_strEditor
 
std::string m_strEditorSpecs
 
std::string m_strDescription
 
std::list< std::string > m_lstrKeywords
 
std::string m_strHistory
 
std::string m_strGeography
 
std::string m_strInstrument
 
std::list< std::string > m_lstrCompositions
 
std::string m_strComments
 

Member Enumeration Documentation

Enumerator
KEY_Unknown 
KEY_Format 
KEY_FormatVersion 
KEY_FormatSpecs 
KEY_Name 
KEY_ID 
KEY_Filename 
KEY_Author 
KEY_Location 
KEY_Contact 
KEY_Date 
KEY_Editor 
KEY_EditorSpecs 
KEY_Description 
KEY_Keyword 
KEY_History 
KEY_Geography 
KEY_Instrument 
KEY_Composition 
KEY_Comments 
KEY_Note 
KEY_BaseFreq 
KEY_InitEqual 
KEY_LoopSize 
KEY_Keyboard 
KEY_MIDIChannel 
KEY_AllData 
KEY_NumOfKeys 
Enumerator
SEC_Unknown 
SEC_ScaleBegin 
SEC_ScaleEnd 
SEC_Info 
SEC_EditorSpecifics 
SEC_Tuning 
SEC_ExactTuning 
SEC_FunctionalTuning 
SEC_Mapping 
SEC_Assignment 
SEC_DataSet 
SEC_NumOfSections 

Constructor & Destructor Documentation

TUN::CSingleScale::CSingleScale ( )
TUN::CSingleScale::~CSingleScale ( )
virtual

Member Function Documentation

void TUN::CSingleScale::AddFormula ( CFormula  formula)
bool TUN::CSingleScale::AppliesToChannel ( long  lMIDIChannel) const
const CErr& TUN::CSingleScale::Err ( ) const
inline
CSingleScale::eKey TUN::CSingleScale::FindKey ( const std::string &  strKey,
long &  lKeyIndex 
)
static
CSingleScale::eSection TUN::CSingleScale::FindSection ( const std::string &  strSection)
static
const char* TUN::CSingleScale::Format ( ) const
inline
static const char* TUN::CSingleScale::FormatSpecs ( )
inlinestatic
long TUN::CSingleScale::FormatVersion ( ) const
inline
const char* TUN::CSingleScale::FormatVersionAsStr ( ) const
inline
double TUN::CSingleScale::GetBaseFreqHz ( ) const
inline
long TUN::CSingleScale::GetBaseNote ( ) const
inline
std::list<CMIDIChannelRange>& TUN::CSingleScale::GetChannels ( )
inline
const std::list<CMIDIChannelRange>& TUN::CSingleScale::GetChannels ( ) const
inline
std::string TUN::CSingleScale::GetDate ( ) const
inline
static const std::vector<std::string>& TUN::CSingleScale::GetKeys ( )
inlinestatic
std::vector<long>& TUN::CSingleScale::GetMapping ( )
inline
const std::vector<long>& TUN::CSingleScale::GetMapping ( ) const
inline
long TUN::CSingleScale::GetMappingLoopSize ( ) const
inline
std::string TUN::CSingleScale::GetMIDIChannelsAssignment ( ) const
double TUN::CSingleScale::GetMIDINoteFreqHz ( long  lMIDINoteNumber) const
inline

Be aware that frequencies <= 0 Hz could be returned, especially when the .tun file loaded makes use of the [Functional Tuning] section. It is strongly suggest to handle notes of such frequencies as "muted" notes. (i.e. do not output any sound on these notes.)

Parameters
lMIDINoteNumberMIDI note number (0 to 127)
Returns
Frequency of that note in scale
const std::vector<double>& TUN::CSingleScale::GetNoteFrequenciesHz ( ) const
inline

Read-access of the note frequencies

Be aware that frequencies <= 0 Hz could be returned, especially when the .tun file loaded makes use of the [Functional Tuning] section. It is strongly suggest to handle notes of such frequencies as "muted" notes. (i.e. do not output any sound on these notes.)

(NOTE: Vector index is scale note number, NOT MIDI note number!)

Returns
Frequencies of scale notes.
static const std::vector<std::string>& TUN::CSingleScale::GetSections ( )
inlinestatic
void TUN::CSingleScale::InitEqual ( long  lBaseNote = 69,
double  dblBaseFreqHz = 440 
)
bool TUN::CSingleScale::IsDateFormatOK ( const std::string &  strDate)
static
long TUN::CSingleScale::MapMIDI2Scale ( long  lMIDINoteNumber) const
long TUN::CSingleScale::Read ( const char *  szFilepath)
long TUN::CSingleScale::Read ( std::istream &  istr,
CStringParser strparser 
)
void TUN::CSingleScale::Reset ( )
bool TUN::CSingleScale::SetDate ( std::string  strDate)
bool TUN::CSingleScale::SetDate ( long  lYear,
long  lMonth,
long  lDay 
)
void TUN::CSingleScale::SetMappingLoopSize ( long  lMappingLoopSize)
bool TUN::CSingleScale::SetMIDIChannelsAssignment ( std::string  strMIDIChannels)
bool TUN::CSingleScale::Write ( const char *  szFilepath,
long  lVersionFrom = 0,
long  lVersionTo = 200,
bool  bWriteHeaderComment = true 
)
bool TUN::CSingleScale::Write ( std::ostream &  os,
long  lVersionFrom = 0,
long  lVersionTo = 200,
bool  bWriteHeaderComment = true 
)

Member Data Documentation

std::list<std::string> TUN::CSingleScale::m_lstrCompositions
std::list<std::string> TUN::CSingleScale::m_lstrKeywords
std::string TUN::CSingleScale::m_strAuthor
std::string TUN::CSingleScale::m_strComments
std::string TUN::CSingleScale::m_strContact
std::string TUN::CSingleScale::m_strDescription
std::string TUN::CSingleScale::m_strEditor
std::string TUN::CSingleScale::m_strEditorSpecs
std::string TUN::CSingleScale::m_strFilename
std::string TUN::CSingleScale::m_strGeography
std::string TUN::CSingleScale::m_strHistory
std::string TUN::CSingleScale::m_strID
std::string TUN::CSingleScale::m_strInstrument
std::string TUN::CSingleScale::m_strLocation
std::string TUN::CSingleScale::m_strName

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