Class: Beats::Track
- Inherits:
-
Object
- Object
- Beats::Track
- Defined in:
- lib/beats/track.rb
Overview
Domain object which models a kit sound playing a rhythm. For example, a bass drum playing every quarter note for two measures.
This object is like sheet music; the AudioEngine is responsible creating actual audio data for a Track (with the help of a Kit).
Constant Summary collapse
- REST =
"."
- BEAT =
"X"
- BARLINE =
"|"
Instance Attribute Summary collapse
-
#beats ⇒ Object
readonly
Returns the value of attribute beats.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rhythm ⇒ Object
Returns the value of attribute rhythm.
Instance Method Summary collapse
-
#initialize(name, rhythm) ⇒ Track
constructor
A new instance of Track.
- #step_count ⇒ Object
Constructor Details
#initialize(name, rhythm) ⇒ Track
Returns a new instance of Track.
15 16 17 18 19 |
# File 'lib/beats/track.rb', line 15 def initialize(name, rhythm) # TODO: Add validation for input parameters @name = name self.rhythm = rhythm end |
Instance Attribute Details
#beats ⇒ Object (readonly)
Returns the value of attribute beats.
55 56 57 |
# File 'lib/beats/track.rb', line 55 def beats @beats end |
#name ⇒ Object
Returns the value of attribute name.
54 55 56 |
# File 'lib/beats/track.rb', line 54 def name @name end |
#rhythm ⇒ Object
Returns the value of attribute rhythm.
55 56 57 |
# File 'lib/beats/track.rb', line 55 def rhythm @rhythm end |
Instance Method Details
#step_count ⇒ Object
50 51 52 |
# File 'lib/beats/track.rb', line 50 def step_count @rhythm.length end |