Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19983
Modified Files: Tag: devel_0_39 s_midi.c m_glob.c Log Message: message-based access to the current midi devices via the pd receiver
Index: s_midi.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_midi.c,v retrieving revision 1.4.4.1.2.6 retrieving revision 1.4.4.1.2.7 diff -C2 -d -r1.4.4.1.2.6 -r1.4.4.1.2.7 *** s_midi.c 25 Jul 2006 01:41:40 -0000 1.4.4.1.2.6 --- s_midi.c 25 Jul 2006 01:56:30 -0000 1.4.4.1.2.7 *************** *** 835,836 **** --- 835,892 ---- typedmess(pd->s_thing, selector, noutdevs, argv); } + + + + void glob_midi_getcurrentindevs(t_pd *dummy) + { + char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; + + /* these are the devices you're using: */ + int nindev, midiindev[MAXMIDIINDEV]; + int noutdev, midioutdev[MAXMIDIOUTDEV]; + int midiindev1, midiindev2, midiindev3, midiindev4, + midioutdev1, midioutdev2, midioutdev3, midioutdev4; + + t_atom argv[MAXNDEV]; + char str[DEVDESCSIZE]; + + t_symbol * selector = gensym("midicurrentindev"); + t_symbol * pd = gensym("pd"); + int i; + + sys_get_midi_params(&nindev, midiindev, &noutdev, midioutdev); + + for (i = 0; i < noutdev; i++) + { + SETFLOAT(argv+i, midiindev[i]); + } + typedmess(pd->s_thing, selector, nindev, argv); + } + + + void glob_midi_getcurrentoutdevs(t_pd *dummy) + { + char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; + + /* these are the devices you're using: */ + int nindev, midiindev[MAXMIDIINDEV]; + int noutdev, midioutdev[MAXMIDIOUTDEV]; + int midiindev1, midiindev2, midiindev3, midiindev4, + midioutdev1, midioutdev2, midioutdev3, midioutdev4; + + t_atom argv[MAXNDEV]; + char str[DEVDESCSIZE]; + + t_symbol * selector = gensym("midicurrentoutdev"); + t_symbol * pd = gensym("pd"); + int i; + + sys_get_midi_params(&nindev, midiindev, &noutdev, midioutdev); + + for (i = 0; i < noutdev; i++) + { + SETFLOAT(argv+i, midioutdev[i]); + } + typedmess(pd->s_thing, selector, nindev, argv); + } +
Index: m_glob.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_glob.c,v retrieving revision 1.4.4.2.2.11 retrieving revision 1.4.4.2.2.12 diff -C2 -d -r1.4.4.2.2.11 -r1.4.4.2.2.12 *** m_glob.c 25 Jul 2006 01:41:40 -0000 1.4.4.2.2.11 --- m_glob.c 25 Jul 2006 01:56:30 -0000 1.4.4.2.2.12 *************** *** 50,53 **** --- 50,55 ---- void glob_midi_getindevs(t_pd *dummy); void glob_midi_getoutdevs(t_pd *dummy); + void glob_midi_getcurrentindevs(t_pd *dummy); + void glob_midi_getcurrentoutdevs(t_pd *dummy); /* tb } */
*************** *** 95,98 **** --- 97,104 ---- if (s == gensym("midioutdev")) return; + if (s == gensym("midicurrentindev")) + return; + if (s == gensym("midicurrentoutdev")) + return;
startpost("%s: unknown message %s ", class_getname(pd_class(x)), *************** *** 218,221 **** --- 224,229 ---- class_addmethod(glob_pdobject, (t_method)glob_midi_getoutdevs, gensym("getmidioutdev"), 0); class_addmethod(glob_pdobject, (t_method)glob_midi_getindevs, gensym("getmidiindev"), 0); + class_addmethod(glob_pdobject, (t_method)glob_midi_getcurrentoutdevs, gensym("getcurrentmidioutdev"), 0); + class_addmethod(glob_pdobject, (t_method)glob_midi_getcurrentindevs, gensym("getcurrentmidiindev"), 0);
/* tb } */