Commit 07e5a339 authored by Miller Puckette's avatar Miller Puckette
Browse files

Fixed problem finding MIDI devices in Fedora (/dev/midi1 instead of /dev/midi0)

small helpfile fixes
parent 49ff936c
#N canvas 286 197 499 284 10;
#X obj 19 108 sig~;
#X obj 71 133 loadbang;
#X obj 71 157 metro 100;
#X obj 71 181 snapshot~;
#X floatatom 19 87 5 0 0 0 - - -;
#X floatatom 71 206 7 0 0 0 - - -;
#X text 316 257 updated for Pd version 0.42.;
#X obj 20 132 abs~;
#X obj 21 14 abs~;
#X text 60 14 - absolute value;
#X text 82 33 Passes nonnegative values unchanged \, but replaces negative
ones with their (positive) inverses.;
#X text 81 66 (turn DSP on to test):;
#X connect 0 0 7 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 5 0;
#X connect 4 0 0 0;
#X connect 7 0 3 0;
#N canvas 250 93 494 364 12;
#N canvas 130 55 494 364 12;
#X floatatom 84 288 3 0 0 0 - - -;
#X obj 34 237 notein;
#X obj 34 263 stripnote;
......@@ -55,7 +55,7 @@
#X obj 177 126 tgl 20 0 tone-ch1 tone-ch1 1 5 -8 0 12 -262144 -1 -1
1 1;
#X obj 202 126 tgl 20 0 tone-ch2 tone-ch2 2 5 -8 0 12 -262144 -1 -1
1 1;
0 1;
#X obj 219 258 tgl 20 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
1;
#X obj 184 192 tgl 15 0 tone-monitor set-tone-monitor monitor-inputs
......@@ -99,8 +99,8 @@
#X connect 14 0 11 1;
#X connect 15 0 11 1;
#X restore 388 266 pd more;
#X obj 343 193 tgl 15 0 tone-hipass set-tone-hipass input-hipass 23
8 0 12 -262144 -1 -1 0 1;
#X obj 343 193 tgl 15 0 tone-hipass tone-hipass-set input-hipass 23
8 0 12 -262144 -1 -1 1 1;
#X obj 243 126 tgl 20 0 tone-ch3 tone-ch3 3 5 -8 0 12 -262144 -1 -1
1 1;
#X obj 268 126 tgl 20 0 tone-ch4 tone-ch4 4 5 -8 0 12 -262144 -1 -1
......@@ -109,9 +109,9 @@
1 1;
#X obj 334 126 tgl 20 0 tone-ch6 tone-ch6 6 5 -8 0 12 -262144 -1 -1
1 1;
#X obj 427 117 bng 15 250 50 0 tone-all empty ALL 20 8 0 12 -262144
#X obj 428 117 bng 15 250 50 0 tone-all empty ALL 20 8 0 12 -262144
-1 -1;
#X obj 427 138 bng 15 250 50 0 tone-none empty NONE 20 8 0 12 -262144
#X obj 428 138 bng 15 250 50 0 tone-none empty NONE 20 8 0 12 -262144
-1 -1;
#X floatatom 244 93 3 0 0 0 - tone-vu3 -;
#X floatatom 272 93 3 0 0 0 - tone-vu4 -;
......@@ -121,14 +121,14 @@
#X text 101 88 noise;
#X text 100 105 tone;
#X obj 84 90 vradio 15 1 0 2 tone-type tone-type-set empty 0 -6 0 8
-262144 -1 -1 1;
-262144 -1 -1 0;
#X obj 22 91 vradio 15 1 0 3 tone-radio tone-radio-set empty 0 -6 0
8 -262144 -1 -1 2;
#X floatatom 376 93 3 0 0 0 - tone-vu7 -;
#X floatatom 404 93 3 0 0 0 - tone-vu8 -;
#X obj 374 126 tgl 20 0 tone-ch7 tone-ch7 7 5 -8 0 12 -262144 -1 -1
#X obj 375 126 tgl 20 0 tone-ch7 tone-ch7 7 5 -8 0 12 -262144 -1 -1
1 1;
#X obj 399 126 tgl 20 0 tone-ch8 tone-ch8 8 5 -8 0 12 -262144 -1 -1
#X obj 400 126 tgl 20 0 tone-ch8 tone-ch8 8 5 -8 0 12 -262144 -1 -1
1 1;
#N canvas 233 346 321 422 audio 0;
#X obj 25 303 s~ tone-mon;
......@@ -138,7 +138,7 @@
#X obj 28 139 * 5;
#X obj 28 164 s tone-hip;
#X obj 28 114 r tone-hipass;
#N canvas 476 63 548 519 glue+loadbang 0;
#N canvas 424 104 548 519 glue+loadbang 0;
#X obj 8 20 loadbang;
#X obj 175 18 r tone-all;
#X obj 285 16 r tone-none;
......
---------------- dolist --------------------
test:
doc:
exp~, abs~ fixes
pd~ -ninsig 0 bug fixed
compile on various versions of linux
windows:
......
......@@ -17,6 +17,8 @@
#include "m_pd.h"
#include "s_stuff.h"
#define NSEARCH 10
static int oss_nmidiindevs, oss_nmidioutdevs, oss_initted, oss_onebased;
static int oss_nmidiin;
static int oss_midiinfd[MAXMIDIINDEV];
static int oss_nmidiout;
......@@ -41,7 +43,7 @@ void sys_do_open_midi(int nmidiin, int *midiinvec,
{
int fd = -1, j, outdevindex = -1;
char namebuf[80];
int devno = midiinvec[i];
int devno = midiinvec[i] + oss_onebased;
for (j = 0; j < nmidiout; j++)
if (midioutvec[j] == midiinvec[i])
......@@ -115,7 +117,7 @@ void sys_do_open_midi(int nmidiin, int *midiinvec,
{
int fd = oss_midioutfd[i];
char namebuf[80];
int devno = midioutvec[i];
int devno = midioutvec[i] + oss_onebased;
if (devno == 0 && fd < 0)
{
sys_setalarm(1000000);
......@@ -266,23 +268,26 @@ void sys_close_midi()
oss_nmidiin = oss_nmidiout = 0;
}
#define NSEARCH 10
static int oss_nmidiindevs, oss_nmidioutdevs, oss_initted;
void midi_oss_init(void)
{
int i;
int i, fd, devno;
struct stat statbuf;
char namebuf[80];
if (oss_initted)
return;
oss_initted = 1;
/* at some point, Fedora started counting MIDI devices from one -
catch that here: */
oss_onebased = (stat("/dev/midi1", &statbuf) >= 0 &&
stat("/dev/midi0", &statbuf) < 0);
for (i = 0; i < NSEARCH; i++)
{
int fd;
char namebuf[80];
oss_nmidiindevs = i;
devno = i + oss_onebased;
/* try to open the device for reading */
if (i == 0)
if (devno == 0)
{
fd = open("/dev/midi", O_RDONLY | O_NDELAY);
if (fd >= 0)
......@@ -291,14 +296,14 @@ void midi_oss_init(void)
continue;
}
}
sprintf(namebuf, "/dev/midi%2.2d", i);
sprintf(namebuf, "/dev/midi%2.2d", devno);
fd = open(namebuf, O_RDONLY | O_NDELAY);
if (fd >= 0)
{
close(fd);
continue;
}
sprintf(namebuf, "/dev/midi%d", i);
sprintf(namebuf, "/dev/midi%d", devno);
fd = open(namebuf, O_RDONLY | O_NDELAY);
if (fd >= 0)
{
......@@ -309,12 +314,10 @@ void midi_oss_init(void)
}
for (i = 0; i < NSEARCH; i++)
{
int fd;
char namebuf[80];
oss_nmidioutdevs = i;
devno = i + oss_onebased;
/* try to open the device for writing */
if (i == 0)
if (devno == 0)
{
fd = open("/dev/midi", O_WRONLY | O_NDELAY);
if (fd >= 0)
......@@ -323,14 +326,14 @@ void midi_oss_init(void)
continue;
}
}
sprintf(namebuf, "/dev/midi%2.2d", i);
sprintf(namebuf, "/dev/midi%2.2d", devno);
fd = open(namebuf, O_WRONLY | O_NDELAY);
if (fd >= 0)
{
close(fd);
continue;
}
sprintf(namebuf, "/dev/midi%d", i);
sprintf(namebuf, "/dev/midi%d", devno);
fd = open(namebuf, O_WRONLY | O_NDELAY);
if (fd >= 0)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment