1 /* Demo Recorder for MAEMO 5
2 * Copyright (C) 2010 Dru Moore <usr@dru-id.co.uk>
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2,
5 * or (at your option) any later version, as published by the Free
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 public class MixerBin : Gst.Bin {
23 Gst.Element equalizer;
26 List<TrackBin> tracks;
27 Gst.GhostPad sink_pad;
30 public MixerBin(string name) {
32 tracks = new List<TrackBin>();
34 adder = Gst.ElementFactory.make("adder", "adder_source");
36 equalizer = Gst.ElementFactory.make("equalizer-10bands", "eq");
38 panorama = Gst.ElementFactory.make("audiopanorama", "panorama");
40 volume = Gst.ElementFactory.make("volume", "vol");
43 adder.link(equalizer);
44 equalizer.link(panorama);
45 panorama.link(volume);
48 sink_pad = new Gst.GhostPad("sink", adder.get_static_pad("sink"));
49 this.add_pad(sink_pad);
50 src_pad = new Gst.GhostPad("src", volume.get_static_pad("src"));
51 this.add_pad(src_pad);
54 public bool add_track(TrackBin bin) {
58 tracks = new List<TrackBin>();
64 public void remove_all_tracks() {
65 while (null != tracks.first()) {
66 TrackBin track = tracks.first().data as TrackBin;
71 tracks.remove_link(tracks.first());
75 public bool remove_track(TrackBin track) {
82 public new Gst.PadTemplate get_pad_template(string name) {
85 return this.volume.get_pad_template("src");
87 return this.adder.get_pad_template("sink");
89 return this.get_pad_template(name);
93 public void set_volume(double val)
94 requires (val >= 0.0 && val <= 10.0) {
95 volume.set_property("volume", val);
97 public double get_volume() {
99 volume.get_property("volume", ref ret);
100 return ret.get_double();
103 public void set_panorama(double val)
104 requires (val >= -1 && val <= 1) {
105 panorama.set_property("panorama", val);
107 public double get_panorama() {
108 GLib.Value ret = 0.0;
109 panorama.get_property("panorama", ref ret);
110 return ret.get_double();
113 public void set_eq(int band, double val)
114 requires (band > -1 && band < 10)
115 requires (val >= -24 && val <= 12) {
116 equalizer.set_property("band" + band.to_string(), val);
118 public double get_eq(int band) {
119 GLib.Value ret = 0.0;
120 equalizer.get_property("band" + band.to_string(), ref ret);
121 return ret.get_double();