aboutsummaryrefslogtreecommitdiff
path: root/pd/src
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2006-09-08 23:45:31 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2006-09-08 23:45:31 +0000
commit026589c77ea733ae92c38b78fbd633bfbd0b8e94 (patch)
treecfee6b4dad7347415955e5fb8442ffbfca6256b6 /pd/src
parent018a1061ed9e619398d7d26fa54c9876b3f26d31 (diff)
Many bug fixes
svn path=/trunk/; revision=5906
Diffstat (limited to 'pd/src')
-rw-r--r--pd/src/CHANGELOG.txt129
-rw-r--r--pd/src/configure.in2
-rw-r--r--pd/src/g_bang.c4
-rw-r--r--pd/src/g_canvas.c2
-rw-r--r--pd/src/g_editor.c8
-rw-r--r--pd/src/g_hdial.c4
-rw-r--r--pd/src/g_hslider.c4
-rw-r--r--pd/src/g_numbox.c2
-rw-r--r--pd/src/g_template.c17
-rw-r--r--pd/src/g_text.c2
-rw-r--r--pd/src/g_toggle.c4
-rw-r--r--pd/src/g_vdial.c4
-rw-r--r--pd/src/g_vslider.c4
-rw-r--r--pd/src/m_pd.h2
-rw-r--r--pd/src/makefile.in1
-rw-r--r--pd/src/notes.txt193
-rw-r--r--pd/src/s_audio.c69
-rw-r--r--pd/src/s_audio_alsa.c6
-rw-r--r--pd/src/s_loader.c2
-rw-r--r--pd/src/s_main.c10
-rw-r--r--pd/src/s_midi.c31
-rw-r--r--pd/src/s_path.c2
-rw-r--r--pd/src/u_main.tk192
-rw-r--r--pd/src/x_midi.c2
24 files changed, 346 insertions, 350 deletions
diff --git a/pd/src/CHANGELOG.txt b/pd/src/CHANGELOG.txt
index 321b0bc8..ccd8641d 100644
--- a/pd/src/CHANGELOG.txt
+++ b/pd/src/CHANGELOG.txt
@@ -1,5 +1,6 @@
This file describes implementation and API changes; stuff more visible to the
-user appears in the "release notes" instead.
+user appears in the "release notes" instead. See the bottom of this file
+for original notes on source stype and organization.
0.40.0
@@ -119,4 +120,130 @@ one more improvement in jack support (guenter)
make an "nrt" flag so mac can disable pthread_setschedparam call if yu want.
+------------------- original source notes -------------
+
+0. structure definition roadmap. First, the containment tree of things
+that can be sent messages ("pure data"). (note that t_object and t_text,
+and t_graph and t_canvas, should be unified...)
+
+------------ BFFORE 0.35: ---------
+m_pd.h t_pd anything with a class
+ t_gobj "graphic object"
+ t_text text object
+g_canvas.h
+ t_glist list of graphic objects
+g_canvas.c t_canvas Pd "document"
+
+------------ AFTER 0.35: ---------
+m_pd.h t_pd anything with a class
+ t_gobj "graphic object"
+ t_text patchable object, AKA t_object
+g_canvas.h t_glist list of graphic objects, AKA t_canvas
+
+... and other structures:
+g_canvas.h t_selection -- linked list of gobjs
+ t_editor -- editor state, allocated for visible glists
+m_imp.h t_methodentry -- method handler
+ t_widgetbehavior -- class-dependent editing behavior for gobjs
+ t_parentwidgetbehavior -- objects' behavior on parent window
+ t_class -- method definitions, instance size, flags, etc.
+
+
+1. C coding style. The source should pass most "warnings" of C compilers
+(-Wall on linux, for instance; see the makefile.) Some informalities
+are intentional, for instance the loose use of function prototypes (see
+below) and uncast conversions from longer to shorter numerical formats.
+The code doesn't respect "const" yet.
+
+1.1. Prefixes in structure elements. The names of structure elements always
+have a K&R-style prefix, as in ((t_atom)x)->a_type, where the "a_" prefix
+indicates "atom." This is intended to enhance readability (although the
+convention arose from a limitation of early C compilers.) Common prefixes are
+"w_" (word), "a_" (atom), "s_" (symbol), "ob_" (object), "te_" (text object),
+"g_" (graphical object), and "gl_" (glist, a list of graphical objects). Also,
+global symbols sometimes get prefixes, as in "s_float" (the symbol whose string
+is "float). Typedefs are prefixed by "t_". Most _private_ structures, i.e.,
+structures whose definitions appear in a ".c" file, are prefixed by "x_".
+
+1.2. Function arguments. Many functions take as their first
+argument a pointer named "x", which is a pointer to a structure suggested
+by the function prefix; e.g., canvas_dirty(x, n) where "x" points to a canvas
+(t_canvas *x).
+
+1.3. Function Prototypes. Functions which are used in at least two different
+files (besides where they originate) are prototyped in the appropriate include
+file. Functions which are provided in one file and used in one other are
+prototyped right where they are used. This is just to keep the size of the
+".h" files down for readability's sake.
+
+1.4. Whacko private terminology. Some terms are lifted from other historically
+relevant programs, notably "ugen" (which is just a tilde object; see d_ugen.c.)
+
+1.5. Spacing. Tabs are 8 spaces; indentation is 4 spaces. Indenting
+curly brackets are by themselves on their own lines, as in:
+
+ if (x)
+ {
+ x = 0;
+ }
+
+Lines should fit within 80 spaces.
+
+2. Max patch-level compatibility. "Import" and "Export" functions are
+provided which aspire to strict compatibility with 0.26 patches (ISPW version),
+but which don't get anywhere close to that yet. Where possible, features
+appearing on the Mac will comeday also be provided; for instance, the connect
+message on the Mac offers segmented patch cords; these will devolve into
+straight lines in Pd. Many, many UI objects in Opcode Max will not appear in
+Pd, at least at first.
+
+3. Compatibility with Max 0.26 "externs", i.e., source-level compatibility. Pd
+objects follow the style of 0.26 objects as closely as possible, making
+exceptions in cases where the 0.26 model is clearly deficient. These are:
+
+3.1. Anything involving the MacIntosh "Handle" data type is changed to use
+char * or void * instead.
+
+3.2. Pd passes true single-precision floating-point arguments to methods;
+Max uses double.
+Typedefs are provided:
+ t_floatarg, t_intarg for arguments passed by the message system
+ t_float, t_int for the "word" union (in atoms, for example.)
+
+3.3. Badly-named entities got name changes:
+
+ w_long --> w_int (in the "union word" structure)
+
+3.4. Many library functions are renamed and have different arguments;
+I hope to provide an include file to alias them when compiling Max externs.
+
+4. Function name prefixes.
+Many function names have prefixes which indicate what "package" they belong
+to. The exceptions are:
+ typedmess, vmess, getfn, gensym (m_class.c)
+ getbytes, freebytes, resizebytes (m_memory.c)
+ post, error, bug (s_print.c)
+which are all frequently called and which don't fit into simple categories.
+Important packages are:
+(pd-gui:) pdgui -- everything
+(pd:) pd -- functions common to all "pd" objects
+ obj -- fuctions common to all "patchable" objects ala Max
+ sys -- "system" level functions
+ binbuf -- functions manipulating binbufs
+ class -- functions manipulating classes
+ (other) -- functions common to the named Pd class
+
+5. Source file prefixes.
+PD:
+s system interface
+m message system
+g graphics stuff
+d DSP objects
+x control objects
+z other
+
+PD-GUI:
+t TK front end
+
+
diff --git a/pd/src/configure.in b/pd/src/configure.in
index 08ad6204..a1ceb48e 100644
--- a/pd/src/configure.in
+++ b/pd/src/configure.in
@@ -251,7 +251,7 @@ then
-DUSEAPI_PORTAUDIO -DPA19 -DPA_USE_COREAUDIO"
if test `uname -r` = 7.9.0;
then
- MORECFLAGS="-DPA_BIG_ENDIAN -Wno-error"
+ MORECFLAGS="-DMACOSX3 -DPA_BIG_ENDIAN -Wno-error"
EXTERNTARGET=d_ppc
else
MORECFLAGS="-arch i386 -arch ppc -Wno-error"
diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c
index 7c0cc091..3a5ef4d3 100644
--- a/pd/src/g_bang.c
+++ b/pd/src/g_bang.c
@@ -433,8 +433,8 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
t_bng *x = (t_bng *)pd_new(bng_class);
int bflcol[]={-262144, -1, -1};
int a=IEM_GUI_DEFAULTSIZE;
- int ldx=0, ldy=-6;
- int fs=8;
+ int ldx=17, ldy=7;
+ int fs=10;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME,
fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
char str[144];
diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 71aa89b9..dd9dd478 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -72,7 +72,7 @@ static void glist_doupdatewindowlist(t_glist *gl, char *sbuf)
if (strlen(sbuf) + strlen(gl->gl_name->s_name) + 100 <= 1024)
{
char tbuf[1024];
- sprintf(tbuf, "{%s .x%lx} ", gl->gl_name->s_name,
+ sprintf(tbuf, "{{%s} .x%lx} ", gl->gl_name->s_name,
(t_int)canvas);
strcat(sbuf, tbuf);
}
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 1bbeacbf..8b146fc1 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -1018,11 +1018,7 @@ static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos)
if (which == 0)
canvas_properties(x);
else if (which == 2)
- {
- strcpy(pathbuf, sys_libdir->s_name);
- strcat(pathbuf, "/doc/5.reference/0.INTRO.txt");
- sys_vgui("menu_opentext %s\n", pathbuf);
- }
+ open_via_helppath("intro.pd", canvas_getdir((t_canvas *)x)->s_name);
}
#define NOMOD 0
@@ -1480,7 +1476,7 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
keynum = (av[1].a_type == A_FLOAT ? av[1].a_w.w_float : 0);
if (keynum == '\\' || keynum == '{' || keynum == '}')
{
- post("%c: dropped", (int)keynum);
+ post("keycode %d: dropped", (int)keynum);
return;
}
#if 0
diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c
index 5f37fbed..df595126 100644
--- a/pd/src/g_hdial.c
+++ b/pd/src/g_hdial.c
@@ -546,8 +546,8 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
t_hradio *x = (t_hradio *)pd_new(old? hradio_old_class : hradio_class);
int bflcol[]={-262144, -1, -1};
int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
- int ldx=0, ldy=-6, chg=1, num=8;
- int fs=8;
+ int ldx=0, ldy=-8, chg=1, num=8;
+ int fs=10;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
char str[144];
diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c
index 624f1afe..4958639a 100644
--- a/pd/src/g_hslider.c
+++ b/pd/src/g_hslider.c
@@ -526,8 +526,8 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
t_hslider *x = (t_hslider *)pd_new(hslider_class);
int bflcol[]={-262144, -1, -1};
int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE;
- int lilo=0, ldx=-2, ldy=-6, f=0, v=0, steady=1;
- int fs=8;
+ int lilo=0, ldx=-2, ldy=-8, f=0, v=0, steady=1;
+ int fs=10;
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
char str[144];
diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c
index 68e1399d..04c9c1bb 100644
--- a/pd/src/g_numbox.c
+++ b/pd/src/g_numbox.c
@@ -749,7 +749,7 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
t_my_numbox *x = (t_my_numbox *)pd_new(my_numbox_class);
int bflcol[]={-262144, -1, -1};
int w=5, h=14;
- int lilo=0, f=0, ldx=0, ldy=-6;
+ int lilo=0, f=0, ldx=0, ldy=-8;
int fs=10;
int log_height=256;
double min=-1.0e+37, max=1.0e+37,v=0.0;
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 1624e0ed..2ee67196 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -94,7 +94,7 @@ t_template *template_new(t_symbol *templatesym, int argc, t_atom *argv)
else
{
pd_error(x, "%s: no such type", newtypesym->s_name);
- return (0);
+ goto bad;
}
newn = (oldn = x->t_n) + 1;
x->t_vec = (t_dataslot *)t_resizebytes(x->t_vec,
@@ -514,7 +514,7 @@ static void *template_usetemplate(void *dummy, t_symbol *s,
/* check if there's already a template by this name. */
if ((x = (t_template *)pd_findbyclass(templatesym, template_class)))
{
- t_template *y = template_new(&s_, argc, argv);
+ t_template *y = template_new(&s_, argc, argv), *y2;
/* If the new template is the same as the old one,
there's nothing to do. */
if (!template_match(x, y))
@@ -531,7 +531,8 @@ static void *template_usetemplate(void *dummy, t_symbol *s,
/* conform everyone to the new template */
template_conform(x, y);
pd_free(&x->t_pdobj);
- template_new(templatesym, argc, argv);
+ y2 = template_new(templatesym, argc, argv);
+ y2->t_list = 0;
}
}
pd_free(&y->t_pdobj);
@@ -656,6 +657,7 @@ static void gtemplate_free(t_gtemplate *x)
{
/* get off the template's list */
t_template *t = x->x_template;
+ t_gtemplate *y;
if (x == t->t_list)
{
canvas_redrawallfortemplate(t, 2);
@@ -663,13 +665,16 @@ static void gtemplate_free(t_gtemplate *x)
{
/* if we were first on the list, and there are others on
the list, make a new template corresponding to the new
- first-on-list and replace teh existing template with it. */
- t_template *z = template_new(&s_, x->x_argc, x->x_argv);
+ first-on-list and replace the existing template with it. */
+ t_template *z = template_new(&s_,
+ x->x_next->x_argc, x->x_next->x_argv);
template_conform(t, z);
pd_free(&t->t_pdobj);
pd_free(&z->t_pdobj);
- z = template_new(x->x_sym, x->x_argc, x->x_argv);
+ z = template_new(x->x_sym, x->x_next->x_argc, x->x_next->x_argv);
z->t_list = x->x_next;
+ for (y = z->t_list; y ; y = y->x_next)
+ y->x_template = z;
}
else t->t_list = 0;
canvas_redrawallfortemplate(t, 1);
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index 3cca6b3a..a146ae91 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -902,7 +902,7 @@ static void gatom_properties(t_gobj *z, t_glist *owner)
{
t_gatom *x = (t_gatom *)z;
char buf[200];
- sprintf(buf, "pdtk_gatom_dialog %%s %d %g %g %d %s %s %s\n",
+ sprintf(buf, "pdtk_gatom_dialog %%s %d %g %g %d {%s} {%s} {%s}\n",
x->a_text.te_width, x->a_draglo, x->a_draghi,
x->a_wherelabel, gatom_escapit(x->a_label)->s_name,
gatom_escapit(x->a_symfrom)->s_name,
diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c
index efed91e2..e36be5fa 100644
--- a/pd/src/g_toggle.c
+++ b/pd/src/g_toggle.c
@@ -363,8 +363,8 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
t_toggle *x = (t_toggle *)pd_new(toggle_class);
int bflcol[]={-262144, -1, -1};
int a=IEM_GUI_DEFAULTSIZE, f=0;
- int ldx=0, ldy=-6;
- int fs=8;
+ int ldx=17, ldy=7;
+ int fs=10;
float on=0.0, nonzero=1.0;
char str[144];
diff --git a/pd/src/g_vdial.c b/pd/src/g_vdial.c
index 81e29693..3d352b35 100644
--- a/pd/src/g_vdial.c
+++ b/pd/src/g_vdial.c
@@ -550,8 +550,8 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
t_vradio *x = (t_vradio *)pd_new(old? vradio_old_class : vradio_class);
int bflcol[]={-262144, -1, -1};
int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
- int ldx=0, ldy=-6, chg=1, num=8;
- int fs=8;
+ int ldx=0, ldy=-8, chg=1, num=8;
+ int fs=10;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
char str[144];
diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c
index eba519a3..1b575dac 100644
--- a/pd/src/g_vslider.c
+++ b/pd/src/g_vslider.c
@@ -507,8 +507,8 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
t_vslider *x = (t_vslider *)pd_new(vslider_class);
int bflcol[]={-262144, -1, -1};
int w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE;
- int lilo=0, f=0, ldx=0, ldy=-8;
- int fs=8, v=0, steady=1;
+ int lilo=0, f=0, ldx=0, ldy=-9;
+ int fs=10, v=0, steady=1;
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
char str[144];
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index d6b6877f..f4426ada 100644
--- a/pd/src/m_pd.h
+++ b/pd/src/m_pd.h
@@ -11,7 +11,7 @@ extern "C" {
#define PD_MAJOR_VERSION 0
#define PD_MINOR_VERSION 40
#define PD_BUGFIX_VERSION 0
-#define PD_TEST_VERSION "test05"
+#define PD_TEST_VERSION "test07"
/* 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/makefile.in b/pd/src/makefile.in
index 4339da57..05a1ecf8 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -141,6 +141,7 @@ externs:
cd ../extra/loop~;make @EXTERNTARGET@
cd ../extra/lrshift~;make @EXTERNTARGET@
cd ../extra/pique;make @EXTERNTARGET@
+ cd ../extra/sigmund~;make @EXTERNTARGET@
BINARYMODE=@binarymode@
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index 07067182..1b614645 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -1,30 +1,25 @@
---------------- dolist --------------------
-fix:
-look again at array vis/invis conundrum, g_template.c
-subpatches appear at top left of screen regardless
-$1-args not evaluated (z.pd)
-
test:
compile on various versions of linux
windows:
modal dialogs confuse watchdog
check the right-click-on-empty-canvas
MIDI I/O (inc. sysex)
+ "-audiodev" with no args in registry can't start up?
mac:
- text paste broken
clicking on windows seems sometimes not to open them
what does OSX do when jack is compiled into Pd but not installed??
turn on paMacCore_ChangeDeviceParameters for mac (pa_mac_core.h)
+Gnome: why don't windows pop up when clicked on?
-done:
+doc:
+declare help window
openpanel directory
big-soundfile support
escaping filenames for wierdly named externs
infrastructure for adding externs in non-ascii languages
'$' patch (multiple dollar-sign expansion)
-
-doc:
-x flag for curves
object list
document env~ second argument (and why is it no less than 1/10 of first???)
@@ -35,55 +30,52 @@ document tabwrite~_start
$-expansion changed
list length
send inlet
+bug fix: list to numbox (inlet and object but object is noinlet)
+bug fix: pd $1 bug ($1 is saved as it was evaluated, not as '$1')
+flag to defeat .pdsettings
+'{' dropped better
+'[' in numbox label breaks it (Yury Sept. 3)
+more reasonable font size default for GUIs
problems:
+help browser (offer both versions?)
+look again at array vis/invis conundrum, g_template.c
+TK commands to nonexistent windows? (occasionally still happens)
+still can't detect when a window is moved or resized
open_via_path call in d_soundfile.c isn't threadsafe
-Jack interface never goes idle? (Michael Berkowski, Pd list Aug 11 2006)
crashed Pd putting vec and template in wrong order in array element of struct
-z.pd - list to numbox misbehaves (inlet and object but object is noinlet)
floor, ciel functions in expr misdeclared
-graphics updates in data sometimes don't happen?
graph names don't appear until graph moved? (invis/vis on new array/rename)
-flag to defeat .pdsettings
-'{' bug
-"-audiodev" with no args in registry can't start up in MSW
-"save as" with spaces in filename still messes up
don't filter locked click() through getrect
-better scalar hit detection (getrect is too greedy)
when retyping abstractions, offer to save dirty one
should linux stop grabbing focus on vis? Is there a way to detect whether
the mouse is in a window when it opens?
-TK commands to nonexistent windows? (occasionally still happens)
arrays that don't fit in bounds don't update (same as red rectangle problem?)
look in d_resample.pd to understand inlet~ upsampling...
patcher inlets don't deal with scalars (zbug.pd)
check if there's a problem loading libs on startup if superuser
-'[' in numbox label breaks it (Yury Sept. 3)
read xx.txt in "bad" gives warnings
-qlist - 'next 1' seems not to work
Krzysztof's qlist_next reentrancy bug
don't draw in/outlets on gui objects in graph-on-parent
-reasonable font size default for GUIs
-moving a bang toward top of window creates problem (invisible label)
get rid of messages causing renaming; try to prevent patches closing themselves.
scofo reports error on reading score1.txt
loading e-mailed patches without removing headers crashes pd
-pd $1 bug ($1 is saved as it was evaluated, not as '$1')
check if _vsnprintf with zero argument in windows works any better...
detect adc~ and dac~ reblocking
features:
-sprout inlet for "route", "sel" if one arg; also send
-list length and nth functions
-poly inlet to turn stealing on/off
-.dll to .msw32 or .pd_msw (then offer .pd_msw64, .pd_lnx64, etc.)
+flag to defeat .pdsettings
+externs able to usurp built-ins (+mem alignment for SSE)
+replace gatom_escapit with a quoting mechanism (handle '[', spaces, etc.)
+sprout inlet for "route", "sel" if one arg
+more list functions (see x_list.c)
+poly inlet to turn stealing on/off, plus mode to handle note-with-duration
integrate video into tilde objects
graph "hide name" flag controllable from dialog
-flag to suppress scrollbars in canvases
+"installation mode" - turn off Pd window, accelerators, menu bars, scrollbars
fix copyright notices
pixel font sizes
pd to find running ones (pd -new to defeat)
-rename windowname-pd instead of pd-windowname
tables:
if there's just one array, don't do stringent hit check.
array click protection (Krzysztof's suggestion)
@@ -92,7 +84,6 @@ tables:
flag to hide array names
think of a way to embed abstractions in a patch
make watchdog work for MACOSX
-search path to include both calling patch and abstraction, if different
pasting should look at current mouse location
delete-in-rectangle message to Pds
put serial object in main dist (see rat@telecoma, Apr. 25; winfried May 22)
@@ -100,7 +91,7 @@ open/save panel to take messages to init directory, and to set extent list
flags to defeat pre-loading specified classes
expr to parse exponential notation
pipe to handle symbols&pointers (just takes floats now???)
-use snd_pcm_poll_descriptors_count, etc., to set alsa FDs CLOEXEC?
+fix "system" (google CLOEXEC alsa)
editing:
"enter" into object box to create new one (also, change border? forking?)
tab to jump to a connected object (first one?) (shift-tab to back up?)
@@ -112,7 +103,7 @@ editing:
(also, a way to make multiple connections?)
data:
-hook for table mousing
+hooks for table mousing, other changes (scalars?)
data to save as succession of "list" messages that textfile can store, etc.
implement list field (GOP or subwindow, perhaps GOP could suppress bounds rect?)
fix blue selection rectangle to update if selected datum is redrawn
@@ -120,12 +111,10 @@ data copy/paste doesn't check templates aren't changed
arrays of non-existent templates crash
vget, vset traversal objects
cursor to show (x, y) location
-typing at drawnumbers
-test and debug list elements of templates
+improve typing at drawnumbers
sublists should display on parent if desired? (new drawing instruction)
+test and debug list elements of templates
sublists seem not to handle canvas allocation right (get.pd->pointer.pd bug)
-scalar hook to catch the mouse
-protect against "plots" going away while you drag on them
append doesn't do symbols yet.
more features:
@@ -136,7 +125,6 @@ search for -mcpu=cpu-type in man gcc.
-Wno-unused to -Wno-unused-paramter and clean up unused automatic variables
security module system in 2.6 - see the kernel module replacing jackstart
signal inlets to sense signals; fix +~ etc, vcf~, biquad~, other filters
-mess with RME ALSA some more; ALSA readn doesn't work yet; use mmap?
try to reduce startup time
investigate gcc 3.3 warnings; try to reinstate -fstrict-aliasing
message dialog not to disappear
@@ -144,7 +132,6 @@ why does changing the name of an explode in jupiter patch take so long?
close-subwindows menu item
show results of opening audio and MIDI on dialogs
windows escape from control-C
-settable netsend and netreceive port numbers
new: abs~, nexttick~, extend threshold~ and snapshot~ (vthreshold~ etc)
incorporate pddp doc
try again to fix the font scene
@@ -153,25 +140,20 @@ look at prctl(2) for FP exception handling
netsend separate thread
netreceive (and netsend?) message to set port number
graph_vis() to decorate graphs when they're toplevel (parent_glist == 0)
-suita.chopin.edu.pl/~czaja/miXed/externs/xeq.html -- MIDI file reader
in glist_delete, consider why this can't be just "vis 0" -- why do we need it?
closebang
check that -blocksize really reflects in audiobuf calc for Hammerfall
makefile to have make install depend on make local.
-Float method for random
put in something for tilde order forcing
extensible "toolbar" so people can add external GUI objects
variable send and receive -- check how max/MSP does it?
number boxes to darken for typing and/or received messages
-pique~ and fiddle~ unification (notice pique filtering is different!)
new message box look
figure out what to do when "pd sym" conflicts with window title as in Pluton?
bonk~ file path handling
-unify arrays and garrays
dialog to give values of $1, ... for the canvas
bang at end of line~, tabwrite~, etc.
recording to part of a table
-printout to main window
should sys_bail kill all "threads" on the way out?
check a_valid usage
allow backslashes (or else really disallow them)
@@ -186,128 +168,3 @@ get gui to notice early EOF
rewrite t_getbytes properly
obj_new should do a longjmp on out-of-memory
---------------------- source notes --------------------------
-
-0. structure definition roadmap. First, the containment tree of things
-that can be sent messages ("pure data"). (note that t_object and t_text,
-and t_graph and t_canvas, should be unified...)
-
------------- BFFORE 0.35: ---------
-m_pd.h t_pd anything with a class
- t_gobj "graphic object"
- t_text text object
-g_canvas.h
- t_glist list of graphic objects
-g_canvas.c t_canvas Pd "document"
-
------------- AFTER 0.35: ---------
-m_pd.h t_pd anything with a class
- t_gobj "graphic object"
- t_text patchable object, AKA t_object
-g_canvas.h t_glist list of graphic objects, AKA t_canvas
-
-... and other structures:
-g_canvas.h t_selection -- linked list of gobjs
- t_editor -- editor state, allocated for visible glists
-m_imp.h t_methodentry -- method handler
- t_widgetbehavior -- class-dependent editing behavior for gobjs
- t_parentwidgetbehavior -- objects' behavior on parent window
- t_class -- method definitions, instance size, flags, etc.
-
-
-1. C coding style. The source should pass most "warnings" of C compilers
-(-Wall on linux, for instance; see the makefile.) Some informalities
-are intentional, for instance the loose use of function prototypes (see
-below) and uncast conversions from longer to shorter numerical formats.
-The code doesn't respect "const" yet.
-
-1.1. Prefixes in structure elements. The names of structure elements always
-have a K&R-style prefix, as in ((t_atom)x)->a_type, where the "a_" prefix
-indicates "atom." This is intended to enhance readability (although the
-convention arose from a limitation of early C compilers.) Common prefixes are
-"w_" (word), "a_" (atom), "s_" (symbol), "ob_" (object), "te_" (text object),
-"g_" (graphical object), and "gl_" (glist, a list of graphical objects). Also,
-global symbols sometimes get prefixes, as in "s_float" (the symbol whose string
-is "float). Typedefs are prefixed by "t_". Most _private_ structures, i.e.,
-structures whose definitions appear in a ".c" file, are prefixed by "x_".
-
-1.2. Function arguments. Many functions take as their first
-argument a pointer named "x", which is a pointer to a structure suggested
-by the function prefix; e.g., canvas_dirty(x, n) where "x" points to a canvas
-(t_canvas *x).
-
-1.3. Function Prototypes. Functions which are used in at least two different
-files (besides where they originate) are prototyped in the appropriate include
-file. Functions which are provided in one file and used in one other are
-prototyped right where they are used. This is just to keep the size of the
-".h" files down for readability's sake.
-
-1.4. Whacko private terminology. Some terms are lifted from other historically
-relevant programs, notably "ugen" (which is just a tilde object; see d_ugen.c.)
-
-1.5. Spacing. Tabs are 8 spaces; indentation is 4 spaces. Indenting
-curly brackets are by themselves on their own lines, as in:
-
- if (x)
- {
- x = 0;
- }
-
-Lines should fit within 80 spaces.
-
-2. Max patch-level compatibility. "Import" and "Export" functions are
-provided which aspire to strict compatibility with 0.26 patches (ISPW version),
-but which don't get anywhere close to that yet. Where possible, features
-appearing on the Mac will comeday also be provided; for instance, the connect
-message on the Mac offers segmented patch cords; these will devolve into
-straight lines in Pd. Many, many UI objects in Opcode Max will not appear in
-Pd, at least at first.
-
-3. Compatibility with Max 0.26 "externs", i.e., source-level compatibility. Pd
-objects follow the style of 0.26 objects as closely as possible, making
-exceptions in cases where the 0.26 model is clearly deficient. These are:
-
-3.1. Anything involving the MacIntosh "Handle" data type is changed to use
-char * or void * instead.
-
-3.2. Pd passes true single-precision floating-point arguments to methods;
-Max uses double.
-Typedefs are provided:
- t_floatarg, t_intarg for arguments passed by the message system
- t_float, t_int for the "word" union (in atoms, for example.)
-
-3.3. Badly-named entities got name changes:
-
- w_long --> w_int (in the "union word" structure)
-
-3.4. Many library functions are renamed and have different arguments;
-I hope to provide an include file to alias them when compiling Max externs.
-
-4. Function name prefixes.
-Many function names have prefixes which indicate what "package" they belong
-to. The exceptions are:
- typedmess, vmess, getfn, gensym (m_class.c)
- getbytes, freebytes, resizebytes (m_memory.c)
- post, error, bug (s_print.c)
-which are all frequently called and which don't fit into simple categories.
-Important packages are:
-(pd-gui:) pdgui -- everything
-(pd:) pd -- functions common to all "pd" objects
- obj -- fuctions common to all "patchable" objects ala Max
- sys -- "system" level functions
- binbuf -- functions manipulating binbufs
- class -- functions manipulating classes
- (other) -- functions common to the named Pd class
-
-5. Source file prefixes.
-PD:
-s system interface
-m message system
-g graphics stuff
-d DSP objects
-x control objects
-z other
-
-PD-GUI:
-t TK front end
-
diff --git a/pd/src/s_audio.c b/pd/src/s_audio.c
index 8d4683f8..086ca490 100644
--- a/pd/src/s_audio.c
+++ b/pd/src/s_audio.c
@@ -170,7 +170,8 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
{
int i, *ip;
int defaultchannels = SYS_DEFAULTCH;
- int inchans, outchans;
+ int inchans, outchans, nrealindev, nrealoutdev;
+ int realindev[MAXAUDIOINDEV], realoutdev[MAXAUDIOOUTDEV];
int realinchans[MAXAUDIOINDEV], realoutchans[MAXAUDIOOUTDEV];
char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
@@ -296,10 +297,22 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
}
/* count total number of input and output channels */
- for (i = inchans = 0; i < naudioindev; i++)
- inchans += (realinchans[i] = (chindev[i] > 0 ? chindev[i] : 0));
- for (i = outchans = 0; i < naudiooutdev; i++)
- outchans += (realoutchans[i] = (choutdev[i] > 0 ? choutdev[i] : 0));
+ for (i = nrealindev = inchans = 0; i < naudioindev; i++)
+ if (chindev[i] > 0)
+ {
+ realinchans[nrealindev] = chindev[i];
+ realindev[nrealindev] = audioindev[i];
+ inchans += chindev[i];
+ nrealindev++;
+ }
+ for (i = nrealoutdev = outchans = 0; i < naudiooutdev; i++)
+ if (choutdev[i] > 0)
+ {
+ realoutchans[nrealoutdev] = choutdev[i];
+ realoutdev[nrealoutdev] = audiooutdev[i];
+ outchans += choutdev[i];
+ nrealoutdev++;
+ }
/* if no input or output devices seem to have been specified,
this really means just disable audio, which we now do. */
if (!inchans && !outchans)
@@ -322,23 +335,23 @@ else
#endif
#ifdef USEAPI_JACK
if (sys_audioapi == API_JACK)
- jack_open_audio((naudioindev > 0 ? realinchans[0] : 0),
- (naudiooutdev > 0 ? realoutchans[0] : 0), rate);
+ jack_open_audio((nrealindev > 0 ? realinchans[0] : 0),
+ (nrealoutdev > 0 ? realoutchans[0] : 0), rate);
else
#endif
#ifdef USEAPI_OSS
if (sys_audioapi == API_OSS)
- oss_open_audio(naudioindev, audioindev, nchindev, realinchans,
- naudiooutdev, audiooutdev, nchoutdev, realoutchans, rate);
+ oss_open_audio(nrealindev, realindev, nrealindev, realinchans,
+ nrealoutdev, realoutdev, nrealoutdev, realoutchans, rate);
else
#endif
#ifdef USEAPI_ALSA
/* for alsa, only one device is supported; it may
be open for both input and output. */
if (sys_audioapi == API_ALSA)
- alsa_open_audio(naudioindev, audioindev, nchindev, realinchans,
- naudiooutdev, audiooutdev, nchoutdev, realoutchans, rate);
+ alsa_open_audio(nrealindev, audioindev, nrealindev, realinchans,
+ nrealoutdev, audiooutdev, nrealoutdev, realoutchans, rate);
else
#endif
#ifdef USEAPI_SGI
@@ -354,8 +367,8 @@ else
#endif
#ifdef USEAPI_MMIO
if (sys_audioapi == API_MMIO)
- mmio_open_audio(naudioindev, audioindev, nchindev, realinchans,
- naudiooutdev, audiooutdev, nchoutdev, realoutchans, rate);
+ mmio_open_audio(nrealindev, audioindev, nrealindev, realinchans,
+ nrealoutdev, audiooutdev, nrealoutdev, realoutchans, rate);
else
#endif
post("unknown audio API specified");
@@ -638,29 +651,18 @@ void glob_audio_properties(t_pd *dummy, t_floatarg flongform)
char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
int nindevs = 0, noutdevs = 0, canmulti = 0, i;
- char indevliststring[MAXNDEV*(DEVDESCSIZE+4)+80],
- outdevliststring[MAXNDEV*(DEVDESCSIZE+4)+80];
-
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti,
MAXNDEV, DEVDESCSIZE);
- strcpy(indevliststring, "{");
+ sys_gui("set audio_indevlist {}\n");
for (i = 0; i < nindevs; i++)
- {
- strcat(indevliststring, "\"");
- strcat(indevliststring, indevlist + i * DEVDESCSIZE);
- strcat(indevliststring, "\" ");
- }
- strcat(indevliststring, "}");
+ sys_vgui("lappend audio_indevlist \"%s\"\n",
+ indevlist + i * DEVDESCSIZE);
- strcpy(outdevliststring, "{");
+ sys_gui("set audio_outdevlist {}\n");
for (i = 0; i < noutdevs; i++)
- {
- strcat(outdevliststring, "\"");
- strcat(outdevliststring, outdevlist + i * DEVDESCSIZE);
- strcat(outdevliststring, "\" ");
- }
- strcat(outdevliststring, "}");
+ sys_vgui("lappend audio_outdevlist \"%s\"\n",
+ outdevlist + i * DEVDESCSIZE);
sys_get_audio_params(&naudioindev, audioindev, chindev,
&naudiooutdev, audiooutdev, choutdev, &rate, &advance);
@@ -670,7 +672,6 @@ void glob_audio_properties(t_pd *dummy, t_floatarg flongform)
if (naudioindev > 1 || naudiooutdev > 1)
flongform = 1;
-
audioindev1 = (naudioindev > 0 && audioindev[0]>= 0 ? audioindev[0] : 0);
audioindev2 = (naudioindev > 1 && audioindev[1]>= 0 ? audioindev[1] : 0);
audioindev3 = (naudioindev > 2 && audioindev[2]>= 0 ? audioindev[2] : 0);
@@ -689,13 +690,11 @@ void glob_audio_properties(t_pd *dummy, t_floatarg flongform)
audiooutchan4 = (naudiooutdev > 3 ? choutdev[3] : 0);
sprintf(buf,
"pdtk_audio_dialog %%s \
-%s %d %d %d %d %d %d %d %d \
-%s %d %d %d %d %d %d %d %d \
+%d %d %d %d %d %d %d %d \
+%d %d %d %d %d %d %d %d \
%d %d %d %d\n",
- indevliststring,
audioindev1, audioindev2, audioindev3, audioindev4,
audioinchan1, audioinchan2, audioinchan3, audioinchan4,
- outdevliststring,
audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4,
audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4,
rate, advance, canmulti, (flongform != 0));
diff --git a/pd/src/s_audio_alsa.c b/pd/src/s_audio_alsa.c
index eb9bdc10..83530de9 100644
--- a/pd/src/s_audio_alsa.c
+++ b/pd/src/s_audio_alsa.c
@@ -37,6 +37,8 @@
static void alsa_checkiosync( void);
static void alsa_numbertoname(int iodev, char *devname, int nchar);
+static int alsa_jittermax;
+#define ALSA_DEFJITTERMAX 3
/* don't assume we can turn all 31 bits when doing float-to-fix;
otherwise some audio drivers (e.g. Midiman/ALSA) wrap around. */
@@ -240,6 +242,7 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
/* save our belief as to ALSA's buffer size for later */
alsa_buf_samps = nfrags * frag_size;
alsa_nindev = alsa_noutdev = 0;
+ alsa_jittermax = ALSA_DEFJITTERMAX;
if (sys_verbose)
post("audio buffer set to %d", (int)(0.001 * sys_schedadvance));
@@ -655,6 +658,7 @@ static void alsa_checkiosync( void)
if (giveup-- <= 0)
{
post("tried but couldn't sync A/D/A");
+ alsa_jittermax += 1;
return;
}
minphase = 0x7fffffff;
@@ -712,7 +716,7 @@ static void alsa_checkiosync( void)
equal; but since we only make corrections DEFDACBLKSIZE samples
at a time, we just ask that the spread be not more than 3/4
of a block. */
- if (maxphase <= minphase + (3 * DEFDACBLKSIZE / 4))
+ if (maxphase <= minphase + (alsa_jittermax * (DEFDACBLKSIZE / 4)))
break;
if (!alreadylogged)
diff --git a/pd/src/s_loader.c b/pd/src/s_loader.c
index 159be4bf..b72d799b 100644
--- a/pd/src/s_loader.c
+++ b/pd/src/s_loader.c
@@ -42,7 +42,7 @@ static char sys_dllextent[] = ".l_i386", sys_dllextent2[] = ".pd_linux";
#endif
#endif
#ifdef MACOSX
-#ifdef __i386__
+#ifndef MACOSX3
static char sys_dllextent[] = ".d_fat", sys_dllextent2[] = ".pd_darwin";
#else
static char sys_dllextent[] = ".d_ppc", sys_dllextent2[] = ".pd_darwin";
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 50fde079..8c745dc4 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -256,6 +256,7 @@ static void pd_makeversion(void)
/* this is called from main() in s_entry.c */
int sys_main(int argc, char **argv)
{
+ int i, noprefs;
sys_externalschedlib = 0;
sys_extraflags = 0;
#ifdef PD_DEBUG
@@ -263,7 +264,11 @@ int sys_main(int argc, char **argv)
#endif
pd_init(); /* start the message system */
sys_findprogdir(argv[0]); /* set sys_progname, guipath */
- sys_loadpreferences(); /* load default settings */
+ for (i = noprefs = 0; i < argc; i++) /* prescan args for noprefs */
+ if (!strcmp(argv[i], "-noprefs"))
+ noprefs = 1;
+ if (!noprefs)
+ sys_loadpreferences(); /* load default settings */
#ifndef MSW
sys_rcfile(); /* parse the startup file */
#endif
@@ -387,6 +392,7 @@ static char *(usagemessage[]) = {
"-guiport <n> -- connect to pre-existing GUI over port <n>\n",
"-guicmd \"cmd...\" -- start alternatve GUI program (e.g., remote via ssh)\n",
"-send \"msg...\" -- send a message at startup, after patches are loaded\n",
+"-noprefs -- suppress loading preferences on startup\n",
#ifdef UNISTD
"-rt or -realtime -- use real-time priority\n",
"-nrt -- don't use real-time priority\n",
@@ -852,6 +858,8 @@ int sys_argparse(int argc, char **argv)
goto usage;
argc -= 2; argv += 2;
}
+ else if (!strcmp(*argv, "-noprefs")) /* did this earlier */
+ ;
else
{
unsigned int i;
diff --git a/pd/src/s_midi.c b/pd/src/s_midi.c
index 77943121..936fb282 100644
--- a/pd/src/s_midi.c
+++ b/pd/src/s_midi.c
@@ -650,29 +650,18 @@ void glob_midi_properties(t_pd *dummy, t_floatarg flongform)
char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
int nindevs = 0, noutdevs = 0, i;
- char indevliststring[MAXNDEV*(DEVDESCSIZE+4)+80],
- outdevliststring[MAXNDEV*(DEVDESCSIZE+4)+80];
-
midi_getdevs(indevlist, &nindevs, outdevlist, &noutdevs,
MAXNDEV, DEVDESCSIZE);
- strcpy(indevliststring, "{ {none} ");
+ sys_gui("set midi_indevlist {none}\n");
for (i = 0; i < nindevs; i++)
- {
- strcat(indevliststring, "\"");
- strcat(indevliststring, indevlist + i * DEVDESCSIZE);
- strcat(indevliststring, "\" ");
- }
- strcat(indevliststring, "}");
+ sys_vgui("lappend midi_indevlist \"%s\"\n",
+ indevlist + i * DEVDESCSIZE);
- strcpy(outdevliststring, "{ {none} ");
+ sys_gui("set midi_outdevlist {none}\n");
for (i = 0; i < noutdevs; i++)
- {
- strcat(outdevliststring, "\"");
- strcat(outdevliststring, outdevlist + i * DEVDESCSIZE);
- strcat(outdevliststring, "\" ");
- }
- strcat(outdevliststring, "}");
+ sys_vgui("lappend midi_outdevlist \"%s\"\n",
+ outdevlist + i * DEVDESCSIZE);
sys_get_midi_params(&nindev, midiindev, &noutdev, midioutdev);
@@ -692,22 +681,18 @@ void glob_midi_properties(t_pd *dummy, t_floatarg flongform)
if (sys_midiapi == API_ALSA)
sprintf(buf,
"pdtk_alsa_midi_dialog %%s \
-%s %d %d %d %d %s %d %d %d %d \
+%d %d %d %d %d %d %d %d \
%d 1\n",
- indevliststring,
midiindev1, midiindev2, midiindev3, midiindev4,
- outdevliststring,
midioutdev1, midioutdev2, midioutdev3, midioutdev4,
(flongform != 0));
else
#endif
sprintf(buf,
"pdtk_midi_dialog %%s \
-%s %d %d %d %d %s %d %d %d %d \
+%d %d %d %d %d %d %d %d \
%d\n",
- indevliststring,
midiindev1, midiindev2, midiindev3, midiindev4,
- outdevliststring,
midioutdev1, midioutdev2, midioutdev3, midioutdev4,
(flongform != 0));
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index 6d4d33bf..07520bcf 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -342,7 +342,7 @@ void open_via_helppath(const char *name, const char *dir)
return;
gotone:
close (fd);
- glob_evalfile(0, gensym((char*)realname), gensym(dirbuf));
+ glob_evalfile(0, gensym((char*)basename), gensym(dirbuf));
}
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index 2dacec81..e8a57f10 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -226,8 +226,11 @@ proc pdtk_enquote {x} {
}
#enquote a string to send it to Pd. Blow off semi and comma; alias spaces
+#we also blow off "{", "}", "\" because they'll just cause bad trouble later.
proc pdtk_unspace {x} {
- string map {" " "_" ";" "" "," ""} $x
+ set y [string map {" " "_" ";" "" "," "" "{" "" "}" "" "\\" ""} $x]
+ if {$y == ""} {set y "empty"}
+ concat $y
}
#enquote a string for preferences (command strings etc.)
@@ -860,7 +863,7 @@ proc pdtk_canvas_new {name width height geometry editable} {
set geometry [join $geometry +]
}
wm geometry $name $geometry
- canvas $name.c -width $width -height $height -background white \
+ canvas $name.c -width $width -height $height -background white \
-yscrollcommand "$name.scrollvert set" \
-xscrollcommand "$name.scrollhort set" \
-scrollregion [concat 0 0 $width $height]
@@ -1436,16 +1439,20 @@ proc canvastosym {name} {
set pdtk_lastcanvasconfigured ""
set pdtk_lastcanvasconfiguration ""
+set pdtk_lastcanvasconfiguration2 ""
proc pdtk_canvas_checkgeometry {topname} {
set boo [winfo geometry $topname.c]
set boo2 [wm geometry $topname]
global pdtk_lastcanvasconfigured
global pdtk_lastcanvasconfiguration
+ global pdtk_lastcanvasconfiguration2
if {$topname != $pdtk_lastcanvasconfigured || \
- $boo != $pdtk_lastcanvasconfiguration} {
+ $boo != $pdtk_lastcanvasconfiguration || \
+ $boo2 != $pdtk_lastcanvasconfiguration2} {
set pdtk_lastcanvasconfigured $topname
set pdtk_lastcanvasconfiguration $boo
+ set pdtk_lastcanvasconfiguration2 $boo2
pd $topname relocate $boo $boo2 \;
}
}
@@ -3516,9 +3523,9 @@ proc audio_popup {name buttonname varname devlist} {
# opening several devices; if not, we get an extra button to turn longform
# on and restart the dialog.
-proc pdtk_audio_dialog {id indevlist indev1 indev2 indev3 indev4 \
+proc pdtk_audio_dialog {id indev1 indev2 indev3 indev4 \
inchan1 inchan2 inchan3 inchan4 \
- outdevlist outdev1 outdev2 outdev3 outdev4 \
+ outdev1 outdev2 outdev3 outdev4 \
outchan1 outchan2 outchan3 outchan4 sr advance multi longform} {
global audio_indev1 audio_indev2 audio_indev3 audio_indev4
global audio_inchan1 audio_inchan2 audio_inchan3 audio_inchan4
@@ -3528,6 +3535,7 @@ proc pdtk_audio_dialog {id indevlist indev1 indev2 indev3 indev4 \
global audio_outenable1 audio_outenable2 audio_outenable3 audio_outenable4
global audio_sr audio_advance
global audio_indevlist audio_outdevlist
+ global pd_indev pd_outdev
set audio_indev1 $indev1
set audio_indev2 $indev2
@@ -3559,8 +3567,6 @@ proc pdtk_audio_dialog {id indevlist indev1 indev2 indev3 indev4 \
set audio_sr $sr
set audio_advance $advance
- set audio_indevlist $indevlist
- set audio_outdevlist $outdevlist
toplevel $id
wm title $id {audio}
@@ -3594,49 +3600,52 @@ proc pdtk_audio_dialog {id indevlist indev1 indev2 indev3 indev4 \
checkbutton $id.in1f.x0 -variable audio_inenable1 \
-text {input device 1} -anchor e
- button $id.in1f.x1 -text [lindex $indevlist $audio_indev1] \
- -command [list audio_popup $id $id.in1f.x1 audio_indev1 $indevlist]
+ button $id.in1f.x1 -text [lindex $audio_indevlist $audio_indev1] \
+ -command [list audio_popup $id $id.in1f.x1 audio_indev1 $audio_indevlist]
label $id.in1f.l2 -text "channels:"
entry $id.in1f.x2 -textvariable audio_inchan1 -width 3
pack $id.in1f.x0 $id.in1f.x1 $id.in1f.l2 $id.in1f.x2 -side left
# input device 2
- if {$longform && $multi > 1 && [llength $indevlist] > 1} {
+ if {$longform && $multi > 1 && [llength $audio_indevlist] > 1} {
frame $id.in2f
pack $id.in2f -side top
checkbutton $id.in2f.x0 -variable audio_inenable2 \
-text {input device 2} -anchor e
- button $id.in2f.x1 -text [lindex $indevlist $audio_indev2] \
- -command [list audio_popup $id $id.in2f.x1 audio_indev2 $indevlist]
+ button $id.in2f.x1 -text [lindex $audio_indevlist $audio_indev2] \
+ -command [list audio_popup $id $id.in2f.x1 audio_indev2 \
+ $audio_indevlist]
label $id.in2f.l2 -text "channels:"
entry $id.in2f.x2 -textvariable audio_inchan2 -width 3
pack $id.in2f.x0 $id.in2f.x1 $id.in2f.l2 $id.in2f.x2 -side left
}
# input device 3
- if {$longform && $multi > 1 && [llength $indevlist] > 2} {
+ if {$longform && $multi > 1 && [llength $audio_indevlist] > 2} {
frame $id.in3f
pack $id.in3f -side top
checkbutton $id.in3f.x0 -variable audio_inenable3 \
-text {input device 3} -anchor e
- button $id.in3f.x1 -text [lindex $indevlist $audio_indev3] \
- -command [list audio_popup $id $id.in3f.x1 audio_indev3 $indevlist]
+ button $id.in3f.x1 -text [lindex $audio_indevlist $audio_indev3] \
+ -command [list audio_popup $id $id.in3f.x1 audio_indev3 \
+ $audio_indevlist]
label $id.in3f.l2 -text "channels:"
entry $id.in3f.x2 -textvariable audio_inchan3 -width 3
pack $id.in3f.x0 $id.in3f.x1 $id.in3f.l2 $id.in3f.x2 -side left
}
# input device 4
- if {$longform && $multi > 1 && [llength $indevlist] > 3} {
+ if {$longform && $multi > 1 && [llength $audio_indevlist] > 3} {
frame $id.in4f
pack $id.in4f -side top
checkbutton $id.in4f.x0 -variable audio_inenable4 \
-text {input device 4} -anchor e
- button $id.in4f.x1 -text [lindex $indevlist $audio_indev4] \
- -command [list audio_popup $id $id.in4f.x1 audio_indev4 $indevlist]
+ button $id.in4f.x1 -text [lindex $audio_indevlist $audio_indev4] \
+ -command [list audio_popup $id $id.in4f.x1 audio_indev4 \
+ $audio_indevlist]
label $id.in4f.l2 -text "channels:"
entry $id.in4f.x2 -textvariable audio_inchan4 -width 3
pack $id.in4f.x0 $id.in4f.x1 $id.in4f.l2 $id.in4f.x2 -side left
@@ -3646,15 +3655,15 @@ proc pdtk_audio_dialog {id indevlist indev1 indev2 indev3 indev4 \
frame $id.out1f
pack $id.out1f -side top
- checkbutton $id.out1f.x0 -variable audio_outenable1 -text {output device 1} \
- -anchor e
+ checkbutton $id.out1f.x0 -variable audio_outenable1 \
+ -text {output device 1} -anchor e
if {$multi == 0} {
label $id.out1f.l1 \
-text "(same as input device) .............. "
} else {
- button $id.out1f.x1 -text [lindex $outdevlist $audio_outdev1] \
- -command \
- [list audio_popup $id $id.out1f.x1 audio_outdev1 $outdevlist]
+ button $id.out1f.x1 -text [lindex $audio_outdevlist $audio_outdev1] \
+ -command [list audio_popup $id $id.out1f.x1 audio_outdev1 \
+ $audio_outdevlist]
}
label $id.out1f.l2 -text "channels:"
entry $id.out1f.x2 -textvariable audio_outchan1 -width 3
@@ -3665,45 +3674,45 @@ proc pdtk_audio_dialog {id indevlist indev1 indev2 indev3 indev4 \
}
# output device 2
- if {$longform && $multi > 1 && [llength $indevlist] > 1} {
+ if {$longform && $multi > 1 && [llength $audio_outdevlist] > 1} {
frame $id.out2f
pack $id.out2f -side top
checkbutton $id.out2f.x0 -variable audio_outenable2 \
-text {output device 2} -anchor e
- button $id.out2f.x1 -text [lindex $outdevlist $audio_outdev2] \
+ button $id.out2f.x1 -text [lindex $audio_outdevlist $audio_outdev2] \
-command \
- [list audio_popup $id $id.out2f.x1 audio_outdev2 $outdevlist]
+ [list audio_popup $id $id.out2f.x1 audio_outdev2 $audio_outdevlist]
label $id.out2f.l2 -text "channels:"
entry $id.out2f.x2 -textvariable audio_outchan2 -width 3
pack $id.out2f.x0 $id.out2f.x1 $id.out2f.l2 $id.out2f.x2 -side left
}
# output device 3
- if {$longform && $multi > 1 && [llength $indevlist] > 2} {
+ if {$longform && $multi > 1 && [llength $audio_outdevlist] > 2} {
frame $id.out3f
pack $id.out3f -side top
checkbutton $id.out3f.x0 -variable audio_outenable3 \
-text {output device 3} -anchor e
- button $id.out3f.x1 -text [lindex $outdevlist $audio_outdev3] \
+ button $id.out3f.x1 -text [lindex $audio_outdevlist $audio_outdev3] \
-command \
- [list audio_popup $id $id.out3f.x1 audio_outdev3 $outdevlist]
+ [list audio_popup $id $id.out3f.x1 audio_outdev3 $audio_outdevlist]
label $id.out3f.l2 -text "channels:"
entry $id.out3f.x2 -textvariable audio_outchan3 -width 3
pack $id.out3f.x0 $id.out3f.x1 $id.out3f.l2 $id.out3f.x2 -side left
}
# output device 4
- if {$longform && $multi > 1 && [llength $indevlist] > 3} {
+ if {$longform && $multi > 1 && [llength $audio_outdevlist] > 3} {
frame $id.out4f
pack $id.out4f -side top
checkbutton $id.out4f.x0 -variable audio_outenable4 \
-text {output device 4} -anchor e
- button $id.out4f.x1 -text [lindex $outdevlist $audio_outdev4] \
+ button $id.out4f.x1 -text [lindex $audio_outdevlist $audio_outdev4] \
-command \
- [list audio_popup $id $id.out4f.x1 audio_outdev4 $outdevlist]
+ [list audio_popup $id $id.out4f.x1 audio_outdev4 $audio_outdevlist]
label $id.out4f.l2 -text "channels:"
entry $id.out4f.x2 -textvariable audio_outchan4 -width 3
pack $id.out4f.x0 $id.out4f.x1 $id.out4f.l2 $id.out4f.x2 -side left
@@ -3736,7 +3745,8 @@ proc pdtk_audio_dialog {id indevlist indev1 indev2 indev3 indev4 \
proc midi_apply {id} {
global midi_indev1 midi_indev2 midi_indev3 midi_indev4
- global midi_outdev1 midi_outdev2 midi_outdev3 midi_outdev4 midi_alsain midi_alsaout
+ global midi_outdev1 midi_outdev2 midi_outdev3 midi_outdev4
+ global midi_alsain midi_alsaout
pd [concat pd midi-dialog \
$midi_indev1 \
@@ -3785,8 +3795,8 @@ proc midi_popup {name buttonname varname devlist} {
# start a dialog window to select midi devices. "longform" asks us to make
# controls for opening several devices; if not, we get an extra button to
# turn longform on and restart the dialog.
-proc pdtk_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
- outdevlist outdev1 outdev2 outdev3 outdev4 longform} {
+proc pdtk_midi_dialog {id indev1 indev2 indev3 indev4 \
+ outdev1 outdev2 outdev3 outdev4 longform} {
global midi_indev1 midi_indev2 midi_indev3 midi_indev4
global midi_outdev1 midi_outdev2 midi_outdev3 midi_outdev4
global midi_indevlist midi_outdevlist
@@ -3800,10 +3810,8 @@ proc pdtk_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
set midi_outdev2 $outdev2
set midi_outdev3 $outdev3
set midi_outdev4 $outdev4
- set midi_indevlist $indevlist
- set midi_outdevlist $outdevlist
- set midi_alsain [llength $indevlist]
- set midi_alsaout [llength $outdevlist]
+ set midi_alsain [llength $midi_indevlist]
+ set midi_alsaout [llength $midi_outdevlist]
toplevel $id
wm title $id {midi}
@@ -3826,40 +3834,43 @@ proc pdtk_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
pack $id.in1f -side top
label $id.in1f.l1 -text "input device 1:"
- button $id.in1f.x1 -text [lindex $indevlist $midi_indev1] \
- -command [list midi_popup $id $id.in1f.x1 midi_indev1 $indevlist]
+ button $id.in1f.x1 -text [lindex $midi_indevlist $midi_indev1] \
+ -command [list midi_popup $id $id.in1f.x1 midi_indev1 $midi_indevlist]
pack $id.in1f.l1 $id.in1f.x1 -side left
# input device 2
- if {$longform && [llength $indevlist] > 2} {
+ if {$longform && [llength $midi_indevlist] > 2} {
frame $id.in2f
pack $id.in2f -side top
label $id.in2f.l1 -text "input device 2:"
- button $id.in2f.x1 -text [lindex $indevlist $midi_indev2] \
- -command [list midi_popup $id $id.in2f.x1 midi_indev2 $indevlist]
+ button $id.in2f.x1 -text [lindex $midi_indevlist $midi_indev2] \
+ -command [list midi_popup $id $id.in2f.x1 midi_indev2 \
+ $midi_indevlist]
pack $id.in2f.l1 $id.in2f.x1 -side left
}
# input device 3
- if {$longform && [llength $indevlist] > 3} {
+ if {$longform && [llength $midi_indevlist] > 3} {
frame $id.in3f
pack $id.in3f -side top
label $id.in3f.l1 -text "input device 3:"
- button $id.in3f.x1 -text [lindex $indevlist $midi_indev3] \
- -command [list midi_popup $id $id.in3f.x1 midi_indev3 $indevlist]
+ button $id.in3f.x1 -text [lindex $midi_indevlist $midi_indev3] \
+ -command [list midi_popup $id $id.in3f.x1 midi_indev3 \
+ $midi_indevlist]
pack $id.in3f.l1 $id.in3f.x1 -side left
}
# input device 4
- if {$longform && [llength $indevlist] > 4} {
+ if {$longform && [llength $midi_indevlist] > 4} {
frame $id.in4f
pack $id.in4f -side top
label $id.in4f.l1 -text "input device 4:"
- button $id.in4f.x1 -text [lindex $indevlist $midi_indev4] \
- -command [list midi_popup $id $id.in4f.x1 midi_indev4 $indevlist]
+ button $id.in4f.x1 -text [lindex $midi_indevlist $midi_indev4] \
+ -command [list midi_popup $id $id.in4f.x1 midi_indev4 \
+ $midi_indevlist]
pack $id.in4f.l1 $id.in4f.x1 -side left
}
@@ -3868,40 +3879,41 @@ proc pdtk_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
frame $id.out1f
pack $id.out1f -side top
label $id.out1f.l1 -text "output device 1:"
- button $id.out1f.x1 -text [lindex $outdevlist $midi_outdev1] \
- -command [list midi_popup $id $id.out1f.x1 midi_outdev1 $outdevlist]
+ button $id.out1f.x1 -text [lindex $midi_outdevlist $midi_outdev1] \
+ -command [list midi_popup $id $id.out1f.x1 midi_outdev1 \
+ $midi_outdevlist]
pack $id.out1f.l1 $id.out1f.x1 -side left
# output device 2
- if {$longform && [llength $indevlist] > 2} {
+ if {$longform && [llength $midi_outdevlist] > 2} {
frame $id.out2f
pack $id.out2f -side top
label $id.out2f.l1 -text "output device 2:"
- button $id.out2f.x1 -text [lindex $outdevlist $midi_outdev2] \
+ button $id.out2f.x1 -text [lindex $midi_outdevlist $midi_outdev2] \
-command \
- [list midi_popup $id $id.out2f.x1 midi_outdev2 $outdevlist]
+ [list midi_popup $id $id.out2f.x1 midi_outdev2 $midi_outdevlist]
pack $id.out2f.l1 $id.out2f.x1 -side left
}
# output device 3
- if {$longform && [llength $indevlist] > 3} {
+ if {$longform && [llength $midi_midi_outdevlist] > 3} {
frame $id.out3f
pack $id.out3f -side top
label $id.out3f.l1 -text "output device 3:"
- button $id.out3f.x1 -text [lindex $outdevlist $midi_outdev3] \
+ button $id.out3f.x1 -text [lindex $midi_outdevlist $midi_outdev3] \
-command \
- [list midi_popup $id $id.out3f.x1 midi_outdev3 $outdevlist]
+ [list midi_popup $id $id.out3f.x1 midi_outdev3 $midi_outdevlist]
pack $id.out3f.l1 $id.out3f.x1 -side left
}
# output device 4
- if {$longform && [llength $indevlist] > 4} {
+ if {$longform && [llength $midi_midi_outdevlist] > 4} {
frame $id.out4f
pack $id.out4f -side top
label $id.out4f.l1 -text "output device 4:"
- button $id.out4f.x1 -text [lindex $outdevlist $midi_outdev4] \
+ button $id.out4f.x1 -text [lindex $midi_outdevlist $midi_outdev4] \
-command \
- [list midi_popup $id $id.out4f.x1 midi_outdev4 $outdevlist]
+ [list midi_popup $id $id.out4f.x1 midi_outdev4 $midi_outdevlist]
pack $id.out4f.l1 $id.out4f.x1 -side left
}
@@ -3917,8 +3929,8 @@ proc pdtk_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
}
}
-proc pdtk_alsa_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
- outdevlist outdev1 outdev2 outdev3 outdev4 longform alsa} {
+proc pdtk_alsa_midi_dialog {id indev1 indev2 indev3 indev4 \
+ outdev1 outdev2 outdev3 outdev4 longform alsa} {
global midi_indev1 midi_indev2 midi_indev3 midi_indev4
global midi_outdev1 midi_outdev2 midi_outdev3 midi_outdev4
global midi_indevlist midi_outdevlist
@@ -3932,10 +3944,8 @@ proc pdtk_alsa_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
set midi_outdev2 $outdev2
set midi_outdev3 $outdev3
set midi_outdev4 $outdev4
- set midi_indevlist $indevlist
- set midi_outdevlist $outdevlist
- set midi_alsain [llength $indevlist]
- set midi_alsaout [llength $outdevlist]
+ set midi_alsain [llength $midi_indevlist]
+ set midi_alsaout [llength $midi_outdevlist]
toplevel $id
wm title $id {midi}
@@ -3959,40 +3969,43 @@ proc pdtk_alsa_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
if {$alsa == 0} {
# input device 1
label $id.in1f.l1 -text "input device 1:"
- button $id.in1f.x1 -text [lindex $indevlist $midi_indev1] \
- -command [list midi_popup $id $id.in1f.x1 midi_indev1 $indevlist]
+ button $id.in1f.x1 -text [lindex $midi_indevlist $midi_indev1] \
+ -command [list midi_popup $id $id.in1f.x1 midi_indev1 $midi_indevlist]
pack $id.in1f.l1 $id.in1f.x1 -side left
# input device 2
- if {$longform && [llength $indevlist] > 2} {
+ if {$longform && [llength $midi_indevlist] > 2} {
frame $id.in2f
pack $id.in2f -side top
label $id.in2f.l1 -text "input device 2:"
- button $id.in2f.x1 -text [lindex $indevlist $midi_indev2] \
- -command [list midi_popup $id $id.in2f.x1 midi_indev2 $indevlist]
+ button $id.in2f.x1 -text [lindex $midi_indevlist $midi_indev2] \
+ -command [list midi_popup $id $id.in2f.x1 midi_indev2 \
+ $midi_indevlist]
pack $id.in2f.l1 $id.in2f.x1 -side left
}
# input device 3
- if {$longform && [llength $indevlist] > 3} {
+ if {$longform && [llength $midi_indevlist] > 3} {
frame $id.in3f
pack $id.in3f -side top
label $id.in3f.l1 -text "input device 3:"
- button $id.in3f.x1 -text [lindex $indevlist $midi_indev3] \
- -command [list midi_popup $id $id.in3f.x1 midi_indev3 $indevlist]
+ button $id.in3f.x1 -text [lindex $midi_indevlist $midi_indev3] \
+ -command [list midi_popup $id $id.in3f.x1 midi_indev3 \
+ $midi_indevlist]
pack $id.in3f.l1 $id.in3f.x1 -side left
}
# input device 4
- if {$longform && [llength $indevlist] > 4} {
+ if {$longform && [llength $midi_indevlist] > 4} {
frame $id.in4f
pack $id.in4f -side top
label $id.in4f.l1 -text "input device 4:"
- button $id.in4f.x1 -text [lindex $indevlist $midi_indev4] \
- -command [list midi_popup $id $id.in4f.x1 midi_indev4 $indevlist]
+ button $id.in4f.x1 -text [lindex $midi_indevlist $midi_indev4] \
+ -command [list midi_popup $id $id.in4f.x1 midi_indev4 \
+ $midi_indevlist]
pack $id.in4f.l1 $id.in4f.x1 -side left
}
@@ -4001,40 +4014,41 @@ proc pdtk_alsa_midi_dialog {id indevlist indev1 indev2 indev3 indev4 \
frame $id.out1f
pack $id.out1f -side top
label $id.out1f.l1 -text "output device 1:"
- button $id.out1f.x1 -text [lindex $outdevlist $midi_outdev1] \
- -command [list midi_popup $id $id.out1f.x1 midi_outdev1 $outdevlist]
+ button $id.out1f.x1 -text [lindex $midi_outdevlist $midi_outdev1] \
+ -command [list midi_popup $id $id.out1f.x1 midi_outdev1 \
+ $midi_outdevlist]
pack $id.out1f.l1 $id.out1f.x1 -side left
# output device 2
- if {$longform && [llength $indevlist] > 2} {
+ if {$longform && [llength $midi_outdevlist] > 2} {
frame $id.out2f
pack $id.out2f -side top
label $id.out2f.l1 -text "output device 2:"
- button $id.out2f.x1 -text [lindex $outdevlist $midi_outdev2] \
+ button $id.out2f.x1 -text [lindex $midi_outdevlist $midi_outdev2] \
-command \
- [list midi_popup $id $id.out2f.x1 midi_outdev2 $outdevlist]
+ [list midi_popup $id $id.out2f.x1 midi_outdev2 $midi_outdevlist]
pack $id.out2f.l1 $id.out2f.x1 -side left
}
# output device 3
- if {$longform && [llength $indevlist] > 3} {
+ if {$longform && [llength $midi_outdevlist] > 3} {
frame $id.out3f
pack $id.out3f -side top
label $id.out3f.l1 -text "output device 3:"
- button $id.out3f.x1 -text [lindex $outdevlist $midi_outdev3] \
+ button $id.out3f.x1 -text [lindex $midi_outdevlist $midi_outdev3] \
-command \
- [list midi_popup $id $id.out3f.x1 midi_outdev3 $outdevlist]
+ [list midi_popup $id $id.out3f.x1 midi_outdev3 $midi_outdevlist]
pack $id.out3f.l1 $id.out3f.x1 -side left
}
# output device 4
- if {$longform && [llength $indevlist] > 4} {
+ if {$longform && [llength $midi_outdevlist] > 4} {
frame $id.out4f
pack $id.out4f -side top
label $id.out4f.l1 -text "output device 4:"
- button $id.out4f.x1 -text [lindex $outdevlist $midi_outdev4] \
+ button $id.out4f.x1 -text [lindex $midi_outdevlist $midi_outdev4] \
-command \
- [list midi_popup $id $id.out4f.x1 midi_outdev4 $outdevlist]
+ [list midi_popup $id $id.out4f.x1 midi_outdev4 $midi_outdevlist]
pack $id.out4f.l1 $id.out4f.x1 -side left
}
diff --git a/pd/src/x_midi.c b/pd/src/x_midi.c
index ad1429a8..b985041d 100644
--- a/pd/src/x_midi.c
+++ b/pd/src/x_midi.c
@@ -648,7 +648,7 @@ void inmidi_realtimein(int portno, int SysMsg)
t_atom at[2];
SETFLOAT(at, portno);
SETFLOAT(at+1, SysMsg);
- pd_list(midirealtimein_sym->s_thing, &s_list, 1, at);
+ pd_list(midirealtimein_sym->s_thing, &s_list, 2, at);
}
}