Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shuvam Sanati
purr-data
Commits
d2eb5d99
Commit
d2eb5d99
authored
Oct 12, 2020
by
Albert Gräf
Browse files
Fix memory leak on fluid synth and settings.
parent
18c895c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
externals/fluid~/fluid~.c
View file @
d2eb5d99
...
...
@@ -42,8 +42,8 @@ static void fluid_tilde_dsp(t_fluid_tilde *x, t_signal **sp)
static
void
fluid_tilde_free
(
t_fluid_tilde
*
x
)
{
out
let_f
ree
(
x
->
x_out_left
);
out
let_f
ree
(
x
->
x_out_right
);
if
(
x
->
x_synth
)
de
let
e
_f
luid_synth
(
x
->
x_synth
);
if
(
x
->
x_settings
)
de
let
e
_f
luid_settings
(
x
->
x_settings
);
}
static
void
fluid_help
(
void
)
...
...
@@ -300,6 +300,7 @@ static void fluid_load(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
static
void
fluid_init
(
t_fluid_tilde
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
if
(
x
->
x_synth
)
delete_fluid_synth
(
x
->
x_synth
);
if
(
x
->
x_settings
)
delete_fluid_settings
(
x
->
x_settings
);
float
sr
=
sys_getsr
();
...
...
@@ -339,8 +340,6 @@ static void fluid_init(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
}
// try to load argument as soundfont
fluid_load
(
x
,
gensym
(
"load"
),
argc
,
argv
);
//if (settings != NULL )
// delete_fluid_settings(settings);
// We're done constructing:
if
(
x
->
x_synth
)
...
...
@@ -351,6 +350,7 @@ static void fluid_init(t_fluid_tilde *x, t_symbol *s, int argc, t_atom *argv)
static
void
*
fluid_tilde_new
(
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
t_fluid_tilde
*
x
=
(
t_fluid_tilde
*
)
pd_new
(
fluid_tilde_class
);
x
->
x_synth
=
NULL
;
x
->
x_settings
=
NULL
;
x
->
x_out_left
=
outlet_new
(
&
x
->
x_obj
,
&
s_signal
);
x
->
x_out_right
=
outlet_new
(
&
x
->
x_obj
,
&
s_signal
);
x
->
smmf_mode
=
0
;
...
...
@@ -362,7 +362,8 @@ static void *fluid_tilde_new(t_symbol *s, int argc, t_atom *argv)
void
fluid_tilde_setup
(
void
)
{
fluid_tilde_class
=
class_new
(
gensym
(
"fluid~"
),
(
t_newmethod
)
fluid_tilde_new
,
0
,
sizeof
(
t_fluid_tilde
),
(
t_newmethod
)
fluid_tilde_new
,
(
t_method
)
fluid_tilde_free
,
sizeof
(
t_fluid_tilde
),
CLASS_DEFAULT
,
A_GIMME
,
0
);
class_addmethod
(
fluid_tilde_class
,
(
t_method
)
fluid_init
,
gensym
(
"init"
),
A_GIMME
,
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment