| @@ -220,6 +220,7 @@ void bankList(Bank &bank, Fl_Osc_Interface *osc) | |||
| if(!rtosc_message(response, 2048, "/bank-list", "iss", | |||
| i++, elm.name.c_str(), elm.dir.c_str())) | |||
| errx(1, "Failure to handle bank update properly..."); | |||
| if (osc) | |||
| osc->tryLink(response); | |||
| } | |||
| } | |||
| @@ -647,8 +648,25 @@ public: | |||
| //Give it to the backend and wait for the old part to return for | |||
| //deallocation | |||
| uToB->write("/load-part", "ib", npart, sizeof(Part*), &p); | |||
| if(osc) | |||
| osc->damage(("/part"+to_s(npart)+"/").c_str()); | |||
| GUI::raiseUi(ui, "/damage", "s", ("/part"+to_s(npart)+"/").c_str()); | |||
| } | |||
| //Load a new cleared Part instance | |||
| void loadClearPart(int npart) | |||
| { | |||
| if(npart == -1) | |||
| return; | |||
| Part *p = new Part(*master->memory, synth, &master->microtonal, master->fft); | |||
| p->applyparameters(); | |||
| obj_store.extractPart(p, npart); | |||
| kits.extractPart(p, npart); | |||
| //Give it to the backend and wait for the old part to return for | |||
| //deallocation | |||
| uToB->write("/load-part", "ib", npart, sizeof(Part*), &p); | |||
| GUI::raiseUi(ui, "/damage", "s", ("/part"+to_s(npart)+"/").c_str()); | |||
| //if(osc) | |||
| // osc->damage(("/part"+to_s(npart)+"/").c_str()); | |||
| } | |||
| //Well, you don't get much crazier than changing out all of your RT | |||
| @@ -826,8 +844,10 @@ MiddleWareImpl::MiddleWareImpl(MiddleWare *mw, SYNTH_T synth_, int prefered_port | |||
| lo_server_add_method(server, NULL, NULL, handler_function, mw); | |||
| fprintf(stderr, "lo server running on %d\n", lo_server_get_port(server)); | |||
| //clean_up_tmp_nams(); | |||
| //create_tmp_file((unsigned)lo_server_get_port(server)); | |||
| #ifndef CARLA_VERSION_STRING | |||
| clean_up_tmp_nams(); | |||
| create_tmp_file((unsigned)lo_server_get_port(server)); | |||
| #endif | |||
| //dummy callback for starters | |||
| cb = [](void*, const char*){}; | |||
| @@ -1122,6 +1142,8 @@ void MiddleWareImpl::handleMsg(const char *msg) | |||
| //printf("watching '%s' go by\n", msg); | |||
| //Get the object resource locator | |||
| string obj_rl(msg, last_path+1); | |||
| int npart = -1; | |||
| char testchr = 0; | |||
| if(!strcmp(msg, "/refresh_bank") && !strcmp(rtosc_argument_string(msg), "i")) { | |||
| refreshBankView(master->bank, rtosc_argument(msg,0).i, osc); | |||
| @@ -1180,6 +1202,8 @@ void MiddleWareImpl::handleMsg(const char *msg) | |||
| } else if(strstr(msg, "Padenabled") || strstr(msg, "Ppadenabled") || strstr(msg, "Psubenabled")) { | |||
| kitEnable(msg); | |||
| uToB->raw_write(msg); | |||
| } else if(sscanf(msg, "/part%d/clea%c", &npart, &testchr) == 2 && testchr == 'r') { | |||
| loadClearPart(npart); | |||
| } else if(!strcmp(msg, "/undo")) { | |||
| undo.seekHistory(-1); | |||
| } else if(!strcmp(msg, "/redo")) { | |||
| @@ -57,6 +57,9 @@ static const Ports partPorts = { | |||
| #define rChangeCb obj->setPvolume(obj->Pvolume); | |||
| rParamZyn(Pvolume, "Part Volume"), | |||
| #undef rChangeCb | |||
| #define rChangeCb obj->setPpanning(obj->Ppanning); | |||
| rParamZyn(Ppanning, "Set Panning"), | |||
| #undef rChangeCb | |||
| #define rChangeCb obj->setkeylimit(obj->Pkeylimit); | |||
| rParamI(Pkeylimit, rProp(parameter), rMap(min,0), rMap(max, POLYPHONY), "Key limit per part"), | |||
| #undef rChangeCb | |||
| @@ -65,7 +68,6 @@ static const Ports partPorts = { | |||
| rParamZyn(Pmaxkey, "Max Used Key"), | |||
| rParamZyn(Pkeyshift, "Part keyshift"), | |||
| rParamZyn(Prcvchn, "Active MIDI channel"), | |||
| rParamZyn(Ppanning, "Set Panning"), | |||
| rParamZyn(Pvelsns, "Velocity sensing"), | |||
| rParamZyn(Pveloffs, "Velocity offset"), | |||
| rToggle(Pnoteon, "If the channel accepts note on events"), | |||
| @@ -106,6 +108,20 @@ static const Ports partPorts = { | |||
| p->Ppolymode = 0; | |||
| p->Plegatomode = 1; | |||
| }}}, | |||
| {"clear:", rProp(internal) rDoc("Reset Part To Defaults"), 0, [](const char *, RtData &d) | |||
| { | |||
| //XXX todo forward this event for middleware to handle | |||
| //Part *p = (Part*)d.obj; | |||
| //p->defaults(); | |||
| //char part_loc[128]; | |||
| //strcpy(part_loc, d.loc); | |||
| //char *end = strrchr(part_loc, '/'); | |||
| //if(end) | |||
| // end[1] = 0; | |||
| //d.broadcast("/damage", "s", part_loc); | |||
| }}, | |||
| //{"kit#16::T:F", "::Enables or disables kit item", 0, | |||
| // [](const char *m, RtData &d) { | |||
| @@ -615,7 +631,7 @@ void Part::NoteOn(unsigned char note, | |||
| // Spawn another note (but silent) if legatomodevalid==true | |||
| if(legatomodevalid) { | |||
| auto ¬e2 = partnote[pos].kititem[ci]; | |||
| auto ¬e2 = partnote[posb].kititem[ci]; | |||
| note2.sendtoparteffect = limit((int)kit[item].Psendtoparteffect, 0, NUM_PART_EFX); | |||
| pars.quiet = true; | |||
| @@ -186,8 +186,17 @@ void GUI::raiseUi(ui_handle_t gui, const char *message) | |||
| if(!gui) | |||
| return; | |||
| MasterUI *mui = (MasterUI*)gui; | |||
| if(string("/damage") == message && rtosc_type(message, 0) == 's') | |||
| if(string("/damage") == message && rtosc_type(message, 0) == 's') { | |||
| string damage_str = rtosc_argument(message,0).s; | |||
| int npart = -1; | |||
| if(sscanf(damage_str.c_str(), "/part%d", &npart) == 1 && damage_str.size() < 10) { | |||
| if(mui->npartcounter->value()-1 == npart) { | |||
| mui->partui->showparameters(0,-1); | |||
| mui->npartcounter->do_callback(); | |||
| } | |||
| } | |||
| mui->osc->damage(rtosc_argument(message,0).s); | |||
| } | |||
| mui->osc->tryLink(message); | |||
| //printf("got message for UI '%s'\n", message); | |||
| char buffer[1024]; | |||
| @@ -21,6 +21,8 @@ class PADnoteOvertonePosition: public Fl_Box, Fl_Osc_Widget | |||
| ~PADnoteOvertonePosition(void) | |||
| { | |||
| osc->removeLink("/oscilsize", | |||
| (Fl_Osc_Widget*) this); | |||
| osc->removeLink(base_path + "oscilgen/spectrum", | |||
| (Fl_Osc_Widget*) this); | |||
| osc->removeLink(base_path + "nhr", | |||
| @@ -9,4 +9,5 @@ void PartNameButton::OSC_value(const char *label_) | |||
| { | |||
| the_string = label_; | |||
| label(the_string.c_str()); | |||
| redraw(); | |||
| } | |||
| @@ -279,10 +279,9 @@ class PartUI {open : {public Fl_Osc_Group} | |||
| label {Grand Piano} | |||
| callback {int event=Fl::event_button(); | |||
| if (event==FL_RIGHT_MOUSE){ | |||
| fprintf(stderr, "Unimplemented...\\n"); | |||
| const char *tmp=fl_input("Instrument name:",o->label()); | |||
| o->oscWrite("Pname", "s", tmp); | |||
| /*if (tmp!=NULL) snprintf((char *)part->Pname,PART_MAX_NAME_LEN,"%s",tmp);*/ | |||
| if (tmp!=NULL) | |||
| o->oscWrite("Pname", "s", tmp); | |||
| } else { | |||
| if (event==FL_LEFT_MOUSE) bankui->show(); | |||
| else instrumenteditwindow->show(); | |||