Permalink
Browse files

Code to accomodate setting a MIDI destination manually.

  • Loading branch information...
1 parent 75c468e commit ded5543ca12f492f6472be0d93e51235ffee3b2f @gilesbowkett committed Oct 12, 2008
Showing with 5 additions and 2 deletions.
  1. +3 −1 lib/arkx.rb
  2. +2 −1 lib/midi/practical_ruby_projects/live_midi.rb
View
@@ -4,9 +4,11 @@ def initialize(attributes)
@generator = attributes[:generator]
# @measures = attributes[:measures] || 32
@beats = attributes[:beats] || 16
+ midi_destination = attributes[:midi_destination] || 0
@evil_timer_offset_wtf = attributes[:evil_timer_offset_wtf]
@midi = LiveMIDI.new(:clock => @clock = attributes[:clock], # confusion!!!!!!!!!!
- :logging => attributes[:logging] || false)
+ :logging => attributes[:logging] || false,
+ :midi_destination => midi_destination)
end
def play(music)
music.each {|note| @midi.play(note)}
@@ -25,6 +25,7 @@ def to_code
def initialize(options)
@clock = options[:clock]
@logging = options[:logging]
+ @midi_destination = options[:midi_destination]
if @logging
puts <<LOG_PLAYBACK
require 'lib/archaeopteryx'
@@ -64,7 +65,7 @@ def open
number_of_destinations = CoreMIDI.mIDIGetNumberOfDestinations()
raise NoMIDIDestinations if number_of_destinations < 1
- @destination = CoreMIDI.mIDIGetDestination(0)
+ @destination = CoreMIDI.mIDIGetDestination(@midi_destination)
end
def close

0 comments on commit ded5543

Please sign in to comment.