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.

MasterUI.fl 59KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885
  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0110
  3. header_name {.h}
  4. code_name {.cc}
  5. decl {//Copyright (c) 2002-2009 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 "WidgetPDial.h"} {public
  14. }
  15. decl {\#include "ADnoteUI.h"} {public
  16. }
  17. decl {\#include "SUBnoteUI.h"} {public
  18. }
  19. decl {\#include "EffUI.h"} {public
  20. }
  21. decl {\#include "VirKeyboard.h"} {public
  22. }
  23. decl {\#include "ConfigUI.h"} {public
  24. }
  25. decl {\#include "BankUI.h"} {public
  26. }
  27. decl {\#include "PartUI.h"} {public
  28. }
  29. decl {\#include "MicrotonalUI.h"} {public
  30. }
  31. decl {\#include "PresetsUI.h"} {public
  32. }
  33. decl {\#include "NioUI.h"} {public global
  34. }
  35. decl {\#include "../Misc/Master.h"} {public
  36. }
  37. decl {\#include "../Misc/Part.h"} {public
  38. }
  39. decl {\#include "../Misc/Util.h"} {public
  40. }
  41. decl {\#include "common.H"} {public
  42. }
  43. decl {\#if USE_NSM
  44. \#include "NSM.H"
  45. extern NSM_Client *nsm;
  46. \#endif} {public
  47. }
  48. decl {\#include "../globals.h"} {public
  49. }
  50. class VUMeter {: {public Fl_Box}
  51. } {
  52. Function {VUMeter(int x,int y, int w, int h, const char *label=0):Fl_Box(x,y,w,h,label)} {} {
  53. code {master=NULL;
  54. npart=-1;} {}
  55. }
  56. Function {init(Master *master_,int part_)} {} {
  57. code {//the "part_" parameters sets the part (if it is >=0), else it sets the master
  58. master=master_;
  59. label(NULL);
  60. npart=part_;
  61. olddbl=0.0;
  62. olddbr=0.0;
  63. oldrmsdbl=0.0;
  64. oldrmsdbr=0.0;} {}
  65. }
  66. Function {draw_master()} {} {
  67. code {\#define MIN_DB (-48)
  68. int ox=x(); int oy=y(); int lx=w(); int ly=h();
  69. vuData data = master->getVuData();
  70. //pthread_mutex_lock(&master->mutex);
  71. float dbl=rap2dB(data.outpeakl);
  72. float dbr=rap2dB(data.outpeakr);
  73. float rmsdbl=rap2dB(data.rmspeakl);
  74. float rmsdbr=rap2dB(data.rmspeakr);
  75. float maxdbl=rap2dB(data.maxoutpeakl);
  76. float maxdbr=rap2dB(data.maxoutpeakr);
  77. int clipped=data.clipped;
  78. //pthread_mutex_unlock(&master->mutex);
  79. dbl=(MIN_DB-dbl)/MIN_DB;
  80. if (dbl<0.0) dbl=0.0;
  81. else if (dbl>1.0)dbl=1.0;
  82. dbr=(MIN_DB-dbr)/MIN_DB;
  83. if (dbr<0.0) dbr=0.0;
  84. else if (dbr>1.0) dbr=1.0;
  85. dbl=dbl*0.4+olddbl*0.6;
  86. dbr=dbr*0.4+olddbr*0.6;
  87. if ( damage() & FL_DAMAGE_USER1 )
  88. {
  89. if ( olddbl == dbl && olddbr == dbr )
  90. return;
  91. }
  92. olddbl=dbl;
  93. olddbr=dbr;
  94. \#define VULENX (lx-35)
  95. \#define VULENY (ly/2-3)
  96. dbl*=VULENX;dbr*=VULENX;
  97. int idbl=(int) dbl;
  98. int idbr=(int) dbr;
  99. //compute RMS - start
  100. rmsdbl=(MIN_DB-rmsdbl)/MIN_DB;
  101. if (rmsdbl<0.0) rmsdbl=0.0;
  102. else if (rmsdbl>1.0) rmsdbl=1.0;
  103. rmsdbr=(MIN_DB-rmsdbr)/MIN_DB;
  104. if (rmsdbr<0.0) rmsdbr=0.0;
  105. else if (rmsdbr>1.0) rmsdbr=1.0;
  106. rmsdbl=rmsdbl*0.4+oldrmsdbl*0.6;
  107. rmsdbr=rmsdbr*0.4+oldrmsdbr*0.6;
  108. oldrmsdbl=rmsdbl;
  109. oldrmsdbr=rmsdbr;
  110. rmsdbl*=VULENX;rmsdbr*=VULENX;
  111. int irmsdbl=(int) rmsdbl;
  112. int irmsdbr=(int) rmsdbr;
  113. //compute RMS - end
  114. //draw the vu-meter lines
  115. //db
  116. fl_rectf(ox,oy,idbr,VULENY,0,200,255);
  117. fl_rectf(ox,oy+ly/2,idbl,VULENY,0,200,255);
  118. //black
  119. fl_rectf(ox+idbr,oy,VULENX-idbr,VULENY,0,0,0);
  120. fl_rectf(ox+idbl,oy+ly/2,VULENX-idbl,VULENY,0,0,0);
  121. //draw the scales
  122. float tmp=VULENX*1.0/MIN_DB;
  123. for (int i=1;i<1-MIN_DB;i++){
  124. int tx=VULENX+(int) (tmp*i);
  125. fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,160,200);
  126. if (i%5==0) fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,230,240);
  127. if (i%10==0) fl_rectf(ox+tx-1,oy,2,VULENY+ly/2,0,225,255);
  128. };
  129. //rms
  130. if (irmsdbr>2) fl_rectf(ox+irmsdbr-1,oy,3,VULENY,255,255,0);
  131. if (irmsdbl>2) fl_rectf(ox+irmsdbl-1,oy+ly/2,3,VULENY,255,255,0);
  132. //draw the red box if clipping has occured
  133. if (clipped==0) fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,0,0,10);
  134. else fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,250,10,10);
  135. //draw the maxdB
  136. fl_font(FL_HELVETICA|FL_BOLD,10);
  137. fl_color(255,255,255);
  138. char tmpstr[10];
  139. if ((maxdbl>MIN_DB-20)){
  140. snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbr);
  141. fl_draw(tmpstr,ox+VULENX+1,oy+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0);
  142. };
  143. if ((maxdbr>MIN_DB-20)){
  144. snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbl);
  145. fl_draw(tmpstr,ox+VULENX+1,oy+ly/2+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0);
  146. };} {}
  147. }
  148. Function {draw_part()} {} {
  149. code {\#define MIN_DB (-48)
  150. int ox=x(); int oy=y(); int lx=w(); int ly=h();
  151. if (!active_r()){
  152. pthread_mutex_lock(&master->vumutex);
  153. int fakedb=master->fakepeakpart[npart];
  154. pthread_mutex_unlock(&master->vumutex);
  155. fl_rectf(ox,oy,lx,ly,140,140,140);
  156. if (fakedb>0){
  157. fakedb=(int)(fakedb/255.0*ly)+4;
  158. fl_rectf(ox+2,oy+ly-fakedb,lx-4,fakedb,0,0,0);
  159. };
  160. return;
  161. };
  162. //draw the vu lines
  163. pthread_mutex_lock(&master->vumutex);
  164. float db=rap2dB(master->vuoutpeakpart[npart]);
  165. pthread_mutex_unlock(&master->vumutex);
  166. db=(MIN_DB-db)/MIN_DB;
  167. if (db<0.0) db=0.0;
  168. else if (db>1.0) db=1.0;
  169. db*=ly-2;
  170. int idb=(int) db;
  171. fl_rectf(ox,oy+ly-idb,lx,idb,0,200,255);
  172. fl_rectf(ox,oy,lx,ly-idb,0,0,0);
  173. //draw the scales
  174. float tmp=ly*1.0/MIN_DB;
  175. for (int i=1;i<1-MIN_DB;i++){
  176. int ty=ly+(int) (tmp*i);
  177. if (i%5==0) fl_rectf(ox,oy+ly-ty,lx,1,0,160,200);
  178. if (i%10==0) fl_rectf(ox,oy+ly-ty,lx,1,0,230,240);
  179. };} {}
  180. }
  181. Function {draw()} {} {
  182. code {if (npart>=0) draw_part();
  183. else draw_master();} {}
  184. }
  185. Function {tickdraw(VUMeter *o)} {return_type {static void}
  186. } {
  187. code {o->damage(FL_DAMAGE_USER1);} {}
  188. }
  189. Function {tick(void *v)} {return_type {static void}
  190. } {
  191. code {tickdraw((VUMeter *) v);
  192. Fl::repeat_timeout(1.0/18.0,tick,v);//18 fps} {}
  193. }
  194. Function {handle(int event)} {return_type int
  195. } {
  196. code {switch(event){
  197. case FL_SHOW:
  198. Fl::add_timeout(1.0/18.0,tick,this);
  199. break;
  200. case FL_HIDE:
  201. Fl::remove_timeout(tick,this);
  202. break;
  203. case FL_PUSH:
  204. if (npart>=0) break;
  205. pthread_mutex_lock(&master->mutex);
  206. master->vuresetpeaks();
  207. pthread_mutex_unlock(&master->mutex);
  208. break;
  209. };
  210. return(1);} {}
  211. }
  212. decl {Master *master;} {}
  213. decl {int npart;} {}
  214. decl {float olddbl,olddbr;} {}
  215. decl {float oldrmsdbl,oldrmsdbr;} {}
  216. }
  217. class SysEffSend {open : {public WidgetPDial}
  218. } {
  219. Function {SysEffSend(int x,int y, int w, int h, const char *label=0):WidgetPDial(x,y,w,h,label)} {} {
  220. code {master=NULL;
  221. neff1=0;
  222. neff2=0;} {}
  223. }
  224. Function {init(Master *master_,int neff1_,int neff2_)} {} {
  225. code {neff1=neff1_;
  226. neff2=neff2_;
  227. master=master_;
  228. minimum(0);
  229. maximum(127);
  230. step(1);
  231. labelfont(1);
  232. labelsize(10);
  233. align(FL_ALIGN_TOP);
  234. value(master->Psysefxsend[neff1][neff2]);
  235. char tmp[20];snprintf(tmp,20,"%d->%d",neff1+1,neff2+1);
  236. this->copy_label(tmp);} {}
  237. }
  238. Function {~SysEffSend()} {} {
  239. code {hide();} {}
  240. }
  241. Function {handle(int event)} {return_type int
  242. } {
  243. code {if ((event==FL_PUSH) || (event==FL_DRAG)){
  244. master->setPsysefxsend(neff1,neff2,(int) value());
  245. };
  246. return(WidgetPDial::handle(event));} {}
  247. }
  248. decl {Master *master;} {}
  249. decl {int neff1;} {}
  250. decl {int neff2;} {}
  251. }
  252. class Panellistitem {open : {public Fl_Group}
  253. } {
  254. Function {make_window()} {open private
  255. } {
  256. Fl_Window panellistitem {open
  257. private xywh {608 711 100 260} type Double box NO_BOX
  258. class Fl_Group visible
  259. } {
  260. Fl_Group panellistitemgroup {open
  261. private xywh {0 20 70 240} box UP_FRAME
  262. code0 {if (master->part[npart]->Penabled==0) o->deactivate();}
  263. code1 {set_module_parameters( o );}
  264. } {
  265. Fl_Group {} {
  266. xywh {45 65 15 110} box ENGRAVED_FRAME
  267. } {
  268. Fl_Box {} {
  269. label {V U}
  270. xywh {45 65 15 110} box FLAT_BOX color 0 selection_color 75 labelcolor 55 align 128
  271. code0 {o->init(master,npart);}
  272. class VUMeter
  273. }
  274. }
  275. Fl_Button partname {
  276. label { }
  277. callback {if ((int)bankui->cbwig->value()!=(npart+1)){
  278. bankui->cbwig->value(npart+1);
  279. bankui->cbwig->do_callback();
  280. };
  281. bankui->show();}
  282. xywh {5 27 60 30} box THIN_DOWN_BOX down_box FLAT_BOX labelfont 1 labelsize 10 align 208
  283. }
  284. Fl_Slider partvolume {
  285. callback {master->part[npart]->setPvolume((int) o->value());}
  286. xywh {10 65 30 110} type {Vert Knob} box NO_BOX minimum 127 maximum 0 step 1 value 127
  287. code0 {o->value(master->part[npart]->Pvolume);}
  288. }
  289. Fl_Dial partpanning {
  290. callback {master->part[npart]->setPpanning((int) o->value());}
  291. xywh {20 180 30 30} maximum 127 step 1
  292. code0 {o->value(master->part[npart]->Ppanning);}
  293. class WidgetPDial
  294. }
  295. Fl_Button {} {
  296. label edit
  297. callback {if ((int)bankui->cbwig->value()!=(npart+1)){
  298. bankui->cbwig->value(npart+1);
  299. bankui->cbwig->do_callback();
  300. };}
  301. xywh {15 235 40 20} labelsize 10
  302. }
  303. Fl_Choice partrcv {
  304. callback {master->part[npart]->Prcvchn=(int) o->value();}
  305. tooltip {receive from Midi channel} xywh {10 213 50 15} down_box BORDER_BOX labelsize 10 align 5 textfont 1 textsize 10
  306. code0 {char nrstr[10]; for(int i=0;i<NUM_MIDI_CHANNELS;i++){sprintf(nrstr,"Ch%d",i+1);if (i!=9) o->add(nrstr); else o->add("Dr10");};}
  307. code1 {o->value(master->part[npart]->Prcvchn);}
  308. } {}
  309. }
  310. Fl_Check_Button partenabled {
  311. label 01
  312. callback {pthread_mutex_lock(&master->mutex);
  313. master->partonoff(npart,(int) o->value());
  314. pthread_mutex_unlock(&master->mutex);
  315. if ((int) o->value()==0) panellistitemgroup->deactivate();
  316. else {
  317. panellistitemgroup->activate();
  318. if ((int)bankui->cbwig->value()!=(npart+1)){
  319. bankui->cbwig->value(npart+1);
  320. bankui->cbwig->do_callback();
  321. };
  322. };
  323. o->redraw();}
  324. private xywh {5 0 45 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 24
  325. code0 {char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp);}
  326. code1 {o->value(master->part[npart]->Penabled);}
  327. }
  328. }
  329. }
  330. Function {Panellistitem(int x,int y, int w, int h, const char *label=0):Fl_Group(x,y,w,h,label)} {} {
  331. code {npart=0;
  332. master=NULL;
  333. bankui=NULL;} {}
  334. }
  335. Function {init(Master *master_, int npart_,BankUI *bankui_)} {} {
  336. code {npart=npart_;
  337. master=master_;
  338. bankui=bankui_;
  339. make_window();
  340. panellistitem->show();
  341. end();} {}
  342. }
  343. Function {refresh()} {} {
  344. code {partenabled->value(master->part[npart]->Penabled);
  345. if (master->part[npart]->Penabled!=0) panellistitemgroup->activate();
  346. else panellistitemgroup->deactivate();
  347. partvolume->value(master->part[npart]->Pvolume);
  348. partpanning->value(master->part[npart]->Ppanning);
  349. partrcv->value(master->part[npart]->Prcvchn);
  350. partname->label((char *)master->part[npart]->Pname);
  351. if ((int)bankui->cbwig->value()!=(npart+1))
  352. panellistitemgroup->color(fl_rgb_color(160,160,160));
  353. else
  354. panellistitemgroup->color(fl_rgb_color(50,190,240));
  355. panellistitemgroup->redraw();} {}
  356. }
  357. Function {~Panellistitem()} {} {
  358. code {panellistitem->hide();
  359. //delete(panellistitem);} {}
  360. }
  361. decl {int npart;} {}
  362. decl {Master *master;} {}
  363. decl {BankUI *bankui;} {}
  364. }
  365. class MasterUI {open
  366. } {
  367. Function {make_window()} {open
  368. } {
  369. Fl_Window masterwindow {
  370. label zynaddsubfx
  371. callback {if ((
  372. \#ifdef PLUGINVERSION
  373. 1
  374. \#elif USE_NSM
  375. (nsm && nsm->is_active())
  376. \#else
  377. 0
  378. \#endif
  379. || fl_choice("Exit and leave the unsaved data?","No","Yes",NULL))) {
  380. config.save();
  381. *exitprogram=1;
  382. };
  383. } open
  384. xywh {80 370 390 525} type Double xclass zynaddsubfx visible
  385. } {
  386. Fl_Menu_Bar mastermenu {
  387. xywh {-5 0 690 25}
  388. } {
  389. Submenu {} {
  390. label {&File}
  391. xywh {0 0 100 20}
  392. } {
  393. MenuItem {} {
  394. label {&New (erase all)...}
  395. callback {do_new_master();}
  396. xywh {20 20 100 20}
  397. }
  398. MenuItem {} {
  399. label {&Open Parameters...}
  400. callback {\#if USE_NSM
  401. if ( nsm && nsm->is_active() )
  402. {
  403. do_load_master();
  404. do_save_master( nsm->project_filename );
  405. }
  406. else
  407. \#endif
  408. {
  409. do_load_master();
  410. }}
  411. xywh {20 20 100 20}
  412. }
  413. MenuItem {} {
  414. label {&Save All Parameters...}
  415. callback {\#if USE_NSM
  416. if ( nsm && nsm->is_active() )
  417. {
  418. do_save_master( nsm->project_filename );
  419. }
  420. else
  421. \#endif
  422. {
  423. do_save_master();
  424. }}
  425. xywh {10 10 100 20} divider
  426. }
  427. MenuItem {} {
  428. label {&Load Scale Settings...}
  429. callback {char *filename;
  430. filename=fl_file_chooser("Open:","({*.xsz})",NULL,0);
  431. if (filename==NULL) return;
  432. pthread_mutex_lock(&master->mutex);
  433. //clear all parameters
  434. master->microtonal.defaults();
  435. //load the data
  436. int result=master->microtonal.loadXML(filename);
  437. pthread_mutex_unlock(&master->mutex);
  438. delete microtonalui;
  439. microtonalui=new MicrotonalUI(&master->microtonal);
  440. if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not a scale file.");
  441. else if (result<0) fl_alert("Error: Could not load the file.");}
  442. xywh {35 35 100 20}
  443. }
  444. MenuItem {} {
  445. label {Save Sc&ale Settings ..}
  446. callback {char *filename;
  447. int result=0;
  448. filename=fl_file_chooser("Save:","({*.xsz})",NULL,0);
  449. if (filename==NULL) return;
  450. filename=fl_filename_setext(filename,".xsz");
  451. result=fileexists(filename);
  452. if (result) {
  453. result=0;
  454. if (!fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) return;
  455. };
  456. pthread_mutex_lock(&master->mutex);
  457. result=master->microtonal.saveXML(filename);
  458. pthread_mutex_unlock(&master->mutex);
  459. if (result<0) fl_alert("Error: Could not save the file.");
  460. updatepanel();}
  461. xywh {25 25 100 20}
  462. }
  463. MenuItem {} {
  464. label {Show Scale Settings...}
  465. callback {microtonalui->show();}
  466. xywh {0 0 100 20} divider
  467. }
  468. MenuItem {} {
  469. label {&Settings...}
  470. callback {configui->show();}
  471. xywh {25 25 100 20}
  472. }
  473. MenuItem {} {
  474. label {N&io Settings}
  475. callback {nioui.refresh();
  476. nioui.show();}
  477. xywh {0 0 36 21} divider
  478. }
  479. MenuItem {} {
  480. label {&Copyright...}
  481. callback {aboutwindow->show();}
  482. xywh {15 15 100 20} divider
  483. }
  484. MenuItem {} {
  485. label {E&xit}
  486. callback {masterwindow->do_callback();}
  487. xywh {10 10 100 20}
  488. }
  489. }
  490. Submenu {} {
  491. label {&Instrument}
  492. xywh {10 10 100 20}
  493. } {
  494. MenuItem {} {
  495. label {&Clear Instrument...}
  496. callback {if (fl_choice("Clear instrument's parameters ?","No","Yes",NULL)){
  497. // int npart=(int)npartcounter->value()-1;
  498. pthread_mutex_lock(&master->mutex);
  499. master->part[npart]->defaultsinstrument();
  500. pthread_mutex_unlock(&master->mutex);
  501. npartcounter->do_callback();
  502. };
  503. updatepanel();}
  504. xywh {35 35 100 20}
  505. }
  506. MenuItem {} {
  507. label {&Open Instrument...}
  508. callback {const char *filename;
  509. filename=fl_file_chooser("Load:","({*.xiz})",NULL,0);
  510. if (filename==NULL) return;
  511. pthread_mutex_lock(&master->mutex);
  512. // int npart=(int)npartcounter->value()-1;
  513. //clear all instrument parameters, first
  514. master->part[npart]->defaultsinstrument();
  515. //load the instr. parameters
  516. int result=master->part[npart]->loadXMLinstrument(filename);
  517. pthread_mutex_unlock(&master->mutex);
  518. master->part[npart]->applyparameters();
  519. npartcounter->do_callback();
  520. updatepanel();
  521. if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not an instrument file.");
  522. else if (result<0) fl_alert("Error: Could not load the file.");}
  523. xywh {30 30 100 20}
  524. }
  525. MenuItem {} {
  526. label {&Save Instrument ...}
  527. callback {char *filename;
  528. filename=fl_file_chooser("Save:","({*.xiz})",NULL,0);
  529. if (filename==NULL) return;
  530. filename=fl_filename_setext(filename,".xiz");
  531. int result=fileexists(filename);
  532. if (result) {
  533. result=0;
  534. if (!fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL)) return;
  535. };
  536. pthread_mutex_lock(&master->mutex);
  537. result=master->part[npart]->saveXML(filename);
  538. pthread_mutex_unlock(&master->mutex);
  539. if (result<0) fl_alert("Error: Could not save the file.");
  540. updatepanel();}
  541. xywh {20 20 100 20} divider
  542. }
  543. MenuItem {} {
  544. label {Show Instrument &Bank...}
  545. callback {bankui->show();}
  546. xywh {0 0 100 20} divider
  547. }
  548. MenuItem {} {
  549. label {&Virtual Keyboard...}
  550. callback {virkeyboard->show();}
  551. xywh {10 10 100 20}
  552. }
  553. }
  554. Submenu recordmenu {
  555. label {&Record}
  556. xywh {0 0 100 20}
  557. } {
  558. MenuItem {} {
  559. label {&Choose WAV file...}
  560. callback {char *filename;
  561. recordbutton->deactivate();
  562. pausebutton->deactivate();
  563. pauselabel->deactivate();
  564. stopbutton->deactivate();
  565. filename=fl_file_chooser("Record to audio file:","(*.wav)",NULL,0);
  566. if (filename==NULL) return;
  567. fl_filename_setext(filename,".wav");
  568. int result=master->HDDRecorder.preparefile(filename,0);
  569. if (result==1) {
  570. result=0;
  571. if (fl_choice("The file exists. \\nOverwrite it?","No","Yes",NULL))
  572. master->HDDRecorder.preparefile(filename,1);
  573. };
  574. if (result==0) recordbutton->activate();
  575. if (result!=0) fl_alert("Error: Could not save the file.");}
  576. xywh {0 0 100 20}
  577. }
  578. }
  579. Submenu {} {
  580. label Misc
  581. xywh {10 10 100 20}
  582. } {
  583. MenuItem {} {
  584. label {Switch User Interface Mode}
  585. callback {if (fl_choice("Switch the User Interface to Beginner mode ?","No","Yes",NULL)){
  586. masterwindow->hide();
  587. refresh_master_ui();
  588. simplemasterwindow->show();
  589. config.cfg.UserInterfaceMode=2;
  590. };}
  591. xywh {10 10 100 20}
  592. }
  593. }
  594. }
  595. Fl_Dial mastervolumedial {
  596. label {Master Volume}
  597. callback {master->setPvolume((int) o->value());}
  598. tooltip {Master Volume} xywh {15 32 55 55} box ROUND_UP_BOX labelsize 9 align 130 maximum 127 step 1
  599. code0 {o->value(master->Pvolume);}
  600. class WidgetPDial
  601. }
  602. Fl_Counter masterkeyshiftcounter {
  603. label {Master KeyShift}
  604. callback {master->setPkeyshift((int) o->value()+64);}
  605. xywh {150 97 120 23} type Simple labelsize 9 minimum -64 maximum 64 step 1
  606. code0 {o->lstep(12);}
  607. code1 {o->value(master->Pkeyshift-64);}
  608. }
  609. Fl_Button {} {
  610. label {Panic!}
  611. callback {virkeyboard->relaseallkeys();
  612. pthread_mutex_lock(&master->mutex);
  613. master->shutup=1;
  614. pthread_mutex_unlock(&master->mutex);}
  615. xywh {280 29 105 53} color 90 labelfont 1
  616. }
  617. Fl_Group partuigroup {open
  618. xywh {0 310 390 205}
  619. } {
  620. Fl_Group partui {open selected
  621. xywh {0 310 383 175}
  622. code0 {o->init(master->part[0],master,0,bankui);}
  623. code1 {o->show();}
  624. class PartUI
  625. } {}
  626. }
  627. Fl_Tabs {} {open
  628. xywh {0 145 390 165} box UP_FRAME
  629. } {
  630. Fl_Group {} {
  631. label {System Effects} open
  632. xywh {0 162 390 145} labelsize 15 align 9
  633. } {
  634. Fl_Counter syseffnocounter {
  635. label {Sys.Effect No.}
  636. callback {nsyseff=(int) o->value()-1;
  637. sysefftype->value(master->sysefx[nsyseff]->geteffect());
  638. syseffectui->refresh(master->sysefx[nsyseff]);}
  639. xywh {5 181 80 22} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  640. code0 {o->bounds(1,NUM_SYS_EFX);}
  641. code1 {o->value(nsyseff+1);}
  642. }
  643. Fl_Choice sysefftype {
  644. label EffType
  645. callback {pthread_mutex_lock(&master->mutex);
  646. master->sysefx[nsyseff]->changeeffect((int) o->value());
  647. pthread_mutex_unlock(&master->mutex);
  648. syseffectui->refresh(master->sysefx[nsyseff]);}
  649. xywh {285 176 100 22} down_box BORDER_BOX labelsize 10
  650. code0 {o->value(master->sysefx[nsyseff]->geteffect());}
  651. } {
  652. MenuItem {} {
  653. label {No Effect}
  654. xywh {10 10 100 20} labelfont 1 labelsize 10
  655. }
  656. MenuItem {} {
  657. label Reverb
  658. xywh {20 20 100 20} labelfont 1 labelsize 10
  659. }
  660. MenuItem {} {
  661. label Echo
  662. xywh {30 30 100 20} labelfont 1 labelsize 10
  663. }
  664. MenuItem {} {
  665. label Chorus
  666. xywh {40 40 100 20} labelfont 1 labelsize 10
  667. }
  668. MenuItem {} {
  669. label Phaser
  670. xywh {50 50 100 20} labelfont 1 labelsize 10
  671. }
  672. MenuItem {} {
  673. label AlienWah
  674. xywh {60 60 100 20} labelfont 1 labelsize 10
  675. }
  676. MenuItem {} {
  677. label Distortion
  678. xywh {70 70 100 20} labelfont 1 labelsize 10
  679. }
  680. MenuItem {} {
  681. label EQ
  682. xywh {80 80 100 20} labelfont 1 labelsize 10
  683. }
  684. MenuItem {} {
  685. label DynFilter
  686. xywh {90 90 100 20} labelfont 1 labelsize 10
  687. }
  688. }
  689. Fl_Group syseffectuigroup {open
  690. xywh {5 203 380 95} color 48
  691. } {
  692. Fl_Group syseffectui {
  693. xywh {5 203 380 95}
  694. code0 {o->init(master->sysefx[nsyseff]);}
  695. class EffUI
  696. } {}
  697. }
  698. Fl_Button {} {
  699. label {Send to...}
  700. callback {syseffsendwindow->show();}
  701. xywh {90 181 85 22} box THIN_UP_BOX labelfont 1 labelsize 11
  702. }
  703. Fl_Button {} {
  704. label C
  705. callback {presetsui->copy(master->sysefx[nsyseff]);}
  706. xywh {180 187 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  707. }
  708. Fl_Button {} {
  709. label P
  710. callback {pthread_mutex_lock(&master->mutex);
  711. presetsui->paste(master->sysefx[nsyseff],syseffectui);
  712. pthread_mutex_unlock(&master->mutex);}
  713. xywh {210 187 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  714. }
  715. }
  716. Fl_Group {} {
  717. label {Insertion Effects} open
  718. xywh {0 165 390 145} labelsize 15 align 9 hide
  719. } {
  720. Fl_Counter inseffnocounter {
  721. label {Ins.Effect No.}
  722. callback {ninseff=(int) o->value()-1;
  723. insefftype->value(master->insefx[ninseff]->geteffect());
  724. inseffpart->value(master->Pinsparts[ninseff]+2);
  725. inseffectui->refresh(master->insefx[ninseff]);
  726. if (master->Pinsparts[ninseff]!=-1) {
  727. insefftype->activate();
  728. inseffectui->activate();
  729. inseffectuigroup->activate();
  730. } else {
  731. insefftype->deactivate();
  732. inseffectui->deactivate();
  733. inseffectuigroup->deactivate();
  734. };}
  735. xywh {5 183 80 22} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  736. code0 {o->bounds(1,NUM_INS_EFX);}
  737. code1 {o->value(ninseff+1);}
  738. }
  739. Fl_Choice insefftype {
  740. label EffType
  741. callback {pthread_mutex_lock(&master->mutex);
  742. master->insefx[ninseff]->changeeffect((int) o->value());
  743. pthread_mutex_unlock(&master->mutex);
  744. inseffectui->refresh(master->insefx[ninseff]);
  745. inseffectui->show();}
  746. xywh {285 173 100 22} down_box BORDER_BOX labelsize 10
  747. code0 {o->value(master->insefx[ninseff]->geteffect());}
  748. code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();}
  749. } {
  750. MenuItem {} {
  751. label {No Effect}
  752. xywh {25 25 100 20} labelfont 1 labelsize 10
  753. }
  754. MenuItem {} {
  755. label Reverb
  756. xywh {35 35 100 20} labelfont 1 labelsize 10
  757. }
  758. MenuItem {} {
  759. label Echo
  760. xywh {45 45 100 20} labelfont 1 labelsize 10
  761. }
  762. MenuItem {} {
  763. label Chorus
  764. xywh {55 55 100 20} labelfont 1 labelsize 10
  765. }
  766. MenuItem {} {
  767. label Phaser
  768. xywh {60 60 100 20} labelfont 1 labelsize 10
  769. }
  770. MenuItem {} {
  771. label AlienWah
  772. xywh {70 70 100 20} labelfont 1 labelsize 10
  773. }
  774. MenuItem {} {
  775. label Distortion
  776. xywh {80 80 100 20} labelfont 1 labelsize 10
  777. }
  778. MenuItem {} {
  779. label EQ
  780. xywh {90 90 100 20} labelfont 1 labelsize 10
  781. }
  782. MenuItem {} {
  783. label DynFilter
  784. xywh {100 100 100 20} labelfont 1 labelsize 10
  785. }
  786. }
  787. Fl_Group inseffectuigroup {open
  788. xywh {5 205 380 95} box FLAT_BOX color 48
  789. } {
  790. Fl_Group inseffectui {
  791. xywh {5 205 380 90} box UP_FRAME
  792. code0 {o->init(master->insefx[ninseff]);}
  793. code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();}
  794. class EffUI
  795. } {}
  796. }
  797. Fl_Choice inseffpart {
  798. label {Insert To.}
  799. callback {master->Pinsparts[ninseff]=(int) o->value()-2;
  800. if ((int) o->value()==1){
  801. inseffectuigroup->deactivate();
  802. insefftype->deactivate();
  803. inseffectui->deactivate();
  804. } else {
  805. inseffectuigroup->activate();
  806. insefftype->activate();
  807. inseffectui->activate();
  808. };
  809. master->insefx[ninseff]->cleanup();} open
  810. xywh {95 183 80 22} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 10
  811. code0 {o->add("Master Out");o->add("Off");}
  812. code1 {char tmp[50]; for (int i=0;i<NUM_MIDI_PARTS;i++) {sprintf(tmp,"Part %2d",i+1);o->add(tmp);};}
  813. code3 {o->value(master->Pinsparts[ninseff]+2);}
  814. } {}
  815. Fl_Button {} {
  816. label C
  817. callback {presetsui->copy(master->insefx[ninseff]);}
  818. xywh {180 185 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  819. }
  820. Fl_Button {} {
  821. label P
  822. callback {pthread_mutex_lock(&master->mutex);
  823. presetsui->paste(master->insefx[ninseff],inseffectui);
  824. pthread_mutex_unlock(&master->mutex);}
  825. xywh {210 185 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  826. }
  827. }
  828. }
  829. Fl_Button {} {
  830. label Scales
  831. callback {microtonalui->show();}
  832. xywh {320 87 65 23} color 51 labelfont 1
  833. }
  834. Fl_Group {} {
  835. xywh {150 40 117 45} box UP_FRAME
  836. } {
  837. Fl_Button recordbutton {
  838. label {Rec.}
  839. callback {o->deactivate();
  840. recordmenu->deactivate();
  841. recordmenu->label("&Record(*)");
  842. stopbutton->activate();
  843. pausebutton->activate();
  844. pauselabel->activate();
  845. master->HDDRecorder.start();
  846. master->vuresetpeaks();
  847. mastermenu->redraw();}
  848. tooltip {Start Recording} xywh {159 46 21 21} box ROUND_UP_BOX color 88 labelfont 1 labelsize 10 align 2 deactivate
  849. }
  850. Fl_Button stopbutton {
  851. label Stop
  852. callback {o->deactivate();
  853. master->HDDRecorder.stop();
  854. recordbutton->deactivate();
  855. pausebutton->deactivate();
  856. pauselabel->deactivate();
  857. recordmenu->activate();
  858. recordmenu->label("&Record");
  859. mastermenu->redraw();}
  860. tooltip {Stop Recording and close the audio file} xywh {237 46 21 21} box THIN_UP_BOX color 4 labelfont 1 labelsize 10 align 2 deactivate
  861. }
  862. Fl_Button pausebutton {
  863. label {@||}
  864. callback {o->deactivate();
  865. master->HDDRecorder.pause();
  866. recordbutton->activate();
  867. mastermenu->redraw();}
  868. tooltip {Pause Recording} xywh {198 46 21 21} box THIN_UP_BOX color 4 selection_color 4 labelfont 1 labelcolor 3 align 16 deactivate
  869. }
  870. Fl_Box pauselabel {
  871. label Pause
  872. xywh {192 66 30 15} labelfont 1 labelsize 10 deactivate
  873. }
  874. }
  875. Fl_Group {} {open
  876. xywh {1 490 389 55}
  877. } {
  878. Fl_Box {} {
  879. label {VU-Meter}
  880. xywh {5 490 380 30} box FLAT_BOX color 48 selection_color 75
  881. code0 {o->init(master,-1);}
  882. class VUMeter
  883. }
  884. }
  885. Fl_Check_Button nrpnbutton {
  886. label NRPN
  887. callback {master->ctl.NRPN.receive=(int) o->value();}
  888. tooltip {Receive NRPNs} xywh {10 115 60 25} down_box DOWN_BOX labelsize 12
  889. code0 {o->value(master->ctl.NRPN.receive);}
  890. }
  891. Fl_Counter npartcounter {
  892. callback {int nval=(int) o->value()-1;
  893. partuigroup->remove(partui);
  894. delete partui;
  895. partui=new PartUI(0,0,765,525);
  896. partuigroup->add(partui);
  897. partui->init(master->part[nval],master,nval,bankui);
  898. partui->redraw();
  899. o->redraw();
  900. npart=nval;
  901. updatepanel();
  902. simplenpartcounter->value(nval+1);
  903. simplenpartcounter->do_callback();}
  904. tooltip {The part number} xywh {5 312 50 18} type Simple labelfont 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  905. code0 {o->bounds(1,NUM_MIDI_PARTS);}
  906. code1 {bankui->init(o);}
  907. }
  908. Fl_Button {} {
  909. label vK
  910. callback {virkeyboard->show();}
  911. tooltip {Virtual Keyboard} xywh {280 87 40 23} color 51 labelfont 1
  912. }
  913. Fl_Group {} {open
  914. xywh {85 32 55 110} box UP_FRAME
  915. } {
  916. Fl_Button {} {
  917. label Reset
  918. callback {globalfinedetuneslider->value(64.0);
  919. globalfinedetuneslider->do_callback();}
  920. tooltip {Master fine detune reset} xywh {90 37 45 23} box THIN_UP_BOX labelsize 10
  921. }
  922. Fl_Dial globalfinedetuneslider {
  923. label {Fine Detune}
  924. callback {master->microtonal.Pglobalfinedetune=(int) o->value();}
  925. tooltip {global fine detune} xywh {90 68 45 45} box ROUND_UP_BOX labelsize 9 align 130 maximum 127 step 1 value 64
  926. code0 {o->value(master->microtonal.Pglobalfinedetune);}
  927. class WidgetPDial
  928. }
  929. }
  930. Fl_Button {} {
  931. label {Panel Window}
  932. callback {updatepanel();
  933. panelwindow->show();}
  934. tooltip {Panel Window} xywh {280 112 105 23} color 51 labelfont 1 labelsize 10
  935. }
  936. Fl_Button sm_indicator1 {
  937. label SM
  938. xywh {350 5 35 15} box ROUNDED_BOX down_box ROUNDED_BOX color 45 selection_color 93 labelfont 3 labelcolor 39 deactivate
  939. }
  940. }
  941. Fl_Window aboutwindow {
  942. label {Copyright...}
  943. xywh {411 344 365 280} type Double hide
  944. } {
  945. Fl_Box {} {
  946. label {Copyright (c) 2002-2009 Nasca O. PAUL and others. Please read AUTHORS.txt}
  947. xywh {15 35 335 55} labeltype EMBOSSED_LABEL labelsize 15 align 208
  948. }
  949. Fl_Box {} {
  950. label {This is free software; you may redistribute it and/or modify it under the terms of the
  951. version 2 (or any later version) of the GNU General Public License as published by the Free Software Fundation.
  952. This program comes with
  953. ABSOLUTELY NO WARRANTY.
  954. See the version 2 (or any later version) of the
  955. GNU General Public License for details.}
  956. xywh {15 90 335 145} labelfont 1 labelsize 11 align 144
  957. }
  958. Fl_Button {} {
  959. label {Close this window}
  960. callback {aboutwindow->hide();}
  961. xywh {80 245 190 25} box THIN_UP_BOX labelsize 11
  962. }
  963. Fl_Box {} {
  964. label ZynAddSubFX
  965. xywh {15 5 335 30} labeltype EMBOSSED_LABEL labelfont 1 labelsize 20 align 16
  966. }
  967. }
  968. Fl_Window syseffsendwindow {
  969. label {System Effects Send}
  970. xywh {171 234 120 250} type Double hide resizable
  971. } {
  972. Fl_Scroll {} {open
  973. xywh {0 45 120 170} box FLAT_BOX resizable
  974. code0 {for (int neff1=0;neff1<NUM_SYS_EFX;neff1++) for (int neff2=neff1+1;neff2<NUM_SYS_EFX;neff2++)}
  975. code1 {{syseffsend[neff1][neff2]=new SysEffSend(o->x()+(neff2-1)*35,o->y()+15+neff1*50,30,30);syseffsend[neff1][neff2]->label("aaa");syseffsend[neff1][neff2]->init(master,neff1,neff2);};}
  976. } {}
  977. Fl_Button {} {
  978. label Close
  979. callback {syseffsendwindow->hide();}
  980. xywh {25 220 80 25} box THIN_UP_BOX
  981. }
  982. Fl_Box {} {
  983. label {Send system effect's output to other system effects}
  984. xywh {5 5 110 35} labelsize 10 align 192
  985. }
  986. }
  987. Fl_Window panelwindow {
  988. label {ZynAddSubFX Panel}
  989. xywh {89 59 630 635} type Double hide
  990. } {
  991. Fl_Scroll {} {
  992. xywh {0 5 570 310} type HORIZONTAL box THIN_UP_BOX
  993. } {
  994. Fl_Pack {} {
  995. xywh {5 10 560 285} type HORIZONTAL
  996. code0 {for (int i=0;i<NUM_MIDI_PARTS/2;i++){panellistitem[i]=new Panellistitem(0,0,70,260,"");panellistitem[i]->init(master,i,bankui);}}
  997. } {}
  998. }
  999. Fl_Scroll {} {
  1000. xywh {0 320 570 310} type HORIZONTAL box THIN_UP_BOX
  1001. } {
  1002. Fl_Pack {} {
  1003. xywh {5 325 560 285} type HORIZONTAL
  1004. code0 {for (int i=NUM_MIDI_PARTS/2;i<NUM_MIDI_PARTS;i++){panellistitem[i]=new Panellistitem(0,0,70,260,"");panellistitem[i]->init(master,i,bankui);}}
  1005. } {}
  1006. }
  1007. Fl_Button {} {
  1008. label Close
  1009. callback {panelwindow->hide();
  1010. updatepanel();}
  1011. xywh {575 605 50 25} box THIN_UP_BOX labelsize 13
  1012. }
  1013. Fl_Button {} {
  1014. label Refresh
  1015. callback {updatepanel();}
  1016. xywh {575 570 55 25} box THIN_UP_BOX labelsize 13
  1017. }
  1018. }
  1019. Fl_Window simplemasterwindow {
  1020. label ZynAddSubFX
  1021. callback {\#ifndef PLUGINVERSION
  1022. if (fl_choice("Exit and leave the unsaved data?","No","Yes",NULL))
  1023. \#endif
  1024. {
  1025. config.save();
  1026. *exitprogram=1;
  1027. };
  1028. } open
  1029. xywh {283 262 600 335} type Double visible
  1030. } {
  1031. Fl_Menu_Bar simplemastermenu {
  1032. xywh {0 0 690 25}
  1033. } {
  1034. Submenu {} {
  1035. label {&File}
  1036. xywh {10 10 100 20}
  1037. } {
  1038. MenuItem {} {
  1039. label {&New (erase all)...}
  1040. callback {do_new_master();}
  1041. xywh {30 30 100 20}
  1042. }
  1043. MenuItem {} {
  1044. label {&Open Parameters...}
  1045. callback {do_load_master();}
  1046. xywh {30 30 100 20}
  1047. }
  1048. MenuItem {} {
  1049. label {&Save All Parameters...}
  1050. callback {\#if USE_NSM
  1051. if ( nsm && nsm->is_active() )
  1052. {
  1053. do_save_master( nsm->project_filename );
  1054. }
  1055. else
  1056. \#endif
  1057. {
  1058. do_save_master();
  1059. }}
  1060. xywh {20 20 100 20} divider
  1061. }
  1062. MenuItem {} {
  1063. label {&Settings...}
  1064. callback {configui->show();}
  1065. xywh {35 35 100 20} divider
  1066. }
  1067. MenuItem {} {
  1068. label {&Copyright...}
  1069. callback {aboutwindow->show();}
  1070. xywh {25 25 100 20} divider
  1071. }
  1072. MenuItem {} {
  1073. label {E&xit}
  1074. callback {masterwindow->do_callback();}
  1075. xywh {20 20 100 20}
  1076. }
  1077. }
  1078. Submenu {} {
  1079. label {&Instrument}
  1080. xywh {20 20 100 20}
  1081. } {
  1082. MenuItem {} {
  1083. label {&Open Instrument...}
  1084. callback {const char *filename;
  1085. filename=fl_file_chooser("Load:","({*.xiz})",NULL,0);
  1086. if (filename==NULL) return;
  1087. pthread_mutex_lock(&master->mutex);
  1088. // int npart=(int)npartcounter->value()-1;
  1089. //clear all instrument parameters, first
  1090. master->part[npart]->defaultsinstrument();
  1091. //load the instr. parameters
  1092. int result=master->part[npart]->loadXMLinstrument(filename);
  1093. pthread_mutex_unlock(&master->mutex);
  1094. master->part[npart]->applyparameters();
  1095. simplenpartcounter->do_callback();
  1096. if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not an instrument file.");
  1097. else if (result<0) fl_alert("Error: Could not load the file.");}
  1098. xywh {40 40 100 20}
  1099. }
  1100. MenuItem {} {
  1101. label {Show Instrument &Bank...}
  1102. callback {bankui->show();}
  1103. xywh {10 10 100 20} divider
  1104. }
  1105. }
  1106. Submenu {} {
  1107. label Misc
  1108. xywh {0 0 100 20}
  1109. } {
  1110. MenuItem {} {
  1111. label {Switch User Interface Mode}
  1112. callback {if (fl_choice("Switch the User Interface to Advanced mode ?","No","Yes",NULL)){
  1113. simplemasterwindow->hide();
  1114. refresh_master_ui();
  1115. masterwindow->show();
  1116. config.cfg.UserInterfaceMode=1;
  1117. };}
  1118. xywh {0 0 100 20}
  1119. }
  1120. }
  1121. }
  1122. Fl_Group simplelistitemgroup {open
  1123. private xywh {125 65 215 145} box UP_FRAME
  1124. code0 {if (master->part[npart]->Penabled==0) o->deactivate();}
  1125. } {
  1126. Fl_Button partname {
  1127. callback {if ((int)bankui->cbwig->value()!=(npart+1)){
  1128. bankui->cbwig->value(npart+1);
  1129. bankui->cbwig->do_callback();
  1130. };
  1131. bankui->show();}
  1132. xywh {130 72 205 18} box THIN_DOWN_BOX down_box FLAT_BOX color 50 labelfont 1 labelsize 11 align 208
  1133. }
  1134. Fl_Slider partpanning {
  1135. label Pan
  1136. callback {master->part[npart]->setPpanning((int) o->value());}
  1137. xywh {185 95 145 15} type {Horz Knob} box NO_BOX labelsize 11 maximum 127 step 1 value 64
  1138. code0 {o->value(master->part[npart]->Ppanning);}
  1139. }
  1140. Fl_Choice partrcv {
  1141. label {Midi Channel Receive}
  1142. callback {virkeys->relaseallkeys(0);
  1143. master->part[npart]->Prcvchn=(int) o->value();
  1144. virkeys->midich=(int) o->value();} open
  1145. tooltip {receive from Midi channel} xywh {140 157 65 18} down_box BORDER_BOX labelsize 10 align 130 textfont 1
  1146. code0 {char nrstr[10]; for(int i=0;i<NUM_MIDI_CHANNELS;i++){sprintf(nrstr,"Ch%d",i+1);if (i!=9) o->add(nrstr); else o->add("Dr10");};}
  1147. code1 {o->value(master->part[npart]->Prcvchn);}
  1148. } {}
  1149. Fl_Dial partvolume {
  1150. callback {master->part[npart]->setPvolume((int) o->value());}
  1151. xywh {135 95 45 40} labelsize 9 maximum 127 step 1
  1152. code0 {o->value(master->part[npart]->Pvolume);}
  1153. class WidgetPDial
  1154. }
  1155. Fl_Box {} {
  1156. label Volume
  1157. xywh {130 130 55 20} labelsize 10
  1158. }
  1159. Fl_Check_Button simplepartportamento {
  1160. label Portamento
  1161. callback {master->part[npart]->ctl.portamento.portamento=(int) o->value();}
  1162. tooltip {Enable/Disable the portamento} xywh {193 127 79 23} down_box DOWN_BOX labelsize 9
  1163. code0 {o->value(master->part[npart]->ctl.portamento.portamento);}
  1164. }
  1165. Fl_Counter simpleminkcounter {
  1166. label {Min.key}
  1167. callback {master->part[npart]->Pminkey=(int) o->value();
  1168. if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED);
  1169. else o->textcolor(FL_BLACK);}
  1170. tooltip {Minimum key (that the part receives NoteOn messages)} xywh {210 158 40 15} type Simple labelsize 10 minimum 0 maximum 127 step 1 textsize 10
  1171. code0 {o->value(master->part[npart]->Pminkey);}
  1172. }
  1173. Fl_Counter simplemaxkcounter {
  1174. label {Max.key}
  1175. callback {master->part[npart]->Pmaxkey=(int) o->value();
  1176. if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED);
  1177. else o->textcolor(FL_BLACK);}
  1178. tooltip {Maximum key (that the part receives NoteOn messages)} xywh {255 158 40 15} type Simple labelsize 10 minimum 0 maximum 127 step 1 textsize 10
  1179. code0 {o->value(master->part[npart]->Pmaxkey);}
  1180. }
  1181. Fl_Button {} {
  1182. label m
  1183. callback {if (master->part[npart]->lastnote>=0) simpleminkcounter->value(master->part[npart]->lastnote);
  1184. simpleminkcounter->do_callback();
  1185. simplemaxkcounter->do_callback();}
  1186. tooltip {set the minimum key to the last pressed key} xywh {230 188 15 12} box THIN_UP_BOX labelsize 10
  1187. }
  1188. Fl_Button {} {
  1189. label M
  1190. callback {if (master->part[npart]->lastnote>=0) simplemaxkcounter->value(master->part[npart]->lastnote);
  1191. simplemaxkcounter->do_callback();
  1192. simpleminkcounter->do_callback();}
  1193. tooltip {set the maximum key to the last pressed key} xywh {260 188 15 12} box THIN_UP_BOX labelsize 10
  1194. }
  1195. Fl_Button {} {
  1196. label R
  1197. callback {simpleminkcounter->value(0);
  1198. simpleminkcounter->do_callback();
  1199. simplemaxkcounter->value(127);
  1200. simplemaxkcounter->do_callback();}
  1201. tooltip {reset the minimum key to 0 and maximum key to 127} xywh {245 188 15 12} box THIN_UP_BOX labelfont 1 labelsize 10
  1202. }
  1203. Fl_Counter simplepartkeyshiftcounter {
  1204. label KeyShift
  1205. callback {master->part[npart]->Pkeyshift=(int) o->value()+64;}
  1206. xywh {280 120 50 20} type Simple labelsize 11 minimum -64 maximum 64 step 1
  1207. code0 {o->lstep(12);}
  1208. code1 {o->value(master->part[npart]->Pkeyshift-64);}
  1209. }
  1210. Fl_Dial simplesyseffsend {
  1211. callback {master->setPsysefxvol(npart,nsyseff,(int) o->value());}
  1212. xywh {300 160 30 30} maximum 127 step 1
  1213. class WidgetPDial
  1214. }
  1215. Fl_Box {} {
  1216. label Effect
  1217. xywh {295 190 40 15} labelsize 10
  1218. }
  1219. }
  1220. Fl_Check_Button partenabled {
  1221. label Enabled
  1222. callback {pthread_mutex_lock(&master->mutex);
  1223. master->partonoff(npart,(int) o->value());
  1224. pthread_mutex_unlock(&master->mutex);
  1225. if ((int) o->value()==0) simplelistitemgroup->deactivate();
  1226. else {
  1227. simplelistitemgroup->activate();
  1228. if ((int)bankui->cbwig->value()!=(npart+1)){
  1229. bankui->cbwig->value(npart+1);
  1230. bankui->cbwig->do_callback();
  1231. };
  1232. };
  1233. o->redraw();}
  1234. private xywh {250 40 85 20} down_box DOWN_BOX labeltype EMBOSSED_LABEL labelfont 1 labelsize 13 align 24
  1235. code0 {//char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp);}
  1236. code1 {o->value(master->part[npart]->Penabled);}
  1237. }
  1238. Fl_Box virkeys {
  1239. label Keyboard
  1240. xywh {5 215 590 80} box BORDER_BOX color 17
  1241. code0 {o->init(master);}
  1242. class VirKeys
  1243. }
  1244. Fl_Group {} {open
  1245. xywh {340 30 255 185}
  1246. } {
  1247. Fl_Tabs {} {open
  1248. xywh {345 35 245 175} box UP_FRAME align 18
  1249. } {
  1250. Fl_Group {} {
  1251. label {System Effects} open
  1252. xywh {345 55 245 155} box UP_FRAME labelfont 1 labelsize 12 align 18
  1253. } {
  1254. Fl_Counter simplesyseffnocounter {
  1255. label {Sys.Effect No.}
  1256. callback {nsyseff=(int) o->value()-1;
  1257. simplesysefftype->value(master->sysefx[nsyseff]->geteffect());
  1258. simplesyseffectui->refresh(master->sysefx[nsyseff]);
  1259. simplerefresh();}
  1260. xywh {350 75 80 20} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  1261. code0 {o->bounds(1,NUM_SYS_EFX);}
  1262. code1 {o->value(nsyseff+1);}
  1263. }
  1264. Fl_Choice simplesysefftype {
  1265. label EffType
  1266. callback {pthread_mutex_lock(&master->mutex);
  1267. master->sysefx[nsyseff]->changeeffect((int) o->value());
  1268. pthread_mutex_unlock(&master->mutex);
  1269. simplesyseffectui->refresh(master->sysefx[nsyseff]);}
  1270. xywh {515 80 70 15} down_box BORDER_BOX labelsize 10 align 5
  1271. code0 {o->value(master->sysefx[nsyseff]->geteffect());}
  1272. } {
  1273. MenuItem {} {
  1274. label {No Effect}
  1275. xywh {20 20 100 20} labelfont 1 labelsize 10
  1276. }
  1277. MenuItem {} {
  1278. label Reverb
  1279. xywh {30 30 100 20} labelfont 1 labelsize 10
  1280. }
  1281. MenuItem {} {
  1282. label Echo
  1283. xywh {40 40 100 20} labelfont 1 labelsize 10
  1284. }
  1285. MenuItem {} {
  1286. label Chorus
  1287. xywh {50 50 100 20} labelfont 1 labelsize 10
  1288. }
  1289. MenuItem {} {
  1290. label Phaser
  1291. xywh {60 60 100 20} labelfont 1 labelsize 10
  1292. }
  1293. MenuItem {} {
  1294. label AlienWah
  1295. xywh {70 70 100 20} labelfont 1 labelsize 10
  1296. }
  1297. MenuItem {} {
  1298. label Distortion
  1299. xywh {80 80 100 20} labelfont 1 labelsize 10
  1300. }
  1301. MenuItem {} {
  1302. label EQ
  1303. xywh {90 90 100 20} labelfont 1 labelsize 10
  1304. }
  1305. MenuItem {} {
  1306. label DynFilter
  1307. xywh {100 100 100 20} labelfont 1 labelsize 10
  1308. }
  1309. }
  1310. Fl_Group simplesyseffectuigroup {open
  1311. xywh {350 95 235 95} color 48
  1312. } {
  1313. Fl_Group simplesyseffectui {
  1314. xywh {350 95 234 95}
  1315. code0 {o->init(master->sysefx[nsyseff]);}
  1316. class SimpleEffUI
  1317. } {}
  1318. }
  1319. Fl_Button {} {
  1320. label {Send to...}
  1321. callback {syseffsendwindow->show();}
  1322. xywh {435 75 75 20} box THIN_UP_BOX labelfont 1 labelsize 11
  1323. }
  1324. Fl_Button {} {
  1325. label P
  1326. callback {pthread_mutex_lock(&master->mutex);
  1327. presetsui->paste(master->sysefx[nsyseff],simplesyseffectui);
  1328. pthread_mutex_unlock(&master->mutex);}
  1329. xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  1330. }
  1331. }
  1332. Fl_Group {} {
  1333. label {Insertion Effects}
  1334. xywh {345 55 245 155} box UP_FRAME labelfont 1 labelsize 12 align 18 hide
  1335. } {
  1336. Fl_Counter simpleinseffnocounter {
  1337. label {Ins.Effect No.}
  1338. callback {ninseff=(int) o->value()-1;
  1339. simpleinsefftype->value(master->insefx[ninseff]->geteffect());
  1340. simpleinseffpart->value(master->Pinsparts[ninseff]+2);
  1341. simpleinseffectui->refresh(master->insefx[ninseff]);
  1342. if (master->Pinsparts[ninseff]!=-1) {
  1343. simpleinsefftype->activate();
  1344. simpleinseffectui->activate();
  1345. simpleinseffectuigroup->activate();
  1346. } else {
  1347. simpleinsefftype->deactivate();
  1348. simpleinseffectui->deactivate();
  1349. simpleinseffectuigroup->deactivate();
  1350. };}
  1351. xywh {350 75 80 20} type Simple labelfont 1 labelsize 10 align 1 minimum 0 maximum 127 step 1 value 1 textfont 1
  1352. code0 {o->bounds(1,NUM_INS_EFX);}
  1353. code1 {o->value(ninseff+1);}
  1354. }
  1355. Fl_Choice simpleinsefftype {
  1356. label EffType
  1357. callback {pthread_mutex_lock(&master->mutex);
  1358. master->insefx[ninseff]->changeeffect((int) o->value());
  1359. pthread_mutex_unlock(&master->mutex);
  1360. simpleinseffectui->refresh(master->insefx[ninseff]);
  1361. simpleinseffectui->show();}
  1362. xywh {515 80 70 15} down_box BORDER_BOX labelsize 10 align 5
  1363. code0 {o->value(master->insefx[ninseff]->geteffect());}
  1364. code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();}
  1365. } {
  1366. MenuItem {} {
  1367. label {No Effect}
  1368. xywh {35 35 100 20} labelfont 1 labelsize 10
  1369. }
  1370. MenuItem {} {
  1371. label Reverb
  1372. xywh {45 45 100 20} labelfont 1 labelsize 10
  1373. }
  1374. MenuItem {} {
  1375. label Echo
  1376. xywh {55 55 100 20} labelfont 1 labelsize 10
  1377. }
  1378. MenuItem {} {
  1379. label Chorus
  1380. xywh {65 65 100 20} labelfont 1 labelsize 10
  1381. }
  1382. MenuItem {} {
  1383. label Phaser
  1384. xywh {70 70 100 20} labelfont 1 labelsize 10
  1385. }
  1386. MenuItem {} {
  1387. label AlienWah
  1388. xywh {80 80 100 20} labelfont 1 labelsize 10
  1389. }
  1390. MenuItem {} {
  1391. label Distortion
  1392. xywh {90 90 100 20} labelfont 1 labelsize 10
  1393. }
  1394. MenuItem {} {
  1395. label EQ
  1396. xywh {100 100 100 20} labelfont 1 labelsize 10
  1397. }
  1398. MenuItem {} {
  1399. label DynFilter
  1400. xywh {110 110 100 20} labelfont 1 labelsize 10
  1401. }
  1402. }
  1403. Fl_Group simpleinseffectuigroup {
  1404. xywh {350 95 234 95} box FLAT_BOX color 48
  1405. } {
  1406. Fl_Group simpleinseffectui {
  1407. xywh {350 95 234 95}
  1408. code0 {o->init(master->insefx[ninseff]);}
  1409. code1 {if (master->Pinsparts[ninseff]== -1) o->deactivate();}
  1410. class SimpleEffUI
  1411. } {}
  1412. }
  1413. Fl_Choice simpleinseffpart {
  1414. label {Insert To.}
  1415. callback {master->Pinsparts[ninseff]=(int) o->value()-2;
  1416. if ((int) o->value()==1){
  1417. simpleinseffectuigroup->deactivate();
  1418. simpleinsefftype->deactivate();
  1419. simpleinseffectui->deactivate();
  1420. } else {
  1421. simpleinseffectuigroup->activate();
  1422. simpleinsefftype->activate();
  1423. simpleinseffectui->activate();
  1424. };
  1425. master->insefx[ninseff]->cleanup();} open
  1426. xywh {435 75 80 20} down_box BORDER_BOX labelfont 1 labelsize 10 align 5 textsize 10
  1427. code0 {o->add("Master Out");o->add("Off");}
  1428. code1 {char tmp[50]; for (int i=0;i<NUM_MIDI_PARTS;i++) {sprintf(tmp,"Part %2d",i+1);o->add(tmp);};}
  1429. code3 {o->value(master->Pinsparts[ninseff]+2);}
  1430. } {}
  1431. Fl_Button {} {
  1432. label P
  1433. callback {pthread_mutex_lock(&master->mutex);
  1434. presetsui->paste(master->insefx[ninseff],simpleinseffectui);
  1435. pthread_mutex_unlock(&master->mutex);}
  1436. xywh {560 65 25 15} box THIN_UP_BOX color 179 labelfont 1 labelsize 11 labelcolor 7
  1437. }
  1438. }
  1439. }
  1440. }
  1441. Fl_Group {} {open
  1442. xywh {5 300 590 30} box ENGRAVED_FRAME
  1443. } {
  1444. Fl_Box {} {
  1445. label {VU-Meter}
  1446. xywh {5 300 590 30} box FLAT_BOX color 41 selection_color 75
  1447. code0 {o->init(master,-1);}
  1448. class VUMeter
  1449. }
  1450. }
  1451. Fl_Dial simplemastervolumedial {
  1452. label {Master Volume}
  1453. callback {master->setPvolume((int) o->value());}
  1454. tooltip {Master Volume} xywh {10 35 40 40} box ROUND_UP_BOX labelfont 1 labelsize 11 align 130 maximum 127 step 1
  1455. code0 {o->value(master->Pvolume);}
  1456. class WidgetPDial
  1457. }
  1458. Fl_Counter simplemasterkeyshiftcounter {
  1459. label {Master KeyShift}
  1460. callback {master->setPkeyshift((int) o->value()+64);}
  1461. xywh {15 110 90 20} labelsize 11 minimum -64 maximum 64 step 1
  1462. code0 {o->lstep(12);}
  1463. code1 {o->value(master->Pkeyshift-64);}
  1464. }
  1465. Fl_Button {} {
  1466. label {Stop ALL sounds!}
  1467. callback {virkeyboard->relaseallkeys();
  1468. pthread_mutex_lock(&master->mutex);
  1469. master->shutup=1;
  1470. pthread_mutex_unlock(&master->mutex);}
  1471. xywh {5 149 115 31} color 90 labelfont 1 labelsize 10
  1472. }
  1473. Fl_Button {} {
  1474. label Reset
  1475. callback {simpleglobalfinedetuneslider->value(64.0);
  1476. simpleglobalfinedetuneslider->do_callback();}
  1477. tooltip {Master fine detune reset} xywh {70 30 50 17} box THIN_UP_BOX labelsize 11 align 128
  1478. }
  1479. Fl_Dial simpleglobalfinedetuneslider {
  1480. label {Fine Detune}
  1481. callback {master->microtonal.Pglobalfinedetune=(int) o->value();}
  1482. tooltip {global fine detune} xywh {80 50 30 30} box ROUND_UP_BOX labelsize 11 align 130 maximum 127 step 1 value 64
  1483. code0 {o->value(master->microtonal.Pglobalfinedetune);}
  1484. class WidgetPDial
  1485. }
  1486. Fl_Counter simplenpartcounter {
  1487. label Part
  1488. callback {virkeys->relaseallkeys(0);
  1489. npartcounter->value(o->value());
  1490. npart=(int) o->value()-1;
  1491. simplerefresh();
  1492. virkeys->midich=master->part[npart]->Prcvchn;}
  1493. tooltip {The part number} xywh {170 40 70 20} type Simple labelfont 1 align 4 minimum 0 maximum 127 step 1 value 1 textfont 1
  1494. code0 {o->bounds(1,NUM_MIDI_PARTS);}
  1495. }
  1496. Fl_Counter {} {
  1497. label {Keyb.Oct.}
  1498. callback {virkeys->relaseallkeys(0);
  1499. virkeys->midioct=(int) o->value();
  1500. virkeys->take_focus();}
  1501. tooltip {Midi Octave} xywh {5 190 55 20} type Simple labelsize 11 align 8 when 6 minimum 0 maximum 5 step 1 textfont 1 textsize 11
  1502. code0 {o->value(virkeys->midioct);}
  1503. }
  1504. Fl_Button sm_indicator2 {
  1505. label SM
  1506. xywh {560 5 35 15} box ROUNDED_BOX down_box ROUNDED_BOX color 45 selection_color 93 labelfont 3 labelcolor 39 deactivate
  1507. }
  1508. }
  1509. Fl_Window selectuiwindow {
  1510. label {User Interface mode}
  1511. callback {*exitprogram=1;}
  1512. xywh {342 246 430 250} type Double hide non_modal
  1513. } {
  1514. Fl_Box {} {
  1515. label {Welcome to ZynAddSubFX}
  1516. xywh {5 5 425 40} labeltype SHADOW_LABEL labelfont 1 labelsize 26
  1517. }
  1518. Fl_Box {} {
  1519. label {Please choose the interface mode:}
  1520. xywh {10 50 265 25} labelfont 1 labelsize 13
  1521. }
  1522. Fl_Button {} {
  1523. label Advanced
  1524. callback {config.cfg.UserInterfaceMode=1;
  1525. masterwindow->show();
  1526. selectuiwindow->hide();}
  1527. xywh {10 165 100 35} color 229 labelfont 1 labelsize 16
  1528. }
  1529. Fl_Box {} {
  1530. label {.. if you have used ZynAddSubFX before, or you like to have full controll to all parameters.}
  1531. xywh {110 165 310 35} labelfont 1 labelsize 11 align 144
  1532. }
  1533. Fl_Button {} {
  1534. label Beginner
  1535. callback {simplemasterwindow->show();
  1536. selectuiwindow->hide();
  1537. config.cfg.UserInterfaceMode=2;}
  1538. xywh {10 80 100 65} color 238 labelfont 1 labelsize 16
  1539. }
  1540. Fl_Box {} {
  1541. label {..if you are a beginner, you prefer using presets or you prefer to use simpler user interfaces. Most functionality of ZynAddSubFX will be hidden in this mode to make simple the learning/using it.}
  1542. xywh {110 75 320 75} labelfont 1 labelsize 11 align 144
  1543. }
  1544. Fl_Box {} {
  1545. label {You can switch the interface modes anytime you want.}
  1546. xywh {30 215 360 25} box BORDER_BOX color 51 labelfont 1 labelsize 11 align 144
  1547. }
  1548. }
  1549. }
  1550. Function {updatesendwindow()} {} {
  1551. code {for (int neff1=0;neff1<NUM_SYS_EFX;neff1++)
  1552. for (int neff2=neff1+1;neff2<NUM_SYS_EFX;neff2++)
  1553. syseffsend[neff1][neff2]->value(master->Psysefxsend[neff1][neff2]);} {}
  1554. }
  1555. Function {updatepanel()} {} {
  1556. code {for (int npart=0;npart<NUM_MIDI_PARTS;npart++){
  1557. panellistitem[npart]->refresh();
  1558. };} {}
  1559. }
  1560. Function {setfilelabel(const char *filename)} {} {
  1561. code {if (filename!=NULL) snprintf(&masterwindowlabel[0],100,"%s - ZynAddSubFX",fl_filename_name(filename));
  1562. else snprintf(&masterwindowlabel[0],100,"%s","ZynAddSubFX");
  1563. masterwindowlabel[99]='\\0';
  1564. masterwindow->label(&masterwindowlabel[0]);
  1565. simplemasterwindow->label(&masterwindowlabel[0]);} {}
  1566. }
  1567. Function {MasterUI(Master *master_,int *exitprogram_)} {} {
  1568. code {master=master_;
  1569. exitprogram=exitprogram_;
  1570. ninseff=0;
  1571. nsyseff=0;
  1572. npart=0;
  1573. for (int i=0;i<NUM_SYS_EFX;i++)
  1574. for (int j=0;j<NUM_SYS_EFX;j++)
  1575. syseffsend[i][j]=NULL;
  1576. microtonalui=new MicrotonalUI(&master->microtonal);
  1577. virkeyboard=new VirKeyboard(master);
  1578. bankui=new BankUI(master,&npart);
  1579. configui=new ConfigUI();
  1580. make_window();
  1581. presetsui=new PresetsUI();
  1582. setfilelabel(NULL);
  1583. swapefftype=0;
  1584. simplerefresh();} {}
  1585. }
  1586. Function {~MasterUI()} {} {
  1587. code {masterwindow->hide();
  1588. delete masterwindow;
  1589. simplemasterwindow->hide();
  1590. delete simplemasterwindow;
  1591. aboutwindow->hide();
  1592. delete aboutwindow;
  1593. syseffsendwindow->hide();
  1594. delete syseffsendwindow;
  1595. delete virkeyboard;
  1596. delete microtonalui;
  1597. delete bankui;
  1598. delete configui;
  1599. delete presetsui;
  1600. delete panelwindow;
  1601. delete selectuiwindow;} {}
  1602. }
  1603. Function {showUI()} {} {
  1604. code {switch (config.cfg.UserInterfaceMode){
  1605. case 0:selectuiwindow->show();
  1606. break;
  1607. case 1:masterwindow->show();
  1608. break;
  1609. case 2:simplemasterwindow->show();
  1610. break;
  1611. };} {}
  1612. }
  1613. Function {simplerefresh()} {} {
  1614. code {partenabled->value(master->part[npart]->Penabled);
  1615. if (master->part[npart]->Penabled!=0) simplelistitemgroup->activate();
  1616. else simplelistitemgroup->deactivate();
  1617. partvolume->value(master->part[npart]->Pvolume);
  1618. partpanning->value(master->part[npart]->Ppanning);
  1619. partrcv->value(master->part[npart]->Prcvchn);
  1620. if (master->part[npart]->Pname[0]!=0) partname->label((char *)master->part[npart]->Pname);
  1621. else partname->label("Click here to load a instrument");
  1622. simplelistitemgroup->redraw();
  1623. simplepartportamento->value(master->part[npart]->ctl.portamento.portamento);
  1624. simpleminkcounter->value(master->part[npart]->Pminkey);
  1625. simplemaxkcounter->value(master->part[npart]->Pmaxkey);
  1626. simplepartkeyshiftcounter->value(master->part[npart]->Pkeyshift-64);
  1627. simplesyseffsend->value(master->Psysefxvol[nsyseff][npart]);} {}
  1628. }
  1629. Function {do_new_master_unconditional()} {} {
  1630. code {delete microtonalui;
  1631. pthread_mutex_lock(&master->mutex);
  1632. master->defaults();
  1633. pthread_mutex_unlock(&master->mutex);
  1634. npartcounter->value(1);
  1635. refresh_master_ui();
  1636. updatepanel();} {}
  1637. }
  1638. Function {do_new_master()} {} {
  1639. code {if (fl_choice("Clear *ALL* the parameters ?","No","Yes",NULL)){
  1640. do_new_master_unconditional();
  1641. }} {}
  1642. }
  1643. Function {do_load_master_unconditional(const char *filename, const char *display_name)} {return_type int
  1644. } {
  1645. code {pthread_mutex_lock(&master->mutex);
  1646. //clear all parameters
  1647. master->defaults();
  1648. //load the data
  1649. int result=master->loadXML(filename);
  1650. master->applyparameters(false);
  1651. pthread_mutex_unlock(&master->mutex);
  1652. npartcounter->value(1);
  1653. refresh_master_ui();
  1654. updatepanel();
  1655. if (result>=0) setfilelabel(display_name);
  1656. return result;} {}
  1657. }
  1658. Function {do_load_master(const char* file = NULL)} {} {
  1659. code {const char *filename;
  1660. if (file == NULL) {
  1661. filename=fl_file_chooser("Open:","({*.xmz})",NULL,0);
  1662. if (filename==NULL) return;
  1663. }
  1664. else {
  1665. filename = file;
  1666. }
  1667. int result = do_load_master_unconditional( filename, filename );
  1668. if (result==-10) fl_alert("Error: Could not load the file\\nbecause it is not a zynaddsubfx parameters file.");
  1669. else if (result<0) fl_alert("Error: Could not load the file.");} {}
  1670. }
  1671. Function {do_save_master(const char* file = NULL)} {} {
  1672. code {const char *filename;
  1673. char *tmp;
  1674. int result=0;
  1675. if (file == NULL) {
  1676. tmp=fl_file_chooser("Save:","({*.xmz})",NULL,0);
  1677. if (tmp==NULL) return;
  1678. tmp=fl_filename_setext(tmp,".xmz");
  1679. filename=tmp;
  1680. result=fileexists(tmp);
  1681. if (result) {
  1682. result=0;
  1683. if (!fl_choice("The file exists. Overwrite it?","No","Yes",NULL)) return;
  1684. }
  1685. }
  1686. else {
  1687. filename = file;
  1688. }
  1689. pthread_mutex_lock(&master->mutex);
  1690. result=master->saveXML(filename);
  1691. pthread_mutex_unlock(&master->mutex);
  1692. if (result<0) fl_alert("Error: Could not save the file.");
  1693. else
  1694. {
  1695. \#if USE_NSM
  1696. if ( nsm && nsm->is_active() )
  1697. setfilelabel( nsm->display_name );
  1698. else
  1699. \#endif
  1700. setfilelabel(filename);
  1701. }
  1702. updatepanel();} {}
  1703. }
  1704. Function {refresh_master_ui()} {} {
  1705. code {ninseff=0;
  1706. nsyseff=0;
  1707. npart=0;
  1708. //the Master UI
  1709. npartcounter->do_callback();
  1710. syseffnocounter->do_callback();
  1711. inseffnocounter->do_callback();
  1712. masterkeyshiftcounter->value(master->Pkeyshift-64);
  1713. mastervolumedial->value(master->Pvolume);
  1714. globalfinedetuneslider->value(master->microtonal.Pglobalfinedetune);
  1715. microtonalui=new MicrotonalUI(&master->microtonal);
  1716. nrpnbutton->value(master->ctl.NRPN.receive);
  1717. updatesendwindow();
  1718. updatepanel();
  1719. //the simle MasterUI
  1720. simplenpartcounter->value(1);
  1721. simplesyseffnocounter->value(1);
  1722. simpleinseffnocounter->value(1);
  1723. simplenpartcounter->do_callback();
  1724. simplesyseffnocounter->do_callback();
  1725. simpleinseffnocounter->do_callback();
  1726. simplemasterkeyshiftcounter->value(master->Pkeyshift-64);
  1727. simplemastervolumedial->value(master->Pvolume);
  1728. simpleglobalfinedetuneslider->value(master->microtonal.Pglobalfinedetune);
  1729. virkeys->midich=master->part[npart]->Prcvchn;
  1730. simplerefresh();
  1731. bankui->hide();} {}
  1732. }
  1733. decl {Master *master;} {}
  1734. decl {MicrotonalUI *microtonalui;} {}
  1735. decl {BankUI *bankui;} {}
  1736. decl {int ninseff,npart;} {}
  1737. decl {int nsyseff;} {}
  1738. decl {int *exitprogram;} {}
  1739. decl {SysEffSend *syseffsend[NUM_SYS_EFX][NUM_SYS_EFX];} {}
  1740. decl {VirKeyboard *virkeyboard;} {}
  1741. decl {ConfigUI *configui;} {}
  1742. decl {int swapefftype;} {}
  1743. decl {char masterwindowlabel[100];} {}
  1744. decl {Panellistitem *panellistitem[NUM_MIDI_PARTS];} {}
  1745. decl {NioUI nioui;} {}
  1746. }