LMMS
Loading...
Searching...
No Matches
Microtonal.h
Go to the documentation of this file.
1/*
2 ZynAddSubFX - a software synthesizer
3
4 Microtonal.h - Tuning settings and microtonal capabilities
5 Copyright (C) 2002-2005 Nasca Octavian Paul
6 Author: Nasca Octavian Paul
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of version 2 of the GNU General Public License
10 as published by the Free Software Foundation.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License (version 2 or later) for more details.
16
17 You should have received a copy of the GNU General Public License (version 2)
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21*/
22
23#ifndef MICROTONAL_H
24#define MICROTONAL_H
25
26#include "../globals.h"
27#include "XMLwrapper.h"
28
29#define MAX_OCTAVE_SIZE 128
30#define MICROTONAL_MAX_NAME_LEN 120
31
32#include <stdio.h>
33
34
37{
38 public:
40 Microtonal();
43 void defaults();
46 float getnotefreq(int note, int keyshift) const;
47
48
49 //Parameters
51 unsigned char Pinvertupdown;
52
54 unsigned char Pinvertupdowncenter;
55
57 unsigned char Penabled;
58
60 unsigned char PAnote;
61
63 float PAfreq;
64
66 unsigned char Pscaleshift;
67
68 //first and last key (to retune)
69 unsigned char Pfirstkey;
70 unsigned char Plastkey;
71
73 unsigned char Pmiddlenote;
74
76 unsigned char Pmapsize;
77
79 unsigned char Pmappingenabled;
81 short int Pmapping[128];
82
84 unsigned char Pglobalfinedetune;
85
86 // Functions
88 unsigned char getoctavesize() const;
90 void tuningtoline(int n, char *line, int maxn);
92 int loadscl(const char *filename);
94 int loadkbm(const char *filename);
98 int texttotunings(const char *text);
102 void texttomapping(const char *text);
103
105 unsigned char *Pname;
107 unsigned char *Pcomment;
108
109 void add2XML(XMLwrapper *xml) const;
110 void getfromXML(XMLwrapper *xml);
111 int saveXML(const char *filename) const;
112 int loadXML(const char *filename);
113
114 //simple operators primarily for debug
115 bool operator==(const Microtonal &micro) const;
116 bool operator!=(const Microtonal &micro) const;
117
118 private:
119 int linetotunings(unsigned int nline, const char *line);
120 int loadline(FILE *file, char *line); //loads a line from the text file, while ignoring the lines beggining with "!"
121 unsigned char octavesize;
122 struct {
123 unsigned char type; //1 for cents or 2 for division
124
125 // the real tuning (eg. +1.05946f for one halftone)
126 // or 2.0f for one octave
127 float tuning;
128
129 //the real tunning is x1/x2
130 unsigned int x1, x2;
132};
133
134#endif
#define MAX_OCTAVE_SIZE
Definition Microtonal.h:21
unsigned char Pfirstkey
Definition Microtonal.h:69
float getnotefreq(int note, int keyshift) const
Definition Microtonal.cpp:98
unsigned char Pmiddlenote
Definition Microtonal.h:73
~Microtonal()
Definition Microtonal.cpp:78
void defaults()
Definition Microtonal.cpp:36
bool operator==(const Microtonal &micro) const
Definition Microtonal.cpp:202
int loadscl(const char *filename)
Definition Microtonal.cpp:417
void add2XML(XMLwrapper *xml) const
Definition Microtonal.cpp:551
float tuning
Definition Microtonal.h:127
unsigned char Pmapsize
Definition Microtonal.h:76
unsigned int x2
Definition Microtonal.h:130
unsigned char Pglobalfinedetune
Definition Microtonal.h:84
int loadXML(const char *filename)
Definition Microtonal.cpp:679
int texttotunings(const char *text)
Definition Microtonal.cpp:316
Microtonal()
Definition Microtonal.cpp:29
unsigned char type
Definition Microtonal.h:123
unsigned char Plastkey
Definition Microtonal.h:70
unsigned int x1
Definition Microtonal.h:130
unsigned char * Pname
Definition Microtonal.h:105
unsigned char octavesize
Definition Microtonal.h:121
bool operator!=(const Microtonal &micro) const
Definition Microtonal.cpp:207
int loadline(FILE *file, char *line)
Definition Microtonal.cpp:406
unsigned char Penabled
Definition Microtonal.h:57
struct Microtonal::@266236064352147135305016060006235177300353223107 tmpoctave[MAX_OCTAVE_SIZE]
unsigned char * Pcomment
Definition Microtonal.h:107
unsigned char Pmappingenabled
Definition Microtonal.h:79
int saveXML(const char *filename) const
Definition Microtonal.cpp:666
unsigned char Pscaleshift
Definition Microtonal.h:66
unsigned char Pinvertupdowncenter
Definition Microtonal.h:54
int linetotunings(unsigned int nline, const char *line)
Definition Microtonal.cpp:257
void tuningtoline(int n, char *line, int maxn)
Definition Microtonal.cpp:393
int loadkbm(const char *filename)
Definition Microtonal.cpp:459
float PAfreq
Definition Microtonal.h:63
unsigned char Pinvertupdown
Definition Microtonal.h:51
short int Pmapping[128]
Definition Microtonal.h:81
void getfromXML(XMLwrapper *xml)
Definition Microtonal.cpp:602
struct Microtonal::@266236064352147135305016060006235177300353223107 octave[MAX_OCTAVE_SIZE]
void texttomapping(const char *text)
Definition Microtonal.cpp:355
unsigned char PAnote
Definition Microtonal.h:60
unsigned char getoctavesize() const
Definition Microtonal.cpp:87
static char filename[]
Definition features.c:5
const char * text
Definition swell-functions.h:167
int n
Definition crypt.c:458
struct zdirent * file
Definition win32.c:1500