Class: Rtmidi::MidiOut::Release

Inherits:
Object
  • Object
show all
Defined in:
lib/rtmidi/midi_out.rb

Instance Method Summary collapse

Constructor Details

#initialize(handle) ⇒ Release

Returns a new instance of Release.



9
10
11
12
# File 'lib/rtmidi/midi_out.rb', line 9

def initialize(handle)
  @handle = handle
  @mutex = Mutex.new
end

Instance Method Details

#callObject



14
15
16
# File 'lib/rtmidi/midi_out.rb', line 14

def call(*)
  free
end

#freeObject



18
19
20
21
22
23
24
25
# File 'lib/rtmidi/midi_out.rb', line 18

def free
  @mutex.synchronize do
    return if @handle.nil? || @handle.null?

    Native.rtmidi_out_free(@handle)
    @handle = nil
  end
end