void oedge_perform64(t_oedge *x, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long vectorsize, long flags, void *userparam) { omax_realtime_clock_tick(x); t_osc_timetag now; omax_realtime_clock_now(&now); atom_setlong(x->av + 1, x->blockcount++); atom_setlong(x->av + 2, osc_timetag_ntp_getSeconds(now));//(((uint64_t)now) & 0xffffffff00000000) >> 32); atom_setlong(x->av + 3, osc_timetag_ntp_getFraction(now));//(((uint64_t)now) & 0xffffffff)); atom_setdouble_array(x->ac, x->av + 4, vectorsize, ins[0]); schedule_delay(x, (method)oedge_callback, 0, NULL, vectorsize + 4, x->av); }
static void dns_handle_remote() { struct sockaddr *src_addr = malloc(sizeof(struct sockaddr)); socklen_t src_len = sizeof(struct sockaddr); uint16_t query_id; ssize_t len; const char *question_hostname; int r; ns_msg msg; len = recvfrom(remote_sock, global_buf, BUF_SIZE, 0, src_addr, &src_len); if (len > 0) { if (ns_initparse((const u_char *)global_buf, len, &msg) < 0) { ERR("ns_initparse"); free(src_addr); return; } // parse DNS query id query_id = ns_msg_id(msg); question_hostname = hostname_from_question(msg); if (question_hostname) { LOG("response %s from %s:%d - ", question_hostname, inet_ntoa(((struct sockaddr_in *)src_addr)->sin_addr), htons(((struct sockaddr_in *)src_addr)->sin_port)); } id_addr_t *id_addr = queue_lookup(query_id); if (id_addr) { id_addr->addr->sa_family = AF_INET; uint16_t ns_old_id = htons(id_addr->old_id); memcpy(global_buf, &ns_old_id, 2); r = should_filter_query(msg, ((struct sockaddr_in *)src_addr)->sin_addr); if (r == 0) { if (verbose) printf("pass\n"); if (-1 == sendto(local_sock, global_buf, len, 0, id_addr->addr, id_addr->addrlen)) ERR("sendto"); } else if (r == -1) { schedule_delay(query_id, global_buf, len, id_addr->addr, id_addr->addrlen); if (verbose) printf("delay\n"); } else { if (verbose) printf("filter\n"); } } else { if (verbose) printf("skip\n"); } free(src_addr); } else ERR("recvfrom"); }
// This will be called when the object receives a message in either inlet void ppn_anything(t_ppn *x, t_symbol *msg, short argc, t_atom *argv) { switch(proxy_getinlet((t_object *)x)) { case 0: // left inlet: create a temp array and set the state as the first element, then // copy the contents of argv into the array and schedule it for delay. schedule_delay((t_object *)x, (method)ppn_callback, x->delay_time_ms, msg, argc, argv); break; case 1: // right inlet: we don't understand, so just return break; } }
// This function will be called when the object receives a bang in either inlet void ppn_bang(t_ppn *x) { // Call proxy_getinlet() to find out which inlet the message was received in switch(proxy_getinlet((t_object *)x)) { case 0: // left inlet: schedule a bang for execution later. { schedule_delay((t_object *)x, (method)ppn_callback, x->delay_time_ms, _sym_bang, 0, NULL); } break; case 1: // right inlet: doesn't understand bang, so do nothing break; } }
t_int *oedge_perform(t_int *w) { t_oedge *x = (t_oedge *)(w[1]); t_float *in = (t_float *)(w[2]); t_int n = (t_float *)(w[3]); omax_realtime_clock_tick(x); t_osc_timetag now; omax_realtime_clock_now(&now); atom_setlong(x->av + 1, x->blockcount++); atom_setlong(x->av + 2, osc_timetag_ntp_getSeconds(now));//(((uint64_t)now) & 0xffffffff00000000) >> 32); atom_setlong(x->av + 3, osc_timetag_ntp_getFraction(now));//(((uint64_t)now) & 0xffffffff)); atom_setdouble_array(x->ac, x->av + 4, n, in); schedule_delay(x, (method)oedge_callback, 0, NULL, n + 4, x->av); return w + 4; }