Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5706
Modified Files: Tag: desiredata s_midi.c Log Message: cleanup
Index: s_midi.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_midi.c,v retrieving revision 1.4.4.1.2.12.2.10 retrieving revision 1.4.4.1.2.12.2.11 diff -C2 -d -r1.4.4.1.2.12.2.10 -r1.4.4.1.2.12.2.11 *** s_midi.c 10 Jul 2007 06:20:48 -0000 1.4.4.1.2.12.2.10 --- s_midi.c 10 Jul 2007 07:03:34 -0000 1.4.4.1.2.12.2.11 *************** *** 47,54 **** int sys_midiapi = API_DEFAULT;
! /* this is our current estimate for at what "system" real time the ! current logical time's output should occur. */ static double sys_dactimeminusrealtime; ! /* same for input, should be schduler advance earlier. */ static double sys_adctimeminusrealtime;
--- 47,54 ---- int sys_midiapi = API_DEFAULT;
! /* this is our current estimate for at what "system" real time the ! current logical time's output should occur. */ static double sys_dactimeminusrealtime; ! /* same for input, should be schduler advance earlier. */ static double sys_adctimeminusrealtime;
*************** *** 79,105 **** }
! /* return the logical time of the DAC sample we believe is currently ! going out, based on how much "system time" has elapsed since the ! last time sys_setmiditimediff got called. */ static double sys_getmidioutrealtime() {return sys_getrealtime() + sys_dactimeminusrealtime;} static double sys_getmidiinrealtime () {return sys_getrealtime() + sys_adctimeminusrealtime;}
static void sys_putnext () { ! int portno = midi_outqueue[midi_outtail].portno; #ifdef USEAPI_ALSA if (sys_midiapi == API_ALSA) { ! if (midi_outqueue[midi_outtail].onebyte) ! sys_alsa_putmidibyte(portno, midi_outqueue[midi_outtail].byte1); ! else sys_alsa_putmidimess(portno, midi_outqueue[midi_outtail].byte1, ! midi_outqueue[midi_outtail].byte2, ! midi_outqueue[midi_outtail].byte3); } else #endif /* ALSA */ { ! if (midi_outqueue[midi_outtail].onebyte) ! sys_putmidibyte(portno, midi_outqueue[midi_outtail].byte1); ! else sys_putmidimess(portno, midi_outqueue[midi_outtail].byte1, ! midi_outqueue[midi_outtail].byte2, ! midi_outqueue[midi_outtail].byte3); } midi_outtail = (midi_outtail + 1 == MIDIQSIZE ? 0 : midi_outtail + 1); --- 79,99 ---- }
! /* return the logical time of the DAC sample we believe is currently going out, based on how much "system time" ! has elapsed since the last time sys_setmiditimediff got called. */ static double sys_getmidioutrealtime() {return sys_getrealtime() + sys_dactimeminusrealtime;} static double sys_getmidiinrealtime () {return sys_getrealtime() + sys_adctimeminusrealtime;}
static void sys_putnext () { ! t_midiqelem &m = midi_outqueue[midi_outtail]; ! int portno = m.portno; #ifdef USEAPI_ALSA if (sys_midiapi == API_ALSA) { ! if (m.onebyte) sys_alsa_putmidibyte(portno, m.byte1); ! else sys_alsa_putmidimess(portno, m.byte1, m.byte2, m.byte3); } else #endif /* ALSA */ { ! if (m.onebyte) sys_putmidibyte(portno, m.byte1); ! else sys_putmidimess(portno, m.byte1, m.byte2, m.byte3); } midi_outtail = (midi_outtail + 1 == MIDIQSIZE ? 0 : midi_outtail + 1); *************** *** 137,146 **** /* if FIFO is full flush an element to make room */ if (newhead == midi_outtail) sys_putnext(); ! midi_outqueue[midi_outhead].portno = portno; ! midi_outqueue[midi_outhead].onebyte = onebyte; ! midi_outqueue[midi_outhead].byte1 = a; ! midi_outqueue[midi_outhead].byte2 = b; ! midi_outqueue[midi_outhead].byte3 = c; ! midi_outqueue[midi_outhead].time = .001 * clock_gettimesince(sys_midiinittime); midi_outhead = newhead; sys_pollmidioutqueue(); --- 131,141 ---- /* if FIFO is full flush an element to make room */ if (newhead == midi_outtail) sys_putnext(); ! t_midiqelem m = midi_outqueue[midi_outhead]; ! m.portno = portno; ! m.onebyte = onebyte; ! m.byte1 = a; ! m.byte2 = b; ! m.byte3 = c; ! m.time = .001 * clock_gettimesince(sys_midiinittime); midi_outhead = newhead; sys_pollmidioutqueue(); *************** *** 566,570 **** int nindevs = 0, noutdevs = 0; t_atom argv[MAXNDEV]; - char str[DEVDESCSIZE]; int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1; t_symbol *selector = gensym("midiindev"); --- 561,564 ---- *************** *** 572,583 **** midi_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, MAXNDEV, DEVDESCSIZE); if (f < 0) { ! for (int i=0; i<nindevs; i++) { ! strcpy(str, indevlist + i * DEVDESCSIZE); ! SETSYMBOL(argv+i, gensym(str)); ! } typedmess(pd->s_thing, selector, nindevs, argv); } else if (f < nindevs) { ! strcpy(str, indevlist + f * DEVDESCSIZE); ! SETSYMBOL(argv, gensym(str)); typedmess(pd->s_thing, selector, 1, argv); } --- 566,573 ---- midi_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, MAXNDEV, DEVDESCSIZE); if (f < 0) { ! for (int i=0; i<nindevs; i++) SETSYMBOL(argv+i, gensym(indevlist + i * DEVDESCSIZE)); typedmess(pd->s_thing, selector, nindevs, argv); } else if (f < nindevs) { ! SETSYMBOL(argv, gensym(indevlist + f * DEVDESCSIZE)); typedmess(pd->s_thing, selector, 1, argv); } *************** *** 589,593 **** int nindevs = 0, noutdevs = 0; t_atom argv[MAXNDEV]; - char str[DEVDESCSIZE]; int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1; t_symbol *selector = gensym("midioutdev"); --- 579,582 ---- *************** *** 595,606 **** midi_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, MAXNDEV, DEVDESCSIZE); if (f < 0) { ! for (int i=0; i<noutdevs; i++) { ! strcpy(str, outdevlist + i*DEVDESCSIZE); ! SETSYMBOL(argv+i, gensym(str)); ! } typedmess(pd->s_thing, selector, noutdevs, argv); } else if (f < noutdevs) { ! strcpy(str, outdevlist + f*DEVDESCSIZE); ! SETSYMBOL(argv, gensym(str)); typedmess(pd->s_thing, selector, 1, argv); } --- 584,591 ---- midi_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, MAXNDEV, DEVDESCSIZE); if (f < 0) { ! for (int i=0; i<noutdevs; i++) SETSYMBOL(argv+i, gensym(outdevlist + i*DEVDESCSIZE)); typedmess(pd->s_thing, selector, noutdevs, argv); } else if (f < noutdevs) { ! SETSYMBOL(argv, gensym(outdevlist + f*DEVDESCSIZE)); typedmess(pd->s_thing, selector, 1, argv); }