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.

2559 lines
90KB

  1. // generated by Fast Light User Interface Designer (fluid) version 1.0300
  2. #include "zynaddsubfx/UI/MasterUI.h"
  3. //Copyright (c) 2002-2009 Nasca Octavian Paul
  4. //License: GNU GPL version 2 or later
  5. VUMeter::VUMeter(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) {
  6. master=NULL;
  7. npart=-1;
  8. }
  9. void VUMeter::init(Master *master_,int part_) {
  10. //the "part_" parameters sets the part (if it is >=0), else it sets the master
  11. master=master_;
  12. label(NULL);
  13. npart=part_;
  14. olddbl=0.0;
  15. olddbr=0.0;
  16. oldrmsdbl=0.0;
  17. oldrmsdbr=0.0;
  18. }
  19. void VUMeter::draw_master() {
  20. #define MIN_DB (-48)
  21. int ox=x(); int oy=y(); int lx=w(); int ly=h();
  22. vuData data = master->getVuData();
  23. //pthread_mutex_lock(&master->mutex);
  24. float dbl=rap2dB(data.outpeakl);
  25. float dbr=rap2dB(data.outpeakr);
  26. float rmsdbl=rap2dB(data.rmspeakl);
  27. float rmsdbr=rap2dB(data.rmspeakr);
  28. float maxdbl=rap2dB(data.maxoutpeakl);
  29. float maxdbr=rap2dB(data.maxoutpeakr);
  30. int clipped=data.clipped;
  31. //pthread_mutex_unlock(&master->mutex);
  32. dbl=(MIN_DB-dbl)/MIN_DB;
  33. if (dbl<0.0) dbl=0.0;
  34. else if (dbl>1.0)dbl=1.0;
  35. dbr=(MIN_DB-dbr)/MIN_DB;
  36. if (dbr<0.0) dbr=0.0;
  37. else if (dbr>1.0) dbr=1.0;
  38. dbl=dbl*0.4+olddbl*0.6;
  39. dbr=dbr*0.4+olddbr*0.6;
  40. if ( damage() & FL_DAMAGE_USER1 )
  41. {
  42. if ( olddbl == dbl && olddbr == dbr )
  43. return;
  44. }
  45. olddbl=dbl;
  46. olddbr=dbr;
  47. #define VULENX (lx-35)
  48. #define VULENY (ly/2-3)
  49. dbl*=VULENX;dbr*=VULENX;
  50. int idbl=(int) dbl;
  51. int idbr=(int) dbr;
  52. //compute RMS - start
  53. rmsdbl=(MIN_DB-rmsdbl)/MIN_DB;
  54. if (rmsdbl<0.0) rmsdbl=0.0;
  55. else if (rmsdbl>1.0) rmsdbl=1.0;
  56. rmsdbr=(MIN_DB-rmsdbr)/MIN_DB;
  57. if (rmsdbr<0.0) rmsdbr=0.0;
  58. else if (rmsdbr>1.0) rmsdbr=1.0;
  59. rmsdbl=rmsdbl*0.4+oldrmsdbl*0.6;
  60. rmsdbr=rmsdbr*0.4+oldrmsdbr*0.6;
  61. oldrmsdbl=rmsdbl;
  62. oldrmsdbr=rmsdbr;
  63. rmsdbl*=VULENX;rmsdbr*=VULENX;
  64. int irmsdbl=(int) rmsdbl;
  65. int irmsdbr=(int) rmsdbr;
  66. //compute RMS - end
  67. //draw the vu-meter lines
  68. //db
  69. fl_rectf(ox,oy,idbr,VULENY,0,200,255);
  70. fl_rectf(ox,oy+ly/2,idbl,VULENY,0,200,255);
  71. //black
  72. fl_rectf(ox+idbr,oy,VULENX-idbr,VULENY,0,0,0);
  73. fl_rectf(ox+idbl,oy+ly/2,VULENX-idbl,VULENY,0,0,0);
  74. //draw the scales
  75. float tmp=VULENX*1.0/MIN_DB;
  76. for (int i=1;i<1-MIN_DB;i++){
  77. int tx=VULENX+(int) (tmp*i);
  78. fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,160,200);
  79. if (i%5==0) fl_rectf(ox+tx,oy,1,VULENY+ly/2,0,230,240);
  80. if (i%10==0) fl_rectf(ox+tx-1,oy,2,VULENY+ly/2,0,225,255);
  81. };
  82. //rms
  83. if (irmsdbr>2) fl_rectf(ox+irmsdbr-1,oy,3,VULENY,255,255,0);
  84. if (irmsdbl>2) fl_rectf(ox+irmsdbl-1,oy+ly/2,3,VULENY,255,255,0);
  85. //draw the red box if clipping has occured
  86. if (clipped==0) fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,0,0,10);
  87. else fl_rectf(ox+VULENX+2,oy+1,lx-VULENX-3,ly-4,250,10,10);
  88. //draw the maxdB
  89. fl_font(FL_HELVETICA|FL_BOLD,10);
  90. fl_color(255,255,255);
  91. char tmpstr[10];
  92. if ((maxdbl>MIN_DB-20)){
  93. snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbr);
  94. fl_draw(tmpstr,ox+VULENX+1,oy+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0);
  95. };
  96. if ((maxdbr>MIN_DB-20)){
  97. snprintf((char *)&tmpstr,10,"%ddB",(int)maxdbl);
  98. fl_draw(tmpstr,ox+VULENX+1,oy+ly/2+1,lx-VULENX-1,VULENY,FL_ALIGN_RIGHT,NULL,0);
  99. };
  100. }
  101. void VUMeter::draw_part() {
  102. #define MIN_DB (-48)
  103. int ox=x(); int oy=y(); int lx=w(); int ly=h();
  104. if (!active_r()){
  105. pthread_mutex_lock(&master->vumutex);
  106. int fakedb=master->fakepeakpart[npart];
  107. pthread_mutex_unlock(&master->vumutex);
  108. fl_rectf(ox,oy,lx,ly,140,140,140);
  109. if (fakedb>0){
  110. fakedb=(int)(fakedb/255.0*ly)+4;
  111. fl_rectf(ox+2,oy+ly-fakedb,lx-4,fakedb,0,0,0);
  112. };
  113. return;
  114. };
  115. //draw the vu lines
  116. pthread_mutex_lock(&master->vumutex);
  117. float db=rap2dB(master->vuoutpeakpart[npart]);
  118. pthread_mutex_unlock(&master->vumutex);
  119. db=(MIN_DB-db)/MIN_DB;
  120. if (db<0.0) db=0.0;
  121. else if (db>1.0) db=1.0;
  122. db*=ly-2;
  123. int idb=(int) db;
  124. fl_rectf(ox,oy+ly-idb,lx,idb,0,200,255);
  125. fl_rectf(ox,oy,lx,ly-idb,0,0,0);
  126. //draw the scales
  127. float tmp=ly*1.0/MIN_DB;
  128. for (int i=1;i<1-MIN_DB;i++){
  129. int ty=ly+(int) (tmp*i);
  130. if (i%5==0) fl_rectf(ox,oy+ly-ty,lx,1,0,160,200);
  131. if (i%10==0) fl_rectf(ox,oy+ly-ty,lx,1,0,230,240);
  132. };
  133. }
  134. void VUMeter::draw() {
  135. if (npart>=0) draw_part();
  136. else draw_master();
  137. }
  138. void VUMeter::tickdraw(VUMeter *o) {
  139. o->damage(FL_DAMAGE_USER1);
  140. }
  141. void VUMeter::tick(void *v) {
  142. tickdraw((VUMeter *) v);
  143. Fl::repeat_timeout(1.0/18.0,tick,v);//18 fps
  144. }
  145. int VUMeter::handle(int event) {
  146. switch(event){
  147. case FL_SHOW:
  148. Fl::add_timeout(1.0/18.0,tick,this);
  149. break;
  150. case FL_HIDE:
  151. Fl::remove_timeout(tick,this);
  152. break;
  153. case FL_PUSH:
  154. if (npart>=0) break;
  155. pthread_mutex_lock(&master->mutex);
  156. master->vuresetpeaks();
  157. pthread_mutex_unlock(&master->mutex);
  158. break;
  159. };
  160. return(1);
  161. }
  162. SysEffSend::SysEffSend(int x,int y, int w, int h, const char *label):WidgetPDial(x,y,w,h,label) {
  163. master=NULL;
  164. neff1=0;
  165. neff2=0;
  166. }
  167. void SysEffSend::init(Master *master_,int neff1_,int neff2_) {
  168. neff1=neff1_;
  169. neff2=neff2_;
  170. master=master_;
  171. minimum(0);
  172. maximum(127);
  173. step(1);
  174. labelfont(1);
  175. labelsize(10);
  176. align(FL_ALIGN_TOP);
  177. value(master->Psysefxsend[neff1][neff2]);
  178. char tmp[20];snprintf(tmp,20,"%d->%d",neff1+1,neff2+1);
  179. this->copy_label(tmp);
  180. }
  181. SysEffSend::~SysEffSend() {
  182. hide();
  183. }
  184. int SysEffSend::handle(int event) {
  185. if ((event==FL_PUSH) || (event==FL_DRAG)){
  186. master->setPsysefxsend(neff1,neff2,(int) value());
  187. };
  188. return(WidgetPDial::handle(event));
  189. }
  190. void Panellistitem::cb_partname_i(Fl_Button*, void*) {
  191. if ((int)bankui->cbwig->value()!=(npart+1)){
  192. bankui->cbwig->value(npart+1);
  193. bankui->cbwig->do_callback();
  194. };
  195. bankui->show();
  196. }
  197. void Panellistitem::cb_partname(Fl_Button* o, void* v) {
  198. ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_partname_i(o,v);
  199. }
  200. void Panellistitem::cb_partvolume_i(Fl_Slider* o, void*) {
  201. master->part[npart]->setPvolume((int) o->value());
  202. }
  203. void Panellistitem::cb_partvolume(Fl_Slider* o, void* v) {
  204. ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_partvolume_i(o,v);
  205. }
  206. void Panellistitem::cb_partpanning_i(WidgetPDial* o, void*) {
  207. master->part[npart]->setPpanning((int) o->value());
  208. }
  209. void Panellistitem::cb_partpanning(WidgetPDial* o, void* v) {
  210. ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_partpanning_i(o,v);
  211. }
  212. void Panellistitem::cb_edit_i(Fl_Button*, void*) {
  213. if ((int)bankui->cbwig->value()!=(npart+1)){
  214. bankui->cbwig->value(npart+1);
  215. bankui->cbwig->do_callback();
  216. };
  217. }
  218. void Panellistitem::cb_edit(Fl_Button* o, void* v) {
  219. ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_edit_i(o,v);
  220. }
  221. void Panellistitem::cb_partrcv_i(Fl_Choice* o, void*) {
  222. master->part[npart]->Prcvchn=(int) o->value();
  223. }
  224. void Panellistitem::cb_partrcv(Fl_Choice* o, void* v) {
  225. ((Panellistitem*)(o->parent()->parent()->user_data()))->cb_partrcv_i(o,v);
  226. }
  227. void Panellistitem::cb_partenabled_i(Fl_Check_Button* o, void*) {
  228. pthread_mutex_lock(&master->mutex);
  229. master->partonoff(npart,(int) o->value());
  230. pthread_mutex_unlock(&master->mutex);
  231. if ((int) o->value()==0) panellistitemgroup->deactivate();
  232. else {
  233. panellistitemgroup->activate();
  234. if ((int)bankui->cbwig->value()!=(npart+1)){
  235. bankui->cbwig->value(npart+1);
  236. bankui->cbwig->do_callback();
  237. };
  238. };
  239. o->redraw();
  240. }
  241. void Panellistitem::cb_partenabled(Fl_Check_Button* o, void* v) {
  242. ((Panellistitem*)(o->parent()->user_data()))->cb_partenabled_i(o,v);
  243. }
  244. Fl_Group* Panellistitem::make_window() {
  245. { panellistitem = new Fl_Group(0, 0, 100, 260);
  246. panellistitem->box(FL_NO_BOX);
  247. panellistitem->color(FL_BACKGROUND_COLOR);
  248. panellistitem->selection_color(FL_BACKGROUND_COLOR);
  249. panellistitem->labeltype(FL_NO_LABEL);
  250. panellistitem->labelfont(0);
  251. panellistitem->labelsize(14);
  252. panellistitem->labelcolor(FL_FOREGROUND_COLOR);
  253. panellistitem->user_data((void*)(this));
  254. panellistitem->align(Fl_Align(FL_ALIGN_TOP));
  255. panellistitem->when(FL_WHEN_RELEASE);
  256. { Fl_Group* o = panellistitemgroup = new Fl_Group(0, 20, 70, 240);
  257. panellistitemgroup->box(FL_UP_FRAME);
  258. { Fl_Group* o = new Fl_Group(45, 65, 15, 110);
  259. o->box(FL_ENGRAVED_FRAME);
  260. { VUMeter* o = new VUMeter(45, 65, 15, 110, "V U");
  261. o->box(FL_FLAT_BOX);
  262. o->color(FL_FOREGROUND_COLOR);
  263. o->selection_color((Fl_Color)75);
  264. o->labeltype(FL_NORMAL_LABEL);
  265. o->labelfont(0);
  266. o->labelsize(14);
  267. o->labelcolor((Fl_Color)55);
  268. o->align(Fl_Align(FL_ALIGN_WRAP));
  269. o->when(FL_WHEN_RELEASE);
  270. o->init(master,npart);
  271. } // VUMeter* o
  272. o->end();
  273. } // Fl_Group* o
  274. { partname = new Fl_Button(5, 27, 60, 30, " ");
  275. partname->box(FL_THIN_DOWN_BOX);
  276. partname->down_box(FL_FLAT_BOX);
  277. partname->labelfont(1);
  278. partname->labelsize(10);
  279. partname->callback((Fl_Callback*)cb_partname);
  280. partname->align(Fl_Align(192|FL_ALIGN_INSIDE));
  281. } // Fl_Button* partname
  282. { Fl_Slider* o = partvolume = new Fl_Slider(10, 65, 30, 110);
  283. partvolume->type(4);
  284. partvolume->box(FL_NO_BOX);
  285. partvolume->minimum(127);
  286. partvolume->maximum(0);
  287. partvolume->step(1);
  288. partvolume->value(127);
  289. partvolume->callback((Fl_Callback*)cb_partvolume);
  290. o->value(master->part[npart]->Pvolume);
  291. } // Fl_Slider* partvolume
  292. { WidgetPDial* o = partpanning = new WidgetPDial(20, 180, 30, 30);
  293. partpanning->box(FL_NO_BOX);
  294. partpanning->color(FL_BACKGROUND_COLOR);
  295. partpanning->selection_color(FL_INACTIVE_COLOR);
  296. partpanning->labeltype(FL_NORMAL_LABEL);
  297. partpanning->labelfont(0);
  298. partpanning->labelsize(14);
  299. partpanning->labelcolor(FL_FOREGROUND_COLOR);
  300. partpanning->maximum(127);
  301. partpanning->step(1);
  302. partpanning->callback((Fl_Callback*)cb_partpanning);
  303. partpanning->align(Fl_Align(FL_ALIGN_BOTTOM));
  304. partpanning->when(FL_WHEN_CHANGED);
  305. o->value(master->part[npart]->Ppanning);
  306. } // WidgetPDial* partpanning
  307. { Fl_Button* o = new Fl_Button(15, 235, 40, 20, "edit");
  308. o->labelsize(10);
  309. o->callback((Fl_Callback*)cb_edit);
  310. } // Fl_Button* o
  311. { Fl_Choice* o = partrcv = new Fl_Choice(10, 213, 50, 15);
  312. partrcv->tooltip("receive from Midi channel");
  313. partrcv->down_box(FL_BORDER_BOX);
  314. partrcv->labelsize(10);
  315. partrcv->textfont(1);
  316. partrcv->textsize(10);
  317. partrcv->callback((Fl_Callback*)cb_partrcv);
  318. partrcv->align(Fl_Align(FL_ALIGN_TOP_LEFT));
  319. 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");};
  320. o->value(master->part[npart]->Prcvchn);
  321. } // Fl_Choice* partrcv
  322. if (master->part[npart]->Penabled==0) o->deactivate();
  323. set_module_parameters( o );
  324. panellistitemgroup->end();
  325. } // Fl_Group* panellistitemgroup
  326. { Fl_Check_Button* o = partenabled = new Fl_Check_Button(5, 0, 45, 20, "01");
  327. partenabled->down_box(FL_DOWN_BOX);
  328. partenabled->labeltype(FL_EMBOSSED_LABEL);
  329. partenabled->labelfont(1);
  330. partenabled->labelsize(13);
  331. partenabled->callback((Fl_Callback*)cb_partenabled);
  332. partenabled->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE));
  333. char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp);
  334. o->value(master->part[npart]->Penabled);
  335. } // Fl_Check_Button* partenabled
  336. panellistitem->end();
  337. } // Fl_Group* panellistitem
  338. return panellistitem;
  339. }
  340. Panellistitem::Panellistitem(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) {
  341. npart=0;
  342. master=NULL;
  343. bankui=NULL;
  344. }
  345. void Panellistitem::init(Master *master_, int npart_,BankUI *bankui_) {
  346. npart=npart_;
  347. master=master_;
  348. bankui=bankui_;
  349. make_window();
  350. panellistitem->show();
  351. end();
  352. }
  353. void Panellistitem::refresh() {
  354. partenabled->value(master->part[npart]->Penabled);
  355. if (master->part[npart]->Penabled!=0) panellistitemgroup->activate();
  356. else panellistitemgroup->deactivate();
  357. partvolume->value(master->part[npart]->Pvolume);
  358. partpanning->value(master->part[npart]->Ppanning);
  359. partrcv->value(master->part[npart]->Prcvchn);
  360. partname->label((char *)master->part[npart]->Pname);
  361. if ((int)bankui->cbwig->value()!=(npart+1))
  362. panellistitemgroup->color(fl_rgb_color(160,160,160));
  363. else
  364. panellistitemgroup->color(fl_rgb_color(50,190,240));
  365. panellistitemgroup->redraw();
  366. }
  367. Panellistitem::~Panellistitem() {
  368. panellistitem->hide();
  369. //delete(panellistitem);
  370. }
  371. void MasterUI::cb_masterwindow_i(Fl_Double_Window*, void*) {
  372. if ((
  373. #ifdef PLUGINVERSION
  374. 1
  375. #elif USE_NSM
  376. (nsm && nsm->is_active())
  377. #else
  378. 0
  379. #endif
  380. || fl_choice("Exit and leave the unsaved data?","No","Yes",NULL))) {
  381. config.save();
  382. *exitprogram=1;
  383. };
  384. }
  385. void MasterUI::cb_masterwindow(Fl_Double_Window* o, void* v) {
  386. ((MasterUI*)(o->user_data()))->cb_masterwindow_i(o,v);
  387. }
  388. void MasterUI::cb_New_i(Fl_Menu_*, void*) {
  389. do_new_master();
  390. }
  391. void MasterUI::cb_New(Fl_Menu_* o, void* v) {
  392. ((MasterUI*)(o->parent()->user_data()))->cb_New_i(o,v);
  393. }
  394. void MasterUI::cb_Open_i(Fl_Menu_*, void*) {
  395. #if USE_NSM
  396. if ( nsm && nsm->is_active() )
  397. {
  398. do_load_master();
  399. do_save_master( nsm->project_filename );
  400. }
  401. else
  402. #endif
  403. {
  404. do_load_master();
  405. };
  406. }
  407. void MasterUI::cb_Open(Fl_Menu_* o, void* v) {
  408. ((MasterUI*)(o->parent()->user_data()))->cb_Open_i(o,v);
  409. }
  410. void MasterUI::cb_Save_i(Fl_Menu_*, void*) {
  411. #if USE_NSM
  412. if ( nsm && nsm->is_active() )
  413. {
  414. do_save_master( nsm->project_filename );
  415. }
  416. else
  417. #endif
  418. {
  419. do_save_master();
  420. };
  421. }
  422. void MasterUI::cb_Save(Fl_Menu_* o, void* v) {
  423. ((MasterUI*)(o->parent()->user_data()))->cb_Save_i(o,v);
  424. }
  425. void MasterUI::cb_Load_i(Fl_Menu_*, void*) {
  426. char *filename;
  427. filename=fl_file_chooser("Open:","({*.xsz})",NULL,0);
  428. if (filename==NULL) return;
  429. pthread_mutex_lock(&master->mutex);
  430. //clear all parameters
  431. master->microtonal.defaults();
  432. //load the data
  433. int result=master->microtonal.loadXML(filename);
  434. pthread_mutex_unlock(&master->mutex);
  435. delete microtonalui;
  436. microtonalui=new MicrotonalUI(&master->microtonal);
  437. if (result==-10) fl_alert("Error: Could not load the file\nbecause it is not a scale file.");
  438. else if (result<0) fl_alert("Error: Could not load the file.");
  439. }
  440. void MasterUI::cb_Load(Fl_Menu_* o, void* v) {
  441. ((MasterUI*)(o->parent()->user_data()))->cb_Load_i(o,v);
  442. }
  443. void MasterUI::cb_Save1_i(Fl_Menu_*, void*) {
  444. char *filename;
  445. int result=0;
  446. filename=fl_file_chooser("Save:","({*.xsz})",NULL,0);
  447. if (filename==NULL) return;
  448. filename=fl_filename_setext(filename,".xsz");
  449. result=fileexists(filename);
  450. if (result) {
  451. result=0;
  452. if (!fl_choice("The file exists. \nOverwrite it?","No","Yes",NULL)) return;
  453. };
  454. pthread_mutex_lock(&master->mutex);
  455. result=master->microtonal.saveXML(filename);
  456. pthread_mutex_unlock(&master->mutex);
  457. if (result<0) fl_alert("Error: Could not save the file.");
  458. updatepanel();
  459. }
  460. void MasterUI::cb_Save1(Fl_Menu_* o, void* v) {
  461. ((MasterUI*)(o->parent()->user_data()))->cb_Save1_i(o,v);
  462. }
  463. void MasterUI::cb_Show_i(Fl_Menu_*, void*) {
  464. microtonalui->show();
  465. }
  466. void MasterUI::cb_Show(Fl_Menu_* o, void* v) {
  467. ((MasterUI*)(o->parent()->user_data()))->cb_Show_i(o,v);
  468. }
  469. void MasterUI::cb_Settings_i(Fl_Menu_*, void*) {
  470. configui->show();
  471. }
  472. void MasterUI::cb_Settings(Fl_Menu_* o, void* v) {
  473. ((MasterUI*)(o->parent()->user_data()))->cb_Settings_i(o,v);
  474. }
  475. void MasterUI::cb_N_i(Fl_Menu_*, void*) {
  476. nioui.refresh();
  477. nioui.show();
  478. }
  479. void MasterUI::cb_N(Fl_Menu_* o, void* v) {
  480. ((MasterUI*)(o->parent()->user_data()))->cb_N_i(o,v);
  481. }
  482. void MasterUI::cb_Copyright_i(Fl_Menu_*, void*) {
  483. aboutwindow->show();
  484. }
  485. void MasterUI::cb_Copyright(Fl_Menu_* o, void* v) {
  486. ((MasterUI*)(o->parent()->user_data()))->cb_Copyright_i(o,v);
  487. }
  488. void MasterUI::cb_E_i(Fl_Menu_*, void*) {
  489. masterwindow->do_callback();
  490. }
  491. void MasterUI::cb_E(Fl_Menu_* o, void* v) {
  492. ((MasterUI*)(o->parent()->user_data()))->cb_E_i(o,v);
  493. }
  494. void MasterUI::cb_Clear_i(Fl_Menu_*, void*) {
  495. if (fl_choice("Clear instrument's parameters ?","No","Yes",NULL)){
  496. // int npart=(int)npartcounter->value()-1;
  497. pthread_mutex_lock(&master->mutex);
  498. master->part[npart]->defaultsinstrument();
  499. pthread_mutex_unlock(&master->mutex);
  500. npartcounter->do_callback();
  501. };
  502. updatepanel();
  503. }
  504. void MasterUI::cb_Clear(Fl_Menu_* o, void* v) {
  505. ((MasterUI*)(o->parent()->user_data()))->cb_Clear_i(o,v);
  506. }
  507. void MasterUI::cb_Open1_i(Fl_Menu_*, void*) {
  508. 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. }
  524. void MasterUI::cb_Open1(Fl_Menu_* o, void* v) {
  525. ((MasterUI*)(o->parent()->user_data()))->cb_Open1_i(o,v);
  526. }
  527. void MasterUI::cb_Save2_i(Fl_Menu_*, void*) {
  528. char *filename;
  529. filename=fl_file_chooser("Save:","({*.xiz})",NULL,0);
  530. if (filename==NULL) return;
  531. filename=fl_filename_setext(filename,".xiz");
  532. int result=fileexists(filename);
  533. if (result) {
  534. result=0;
  535. if (!fl_choice("The file exists. \nOverwrite it?","No","Yes",NULL)) return;
  536. };
  537. pthread_mutex_lock(&master->mutex);
  538. result=master->part[npart]->saveXML(filename);
  539. pthread_mutex_unlock(&master->mutex);
  540. if (result<0) fl_alert("Error: Could not save the file.");
  541. updatepanel();
  542. }
  543. void MasterUI::cb_Save2(Fl_Menu_* o, void* v) {
  544. ((MasterUI*)(o->parent()->user_data()))->cb_Save2_i(o,v);
  545. }
  546. void MasterUI::cb_Show1_i(Fl_Menu_*, void*) {
  547. bankui->show();
  548. }
  549. void MasterUI::cb_Show1(Fl_Menu_* o, void* v) {
  550. ((MasterUI*)(o->parent()->user_data()))->cb_Show1_i(o,v);
  551. }
  552. void MasterUI::cb_Virtual_i(Fl_Menu_*, void*) {
  553. virkeyboard->show();
  554. }
  555. void MasterUI::cb_Virtual(Fl_Menu_* o, void* v) {
  556. ((MasterUI*)(o->parent()->user_data()))->cb_Virtual_i(o,v);
  557. }
  558. void MasterUI::cb_Choose_i(Fl_Menu_*, void*) {
  559. char *filename;
  560. recordbutton->deactivate();
  561. pausebutton->deactivate();
  562. pauselabel->deactivate();
  563. stopbutton->deactivate();
  564. filename=fl_file_chooser("Record to audio file:","(*.wav)",NULL,0);
  565. if (filename==NULL) return;
  566. fl_filename_setext(filename,".wav");
  567. int result=master->HDDRecorder.preparefile(filename,0);
  568. if (result==1) {
  569. result=0;
  570. if (fl_choice("The file exists. \nOverwrite it?","No","Yes",NULL))
  571. master->HDDRecorder.preparefile(filename,1);
  572. };
  573. if (result==0) recordbutton->activate();
  574. if (result!=0) fl_alert("Error: Could not save the file.");
  575. }
  576. void MasterUI::cb_Choose(Fl_Menu_* o, void* v) {
  577. ((MasterUI*)(o->parent()->user_data()))->cb_Choose_i(o,v);
  578. }
  579. void MasterUI::cb_Switch_i(Fl_Menu_*, void*) {
  580. if (fl_choice("Switch the User Interface to Beginner mode ?","No","Yes",NULL)){
  581. masterwindow->hide();
  582. refresh_master_ui();
  583. simplemasterwindow->show();
  584. config.cfg.UserInterfaceMode=2;
  585. };
  586. }
  587. void MasterUI::cb_Switch(Fl_Menu_* o, void* v) {
  588. ((MasterUI*)(o->parent()->user_data()))->cb_Switch_i(o,v);
  589. }
  590. Fl_Menu_Item MasterUI::menu_mastermenu[] = {
  591. {"&File", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0},
  592. {"&New (erase all)...", 0, (Fl_Callback*)MasterUI::cb_New, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  593. {"&Open Parameters...", 0, (Fl_Callback*)MasterUI::cb_Open, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  594. {"&Save All Parameters...", 0, (Fl_Callback*)MasterUI::cb_Save, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  595. {"&Load Scale Settings...", 0, (Fl_Callback*)MasterUI::cb_Load, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  596. {"Save Sc&ale Settings ..", 0, (Fl_Callback*)MasterUI::cb_Save1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  597. {"Show Scale Settings...", 0, (Fl_Callback*)MasterUI::cb_Show, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  598. {"&Settings...", 0, (Fl_Callback*)MasterUI::cb_Settings, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  599. {"N&io Settings", 0, (Fl_Callback*)MasterUI::cb_N, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  600. {"&Copyright...", 0, (Fl_Callback*)MasterUI::cb_Copyright, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  601. {"E&xit", 0, (Fl_Callback*)MasterUI::cb_E, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  602. {0,0,0,0,0,0,0,0,0},
  603. {"&Instrument", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0},
  604. {"&Clear Instrument...", 0, (Fl_Callback*)MasterUI::cb_Clear, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  605. {"&Open Instrument...", 0, (Fl_Callback*)MasterUI::cb_Open1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  606. {"&Save Instrument ...", 0, (Fl_Callback*)MasterUI::cb_Save2, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  607. {"Show Instrument &Bank...", 0, (Fl_Callback*)MasterUI::cb_Show1, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  608. {"&Virtual Keyboard...", 0, (Fl_Callback*)MasterUI::cb_Virtual, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  609. {0,0,0,0,0,0,0,0,0},
  610. {"&Record", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0},
  611. {"&Choose WAV file...", 0, (Fl_Callback*)MasterUI::cb_Choose, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  612. {0,0,0,0,0,0,0,0,0},
  613. {"Misc", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0},
  614. {"Switch User Interface Mode", 0, (Fl_Callback*)MasterUI::cb_Switch, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  615. {0,0,0,0,0,0,0,0,0},
  616. {0,0,0,0,0,0,0,0,0}
  617. };
  618. Fl_Menu_Item* MasterUI::recordmenu = MasterUI::menu_mastermenu + 19;
  619. void MasterUI::cb_mastervolumedial_i(WidgetPDial* o, void*) {
  620. master->setPvolume((int) o->value());
  621. }
  622. void MasterUI::cb_mastervolumedial(WidgetPDial* o, void* v) {
  623. ((MasterUI*)(o->parent()->user_data()))->cb_mastervolumedial_i(o,v);
  624. }
  625. void MasterUI::cb_masterkeyshiftcounter_i(Fl_Counter* o, void*) {
  626. master->setPkeyshift((int) o->value()+64);
  627. }
  628. void MasterUI::cb_masterkeyshiftcounter(Fl_Counter* o, void* v) {
  629. ((MasterUI*)(o->parent()->user_data()))->cb_masterkeyshiftcounter_i(o,v);
  630. }
  631. void MasterUI::cb_Panic_i(Fl_Button*, void*) {
  632. virkeyboard->relaseallkeys();
  633. pthread_mutex_lock(&master->mutex);
  634. master->shutup=1;
  635. pthread_mutex_unlock(&master->mutex);
  636. }
  637. void MasterUI::cb_Panic(Fl_Button* o, void* v) {
  638. ((MasterUI*)(o->parent()->user_data()))->cb_Panic_i(o,v);
  639. }
  640. void MasterUI::cb_syseffnocounter_i(Fl_Counter* o, void*) {
  641. nsyseff=(int) o->value()-1;
  642. sysefftype->value(master->sysefx[nsyseff]->geteffect());
  643. syseffectui->refresh(master->sysefx[nsyseff]);
  644. }
  645. void MasterUI::cb_syseffnocounter(Fl_Counter* o, void* v) {
  646. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_syseffnocounter_i(o,v);
  647. }
  648. void MasterUI::cb_sysefftype_i(Fl_Choice* o, void*) {
  649. pthread_mutex_lock(&master->mutex);
  650. master->sysefx[nsyseff]->changeeffect((int) o->value());
  651. pthread_mutex_unlock(&master->mutex);
  652. syseffectui->refresh(master->sysefx[nsyseff]);
  653. }
  654. void MasterUI::cb_sysefftype(Fl_Choice* o, void* v) {
  655. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_sysefftype_i(o,v);
  656. }
  657. Fl_Menu_Item MasterUI::menu_sysefftype[] = {
  658. {"No Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  659. {"Reverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  660. {"Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  661. {"Chorus", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  662. {"Phaser", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  663. {"AlienWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  664. {"Distortion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  665. {"EQ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  666. {"DynFilter", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  667. {0,0,0,0,0,0,0,0,0}
  668. };
  669. void MasterUI::cb_Send_i(Fl_Button*, void*) {
  670. syseffsendwindow->show();
  671. }
  672. void MasterUI::cb_Send(Fl_Button* o, void* v) {
  673. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_Send_i(o,v);
  674. }
  675. void MasterUI::cb_C_i(Fl_Button*, void*) {
  676. presetsui->copy(master->sysefx[nsyseff]);
  677. }
  678. void MasterUI::cb_C(Fl_Button* o, void* v) {
  679. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_C_i(o,v);
  680. }
  681. void MasterUI::cb_P_i(Fl_Button*, void*) {
  682. pthread_mutex_lock(&master->mutex);
  683. presetsui->paste(master->sysefx[nsyseff],syseffectui);
  684. pthread_mutex_unlock(&master->mutex);
  685. }
  686. void MasterUI::cb_P(Fl_Button* o, void* v) {
  687. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_P_i(o,v);
  688. }
  689. void MasterUI::cb_inseffnocounter_i(Fl_Counter* o, void*) {
  690. ninseff=(int) o->value()-1;
  691. insefftype->value(master->insefx[ninseff]->geteffect());
  692. inseffpart->value(master->Pinsparts[ninseff]+2);
  693. inseffectui->refresh(master->insefx[ninseff]);
  694. if (master->Pinsparts[ninseff]!=-1) {
  695. insefftype->activate();
  696. inseffectui->activate();
  697. inseffectuigroup->activate();
  698. } else {
  699. insefftype->deactivate();
  700. inseffectui->deactivate();
  701. inseffectuigroup->deactivate();
  702. };
  703. }
  704. void MasterUI::cb_inseffnocounter(Fl_Counter* o, void* v) {
  705. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_inseffnocounter_i(o,v);
  706. }
  707. void MasterUI::cb_insefftype_i(Fl_Choice* o, void*) {
  708. pthread_mutex_lock(&master->mutex);
  709. master->insefx[ninseff]->changeeffect((int) o->value());
  710. pthread_mutex_unlock(&master->mutex);
  711. inseffectui->refresh(master->insefx[ninseff]);
  712. inseffectui->show();
  713. }
  714. void MasterUI::cb_insefftype(Fl_Choice* o, void* v) {
  715. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_insefftype_i(o,v);
  716. }
  717. Fl_Menu_Item MasterUI::menu_insefftype[] = {
  718. {"No Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  719. {"Reverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  720. {"Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  721. {"Chorus", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  722. {"Phaser", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  723. {"AlienWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  724. {"Distortion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  725. {"EQ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  726. {"DynFilter", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  727. {0,0,0,0,0,0,0,0,0}
  728. };
  729. void MasterUI::cb_inseffpart_i(Fl_Choice* o, void*) {
  730. master->Pinsparts[ninseff]=(int) o->value()-2;
  731. if ((int) o->value()==1){
  732. inseffectuigroup->deactivate();
  733. insefftype->deactivate();
  734. inseffectui->deactivate();
  735. } else {
  736. inseffectuigroup->activate();
  737. insefftype->activate();
  738. inseffectui->activate();
  739. };
  740. master->insefx[ninseff]->cleanup();
  741. }
  742. void MasterUI::cb_inseffpart(Fl_Choice* o, void* v) {
  743. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_inseffpart_i(o,v);
  744. }
  745. void MasterUI::cb_C1_i(Fl_Button*, void*) {
  746. presetsui->copy(master->insefx[ninseff]);
  747. }
  748. void MasterUI::cb_C1(Fl_Button* o, void* v) {
  749. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_C1_i(o,v);
  750. }
  751. void MasterUI::cb_P1_i(Fl_Button*, void*) {
  752. pthread_mutex_lock(&master->mutex);
  753. presetsui->paste(master->insefx[ninseff],inseffectui);
  754. pthread_mutex_unlock(&master->mutex);
  755. }
  756. void MasterUI::cb_P1(Fl_Button* o, void* v) {
  757. ((MasterUI*)(o->parent()->parent()->parent()->user_data()))->cb_P1_i(o,v);
  758. }
  759. void MasterUI::cb_Scales_i(Fl_Button*, void*) {
  760. microtonalui->show();
  761. }
  762. void MasterUI::cb_Scales(Fl_Button* o, void* v) {
  763. ((MasterUI*)(o->parent()->user_data()))->cb_Scales_i(o,v);
  764. }
  765. void MasterUI::cb_recordbutton_i(Fl_Button* o, void*) {
  766. o->deactivate();
  767. recordmenu->deactivate();
  768. recordmenu->label("&Record(*)");
  769. stopbutton->activate();
  770. pausebutton->activate();
  771. pauselabel->activate();
  772. master->HDDRecorder.start();
  773. master->vuresetpeaks();
  774. mastermenu->redraw();
  775. }
  776. void MasterUI::cb_recordbutton(Fl_Button* o, void* v) {
  777. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_recordbutton_i(o,v);
  778. }
  779. void MasterUI::cb_stopbutton_i(Fl_Button* o, void*) {
  780. o->deactivate();
  781. master->HDDRecorder.stop();
  782. recordbutton->deactivate();
  783. pausebutton->deactivate();
  784. pauselabel->deactivate();
  785. recordmenu->activate();
  786. recordmenu->label("&Record");
  787. mastermenu->redraw();
  788. }
  789. void MasterUI::cb_stopbutton(Fl_Button* o, void* v) {
  790. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_stopbutton_i(o,v);
  791. }
  792. void MasterUI::cb_pausebutton_i(Fl_Button* o, void*) {
  793. o->deactivate();
  794. master->HDDRecorder.pause();
  795. recordbutton->activate();
  796. mastermenu->redraw();
  797. }
  798. void MasterUI::cb_pausebutton(Fl_Button* o, void* v) {
  799. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_pausebutton_i(o,v);
  800. }
  801. void MasterUI::cb_nrpnbutton_i(Fl_Check_Button* o, void*) {
  802. master->ctl.NRPN.receive=(int) o->value();
  803. }
  804. void MasterUI::cb_nrpnbutton(Fl_Check_Button* o, void* v) {
  805. ((MasterUI*)(o->parent()->user_data()))->cb_nrpnbutton_i(o,v);
  806. }
  807. void MasterUI::cb_npartcounter_i(Fl_Counter* o, void*) {
  808. int nval=(int) o->value()-1;
  809. partuigroup->remove(partui);
  810. delete partui;
  811. partui=new PartUI(0,0,765,525);
  812. partuigroup->add(partui);
  813. partui->init(master->part[nval],master,nval,bankui);
  814. partui->redraw();
  815. o->redraw();
  816. npart=nval;
  817. updatepanel();
  818. simplenpartcounter->value(nval+1);
  819. simplenpartcounter->do_callback();
  820. }
  821. void MasterUI::cb_npartcounter(Fl_Counter* o, void* v) {
  822. ((MasterUI*)(o->parent()->user_data()))->cb_npartcounter_i(o,v);
  823. }
  824. void MasterUI::cb_vK_i(Fl_Button*, void*) {
  825. virkeyboard->show();
  826. }
  827. void MasterUI::cb_vK(Fl_Button* o, void* v) {
  828. ((MasterUI*)(o->parent()->user_data()))->cb_vK_i(o,v);
  829. }
  830. void MasterUI::cb_Reset_i(Fl_Button*, void*) {
  831. globalfinedetuneslider->value(64.0);
  832. globalfinedetuneslider->do_callback();
  833. }
  834. void MasterUI::cb_Reset(Fl_Button* o, void* v) {
  835. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_Reset_i(o,v);
  836. }
  837. void MasterUI::cb_globalfinedetuneslider_i(WidgetPDial* o, void*) {
  838. master->microtonal.Pglobalfinedetune=(int) o->value();
  839. }
  840. void MasterUI::cb_globalfinedetuneslider(WidgetPDial* o, void* v) {
  841. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_globalfinedetuneslider_i(o,v);
  842. }
  843. void MasterUI::cb_Panel_i(Fl_Button*, void*) {
  844. updatepanel();
  845. panelwindow->show();
  846. }
  847. void MasterUI::cb_Panel(Fl_Button* o, void* v) {
  848. ((MasterUI*)(o->parent()->user_data()))->cb_Panel_i(o,v);
  849. }
  850. void MasterUI::cb_Close_i(Fl_Button*, void*) {
  851. aboutwindow->hide();
  852. }
  853. void MasterUI::cb_Close(Fl_Button* o, void* v) {
  854. ((MasterUI*)(o->parent()->user_data()))->cb_Close_i(o,v);
  855. }
  856. void MasterUI::cb_Close1_i(Fl_Button*, void*) {
  857. syseffsendwindow->hide();
  858. }
  859. void MasterUI::cb_Close1(Fl_Button* o, void* v) {
  860. ((MasterUI*)(o->parent()->user_data()))->cb_Close1_i(o,v);
  861. }
  862. void MasterUI::cb_Close2_i(Fl_Button*, void*) {
  863. panelwindow->hide();
  864. updatepanel();
  865. }
  866. void MasterUI::cb_Close2(Fl_Button* o, void* v) {
  867. ((MasterUI*)(o->parent()->user_data()))->cb_Close2_i(o,v);
  868. }
  869. void MasterUI::cb_Refresh_i(Fl_Button*, void*) {
  870. updatepanel();
  871. }
  872. void MasterUI::cb_Refresh(Fl_Button* o, void* v) {
  873. ((MasterUI*)(o->parent()->user_data()))->cb_Refresh_i(o,v);
  874. }
  875. void MasterUI::cb_simplemasterwindow_i(Fl_Double_Window*, void*) {
  876. #ifndef PLUGINVERSION
  877. if (fl_choice("Exit and leave the unsaved data?","No","Yes",NULL))
  878. #endif
  879. {
  880. config.save();
  881. *exitprogram=1;
  882. };
  883. }
  884. void MasterUI::cb_simplemasterwindow(Fl_Double_Window* o, void* v) {
  885. ((MasterUI*)(o->user_data()))->cb_simplemasterwindow_i(o,v);
  886. }
  887. void MasterUI::cb_New1_i(Fl_Menu_*, void*) {
  888. do_new_master();
  889. }
  890. void MasterUI::cb_New1(Fl_Menu_* o, void* v) {
  891. ((MasterUI*)(o->parent()->user_data()))->cb_New1_i(o,v);
  892. }
  893. void MasterUI::cb_Open2_i(Fl_Menu_*, void*) {
  894. do_load_master();
  895. }
  896. void MasterUI::cb_Open2(Fl_Menu_* o, void* v) {
  897. ((MasterUI*)(o->parent()->user_data()))->cb_Open2_i(o,v);
  898. }
  899. void MasterUI::cb_Save3_i(Fl_Menu_*, void*) {
  900. #if USE_NSM
  901. if ( nsm && nsm->is_active() )
  902. {
  903. do_save_master( nsm->project_filename );
  904. }
  905. else
  906. #endif
  907. {
  908. do_save_master();
  909. };
  910. }
  911. void MasterUI::cb_Save3(Fl_Menu_* o, void* v) {
  912. ((MasterUI*)(o->parent()->user_data()))->cb_Save3_i(o,v);
  913. }
  914. void MasterUI::cb_Settings1_i(Fl_Menu_*, void*) {
  915. configui->show();
  916. }
  917. void MasterUI::cb_Settings1(Fl_Menu_* o, void* v) {
  918. ((MasterUI*)(o->parent()->user_data()))->cb_Settings1_i(o,v);
  919. }
  920. void MasterUI::cb_Copyright1_i(Fl_Menu_*, void*) {
  921. aboutwindow->show();
  922. }
  923. void MasterUI::cb_Copyright1(Fl_Menu_* o, void* v) {
  924. ((MasterUI*)(o->parent()->user_data()))->cb_Copyright1_i(o,v);
  925. }
  926. void MasterUI::cb_E1_i(Fl_Menu_*, void*) {
  927. masterwindow->do_callback();
  928. }
  929. void MasterUI::cb_E1(Fl_Menu_* o, void* v) {
  930. ((MasterUI*)(o->parent()->user_data()))->cb_E1_i(o,v);
  931. }
  932. void MasterUI::cb_Open3_i(Fl_Menu_*, void*) {
  933. const char *filename;
  934. filename=fl_file_chooser("Load:","({*.xiz})",NULL,0);
  935. if (filename==NULL) return;
  936. pthread_mutex_lock(&master->mutex);
  937. // int npart=(int)npartcounter->value()-1;
  938. //clear all instrument parameters, first
  939. master->part[npart]->defaultsinstrument();
  940. //load the instr. parameters
  941. int result=master->part[npart]->loadXMLinstrument(filename);
  942. pthread_mutex_unlock(&master->mutex);
  943. master->part[npart]->applyparameters();
  944. simplenpartcounter->do_callback();
  945. if (result==-10) fl_alert("Error: Could not load the file\nbecause it is not an instrument file.");
  946. else if (result<0) fl_alert("Error: Could not load the file.");
  947. }
  948. void MasterUI::cb_Open3(Fl_Menu_* o, void* v) {
  949. ((MasterUI*)(o->parent()->user_data()))->cb_Open3_i(o,v);
  950. }
  951. void MasterUI::cb_Show2_i(Fl_Menu_*, void*) {
  952. bankui->show();
  953. }
  954. void MasterUI::cb_Show2(Fl_Menu_* o, void* v) {
  955. ((MasterUI*)(o->parent()->user_data()))->cb_Show2_i(o,v);
  956. }
  957. void MasterUI::cb_Switch1_i(Fl_Menu_*, void*) {
  958. if (fl_choice("Switch the User Interface to Advanced mode ?","No","Yes",NULL)){
  959. simplemasterwindow->hide();
  960. refresh_master_ui();
  961. masterwindow->show();
  962. config.cfg.UserInterfaceMode=1;
  963. };
  964. }
  965. void MasterUI::cb_Switch1(Fl_Menu_* o, void* v) {
  966. ((MasterUI*)(o->parent()->user_data()))->cb_Switch1_i(o,v);
  967. }
  968. Fl_Menu_Item MasterUI::menu_simplemastermenu[] = {
  969. {"&File", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0},
  970. {"&New (erase all)...", 0, (Fl_Callback*)MasterUI::cb_New1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  971. {"&Open Parameters...", 0, (Fl_Callback*)MasterUI::cb_Open2, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  972. {"&Save All Parameters...", 0, (Fl_Callback*)MasterUI::cb_Save3, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  973. {"&Settings...", 0, (Fl_Callback*)MasterUI::cb_Settings1, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  974. {"&Copyright...", 0, (Fl_Callback*)MasterUI::cb_Copyright1, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  975. {"E&xit", 0, (Fl_Callback*)MasterUI::cb_E1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  976. {0,0,0,0,0,0,0,0,0},
  977. {"&Instrument", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0},
  978. {"&Open Instrument...", 0, (Fl_Callback*)MasterUI::cb_Open3, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  979. {"Show Instrument &Bank...", 0, (Fl_Callback*)MasterUI::cb_Show2, 0, 128, FL_NORMAL_LABEL, 0, 14, 0},
  980. {0,0,0,0,0,0,0,0,0},
  981. {"Misc", 0, 0, 0, 64, FL_NORMAL_LABEL, 0, 14, 0},
  982. {"Switch User Interface Mode", 0, (Fl_Callback*)MasterUI::cb_Switch1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
  983. {0,0,0,0,0,0,0,0,0},
  984. {0,0,0,0,0,0,0,0,0}
  985. };
  986. void MasterUI::cb_partname1_i(Fl_Button*, void*) {
  987. if ((int)bankui->cbwig->value()!=(npart+1)){
  988. bankui->cbwig->value(npart+1);
  989. bankui->cbwig->do_callback();
  990. };
  991. bankui->show();
  992. }
  993. void MasterUI::cb_partname1(Fl_Button* o, void* v) {
  994. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_partname1_i(o,v);
  995. }
  996. void MasterUI::cb_partpanning1_i(Fl_Slider* o, void*) {
  997. master->part[npart]->setPpanning((int) o->value());
  998. }
  999. void MasterUI::cb_partpanning1(Fl_Slider* o, void* v) {
  1000. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_partpanning1_i(o,v);
  1001. }
  1002. void MasterUI::cb_partrcv1_i(Fl_Choice* o, void*) {
  1003. virkeys->relaseallkeys(0);
  1004. master->part[npart]->Prcvchn=(int) o->value();
  1005. virkeys->midich=(int) o->value();
  1006. }
  1007. void MasterUI::cb_partrcv1(Fl_Choice* o, void* v) {
  1008. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_partrcv1_i(o,v);
  1009. }
  1010. void MasterUI::cb_partvolume1_i(WidgetPDial* o, void*) {
  1011. master->part[npart]->setPvolume((int) o->value());
  1012. }
  1013. void MasterUI::cb_partvolume1(WidgetPDial* o, void* v) {
  1014. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_partvolume1_i(o,v);
  1015. }
  1016. void MasterUI::cb_simplepartportamento_i(Fl_Check_Button* o, void*) {
  1017. master->part[npart]->ctl.portamento.portamento=(int) o->value();
  1018. }
  1019. void MasterUI::cb_simplepartportamento(Fl_Check_Button* o, void* v) {
  1020. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simplepartportamento_i(o,v);
  1021. }
  1022. void MasterUI::cb_simpleminkcounter_i(Fl_Counter* o, void*) {
  1023. master->part[npart]->Pminkey=(int) o->value();
  1024. if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED);
  1025. else o->textcolor(FL_BLACK);
  1026. }
  1027. void MasterUI::cb_simpleminkcounter(Fl_Counter* o, void* v) {
  1028. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simpleminkcounter_i(o,v);
  1029. }
  1030. void MasterUI::cb_simplemaxkcounter_i(Fl_Counter* o, void*) {
  1031. master->part[npart]->Pmaxkey=(int) o->value();
  1032. if (master->part[npart]->Pminkey>master->part[npart]->Pmaxkey) o->textcolor(FL_RED);
  1033. else o->textcolor(FL_BLACK);
  1034. }
  1035. void MasterUI::cb_simplemaxkcounter(Fl_Counter* o, void* v) {
  1036. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simplemaxkcounter_i(o,v);
  1037. }
  1038. void MasterUI::cb_m_i(Fl_Button*, void*) {
  1039. if (master->part[npart]->lastnote>=0) simpleminkcounter->value(master->part[npart]->lastnote);
  1040. simpleminkcounter->do_callback();
  1041. simplemaxkcounter->do_callback();
  1042. }
  1043. void MasterUI::cb_m(Fl_Button* o, void* v) {
  1044. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_m_i(o,v);
  1045. }
  1046. void MasterUI::cb_M_i(Fl_Button*, void*) {
  1047. if (master->part[npart]->lastnote>=0) simplemaxkcounter->value(master->part[npart]->lastnote);
  1048. simplemaxkcounter->do_callback();
  1049. simpleminkcounter->do_callback();
  1050. }
  1051. void MasterUI::cb_M(Fl_Button* o, void* v) {
  1052. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_M_i(o,v);
  1053. }
  1054. void MasterUI::cb_R_i(Fl_Button*, void*) {
  1055. simpleminkcounter->value(0);
  1056. simpleminkcounter->do_callback();
  1057. simplemaxkcounter->value(127);
  1058. simplemaxkcounter->do_callback();
  1059. }
  1060. void MasterUI::cb_R(Fl_Button* o, void* v) {
  1061. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_R_i(o,v);
  1062. }
  1063. void MasterUI::cb_simplepartkeyshiftcounter_i(Fl_Counter* o, void*) {
  1064. master->part[npart]->Pkeyshift=(int) o->value()+64;
  1065. }
  1066. void MasterUI::cb_simplepartkeyshiftcounter(Fl_Counter* o, void* v) {
  1067. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simplepartkeyshiftcounter_i(o,v);
  1068. }
  1069. void MasterUI::cb_simplesyseffsend_i(WidgetPDial* o, void*) {
  1070. master->setPsysefxvol(npart,nsyseff,(int) o->value());
  1071. }
  1072. void MasterUI::cb_simplesyseffsend(WidgetPDial* o, void* v) {
  1073. ((MasterUI*)(o->parent()->parent()->user_data()))->cb_simplesyseffsend_i(o,v);
  1074. }
  1075. void MasterUI::cb_partenabled1_i(Fl_Check_Button* o, void*) {
  1076. pthread_mutex_lock(&master->mutex);
  1077. master->partonoff(npart,(int) o->value());
  1078. pthread_mutex_unlock(&master->mutex);
  1079. if ((int) o->value()==0) simplelistitemgroup->deactivate();
  1080. else {
  1081. simplelistitemgroup->activate();
  1082. if ((int)bankui->cbwig->value()!=(npart+1)){
  1083. bankui->cbwig->value(npart+1);
  1084. bankui->cbwig->do_callback();
  1085. };
  1086. };
  1087. o->redraw();
  1088. }
  1089. void MasterUI::cb_partenabled1(Fl_Check_Button* o, void* v) {
  1090. ((MasterUI*)(o->parent()->user_data()))->cb_partenabled1_i(o,v);
  1091. }
  1092. void MasterUI::cb_simplesyseffnocounter_i(Fl_Counter* o, void*) {
  1093. nsyseff=(int) o->value()-1;
  1094. simplesysefftype->value(master->sysefx[nsyseff]->geteffect());
  1095. simplesyseffectui->refresh(master->sysefx[nsyseff]);
  1096. simplerefresh();
  1097. }
  1098. void MasterUI::cb_simplesyseffnocounter(Fl_Counter* o, void* v) {
  1099. ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simplesyseffnocounter_i(o,v);
  1100. }
  1101. void MasterUI::cb_simplesysefftype_i(Fl_Choice* o, void*) {
  1102. pthread_mutex_lock(&master->mutex);
  1103. master->sysefx[nsyseff]->changeeffect((int) o->value());
  1104. pthread_mutex_unlock(&master->mutex);
  1105. simplesyseffectui->refresh(master->sysefx[nsyseff]);
  1106. }
  1107. void MasterUI::cb_simplesysefftype(Fl_Choice* o, void* v) {
  1108. ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simplesysefftype_i(o,v);
  1109. }
  1110. Fl_Menu_Item MasterUI::menu_simplesysefftype[] = {
  1111. {"No Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1112. {"Reverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1113. {"Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1114. {"Chorus", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1115. {"Phaser", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1116. {"AlienWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1117. {"Distortion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1118. {"EQ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1119. {"DynFilter", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1120. {0,0,0,0,0,0,0,0,0}
  1121. };
  1122. void MasterUI::cb_Send1_i(Fl_Button*, void*) {
  1123. syseffsendwindow->show();
  1124. }
  1125. void MasterUI::cb_Send1(Fl_Button* o, void* v) {
  1126. ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Send1_i(o,v);
  1127. }
  1128. void MasterUI::cb_P2_i(Fl_Button*, void*) {
  1129. pthread_mutex_lock(&master->mutex);
  1130. presetsui->paste(master->sysefx[nsyseff],simplesyseffectui);
  1131. pthread_mutex_unlock(&master->mutex);
  1132. }
  1133. void MasterUI::cb_P2(Fl_Button* o, void* v) {
  1134. ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_P2_i(o,v);
  1135. }
  1136. void MasterUI::cb_simpleinseffnocounter_i(Fl_Counter* o, void*) {
  1137. ninseff=(int) o->value()-1;
  1138. simpleinsefftype->value(master->insefx[ninseff]->geteffect());
  1139. simpleinseffpart->value(master->Pinsparts[ninseff]+2);
  1140. simpleinseffectui->refresh(master->insefx[ninseff]);
  1141. if (master->Pinsparts[ninseff]!=-1) {
  1142. simpleinsefftype->activate();
  1143. simpleinseffectui->activate();
  1144. simpleinseffectuigroup->activate();
  1145. } else {
  1146. simpleinsefftype->deactivate();
  1147. simpleinseffectui->deactivate();
  1148. simpleinseffectuigroup->deactivate();
  1149. };
  1150. }
  1151. void MasterUI::cb_simpleinseffnocounter(Fl_Counter* o, void* v) {
  1152. ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simpleinseffnocounter_i(o,v);
  1153. }
  1154. void MasterUI::cb_simpleinsefftype_i(Fl_Choice* o, void*) {
  1155. pthread_mutex_lock(&master->mutex);
  1156. master->insefx[ninseff]->changeeffect((int) o->value());
  1157. pthread_mutex_unlock(&master->mutex);
  1158. simpleinseffectui->refresh(master->insefx[ninseff]);
  1159. simpleinseffectui->show();
  1160. }
  1161. void MasterUI::cb_simpleinsefftype(Fl_Choice* o, void* v) {
  1162. ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simpleinsefftype_i(o,v);
  1163. }
  1164. Fl_Menu_Item MasterUI::menu_simpleinsefftype[] = {
  1165. {"No Effect", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1166. {"Reverb", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1167. {"Echo", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1168. {"Chorus", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1169. {"Phaser", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1170. {"AlienWah", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1171. {"Distortion", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1172. {"EQ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1173. {"DynFilter", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0},
  1174. {0,0,0,0,0,0,0,0,0}
  1175. };
  1176. void MasterUI::cb_simpleinseffpart_i(Fl_Choice* o, void*) {
  1177. master->Pinsparts[ninseff]=(int) o->value()-2;
  1178. if ((int) o->value()==1){
  1179. simpleinseffectuigroup->deactivate();
  1180. simpleinsefftype->deactivate();
  1181. simpleinseffectui->deactivate();
  1182. } else {
  1183. simpleinseffectuigroup->activate();
  1184. simpleinsefftype->activate();
  1185. simpleinseffectui->activate();
  1186. };
  1187. master->insefx[ninseff]->cleanup();
  1188. }
  1189. void MasterUI::cb_simpleinseffpart(Fl_Choice* o, void* v) {
  1190. ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_simpleinseffpart_i(o,v);
  1191. }
  1192. void MasterUI::cb_P3_i(Fl_Button*, void*) {
  1193. pthread_mutex_lock(&master->mutex);
  1194. presetsui->paste(master->insefx[ninseff],simpleinseffectui);
  1195. pthread_mutex_unlock(&master->mutex);
  1196. }
  1197. void MasterUI::cb_P3(Fl_Button* o, void* v) {
  1198. ((MasterUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_P3_i(o,v);
  1199. }
  1200. void MasterUI::cb_simplemastervolumedial_i(WidgetPDial* o, void*) {
  1201. master->setPvolume((int) o->value());
  1202. }
  1203. void MasterUI::cb_simplemastervolumedial(WidgetPDial* o, void* v) {
  1204. ((MasterUI*)(o->parent()->user_data()))->cb_simplemastervolumedial_i(o,v);
  1205. }
  1206. void MasterUI::cb_simplemasterkeyshiftcounter_i(Fl_Counter* o, void*) {
  1207. master->setPkeyshift((int) o->value()+64);
  1208. }
  1209. void MasterUI::cb_simplemasterkeyshiftcounter(Fl_Counter* o, void* v) {
  1210. ((MasterUI*)(o->parent()->user_data()))->cb_simplemasterkeyshiftcounter_i(o,v);
  1211. }
  1212. void MasterUI::cb_Stop_i(Fl_Button*, void*) {
  1213. virkeyboard->relaseallkeys();
  1214. pthread_mutex_lock(&master->mutex);
  1215. master->shutup=1;
  1216. pthread_mutex_unlock(&master->mutex);
  1217. }
  1218. void MasterUI::cb_Stop(Fl_Button* o, void* v) {
  1219. ((MasterUI*)(o->parent()->user_data()))->cb_Stop_i(o,v);
  1220. }
  1221. void MasterUI::cb_Reset1_i(Fl_Button*, void*) {
  1222. simpleglobalfinedetuneslider->value(64.0);
  1223. simpleglobalfinedetuneslider->do_callback();
  1224. }
  1225. void MasterUI::cb_Reset1(Fl_Button* o, void* v) {
  1226. ((MasterUI*)(o->parent()->user_data()))->cb_Reset1_i(o,v);
  1227. }
  1228. void MasterUI::cb_simpleglobalfinedetuneslider_i(WidgetPDial* o, void*) {
  1229. master->microtonal.Pglobalfinedetune=(int) o->value();
  1230. }
  1231. void MasterUI::cb_simpleglobalfinedetuneslider(WidgetPDial* o, void* v) {
  1232. ((MasterUI*)(o->parent()->user_data()))->cb_simpleglobalfinedetuneslider_i(o,v);
  1233. }
  1234. void MasterUI::cb_simplenpartcounter_i(Fl_Counter* o, void*) {
  1235. virkeys->relaseallkeys(0);
  1236. npartcounter->value(o->value());
  1237. npart=(int) o->value()-1;
  1238. simplerefresh();
  1239. virkeys->midich=master->part[npart]->Prcvchn;
  1240. }
  1241. void MasterUI::cb_simplenpartcounter(Fl_Counter* o, void* v) {
  1242. ((MasterUI*)(o->parent()->user_data()))->cb_simplenpartcounter_i(o,v);
  1243. }
  1244. void MasterUI::cb_Keyb_i(Fl_Counter* o, void*) {
  1245. virkeys->relaseallkeys(0);
  1246. virkeys->midioct=(int) o->value();
  1247. virkeys->take_focus();
  1248. }
  1249. void MasterUI::cb_Keyb(Fl_Counter* o, void* v) {
  1250. ((MasterUI*)(o->parent()->user_data()))->cb_Keyb_i(o,v);
  1251. }
  1252. void MasterUI::cb_selectuiwindow_i(Fl_Double_Window*, void*) {
  1253. *exitprogram=1;
  1254. }
  1255. void MasterUI::cb_selectuiwindow(Fl_Double_Window* o, void* v) {
  1256. ((MasterUI*)(o->user_data()))->cb_selectuiwindow_i(o,v);
  1257. }
  1258. void MasterUI::cb_Advanced_i(Fl_Button*, void*) {
  1259. config.cfg.UserInterfaceMode=1;
  1260. masterwindow->show();
  1261. selectuiwindow->hide();
  1262. }
  1263. void MasterUI::cb_Advanced(Fl_Button* o, void* v) {
  1264. ((MasterUI*)(o->parent()->user_data()))->cb_Advanced_i(o,v);
  1265. }
  1266. void MasterUI::cb_Beginner_i(Fl_Button*, void*) {
  1267. simplemasterwindow->show();
  1268. selectuiwindow->hide();
  1269. config.cfg.UserInterfaceMode=2;
  1270. }
  1271. void MasterUI::cb_Beginner(Fl_Button* o, void* v) {
  1272. ((MasterUI*)(o->parent()->user_data()))->cb_Beginner_i(o,v);
  1273. }
  1274. Fl_Double_Window* MasterUI::make_window() {
  1275. { masterwindow = new Fl_Double_Window(390, 525, "zynaddsubfx");
  1276. masterwindow->callback((Fl_Callback*)cb_masterwindow, (void*)(this));
  1277. { mastermenu = new Fl_Menu_Bar(-5, 0, 690, 25);
  1278. mastermenu->menu(menu_mastermenu);
  1279. } // Fl_Menu_Bar* mastermenu
  1280. { WidgetPDial* o = mastervolumedial = new WidgetPDial(15, 32, 55, 55, "Master Volume");
  1281. mastervolumedial->tooltip("Master Volume");
  1282. mastervolumedial->box(FL_ROUND_UP_BOX);
  1283. mastervolumedial->color(FL_BACKGROUND_COLOR);
  1284. mastervolumedial->selection_color(FL_INACTIVE_COLOR);
  1285. mastervolumedial->labeltype(FL_NORMAL_LABEL);
  1286. mastervolumedial->labelfont(0);
  1287. mastervolumedial->labelsize(9);
  1288. mastervolumedial->labelcolor(FL_FOREGROUND_COLOR);
  1289. mastervolumedial->maximum(127);
  1290. mastervolumedial->step(1);
  1291. mastervolumedial->callback((Fl_Callback*)cb_mastervolumedial);
  1292. mastervolumedial->align(Fl_Align(130));
  1293. mastervolumedial->when(FL_WHEN_CHANGED);
  1294. o->value(master->Pvolume);
  1295. } // WidgetPDial* mastervolumedial
  1296. { Fl_Counter* o = masterkeyshiftcounter = new Fl_Counter(150, 97, 120, 23, "Master KeyShift");
  1297. masterkeyshiftcounter->type(1);
  1298. masterkeyshiftcounter->labelsize(9);
  1299. masterkeyshiftcounter->minimum(-64);
  1300. masterkeyshiftcounter->maximum(64);
  1301. masterkeyshiftcounter->step(1);
  1302. masterkeyshiftcounter->callback((Fl_Callback*)cb_masterkeyshiftcounter);
  1303. o->lstep(12);
  1304. o->value(master->Pkeyshift-64);
  1305. } // Fl_Counter* masterkeyshiftcounter
  1306. { Fl_Button* o = new Fl_Button(280, 29, 105, 53, "Panic!");
  1307. o->color((Fl_Color)90);
  1308. o->labelfont(1);
  1309. o->callback((Fl_Callback*)cb_Panic);
  1310. } // Fl_Button* o
  1311. { partuigroup = new Fl_Group(0, 310, 390, 205);
  1312. { PartUI* o = partui = new PartUI(0, 310, 383, 175);
  1313. partui->box(FL_NO_BOX);
  1314. partui->color(FL_BACKGROUND_COLOR);
  1315. partui->selection_color(FL_BACKGROUND_COLOR);
  1316. partui->labeltype(FL_NORMAL_LABEL);
  1317. partui->labelfont(0);
  1318. partui->labelsize(14);
  1319. partui->labelcolor(FL_FOREGROUND_COLOR);
  1320. partui->align(Fl_Align(FL_ALIGN_TOP));
  1321. partui->when(FL_WHEN_RELEASE);
  1322. o->init(master->part[0],master,0,bankui);
  1323. o->show();
  1324. partui->end();
  1325. } // PartUI* partui
  1326. partuigroup->end();
  1327. } // Fl_Group* partuigroup
  1328. { Fl_Tabs* o = new Fl_Tabs(0, 145, 390, 165);
  1329. o->box(FL_UP_FRAME);
  1330. { Fl_Group* o = new Fl_Group(0, 162, 390, 145, "System Effects");
  1331. o->labelsize(15);
  1332. o->align(Fl_Align(FL_ALIGN_TOP_RIGHT));
  1333. { Fl_Counter* o = syseffnocounter = new Fl_Counter(5, 181, 80, 22, "Sys.Effect No.");
  1334. syseffnocounter->type(1);
  1335. syseffnocounter->labelfont(1);
  1336. syseffnocounter->labelsize(10);
  1337. syseffnocounter->minimum(0);
  1338. syseffnocounter->maximum(127);
  1339. syseffnocounter->step(1);
  1340. syseffnocounter->value(1);
  1341. syseffnocounter->textfont(1);
  1342. syseffnocounter->callback((Fl_Callback*)cb_syseffnocounter);
  1343. syseffnocounter->align(Fl_Align(FL_ALIGN_TOP));
  1344. o->bounds(1,NUM_SYS_EFX);
  1345. o->value(nsyseff+1);
  1346. } // Fl_Counter* syseffnocounter
  1347. { Fl_Choice* o = sysefftype = new Fl_Choice(285, 176, 100, 22, "EffType");
  1348. sysefftype->down_box(FL_BORDER_BOX);
  1349. sysefftype->labelsize(10);
  1350. sysefftype->callback((Fl_Callback*)cb_sysefftype);
  1351. sysefftype->menu(menu_sysefftype);
  1352. o->value(master->sysefx[nsyseff]->geteffect());
  1353. } // Fl_Choice* sysefftype
  1354. { syseffectuigroup = new Fl_Group(5, 203, 380, 95);
  1355. syseffectuigroup->color((Fl_Color)48);
  1356. { EffUI* o = syseffectui = new EffUI(5, 203, 380, 95);
  1357. syseffectui->box(FL_NO_BOX);
  1358. syseffectui->color(FL_BACKGROUND_COLOR);
  1359. syseffectui->selection_color(FL_BACKGROUND_COLOR);
  1360. syseffectui->labeltype(FL_NORMAL_LABEL);
  1361. syseffectui->labelfont(0);
  1362. syseffectui->labelsize(14);
  1363. syseffectui->labelcolor(FL_FOREGROUND_COLOR);
  1364. syseffectui->align(Fl_Align(FL_ALIGN_TOP));
  1365. syseffectui->when(FL_WHEN_RELEASE);
  1366. o->init(master->sysefx[nsyseff]);
  1367. syseffectui->end();
  1368. } // EffUI* syseffectui
  1369. syseffectuigroup->end();
  1370. } // Fl_Group* syseffectuigroup
  1371. { Fl_Button* o = new Fl_Button(90, 181, 85, 22, "Send to...");
  1372. o->box(FL_THIN_UP_BOX);
  1373. o->labelfont(1);
  1374. o->labelsize(11);
  1375. o->callback((Fl_Callback*)cb_Send);
  1376. } // Fl_Button* o
  1377. { Fl_Button* o = new Fl_Button(180, 187, 25, 15, "C");
  1378. o->box(FL_THIN_UP_BOX);
  1379. o->color((Fl_Color)179);
  1380. o->labelfont(1);
  1381. o->labelsize(11);
  1382. o->labelcolor(FL_BACKGROUND2_COLOR);
  1383. o->callback((Fl_Callback*)cb_C);
  1384. } // Fl_Button* o
  1385. { Fl_Button* o = new Fl_Button(210, 187, 25, 15, "P");
  1386. o->box(FL_THIN_UP_BOX);
  1387. o->color((Fl_Color)179);
  1388. o->labelfont(1);
  1389. o->labelsize(11);
  1390. o->labelcolor(FL_BACKGROUND2_COLOR);
  1391. o->callback((Fl_Callback*)cb_P);
  1392. } // Fl_Button* o
  1393. o->end();
  1394. } // Fl_Group* o
  1395. { Fl_Group* o = new Fl_Group(0, 165, 390, 145, "Insertion Effects");
  1396. o->labelsize(15);
  1397. o->align(Fl_Align(FL_ALIGN_TOP_RIGHT));
  1398. o->hide();
  1399. { Fl_Counter* o = inseffnocounter = new Fl_Counter(5, 183, 80, 22, "Ins.Effect No.");
  1400. inseffnocounter->type(1);
  1401. inseffnocounter->labelfont(1);
  1402. inseffnocounter->labelsize(10);
  1403. inseffnocounter->minimum(0);
  1404. inseffnocounter->maximum(127);
  1405. inseffnocounter->step(1);
  1406. inseffnocounter->value(1);
  1407. inseffnocounter->textfont(1);
  1408. inseffnocounter->callback((Fl_Callback*)cb_inseffnocounter);
  1409. inseffnocounter->align(Fl_Align(FL_ALIGN_TOP));
  1410. o->bounds(1,NUM_INS_EFX);
  1411. o->value(ninseff+1);
  1412. } // Fl_Counter* inseffnocounter
  1413. { Fl_Choice* o = insefftype = new Fl_Choice(285, 173, 100, 22, "EffType");
  1414. insefftype->down_box(FL_BORDER_BOX);
  1415. insefftype->labelsize(10);
  1416. insefftype->callback((Fl_Callback*)cb_insefftype);
  1417. insefftype->menu(menu_insefftype);
  1418. o->value(master->insefx[ninseff]->geteffect());
  1419. if (master->Pinsparts[ninseff]== -1) o->deactivate();
  1420. } // Fl_Choice* insefftype
  1421. { inseffectuigroup = new Fl_Group(5, 205, 380, 95);
  1422. inseffectuigroup->box(FL_FLAT_BOX);
  1423. inseffectuigroup->color((Fl_Color)48);
  1424. { EffUI* o = inseffectui = new EffUI(5, 205, 380, 90);
  1425. inseffectui->box(FL_UP_FRAME);
  1426. inseffectui->color(FL_BACKGROUND_COLOR);
  1427. inseffectui->selection_color(FL_BACKGROUND_COLOR);
  1428. inseffectui->labeltype(FL_NORMAL_LABEL);
  1429. inseffectui->labelfont(0);
  1430. inseffectui->labelsize(14);
  1431. inseffectui->labelcolor(FL_FOREGROUND_COLOR);
  1432. inseffectui->align(Fl_Align(FL_ALIGN_TOP));
  1433. inseffectui->when(FL_WHEN_RELEASE);
  1434. o->init(master->insefx[ninseff]);
  1435. if (master->Pinsparts[ninseff]== -1) o->deactivate();
  1436. inseffectui->end();
  1437. } // EffUI* inseffectui
  1438. inseffectuigroup->end();
  1439. } // Fl_Group* inseffectuigroup
  1440. { Fl_Choice* o = inseffpart = new Fl_Choice(95, 183, 80, 22, "Insert To.");
  1441. inseffpart->down_box(FL_BORDER_BOX);
  1442. inseffpart->labelfont(1);
  1443. inseffpart->labelsize(10);
  1444. inseffpart->textsize(10);
  1445. inseffpart->callback((Fl_Callback*)cb_inseffpart);
  1446. inseffpart->align(Fl_Align(FL_ALIGN_TOP_LEFT));
  1447. o->add("Master Out");o->add("Off");
  1448. char tmp[50]; for (int i=0;i<NUM_MIDI_PARTS;i++) {sprintf(tmp,"Part %2d",i+1);o->add(tmp);};
  1449. o->value(master->Pinsparts[ninseff]+2);
  1450. } // Fl_Choice* inseffpart
  1451. { Fl_Button* o = new Fl_Button(180, 185, 25, 15, "C");
  1452. o->box(FL_THIN_UP_BOX);
  1453. o->color((Fl_Color)179);
  1454. o->labelfont(1);
  1455. o->labelsize(11);
  1456. o->labelcolor(FL_BACKGROUND2_COLOR);
  1457. o->callback((Fl_Callback*)cb_C1);
  1458. } // Fl_Button* o
  1459. { Fl_Button* o = new Fl_Button(210, 185, 25, 15, "P");
  1460. o->box(FL_THIN_UP_BOX);
  1461. o->color((Fl_Color)179);
  1462. o->labelfont(1);
  1463. o->labelsize(11);
  1464. o->labelcolor(FL_BACKGROUND2_COLOR);
  1465. o->callback((Fl_Callback*)cb_P1);
  1466. } // Fl_Button* o
  1467. o->end();
  1468. } // Fl_Group* o
  1469. o->end();
  1470. } // Fl_Tabs* o
  1471. { Fl_Button* o = new Fl_Button(320, 87, 65, 23, "Scales");
  1472. o->color((Fl_Color)51);
  1473. o->labelfont(1);
  1474. o->callback((Fl_Callback*)cb_Scales);
  1475. } // Fl_Button* o
  1476. { Fl_Group* o = new Fl_Group(150, 40, 117, 45);
  1477. o->box(FL_UP_FRAME);
  1478. { recordbutton = new Fl_Button(159, 46, 21, 21, "Rec.");
  1479. recordbutton->tooltip("Start Recording");
  1480. recordbutton->box(FL_ROUND_UP_BOX);
  1481. recordbutton->color(FL_RED);
  1482. recordbutton->labelfont(1);
  1483. recordbutton->labelsize(10);
  1484. recordbutton->callback((Fl_Callback*)cb_recordbutton);
  1485. recordbutton->align(Fl_Align(FL_ALIGN_BOTTOM));
  1486. recordbutton->deactivate();
  1487. } // Fl_Button* recordbutton
  1488. { stopbutton = new Fl_Button(237, 46, 21, 21, "Stop");
  1489. stopbutton->tooltip("Stop Recording and close the audio file");
  1490. stopbutton->box(FL_THIN_UP_BOX);
  1491. stopbutton->color((Fl_Color)4);
  1492. stopbutton->labelfont(1);
  1493. stopbutton->labelsize(10);
  1494. stopbutton->callback((Fl_Callback*)cb_stopbutton);
  1495. stopbutton->align(Fl_Align(FL_ALIGN_BOTTOM));
  1496. stopbutton->deactivate();
  1497. } // Fl_Button* stopbutton
  1498. { pausebutton = new Fl_Button(198, 46, 21, 21, "@||");
  1499. pausebutton->tooltip("Pause Recording");
  1500. pausebutton->box(FL_THIN_UP_BOX);
  1501. pausebutton->color((Fl_Color)4);
  1502. pausebutton->selection_color((Fl_Color)4);
  1503. pausebutton->labelfont(1);
  1504. pausebutton->labelcolor((Fl_Color)3);
  1505. pausebutton->callback((Fl_Callback*)cb_pausebutton);
  1506. pausebutton->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE));
  1507. pausebutton->deactivate();
  1508. } // Fl_Button* pausebutton
  1509. { pauselabel = new Fl_Box(192, 66, 30, 15, "Pause");
  1510. pauselabel->labelfont(1);
  1511. pauselabel->labelsize(10);
  1512. pauselabel->deactivate();
  1513. } // Fl_Box* pauselabel
  1514. o->end();
  1515. } // Fl_Group* o
  1516. { Fl_Group* o = new Fl_Group(1, 490, 389, 55);
  1517. { VUMeter* o = new VUMeter(5, 490, 380, 30, "VU-Meter");
  1518. o->box(FL_FLAT_BOX);
  1519. o->color((Fl_Color)48);
  1520. o->selection_color((Fl_Color)75);
  1521. o->labeltype(FL_NORMAL_LABEL);
  1522. o->labelfont(0);
  1523. o->labelsize(14);
  1524. o->labelcolor(FL_FOREGROUND_COLOR);
  1525. o->align(Fl_Align(FL_ALIGN_CENTER));
  1526. o->when(FL_WHEN_RELEASE);
  1527. o->init(master,-1);
  1528. } // VUMeter* o
  1529. o->end();
  1530. } // Fl_Group* o
  1531. { Fl_Check_Button* o = nrpnbutton = new Fl_Check_Button(10, 115, 60, 25, "NRPN");
  1532. nrpnbutton->tooltip("Receive NRPNs");
  1533. nrpnbutton->down_box(FL_DOWN_BOX);
  1534. nrpnbutton->labelsize(12);
  1535. nrpnbutton->callback((Fl_Callback*)cb_nrpnbutton);
  1536. o->value(master->ctl.NRPN.receive);
  1537. } // Fl_Check_Button* nrpnbutton
  1538. { Fl_Counter* o = npartcounter = new Fl_Counter(5, 312, 50, 18);
  1539. npartcounter->tooltip("The part number");
  1540. npartcounter->type(1);
  1541. npartcounter->labelfont(1);
  1542. npartcounter->minimum(0);
  1543. npartcounter->maximum(127);
  1544. npartcounter->step(1);
  1545. npartcounter->value(1);
  1546. npartcounter->textfont(1);
  1547. npartcounter->callback((Fl_Callback*)cb_npartcounter);
  1548. o->bounds(1,NUM_MIDI_PARTS);
  1549. bankui->init(o);
  1550. } // Fl_Counter* npartcounter
  1551. { Fl_Button* o = new Fl_Button(280, 87, 40, 23, "vK");
  1552. o->tooltip("Virtual Keyboard");
  1553. o->color((Fl_Color)51);
  1554. o->labelfont(1);
  1555. o->callback((Fl_Callback*)cb_vK);
  1556. } // Fl_Button* o
  1557. { Fl_Group* o = new Fl_Group(85, 32, 55, 110);
  1558. o->box(FL_UP_FRAME);
  1559. { Fl_Button* o = new Fl_Button(90, 37, 45, 23, "Reset");
  1560. o->tooltip("Master fine detune reset");
  1561. o->box(FL_THIN_UP_BOX);
  1562. o->labelsize(10);
  1563. o->callback((Fl_Callback*)cb_Reset);
  1564. } // Fl_Button* o
  1565. { WidgetPDial* o = globalfinedetuneslider = new WidgetPDial(90, 68, 45, 45, "Fine Detune");
  1566. globalfinedetuneslider->tooltip("global fine detune");
  1567. globalfinedetuneslider->box(FL_ROUND_UP_BOX);
  1568. globalfinedetuneslider->color(FL_BACKGROUND_COLOR);
  1569. globalfinedetuneslider->selection_color(FL_INACTIVE_COLOR);
  1570. globalfinedetuneslider->labeltype(FL_NORMAL_LABEL);
  1571. globalfinedetuneslider->labelfont(0);
  1572. globalfinedetuneslider->labelsize(9);
  1573. globalfinedetuneslider->labelcolor(FL_FOREGROUND_COLOR);
  1574. globalfinedetuneslider->maximum(127);
  1575. globalfinedetuneslider->step(1);
  1576. globalfinedetuneslider->value(64);
  1577. globalfinedetuneslider->callback((Fl_Callback*)cb_globalfinedetuneslider);
  1578. globalfinedetuneslider->align(Fl_Align(130));
  1579. globalfinedetuneslider->when(FL_WHEN_CHANGED);
  1580. o->value(master->microtonal.Pglobalfinedetune);
  1581. } // WidgetPDial* globalfinedetuneslider
  1582. o->end();
  1583. } // Fl_Group* o
  1584. { Fl_Button* o = new Fl_Button(280, 112, 105, 23, "Panel Window");
  1585. o->tooltip("Panel Window");
  1586. o->color((Fl_Color)51);
  1587. o->labelfont(1);
  1588. o->labelsize(10);
  1589. o->callback((Fl_Callback*)cb_Panel);
  1590. } // Fl_Button* o
  1591. { sm_indicator1 = new Fl_Button(350, 5, 35, 15, "SM");
  1592. sm_indicator1->box(FL_ROUNDED_BOX);
  1593. sm_indicator1->down_box(FL_ROUNDED_BOX);
  1594. sm_indicator1->color(FL_DARK2);
  1595. sm_indicator1->selection_color((Fl_Color)93);
  1596. sm_indicator1->labelfont(3);
  1597. sm_indicator1->labelcolor(FL_DARK3);
  1598. sm_indicator1->deactivate();
  1599. } // Fl_Button* sm_indicator1
  1600. masterwindow->xclass("zynaddsubfx");
  1601. masterwindow->end();
  1602. } // Fl_Double_Window* masterwindow
  1603. { aboutwindow = new Fl_Double_Window(365, 280, "Copyright...");
  1604. aboutwindow->user_data((void*)(this));
  1605. { Fl_Box* o = new Fl_Box(15, 35, 335, 55, "Copyright (c) 2002-2009 Nasca O. PAUL and others. Please read AUTHORS.txt");
  1606. o->labeltype(FL_EMBOSSED_LABEL);
  1607. o->labelsize(15);
  1608. o->align(Fl_Align(192|FL_ALIGN_INSIDE));
  1609. } // Fl_Box* o
  1610. { Fl_Box* o = new Fl_Box(15, 90, 335, 145, "This is free software; you may redistribute it and/or modify it under the ter\
  1611. ms of the \nversion 2 (or any later version) of the GNU General Public License\
  1612. as published by the Free Software Fundation.\n This program comes with\n ABS\
  1613. OLUTELY NO WARRANTY. \n See the version 2 (or any later version) of the \nGNU \
  1614. General Public License for details.");
  1615. o->labelfont(1);
  1616. o->labelsize(11);
  1617. o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  1618. } // Fl_Box* o
  1619. { Fl_Button* o = new Fl_Button(80, 245, 190, 25, "Close this window");
  1620. o->box(FL_THIN_UP_BOX);
  1621. o->labelsize(11);
  1622. o->callback((Fl_Callback*)cb_Close);
  1623. } // Fl_Button* o
  1624. { Fl_Box* o = new Fl_Box(15, 5, 335, 30, "ZynAddSubFX");
  1625. o->labeltype(FL_EMBOSSED_LABEL);
  1626. o->labelfont(1);
  1627. o->labelsize(20);
  1628. o->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE));
  1629. } // Fl_Box* o
  1630. aboutwindow->end();
  1631. } // Fl_Double_Window* aboutwindow
  1632. { syseffsendwindow = new Fl_Double_Window(120, 250, "System Effects Send");
  1633. syseffsendwindow->user_data((void*)(this));
  1634. { Fl_Scroll* o = new Fl_Scroll(0, 45, 120, 170);
  1635. o->box(FL_FLAT_BOX);
  1636. for (int neff1=0;neff1<NUM_SYS_EFX;neff1++) for (int neff2=neff1+1;neff2<NUM_SYS_EFX;neff2++)
  1637. {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);};
  1638. o->end();
  1639. Fl_Group::current()->resizable(o);
  1640. } // Fl_Scroll* o
  1641. { Fl_Button* o = new Fl_Button(25, 220, 80, 25, "Close");
  1642. o->box(FL_THIN_UP_BOX);
  1643. o->callback((Fl_Callback*)cb_Close1);
  1644. } // Fl_Button* o
  1645. { Fl_Box* o = new Fl_Box(5, 5, 110, 35, "Send system effect\'s output to other system effects");
  1646. o->labelsize(10);
  1647. o->align(Fl_Align(192));
  1648. } // Fl_Box* o
  1649. syseffsendwindow->end();
  1650. } // Fl_Double_Window* syseffsendwindow
  1651. { panelwindow = new Fl_Double_Window(630, 635, "ZynAddSubFX Panel");
  1652. panelwindow->user_data((void*)(this));
  1653. { Fl_Scroll* o = new Fl_Scroll(0, 5, 570, 310);
  1654. o->type(1);
  1655. o->box(FL_THIN_UP_BOX);
  1656. { Fl_Pack* o = new Fl_Pack(5, 10, 560, 285);
  1657. o->type(1);
  1658. for (int i=0;i<NUM_MIDI_PARTS/2;i++){panellistitem[i]=new Panellistitem(0,0,70,260,"");panellistitem[i]->init(master,i,bankui);}
  1659. o->end();
  1660. } // Fl_Pack* o
  1661. o->end();
  1662. } // Fl_Scroll* o
  1663. { Fl_Scroll* o = new Fl_Scroll(0, 320, 570, 310);
  1664. o->type(1);
  1665. o->box(FL_THIN_UP_BOX);
  1666. { Fl_Pack* o = new Fl_Pack(5, 325, 560, 285);
  1667. o->type(1);
  1668. 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);}
  1669. o->end();
  1670. } // Fl_Pack* o
  1671. o->end();
  1672. } // Fl_Scroll* o
  1673. { Fl_Button* o = new Fl_Button(575, 605, 50, 25, "Close");
  1674. o->box(FL_THIN_UP_BOX);
  1675. o->labelsize(13);
  1676. o->callback((Fl_Callback*)cb_Close2);
  1677. } // Fl_Button* o
  1678. { Fl_Button* o = new Fl_Button(575, 570, 55, 25, "Refresh");
  1679. o->box(FL_THIN_UP_BOX);
  1680. o->labelsize(13);
  1681. o->callback((Fl_Callback*)cb_Refresh);
  1682. } // Fl_Button* o
  1683. panelwindow->end();
  1684. } // Fl_Double_Window* panelwindow
  1685. { simplemasterwindow = new Fl_Double_Window(600, 335, "ZynAddSubFX");
  1686. simplemasterwindow->callback((Fl_Callback*)cb_simplemasterwindow, (void*)(this));
  1687. { simplemastermenu = new Fl_Menu_Bar(0, 0, 690, 25);
  1688. simplemastermenu->menu(menu_simplemastermenu);
  1689. } // Fl_Menu_Bar* simplemastermenu
  1690. { Fl_Group* o = simplelistitemgroup = new Fl_Group(125, 65, 215, 145);
  1691. simplelistitemgroup->box(FL_UP_FRAME);
  1692. { partname = new Fl_Button(130, 72, 205, 18);
  1693. partname->box(FL_THIN_DOWN_BOX);
  1694. partname->down_box(FL_FLAT_BOX);
  1695. partname->color(FL_LIGHT1);
  1696. partname->labelfont(1);
  1697. partname->labelsize(11);
  1698. partname->callback((Fl_Callback*)cb_partname1);
  1699. partname->align(Fl_Align(192|FL_ALIGN_INSIDE));
  1700. } // Fl_Button* partname
  1701. { Fl_Slider* o = partpanning = new Fl_Slider(185, 95, 145, 15, "Pan");
  1702. partpanning->type(5);
  1703. partpanning->box(FL_NO_BOX);
  1704. partpanning->labelsize(11);
  1705. partpanning->maximum(127);
  1706. partpanning->step(1);
  1707. partpanning->value(64);
  1708. partpanning->callback((Fl_Callback*)cb_partpanning1);
  1709. o->value(master->part[npart]->Ppanning);
  1710. } // Fl_Slider* partpanning
  1711. { Fl_Choice* o = partrcv = new Fl_Choice(140, 157, 65, 18, "Midi Channel Receive");
  1712. partrcv->tooltip("receive from Midi channel");
  1713. partrcv->down_box(FL_BORDER_BOX);
  1714. partrcv->labelsize(10);
  1715. partrcv->textfont(1);
  1716. partrcv->callback((Fl_Callback*)cb_partrcv1);
  1717. partrcv->align(Fl_Align(130));
  1718. 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");};
  1719. o->value(master->part[npart]->Prcvchn);
  1720. } // Fl_Choice* partrcv
  1721. { WidgetPDial* o = partvolume = new WidgetPDial(135, 95, 45, 40);
  1722. partvolume->box(FL_NO_BOX);
  1723. partvolume->color(FL_BACKGROUND_COLOR);
  1724. partvolume->selection_color(FL_INACTIVE_COLOR);
  1725. partvolume->labeltype(FL_NORMAL_LABEL);
  1726. partvolume->labelfont(0);
  1727. partvolume->labelsize(9);
  1728. partvolume->labelcolor(FL_FOREGROUND_COLOR);
  1729. partvolume->maximum(127);
  1730. partvolume->step(1);
  1731. partvolume->callback((Fl_Callback*)cb_partvolume1);
  1732. partvolume->align(Fl_Align(FL_ALIGN_BOTTOM));
  1733. partvolume->when(FL_WHEN_CHANGED);
  1734. o->value(master->part[npart]->Pvolume);
  1735. } // WidgetPDial* partvolume
  1736. { Fl_Box* o = new Fl_Box(130, 130, 55, 20, "Volume");
  1737. o->labelsize(10);
  1738. } // Fl_Box* o
  1739. { Fl_Check_Button* o = simplepartportamento = new Fl_Check_Button(193, 127, 79, 23, "Portamento");
  1740. simplepartportamento->tooltip("Enable/Disable the portamento");
  1741. simplepartportamento->down_box(FL_DOWN_BOX);
  1742. simplepartportamento->labelsize(9);
  1743. simplepartportamento->callback((Fl_Callback*)cb_simplepartportamento);
  1744. o->value(master->part[npart]->ctl.portamento.portamento);
  1745. } // Fl_Check_Button* simplepartportamento
  1746. { Fl_Counter* o = simpleminkcounter = new Fl_Counter(210, 158, 40, 15, "Min.key");
  1747. simpleminkcounter->tooltip("Minimum key (that the part receives NoteOn messages)");
  1748. simpleminkcounter->type(1);
  1749. simpleminkcounter->labelsize(10);
  1750. simpleminkcounter->minimum(0);
  1751. simpleminkcounter->maximum(127);
  1752. simpleminkcounter->step(1);
  1753. simpleminkcounter->textsize(10);
  1754. simpleminkcounter->callback((Fl_Callback*)cb_simpleminkcounter);
  1755. o->value(master->part[npart]->Pminkey);
  1756. } // Fl_Counter* simpleminkcounter
  1757. { Fl_Counter* o = simplemaxkcounter = new Fl_Counter(255, 158, 40, 15, "Max.key");
  1758. simplemaxkcounter->tooltip("Maximum key (that the part receives NoteOn messages)");
  1759. simplemaxkcounter->type(1);
  1760. simplemaxkcounter->labelsize(10);
  1761. simplemaxkcounter->minimum(0);
  1762. simplemaxkcounter->maximum(127);
  1763. simplemaxkcounter->step(1);
  1764. simplemaxkcounter->textsize(10);
  1765. simplemaxkcounter->callback((Fl_Callback*)cb_simplemaxkcounter);
  1766. o->value(master->part[npart]->Pmaxkey);
  1767. } // Fl_Counter* simplemaxkcounter
  1768. { Fl_Button* o = new Fl_Button(230, 188, 15, 12, "m");
  1769. o->tooltip("set the minimum key to the last pressed key");
  1770. o->box(FL_THIN_UP_BOX);
  1771. o->labelsize(10);
  1772. o->callback((Fl_Callback*)cb_m);
  1773. } // Fl_Button* o
  1774. { Fl_Button* o = new Fl_Button(260, 188, 15, 12, "M");
  1775. o->tooltip("set the maximum key to the last pressed key");
  1776. o->box(FL_THIN_UP_BOX);
  1777. o->labelsize(10);
  1778. o->callback((Fl_Callback*)cb_M);
  1779. } // Fl_Button* o
  1780. { Fl_Button* o = new Fl_Button(245, 188, 15, 12, "R");
  1781. o->tooltip("reset the minimum key to 0 and maximum key to 127");
  1782. o->box(FL_THIN_UP_BOX);
  1783. o->labelfont(1);
  1784. o->labelsize(10);
  1785. o->callback((Fl_Callback*)cb_R);
  1786. } // Fl_Button* o
  1787. { Fl_Counter* o = simplepartkeyshiftcounter = new Fl_Counter(280, 120, 50, 20, "KeyShift");
  1788. simplepartkeyshiftcounter->type(1);
  1789. simplepartkeyshiftcounter->labelsize(11);
  1790. simplepartkeyshiftcounter->minimum(-64);
  1791. simplepartkeyshiftcounter->maximum(64);
  1792. simplepartkeyshiftcounter->step(1);
  1793. simplepartkeyshiftcounter->callback((Fl_Callback*)cb_simplepartkeyshiftcounter);
  1794. o->lstep(12);
  1795. o->value(master->part[npart]->Pkeyshift-64);
  1796. } // Fl_Counter* simplepartkeyshiftcounter
  1797. { simplesyseffsend = new WidgetPDial(300, 160, 30, 30);
  1798. simplesyseffsend->box(FL_NO_BOX);
  1799. simplesyseffsend->color(FL_BACKGROUND_COLOR);
  1800. simplesyseffsend->selection_color(FL_INACTIVE_COLOR);
  1801. simplesyseffsend->labeltype(FL_NORMAL_LABEL);
  1802. simplesyseffsend->labelfont(0);
  1803. simplesyseffsend->labelsize(14);
  1804. simplesyseffsend->labelcolor(FL_FOREGROUND_COLOR);
  1805. simplesyseffsend->maximum(127);
  1806. simplesyseffsend->step(1);
  1807. simplesyseffsend->callback((Fl_Callback*)cb_simplesyseffsend);
  1808. simplesyseffsend->align(Fl_Align(FL_ALIGN_BOTTOM));
  1809. simplesyseffsend->when(FL_WHEN_CHANGED);
  1810. } // WidgetPDial* simplesyseffsend
  1811. { Fl_Box* o = new Fl_Box(295, 190, 40, 15, "Effect");
  1812. o->labelsize(10);
  1813. } // Fl_Box* o
  1814. if (master->part[npart]->Penabled==0) o->deactivate();
  1815. simplelistitemgroup->end();
  1816. } // Fl_Group* simplelistitemgroup
  1817. { Fl_Check_Button* o = partenabled = new Fl_Check_Button(250, 40, 85, 20, "Enabled");
  1818. partenabled->down_box(FL_DOWN_BOX);
  1819. partenabled->labeltype(FL_EMBOSSED_LABEL);
  1820. partenabled->labelfont(1);
  1821. partenabled->labelsize(13);
  1822. partenabled->callback((Fl_Callback*)cb_partenabled1);
  1823. partenabled->align(Fl_Align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE));
  1824. //char tmp[10];snprintf(tmp,10,"%d",npart+1);o->copy_label(tmp);
  1825. o->value(master->part[npart]->Penabled);
  1826. } // Fl_Check_Button* partenabled
  1827. { VirKeys* o = virkeys = new VirKeys(5, 215, 590, 80, "Keyboard");
  1828. virkeys->box(FL_BORDER_BOX);
  1829. virkeys->color((Fl_Color)17);
  1830. virkeys->selection_color(FL_BACKGROUND_COLOR);
  1831. virkeys->labeltype(FL_NORMAL_LABEL);
  1832. virkeys->labelfont(0);
  1833. virkeys->labelsize(14);
  1834. virkeys->labelcolor(FL_FOREGROUND_COLOR);
  1835. virkeys->align(Fl_Align(FL_ALIGN_CENTER));
  1836. virkeys->when(FL_WHEN_RELEASE);
  1837. o->init(master);
  1838. } // VirKeys* virkeys
  1839. { Fl_Group* o = new Fl_Group(340, 30, 255, 185);
  1840. { Fl_Tabs* o = new Fl_Tabs(345, 35, 245, 175);
  1841. o->box(FL_UP_FRAME);
  1842. o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE));
  1843. { Fl_Group* o = new Fl_Group(345, 55, 245, 155, "System Effects");
  1844. o->box(FL_UP_FRAME);
  1845. o->labelfont(1);
  1846. o->labelsize(12);
  1847. o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE));
  1848. { Fl_Counter* o = simplesyseffnocounter = new Fl_Counter(350, 75, 80, 20, "Sys.Effect No.");
  1849. simplesyseffnocounter->type(1);
  1850. simplesyseffnocounter->labelfont(1);
  1851. simplesyseffnocounter->labelsize(10);
  1852. simplesyseffnocounter->minimum(0);
  1853. simplesyseffnocounter->maximum(127);
  1854. simplesyseffnocounter->step(1);
  1855. simplesyseffnocounter->value(1);
  1856. simplesyseffnocounter->textfont(1);
  1857. simplesyseffnocounter->callback((Fl_Callback*)cb_simplesyseffnocounter);
  1858. simplesyseffnocounter->align(Fl_Align(FL_ALIGN_TOP));
  1859. o->bounds(1,NUM_SYS_EFX);
  1860. o->value(nsyseff+1);
  1861. } // Fl_Counter* simplesyseffnocounter
  1862. { Fl_Choice* o = simplesysefftype = new Fl_Choice(515, 80, 70, 15, "EffType");
  1863. simplesysefftype->down_box(FL_BORDER_BOX);
  1864. simplesysefftype->labelsize(10);
  1865. simplesysefftype->callback((Fl_Callback*)cb_simplesysefftype);
  1866. simplesysefftype->align(Fl_Align(FL_ALIGN_TOP_LEFT));
  1867. simplesysefftype->menu(menu_simplesysefftype);
  1868. o->value(master->sysefx[nsyseff]->geteffect());
  1869. } // Fl_Choice* simplesysefftype
  1870. { simplesyseffectuigroup = new Fl_Group(350, 95, 235, 95);
  1871. simplesyseffectuigroup->color((Fl_Color)48);
  1872. { SimpleEffUI* o = simplesyseffectui = new SimpleEffUI(350, 95, 234, 95);
  1873. simplesyseffectui->box(FL_NO_BOX);
  1874. simplesyseffectui->color(FL_BACKGROUND_COLOR);
  1875. simplesyseffectui->selection_color(FL_BACKGROUND_COLOR);
  1876. simplesyseffectui->labeltype(FL_NORMAL_LABEL);
  1877. simplesyseffectui->labelfont(0);
  1878. simplesyseffectui->labelsize(14);
  1879. simplesyseffectui->labelcolor(FL_FOREGROUND_COLOR);
  1880. simplesyseffectui->align(Fl_Align(FL_ALIGN_TOP));
  1881. simplesyseffectui->when(FL_WHEN_RELEASE);
  1882. o->init(master->sysefx[nsyseff]);
  1883. simplesyseffectui->end();
  1884. } // SimpleEffUI* simplesyseffectui
  1885. simplesyseffectuigroup->end();
  1886. } // Fl_Group* simplesyseffectuigroup
  1887. { Fl_Button* o = new Fl_Button(435, 75, 75, 20, "Send to...");
  1888. o->box(FL_THIN_UP_BOX);
  1889. o->labelfont(1);
  1890. o->labelsize(11);
  1891. o->callback((Fl_Callback*)cb_Send1);
  1892. } // Fl_Button* o
  1893. { Fl_Button* o = new Fl_Button(560, 65, 25, 15, "P");
  1894. o->box(FL_THIN_UP_BOX);
  1895. o->color((Fl_Color)179);
  1896. o->labelfont(1);
  1897. o->labelsize(11);
  1898. o->labelcolor(FL_BACKGROUND2_COLOR);
  1899. o->callback((Fl_Callback*)cb_P2);
  1900. } // Fl_Button* o
  1901. o->end();
  1902. } // Fl_Group* o
  1903. { Fl_Group* o = new Fl_Group(345, 55, 245, 155, "Insertion Effects");
  1904. o->box(FL_UP_FRAME);
  1905. o->labelfont(1);
  1906. o->labelsize(12);
  1907. o->align(Fl_Align(FL_ALIGN_BOTTOM|FL_ALIGN_INSIDE));
  1908. o->hide();
  1909. { Fl_Counter* o = simpleinseffnocounter = new Fl_Counter(350, 75, 80, 20, "Ins.Effect No.");
  1910. simpleinseffnocounter->type(1);
  1911. simpleinseffnocounter->labelfont(1);
  1912. simpleinseffnocounter->labelsize(10);
  1913. simpleinseffnocounter->minimum(0);
  1914. simpleinseffnocounter->maximum(127);
  1915. simpleinseffnocounter->step(1);
  1916. simpleinseffnocounter->value(1);
  1917. simpleinseffnocounter->textfont(1);
  1918. simpleinseffnocounter->callback((Fl_Callback*)cb_simpleinseffnocounter);
  1919. simpleinseffnocounter->align(Fl_Align(FL_ALIGN_TOP));
  1920. o->bounds(1,NUM_INS_EFX);
  1921. o->value(ninseff+1);
  1922. } // Fl_Counter* simpleinseffnocounter
  1923. { Fl_Choice* o = simpleinsefftype = new Fl_Choice(515, 80, 70, 15, "EffType");
  1924. simpleinsefftype->down_box(FL_BORDER_BOX);
  1925. simpleinsefftype->labelsize(10);
  1926. simpleinsefftype->callback((Fl_Callback*)cb_simpleinsefftype);
  1927. simpleinsefftype->align(Fl_Align(FL_ALIGN_TOP_LEFT));
  1928. simpleinsefftype->menu(menu_simpleinsefftype);
  1929. o->value(master->insefx[ninseff]->geteffect());
  1930. if (master->Pinsparts[ninseff]== -1) o->deactivate();
  1931. } // Fl_Choice* simpleinsefftype
  1932. { simpleinseffectuigroup = new Fl_Group(350, 95, 234, 95);
  1933. simpleinseffectuigroup->box(FL_FLAT_BOX);
  1934. simpleinseffectuigroup->color((Fl_Color)48);
  1935. { SimpleEffUI* o = simpleinseffectui = new SimpleEffUI(350, 95, 234, 95);
  1936. simpleinseffectui->box(FL_NO_BOX);
  1937. simpleinseffectui->color(FL_BACKGROUND_COLOR);
  1938. simpleinseffectui->selection_color(FL_BACKGROUND_COLOR);
  1939. simpleinseffectui->labeltype(FL_NORMAL_LABEL);
  1940. simpleinseffectui->labelfont(0);
  1941. simpleinseffectui->labelsize(14);
  1942. simpleinseffectui->labelcolor(FL_FOREGROUND_COLOR);
  1943. simpleinseffectui->align(Fl_Align(FL_ALIGN_TOP));
  1944. simpleinseffectui->when(FL_WHEN_RELEASE);
  1945. o->init(master->insefx[ninseff]);
  1946. if (master->Pinsparts[ninseff]== -1) o->deactivate();
  1947. simpleinseffectui->end();
  1948. } // SimpleEffUI* simpleinseffectui
  1949. simpleinseffectuigroup->end();
  1950. } // Fl_Group* simpleinseffectuigroup
  1951. { Fl_Choice* o = simpleinseffpart = new Fl_Choice(435, 75, 80, 20, "Insert To.");
  1952. simpleinseffpart->down_box(FL_BORDER_BOX);
  1953. simpleinseffpart->labelfont(1);
  1954. simpleinseffpart->labelsize(10);
  1955. simpleinseffpart->textsize(10);
  1956. simpleinseffpart->callback((Fl_Callback*)cb_simpleinseffpart);
  1957. simpleinseffpart->align(Fl_Align(FL_ALIGN_TOP_LEFT));
  1958. o->add("Master Out");o->add("Off");
  1959. char tmp[50]; for (int i=0;i<NUM_MIDI_PARTS;i++) {sprintf(tmp,"Part %2d",i+1);o->add(tmp);};
  1960. o->value(master->Pinsparts[ninseff]+2);
  1961. } // Fl_Choice* simpleinseffpart
  1962. { Fl_Button* o = new Fl_Button(560, 65, 25, 15, "P");
  1963. o->box(FL_THIN_UP_BOX);
  1964. o->color((Fl_Color)179);
  1965. o->labelfont(1);
  1966. o->labelsize(11);
  1967. o->labelcolor(FL_BACKGROUND2_COLOR);
  1968. o->callback((Fl_Callback*)cb_P3);
  1969. } // Fl_Button* o
  1970. o->end();
  1971. } // Fl_Group* o
  1972. o->end();
  1973. } // Fl_Tabs* o
  1974. o->end();
  1975. } // Fl_Group* o
  1976. { Fl_Group* o = new Fl_Group(5, 300, 590, 30);
  1977. o->box(FL_ENGRAVED_FRAME);
  1978. { VUMeter* o = new VUMeter(5, 300, 590, 30, "VU-Meter");
  1979. o->box(FL_FLAT_BOX);
  1980. o->color((Fl_Color)41);
  1981. o->selection_color((Fl_Color)75);
  1982. o->labeltype(FL_NORMAL_LABEL);
  1983. o->labelfont(0);
  1984. o->labelsize(14);
  1985. o->labelcolor(FL_FOREGROUND_COLOR);
  1986. o->align(Fl_Align(FL_ALIGN_CENTER));
  1987. o->when(FL_WHEN_RELEASE);
  1988. o->init(master,-1);
  1989. } // VUMeter* o
  1990. o->end();
  1991. } // Fl_Group* o
  1992. { WidgetPDial* o = simplemastervolumedial = new WidgetPDial(10, 35, 40, 40, "Master Volume");
  1993. simplemastervolumedial->tooltip("Master Volume");
  1994. simplemastervolumedial->box(FL_ROUND_UP_BOX);
  1995. simplemastervolumedial->color(FL_BACKGROUND_COLOR);
  1996. simplemastervolumedial->selection_color(FL_INACTIVE_COLOR);
  1997. simplemastervolumedial->labeltype(FL_NORMAL_LABEL);
  1998. simplemastervolumedial->labelfont(1);
  1999. simplemastervolumedial->labelsize(11);
  2000. simplemastervolumedial->labelcolor(FL_FOREGROUND_COLOR);
  2001. simplemastervolumedial->maximum(127);
  2002. simplemastervolumedial->step(1);
  2003. simplemastervolumedial->callback((Fl_Callback*)cb_simplemastervolumedial);
  2004. simplemastervolumedial->align(Fl_Align(130));
  2005. simplemastervolumedial->when(FL_WHEN_CHANGED);
  2006. o->value(master->Pvolume);
  2007. } // WidgetPDial* simplemastervolumedial
  2008. { Fl_Counter* o = simplemasterkeyshiftcounter = new Fl_Counter(15, 110, 90, 20, "Master KeyShift");
  2009. simplemasterkeyshiftcounter->labelsize(11);
  2010. simplemasterkeyshiftcounter->minimum(-64);
  2011. simplemasterkeyshiftcounter->maximum(64);
  2012. simplemasterkeyshiftcounter->step(1);
  2013. simplemasterkeyshiftcounter->callback((Fl_Callback*)cb_simplemasterkeyshiftcounter);
  2014. o->lstep(12);
  2015. o->value(master->Pkeyshift-64);
  2016. } // Fl_Counter* simplemasterkeyshiftcounter
  2017. { Fl_Button* o = new Fl_Button(5, 149, 115, 31, "Stop ALL sounds!");
  2018. o->color((Fl_Color)90);
  2019. o->labelfont(1);
  2020. o->labelsize(10);
  2021. o->callback((Fl_Callback*)cb_Stop);
  2022. } // Fl_Button* o
  2023. { Fl_Button* o = new Fl_Button(70, 30, 50, 17, "Reset");
  2024. o->tooltip("Master fine detune reset");
  2025. o->box(FL_THIN_UP_BOX);
  2026. o->labelsize(11);
  2027. o->callback((Fl_Callback*)cb_Reset1);
  2028. o->align(Fl_Align(FL_ALIGN_WRAP));
  2029. } // Fl_Button* o
  2030. { WidgetPDial* o = simpleglobalfinedetuneslider = new WidgetPDial(80, 50, 30, 30, "Fine Detune");
  2031. simpleglobalfinedetuneslider->tooltip("global fine detune");
  2032. simpleglobalfinedetuneslider->box(FL_ROUND_UP_BOX);
  2033. simpleglobalfinedetuneslider->color(FL_BACKGROUND_COLOR);
  2034. simpleglobalfinedetuneslider->selection_color(FL_INACTIVE_COLOR);
  2035. simpleglobalfinedetuneslider->labeltype(FL_NORMAL_LABEL);
  2036. simpleglobalfinedetuneslider->labelfont(0);
  2037. simpleglobalfinedetuneslider->labelsize(11);
  2038. simpleglobalfinedetuneslider->labelcolor(FL_FOREGROUND_COLOR);
  2039. simpleglobalfinedetuneslider->maximum(127);
  2040. simpleglobalfinedetuneslider->step(1);
  2041. simpleglobalfinedetuneslider->value(64);
  2042. simpleglobalfinedetuneslider->callback((Fl_Callback*)cb_simpleglobalfinedetuneslider);
  2043. simpleglobalfinedetuneslider->align(Fl_Align(130));
  2044. simpleglobalfinedetuneslider->when(FL_WHEN_CHANGED);
  2045. o->value(master->microtonal.Pglobalfinedetune);
  2046. } // WidgetPDial* simpleglobalfinedetuneslider
  2047. { Fl_Counter* o = simplenpartcounter = new Fl_Counter(170, 40, 70, 20, "Part");
  2048. simplenpartcounter->tooltip("The part number");
  2049. simplenpartcounter->type(1);
  2050. simplenpartcounter->labelfont(1);
  2051. simplenpartcounter->minimum(0);
  2052. simplenpartcounter->maximum(127);
  2053. simplenpartcounter->step(1);
  2054. simplenpartcounter->value(1);
  2055. simplenpartcounter->textfont(1);
  2056. simplenpartcounter->callback((Fl_Callback*)cb_simplenpartcounter);
  2057. simplenpartcounter->align(Fl_Align(FL_ALIGN_LEFT));
  2058. o->bounds(1,NUM_MIDI_PARTS);
  2059. } // Fl_Counter* simplenpartcounter
  2060. { Fl_Counter* o = new Fl_Counter(5, 190, 55, 20, "Keyb.Oct.");
  2061. o->tooltip("Midi Octave");
  2062. o->type(1);
  2063. o->labelsize(11);
  2064. o->minimum(0);
  2065. o->maximum(5);
  2066. o->step(1);
  2067. o->textfont(1);
  2068. o->textsize(11);
  2069. o->callback((Fl_Callback*)cb_Keyb);
  2070. o->align(Fl_Align(FL_ALIGN_RIGHT));
  2071. o->when(FL_WHEN_RELEASE_ALWAYS);
  2072. o->value(virkeys->midioct);
  2073. } // Fl_Counter* o
  2074. { sm_indicator2 = new Fl_Button(560, 5, 35, 15, "SM");
  2075. sm_indicator2->box(FL_ROUNDED_BOX);
  2076. sm_indicator2->down_box(FL_ROUNDED_BOX);
  2077. sm_indicator2->color(FL_DARK2);
  2078. sm_indicator2->selection_color((Fl_Color)93);
  2079. sm_indicator2->labelfont(3);
  2080. sm_indicator2->labelcolor(FL_DARK3);
  2081. sm_indicator2->deactivate();
  2082. } // Fl_Button* sm_indicator2
  2083. simplemasterwindow->end();
  2084. } // Fl_Double_Window* simplemasterwindow
  2085. { selectuiwindow = new Fl_Double_Window(430, 250, "User Interface mode");
  2086. selectuiwindow->callback((Fl_Callback*)cb_selectuiwindow, (void*)(this));
  2087. { Fl_Box* o = new Fl_Box(5, 5, 425, 40, "Welcome to ZynAddSubFX");
  2088. o->labeltype(FL_SHADOW_LABEL);
  2089. o->labelfont(1);
  2090. o->labelsize(26);
  2091. } // Fl_Box* o
  2092. { Fl_Box* o = new Fl_Box(10, 50, 265, 25, "Please choose the interface mode:");
  2093. o->labelfont(1);
  2094. o->labelsize(13);
  2095. } // Fl_Box* o
  2096. { Fl_Button* o = new Fl_Button(10, 165, 100, 35, "Advanced");
  2097. o->color((Fl_Color)229);
  2098. o->labelfont(1);
  2099. o->labelsize(16);
  2100. o->callback((Fl_Callback*)cb_Advanced);
  2101. } // Fl_Button* o
  2102. { Fl_Box* o = new Fl_Box(110, 165, 310, 35, ".. if you have used ZynAddSubFX before, or you like to have full controll to \
  2103. all parameters.");
  2104. o->labelfont(1);
  2105. o->labelsize(11);
  2106. o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  2107. } // Fl_Box* o
  2108. { Fl_Button* o = new Fl_Button(10, 80, 100, 65, "Beginner");
  2109. o->color((Fl_Color)238);
  2110. o->labelfont(1);
  2111. o->labelsize(16);
  2112. o->callback((Fl_Callback*)cb_Beginner);
  2113. } // Fl_Button* o
  2114. { Fl_Box* o = new Fl_Box(110, 75, 320, 75, "..if you are a beginner, you prefer using presets or you prefer to use simple\
  2115. r user interfaces. Most functionality of ZynAddSubFX will be hidden in this mo\
  2116. de to make simple the learning/using it.");
  2117. o->labelfont(1);
  2118. o->labelsize(11);
  2119. o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  2120. } // Fl_Box* o
  2121. { Fl_Box* o = new Fl_Box(30, 215, 360, 25, "You can switch the interface modes anytime you want.");
  2122. o->box(FL_BORDER_BOX);
  2123. o->color((Fl_Color)51);
  2124. o->labelfont(1);
  2125. o->labelsize(11);
  2126. o->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE));
  2127. } // Fl_Box* o
  2128. selectuiwindow->set_non_modal();
  2129. selectuiwindow->end();
  2130. } // Fl_Double_Window* selectuiwindow
  2131. return selectuiwindow;
  2132. }
  2133. void MasterUI::updatesendwindow() {
  2134. for (int neff1=0;neff1<NUM_SYS_EFX;neff1++)
  2135. for (int neff2=neff1+1;neff2<NUM_SYS_EFX;neff2++)
  2136. syseffsend[neff1][neff2]->value(master->Psysefxsend[neff1][neff2]);
  2137. }
  2138. void MasterUI::updatepanel() {
  2139. for (int npart=0;npart<NUM_MIDI_PARTS;npart++){
  2140. panellistitem[npart]->refresh();
  2141. };
  2142. }
  2143. void MasterUI::setfilelabel(const char *filename) {
  2144. if (filename!=NULL) snprintf(&masterwindowlabel[0],100,"%s - ZynAddSubFX",fl_filename_name(filename));
  2145. else snprintf(&masterwindowlabel[0],100,"%s","ZynAddSubFX");
  2146. masterwindowlabel[99]='\0';
  2147. masterwindow->label(&masterwindowlabel[0]);
  2148. simplemasterwindow->label(&masterwindowlabel[0]);
  2149. }
  2150. MasterUI::MasterUI(Master *master_,int *exitprogram_) {
  2151. master=master_;
  2152. exitprogram=exitprogram_;
  2153. ninseff=0;
  2154. nsyseff=0;
  2155. npart=0;
  2156. for (int i=0;i<NUM_SYS_EFX;i++)
  2157. for (int j=0;j<NUM_SYS_EFX;j++)
  2158. syseffsend[i][j]=NULL;
  2159. microtonalui=new MicrotonalUI(&master->microtonal);
  2160. virkeyboard=new VirKeyboard(master);
  2161. bankui=new BankUI(master,&npart);
  2162. configui=new ConfigUI();
  2163. make_window();
  2164. presetsui=new PresetsUI();
  2165. setfilelabel(NULL);
  2166. swapefftype=0;
  2167. simplerefresh();
  2168. }
  2169. MasterUI::~MasterUI() {
  2170. masterwindow->hide();
  2171. delete masterwindow;
  2172. simplemasterwindow->hide();
  2173. delete simplemasterwindow;
  2174. aboutwindow->hide();
  2175. delete aboutwindow;
  2176. syseffsendwindow->hide();
  2177. delete syseffsendwindow;
  2178. delete virkeyboard;
  2179. delete microtonalui;
  2180. delete bankui;
  2181. delete configui;
  2182. delete presetsui;
  2183. delete panelwindow;
  2184. delete selectuiwindow;
  2185. }
  2186. void MasterUI::showUI() {
  2187. switch (config.cfg.UserInterfaceMode){
  2188. case 0:selectuiwindow->show();
  2189. break;
  2190. case 1:masterwindow->show();
  2191. break;
  2192. case 2:simplemasterwindow->show();
  2193. break;
  2194. };
  2195. }
  2196. void MasterUI::simplerefresh() {
  2197. partenabled->value(master->part[npart]->Penabled);
  2198. if (master->part[npart]->Penabled!=0) simplelistitemgroup->activate();
  2199. else simplelistitemgroup->deactivate();
  2200. partvolume->value(master->part[npart]->Pvolume);
  2201. partpanning->value(master->part[npart]->Ppanning);
  2202. partrcv->value(master->part[npart]->Prcvchn);
  2203. if (master->part[npart]->Pname[0]!=0) partname->label((char *)master->part[npart]->Pname);
  2204. else partname->label("Click here to load a instrument");
  2205. simplelistitemgroup->redraw();
  2206. simplepartportamento->value(master->part[npart]->ctl.portamento.portamento);
  2207. simpleminkcounter->value(master->part[npart]->Pminkey);
  2208. simplemaxkcounter->value(master->part[npart]->Pmaxkey);
  2209. simplepartkeyshiftcounter->value(master->part[npart]->Pkeyshift-64);
  2210. simplesyseffsend->value(master->Psysefxvol[nsyseff][npart]);
  2211. }
  2212. void MasterUI::do_new_master_unconditional() {
  2213. delete microtonalui;
  2214. pthread_mutex_lock(&master->mutex);
  2215. master->defaults();
  2216. pthread_mutex_unlock(&master->mutex);
  2217. npartcounter->value(1);
  2218. refresh_master_ui();
  2219. updatepanel();
  2220. }
  2221. void MasterUI::do_new_master() {
  2222. if (fl_choice("Clear *ALL* the parameters ?","No","Yes",NULL)){
  2223. do_new_master_unconditional();
  2224. }
  2225. }
  2226. int MasterUI::do_load_master_unconditional(const char *filename, const char *display_name) {
  2227. pthread_mutex_lock(&master->mutex);
  2228. //clear all parameters
  2229. master->defaults();
  2230. //load the data
  2231. int result=master->loadXML(filename);
  2232. master->applyparameters(false);
  2233. pthread_mutex_unlock(&master->mutex);
  2234. npartcounter->value(1);
  2235. refresh_master_ui();
  2236. updatepanel();
  2237. if (result>=0) setfilelabel(display_name);
  2238. return result;
  2239. }
  2240. void MasterUI::do_load_master(const char* file ) {
  2241. const char *filename;
  2242. if (file == NULL) {
  2243. filename=fl_file_chooser("Open:","({*.xmz})",NULL,0);
  2244. if (filename==NULL) return;
  2245. }
  2246. else {
  2247. filename = file;
  2248. }
  2249. int result = do_load_master_unconditional( filename, filename );
  2250. if (result==-10) fl_alert("Error: Could not load the file\nbecause it is not a zynaddsubfx parameters file.");
  2251. else if (result<0) fl_alert("Error: Could not load the file.");
  2252. }
  2253. void MasterUI::do_save_master(const char* file ) {
  2254. const char *filename;
  2255. char *tmp;
  2256. int result=0;
  2257. if (file == NULL) {
  2258. tmp=fl_file_chooser("Save:","({*.xmz})",NULL,0);
  2259. if (tmp==NULL) return;
  2260. tmp=fl_filename_setext(tmp,".xmz");
  2261. filename=tmp;
  2262. result=fileexists(tmp);
  2263. if (result) {
  2264. result=0;
  2265. if (!fl_choice("The file exists. Overwrite it?","No","Yes",NULL)) return;
  2266. }
  2267. }
  2268. else {
  2269. filename = file;
  2270. }
  2271. pthread_mutex_lock(&master->mutex);
  2272. result=master->saveXML(filename);
  2273. pthread_mutex_unlock(&master->mutex);
  2274. if (result<0) fl_alert("Error: Could not save the file.");
  2275. else
  2276. {
  2277. #if USE_NSM
  2278. if ( nsm && nsm->is_active() )
  2279. setfilelabel( nsm->display_name );
  2280. else
  2281. #endif
  2282. setfilelabel(filename);
  2283. }
  2284. updatepanel();
  2285. }
  2286. void MasterUI::refresh_master_ui() {
  2287. ninseff=0;
  2288. nsyseff=0;
  2289. npart=0;
  2290. //the Master UI
  2291. npartcounter->do_callback();
  2292. syseffnocounter->do_callback();
  2293. inseffnocounter->do_callback();
  2294. masterkeyshiftcounter->value(master->Pkeyshift-64);
  2295. mastervolumedial->value(master->Pvolume);
  2296. globalfinedetuneslider->value(master->microtonal.Pglobalfinedetune);
  2297. microtonalui=new MicrotonalUI(&master->microtonal);
  2298. nrpnbutton->value(master->ctl.NRPN.receive);
  2299. updatesendwindow();
  2300. updatepanel();
  2301. //the simle MasterUI
  2302. simplenpartcounter->value(1);
  2303. simplesyseffnocounter->value(1);
  2304. simpleinseffnocounter->value(1);
  2305. simplenpartcounter->do_callback();
  2306. simplesyseffnocounter->do_callback();
  2307. simpleinseffnocounter->do_callback();
  2308. simplemasterkeyshiftcounter->value(master->Pkeyshift-64);
  2309. simplemastervolumedial->value(master->Pvolume);
  2310. simpleglobalfinedetuneslider->value(master->microtonal.Pglobalfinedetune);
  2311. virkeys->midich=master->part[npart]->Prcvchn;
  2312. simplerefresh();
  2313. bankui->hide();
  2314. }