alsa-rawmidi 0.2.14 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,74 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: alsa-rawmidi
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.2.14
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Ari Russo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2011-05-16 00:00:00 -04:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
11
+ date: 2014-10-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
17
14
  name: ffi
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "1.0"
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
25
20
  type: :runtime
26
- version_requirements: *id001
27
- description: Realtime MIDI input and output with Ruby for Linux.
28
- email:
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ description: Realtime MIDI IO with Ruby for Linux via the ALSA RawMIDI API.
28
+ email:
29
29
  - ari.russo@gmail.com
30
30
  executables: []
31
-
32
31
  extensions: []
33
-
34
32
  extra_rdoc_files: []
35
-
36
- files:
33
+ files:
34
+ - LICENSE
35
+ - README.md
37
36
  - lib/alsa-rawmidi.rb
38
- - lib/alsa-rawmidi/map.rb
37
+ - lib/alsa-rawmidi/api.rb
39
38
  - lib/alsa-rawmidi/device.rb
40
- - lib/alsa-rawmidi/output.rb
41
39
  - lib/alsa-rawmidi/input.rb
40
+ - lib/alsa-rawmidi/output.rb
42
41
  - lib/alsa-rawmidi/soundcard.rb
43
- - LICENSE
44
- - README.rdoc
45
- has_rdoc: true
42
+ - test/helper.rb
43
+ - test/input_buffer_test.rb
44
+ - test/io_test.rb
46
45
  homepage: http://github.com/arirusso/alsa-rawmidi
47
- licenses: []
48
-
46
+ licenses:
47
+ - Apache 2.0
48
+ metadata: {}
49
49
  post_install_message:
50
50
  rdoc_options: []
51
-
52
- require_paths:
51
+ require_paths:
53
52
  - lib
54
- required_ruby_version: !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
57
55
  - - ">="
58
- - !ruby/object:Gem::Version
59
- version: "0"
60
- required_rubygems_version: !ruby/object:Gem::Requirement
61
- none: false
62
- requirements:
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
63
60
  - - ">="
64
- - !ruby/object:Gem::Version
61
+ - !ruby/object:Gem::Version
65
62
  version: 1.3.6
66
63
  requirements: []
67
-
68
64
  rubyforge_project: alsa-rawmidi
69
- rubygems_version: 1.6.2
65
+ rubygems_version: 2.2.2
70
66
  signing_key:
71
- specification_version: 3
72
- summary: Realtime MIDI input and output with Ruby for Linux.
67
+ specification_version: 4
68
+ summary: Realtime MIDI IO with Ruby for Linux
73
69
  test_files: []
