Class: TEF::ProgramSelection::ProgramSheet

Inherits:
Sequencing::Sheet show all
Defined in:
lib/tef/ProgramSelection/SequenceCollection.rb

Overview

Convenience class. Mainly extends Sequencing::Sheet with an #add_key function, which self-registers this program under the last created SequenceCollection.

Instance Attribute Summary collapse

Attributes inherited from Sequencing::Sheet

#end_time, #fill_block, #repeat_time, #setup_block, #start_time, #teardown_block, #tempo

Instance Method Summary collapse

Methods inherited from Sequencing::Sheet

#notes, #setup, #teardown

Constructor Details

#initialize {|_self| ... } ⇒ ProgramSheet

Returns a new instance of ProgramSheet.

Yields:

  • (_self)

Yield Parameters:



119
120
121
122
123
# File 'lib/tef/ProgramSelection/SequenceCollection.rb', line 119

def initialize()
	super()

	yield(self) if block_given?
end

Instance Attribute Details

#program_keyObject

Optional key to use when passing to Sequencing::Player#[]=. Different keys are necessary to not overwrite the previous running program.



117
118
119
# File 'lib/tef/ProgramSelection/SequenceCollection.rb', line 117

def program_key
  @program_key
end

Instance Method Details

#add_key(title, groups = [], variation = '.mp3', options = nil) ⇒ Object

Register this sheet under a given key. Syntax is the same as Selector#register_ID, with a default variant of ‘.mp3’ to comply with the default variant set by SoundCollection.



129
130
131
132
133
134
135
136
137
138
# File 'lib/tef/ProgramSelection/SequenceCollection.rb', line 129

def add_key(title, groups = [], variation = '.mp3', options = nil)
	prog_collection = SequenceCollection.current_collection
	raise "No program collection was instantiated yet!" unless prog_collection

	id = ID.new(title, groups, variation)

	prog_collection[id] = self

	prog_collection.sheet_opts[id] = options if options.is_a? Hash
end