Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
purr-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nerrons
purr-data
Commits
9660f00c
Commit
9660f00c
authored
16 years ago
by
Miller Puckette
Browse files
Options
Downloads
Patches
Plain Diff
pd~ fixed not to open subprocess at startup
parent
cac87d21
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
extra/pd~/pd~-help.pd
+7
-1
7 additions, 1 deletion
extra/pd~/pd~-help.pd
extra/pd~/pd~.c
+70
-10
70 additions, 10 deletions
extra/pd~/pd~.c
with
77 additions
and
11 deletions
extra/pd~/pd~-help.pd
+
7
−
1
View file @
9660f00c
#N canvas 3
49 97
450 300 10;
#N canvas 3
53 325
450 300 10;
#X msg 52 86 foo bar baz;
#X obj 209 52 osc~ 440;
#X obj 74 211 env~ 8192;
...
...
@@ -7,8 +7,14 @@
#X obj 281 232 print a;
#X msg 315 81 \; pd dsp 1;
#X obj 70 166 pd~ test.pd;
#X msg 66 20 pd~ stop;
#X msg 77 42 pd~ start;
#X msg 86 61 pd~ restart;
#X connect 0 0 7 0;
#X connect 1 0 7 0;
#X connect 2 0 3 0;
#X connect 4 0 5 0;
#X connect 7 0 2 0;
#X connect 8 0 7 0;
#X connect 9 0 7 0;
#X connect 10 0 7 0;
This diff is collapsed.
Click to expand it.
extra/pd~/pd~.c
+
70
−
10
View file @
9660f00c
...
...
@@ -28,6 +28,8 @@
#include
"ext_obex.h"
typedef
double
t_floatarg
;
#define w_symbol w_sym
#define A_SYMBOL A_SYM
#define getbytes t_getbytes
#define freebytes t_freebytes
#define ERROR error(
...
...
@@ -85,6 +87,11 @@ typedef struct _pd_tilde
int
x_childpid
;
int
x_ninsig
;
int
x_noutsig
;
int
x_fifo
;
float
x_sr
;
t_symbol
*
x_pddir
;
t_symbol
*
x_schedlibdir
;
char
*
x_pdargs
;
t_sample
**
x_insig
;
t_sample
**
x_outsig
;
}
t_pd_tilde
;
...
...
@@ -192,10 +199,12 @@ static void pd_tilde_donew(t_pd_tilde *x, char *pddir, char *schedlibdir,
}
snprintf
(
cmdbuf
,
MAXPDSTRING
,
"%s -schedlib %s/pdsched %s
\n
"
,
pdexecbuf
,
schedlibdir
,
pdargs
);
#if 0
#ifdef PD
fprintf(stderr, "%s", cmdbuf);
#endif
post("cmd: %s", cmdbuf);
#endif
if
(
pipe
(
pipe1
)
<
0
)
{
ERROR
"pd~: can't create pipe"
);
...
...
@@ -356,6 +365,32 @@ static void pd_tilde_dsp(t_pd_tilde *x, t_signal **sp)
dsp_add
(
pd_tilde_perform
,
2
,
x
,
n
);
}
static
void
pd_tilde_pdtilde
(
t_pd_tilde
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
t_symbol
*
sel
=
((
argc
>
0
&&
argv
->
a_type
==
A_SYMBOL
)
?
argv
->
a_w
.
w_symbol
:
gensym
(
"?"
));
if
(
sel
==
gensym
(
"start"
))
{
if
(
!
x
->
x_infd
)
pd_tilde_donew
(
x
,
x
->
x_pddir
->
s_name
,
x
->
x_schedlibdir
->
s_name
,
x
->
x_pdargs
,
x
->
x_ninsig
,
x
->
x_noutsig
,
x
->
x_fifo
,
x
->
x_sr
);
}
else
if
(
sel
==
gensym
(
"stop"
))
{
if
(
x
->
x_infd
)
pd_tilde_close
(
x
);
}
else
if
(
sel
==
gensym
(
"restart"
))
{
if
(
x
->
x_infd
)
pd_tilde_close
(
x
);
if
(
!
x
->
x_infd
)
pd_tilde_donew
(
x
,
x
->
x_pddir
->
s_name
,
x
->
x_schedlibdir
->
s_name
,
x
->
x_pdargs
,
x
->
x_ninsig
,
x
->
x_noutsig
,
x
->
x_fifo
,
x
->
x_sr
);
}
else
ERROR
"pd~: unknown control message: %s"
,
sel
->
s_name
);
}
static
void
pd_tilde_free
(
t_pd_tilde
*
x
)
{
#ifdef MSP
...
...
@@ -363,6 +398,7 @@ static void pd_tilde_free(t_pd_tilde *x)
#endif
pd_tilde_close
(
x
);
clock_free
(
x
->
x_clock
);
free
(
x
->
x_pdargs
);
}
/* -------------------------- Pd glue ------------------------- */
...
...
@@ -372,7 +408,10 @@ static void pd_tilde_tick(t_pd_tilde *x)
{
int
messstart
=
0
,
i
,
n
;
t_atom
*
vec
;
t_binbuf
*
b
=
binbuf_new
();
t_binbuf
*
b
;
if
(
!
x
->
x_msgbuf
)
return
;
b
=
binbuf_new
();
binbuf_text
(
b
,
x
->
x_msgbuf
,
x
->
x_infill
);
/* binbuf_print(b); */
n
=
binbuf_getnatom
(
b
);
...
...
@@ -489,24 +528,33 @@ static void *pd_tilde_new(t_symbol *s, int argc, t_atom *argv)
x
->
x_outsig
=
(
t_sample
**
)
getbytes
(
noutsig
*
sizeof
(
*
x
->
x_outsig
));
x
->
x_ninsig
=
ninsig
;
x
->
x_noutsig
=
noutsig
;
x
->
x_fifo
=
fifo
;
x
->
x_sr
=
sr
;
x
->
x_pddir
=
pddir
;
x
->
x_schedlibdir
=
scheddir
;
x
->
x_pdargs
=
malloc
(
strlen
(
pdargstring
)
+
1
);
x
->
x_infd
=
0
;
x
->
x_outfd
=
0
;
x
->
x_outfd
=
0
;
x
->
x_childpid
=
-
1
;
x
->
x_msgbuf
=
0
;
strcpy
(
x
->
x_pdargs
,
pdargstring
);
for
(
j
=
1
,
g
=
x
->
x_insig
;
j
<
ninsig
;
j
++
,
g
++
)
inlet_new
(
&
x
->
x_obj
,
&
x
->
x_obj
.
ob_pd
,
&
s_signal
,
&
s_signal
);
for
(
j
=
0
,
g
=
x
->
x_outsig
;
j
<
noutsig
;
j
++
,
g
++
)
outlet_new
(
&
x
->
x_obj
,
&
s_signal
);
signal
(
SIGPIPE
,
SIG_IGN
);
pd_tilde_donew
(
x
,
pddir
->
s_name
,
scheddir
->
s_name
,
pdargstring
,
ninsig
,
noutsig
,
fifo
,
sr
);
return
(
x
);
}
void
pd_tilde_setup
(
void
)
{
pd_tilde_class
=
class_new
(
gensym
(
"pd~"
),
(
t_newmethod
)
pd_tilde_new
,
(
t_method
)
pd_tilde_free
,
sizeof
(
t_pd_tilde
),
0
,
A_GIMME
,
0
);
class_addmethod
(
pd_tilde_class
,
nullfn
,
gensym
(
"signal"
),
0
);
class_addmethod
(
pd_tilde_class
,
(
t_method
)
pd_tilde_dsp
,
gensym
(
"dsp"
),
0
);
class_addmethod
(
pd_tilde_class
,
(
t_method
)
pd_tilde_pdtilde
,
gensym
(
"pd~"
),
A_GIMME
,
0
);
class_addanything
(
pd_tilde_class
,
pd_tilde_anything
);
post
(
"pd~ version 0.1"
);
}
...
...
@@ -521,8 +569,11 @@ static void pd_tilde_tick(t_pd_tilde *x)
{
int
messstart
=
0
,
i
,
n
=
0
;
t_atom
vec
[
LOTS
];
void
*
b
=
binbuf_new
();
long
z1
=
0
,
z2
=
0
;
long
z1
=
0
,
z2
=
0
;
void
*
b
;
if
(
!
x
->
x_msgbuf
)
return
;
b
=
binbuf_new
();
binbuf_text
(
b
,
&
x
->
x_msgbuf
,
x
->
x_infill
);
/* binbuf_print(b); */
while
(
!
binbuf_getatom
(
b
,
&
z1
,
&
z2
,
vec
+
n
))
...
...
@@ -594,7 +645,8 @@ int main()
class_addmethod
(
c
,
(
method
)
pd_tilde_dsp
,
"dsp"
,
A_CANT
,
0
);
class_addmethod
(
c
,
(
method
)
pd_tilde_assist
,
"assist"
,
A_CANT
,
0
);
class_addmethod
(
c
,
(
method
)
pd_tilde_anything
,
"anything"
,
A_GIMME
,
0
);
class_addmethod
(
c
,
(
method
)
pd_tilde_pdtilde
,
"pd~"
,
A_GIMME
,
0
);
class_addmethod
(
c
,
(
method
)
pd_tilde_anything
,
"anything"
,
A_GIMME
,
0
);
class_dspinit
(
c
);
class_register
(
CLASS_BOX
,
c
);
...
...
@@ -683,9 +735,17 @@ static void *pd_tilde_new(t_symbol *s, long ac, t_atom *av)
x
->
x_outsig
=
(
t_sample
**
)
getbytes
(
noutsig
*
sizeof
(
*
x
->
x_outsig
));
x
->
x_ninsig
=
ninsig
;
x
->
x_noutsig
=
noutsig
;
pd_tilde_donew
(
x
,
pddir
->
s_name
,
scheddir
->
s_name
,
pdargstring
,
ninsig
,
noutsig
,
fifo
,
sr
);
x
->
x_fifo
=
fifo
;
x
->
x_sr
=
sr
;
x
->
x_pddir
=
pddir
;
x
->
x_schedlibdir
=
scheddir
;
x
->
x_pdargs
=
malloc
(
strlen
(
pdargstring
)
+
1
);
x
->
x_infd
=
0
;
x
->
x_outfd
=
0
;
x
->
x_outfd
=
0
;
x
->
x_childpid
=
-
1
;
x
->
x_msgbuf
=
0
;
strcpy
(
x
->
x_pdargs
,
pdargstring
);
}
return
(
x
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment