Class: AudioPlayback::Playback::Frame
- Inherits:
-
Object
- Object
- AudioPlayback::Playback::Frame
- Extended by:
- Forwardable
- Defined in:
- lib/audio-playback/playback/frame.rb
Overview
A single frame of audio data in the FrameSet
Instance Attribute Summary collapse
-
#frame ⇒ Object
readonly
Returns the value of attribute frame.
Instance Method Summary collapse
-
#fill(num, options = {}) ⇒ Boolean
Fill up the given number of channels at the end of the frame with duplicate data from the last existing channel.
-
#initialize(frame) ⇒ Frame
constructor
A new instance of Frame.
-
#truncate(num) ⇒ Frame
Truncate the frame to the given size.
Constructor Details
Instance Attribute Details
#frame ⇒ Object (readonly)
Returns the value of attribute frame.
10 11 12 |
# File 'lib/audio-playback/playback/frame.rb', line 10 def frame @frame end |
Instance Method Details
#fill(num, options = {}) ⇒ Boolean
Fill up the given number of channels at the end of the frame with duplicate data from the last
existing channel
34 35 36 37 38 39 40 41 |
# File 'lib/audio-playback/playback/frame.rb', line 34 def fill(num, = {}) if (channels = [:channels]).nil? @frame.fill(@frame.last, @frame.size, num) else fill_for_channels([:num_channels], channels) end true end |
#truncate(num) ⇒ Frame
Truncate the frame to the given size
22 23 24 25 |
# File 'lib/audio-playback/playback/frame.rb', line 22 def truncate(num) @frame.slice!(num..-1) self end |