pipeline volume?

  • Roly

    Roly - 2012-04-15

    I'm trying to control volume from outside an audio pipeline:

    play1AudioPipe = new GSPipeline(this,"filesrc location=av1.ogg ! oggdemux ! vorbisdec ! audioconvert "
      + "! volume volume = 1 ! level ! directsoundsink", GSVideo.AUDIO);



    The volume control inside the pipeline works but the code beneath it has no effect. This is on Windows. I pretty new to gstreamer so not sure if I'm missing something basic or perhaps the volume element is wrong somehow?

  • Andres Colubri

    Andres Colubri - 2012-04-16

    The problem is that the GSPipeline.volume() method tries to set a "volume" property in the pipeline object, but this property is available only inside the volume element.

    One solution would be to create a subclass from GSPipeline that retrieves the volume element from the internal pipeline object and then sets the volume property. Something like this:

    import codeanticode.gsvideo.*;
    import org.gstreamer.Element;
    AudioPipeline pipeline;
    void setup() {
      size(200, 200);  
      pipeline = new AudioPipeline(this, "audiotestsrc ! audioconvert ! volume name=vol volume=1 ! directsoundsink");
    void draw() {
    class AudioPipeline extends GSPipeline {
      Element volumeElement = null;
      AudioPipeline(PApplet parent, String pipelineString)  {
        super(parent, pipelineString, GSVideo.AUDIO);
      void volume(float value) {
        if (volumeElement == null) {
          //List<Element> elements = gpipeline.getElementsSorted();
          volumeElement = gpipeline.getElementByName("vol");
        volumeElement.set("volume", value);   
  • Roly

    Roly - 2012-04-26

    Ok I understand why it isn't working then. Being quite new to Processing and GStreamer the solution will take a little longer to get my head around I think.

    I've been wondering how to work with pipeline elements more dynamically as so far I'm just starting and stopping a number of pipelines for different purposes like webcam preview, record, playback etc.  The GStreamer documentation can be quite intimidating for a novice which is why GSVideo and the included examples have been so helpful.

    Hopefully this will get me started on more in-depth learning so thanks very much for your help.

  • Roly

    Roly - 2012-04-27

    Actually I managed to work this into my code very quickly, great !

    I'm now finding problems in functionality of an exported windows application (basically it crashes straight away) on one of my machines without GStreamer already installed. I'm wondering if it could be missing another library? I've already included the gstreamer folder from GSVideo in my application's directory which has been working well in the past. Is there something to do with org.gstreamer.Element; that could be missing?



Log in to post a comment.