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 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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 {o->init("tunings");}
  86. class Fl_Osc_Input
  87. }
  88. Fl_Input commentinput {
  89. label {Comment:}
  90. xywh {8 104 391 25} labelfont 1 labelsize 11 align 5
  91. code0 {o->maximum_size(MICROTONAL_MAX_NAME_LEN);}
  92. code1 {o->init("Pcomment");}
  93. class Fl_Osc_Input
  94. }
  95. Fl_Counter {} {
  96. label Shift
  97. xywh {313 69 70 20} type Simple labelsize 11 align 1 minimum -64 maximum 63 step 1 textfont 1
  98. code0 {o->init("Pscaleshift");}
  99. class Fl_Osc_Counter
  100. }
  101. Fl_Button {} {
  102. label {Import .SCL file}
  103. callback {const char *filename;
  104. filename=fl_file_chooser("Open:","(*.scl)",NULL,0);
  105. if (filename==NULL) return;
  106. osc->write("/load_scl", "s", filename);
  107. if (true) {
  108. updateTuningsInput();
  109. nameinput->update();
  110. commentinput->update();
  111. tuningsinput->position(0);
  112. octavesizeoutput->update();
  113. }
  114. }
  115. tooltip {Inport Scala .scl file (tunnings)} xywh {243 411 84 15} box THIN_UP_BOX labelfont 1 labelsize 10
  116. }
  117. Fl_Group keymappinggroup {
  118. label {Keyboard Mapping} open
  119. xywh {193 144 206 264} box ENGRAVED_BOX labelfont 1 labelsize 11
  120. } {
  121. Fl_Input mappinginput {
  122. xywh {250 147 146 258} type Multiline labelfont 1 labelsize 11 align 5 when 2
  123. code0 {o->init("mapping");}
  124. class Fl_Osc_Input
  125. }
  126. Fl_Counter firstnotecounter {
  127. label {First note}
  128. 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
  129. code0 {o->init("Pfirstkey");}
  130. class Fl_Osc_Counter
  131. }
  132. Fl_Counter lastnotecounter {
  133. label {Last note}
  134. 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
  135. code0 {o->init("Plastkey");}
  136. class Fl_Osc_Counter
  137. }
  138. Fl_Counter middlenotecounter {
  139. label {Midle note}
  140. 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
  141. code0 {o->init("Pmiddlenote");}
  142. class Fl_Osc_Counter
  143. }
  144. Fl_Value_Output mapsizeoutput {
  145. label {Map Size}
  146. xywh {201 382 44 20} labelsize 10 align 5 maximum 500 step 1 value 12 textfont 1
  147. code0 {o->init("Pmapsize");}
  148. class Fl_Osc_Output
  149. }
  150. }
  151. Fl_Check_Button mappingenabledbutton {
  152. label ON
  153. callback {if (o->value()==0) keymappinggroup->deactivate();
  154. else keymappinggroup->activate();
  155. o->show();}
  156. tooltip {Enable the Mapping (otherwise the mapping is linear)} xywh {198 150 48 21} box FLAT_BOX down_box DOWN_BOX labelfont 1
  157. code0 {o->init("Pmappingenabled");}
  158. class Fl_Osc_Check
  159. }
  160. Fl_Button {} {
  161. label {Import .kbm file}
  162. callback {
  163. const char *filename;
  164. filename=fl_file_chooser("Open:","(*.kbm)",NULL,0);
  165. if (filename==NULL) return;
  166. osc->write("/load_kbm", "s", filename);
  167. if (true) {
  168. updateMappingInput();
  169. mappinginput->position(0);
  170. mapsizeoutput->update();
  171. firstnotecounter->update();
  172. lastnotecounter->update();
  173. middlenotecounter->update();
  174. mappingenabledbutton->update();
  175. afreqinput->update();
  176. anotecounter->update();
  177. }}
  178. tooltip {Inport Scala .kbm file (keyboard mapping)} xywh {243 428 84 16} box THIN_UP_BOX labelfont 1 labelsize 10
  179. }
  180. }
  181. Fl_Group {} {
  182. xywh {108 2 140 45} box ENGRAVED_FRAME
  183. } {
  184. Fl_Counter anotecounter {
  185. label {"A" Note}
  186. callback {
  187. /*if (microtonal->getnotefreq(o->value(),0)<0.0) o->textcolor(FL_RED);
  188. else o->textcolor(FL_BLACK);*/
  189. o->redraw();}
  190. 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
  191. code0 {o->lstep(12);}
  192. code1 {o->init("PAnote");}
  193. class Fl_Osc_Counter
  194. }
  195. Fl_Value_Input afreqinput {
  196. label {"A" Freq.}
  197. 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
  198. code0 {o->init("PAfreq");}
  199. class Fl_Osc_Value
  200. }
  201. }
  202. Fl_Button {} {
  203. label Close
  204. callback {microtonaluiwindow->hide();}
  205. xywh {333 413 67 28} box THIN_UP_BOX
  206. }
  207. Fl_Check_Button {} {
  208. label {Enable Microtonal}
  209. callback {if (o->value()==0) microtonalgroup->deactivate();
  210. else microtonalgroup->activate();}
  211. xywh {3 3 102 45} box UP_BOX down_box DOWN_BOX labelfont 1 labelsize 11 align 148
  212. code0 {o->init("Penabled");}
  213. class Fl_Osc_Check
  214. }
  215. }
  216. }
  217. Function {updateTuningsInput()} {} {
  218. code {tuningsinput->update();} {}
  219. }
  220. Function {updateMappingInput()} {} {
  221. code { mappinginput->update(); } {}
  222. }
  223. Function {MicrotonalUI(Fl_Osc_Interface *osc_, std::string base)} {} {
  224. code {osc=osc_;make_window(osc, base);} {}
  225. }
  226. Function {~MicrotonalUI()} {} {
  227. code {microtonaluiwindow->hide();
  228. delete(microtonaluiwindow);} {}
  229. }
  230. Function {show()} {} {
  231. code {microtonaluiwindow->show();} {}
  232. }
  233. Function {apply()} {} {
  234. code {
  235. osc->write("/microtonal/tunings", "s", tuningsinput->value());
  236. osc->write("/microtonal/mapping", "s", mappinginput->value());
  237. octavesizeoutput->update();
  238. mapsizeoutput->update();
  239. anotecounter->update();
  240. } {}
  241. }
  242. decl {Fl_Osc_Interface *osc;} {private local
  243. }
  244. }