Module: Topaz::TempoSource

Extended by:
TempoSource
Included in:
TempoSource
Defined in:
lib/topaz/tempo_source.rb

Overview

Construct a tempo source object

Instance Method Summary collapse

Instance Method Details

#new(tempo_or_input, options = {}) ⇒ MIDIClockInput, Timer

Construct a tempo source

Parameters:

  • tempo_or_input (Fixnum, UniMIDI::Input)
  • options (Hash) (defaults to: {})

Options Hash (options):

Returns:



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/topaz/tempo_source.rb', line 13

def new(tempo_or_input, options = {})
  klass = case tempo_or_input
  when Numeric then Timer
  when UniMIDI::Input then MIDIClockInput
  else
    raise "Not a valid tempo source"
  end
  source = klass.new(tempo_or_input, :event => options[:event])
  source.interval = options[:interval] unless options[:interval].nil?
  source
end