void JVlibForm::getActivePatchNames() { // get just the associated Part Patch names to match the Part_common headers int err; int Stop=0; unsigned char buf[8]; char name_size[] = { 0x0,0x0,0x0,0x0C }; memset(buf,0,sizeof(buf)); buf[0] = 0x2; buf[7] = 0xC; // just enough space for the name, ignore the rest of patch common for now. // open the selected midi port if (open_ports() == EXIT_FAILURE) return; for (int x=0;x<16;x++) { // get patch common usleep(200000); buf[1] = x; // Patch number RetryC: if (sysex_request(buf) == EXIT_FAILURE) { close_ports(); return; } err = sysex_get((unsigned char *)&active_area->active_perf_patch[x].patch_common.name[0], (char *)name_size); if (err == EXIT_FAILURE) { close_ports(); return; } if (err==2 && Stop<MAX_RETRIES) { Stop++; sleep(1*Stop); goto RetryC; } if (err==3 && Stop<MAX_RETRIES) { Stop++; sleep(1*Stop); goto RetryC; } if (err != EXIT_SUCCESS) { close_ports(); return; } Stop=0; } close_ports(); } // end getActivePatchNames
static int init_server(t_srv_data *srv_data, uint16_t ports[], size_t ports_nb, size_t slots_nb) { srv_data->sockets_nb = ports_nb + slots_nb; srv_data->ports_nb = ports_nb; srv_data->slots_nb = slots_nb; srv_data->connections_nb = 0; if (!(srv_data->sockets = malloc(srv_data->sockets_nb * sizeof(t_srv_socket)))) return (print_err("t_tcp_server.run()", strerror(ENOMEM))); memset(srv_data->sockets, 0, srv_data->sockets_nb * sizeof(t_srv_socket)); return (open_ports(srv_data, ports, ports_nb)); }
/** * @brief Configuration of the null sink parameters. * @param ctx Application context to configure. */ static void configureNullSink(AppOMXContext* ctx) { log_printer("Null Sink configuration...") ; { // Open camera ports (default input, preview and video outputs) const unsigned char PORTS_COUNT = 1 ; enum OMX_PORT_NUMBER ports[] = {PORT_NULLSINK_INPUT} ; const char* portsNames[] = {"null sink input"} ; open_ports(ports, portsNames, PORTS_COUNT, ctx -> getNullSink(ctx)) ; } // Null sink input port definition is done automatically upon tunneling }
/** * @brief Configuration of the encoder parameters. * @param ctx Application context to configure. */ static void configureEncoder(AppOMXContext* ctx) { log_printer("Encoder configuration...") ; { // Open camera ports (default input, preview and video outputs) const unsigned char PORTS_COUNT = 2 ; enum OMX_PORT_NUMBER ports[] = {PORT_ENCODER_INPUT, PORT_ENCODER_OUTPUT} ; const char* portsNames[] = {"encoder input", "encoder output"} ; open_ports(ports, portsNames, PORTS_COUNT, ctx -> getEncoder(ctx)) ; } ctx -> configureEncoder(ctx) ; }
/** * @brief Configuration of the camera parameters. * @param ctx Application context to configure. */ static void configureCamera(AppOMXContext* ctx) { log_printer("Camera configuration...") ; { // Open camera ports (default input, preview and video outputs) const unsigned char PORTS_COUNT = 3 ; enum OMX_PORT_NUMBER ports[] = {PORT_CAMERA_INPUT, PORT_CAMERA_PREVIEW, PORT_CAMERA_VIDEO} ; const char* portsNames[] = {"camera input", "camera preview", "camera video"} ; open_ports(ports, portsNames, PORTS_COUNT, ctx -> getCamera(ctx)) ; } ctx -> configureCamera(ctx) ; }
void JVlibForm::getActivePerfCommon() { // download from the synth: Performance Common, Part Common (15 total) // called from on_PerfSync_button_clicked when Performance Sync button is clicked. int err; int Stop=0; unsigned char buf[8]; char active_perf_common[]={ 0x1,0x0,0x0,0x0 }; char perf_common_size[] = { 0x0,0x0,0x0,0x40 }; char perf_part_size[] = { 0x0,0x0,0x0,0x13 }; char name_size[] = { 0x0,0x0,0x0,0x0C }; // get active_area perf_common memset(buf,0,sizeof(buf)); memcpy(buf+0,active_perf_common,4); memcpy(buf+4,perf_common_size,4); // open the selected midi port if (open_ports() == EXIT_FAILURE) return; QProgressDialog progress("Getting Performance data...", "Abort Download", 0, 32, this); progress.setWindowModality(Qt::WindowModal); progress.setMinimumDuration(0); progress.setValue(0); RetryA: if (sysex_request(buf) == EXIT_FAILURE) { close_ports(); return; } err = sysex_get((unsigned char *)&active_area->active_performance.perf_common.name[0], (char *)perf_common_size); if (err == EXIT_FAILURE) { close_ports(); return; } if (err==2 && Stop<MAX_RETRIES) { if (debug) puts("Retrying"); Stop++; sleep(1*Stop); goto RetryA; } if (err==3 && Stop<MAX_RETRIES) { if (debug) puts("Retrying"); Stop++; sleep(1*Stop); goto RetryA; } if (err != EXIT_SUCCESS) { close_ports(); return; } // get Performance Part_common headers for 16 parts memcpy(buf+4,perf_part_size,4); for (int x=0;x<16;x++) { progress.setValue(x); if (progress.wasCanceled()) goto breakout; printf("part %d\n",x+1); usleep(200000); buf[2] = 0x10+x; RetryB: if (sysex_request(buf) == EXIT_FAILURE) { close_ports(); return; } err = sysex_get((unsigned char *)&active_area->active_performance.perf_part[x].MIDI_receive, (char *)perf_part_size); if (err == EXIT_FAILURE) { close_ports(); return; } if (err==2 && Stop<MAX_RETRIES) { Stop++; sleep(1*Stop); goto RetryB; } if (err==3 && Stop<MAX_RETRIES) { Stop++; sleep(1*Stop); goto RetryB; } if (err != EXIT_SUCCESS) { close_ports(); return; } Stop=0; } // end FOR // get just the associated Part Patch names to match the Part_common headers memset(buf,0,sizeof(buf)); buf[0] = 0x2; buf[7] = 0xC; // just enough space for the name, ignore the rest of patch common for now. for (int x=0;x<16;x++) { // get patch common progress.setValue(x+16); if (progress.wasCanceled()) goto breakout; printf("patch name %d\n",x+1); usleep(200000); buf[1] = x; // Patch number RetryC: if (sysex_request(buf) == EXIT_FAILURE) { close_ports(); return; } err = sysex_get((unsigned char *)&active_area->active_perf_patch[x].patch_common.name[0], (char *)name_size); if (err == EXIT_FAILURE) { close_ports(); return; } if (err==2 && Stop<MAX_RETRIES) { Stop++; sleep(1*Stop); goto RetryC; } if (err==3 && Stop<MAX_RETRIES) { Stop++; sleep(1*Stop); goto RetryC; } if (err != EXIT_SUCCESS) { close_ports(); return; } Stop=0; } breakout: close_ports(); progress.setValue(32); progress.reset(); EnableParts(true); } // end getActivePerfCommon