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.

271 lines
10KB

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