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:
@@ -283,15 +283,6 @@ fbd_dev_vibra_periodic (FbdDevVibra *self,
|
|||||||
|
|
||||||
g_return_val_if_fail (FBD_IS_DEV_VIBRA (self), FALSE);
|
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.type = FF_PERIODIC;
|
||||||
effect.id = -1;
|
effect.id = -1;
|
||||||
effect.u.periodic.waveform = FF_SINE;
|
effect.u.periodic.waveform = FF_SINE;
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ static GParamSpec *props[PROP_LAST_PROP];
|
|||||||
typedef struct _FbdFeedbackVibraPeriodic {
|
typedef struct _FbdFeedbackVibraPeriodic {
|
||||||
FbdFeedbackVibra parent;
|
FbdFeedbackVibra parent;
|
||||||
|
|
||||||
double magnitude;
|
double magnitude;
|
||||||
double fade_in_level;
|
double fade_in_level;
|
||||||
guint fade_in_time;
|
guint fade_in_time;
|
||||||
} FbdFeedbackVibraPeriodic;
|
} FbdFeedbackVibraPeriodic;
|
||||||
|
|
||||||
G_DEFINE_TYPE (FbdFeedbackVibraPeriodic, fbd_feedback_vibra_periodic, FBD_TYPE_FEEDBACK_VIBRA);
|
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] =
|
props[PROP_FADE_IN_TIME] =
|
||||||
g_param_spec_uint ("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);
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
props[PROP_FADE_IN_LEVEL] =
|
props[PROP_FADE_IN_LEVEL] =
|
||||||
g_param_spec_double ("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_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
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
|
static void
|
||||||
fbd_feedback_vibra_periodic_init (FbdFeedbackVibraPeriodic *self)
|
fbd_feedback_vibra_periodic_init (FbdFeedbackVibraPeriodic *self)
|
||||||
{
|
{
|
||||||
|
self->magnitude = 0.5;
|
||||||
|
self->fade_in_level = 0.0;
|
||||||
|
self->fade_in_time = 500;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user