Skip to content

Commit

Permalink
activate: use 1 effect at a time, for now
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Oct 21, 2024
1 parent 09264f9 commit 92fbabf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ The commands supported by mod-host are:
e.g.: remove 0
when instance_number is -1 all plugins will be removed

activate <instance_number> <instance_number_end> <activate_value>
* toggle effects activated state
e.g.: activate 0 0 1
activate <instance_number> <activate_value>
* toggle effect activated state
e.g.: activate 0 1
if activate_value = 1 activate effect
if activate_value = 0 deactivate effect

Expand Down
8 changes: 7 additions & 1 deletion src/effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -5984,6 +5984,7 @@ int effects_remove(int effect_id)
return SUCCESS;
}

#if 0
static void* effects_activate_thread(void* arg)
{
jack_client_t *jack_client = arg;
Expand All @@ -6003,20 +6004,23 @@ static void* effects_deactivate_thread(void* arg)

return NULL;
}
#endif

int effects_activate(int effect_id, int effect_id_end, int value)
int effects_activate(int effect_id, int value)
{
if (!InstanceExist(effect_id))
{
return ERR_INSTANCE_NON_EXISTS;
}
#if 0
if (effect_id > effect_id_end)
{
return ERR_INVALID_OPERATION;
}

if (effect_id == effect_id_end)
{
#endif
effect_t *effect = &g_effects[effect_id];

if (value)
Expand Down Expand Up @@ -6048,6 +6052,7 @@ int effects_activate(int effect_id, int effect_id_end, int value)
lilv_instance_deactivate(effect->lilv_instance);
}
}
#if 0
}
else
{
Expand Down Expand Up @@ -6102,6 +6107,7 @@ int effects_activate(int effect_id, int effect_id_end, int value)
}
}
}
#endif

return SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion src/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ int effects_init(void* client);
int effects_finish(int close_client);
int effects_add(const char *uri, int instance, int activate);
int effects_remove(int effect_id);
int effects_activate(int effect_id, int effect_id_end, int value);
int effects_activate(int effect_id, int value);
int effects_preset_load(int effect_id, const char *uri);
int effects_preset_save(int effect_id, const char *dir, const char *file_name, const char *label);
int effects_preset_show(const char *uri, char **state_str);
Expand Down
2 changes: 1 addition & 1 deletion src/mod-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static void effects_remove_cb(proto_t *proto)
static void effects_activate_cb(proto_t *proto)
{
int resp;
resp = effects_activate(atoi(proto->list[1]), atoi(proto->list[2]), atoi(proto->list[3]));
resp = effects_activate(atoi(proto->list[1]), atoi(proto->list[2]));
protocol_response_int(resp, proto);
}

Expand Down
2 changes: 1 addition & 1 deletion src/mod-host.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
/* Protocol commands definition */
#define EFFECT_ADD "add %s %i"
#define EFFECT_REMOVE "remove %i"
#define EFFECT_ACTIVATE "activate %i %i %i"
#define EFFECT_ACTIVATE "activate %i %i"
#define EFFECT_PRELOAD "preload %s %i"
#define EFFECT_PRESET_LOAD "preset_load %i %s"
#define EFFECT_PRESET_SAVE "preset_save %i %s %s %s"
Expand Down

0 comments on commit 92fbabf

Please sign in to comment.