Class: TEF::Sequencing::Sheet
- Inherits:
-
Object
- Object
- TEF::Sequencing::Sheet
- Defined in:
- lib/tef/Sequencing/Sheet.rb
Overview
Sheet class
This class is meant as a container for the minimum amount of information necessary to instantiate a SheetSequence.
It provides a clean and easy way for the user to define a sequence of events, as well as minimally necessary information such as the speed of the sequence or the starting and ending times.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#end_time ⇒ Numeric
The local ending-time.
-
#fill_block ⇒ nil, Proc
readonly
Block to call when setting up the SheetSequence.
-
#repeat_time ⇒ Object
If set non-nil, determines the timespan after which a given sequence will repeat itself.
-
#setup_block ⇒ Object
readonly
Returns the value of attribute setup_block.
-
#start_time ⇒ Numeric
The local starting time.
-
#teardown_block ⇒ Object
readonly
Returns the value of attribute teardown_block.
-
#tempo ⇒ Numeric?
Tempo of the sheet.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Sheet
constructor
Initialize a new Sheet.
- #notes(&block) ⇒ Object
-
#setup(&block) ⇒ Object
Configure a block to call when setting up the SheetSequence.
-
#teardown(&block) ⇒ Object
Configure the block to call when the SheetSequence is about to be torn down.
Constructor Details
#initialize {|_self| ... } ⇒ Sheet
Initialize a new Sheet.
The user should configure the sheet by writing into #start_time, #end_time and by supplying at least a #sequence
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/tef/Sequencing/Sheet.rb', line 55 def initialize() @start_time = nil; @end_time = nil; @repeat_time = nil; @tempo = nil @fill_block = nil; @setup_block = nil; @teardown_block = nil; yield(self) if(block_given?) end |
Instance Attribute Details
#end_time ⇒ Numeric
Returns The local ending-time. Defaults to nil, i.e. it will be auto-determined by the notes in the sheet. Affects when the sheet is torn down and stops execution!.
26 27 28 |
# File 'lib/tef/Sequencing/Sheet.rb', line 26 def end_time @end_time end |
#fill_block ⇒ nil, Proc (readonly)
Returns Block to call when setting up the TEF::Sequencing::SheetSequence. This is the main way of letting the user configure the TEF::Sequencing::SheetSequence, as this block is called from the context of the sheet itself. Look at the functions of the Sheet Sequence for more details.
46 47 48 |
# File 'lib/tef/Sequencing/Sheet.rb', line 46 def fill_block @fill_block end |
#repeat_time ⇒ Object
If set non-nil, determines the timespan after which a given sequence will repeat itself. Does not influence start_time and end_time.
31 32 33 |
# File 'lib/tef/Sequencing/Sheet.rb', line 31 def repeat_time @repeat_time end |
#setup_block ⇒ Object (readonly)
Returns the value of attribute setup_block.
47 48 49 |
# File 'lib/tef/Sequencing/Sheet.rb', line 47 def setup_block @setup_block end |
#start_time ⇒ Numeric
Returns The local starting time. Defaults to 0, i.e the sheet will start playing immediately. This does not affect the actual time scaling, but instead is merely used to know when to instantiate the TEF::Sequencing::SheetSequence.
20 21 22 |
# File 'lib/tef/Sequencing/Sheet.rb', line 20 def start_time @start_time end |
#teardown_block ⇒ Object (readonly)
Returns the value of attribute teardown_block.
48 49 50 |
# File 'lib/tef/Sequencing/Sheet.rb', line 48 def teardown_block @teardown_block end |
#tempo ⇒ Numeric?
Returns Tempo of the sheet. Defines the execution speed in BPM. If left nil, the execution speed of the parent sheet is used.
36 37 38 |
# File 'lib/tef/Sequencing/Sheet.rb', line 36 def tempo @tempo end |
Instance Method Details
#notes(&block) ⇒ Object
81 82 83 |
# File 'lib/tef/Sequencing/Sheet.rb', line 81 def notes(&block) @fill_block = block; end |
#setup(&block) ⇒ Object
Configure a block to call when setting up the TEF::Sequencing::SheetSequence. This is the main way of letting the user configure the TEF::Sequencing::SheetSequence, as this block is called from the context of the sheet itself. Look at the functions of the Sheet Sequence for more details.
77 78 79 |
# File 'lib/tef/Sequencing/Sheet.rb', line 77 def setup(&block) @setup_block = block; end |
#teardown(&block) ⇒ Object
Configure the block to call when the TEF::Sequencing::SheetSequence is about to be torn down. Use this to stop or delete any resources allocated to the sheet.
Guaranteed to always be called.
90 91 92 |
# File 'lib/tef/Sequencing/Sheet.rb', line 90 def teardown(&block) @teardown_block = block; end |