Class: Zgomot::Drivers::Mgr

Inherits:
Object show all
Extended by:
Forwardable
Defined in:
lib/zgomot/drivers/mgr.rb

Class Method Summary collapse

Class Method Details

.driver_nameObject



20
21
22
23
24
25
26
27
# File 'lib/zgomot/drivers/mgr.rb', line 20

def driver_name
  case RUBY_PLATFORM
    when /darwin/
      'core_midi'
  else
     raise "platform not supported"
  end
end

.load_driverObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/zgomot/drivers/mgr.rb', line 7

def load_driver
  driver_name = self.driver_name
  driver_path = "zgomot/drivers/#{driver_name}"
  Zgomot.logger.info "LOADING DRIVER: #{driver_path}"
  begin
    require driver_path
  rescue LoadError => e
    raise LoadError, "Could not load driver '#{driver_path}'."
  end
  driver_class = "Zgomot::Drivers::" + driver_name.split('_').map{|n| n.capitalize}.join
  @driver = Object.module_eval("::#{driver_class}").new
  Zgomot.logger.info "DRIVER #{driver_class} CREATED"
end

.method_missing(method, *args) ⇒ Object



28
29
30
# File 'lib/zgomot/drivers/mgr.rb', line 28

def method_missing(method, *args)
  return @driver.send(method, *args)
end