module SonicPiAkaiApcMini::Controller

Constants

Configs
Model

Public Instance Methods

model() click to toggle source
# File lib/sonic-pi-akai-apc-mini/controller.rb, line 21
def model
  @_model || raise(Error, 'model not initialized')
end
model=(model_name) click to toggle source
# File lib/sonic-pi-akai-apc-mini/controller.rb, line 7
def model=(model_name)
  if @_model
    if @_model.name == model_name
      return
    else
      raise Error, 'Changing the model is not supported. Please restart Sonic Pi and initialize with new model name'
    end
  end

  config = Configs.fetch(model_name.to_sym) { raise Error, "model #{model_name} not supported" }

  @_model = Model.new(config.merge(name: model_name))
end