Class: MusicTheory::Play
- Inherits:
-
Object
- Object
- MusicTheory::Play
- Includes:
- Output
- Defined in:
- lib/music_theory/play.rb
Instance Attribute Summary collapse
-
#output_file_name ⇒ Object
Returns the value of attribute output_file_name.
-
#playable_music ⇒ Object
Returns the value of attribute playable_music.
-
#samples ⇒ Object
Returns the value of attribute samples.
Instance Method Summary collapse
- #extract_samples ⇒ Object
-
#initialize(playable_music = [], options = {}) ⇒ Play
constructor
A new instance of Play.
Methods included from Output
#buffer_format, #format, #output_track, #play, #sample_rate
Constructor Details
#initialize(playable_music = [], options = {}) ⇒ Play
Returns a new instance of Play.
8 9 10 11 12 13 14 |
# File 'lib/music_theory/play.rb', line 8 def initialize(playable_music = [], = {} ) @playable_music = playable_music @output_file_name = [:output_file_name] || 'music' @play = [:play] || true extract_samples play if play end |
Instance Attribute Details
#output_file_name ⇒ Object
Returns the value of attribute output_file_name.
6 7 8 |
# File 'lib/music_theory/play.rb', line 6 def output_file_name @output_file_name end |
#playable_music ⇒ Object
Returns the value of attribute playable_music.
6 7 8 |
# File 'lib/music_theory/play.rb', line 6 def playable_music @playable_music end |
#samples ⇒ Object
Returns the value of attribute samples.
6 7 8 |
# File 'lib/music_theory/play.rb', line 6 def samples @samples end |
Instance Method Details
#extract_samples ⇒ Object
16 17 18 |
# File 'lib/music_theory/play.rb', line 16 def extract_samples @samples = playable_music.map { |music| music.samples }.flatten end |