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):

  • :event (Clock::Event)
  • :midi_transport (Boolean)

    Whether to respect start/stop commands when the input is MIDI

Returns:



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

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
  klass.new(tempo_or_input, options)
end