1 /* GStreamer StreamVolume
2 * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GST_STREAM_VOLUME_H__
21 #define __GST_STREAM_VOLUME_H__
27 #define GST_TYPE_STREAM_VOLUME \
28 (gst_stream_volume_get_type ())
29 #define GST_STREAM_VOLUME(obj) \
30 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_STREAM_VOLUME, GstStreamVolume))
31 #define GST_STREAM_VOLUME_INTERFACE(iface) \
32 (G_TYPE_CHECK_INTERFACE_CAST ((iface), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface))
33 #define GST_IS_STREAM_VOLUME(obj) \
34 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_STREAM_VOLUME))
35 #define GST_IS_STREAM_VOLUME_INTERFACE(iface) \
36 (G_TYPE_CHECK_INTERFACE_TYPE ((iface), GST_TYPE_STREAM_VOLUME))
37 #define GST_STREAM_VOLUME_GET_INTERFACE(inst) \
38 (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_STREAM_VOLUME, GstStreamVolumeInterface))
40 typedef struct _GstStreamVolume GstStreamVolume;
41 typedef struct _GstStreamVolumeInterface GstStreamVolumeInterface;
43 struct _GstStreamVolumeInterface {
44 GTypeInterface parent;
47 gpointer _gst_reserved[GST_PADDING];
51 * GstStreamVolumeFormat:
52 * @GST_STREAM_VOLUME_FORMAT_LINEAR: Linear scale factor, 1.0 = 100%
53 * @GST_STREAM_VOLUME_FORMAT_CUBIC: Cubic volume scale
54 * @GST_STREAM_VOLUME_FORMAT_DB: Logarithmic volume scale (dB, amplitude not power)
56 * Different representations of a stream volume. gst_stream_volume_convert_volume()
57 * allows to convert between the different representations.
59 * Formulas to convert from a linear to a cubic or dB volume are
60 * cbrt(val) and 20 * log10 (val).
65 GST_STREAM_VOLUME_FORMAT_LINEAR = 0,
66 GST_STREAM_VOLUME_FORMAT_CUBIC,
67 GST_STREAM_VOLUME_FORMAT_DB
68 } GstStreamVolumeFormat;
70 GType gst_stream_volume_get_type (void);
71 void gst_stream_volume_set_volume (GstStreamVolume *volume,
72 GstStreamVolumeFormat format,
74 gdouble gst_stream_volume_get_volume (GstStreamVolume *volume,
75 GstStreamVolumeFormat format);
77 void gst_stream_volume_set_mute (GstStreamVolume *volume,
79 gboolean gst_stream_volume_get_mute (GstStreamVolume *volume);
81 gdouble gst_stream_volume_convert_volume (GstStreamVolumeFormat from,
82 GstStreamVolumeFormat to,
83 gdouble val) G_GNUC_CONST;
87 #endif /* __GST_STREAM_VOLUME_H__ */