Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MicrotonalUI.fl 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0106
  3. header_name {.h}
  4. code_name {.cc}
  5. decl {//Copyright (c) 2002-2005 Nasca Octavian Paul} {}
  6. decl {//License: GNU GPL version 2 or later} {}
  7. decl {\#include <stdlib.h>} {public
  8. }
  9. decl {\#include <stdio.h>} {public
  10. }
  11. decl {\#include <string.h>} {public
  12. }
  13. decl {\#include <FL/Fl_File_Chooser.H>} {public
  14. }
  15. decl {\#include <FL/fl_ask.H>} {public
  16. }
  17. decl {\#include "Fl_Osc_Pane.H"} {public
  18. }
  19. decl {\#include "Fl_Osc_Value.H"} {public
  20. }
  21. decl {\#include "Fl_Osc_Check.H"} {public
  22. }
  23. decl {\#include "Fl_Osc_Counter.H"} {public
  24. }
  25. decl {\#include "Fl_Osc_Input.H"} {public
  26. }
  27. decl {\#include "Fl_Osc_Output.H"} {public
  28. }
  29. decl {\#include "../Misc/Microtonal.h"} {public
  30. }
  31. class MicrotonalUI {} {
  32. Function {make_window(Fl_Osc_Interface *osc, std::string base)} {} {
  33. Fl_Window microtonaluiwindow {
  34. label Scales
  35. xywh {99 164 405 450} type Double hide
  36. class Fl_Osc_Window
  37. } {
  38. Fl_Box {} {
  39. xywh {0 0 0 0}
  40. code0 {microtonaluiwindow->init(osc, base);}
  41. }
  42. Fl_Group {} {
  43. tooltip {Center where the note's freqs. are turned upside-down} xywh {249 2 155 45} box ENGRAVED_FRAME
  44. } {
  45. Fl_Check_Button {} {
  46. label {Invert keys}
  47. callback {if (o->value()==0) centerinvertcounter->deactivate();
  48. else centerinvertcounter->activate();}
  49. tooltip {Turn upside-down the note frequencies} xywh {254 13 55 30} down_box DOWN_BOX labelfont 1 labelsize 11 align 148
  50. code0 {o->init("Pinvertupdown");}
  51. class Fl_Osc_Check
  52. }
  53. Fl_Counter centerinvertcounter {
  54. label Center
  55. xywh {319 13 80 20} labelfont 1 labelsize 11 align 130 minimum 0 maximum 127 step 1 textfont 1
  56. code0 {o->lstep(12/*microtonal->getoctavesize()*/);}
  57. code1 {o->init("Pinvertupdowncenter");}
  58. class Fl_Osc_Counter
  59. }
  60. }
  61. Fl_Group microtonalgroup {selected
  62. xywh {3 49 402 398} box ENGRAVED_FRAME
  63. } {
  64. Fl_Button applybutton {
  65. label Retune
  66. callback {apply();}
  67. tooltip {Retune the synth accorging to the inputs from "Tunnings" and "Keyboard Mappings"} xywh {8 413 107 28} box THIN_UP_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13
  68. }
  69. Fl_Value_Output octavesizeoutput {
  70. label {nts./oct.}
  71. tooltip {Notes/Octave} xywh {150 423 35 17} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1
  72. code0 {o->init("octavesize");}
  73. class Fl_Osc_Output
  74. }
  75. Fl_Input nameinput {
  76. label {Name:}
  77. xywh {8 64 285 25} labelfont 1 labelsize 11 align 5
  78. code0 {o->maximum_size(MICROTONAL_MAX_NAME_LEN);}
  79. code1 {o->init("Pname");}
  80. class Fl_Osc_Input
  81. }
  82. Fl_Input tuningsinput {
  83. label {Tunings:}
  84. xywh {8 144 182 264} type Multiline labelfont 1 labelsize 11 align 5 when 2
  85. code0 {updateTuningsInput();}
  86. }
  87. Fl_Input commentinput {
  88. label {Comment:}
  89. xywh {8 104 391 25} labelfont 1 labelsize 11 align 5
  90. code0 {o->maximum_size(MICROTONAL_MAX_NAME_LEN);}
  91. code1 {o->init("Pcomment");}
  92. class Fl_Osc_Input
  93. }
  94. Fl_Counter {} {
  95. label Shift
  96. xywh {313 69 70 20} type Simple labelsize 11 align 1 minimum -64 maximum 63 step 1 textfont 1
  97. code0 {o->init("Pscaleshift");}
  98. class Fl_Osc_Counter
  99. }
  100. Fl_Button {} {
  101. label {Import .SCL file}
  102. callback {/*const char *filename;
  103. filename=fl_file_chooser("Open:","(*.scl)",NULL,0);
  104. if (filename==NULL) return;
  105. int result=microtonal->loadscl(filename);
  106. if (result==0) {
  107. updateTuningsInput();
  108. nameinput->cut(0,nameinput->maximum_size());
  109. nameinput->insert((char *)microtonal->Pname);
  110. nameinput->position(0);
  111. commentinput->cut(0,commentinput->maximum_size());
  112. commentinput->insert((char *)microtonal->Pname);
  113. commentinput->position(0);
  114. tuningsinput->position(0);
  115. octavesizeoutput->do_callback();
  116. } else {
  117. fl_alert("Error: Could not load the file.");
  118. };*/}
  119. tooltip {Inport Scala .scl file (tunnings)} xywh {243 411 84 15} box THIN_UP_BOX labelfont 1 labelsize 10
  120. }
  121. Fl_Group keymappinggroup {
  122. label {Keyboard Mapping} open
  123. xywh {193 144 206 264} box ENGRAVED_BOX labelfont 1 labelsize 11
  124. } {
  125. Fl_Input mappinginput {
  126. xywh {250 147 146 258} type Multiline labelfont 1 labelsize 11 align 5 when 2
  127. code0 {updateMappingInput();}
  128. }
  129. Fl_Counter firstnotecounter {
  130. label {First note}
  131. tooltip {First MIDI note number} xywh {199 195 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 textfont 1 textsize 11
  132. code0 {o->init("Pfirstkey");}
  133. class Fl_Osc_Counter
  134. }
  135. Fl_Counter lastnotecounter {
  136. label {Last note}
  137. tooltip {Last MIDI note number} xywh {199 225 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 127 textfont 1 textsize 11
  138. code0 {o->init("Plastkey");}
  139. class Fl_Osc_Counter
  140. }
  141. Fl_Counter middlenotecounter {
  142. label {Midle note}
  143. tooltip {Midle note (where scale degree 0 is mapped to)} xywh {199 267 42 18} type Simple labelsize 10 align 5 minimum 0 maximum 127 step 1 value 60 textfont 1 textsize 11
  144. code0 {o->init("Pmiddlenote");}
  145. class Fl_Osc_Counter
  146. }
  147. Fl_Value_Output mapsizeoutput {
  148. label {Map Size}
  149. xywh {201 382 44 20} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1
  150. code0 {o->init("Pmapsize");}
  151. class Fl_Osc_Output
  152. }
  153. }
  154. Fl_Check_Button mappingenabledbutton {
  155. label ON
  156. callback {if (o->value()==0) keymappinggroup->deactivate();
  157. else keymappinggroup->activate();
  158. o->show();}
  159. tooltip {Enable the Mapping (otherwise the mapping is linear)} xywh {198 150 48 21} box FLAT_BOX down_box DOWN_BOX labelfont 1
  160. code0 {o->init("Pmappingenabled");}
  161. class Fl_Osc_Check
  162. }
  163. Fl_Button {} {
  164. label {Import .kbm file}
  165. callback {
  166. //TODO Disabled until this can be moved into middleware
  167. /*const char *filename;
  168. filename=fl_file_chooser("Open:","(*.kbm)",NULL,0);
  169. if (filename==NULL) return;
  170. int result=microtonal->loadkbm(filename);
  171. if (result==0) {
  172. updateMappingInput();
  173. mappinginput->position(0);
  174. mapsizeoutput->update();
  175. firstnotecounter->update();
  176. lastnotecounter->update();
  177. middlenotecounter->update();
  178. mappingenabledbutton->update();
  179. afreqinput->update();
  180. anotecounter->update();
  181. } else {
  182. fl_alert("Error: Could not load the file.");
  183. };*/}
  184. tooltip {Inport Scala .kbm file (keyboard mapping)} xywh {243 428 84 16} box THIN_UP_BOX labelfont 1 labelsize 10
  185. }
  186. }
  187. Fl_Group {} {
  188. xywh {108 2 140 45} box ENGRAVED_FRAME
  189. } {
  190. Fl_Counter anotecounter {
  191. label {"A" Note}
  192. callback {
  193. /*if (microtonal->getnotefreq(o->value(),0)<0.0) o->textcolor(FL_RED);
  194. else o->textcolor(FL_BLACK);*/
  195. o->redraw();}
  196. tooltip {The "A" note (the reference note for which freq. ("A" freq) is given)} xywh {173 17 65 20} labelfont 1 labelsize 10 align 129 minimum 0 maximum 127 step 1 value 69 textfont 1 textsize 10
  197. code0 {o->lstep(12);}
  198. code1 {o->init("PAnote");}
  199. class Fl_Osc_Counter
  200. }
  201. Fl_Value_Input afreqinput {
  202. label {"A" Freq.}
  203. tooltip {The freq. of "A" note (default=440.0)} xywh {118 17 45 20} labelfont 1 labelsize 10 align 1 minimum 1 maximum 20000 step 0.001 value 440 textfont 1 textsize 10
  204. code0 {o->init("PAfreq");}
  205. class Fl_Osc_Value
  206. }
  207. }
  208. Fl_Button {} {
  209. label Close
  210. callback {microtonaluiwindow->hide();}
  211. xywh {333 413 67 28} box THIN_UP_BOX
  212. }
  213. Fl_Check_Button {} {
  214. label {Enable Microtonal}
  215. callback {if (o->value()==0) microtonalgroup->deactivate();
  216. else microtonalgroup->activate();}
  217. xywh {3 3 102 45} box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 11 align 148
  218. code0 {o->init("Penabled");}
  219. class Fl_Osc_Check
  220. }
  221. }
  222. }
  223. Function {updateTuningsInput()} {} {
  224. code {char *tmpbuf=new char[100];
  225. /*
  226. tuningsinput->cut(0,tuningsinput->maximum_size());
  227. for (int i=0;i<microtonal->getoctavesize();i++){
  228. if (i!=0) tuningsinput->insert("\\n");
  229. microtonal->tuningtoline(i,tmpbuf,100);
  230. tuningsinput->insert(tmpbuf);
  231. };
  232. */
  233. delete []tmpbuf;} {}
  234. }
  235. Function {updateMappingInput()} {} {
  236. code {char *tmpbuf=new char[100];
  237. /*
  238. mappinginput->cut(0,tuningsinput->maximum_size());
  239. for (int i=0;i<microtonal->Pmapsize;i++){
  240. if (i!=0) mappinginput->insert("\\n");
  241. if ((microtonal->Pmapping[i])==-1)
  242. snprintf(tmpbuf,100,"x");
  243. else snprintf(tmpbuf,100,"%d",microtonal->Pmapping[i]);
  244. mappinginput->insert(tmpbuf);
  245. };
  246. */
  247. delete []tmpbuf;} {}
  248. }
  249. Function {MicrotonalUI(Fl_Osc_Interface *osc, std::string base)} {} {
  250. code {make_window(osc, base);} {}
  251. }
  252. Function {~MicrotonalUI()} {} {
  253. code {microtonaluiwindow->hide();
  254. delete(microtonaluiwindow);} {}
  255. }
  256. Function {show()} {} {
  257. code {microtonaluiwindow->show();} {}
  258. }
  259. Function {apply()} {} {
  260. code {/*int err=microtonal->texttotunings(tuningsinput->value());
  261. if (err>=0) fl_alert("Parse Error: The input may contain only numbers (like 232.59)\\n or divisions (like 121/64).");
  262. if (err==-2) fl_alert("Parse Error: The input is empty.");
  263. octavesizeoutput->do_callback();
  264. microtonal->texttomapping(mappinginput->value());
  265. mapsizeoutput->do_callback();
  266. anotecounter->do_callback();
  267. */
  268. //applybutton->color(FL_GRAY);} {}
  269. }
  270. }