74
-
@@ -1,45 +0,0 @@
1
- = alsa-rawmidi
2
-
3
- == Summary
4
-
5
- Perform low level realtime MIDI input and output in Ruby for Linux. Uses the ALSA RawMIDI driver interface API.
6
-
7
- Note that in the interest of allowing people on other platforms to utilize your code, you should consider using {unimidi}[http://github.com/arirusso/unimidi]. Unimidi is a platform independent wrapper which implements alsa-rawmidi.
8
-
9
- == Features
10
-
11
- * Input and output on multiple devices concurrently
12
- * Agnostically handle different MIDI Message types (including SysEx)
13
- * Timestamped input events
14
-
15
- == Requirements
16
-
17
- * {ffi}[http://github.com/ffi/ffi] (gem install ffi)
18
- * libasound, libasound-dev packages
19
-
20
- == Install
21
-
22
- * gem install alsa-rawmidi
23
-
24
- == Examples
25
-
26
- * {input}[http://github.com/arirusso/alsa-rawmidi/blob/master/examples/input.rb]
27
- * {output}[http://github.com/arirusso/alsa-rawmidi/blob/master/examples/output.rb]
28
-
29
- == Tests
30
-
31
- * please see {test/config.rb}[http://github.com/arirusso/alsa-rawmidi/blob/master/test/config.rb] before running tests
32
-
33
- == Documentation
34
-
35
- * {rdoc}[http://rdoc.info/gems/alsa-rawmidi]
36
-
37
- == Author
38
-
39
- {Ari Russo}[http://github.com/arirusso] <ari.russo at gmail.com>
40
-
41
- == License
42
-
43
- Apache 2.0, See the file LICENSE
44
-
45
- Copyright (c) 2010-2011 Ari Russo
@@ -1,242 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- module AlsaRawMIDI
4
-
5
- #
6
- # libasound RawMIDI struct, enum and function bindings
7
- #
8
- module Map
9
-
10
- extend FFI::Library
11
- ffi_lib 'libasound'
12
-
13
- Constants = {
14
- :SND_RAWMIDI_STREAM_OUTPUT => 0,
15
- :SND_RAWMIDI_STREAM_INPUT => 1,
16
- :SND_RAWMIDI_APPEND => 0x0001,
17
- :SND_RAWMIDI_NONBLOCK => 0x0002,
18
- :SND_RAWMIDI_SYNC => 0x0004
19
- }
20
-
21
- typedef :ulong, :SndCtlType
22
- typedef :ulong, :SndCtl
23
- typedef :ulong, :SndRawMIDI
24
-
25
- # snd_ctl
26
- class SndCtl < FFI::Struct
27
-
28
- layout :dl_handle, :pointer, # void*
29
- :name, :pointer, # char*
30
- :type, :SndCtlType,
31
- :ops, :pointer, # const snd_ctl_ops_t*
32
- :private_data, :pointer, # void*
33
- :nonblock, :ulong,
34
- :poll_fd, :ulong,
35
- :async_handlers, :ulong
36
- end
37
-
38
- # snd_ctl_card_info
39
- class SndCtlCardInfo < FFI::Struct
40
- layout :card, :int, # card number
41
- :pad, :int, # reserved for future (was type)
42
- :id, [:uchar, 16], # ID of card (user selectable)
43
- :driver, [:uchar, 16], # Driver name
44
- :name, [:uchar, 32], # Short name of soundcard
45
- :longname, [:uchar, 80], # name + info text about soundcard
46
- :reserved_, [:uchar, 16], # reserved for future (was ID of mixer)
47
- :mixername, [:uchar, 80], # visual mixer identification
48
- :components, [:uchar, 128] # card components / fine identification, delimited with one space (AC97 etc..)
49
- end
50
-
51
- # snd_rawmidi_info
52
- class SndRawMIDIInfo < FFI::Struct
53
- layout :device, :uint, # RO/WR (control): device number
54
- :subdevice, :uint, # RO/WR (control): subdevice number
55
- :stream, :int, # WR: stream
56
- :card, :int, # R: card number
57
- :flags, :uint, # SNDRV_RAWMIDI_INFO_XXXX
58
- :id, [:uchar, 64], # ID (user selectable)
59
- :name, [:uchar, 80], # name of device
60
- :subname, [:uchar, 32], # name of active or selected subdevice
61
- :subdevices_count, :uint,
62
- :subdevices_avail, :uint,
63
- :reserved, [:uchar, 64] # reserved for future use
64
- end
65
-
66
- # timespec
67
- class Timespec < FFI::Struct
68
- layout :tv_sec, :time_t, # Seconds since 00:00:00 GMT
69
- :tv_nsec, :long # Additional nanoseconds since
70
- end
71
-
72
- # snd_rawmidi_status
73
- class SndRawMIDIStatus < FFI::Struct
74
- layout :stream, :int,
75
- :timestamp, Timespec.by_value, # Timestamp
76
- :avail, :size_t, # available bytes
77
- :xruns, :size_t, # count of overruns since last status (in bytes)
78
- :reserved, [:uchar, 64] # reserved for future use
79
- end
80
-
81
- # Simple doubly linked list implementation
82
- class LinkedList < FFI::Struct
83
- layout :next, :pointer, # *LinkedList
84
- :prev, :pointer # *LinkedList
85
- end
86
-
87
- # snd_rawmidi
88
- class SndRawMIDI < FFI::Struct
89
- layout :card, :pointer, # *snd_card
90
- :list, LinkedList.by_value,
91
- :device, :uint, # device number
92
- :info_flags, :uint, # SNDRV_RAWMIDI_INFO_XXXX
93
- :id, [:char, 64],
94
- :name, [:char, 80]
95
- end
96
-
97
- # spinlock_t
98
- class Spinlock < FFI::Struct
99
- layout :lock, :uint
100
- end
101
-
102
- # wait_queue_head_t
103
- class WaitQueueHead < FFI::Struct
104
- layout :lock, Spinlock.by_value,
105
- :task_list, LinkedList.by_value
106
- end
107
-
108
- class AtomicT < FFI::Struct
109
- layout :counter, :int # volatile int counter
110
- end
111
-
112
- class Tasklet < FFI::Struct
113
- layout :next, :pointer, # pointer to the next tasklet in the list / void (*func) (unsigned long)
114
- :state, :ulong, # state of the tasklet
115
- :count, AtomicT.by_value, # reference counter
116
- :func, :pointer, # tasklet handler function / void (*func) (unsigned long)
117
- :data, :ulong # argument to the tasklet function
118
- end
119
-
120
- # snd_rawmidi_runtime
121
- class SndRawMIDIRuntime < FFI::Struct
122
- layout :drain, :uint, 1, # drain stage
123
- :oss, :uint, 1, # OSS compatible mode
124
- # midi stream buffer
125
- :buffer, :pointer, # uchar* / buffer for MIDI data
126
- :buffer_size, :size_t, # size of buffer
127
- :appl_ptr, :size_t, # application pointer
128
- :hw_ptr, :size_t, # hardware pointer
129
- :avail_min, :size_t, # min avail for wakeup
130
- :avail, :size_t, # max used buffer for wakeup
131
- :xruns, :size_t, # over/underruns counter
132
- # misc
133
- :lock, Spinlock.by_value,
134
- :sleep, WaitQueueHead.by_value,
135
- # event handler (new bytes, input only)
136
- :substream, :pointer, # void (*event)(struct snd_rawmidi_substream *substream);
137
- # defers calls to event [input] or ops->trigger [output]
138
- :tasklet, Tasklet.by_value,
139
- :private_data, :pointer, # void*
140
- :private_free, :pointer # void (*private_free)(struct snd_rawmidi_substream *substream)
141
- end
142
-
143
- # snd_rawmidi_params
144
- class SndRawMIDIParams < FFI::Struct
145
- layout :stream, :int,
146
- :buffer_size, :size_t, # queue size in bytes
147
- :avail_min, :size_t, # minimum avail bytes for wakeup
148
- :no_active_sensing, :uint, 1, # do not send active sensing byte in close()
149
- :reserved, [:uchar, 16] # reserved for future use
150
- end
151
-
152
- #
153
- # snd_card
154
- #
155
-
156
- # Try to load the driver for a card.
157
- attach_function :snd_card_load, [:int], :int # (int card)
158
- # Try to determine the next card.
159
- attach_function :snd_card_next, [:pointer], :int # (int* card)
160
- # Convert card string to an integer value.
161
- attach_function :snd_card_get_index, [:pointer], :int # (const char* name)
162
- # Obtain the card name.
163
- attach_function :snd_card_get_name, [:int, :pointer], :int # (int card, char **name)
164
- # Obtain the card long name.
165
- attach_function :snd_card_get_longname, [:int, :pointer], :int # (int card, char **name)
166
-
167
- #
168
- # snd_ctl
169
- #
170
-
171
- # Opens a CTL.
172
- attach_function :snd_ctl_open, [:pointer, :pointer, :int], :int # (snd_ctl_t **ctl, const char *name, int mode)
173
- # Opens a CTL using local configuration.
174
- attach_function :snd_ctl_open_lconf, [:pointer, :pointer, :int, :pointer], :int # (snd_ctl_t **ctl, const char *name, int mode, snd_config_t *lconf)
175
- # close CTL handle
176
- attach_function :snd_ctl_close, [:pointer], :int #(snd_ctl_t *ctl)
177
- # set nonblock mode
178
- attach_function :snd_ctl_nonblock, [:pointer, :int], :int # (snd_ctl_t *ctl, int nonblock)
179
- # Get card related information.
180
- attach_function :snd_ctl_card_info, [:pointer, :pointer], :int # (snd_ctl_t *ctl, snd_ctl_card_info_t *info)
181
- # Get card name from a CTL card info.
182
- attach_function :snd_ctl_card_info_get_name, [:pointer], :string # (const snd_ctl_card_info_t *obj) / const char*
183
- # Get info about a RawMidi device.
184
- attach_function :snd_ctl_rawmidi_info, [:SndCtl, :pointer], :int # (snd_ctl_t *ctl, snd_rawmidi_info_t *info)
185
- # Get next RawMidi device number.
186
- attach_function :snd_ctl_rawmidi_next_device, [:SndCtl, :pointer], :int # (snd_ctl_t *ctl, int *device)
187
-
188
- #
189
- # snd_rawmidi
190
- #
191
-
192
- # close RawMidi handle
193
- attach_function :snd_rawmidi_close, [:SndRawMIDI], :int # (snd_rawmidi_t *rmidi)
194
- # drain all bytes in the rawmidi I/O ring buffer
195
- attach_function :snd_rawmidi_drain, [:SndRawMIDI], :int # (snd_rawmidi_t *rmidi)
196
- # drop all bytes in the rawmidi I/O ring buffer immediately
197
- attach_function :snd_rawmidi_drop, [:SndRawMIDI], :int # int ( snd_rawmidi_t * rawmidi)
198
- # set nonblock mode
199
- attach_function :snd_rawmidi_nonblock, [:SndRawMIDI, :int], :int # (snd_rawmidi_t *rmidi, int nonblock)
200
- # Opens a new connection to the RawMidi interface.
201
- attach_function :snd_rawmidi_open, [:pointer, :pointer, :string, :int], :int # (snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi, const char *name, int mode)
202
- # Opens a new connection to the RawMidi interface using local configuration.
203
- attach_function :snd_rawmidi_open_lconf, [:pointer, :pointer, :string, :int, :pointer], :int #(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi, const char *name, int mode, snd_config_t *lconf)
204
- # read MIDI bytes from MIDI stream
205
- attach_function :snd_rawmidi_read, [:SndRawMIDI, :pointer, :size_t], :ssize_t # (snd_rawmidi_t *rmidi, void *buffer, size_t size)
206
- # write MIDI bytes to MIDI stream
207
- attach_function :snd_rawmidi_write, [:SndRawMIDI, :ulong, :size_t], :ssize_t # (snd_rawmidi_t *rmidi, const void *buffer, size_t size)
208
-
209
- #
210
- # snd_rawmidi_info
211
- #
212
-
213
- enum :snd_rawmidi_stream, [
214
- 'SND_RAWMIDI_STREAM_OUTPUT', 0,
215
- 'SND_RAWMIDI_STREAM_INPUT', 1,
216
- 'SND_RAWMIDI_STREAM_LAST', 1
217
- ]
218
-
219
- # get information about RawMidi handle
220
- attach_function :snd_rawmidi_info, [:pointer, :pointer], :int # (snd_rawmidi_t *rmidi, snd_rawmidi_info_t *info)
221
- # get rawmidi count of subdevices
222
- attach_function :snd_rawmidi_info_get_subdevices_count, [:pointer], :uint # (const snd_rawmidi_info_t *obj)
223
- # set rawmidi device number
224
- attach_function :snd_rawmidi_info_set_device, [:pointer, :uint], :void # (snd_rawmidi_info_t *obj, unsigned int val)
225
- # set rawmidi subdevice number
226
- attach_function :snd_rawmidi_info_set_subdevice, [:pointer, :uint], :void # (snd_rawmidi_info_t *obj, unsigned int val)
227
- # set rawmidi stream identifier
228
- attach_function :snd_rawmidi_info_set_stream, [:pointer, :snd_rawmidi_stream], :void # (snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val)
229
- # get size of the snd_rawmidi_info_t structure in bytes
230
- attach_function :snd_rawmidi_info_sizeof, [], :size_t # (void)
231
-
232
- #
233
- # misc
234
- #
235
-
236
- # Convert an error code to a string
237
- attach_function :snd_strerror, [:int], :string # (int errnum) / const char*
238
- # Frees the global configuration tree in snd_config.
239
- attach_function :snd_config_update_free_global, [], :int # (void)
240
-
241
- end
242
- end