Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
purr-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Jonathan Wilkes
purr-data
Commits
4fc2ea3d
Commit
4fc2ea3d
authored
9 years ago
by
Jonathan Wilkes
Browse files
Options
Downloads
Patches
Plain Diff
ported bugfix from pd-l2ork github: 78ee42bb822d21c017401400de638055a3b2cc5f
parent
5c78febe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
externals/ggee/gui/envgen.c
+35
-14
35 additions, 14 deletions
externals/ggee/gui/envgen.c
with
35 additions
and
14 deletions
externals/ggee/gui/envgen.c
+
35
−
14
View file @
4fc2ea3d
...
...
@@ -2,7 +2,8 @@
#include
<m_pd.h>
//#define DEBUG
#define DEBUG(x)
//#define DEBUG(x) x
/* ------------------------ envgen~ ----------------------------- */
#define NONE 0
...
...
@@ -37,6 +38,7 @@ char dumpy[2000];
void
envgen_resize
(
t_envgen
*
x
,
int
ns
)
{
DEBUG
(
post
(
"envgen_resize"
););
if
(
ns
>
x
->
args
)
{
int
newargs
=
ns
*
sizeof
(
t_float
);
...
...
@@ -50,12 +52,13 @@ void envgen_resize(t_envgen* x,int ns)
void
envgen_totaldur
(
t_envgen
*
x
,
t_float
dur
)
{
DEBUG
(
post
(
"envgen_totaldur"
););
int
i
;
float
f
=
dur
/
x
->
duration
[
x
->
last_state
];
if
(
dur
<
10
)
{
post
(
"envgen: duration too small %f"
,
dur
);
return
;
pd_error
(
x
,
"envgen: duration too small %f"
,
dur
);
return
;
}
for
(
i
=
1
;
i
<=
x
->
last_state
;
i
++
)
...
...
@@ -65,6 +68,7 @@ void envgen_totaldur(t_envgen* x,t_float dur)
static
void
envgen_dump
(
t_envgen
*
e
)
{
DEBUG
(
post
(
"envgen_dump"
););
t_atom
argv
[
50
];
int
argc
=
0
;
t_atom
*
a
=
argv
;
...
...
@@ -83,6 +87,7 @@ static void envgen_dump(t_envgen* e)
void
envgen_init
(
t_envgen
*
x
,
int
argc
,
t_atom
*
argv
)
{
DEBUG
(
post
(
"envgen_init"
););
t_float
*
dur
;
t_float
*
val
;
t_float
tdur
=
0
;
...
...
@@ -104,18 +109,14 @@ void envgen_init(t_envgen *x,int argc,t_atom* argv)
dur
++
;
val
++
;
argc
--
;
for
(;
argc
>
0
;
argc
--
)
{
tdur
+=
atom_getfloat
(
argv
++
);
#ifdef DEBUG
post
(
"dur =%f"
,
tdur
);
#endif
DEBUG
(
post
(
"dur =%f"
,
tdur
););
*
dur
++
=
tdur
;
argc
--
;
if
(
argc
>
0
)
*
val
++
=
atom_getfloat
(
argv
++
);
else
*
val
++
=
0
;
#ifdef DEBUG
post
(
"val =%f"
,
*
(
val
-
1
));
#endif
DEBUG
(
post
(
"val =%f"
,
*
(
val
-
1
)););
}
...
...
@@ -127,6 +128,7 @@ void envgen_init(t_envgen *x,int argc,t_atom* argv)
void
envgen_list
(
t_envgen
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
DEBUG
(
post
(
"envgen_list"
););
envgen_init
(
x
,
argc
,
argv
);
if
(
glist_isvisible
(
x
->
w
.
glist
))
{
envgen_drawme
(
x
,
x
->
w
.
glist
,
0
);
...
...
@@ -135,12 +137,14 @@ void envgen_list(t_envgen *x,t_symbol* s, int argc,t_atom* argv)
void
envgen_setresize
(
t_envgen
*
x
,
t_floatarg
f
)
{
DEBUG
(
post
(
"envgen_setresize"
););
x
->
resizeable
=
f
;
}
void
envgen_float
(
t_envgen
*
x
,
t_floatarg
f
)
{
DEBUG
(
post
(
"envgen_float"
););
int
state
=
0
;
float
val
;
...
...
@@ -166,6 +170,7 @@ void envgen_float(t_envgen *x, t_floatarg f)
void
envgen_bang
(
t_envgen
*
x
)
{
DEBUG
(
post
(
"envgen_bang"
););
t_atom
a
[
2
];
SETFLOAT
(
a
,
x
->
finalvalues
[
NONE
]);
...
...
@@ -188,6 +193,7 @@ void envgen_bang(t_envgen *x)
}
void
envgen_release
(
t_envgen
*
x
)
{
DEBUG
(
post
(
"envgen_release"
););
t_atom
a
[
2
];
float
del
=
x
->
duration
[
x
->
x_state
]
-
x
->
duration
[
x
->
x_state
-
1
];
if
(
x
->
x_state
<=
x
->
sustain_state
)
{
...
...
@@ -201,6 +207,7 @@ void envgen_release(t_envgen* x) {
static
void
envgen_sustain
(
t_envgen
*
x
,
t_floatarg
f
)
{
DEBUG
(
post
(
"envgen_sustain"
););
if
(
f
>
0
&&
f
<
x
->
last_state
)
x
->
sustain_state
=
f
;
else
...
...
@@ -210,6 +217,7 @@ static void envgen_sustain(t_envgen *x, t_floatarg f)
static
void
envgen_tick
(
t_envgen
*
x
)
{
DEBUG
(
post
(
"envgen_tick"
););
t_atom
a
[
2
];
x
->
x_state
++
;
if
(
x
->
x_state
<=
x
->
last_state
&&
x
->
x_state
!=
x
->
sustain_state
)
{
...
...
@@ -225,27 +233,34 @@ static void envgen_tick(t_envgen* x)
static
void
envgen_freeze
(
t_envgen
*
x
,
t_floatarg
f
)
{
DEBUG
(
post
(
"envgen_freeze"
););
x
->
x_freeze
=
f
;
}
static
void
bindsym
(
t_pd
*
x
,
t_symbol
*
o
,
t_symbol
*
s
)
{
DEBUG
(
post
(
"bindsym"
););
if
(
o
!=
&
s_
)
pd_unbind
(
x
,
o
);
o
=
s
;
pd_bind
(
x
,
s
);
}
static
void
envgen_free
(
t_envgen
*
x
)
{
clock_free
(
x
->
x_clock
);
}
static
void
*
envgen_new
(
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
DEBUG
(
post
(
"envgen_new"
););
t_envgen
*
x
=
(
t_envgen
*
)
pd_new
(
envgen_class
);
x
->
args
=
STATES
;
x
->
finalvalues
=
getbytes
(
x
->
args
*
sizeof
(
t_float
));
x
->
duration
=
getbytes
(
x
->
args
*
sizeof
(
t_float
));
#ifdef DEBUG
post
(
"finalvalues %x"
,
x
->
finalvalues
);
#endif
DEBUG
(
post
(
"finalvalues %lx"
,
x
->
finalvalues
););
/* widget */
x
->
w
.
grabbed
=
0
;
...
...
@@ -315,8 +330,14 @@ t_widgetbehavior envgen_widgetbehavior;
void
envgen_setup
(
void
)
{
envgen_class
=
class_new
(
gensym
(
"envgen"
),
(
t_newmethod
)
envgen_new
,
0
,
sizeof
(
t_envgen
),
0
,
A_GIMME
,
0
);
DEBUG
(
post
(
"envgen_setup"
););
envgen_class
=
class_new
(
gensym
(
"envgen"
),
(
t_newmethod
)
envgen_new
,
(
t_method
)
envgen_free
,
sizeof
(
t_envgen
),
0
,
A_GIMME
,
0
);
class_addcreator
((
t_newmethod
)
envgen_new
,
gensym
(
"envgen~"
),
A_GIMME
,
0
);
class_addfloat
(
envgen_class
,
envgen_float
);
...
...
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