-
Notifications
You must be signed in to change notification settings - Fork 0
/
asound.rb
86 lines (85 loc) · 1.7 KB
/
asound.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require '_asound'
module Snd::Seq
class << self
def open
Snd::Seq::Seq.new
end
end
class Seq
def create_simple_port(name, caps, type)
Port.new(self, _create_simple_port(name, caps, type))
end
def alloc_queue
Queue.new(self, _alloc_queue)
end
def change_queue_tempo(q, tempo, ev = nil)
_change_queue_tempo(q, tempo, ev)
end
def start_queue(q, ev = nil)
_start_queue(q, ev)
end
def stop_queue(q, ev = nil)
_stop_queue(q, ev)
end
def continue_queue(q, ev = nil)
_continue_queue(q, ev)
end
end
class Port
def initialize(seq, n)
@seq = seq
@n = n
end
def to_int() @n; end
def connect_to(client, port)
@seq.connect_to(@n, client, port)
end
def connect_from(client, port)
@seq.connect_from(@n, client, port)
end
end
class Queue
def initialize(seq, n)
@seq = seq
@n = n
end
def to_int() @n; end
def ppq=(ppq)
@seq.change_queue_ppq(@n, ppq)
end
def change_tempo(bpm, ev = nil)
@seq.change_queue_tempo(@n, 60000000 / bpm, ev)
end
def tempo=(bpm)
change_tempo(bpm)
end
def start(ev = nil)
@seq.start_queue(@n, ev)
end
def stop(ev = nil)
@seq.stop_queue(@n, ev)
end
def continue(ev = nil)
@seq.continue_queue(@n, ev)
end
def tick_time
@seq.queue_get_tick_time(@n)
end
end
# class Event
# def to_subscribers=(val)
# if not val
# raise RuntimeError.new
# else
# set_subs
# end
# end
# def direct=(val)
# if not val
# raise RuntimeError.new
# else
# set_direct
# end
# end
# end
end