1 diff -Nur portmidi/pm_linux/Makefile portmidi-new/pm_linux/Makefile
2 --- portmidi/pm_linux/Makefile 2008-06-14 02:23:43.000000000 +0200
3 +++ portmidi-new/pm_linux/Makefile 2008-11-24 12:01:48.000000000 +0100
7 # For debugging, define PM_CHECK_ERRORS
\r
8 -PMFLAGS = -DPM_CHECK_ERRORS
\r
9 +PMFLAGS = -DNEWBUFFER
\r
10 # Otherwise do not define PM_CHECK_ERRORS
\r
16 pmlib = pm_linux/libportmidi.a
\r
17 +pmslib = pm_linux/libportmidi.so.0.0.0
\r
19 ptlib = porttime/libporttime.a
\r
20 +ptslib = porttime/libporttime.so.0.0.0
\r
22 -CC = gcc $(VFLAGS) $(PMFLAGS) -g -Ipm_common -Iporttime
\r
23 +CC = gcc -fPIC $(CFLAGS) $(VFLAGS) $(PMFLAGS) -g -Ipm_common -Iporttime
\r
27 pmobjects = pm_common/pmutil.o $(versions) pm_linux/pmlinux.o \
\r
28 pm_common/portmidi.o
\r
30 all: $(pmlib) $(ptlib) pm_test/test pm_test/sysex pm_test/midithread \
\r
31 pm_test/latency pm_test/midithru pm_test/qtest pm_test/mm
\r
33 -$(pmlib): pm_linux/Makefile $(pmobjects)
\r
34 +$(pmlib): pm_linux/Makefile $(pmobjects) $(ptlib)
\r
35 ar -cr $(pmlib) $(pmobjects)
\r
36 + $(CC) -shared $(ptslib) $(ALSALIB) $(pmobjects) -Wl,-soname -Wl,libportmidi.so.0 -o $(pmslib)
\r
38 $(ptlib): pm_linux/Makefile $(ptobjects)
\r
39 ar -cr $(ptlib) $(ptobjects)
\r
40 + $(CC) -shared $(ptobjects) -lpthread -Wl,-soname -Wl,libporttime.so.0 -o $(ptslib)
\r
42 pm_linux/pmlinuxalsa.o: pm_linux/Makefile pm_linux/pmlinuxalsa.c pm_linux/pmlinuxalsa.h
\r
43 $(CC) -c pm_linux/pmlinuxalsa.c -o pm_linux/pmlinuxalsa.o
\r
45 pm_test/qtest: pm_linux/Makefile pm_test/qtest.o $(pmlib) $(ptlib)
\r
46 $(CC) pm_test/qtest.o -o pm_test/qtest $(pmlib) $(ptlib) $(ALSALIB)
\r
49 + $(INSTALL) -d $(DESTDIR)/usr/include
\r
50 + $(INSTALL) -m 644 pm_common/portmidi.h $(DESTDIR)/usr/include/
\r
51 + $(INSTALL) -m 644 porttime/porttime.h $(DESTDIR)/usr/include/
\r
52 + $(INSTALL) -d $(DESTDIR)/usr/lib
\r
53 + $(INSTALL) -m 644 pm_linux/libportmidi* $(DESTDIR)/usr/lib/
\r
54 + $(INSTALL) -m 644 porttime/libporttime* $(DESTDIR)/usr/lib/
\r
57 rm -f *.o *~ core* */*.o */*.so */*~ */core* pm_test/*/pm_dll.dll
\r
58 rm -f *.opt *.ncb *.plg pm_win/Debug/pm_dll.lib pm_win/Release/pm_dll.lib
\r
61 rm -f $(pmlib) $(ptlib) pm_test/test pm_test/sysex pm_test/midithread
\r
62 rm -f pm_test/latency pm_test/midithru pm_test/qtest pm_test/mm
\r
63 + rm -f pm_linux/libportmidi.a pm_linux/libportmidi.so.0.0.0 pm_test/test pm_test/sysex \
\r
64 + pm_test/midithread pm_test/latency pm_test/midithru porttime/libporttime.a \
\r
65 + porttime/libporttime.so.0.0.0
\r
68 cd ..; zip -r portmidi.zip portmidi
\r
69 diff -Nur portmidi/pm_linux/pmlinux.c portmidi-new/pm_linux/pmlinux.c
70 --- portmidi/pm_linux/pmlinux.c 2006-11-30 00:37:09.000000000 +0100
71 +++ portmidi-new/pm_linux/pmlinux.c 2008-11-24 11:59:21.000000000 +0100
76 - pm_linuxalsa_init();
\r
77 + return pm_linuxalsa_init();
\r
80 - pm_linuxnull_init();
\r
81 + return pm_linuxnull_init();
\r
85 diff -Nur portmidi/pm_linux/pmlinuxalsa.c portmidi-new/pm_linux/pmlinuxalsa.c
86 --- portmidi/pm_linux/pmlinuxalsa.c 2008-06-14 02:23:43.000000000 +0200
87 +++ portmidi-new/pm_linux/pmlinuxalsa.c 2008-11-24 11:58:30.000000000 +0100
89 if (when == 0) when = now;
\r
90 when = (when - now) + midi->latency;
\r
91 if (when < 0) when = 0;
\r
92 - VERBOSE printf("timestamp %d now %d latency %d, ",
\r
93 + VERBOSE printf("timestamp %d now %d latency %li, ",
\r
94 (int) timestamp, (int) now, midi->latency);
\r
95 VERBOSE printf("scheduling event after %d\n", when);
\r
96 /* message is sent in relative ticks, where 1 tick = 1 ms */
\r
98 alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
\r
99 if (!desc) return pmBadPtr;
\r
101 - if (pm_hosterror = snd_seq_disconnect_to(seq, desc->this_port,
\r
102 - desc->client, desc->port)) {
\r
103 + if ((pm_hosterror = snd_seq_disconnect_to(seq, desc->this_port,
\r
104 + desc->client, desc->port))) {
\r
105 // if there's an error, try to delete the port anyway, but don't
\r
106 // change the pm_hosterror value so we retain the first error
\r
107 snd_seq_delete_port(seq, desc->this_port);
\r
110 alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
\r
111 if (!desc) return pmBadPtr;
\r
112 - if (pm_hosterror = snd_seq_disconnect_from(seq, desc->this_port,
\r
113 - desc->client, desc->port)) {
\r
114 + if ((pm_hosterror = snd_seq_disconnect_from(seq, desc->this_port,
\r
115 + desc->client, desc->port))) {
\r
116 snd_seq_delete_port(seq, desc->this_port); /* try to close port */
\r
118 pm_hosterror = snd_seq_delete_port(seq, desc->this_port);
\r
119 diff -Nur portmidi/pm_test/Makefile portmidi-new/pm_test/Makefile
120 --- portmidi/pm_test/Makefile 1970-01-01 01:00:00.000000000 +0100
121 +++ portmidi-new/pm_test/Makefile 2008-11-24 12:00:31.000000000 +0100
123 +# For debugging, define PM_CHECK_ERRORS
124 +PMFLAGS = -DPM_CHECK_ERRORS
125 +# Use this for linux alsa (0.9x) version
131 +CC = gcc $(CFLAGS) $(VFLAGS) $(PMFLAGS) -g
133 +all: test sysex midithread latency midithru
136 + $(CC) test.c -o test $(pmlib) $(ptlib) $(ALSALIB)
139 + $(CC) sysex.c -o sysex $(pmlib) $(ptlib) $(ALSALIB)
141 +midithread: midithread.o
142 + $(CC) midithread.c -o midithread \
143 + $(pmlib) $(ptlib) $(ALSALIB)
146 + $(CC) latency.c -o latency $(pmlib) $(ptlib) \
147 + $(ALSALIB) -lpthread -lm
149 +midithru: midithru.o
150 + $(CC) midithru.c -o midithru $(pmlib) $(ptlib) \
151 + $(ALSALIB) -lpthread -lm
154 + rm -f midithru latency midithread sysex test