mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-08 18:39:54 +00:00
gst/sine/demo-dparams.c: Use double dparams, not float.
Original commit message from CVS: * gst/sine/demo-dparams.c: (quit_live), (dynparm_log_value_changed), (dynparm_value_changed), (main): Use double dparams, not float. * gst/sine/gstsinesrc.c: (gst_sinesrc_class_init), (gst_sinesrc_init): Change sync default to FALSE, since multiple sync'd elements don't really work correctly. * gst/volume/gstvolume.c: (volume_class_init), (volume_init), (volume_update_volume), (volume_get_property): Change dparam to double.
This commit is contained in:
parent
c773027855
commit
275aac5a50
4 changed files with 30 additions and 15 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2004-02-18 David Schleef <ds@schleef.org>
|
||||||
|
|
||||||
|
* gst/sine/demo-dparams.c: (quit_live),
|
||||||
|
(dynparm_log_value_changed), (dynparm_value_changed), (main):
|
||||||
|
Use double dparams, not float.
|
||||||
|
* gst/sine/gstsinesrc.c: (gst_sinesrc_class_init),
|
||||||
|
(gst_sinesrc_init): Change sync default to FALSE, since multiple
|
||||||
|
sync'd elements don't really work correctly.
|
||||||
|
* gst/volume/gstvolume.c: (volume_class_init), (volume_init),
|
||||||
|
(volume_update_volume), (volume_get_property): Change dparam
|
||||||
|
to double.
|
||||||
|
|
||||||
2004-02-18 Julien MOUTTE <julien@moutte.net>
|
2004-02-18 Julien MOUTTE <julien@moutte.net>
|
||||||
|
|
||||||
* sys/ximage/ximagesink.c:
|
* sys/ximage/ximagesink.c:
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
|
|
||||||
#define ZERO(mem) memset(&mem, 0, sizeof(mem))
|
#define ZERO(mem) memset(&mem, 0, sizeof(mem))
|
||||||
|
|
||||||
static gint quit_live(GtkWidget *window, GdkEventAny *e, gpointer data) {
|
static gint quit_live(GtkWidget *window, GdkEventAny *e, gpointer data)
|
||||||
|
{
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dynparm_log_value_changed(GtkAdjustment *adj,GstDParam *dparam) {
|
static void dynparm_log_value_changed(GtkAdjustment *adj,GstDParam *dparam)
|
||||||
|
{
|
||||||
gdouble value;
|
gdouble value;
|
||||||
g_return_if_fail(dparam != NULL);
|
g_return_if_fail(dparam != NULL);
|
||||||
g_return_if_fail(GST_IS_DPARAM (dparam));
|
g_return_if_fail(GST_IS_DPARAM (dparam));
|
||||||
|
@ -23,7 +25,8 @@ static void dynparm_log_value_changed(GtkAdjustment *adj,GstDParam *dparam) {
|
||||||
g_object_set(G_OBJECT(dparam), "value_double", value, NULL);
|
g_object_set(G_OBJECT(dparam), "value_double", value, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dynparm_value_changed(GtkAdjustment *adj,GstDParam *dparam) {
|
static void dynparm_value_changed(GtkAdjustment *adj,GstDParam *dparam)
|
||||||
|
{
|
||||||
g_return_if_fail(dparam != NULL);
|
g_return_if_fail(dparam != NULL);
|
||||||
g_return_if_fail(GST_IS_DPARAM (dparam));
|
g_return_if_fail(GST_IS_DPARAM (dparam));
|
||||||
|
|
||||||
|
@ -45,7 +48,7 @@ int main(int argc,char *argv[]) {
|
||||||
GstDParamManager *dpman;
|
GstDParamManager *dpman;
|
||||||
GstDParam *volume;
|
GstDParam *volume;
|
||||||
GstDParam *freq;
|
GstDParam *freq;
|
||||||
GParamSpecFloat *spec;
|
GParamSpecDouble *spec;
|
||||||
|
|
||||||
gtk_init(&argc,&argv);
|
gtk_init(&argc,&argv);
|
||||||
gst_init(&argc,&argv);
|
gst_init(&argc,&argv);
|
||||||
|
@ -90,7 +93,7 @@ int main(int argc,char *argv[]) {
|
||||||
g_assert(gst_dpman_attach_dparam (dpman, "freq", freq));
|
g_assert(gst_dpman_attach_dparam (dpman, "freq", freq));
|
||||||
gst_dpman_set_mode(dpman, "asynchronous");
|
gst_dpman_set_mode(dpman, "asynchronous");
|
||||||
|
|
||||||
spec = (GParamSpecFloat*)gst_dpman_get_param_spec (dpman, "freq");
|
spec = (GParamSpecDouble*)gst_dpman_get_param_spec (dpman, "freq");
|
||||||
freq_adj = (GtkAdjustment*)gtk_adjustment_new(log(spec->default_value),
|
freq_adj = (GtkAdjustment*)gtk_adjustment_new(log(spec->default_value),
|
||||||
log(spec->minimum), log(spec->maximum), 0.1, 0.01, 0.01);
|
log(spec->minimum), log(spec->maximum), 0.1, 0.01, 0.01);
|
||||||
|
|
||||||
|
@ -115,7 +118,7 @@ int main(int argc,char *argv[]) {
|
||||||
|
|
||||||
g_object_set(G_OBJECT(volfilter), "mute", FALSE, NULL);
|
g_object_set(G_OBJECT(volfilter), "mute", FALSE, NULL);
|
||||||
|
|
||||||
spec = (GParamSpecFloat*)gst_dpman_get_param_spec (dpman, "volume");
|
spec = (GParamSpecDouble*)gst_dpman_get_param_spec (dpman, "volume");
|
||||||
volume_adj = (GtkAdjustment*)gtk_adjustment_new(spec->default_value, 0.0, 1.2, 0.1, 0.01, 0.01);
|
volume_adj = (GtkAdjustment*)gtk_adjustment_new(spec->default_value, 0.0, 1.2, 0.1, 0.01, 0.01);
|
||||||
volume_slider = gtk_vscale_new(volume_adj);
|
volume_slider = gtk_vscale_new(volume_adj);
|
||||||
gtk_scale_set_digits(GTK_SCALE(volume_slider), 2);
|
gtk_scale_set_digits(GTK_SCALE(volume_slider), 2);
|
||||||
|
|
|
@ -163,7 +163,7 @@ gst_sinesrc_class_init (GstSineSrcClass *klass)
|
||||||
0.0, 1.0, 0.8, G_PARAM_READWRITE));
|
0.0, 1.0, 0.8, G_PARAM_READWRITE));
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
|
||||||
g_param_spec_boolean ("sync", "Sync", "Synchronize to clock",
|
g_param_spec_boolean ("sync", "Sync", "Synchronize to clock",
|
||||||
TRUE, G_PARAM_READWRITE));
|
FALSE, G_PARAM_READWRITE));
|
||||||
|
|
||||||
gobject_class->set_property = gst_sinesrc_set_property;
|
gobject_class->set_property = gst_sinesrc_set_property;
|
||||||
gobject_class->get_property = gst_sinesrc_get_property;
|
gobject_class->get_property = gst_sinesrc_get_property;
|
||||||
|
@ -188,7 +188,7 @@ gst_sinesrc_init (GstSineSrc *src)
|
||||||
src->samplerate = 44100;
|
src->samplerate = 44100;
|
||||||
src->volume = 1.0;
|
src->volume = 1.0;
|
||||||
src->freq = 440.0;
|
src->freq = 440.0;
|
||||||
src->sync = TRUE;
|
src->sync = FALSE;
|
||||||
|
|
||||||
src->table_pos = 0.0;
|
src->table_pos = 0.0;
|
||||||
src->table_size = 1024;
|
src->table_size = 1024;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#define VOLUME_UNITY_INT 8192 /* internal int for unity */
|
#define VOLUME_UNITY_INT 8192 /* internal int for unity */
|
||||||
#define VOLUME_UNITY_BIT_SHIFT 13 /* number of bits to shift
|
#define VOLUME_UNITY_BIT_SHIFT 13 /* number of bits to shift
|
||||||
for unity */
|
for unity */
|
||||||
#define VOLUME_MAX_FLOAT 4.0
|
#define VOLUME_MAX_DOUBLE 4.0
|
||||||
#define VOLUME_MAX_INT16 32767
|
#define VOLUME_MAX_INT16 32767
|
||||||
#define VOLUME_MIN_INT16 -32768
|
#define VOLUME_MIN_INT16 -32768
|
||||||
|
|
||||||
|
@ -357,8 +357,8 @@ volume_class_init (GstVolumeClass *klass)
|
||||||
FALSE,G_PARAM_READWRITE));
|
FALSE,G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_VOLUME,
|
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_VOLUME,
|
||||||
g_param_spec_float("volume","volume","volume",
|
g_param_spec_double("volume","volume","volume",
|
||||||
0.0,VOLUME_MAX_FLOAT,1.0,G_PARAM_READWRITE));
|
0.0,VOLUME_MAX_DOUBLE,1.0,G_PARAM_READWRITE));
|
||||||
|
|
||||||
gobject_class->set_property = volume_set_property;
|
gobject_class->set_property = volume_set_property;
|
||||||
gobject_class->get_property = volume_get_property;
|
gobject_class->get_property = volume_get_property;
|
||||||
|
@ -403,8 +403,8 @@ volume_init (GstVolume *filter)
|
||||||
);
|
);
|
||||||
gst_dpman_add_required_dparam_callback (
|
gst_dpman_add_required_dparam_callback (
|
||||||
filter->dpman,
|
filter->dpman,
|
||||||
g_param_spec_float("volume","Volume","Volume of the audio",
|
g_param_spec_double("volume","Volume","Volume of the audio",
|
||||||
0.0, VOLUME_MAX_FLOAT, 1.0, G_PARAM_READWRITE),
|
0.0, VOLUME_MAX_DOUBLE, 1.0, G_PARAM_READWRITE),
|
||||||
"scalar",
|
"scalar",
|
||||||
volume_update_volume,
|
volume_update_volume,
|
||||||
filter
|
filter
|
||||||
|
@ -527,7 +527,7 @@ volume_update_volume(const GValue *value, gpointer data)
|
||||||
GstVolume *filter = (GstVolume*)data;
|
GstVolume *filter = (GstVolume*)data;
|
||||||
g_return_if_fail(GST_IS_VOLUME(filter));
|
g_return_if_fail(GST_IS_VOLUME(filter));
|
||||||
|
|
||||||
filter->volume_f = g_value_get_float (value);
|
filter->volume_f = g_value_get_double (value);
|
||||||
filter->volume_i = filter->volume_f*VOLUME_UNITY_INT;
|
filter->volume_i = filter->volume_f*VOLUME_UNITY_INT;
|
||||||
if (filter->mute){
|
if (filter->mute){
|
||||||
filter->real_vol_f = 0.0;
|
filter->real_vol_f = 0.0;
|
||||||
|
@ -578,7 +578,7 @@ volume_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *
|
||||||
g_value_set_boolean (value, filter->mute);
|
g_value_set_boolean (value, filter->mute);
|
||||||
break;
|
break;
|
||||||
case ARG_VOLUME:
|
case ARG_VOLUME:
|
||||||
g_value_set_float (value, filter->volume_f);
|
g_value_set_double (value, filter->volume_f);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
Loading…
Reference in a new issue