75 g##type min = g_value_get_##type (&self->priv->minimum_value); \ |
75 g##type min = g_value_get_##type (&self->priv->minimum_value); \ |
76 gdouble amp = convert (g_value_get_##type (&self->priv->amplitude)); \ |
76 gdouble amp = convert (g_value_get_##type (&self->priv->amplitude)); \ |
77 gdouble off = convert (g_value_get_##type (&self->priv->offset)); \ |
77 gdouble off = convert (g_value_get_##type (&self->priv->offset)); \ |
78 GstClockTime pos = _calculate_pos (timestamp, self->priv->timeshift, self->priv->period); \ |
78 GstClockTime pos = _calculate_pos (timestamp, self->priv->timeshift, self->priv->period); \ |
79 \ |
79 \ |
80 ret = sin (2.0 * M_PI * (self->priv->frequency / GST_SECOND) * gst_guint64_to_gdouble (pos)); \ |
80 ret = sin (2.0 * M_PI * (self->priv->frequency / GST_SECOND) * gst_util_guint64_to_gdouble (pos)); \ |
81 ret *= amp; \ |
81 ret *= amp; \ |
82 ret += off; \ |
82 ret += off; \ |
83 \ |
83 \ |
84 if (round) \ |
84 if (round) \ |
85 ret += 0.5; \ |
85 ret += 0.5; \ |
121 DEFINE_SINE (uint, TRUE, EMPTY); |
121 DEFINE_SINE (uint, TRUE, EMPTY); |
122 DEFINE_SINE (long, TRUE, EMPTY); |
122 DEFINE_SINE (long, TRUE, EMPTY); |
123 |
123 |
124 DEFINE_SINE (ulong, TRUE, EMPTY); |
124 DEFINE_SINE (ulong, TRUE, EMPTY); |
125 DEFINE_SINE (int64, TRUE, EMPTY); |
125 DEFINE_SINE (int64, TRUE, EMPTY); |
126 DEFINE_SINE (uint64, TRUE, gst_guint64_to_gdouble); |
126 DEFINE_SINE (uint64, TRUE, gst_util_guint64_to_gdouble); |
127 DEFINE_SINE (float, FALSE, EMPTY); |
127 DEFINE_SINE (float, FALSE, EMPTY); |
128 DEFINE_SINE (double, FALSE, EMPTY); |
128 DEFINE_SINE (double, FALSE, EMPTY); |
129 |
129 |
130 static GstWaveformImplementation waveform_sine = { |
130 static GstWaveformImplementation waveform_sine = { |
131 (GstControlSourceGetValue) waveform_sine_get_int, |
131 (GstControlSourceGetValue) waveform_sine_get_int, |
207 DEFINE_SQUARE (uint, TRUE, EMPTY); |
207 DEFINE_SQUARE (uint, TRUE, EMPTY); |
208 DEFINE_SQUARE (long, TRUE, EMPTY); |
208 DEFINE_SQUARE (long, TRUE, EMPTY); |
209 |
209 |
210 DEFINE_SQUARE (ulong, TRUE, EMPTY); |
210 DEFINE_SQUARE (ulong, TRUE, EMPTY); |
211 DEFINE_SQUARE (int64, TRUE, EMPTY); |
211 DEFINE_SQUARE (int64, TRUE, EMPTY); |
212 DEFINE_SQUARE (uint64, TRUE, gst_guint64_to_gdouble); |
212 DEFINE_SQUARE (uint64, TRUE, gst_util_guint64_to_gdouble); |
213 DEFINE_SQUARE (float, FALSE, EMPTY); |
213 DEFINE_SQUARE (float, FALSE, EMPTY); |
214 DEFINE_SQUARE (double, FALSE, EMPTY); |
214 DEFINE_SQUARE (double, FALSE, EMPTY); |
215 |
215 |
216 static GstWaveformImplementation waveform_square = { |
216 static GstWaveformImplementation waveform_square = { |
217 (GstControlSourceGetValue) waveform_square_get_int, |
217 (GstControlSourceGetValue) waveform_square_get_int, |
243 gdouble off = convert (g_value_get_##type (&self->priv->offset)); \ |
243 gdouble off = convert (g_value_get_##type (&self->priv->offset)); \ |
244 GstClockTime period = self->priv->period; \ |
244 GstClockTime period = self->priv->period; \ |
245 GstClockTime pos = _calculate_pos (timestamp, self->priv->timeshift, period); \ |
245 GstClockTime pos = _calculate_pos (timestamp, self->priv->timeshift, period); \ |
246 gdouble ret; \ |
246 gdouble ret; \ |
247 \ |
247 \ |
248 ret = - ((gst_guint64_to_gdouble (pos) - gst_guint64_to_gdouble (period) / 2.0) * ((2.0 * amp) / gst_guint64_to_gdouble (period)));\ |
248 ret = - ((gst_util_guint64_to_gdouble (pos) - gst_util_guint64_to_gdouble (period) / 2.0) * ((2.0 * amp) / gst_util_guint64_to_gdouble (period)));\ |
249 \ |
249 \ |
250 ret += off; \ |
250 ret += off; \ |
251 \ |
251 \ |
252 if (round) \ |
252 if (round) \ |
253 ret += 0.5; \ |
253 ret += 0.5; \ |
290 DEFINE_SAW (uint, TRUE, EMPTY); |
290 DEFINE_SAW (uint, TRUE, EMPTY); |
291 DEFINE_SAW (long, TRUE, EMPTY); |
291 DEFINE_SAW (long, TRUE, EMPTY); |
292 |
292 |
293 DEFINE_SAW (ulong, TRUE, EMPTY); |
293 DEFINE_SAW (ulong, TRUE, EMPTY); |
294 DEFINE_SAW (int64, TRUE, EMPTY); |
294 DEFINE_SAW (int64, TRUE, EMPTY); |
295 DEFINE_SAW (uint64, TRUE, gst_guint64_to_gdouble); |
295 DEFINE_SAW (uint64, TRUE, gst_util_guint64_to_gdouble); |
296 DEFINE_SAW (float, FALSE, EMPTY); |
296 DEFINE_SAW (float, FALSE, EMPTY); |
297 DEFINE_SAW (double, FALSE, EMPTY); |
297 DEFINE_SAW (double, FALSE, EMPTY); |
298 |
298 |
299 static GstWaveformImplementation waveform_saw = { |
299 static GstWaveformImplementation waveform_saw = { |
300 (GstControlSourceGetValue) waveform_saw_get_int, |
300 (GstControlSourceGetValue) waveform_saw_get_int, |
326 gdouble off = convert (g_value_get_##type (&self->priv->offset)); \ |
326 gdouble off = convert (g_value_get_##type (&self->priv->offset)); \ |
327 GstClockTime period = self->priv->period; \ |
327 GstClockTime period = self->priv->period; \ |
328 GstClockTime pos = _calculate_pos (timestamp, self->priv->timeshift, period); \ |
328 GstClockTime pos = _calculate_pos (timestamp, self->priv->timeshift, period); \ |
329 gdouble ret; \ |
329 gdouble ret; \ |
330 \ |
330 \ |
331 ret = ((gst_guint64_to_gdouble (pos) - gst_guint64_to_gdouble (period) / 2.0) * ((2.0 * amp) / gst_guint64_to_gdouble (period)));\ |
331 ret = ((gst_util_guint64_to_gdouble (pos) - gst_util_guint64_to_gdouble (period) / 2.0) * ((2.0 * amp) / gst_util_guint64_to_gdouble (period)));\ |
332 \ |
332 \ |
333 ret += off; \ |
333 ret += off; \ |
334 \ |
334 \ |
335 if (round) \ |
335 if (round) \ |
336 ret += 0.5; \ |
336 ret += 0.5; \ |
373 DEFINE_RSAW (uint, TRUE, EMPTY); |
373 DEFINE_RSAW (uint, TRUE, EMPTY); |
374 DEFINE_RSAW (long, TRUE, EMPTY); |
374 DEFINE_RSAW (long, TRUE, EMPTY); |
375 |
375 |
376 DEFINE_RSAW (ulong, TRUE, EMPTY); |
376 DEFINE_RSAW (ulong, TRUE, EMPTY); |
377 DEFINE_RSAW (int64, TRUE, EMPTY); |
377 DEFINE_RSAW (int64, TRUE, EMPTY); |
378 DEFINE_RSAW (uint64, TRUE, gst_guint64_to_gdouble); |
378 DEFINE_RSAW (uint64, TRUE, gst_util_guint64_to_gdouble); |
379 DEFINE_RSAW (float, FALSE, EMPTY); |
379 DEFINE_RSAW (float, FALSE, EMPTY); |
380 DEFINE_RSAW (double, FALSE, EMPTY); |
380 DEFINE_RSAW (double, FALSE, EMPTY); |
381 |
381 |
382 static GstWaveformImplementation waveform_rsaw = { |
382 static GstWaveformImplementation waveform_rsaw = { |
383 (GstControlSourceGetValue) waveform_rsaw_get_int, |
383 (GstControlSourceGetValue) waveform_rsaw_get_int, |
409 gdouble off = convert (g_value_get_##type (&self->priv->offset)); \ |
409 gdouble off = convert (g_value_get_##type (&self->priv->offset)); \ |
410 GstClockTime period = self->priv->period; \ |
410 GstClockTime period = self->priv->period; \ |
411 GstClockTime pos = _calculate_pos (timestamp, self->priv->timeshift, period); \ |
411 GstClockTime pos = _calculate_pos (timestamp, self->priv->timeshift, period); \ |
412 gdouble ret; \ |
412 gdouble ret; \ |
413 \ |
413 \ |
414 if (gst_guint64_to_gdouble (pos) <= gst_guint64_to_gdouble (period) / 4.0) \ |
414 if (gst_util_guint64_to_gdouble (pos) <= gst_util_guint64_to_gdouble (period) / 4.0) \ |
415 ret = gst_guint64_to_gdouble (pos) * ((4.0 * amp) / gst_guint64_to_gdouble (period)); \ |
415 ret = gst_util_guint64_to_gdouble (pos) * ((4.0 * amp) / gst_util_guint64_to_gdouble (period)); \ |
416 else if (gst_guint64_to_gdouble (pos) <= (3.0 * gst_guint64_to_gdouble (period)) / 4.0) \ |
416 else if (gst_util_guint64_to_gdouble (pos) <= (3.0 * gst_util_guint64_to_gdouble (period)) / 4.0) \ |
417 ret = -(gst_guint64_to_gdouble (pos) - gst_guint64_to_gdouble (period) / 2.0) * ((4.0 * amp) / gst_guint64_to_gdouble (period)); \ |
417 ret = -(gst_util_guint64_to_gdouble (pos) - gst_util_guint64_to_gdouble (period) / 2.0) * ((4.0 * amp) / gst_util_guint64_to_gdouble (period)); \ |
418 else \ |
418 else \ |
419 ret = gst_guint64_to_gdouble (period) - gst_guint64_to_gdouble (pos) * ((4.0 * amp) / gst_guint64_to_gdouble (period)); \ |
419 ret = gst_util_guint64_to_gdouble (period) - gst_util_guint64_to_gdouble (pos) * ((4.0 * amp) / gst_util_guint64_to_gdouble (period)); \ |
420 \ |
420 \ |
421 ret += off; \ |
421 ret += off; \ |
422 \ |
422 \ |
423 if (round) \ |
423 if (round) \ |
424 ret += 0.5; \ |
424 ret += 0.5; \ |
461 DEFINE_TRIANGLE (uint, TRUE, EMPTY); |
461 DEFINE_TRIANGLE (uint, TRUE, EMPTY); |
462 DEFINE_TRIANGLE (long, TRUE, EMPTY); |
462 DEFINE_TRIANGLE (long, TRUE, EMPTY); |
463 |
463 |
464 DEFINE_TRIANGLE (ulong, TRUE, EMPTY); |
464 DEFINE_TRIANGLE (ulong, TRUE, EMPTY); |
465 DEFINE_TRIANGLE (int64, TRUE, EMPTY); |
465 DEFINE_TRIANGLE (int64, TRUE, EMPTY); |
466 DEFINE_TRIANGLE (uint64, TRUE, gst_guint64_to_gdouble); |
466 DEFINE_TRIANGLE (uint64, TRUE, gst_util_guint64_to_gdouble); |
467 DEFINE_TRIANGLE (float, FALSE, EMPTY); |
467 DEFINE_TRIANGLE (float, FALSE, EMPTY); |
468 DEFINE_TRIANGLE (double, FALSE, EMPTY); |
468 DEFINE_TRIANGLE (double, FALSE, EMPTY); |
469 |
469 |
470 static GstWaveformImplementation waveform_triangle = { |
470 static GstWaveformImplementation waveform_triangle = { |
471 (GstControlSourceGetValue) waveform_triangle_get_int, |
471 (GstControlSourceGetValue) waveform_triangle_get_int, |
1036 * Specifies the waveform that should be used for this #GstLFOControlSource. |
1036 * Specifies the waveform that should be used for this #GstLFOControlSource. |
1037 * |
1037 * |
1038 **/ |
1038 **/ |
1039 g_object_class_install_property (gobject_class, PROP_WAVEFORM, |
1039 g_object_class_install_property (gobject_class, PROP_WAVEFORM, |
1040 g_param_spec_enum ("waveform", "Waveform", "Waveform", |
1040 g_param_spec_enum ("waveform", "Waveform", "Waveform", |
1041 GST_TYPE_LFO_WAVEFORM, GST_LFO_WAVEFORM_SINE, |
1041 GST_TYPE_LFO_WAVEFORM, GST_LFO_WAVEFORM_SINE, G_PARAM_READWRITE)); |
1042 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
|
1043 |
1042 |
1044 /** |
1043 /** |
1045 * GstLFOControlSource:frequency |
1044 * GstLFOControlSource:frequency |
1046 * |
1045 * |
1047 * Specifies the frequency that should be used for the waveform |
1046 * Specifies the frequency that should be used for the waveform |
1050 * |
1049 * |
1051 **/ |
1050 **/ |
1052 g_object_class_install_property (gobject_class, PROP_FREQUENCY, |
1051 g_object_class_install_property (gobject_class, PROP_FREQUENCY, |
1053 g_param_spec_double ("frequency", "Frequency", |
1052 g_param_spec_double ("frequency", "Frequency", |
1054 "Frequency of the waveform", 0.0, G_MAXDOUBLE, 1.0, |
1053 "Frequency of the waveform", 0.0, G_MAXDOUBLE, 1.0, |
1055 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1054 G_PARAM_READWRITE)); |
1056 |
1055 |
1057 /** |
1056 /** |
1058 * GstLFOControlSource:timeshift |
1057 * GstLFOControlSource:timeshift |
1059 * |
1058 * |
1060 * Specifies the timeshift to the right that should be used for the waveform |
1059 * Specifies the timeshift to the right that should be used for the waveform |
1065 * |
1064 * |
1066 **/ |
1065 **/ |
1067 g_object_class_install_property (gobject_class, PROP_TIMESHIFT, |
1066 g_object_class_install_property (gobject_class, PROP_TIMESHIFT, |
1068 g_param_spec_uint64 ("timeshift", "Timeshift", |
1067 g_param_spec_uint64 ("timeshift", "Timeshift", |
1069 "Timeshift of the waveform to the right", 0, G_MAXUINT64, 0, |
1068 "Timeshift of the waveform to the right", 0, G_MAXUINT64, 0, |
1070 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1069 G_PARAM_READWRITE)); |
1071 |
1070 |
1072 /** |
1071 /** |
1073 * GstLFOControlSource:amplitude |
1072 * GstLFOControlSource:amplitude |
1074 * |
1073 * |
1075 * Specifies the amplitude for the waveform of this #GstLFOControlSource. |
1074 * Specifies the amplitude for the waveform of this #GstLFOControlSource. |
1077 * It should be given as a #GValue with a type that can be transformed |
1076 * It should be given as a #GValue with a type that can be transformed |
1078 * to the type of the bound property. |
1077 * to the type of the bound property. |
1079 **/ |
1078 **/ |
1080 g_object_class_install_property (gobject_class, PROP_AMPLITUDE, |
1079 g_object_class_install_property (gobject_class, PROP_AMPLITUDE, |
1081 g_param_spec_boxed ("amplitude", "Amplitude", "Amplitude of the waveform", |
1080 g_param_spec_boxed ("amplitude", "Amplitude", "Amplitude of the waveform", |
1082 G_TYPE_VALUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1081 G_TYPE_VALUE, G_PARAM_READWRITE)); |
1083 |
1082 |
1084 /** |
1083 /** |
1085 * GstLFOControlSource:offset |
1084 * GstLFOControlSource:offset |
1086 * |
1085 * |
1087 * Specifies the offset for the waveform of this #GstLFOControlSource. |
1086 * Specifies the offset for the waveform of this #GstLFOControlSource. |
1089 * It should be given as a #GValue with a type that can be transformed |
1088 * It should be given as a #GValue with a type that can be transformed |
1090 * to the type of the bound property. |
1089 * to the type of the bound property. |
1091 **/ |
1090 **/ |
1092 g_object_class_install_property (gobject_class, PROP_OFFSET, |
1091 g_object_class_install_property (gobject_class, PROP_OFFSET, |
1093 g_param_spec_boxed ("offset", "Offset", "Offset of the waveform", |
1092 g_param_spec_boxed ("offset", "Offset", "Offset of the waveform", |
1094 G_TYPE_VALUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
1093 G_TYPE_VALUE, G_PARAM_READWRITE)); |
1095 } |
1094 } |