Class: EasyAudio::EasyStream
- Defined in:
- lib/easy_audio.rb
Overview
A simplified Stream class whose processor block only processes a single frame at a time. See Waveforms for a set of pre-fabricated EasyStream processor blocks for examples of how to process a single stream.
Note that instead of passing state information as an argument to the block, state is instead stored in the class itself, and the block is instance evaluated. This makes it a bit slower to process, but much more convenient for creating blocks.
See #initialize for usage examples.
Instance Attribute Summary collapse
-
#amp ⇒ Object
Returns the value of attribute amp.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#current_sample ⇒ Object
readonly
Returns the value of attribute current_sample.
-
#frame ⇒ Object
Returns the value of attribute frame.
-
#frequency ⇒ Object
Returns the value of attribute frequency.
-
#i ⇒ Object
readonly
Returns the value of attribute i.
-
#num_frames ⇒ Object
readonly
Returns the value of attribute num_frames.
-
#samples ⇒ Object
readonly
Returns the value of attribute samples.
-
#status_info ⇒ Object
readonly
Returns the value of attribute status_info.
-
#step ⇒ Object
readonly
Returns the value of attribute step.
-
#time_info ⇒ Object
readonly
Returns the value of attribute time_info.
-
#user_data ⇒ Object
readonly
Returns the value of attribute user_data.
Attributes inherited from Stream
#fn, #frame_size, #input_channels, #latency, #output_channels, #sample_rate
Instance Method Summary collapse
-
#initialize(opts = {}) { ... } ⇒ EasyStream
constructor
Creates a new stream for processing audio. Call Stream#start to start processing.
Methods inherited from Stream
Constructor Details
#initialize(opts = {}) { ... } ⇒ EasyStream
Creates a new stream for processing audio. Call Stream#start to start processing.
146 147 148 149 150 151 152 153 |
# File 'lib/easy_audio.rb', line 146 def initialize(opts = {}, &block) @frequency = opts[:freq] || 440.0 @amp = opts[:amp] || 1.0 @frame = 0 @channel = 0 super(opts, &block) end |
Instance Attribute Details
#amp ⇒ Object
Returns the value of attribute amp.
155 156 157 |
# File 'lib/easy_audio.rb', line 155 def amp @amp end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
156 157 158 |
# File 'lib/easy_audio.rb', line 156 def channel @channel end |
#current_sample ⇒ Object (readonly)
Returns the value of attribute current_sample.
157 158 159 |
# File 'lib/easy_audio.rb', line 157 def current_sample @current_sample end |
#frame ⇒ Object
Returns the value of attribute frame.
155 156 157 |
# File 'lib/easy_audio.rb', line 155 def frame @frame end |
#frequency ⇒ Object
Returns the value of attribute frequency.
155 156 157 |
# File 'lib/easy_audio.rb', line 155 def frequency @frequency end |
#i ⇒ Object (readonly)
Returns the value of attribute i.
157 158 159 |
# File 'lib/easy_audio.rb', line 157 def i @i end |
#num_frames ⇒ Object (readonly)
Returns the value of attribute num_frames.
156 157 158 |
# File 'lib/easy_audio.rb', line 156 def num_frames @num_frames end |
#samples ⇒ Object (readonly)
Returns the value of attribute samples.
156 157 158 |
# File 'lib/easy_audio.rb', line 156 def samples @samples end |
#status_info ⇒ Object (readonly)
Returns the value of attribute status_info.
157 158 159 |
# File 'lib/easy_audio.rb', line 157 def status_info @status_info end |
#step ⇒ Object (readonly)
Returns the value of attribute step.
156 157 158 |
# File 'lib/easy_audio.rb', line 156 def step @step end |
#time_info ⇒ Object (readonly)
Returns the value of attribute time_info.
157 158 159 |
# File 'lib/easy_audio.rb', line 157 def time_info @time_info end |
#user_data ⇒ Object (readonly)
Returns the value of attribute user_data.
157 158 159 |
# File 'lib/easy_audio.rb', line 157 def user_data @user_data end |