Class: WaitUp::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/wait_up/pipeline.rb

Overview

Wait Up pipeline class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, tempo) ⇒ Pipeline

Returns a new instance of Pipeline.



10
11
12
13
14
15
16
17
18
# File 'lib/wait_up/pipeline.rb', line 10

def initialize(filename, tempo)
  @filename = filename
  @tempo = tempo

  fill_sink_bin
  link_elements

  set_up_play_bin
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



8
9
10
# File 'lib/wait_up/pipeline.rb', line 8

def filename
  @filename
end

#tempoObject (readonly)

Returns the value of attribute tempo.



8
9
10
# File 'lib/wait_up/pipeline.rb', line 8

def tempo
  @tempo
end

Instance Method Details

#audiosinkObject



38
39
40
# File 'lib/wait_up/pipeline.rb', line 38

def audiosink
  @audiosink ||= Gst::ElementFactory.make("autoaudiosink", "audiosink")
end

#playObject



20
21
22
# File 'lib/wait_up/pipeline.rb', line 20

def play
  play_bin.set_state :playing
end

#play_binObject



24
25
26
# File 'lib/wait_up/pipeline.rb', line 24

def play_bin
  @play_bin ||= Gst::ElementFactory.make "playbin", nil
end

#postconverterObject



42
43
44
# File 'lib/wait_up/pipeline.rb', line 42

def postconverter
  @postconverter ||= Gst::ElementFactory.make("audioconvert", "postconverter")
end

#preconverterObject



46
47
48
# File 'lib/wait_up/pipeline.rb', line 46

def preconverter
  @preconverter ||= Gst::ElementFactory.make("audioconvert", "preconverter")
end

#sink_binObject



28
29
30
# File 'lib/wait_up/pipeline.rb', line 28

def sink_bin
  @sink_bin ||= Gst::Bin.new("sinkbin")
end

#speed_changerObject



32
33
34
35
36
# File 'lib/wait_up/pipeline.rb', line 32

def speed_changer
  @speed_changer ||= Gst::ElementFactory.make("pitch", "speed changer").tap do |element|
    element.set_property "tempo", tempo
  end
end