vibra-periodic: Use better defaults for fade-in-*

Lets start at zero when not specified otherwise and also set an
arbitrary fade-in-time as setting it to the duration isn't very helpful.

While at that move the defaults to the feedback rather than the device
so we ensure consistency over different device implementations.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
This commit is contained in:
Guido Günther
2025-03-21 12:14:55 +01:00
parent 89b33dcbab
commit 91c34f4099
2 changed files with 8 additions and 14 deletions
-9
View File
@@ -283,15 +283,6 @@ fbd_dev_vibra_periodic (FbdDevVibra *self,
g_return_val_if_fail (FBD_IS_DEV_VIBRA (self), FALSE);
if (!magnitude)
magnitude = 0.5;
if (!fade_in_level)
fade_in_level = magnitude;
if (!fade_in_time)
fade_in_time = duration;
effect.type = FF_PERIODIC;
effect.id = -1;
effect.u.periodic.waveform = FF_SINE;
+8 -5
View File
@@ -35,9 +35,9 @@ static GParamSpec *props[PROP_LAST_PROP];
typedef struct _FbdFeedbackVibraPeriodic {
FbdFeedbackVibra parent;
double magnitude;
double fade_in_level;
guint fade_in_time;
double magnitude;
double fade_in_level;
guint fade_in_time;
} FbdFeedbackVibraPeriodic;
G_DEFINE_TYPE (FbdFeedbackVibraPeriodic, fbd_feedback_vibra_periodic, FBD_TYPE_FEEDBACK_VIBRA);
@@ -151,12 +151,12 @@ fbd_feedback_vibra_periodic_class_init (FbdFeedbackVibraPeriodicClass *klass)
props[PROP_FADE_IN_TIME] =
g_param_spec_uint ("fade-in-time", "", "",
0, G_MAXINT, 0,
0, G_MAXINT, 500,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
props[PROP_FADE_IN_LEVEL] =
g_param_spec_double ("fade-in-level", "", "",
0.0, 1.0, 0.5,
0.0, 1.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
@@ -165,4 +165,7 @@ fbd_feedback_vibra_periodic_class_init (FbdFeedbackVibraPeriodicClass *klass)
static void
fbd_feedback_vibra_periodic_init (FbdFeedbackVibraPeriodic *self)
{
self->magnitude = 0.5;
self->fade_in_level = 0.0;
self->fade_in_time = 500;
}