Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6346/pd/src
Modified Files:
configure.in g_rtext.c makefile.in s_audio_jack.c s_file.c
s_midi.c s_midi_alsa.c s_midi_pm.c u_main.tk x_midi.c x_misc.c
Log Message:
fix name clash in s_audio_jack.c (again) and applied some sourceforge patches
Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** u_main.tk 20 Jul 2007 03:25:20 -0000 1.26
--- u_main.tk 2 Aug 2007 00:33:50 -0000 1.27
***************
*** 435,442 ****
proc doc_make_listbox {base dir count} {
# check for [file readable]?
! if { [info tclversion] >= 8.5 } {
# requires Tcl 8.5 but probably deals with special chars better
# destroy {expand}[lrange [winfo children $base] [expr {2 * $count}] end]
! } else {
if { [catch { eval destroy [lrange [winfo children $base] \
[expr { 2 * $count }] end] } \
--- 435,442 ----
proc doc_make_listbox {base dir count} {
# check for [file readable]?
! #if { [info tclversion] >= 8.5 } {
# requires Tcl 8.5 but probably deals with special chars better
# destroy {expand}[lrange [winfo children $base] [expr {2 * $count}] end]
! #} else {
if { [catch { eval destroy [lrange [winfo children $base] \
[expr { 2 * $count }] end] } \
***************
*** 444,448 ****
puts stderr "doc_make_listbox: error listing $dir\n"
}
! }
# exportselection 0 looks good, but selection gets easily out-of-sync
set current_listbox [listbox "[set b "$base.listbox$count"]-list" -yscrollcommand \
--- 444,448 ----
puts stderr "doc_make_listbox: error listing $dir\n"
}
! #}
# exportselection 0 looks good, but selection gets easily out-of-sync
set current_listbox [listbox "[set b "$base.listbox$count"]-list" -yscrollcommand \
Index: configure.in
===================================================================
RCS file: /cvsroot/pure-data/pd/src/configure.in,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** configure.in 20 Jul 2007 03:25:20 -0000 1.23
--- configure.in 2 Aug 2007 00:33:50 -0000 1.24
***************
*** 420,423 ****
--- 420,433 ----
## }JMZ: end of large-file support section
+ if test -d ../obj
+ then echo -n
+ else mkdir ../obj
+ fi
+
+ if test -d ../bin
+ then echo -n
+ else mkdir ../bin
+ fi
+
AC_OUTPUT(makefile)
Index: makefile.in
===================================================================
RCS file: /cvsroot/pure-data/pd/src/makefile.in,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** makefile.in 20 Jul 2007 03:25:20 -0000 1.16
--- makefile.in 2 Aug 2007 00:33:50 -0000 1.17
***************
*** 147,158 ****
externs:
! cd ../extra/bonk~;make @EXTERNTARGET@
! cd ../extra/choice;make @EXTERNTARGET@
! cd ../extra/expr~;make @EXTERNTARGET@
! cd ../extra/fiddle~;make @EXTERNTARGET@
! cd ../extra/loop~;make @EXTERNTARGET@
! cd ../extra/lrshift~;make @EXTERNTARGET@
! cd ../extra/pique;make @EXTERNTARGET@
! cd ../extra/sigmund~;make @EXTERNTARGET@
BINARYMODE=@binarymode@
--- 147,158 ----
externs:
! make -C ../extra/bonk~ @EXTERNTARGET@
! make -C ../extra/choice @EXTERNTARGET@
! make -C ../extra/expr~ @EXTERNTARGET@
! make -C ../extra/fiddle~ @EXTERNTARGET@
! make -C ../extra/loop~ @EXTERNTARGET@
! make -C ../extra/lrshift~ @EXTERNTARGET@
! make -C ../extra/pique @EXTERNTARGET@
! make -C ../extra/sigmund~ @EXTERNTARGET@
BINARYMODE=@binarymode@
Index: s_midi.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_midi.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** s_midi.c 4 Oct 2006 19:35:06 -0000 1.10
--- s_midi.c 2 Aug 2007 00:33:50 -0000 1.11
***************
*** 237,240 ****
--- 237,254 ----
}
+ void outmidi_byte(int portno, int value)
+ {
+ #ifdef USEAPI_ALSA
+ if (sys_midiapi == API_ALSA)
+ {
+ sys_alsa_putmidibyte(portno, value);
+ }
+ else
+ #endif
+ {
+ sys_putmidibyte(portno, value);
+ }
+ }
+
/* ------------------------- MIDI input queue handling ------------------ */
typedef struct midiparser
Index: s_audio_jack.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio_jack.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** s_audio_jack.c 24 Jul 2007 04:53:36 -0000 1.7
--- s_audio_jack.c 2 Aug 2007 00:33:50 -0000 1.8
***************
*** 195,199 ****
! void jack_error_callback(const char *desc) {
return;
}
--- 195,199 ----
! void pd_jack_error_callback(const char *desc) {
return;
}
***************
*** 245,249 ****
jack_set_process_callback (jack_client, process, 0);
! jack_set_error_function (jack_error_callback);
#ifdef JACK_XRUN
--- 245,249 ----
jack_set_process_callback (jack_client, process, 0);
! jack_set_error_function (pd_jack_error_callback);
#ifdef JACK_XRUN
Index: s_midi_pm.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_midi_pm.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** s_midi_pm.c 8 Jul 2005 00:02:45 -0000 1.6
--- s_midi_pm.c 2 Aug 2007 00:33:50 -0000 1.7
***************
*** 141,145 ****
else if (byte == 0xf0)
{
! mess[0] = 0xf7;
nbytes = 1;
sysex = 1;
--- 141,145 ----
else if (byte == 0xf0)
{
! mess[0] = 0xf0;
nbytes = 1;
sysex = 1;
***************
*** 210,213 ****
--- 210,245 ----
}
+ /* this is non-zero if we are in the middle of transmitting sysex */
+
+ int nd_sysex_mode=0;
+
+ /* send in 4 bytes of sysex data. if one of the bytes is 0xF7 (sysex end) stop and unset nd_sysex_mode */
+ void nd_sysex_inword(int midiindev, int status, int data1, int data2, int data3)
+ {
+ if (nd_sysex_mode) {
+ sys_midibytein(midiindev, status);
+ if (status == 0xF7)
+ nd_sysex_mode = 0;
+ }
+
+ if (nd_sysex_mode) {
+ sys_midibytein(midiindev, data1);
+ if (data1 == 0xF7)
+ nd_sysex_mode = 0;
+ }
+
+ if (nd_sysex_mode) {
+ sys_midibytein(midiindev, data2);
+ if (data2 == 0xF7)
+ nd_sysex_mode = 0;
+ }
+
+ if (nd_sysex_mode) {
+ sys_midibytein(midiindev, data3);
+ if (data3 == 0xF7)
+ nd_sysex_mode = 0;
+ }
+ }
+
void sys_poll_midi(void)
{
***************
*** 222,225 ****
--- 254,258 ----
int data1 = Pm_MessageData1(buffer.message);
int data2 = Pm_MessageData2(buffer.message);
+ int data3 = ((buffer.message >> 24) & 0xFF);
int msgtype = (status >> 4) - 8;
switch (msgtype)
***************
*** 240,245 ****
break;
case 7:
! sys_midibytein(i, status);
break;
}
}
--- 273,282 ----
break;
case 7:
! nd_sysex_mode=1;
! nd_sysex_inword(i, status, data1, data2, data3);
break;
+ default:
+ if (nd_sysex_mode)
+ nd_sysex_inword(i, status, data1, data2, data3);
}
}
Index: g_rtext.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_rtext.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** g_rtext.c 20 Jul 2007 03:25:20 -0000 1.7
--- g_rtext.c 2 Aug 2007 00:33:50 -0000 1.8
***************
*** 443,447 ****
be printable in whatever 8-bit character set we find ourselves. */
! if (n == '\n' || n > 31)
{
newsize = x->x_bufsize+1;
--- 443,447 ----
be printable in whatever 8-bit character set we find ourselves. */
! if (n == '\n' || (n > 31 && n != 127))
{
newsize = x->x_bufsize+1;
Index: x_midi.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/x_midi.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** x_midi.c 8 Sep 2006 23:45:31 -0000 1.4
--- x_midi.c 2 Aug 2007 00:33:50 -0000 1.5
***************
*** 13,16 ****
--- 13,18 ----
void outmidi_polyaftertouch(int portno, int channel, int pitch, int value);
void outmidi_mclk(int portno);
+ void outmidi_byte(int portno, int value);
+
/* ----------------------- midiin and sysexin ------------------------- */
***************
*** 33,38 ****
x->x_outlet2 = outlet_new(&x->x_obj, &s_float);
pd_bind(&x->x_obj.ob_pd, midiin_sym);
! #ifndef __linux__
! pd_error(x, "midiin: works under Linux only");
#endif
return (x);
--- 35,40 ----
x->x_outlet2 = outlet_new(&x->x_obj, &s_float);
pd_bind(&x->x_obj.ob_pd, midiin_sym);
! #ifdef WIN32
! pd_error(x, "midiin: windows: not supported");
#endif
return (x);
***************
*** 56,61 ****
x->x_outlet2 = outlet_new(&x->x_obj, &s_float);
pd_bind(&x->x_obj.ob_pd, sysexin_sym);
! #ifndef __linux__
! pd_error(x, "sysexin: works under Linux only");
#endif
return (x);
--- 58,63 ----
x->x_outlet2 = outlet_new(&x->x_obj, &s_float);
pd_bind(&x->x_obj.ob_pd, sysexin_sym);
! #ifdef WIN32
! pd_error(x, "sysexin: windows: not supported");
#endif
return (x);
***************
*** 679,683 ****
static void midiout_float(t_midiout *x, t_floatarg f)
{
! sys_putmidibyte(x->x_portno - 1, f);
}
--- 681,685 ----
static void midiout_float(t_midiout *x, t_floatarg f)
{
! outmidi_byte(x->x_portno - 1, f);
}
Index: s_midi_alsa.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_midi_alsa.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** s_midi_alsa.c 19 Aug 2005 23:28:03 -0000 1.4
--- s_midi_alsa.c 2 Aug 2007 00:33:50 -0000 1.5
***************
*** 48,53 ****
--- 48,61 ----
int i;
snd_seq_client_info_t *alsainfo;
+ /* do we want to connect pd automatically with other devices ?; see below! */
+ /* LATER: think about a flag to enable/disable automatic connection
+ * (sometimes it could be a pain)
+ */
+ int autoconnect = 1;
alsa_nmidiin = 0;
alsa_nmidiout = 0;
+
+ if (nmidiout == 0 && nmidiin == 0) return;
+
if(nmidiin>MAXMIDIINDEV )
{
***************
*** 74,96 ****
return;
}
! for (i=0;i<nmidiout;i++)
{
int port;
sprintf(portname,"Pure Data Midi-In %d",i+1);
! port = snd_seq_create_simple_port(midi_handle,portname,SND_SEQ_PORT_CAP_WRITE |SND_SEQ_PORT_CAP_SUBS_WRITE , SND_SEQ_PORT_TYPE_APPLICATION);
alsa_midiinfd[i] = port;
if (port < 0) goto error;
}
! for (i=0;i<nmidiin;i++)
{
int port;
sprintf(portname,"Pure Data Midi-Out %d",i+1);
! port = snd_seq_create_simple_port(midi_handle,portname, SND_SEQ_PORT_CAP_SUBS_READ | SND_SEQ_PORT_CAP_READ, SND_SEQ_PORT_TYPE_APPLICATION);
alsa_midioutfd[i] = port;
if (port < 0) goto error;
}
- if (nmidiout == 0 && nmidiin == 0) return;
snd_seq_client_info_malloc(&alsainfo);
snd_seq_get_client_info(midi_handle,alsainfo);
--- 82,107 ----
return;
}
! for (i=0;i<nmidiin;i++)
{
int port;
sprintf(portname,"Pure Data Midi-In %d",i+1);
! port = snd_seq_create_simple_port(midi_handle,portname,
! SND_SEQ_PORT_CAP_WRITE |SND_SEQ_PORT_CAP_SUBS_WRITE,
! SND_SEQ_PORT_TYPE_APPLICATION);
alsa_midiinfd[i] = port;
if (port < 0) goto error;
}
! for (i=0;i<nmidiout;i++)
{
int port;
sprintf(portname,"Pure Data Midi-Out %d",i+1);
! port = snd_seq_create_simple_port(midi_handle,portname,
! SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ,
! SND_SEQ_PORT_TYPE_APPLICATION);
alsa_midioutfd[i] = port;
if (port < 0) goto error;
}
snd_seq_client_info_malloc(&alsainfo);
snd_seq_get_client_info(midi_handle,alsainfo);
***************
*** 104,109 ****
alsa_nmidiout = nmidiout;
alsa_nmidiin = nmidiin;
return;
! error:
sys_setalarm(1000000);
post("couldn't open alsa MIDI output device");
--- 115,179 ----
alsa_nmidiout = nmidiout;
alsa_nmidiin = nmidiin;
+
+ /* JMZ: connect all available devices to pd */
+ if (autoconnect)
+ {
+
+ snd_seq_client_info_t *cinfo;
+ snd_seq_port_info_t *pinfo;
+
+ snd_seq_port_subscribe_t *subs;
+ snd_seq_addr_t other, topd, frompd;
+ /* since i don't know how to connect multiple ports
+ * (connect everything to each port, modulo,...),
+ * i only fully connect where we have only one single port
+ */
+ if(alsa_nmidiin)
+ {
+ topd.client =client;
+ topd.port =alsa_midiinfd[0];
+ }
+ if(alsa_nmidiout)
+ {
+ frompd.client =client;
+ frompd.port =alsa_midioutfd[0];
+ }
+
+ snd_seq_port_subscribe_alloca(&subs);
+
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_port_info_alloca(&pinfo);
+ snd_seq_client_info_set_client(cinfo, -1);
+ while (snd_seq_query_next_client(midi_handle, cinfo) >= 0)
+ {
+ /* reset query info */
+ int client_id=snd_seq_client_info_get_client(cinfo);
+
+ if((SND_SEQ_CLIENT_SYSTEM != client_id)&&(client != client_id))
+ { /* skipping port 0 and ourself */
+ snd_seq_port_info_set_client(pinfo, client_id);
+ snd_seq_port_info_set_port(pinfo, -1);
+ while (snd_seq_query_next_port(midi_handle, pinfo) >= 0)
+ {
+ other.client=client_id;
+ other.port =snd_seq_port_info_get_port(pinfo);
+ if(1==alsa_nmidiin) /* only autoconnect 1st port */
+ {
+ snd_seq_port_subscribe_set_sender(subs, &other);
+ snd_seq_port_subscribe_set_dest(subs, &topd);
+ snd_seq_subscribe_port(midi_handle, subs);
+ }
+ if(1==alsa_nmidiout) /* only autoconnect 1st port */
+ {
+ snd_seq_port_subscribe_set_sender(subs, &frompd);
+ snd_seq_port_subscribe_set_dest(subs, &other);
+ snd_seq_subscribe_port(midi_handle, subs);
+ }
+ }
+ }
+ }
+ }
return;
! error:
sys_setalarm(1000000);
post("couldn't open alsa MIDI output device");
***************
*** 170,177 ****
// repack into 1 byte char and put somewhere to point at
unsigned char data = (unsigned char)byte;
- unsigned char *dataptr = malloc(1);
- memcpy(dataptr,&byte,1);
! snd_seq_ev_set_sysex(&ev,1,dataptr); //...set_variable *should* have worked but didn't
snd_seq_ev_set_direct(&ev);
snd_seq_ev_set_subs(&ev);
--- 240,245 ----
// repack into 1 byte char and put somewhere to point at
unsigned char data = (unsigned char)byte;
! snd_seq_ev_set_sysex(&ev,1,&data); //...set_variable *should* have worked but didn't
snd_seq_ev_set_direct(&ev);
snd_seq_ev_set_subs(&ev);
Index: x_misc.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/x_misc.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** x_misc.c 31 Dec 2005 20:55:25 -0000 1.3
--- x_misc.c 2 Aug 2007 00:33:50 -0000 1.4
***************
*** 23,27 ****
#if defined (__APPLE__) || defined (__FreeBSD__)
! #define HZ CLK_TCK
#endif
--- 23,30 ----
#if defined (__APPLE__) || defined (__FreeBSD__)
! #define CLOCKHZ CLK_TCK
! #endif
! #if defined (__linux__)
! #define CLOCKHZ sysconf(_SC_CLK_TCK)
#endif
***************
*** 231,235 ****
elapsedcpu = 1000 * (
newcputime.tms_utime + newcputime.tms_stime -
! x->x_setcputime.tms_utime - x->x_setcputime.tms_stime) / HZ;
outlet_float(x->x_obj.ob_outlet, elapsedcpu);
#endif
--- 234,238 ----
elapsedcpu = 1000 * (
newcputime.tms_utime + newcputime.tms_stime -
! x->x_setcputime.tms_utime - x->x_setcputime.tms_stime) / CLOCKHZ;
outlet_float(x->x_obj.ob_outlet, elapsedcpu);
#endif
Index: s_file.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_file.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** s_file.c 31 Dec 2005 20:55:25 -0000 1.9
--- s_file.c 2 Aug 2007 00:33:50 -0000 1.10
***************
*** 43,50 ****
char filenamebuf[MAXPDSTRING], *homedir = getenv("HOME");
int fd, length;
! if (!homedir)
! return;
! snprintf(filenamebuf, MAXPDSTRING, "%s/.pdsettings", homedir);
filenamebuf[MAXPDSTRING-1] = 0;
if ((fd = open(filenamebuf, 0)) < 0)
--- 43,60 ----
char filenamebuf[MAXPDSTRING], *homedir = getenv("HOME");
int fd, length;
+ char user_prefs_file[MAXPDSTRING]; /* user prefs file */
+ /* default prefs embedded in the package */
+ char default_prefs_file[MAXPDSTRING];
+ struct stat statbuf;
! snprintf(default_prefs_file, MAXPDSTRING, "%s/default.pdsettings",
! sys_libdir->s_name);
! if (homedir)
! snprintf(user_prefs_file, MAXPDSTRING, "%s/.pdsettings", homedir);
! if (stat(user_prefs_file, &statbuf) == 0)
! strncpy(filenamebuf, user_prefs_file, MAXPDSTRING);
! else if (stat(default_prefs_file, &statbuf) == 0)
! strncpy(filenamebuf, default_prefs_file, MAXPDSTRING);
! else return;
filenamebuf[MAXPDSTRING-1] = 0;
if ((fd = open(filenamebuf, 0)) < 0)
***************
*** 216,220 ****
char cmdbuf[256];
int nread = 0, nleft = size;
! snprintf(cmdbuf, 256, "defaults read org.puredata.pd %s 2> /dev/null\n", key);
FILE *fp = popen(cmdbuf, "r");
while (nread < size)
--- 226,244 ----
char cmdbuf[256];
int nread = 0, nleft = size;
! char embedded_prefs[MAXPDSTRING];
! char user_prefs[MAXPDSTRING];
! char *homedir = getenv("HOME");
! struct stat statbuf;
! /* the 'defaults' command expects the filename without .plist at the
! end */
! snprintf(embedded_prefs, MAXPDSTRING, "%s/../org.puredata.pd",
! sys_libdir->s_name);
! snprintf(user_prefs, MAXPDSTRING,
! "%s/Library/Preferences/org.puredata.pd.plist", homedir);
! if (stat(user_prefs, &statbuf) == 0)
! snprintf(cmdbuf, 256, "defaults read org.puredata.pd %s 2> /dev/null\n",
! key);
! else snprintf(cmdbuf, 256, "defaults read %s %s 2> /dev/null\n",
! embedded_prefs, key);
FILE *fp = popen(cmdbuf, "r");
while (nread < size)
***************
*** 273,278 ****
&& sscanf(prefbuf, "%d", &api) > 0)
sys_set_audio_api(api);
if (sys_getpreference("noaudioin", prefbuf, MAXPDSTRING) &&
! (!strcmp(prefbuf, ".") || !strcmp(prefbuf, "True"))) /* JMZ/MB: brackets for initializing */
naudioindev = 0;
else
--- 297,303 ----
&& sscanf(prefbuf, "%d", &api) > 0)
sys_set_audio_api(api);
+ /* JMZ/MB: brackets for initializing */
if (sys_getpreference("noaudioin", prefbuf, MAXPDSTRING) &&
! (!strcmp(prefbuf, ".") || !strcmp(prefbuf, "True")))
naudioindev = 0;
else
***************
*** 291,296 ****
naudioindev = -1;
}
if (sys_getpreference("noaudioout", prefbuf, MAXPDSTRING) &&
! (!strcmp(prefbuf, ".") || !strcmp(prefbuf, "True"))) /* JMZ/MB: brackets for initializing */
naudiooutdev = 0;
else
--- 316,322 ----
naudioindev = -1;
}
+ /* JMZ/MB: brackets for initializing */
if (sys_getpreference("noaudioout", prefbuf, MAXPDSTRING) &&
! (!strcmp(prefbuf, ".") || !strcmp(prefbuf, "True")))
naudiooutdev = 0;
else
***************
*** 316,321 ****
/* load MIDI preferences */
if (sys_getpreference("nomidiin", prefbuf, MAXPDSTRING) &&
! (!strcmp(prefbuf, ".") || !strcmp(prefbuf, "True"))) /* JMZ/MB: brackets for initializing */
nmidiindev = 0;
else for (i = 0, nmidiindev = 0; i < MAXMIDIINDEV; i++)
--- 342,348 ----
/* load MIDI preferences */
+ /* JMZ/MB: brackets for initializing */
if (sys_getpreference("nomidiin", prefbuf, MAXPDSTRING) &&
! (!strcmp(prefbuf, ".") || !strcmp(prefbuf, "True")))
nmidiindev = 0;
else for (i = 0, nmidiindev = 0; i < MAXMIDIINDEV; i++)
***************
*** 328,333 ****
nmidiindev++;
}
if (sys_getpreference("nomidiout", prefbuf, MAXPDSTRING) &&
! (!strcmp(prefbuf, ".") || !strcmp(prefbuf, "True"))) /* JMZ/MB: brackets for initializing */
nmidioutdev = 0;
else for (i = 0, nmidioutdev = 0; i < MAXMIDIOUTDEV; i++)
--- 355,361 ----
nmidiindev++;
}
+ /* JMZ/MB: brackets for initializing */
if (sys_getpreference("nomidiout", prefbuf, MAXPDSTRING) &&
! (!strcmp(prefbuf, ".") || !strcmp(prefbuf, "True")))
nmidioutdev = 0;
else for (i = 0, nmidioutdev = 0; i < MAXMIDIOUTDEV; i++)