Skip to content

Commit

Permalink
audio move support int settings
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro committed Dec 19, 2020
1 parent 345e845 commit 5b65780
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project(move-transition VERSION 2.2.0)
project(move-transition VERSION 2.2.1)
set(PROJECT_FULL_NAME "Move Transition")

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/version.h)
Expand Down
19 changes: 17 additions & 2 deletions audio-move.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ static void load_properties(obs_properties_t *props_from,
if (prop_type == OBS_PROPERTY_GROUP) {
load_properties(obs_property_group_content(prop_from),
setting_list);
} else if (prop_type == OBS_PROPERTY_FLOAT) {
} else if (prop_type == OBS_PROPERTY_FLOAT ||
prop_type == OBS_PROPERTY_INT) {
obs_property_list_add_string(setting_list, description,
name);
}
Expand Down Expand Up @@ -677,7 +678,21 @@ void audio_move_tick(void *data, float seconds)
obs_source_get_settings(filter->target_source);
const double val = filter->factor * filter->audio_value +
filter->base_value;
obs_data_set_double(settings, filter->setting_name, val);
obs_data_item_t *setting =
obs_data_item_byname(settings, filter->setting_name);
if (setting) {
const enum obs_data_number_type num_type =
obs_data_item_numtype(setting);
if (num_type == OBS_DATA_NUM_INT) {
obs_data_item_set_int(&setting, val);
} else if (num_type == OBS_DATA_NUM_DOUBLE) {
obs_data_item_set_double(&setting, val);
}
obs_data_item_release(&setting);
} else {
obs_data_set_double(settings, filter->setting_name,
val);
}
obs_data_release(settings);
obs_source_update(filter->target_source, NULL);
}
Expand Down

0 comments on commit 5b65780

Please sign in to comment.