aboutsummaryrefslogtreecommitdiff
path: root/pd/src
diff options
context:
space:
mode:
Diffstat (limited to 'pd/src')
-rw-r--r--pd/src/d_math.c4
-rw-r--r--pd/src/m_pd.h4
-rw-r--r--pd/src/notes.txt6
-rw-r--r--pd/src/s_audio_pa.c24
-rw-r--r--pd/src/s_midi_oss.c39
5 files changed, 40 insertions, 37 deletions
diff --git a/pd/src/d_math.c b/pd/src/d_math.c
index 738f2d6c..31c6c655 100644
--- a/pd/src/d_math.c
+++ b/pd/src/d_math.c
@@ -627,7 +627,7 @@ t_int *exp_tilde_perform(t_int *w)
t_sample *out = (t_sample *)(w[2]);
int n = (int)(w[3]);
while (n--)
- *out = exp(*in1);
+ *out++ = exp(*in1++);
return (w+4);
}
@@ -720,7 +720,7 @@ t_int *abs_tilde_perform(t_int *w)
while (n--)
{
float f = *in1++;
- *out = (f >= 0 ? f : -f);
+ *out++ = (f >= 0 ? f : -f);
}
return (w+4);
}
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index 534faac0..e3504c26 100644
--- a/pd/src/m_pd.h
+++ b/pd/src/m_pd.h
@@ -10,8 +10,8 @@ extern "C" {
#define PD_MAJOR_VERSION 0
#define PD_MINOR_VERSION 42
-#define PD_BUGFIX_VERSION 4
-#define PD_TEST_VERSION ""
+#define PD_BUGFIX_VERSION 5
+#define PD_TEST_VERSION "test1"
/* old name for "MSW" flag -- we have to take it for the sake of many old
"nmakefiles" for externs, which will define NT and not MSW */
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index c11ef4e8..6c98ca0a 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -1,8 +1,10 @@
-bug: go to ~/rep/rand, start pd, use open panel to open ../mark/mark.pd - crash
---------------- dolist --------------------
-test:
+doc:
+exp~, abs~ fixes
+pd~ -ninsig 0 bug fixed
+
compile on various versions of linux
windows:
modal dialogs confuse watchdog
diff --git a/pd/src/s_audio_pa.c b/pd/src/s_audio_pa.c
index 66618d46..de5fe711 100644
--- a/pd/src/s_audio_pa.c
+++ b/pd/src/s_audio_pa.c
@@ -13,9 +13,12 @@
#include <stdlib.h>
#include <portaudio.h>
#include "s_audio_pablio.h"
+#ifdef MSW
+#include <malloc.h>
+#else
+#include <alloca.h>
+#endif
-#define MAX_PA_CHANS 32
-#define MAX_SAMPLES_PER_FRAME (MAX_PA_CHANS * DEFDACBLKSIZE)
/* LATER try to figure out how to handle default devices in portaudio;
the way s_audio.c handles them isn't going to work here. */
@@ -196,16 +199,6 @@ int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin,
/* fprintf(stderr, "open callback %d\n", (callbackfn != 0)); */
pa_init();
/* post("in %d out %d rate %d device %d", inchans, outchans, rate, deviceno); */
- if (inchans > MAX_PA_CHANS)
- {
- post("input channels reduced to maximum %d", MAX_PA_CHANS);
- inchans = MAX_PA_CHANS;
- }
- if (outchans > MAX_PA_CHANS)
- {
- post("output channels reduced to maximum %d", MAX_PA_CHANS);
- outchans = MAX_PA_CHANS;
- }
if (inchans > 0)
{
@@ -288,10 +281,15 @@ void pa_close_audio( void)
int pa_send_dacs(void)
{
- float samples[MAX_SAMPLES_PER_FRAME], *fp1, *fp2;
+ unsigned int framesize = (sizeof(float) * DEFDACBLKSIZE) *
+ (pa_inchans > pa_outchans ? pa_inchans:pa_outchans);
+ float *samples, *fp1, *fp2;
int i, j;
double timebefore;
+
+ samples = alloca(framesize);
+
timebefore = sys_getrealtime();
if ((pa_inchans && GetAudioStreamReadable(pa_stream) < DEFDACBLKSIZE) ||
(pa_outchans && GetAudioStreamWriteable(pa_stream) < DEFDACBLKSIZE))
diff --git a/pd/src/s_midi_oss.c b/pd/src/s_midi_oss.c
index e1f7c8c6..5c11bae3 100644
--- a/pd/src/s_midi_oss.c
+++ b/pd/src/s_midi_oss.c
@@ -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)
{