/* queue a note-off event by patch id */ void mixer_note_off_with_id(int id, int note) { writer->type = MIXER_NOTEOFF_WITH_ID; writer->ticks = jack_last_frame_time(jc); writer->id_note.id = id; writer->id_note.note = note; advance_writer(); }
/* queue a note-off event */ void mixer_note_off(int chan, int note) { writer->type = MIXER_NOTEOFF; writer->ticks = jack_last_frame_time(jc); writer->note.chan = chan; writer->note.note = note; advance_writer(); }
void add_message(message *msg) { msg->deadline = get_deadline(deadline); pthread_mutex_lock(&write_lock); assert(input_ring[write_ipos] == 0); input_ring[write_ipos] = msg; advance_writer(); pthread_mutex_unlock(&write_lock); }
/* queue control change event */ void mixer_control(int chan, int param, float value) { writer->type = MIXER_CONTROL; writer->ticks = jack_last_frame_time(jc); writer->control.chan = chan; writer->control.param = param; writer->control.value = value; advance_writer(); }
/* queue a note-on event by patch id */ void mixer_note_on_with_id(int id, int note, float vel) { writer->type = MIXER_NOTEON_WITH_ID; writer->ticks = jack_last_frame_time(jc); writer->id_note.id = id; writer->id_note.note = note; writer->id_note.vel = vel; advance_writer(); }
/* queue a note-on event */ void mixer_note_on(int chan, int note, float vel) { writer->type = MIXER_NOTEON; writer->ticks = jack_last_frame_time(jc); writer->note.chan = chan; writer->note.note = note; writer->note.vel = vel; advance_writer(); }
void * read_messages(){ int addr_len, numbytes; int status; char buf[BUFFER_LEN]; struct msg *last_message; struct sockaddr_in server_address; struct sockaddr_in client_addr; int sockfd; /* Inicializacion de servidor */ server_address.sin_family = AF_INET; server_address.sin_port = htons(listen_port); server_address.sin_addr.s_addr = INADDR_ANY; bzero(&(server_address.sin_zero), 8); /* Socket */ sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd == -1) { perror("socket"); exit(1); } /* bind */ status = bind(sockfd ,(struct sockaddr *)&server_address ,sizeof(struct sockaddr)); if (status == -1) { perror("bind"); exit(2); } addr_len = sizeof(struct sockaddr); /* Ciclo indefinido de lectura de socket y escritura en buffer */ while(1) { numbytes = recvfrom(sockfd, buf, BUFFER_LEN, 0, (struct sockaddr *)&client_addr, (socklen_t *)&addr_len); if ( numbytes == -1 ) { perror("recvfrom"); exit(3); } buf[numbytes] = '\0'; /* Obtener posicion de escritura para el buffer circular */ last_message = (struct msg*) get_writer(cb); /* Modificar en memoria */ last_message->in_out = buf[0]; last_message->car_id = atoi(&buf[1]); /* Copiar direccion del cliente que envia */ memcpy(&last_message->client,&client_addr,sizeof(struct sockaddr_in)); advance_writer(&cb); } }