ruby-groove 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +68 -0
- data/lib/groove.rb +5 -0
- data/lib/groove/fingerprinter.rb +184 -0
- data/lib/groove/groove.rb +768 -0
- data/lib/groove/loudness.rb +133 -0
- data/lib/groove/player.rb +183 -0
- data/lib/groove/version.rb +5 -0
- data/test/lib/groove.rb +6 -0
- data/test/lib/test_version.rb +8 -0
- data/test/test_helper.rb +2 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8b837650a481fa113d43ffb9c2fcb0761e75344c
|
4
|
+
data.tar.gz: 8877ffbc45b368074456838bb975e34dce36bea0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3d493bcece4b16e368bd7ebbce5fdc6785e54b9acdfc8180220b8d3fc8d512656501a7f9d3c14b12284721ae69b98c2cbc25a4cd412bcfc6d74748ebf0a19a5c
|
7
|
+
data.tar.gz: b90c52bf94c14c649edd67ec02246554bb54edb22fe91e2012da62d29b13d0976681bab93576192246d3b058a6b5fcb253a0ed0b6dc15ad2955a61996ccc0ccc
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 john muhl
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
ruby bindings to [libgroove][libgroove].
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
First install [libgroove][libgroove] (see below) then:
|
6
|
+
|
7
|
+
gem install ruby-groove
|
8
|
+
|
9
|
+
### libgroove
|
10
|
+
|
11
|
+
#### Ubuntu, FreeBSD and Debian
|
12
|
+
|
13
|
+
Ubuntu, FreeBSD and Debian users can use a [pre-built package][packages].
|
14
|
+
|
15
|
+
#### Mac OS X
|
16
|
+
|
17
|
+
Install with [Homebrew][brew]
|
18
|
+
|
19
|
+
~~~ sh
|
20
|
+
brew tap johnmuhl/libgroove
|
21
|
+
brew install libgroove
|
22
|
+
~~~
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
TODO: Write usage instructions here
|
27
|
+
|
28
|
+
## Generating the bindings
|
29
|
+
|
30
|
+
[ffi_gen][ffi_gen] automatically creates the bindings from the
|
31
|
+
[libgroove][libgroove] header files. Use the included [Vagrantfile][vagrant]
|
32
|
+
and the steps below to setup a build environment.
|
33
|
+
|
34
|
+
~~~ sh
|
35
|
+
# host computer
|
36
|
+
cd ruby-groove
|
37
|
+
vagrant up
|
38
|
+
vagrant ssh
|
39
|
+
~~~
|
40
|
+
|
41
|
+
~~~ sh
|
42
|
+
# virtual machine
|
43
|
+
sudo apt-add-repository ppa:andrewrk/libgroove
|
44
|
+
sudo apt-get update
|
45
|
+
sudo apt-get install libgroove-dev libgrooveplayer-dev libgrooveloudness-dev libgroovefingerprinter-dev ruby ruby-dev clang libclang-dev llvm llvm-dev
|
46
|
+
sudo ln -sv /usr/lib/llvm-3.4/lib/libclang.so /usr/lib/libclang.so
|
47
|
+
sudo gem install bundler
|
48
|
+
cd /vagrant
|
49
|
+
bundle install
|
50
|
+
rake generate_ffi
|
51
|
+
~~~
|
52
|
+
|
53
|
+
Bindings are output to `lib`.
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
1. [Fork it](https://github.com/johnmuhl/ruby-groove/fork)
|
58
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
59
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
60
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
61
|
+
5. Create a new Pull Request
|
62
|
+
|
63
|
+
[brew]: http://brew.sh/
|
64
|
+
[ffi_gen]: https://github.com/neelance/ffi-gen
|
65
|
+
[libebur128]: https://github.com/jiixyj/libebur128
|
66
|
+
[libgroove]: https://github.com/andrewrk/libgroove
|
67
|
+
[packages]: https://github.com/andrewrk/libgroove#pre-built-packages
|
68
|
+
[vagrant]: http://www.vagrantup.com/
|
data/lib/groove.rb
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
# Generated by ffi_gen. Please do not change this file by hand.
|
2
|
+
|
3
|
+
require 'ffi'
|
4
|
+
|
5
|
+
module Groove::Fingerprinter
|
6
|
+
extend FFI::Library
|
7
|
+
ffi_lib 'groovefingerprinter'
|
8
|
+
|
9
|
+
def self.attach_function(name, *_)
|
10
|
+
begin; super; rescue FFI::NotFoundError => e
|
11
|
+
(class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# (Not documented)
|
16
|
+
#
|
17
|
+
# = Fields:
|
18
|
+
# :fingerprint ::
|
19
|
+
# (FFI::Pointer(*Int32T)) raw fingerprint. A fingerprint is an array of signed 32-bit integers.
|
20
|
+
# :fingerprint_size ::
|
21
|
+
# (Integer) the number of 32-bit integers in the fingerprint array
|
22
|
+
# :duration ::
|
23
|
+
# (Float) how many seconds long this song is
|
24
|
+
# :item ::
|
25
|
+
# (FFI::Pointer(*GroovePlaylistItem)) the playlist item that this info applies to.
|
26
|
+
# When this is NULL this is the end-of-playlist sentinel and
|
27
|
+
# other properties are undefined.
|
28
|
+
class GrooveFingerprinterInfo < FFI::Struct
|
29
|
+
layout :fingerprint, :pointer,
|
30
|
+
:fingerprint_size, :int,
|
31
|
+
:duration, :double,
|
32
|
+
:item, :pointer
|
33
|
+
end
|
34
|
+
|
35
|
+
# (Not documented)
|
36
|
+
#
|
37
|
+
# = Fields:
|
38
|
+
# :info_queue_size ::
|
39
|
+
# (Integer) maximum number of GrooveFingerprinterInfo items to store in this
|
40
|
+
# fingerprinter's queue. this defaults to MAX_INT, meaning that
|
41
|
+
# the fingerprinter will cause the decoder to decode the entire
|
42
|
+
# playlist. if you want to instead, for example, obtain fingerprints
|
43
|
+
# at the same time as playback, you might set this value to 1.
|
44
|
+
# :sink_buffer_size ::
|
45
|
+
# (Integer) how big the sink buffer should be, in sample frames.
|
46
|
+
# groove_fingerprinter_create defaults this to 8192
|
47
|
+
# :playlist ::
|
48
|
+
# (FFI::Pointer(*GroovePlaylist)) read-only. set when attached and cleared when detached
|
49
|
+
class GrooveFingerprinter < FFI::Struct
|
50
|
+
layout :info_queue_size, :int,
|
51
|
+
:sink_buffer_size, :int,
|
52
|
+
:playlist, :pointer
|
53
|
+
end
|
54
|
+
|
55
|
+
# (Not documented)
|
56
|
+
#
|
57
|
+
# @method fingerprinter_create()
|
58
|
+
# @return [GrooveFingerprinter]
|
59
|
+
# @scope class
|
60
|
+
attach_function :fingerprinter_create, :groove_fingerprinter_create, [], GrooveFingerprinter
|
61
|
+
|
62
|
+
# (Not documented)
|
63
|
+
#
|
64
|
+
# @method fingerprinter_destroy(printer)
|
65
|
+
# @param [GrooveFingerprinter] printer
|
66
|
+
# @return [nil]
|
67
|
+
# @scope class
|
68
|
+
attach_function :fingerprinter_destroy, :groove_fingerprinter_destroy, [GrooveFingerprinter], :void
|
69
|
+
|
70
|
+
# once you attach, you must detach before destroying the playlist
|
71
|
+
#
|
72
|
+
# @method fingerprinter_attach(printer, playlist)
|
73
|
+
# @param [GrooveFingerprinter] printer
|
74
|
+
# @param [FFI::Pointer(*GroovePlaylist)] playlist
|
75
|
+
# @return [Integer]
|
76
|
+
# @scope class
|
77
|
+
attach_function :fingerprinter_attach, :groove_fingerprinter_attach, [GrooveFingerprinter, :pointer], :int
|
78
|
+
|
79
|
+
# (Not documented)
|
80
|
+
#
|
81
|
+
# @method fingerprinter_detach(printer)
|
82
|
+
# @param [GrooveFingerprinter] printer
|
83
|
+
# @return [Integer]
|
84
|
+
# @scope class
|
85
|
+
attach_function :fingerprinter_detach, :groove_fingerprinter_detach, [GrooveFingerprinter], :int
|
86
|
+
|
87
|
+
# returns < 0 on error, 0 on aborted (block=1) or no info ready (block=0),
|
88
|
+
# 1 on info returned.
|
89
|
+
# When you get info you must free it with groove_fingerprinter_free_info.
|
90
|
+
#
|
91
|
+
# @method fingerprinter_info_get(printer, info, block)
|
92
|
+
# @param [GrooveFingerprinter] printer
|
93
|
+
# @param [GrooveFingerprinterInfo] info
|
94
|
+
# @param [Integer] block
|
95
|
+
# @return [Integer]
|
96
|
+
# @scope class
|
97
|
+
attach_function :fingerprinter_info_get, :groove_fingerprinter_info_get, [GrooveFingerprinter, GrooveFingerprinterInfo, :int], :int
|
98
|
+
|
99
|
+
# (Not documented)
|
100
|
+
#
|
101
|
+
# @method fingerprinter_free_info(info)
|
102
|
+
# @param [GrooveFingerprinterInfo] info
|
103
|
+
# @return [nil]
|
104
|
+
# @scope class
|
105
|
+
attach_function :fingerprinter_free_info, :groove_fingerprinter_free_info, [GrooveFingerprinterInfo], :void
|
106
|
+
|
107
|
+
# returns < 0 on error, 0 on no info ready, 1 on info ready
|
108
|
+
# if block is 1, block until info is ready
|
109
|
+
#
|
110
|
+
# @method fingerprinter_info_peek(printer, block)
|
111
|
+
# @param [GrooveFingerprinter] printer
|
112
|
+
# @param [Integer] block
|
113
|
+
# @return [Integer]
|
114
|
+
# @scope class
|
115
|
+
attach_function :fingerprinter_info_peek, :groove_fingerprinter_info_peek, [GrooveFingerprinter, :int], :int
|
116
|
+
|
117
|
+
# get the position of the printer head
|
118
|
+
# both the current playlist item and the position in seconds in the playlist
|
119
|
+
# item are given. item will be set to NULL if the playlist is empty
|
120
|
+
# you may pass NULL for item or seconds
|
121
|
+
#
|
122
|
+
# @method fingerprinter_position(printer, item, seconds)
|
123
|
+
# @param [GrooveFingerprinter] printer
|
124
|
+
# @param [FFI::Pointer(**GroovePlaylistItem)] item
|
125
|
+
# @param [FFI::Pointer(*Double)] seconds
|
126
|
+
# @return [nil]
|
127
|
+
# @scope class
|
128
|
+
attach_function :fingerprinter_position, :groove_fingerprinter_position, [GrooveFingerprinter, :pointer, :pointer], :void
|
129
|
+
|
130
|
+
# Compress and base64-encode a raw fingerprint
|
131
|
+
#
|
132
|
+
# The caller is responsible for freeing the returned pointer using
|
133
|
+
# groove_fingerprinter_dealloc().
|
134
|
+
#
|
135
|
+
# Parameters:
|
136
|
+
# - fp: pointer to an array of signed 32-bit integers representing the raw
|
137
|
+
# fingerprint to be encoded
|
138
|
+
# - size: number of items in the raw fingerprint
|
139
|
+
# - encoded_fp: pointer to a pointer, where the encoded fingerprint will be
|
140
|
+
# stored
|
141
|
+
#
|
142
|
+
# Returns:
|
143
|
+
# - 0 on success, < 0 on error
|
144
|
+
#
|
145
|
+
# @method fingerprinter_encode(fp, size, encoded_fp)
|
146
|
+
# @param [FFI::Pointer(*Int32T)] fp
|
147
|
+
# @param [Integer] size
|
148
|
+
# @param [FFI::Pointer(**CharS)] encoded_fp
|
149
|
+
# @return [Integer]
|
150
|
+
# @scope class
|
151
|
+
attach_function :fingerprinter_encode, :groove_fingerprinter_encode, [:pointer, :int, :pointer], :int
|
152
|
+
|
153
|
+
# Uncompress and base64-decode an encoded fingerprint
|
154
|
+
#
|
155
|
+
# The caller is responsible for freeing the returned pointer using
|
156
|
+
# groove_fingerprinter_dealloc().
|
157
|
+
#
|
158
|
+
# Parameters:
|
159
|
+
# - encoded_fp: Pointer to an encoded fingerprint
|
160
|
+
# - encoded_size: Size of the encoded fingerprint in bytes
|
161
|
+
# - fp: Pointer to a pointer, where the decoded raw fingerprint (array
|
162
|
+
# of signed 32-bit integers) will be stored
|
163
|
+
# - size: Number of items in the returned raw fingerprint
|
164
|
+
#
|
165
|
+
# Returns:
|
166
|
+
# - 0 on success, < 0 on error
|
167
|
+
#
|
168
|
+
# @method fingerprinter_decode(encoded_fp, fp, size)
|
169
|
+
# @param [String] encoded_fp
|
170
|
+
# @param [FFI::Pointer(**Int32T)] fp
|
171
|
+
# @param [FFI::Pointer(*Int)] size
|
172
|
+
# @return [Integer]
|
173
|
+
# @scope class
|
174
|
+
attach_function :fingerprinter_decode, :groove_fingerprinter_decode, [:string, :pointer, :pointer], :int
|
175
|
+
|
176
|
+
# (Not documented)
|
177
|
+
#
|
178
|
+
# @method fingerprinter_dealloc(ptr)
|
179
|
+
# @param [FFI::Pointer(*Void)] ptr
|
180
|
+
# @return [nil]
|
181
|
+
# @scope class
|
182
|
+
attach_function :fingerprinter_dealloc, :groove_fingerprinter_dealloc, [:pointer], :void
|
183
|
+
|
184
|
+
end
|
@@ -0,0 +1,768 @@
|
|
1
|
+
# Generated by ffi_gen. Please do not change this file by hand.
|
2
|
+
|
3
|
+
require 'ffi'
|
4
|
+
|
5
|
+
module Groove
|
6
|
+
extend FFI::Library
|
7
|
+
ffi_lib 'groove'
|
8
|
+
|
9
|
+
def self.attach_function(name, *_)
|
10
|
+
begin; super; rescue FFI::NotFoundError => e
|
11
|
+
(class << self; self; end).class_eval { define_method(name) { |*_| raise e } }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
GROOVE_LOG_ERROR = 16
|
16
|
+
|
17
|
+
GROOVE_LOG_WARNING = 24
|
18
|
+
|
19
|
+
GROOVE_LOG_INFO = 32
|
20
|
+
|
21
|
+
GROOVE_CH_FRONT_LEFT = 0x00000001
|
22
|
+
|
23
|
+
GROOVE_CH_FRONT_RIGHT = 0x00000002
|
24
|
+
|
25
|
+
GROOVE_CH_FRONT_CENTER = 0x00000004
|
26
|
+
|
27
|
+
GROOVE_TAG_MATCH_CASE = 1
|
28
|
+
|
29
|
+
GROOVE_TAG_DONT_OVERWRITE = 16
|
30
|
+
|
31
|
+
GROOVE_TAG_APPEND = 32
|
32
|
+
|
33
|
+
GROOVE_EVERY_SINK_FULL = 0
|
34
|
+
|
35
|
+
GROOVE_ANY_SINK_FULL = 1
|
36
|
+
|
37
|
+
GROOVE_BUFFER_NO = 0
|
38
|
+
|
39
|
+
GROOVE_BUFFER_YES = 1
|
40
|
+
|
41
|
+
GROOVE_BUFFER_END = 2
|
42
|
+
|
43
|
+
# (Not documented)
|
44
|
+
#
|
45
|
+
# @method init()
|
46
|
+
# @return [Integer]
|
47
|
+
# @scope class
|
48
|
+
attach_function :init, :groove_init, [], :int
|
49
|
+
|
50
|
+
# call at the end of your program to clean up. after calling this
|
51
|
+
# you may no longer use this API.
|
52
|
+
#
|
53
|
+
# @method finish()
|
54
|
+
# @return [nil]
|
55
|
+
# @scope class
|
56
|
+
attach_function :finish, :groove_finish, [], :void
|
57
|
+
|
58
|
+
# enable/disable logging of errors
|
59
|
+
#
|
60
|
+
# @method set_logging(level)
|
61
|
+
# @param [Integer] level
|
62
|
+
# @return [nil]
|
63
|
+
# @scope class
|
64
|
+
attach_function :set_logging, :groove_set_logging, [:int], :void
|
65
|
+
|
66
|
+
# get the channel count for the channel layout
|
67
|
+
#
|
68
|
+
# @method channel_layout_count(channel_layout)
|
69
|
+
# @param [Integer] channel_layout
|
70
|
+
# @return [Integer]
|
71
|
+
# @scope class
|
72
|
+
attach_function :channel_layout_count, :groove_channel_layout_count, [:ulong], :int
|
73
|
+
|
74
|
+
# get the default channel layout based on the channel count
|
75
|
+
#
|
76
|
+
# @method channel_layout_default(count)
|
77
|
+
# @param [Integer] count
|
78
|
+
# @return [Integer]
|
79
|
+
# @scope class
|
80
|
+
attach_function :channel_layout_default, :groove_channel_layout_default, [:int], :ulong
|
81
|
+
|
82
|
+
# (Not documented)
|
83
|
+
#
|
84
|
+
# <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:groove_sample_format).</em>
|
85
|
+
#
|
86
|
+
# === Options:
|
87
|
+
# :fmt_none ::
|
88
|
+
#
|
89
|
+
# :fmt_u8 ::
|
90
|
+
#
|
91
|
+
# :fmt_s16 ::
|
92
|
+
# unsigned 8 bits
|
93
|
+
# :fmt_s32 ::
|
94
|
+
# signed 16 bits
|
95
|
+
# :fmt_flt ::
|
96
|
+
# signed 32 bits
|
97
|
+
# :fmt_dbl ::
|
98
|
+
# float (32 bits)
|
99
|
+
# :fmt_u8p ::
|
100
|
+
# double (64 bits)
|
101
|
+
# :fmt_s16p ::
|
102
|
+
# unsigned 8 bits, planar
|
103
|
+
# :fmt_s32p ::
|
104
|
+
# signed 16 bits, planar
|
105
|
+
# :fmt_fltp ::
|
106
|
+
# signed 32 bits, planar
|
107
|
+
# :fmt_dblp ::
|
108
|
+
# float (32 bits), planar
|
109
|
+
#
|
110
|
+
# @method _enum_groove_sample_format_
|
111
|
+
# @return [Symbol]
|
112
|
+
# @scope class
|
113
|
+
enum :groove_sample_format, [
|
114
|
+
:fmt_none, -1,
|
115
|
+
:fmt_u8, 0,
|
116
|
+
:fmt_s16, 1,
|
117
|
+
:fmt_s32, 2,
|
118
|
+
:fmt_flt, 3,
|
119
|
+
:fmt_dbl, 4,
|
120
|
+
:fmt_u8p, 5,
|
121
|
+
:fmt_s16p, 6,
|
122
|
+
:fmt_s32p, 7,
|
123
|
+
:fmt_fltp, 8,
|
124
|
+
:fmt_dblp, 9
|
125
|
+
]
|
126
|
+
|
127
|
+
# double (64 bits), planar
|
128
|
+
#
|
129
|
+
# = Fields:
|
130
|
+
# :sample_rate ::
|
131
|
+
# (Integer)
|
132
|
+
# :channel_layout ::
|
133
|
+
# (Integer)
|
134
|
+
# :sample_fmt ::
|
135
|
+
# (Symbol from _enum_groove_sample_format_)
|
136
|
+
class GrooveAudioFormat < FFI::Struct
|
137
|
+
layout :sample_rate, :int,
|
138
|
+
:channel_layout, :ulong,
|
139
|
+
:sample_fmt, :groove_sample_format
|
140
|
+
end
|
141
|
+
|
142
|
+
# double (64 bits), planar
|
143
|
+
#
|
144
|
+
# @method sample_format_bytes_per_sample(format)
|
145
|
+
# @param [Symbol from _enum_groove_sample_format_] format
|
146
|
+
# @return [Integer]
|
147
|
+
# @scope class
|
148
|
+
attach_function :sample_format_bytes_per_sample, :groove_sample_format_bytes_per_sample, [:groove_sample_format], :int
|
149
|
+
|
150
|
+
# (Not documented)
|
151
|
+
#
|
152
|
+
# @method version_major()
|
153
|
+
# @return [Integer]
|
154
|
+
# @scope class
|
155
|
+
attach_function :version_major, :groove_version_major, [], :int
|
156
|
+
|
157
|
+
# (Not documented)
|
158
|
+
#
|
159
|
+
# @method version_minor()
|
160
|
+
# @return [Integer]
|
161
|
+
# @scope class
|
162
|
+
attach_function :version_minor, :groove_version_minor, [], :int
|
163
|
+
|
164
|
+
# (Not documented)
|
165
|
+
#
|
166
|
+
# @method version_patch()
|
167
|
+
# @return [Integer]
|
168
|
+
# @scope class
|
169
|
+
attach_function :version_patch, :groove_version_patch, [], :int
|
170
|
+
|
171
|
+
# (Not documented)
|
172
|
+
#
|
173
|
+
# @method version()
|
174
|
+
# @return [String]
|
175
|
+
# @scope class
|
176
|
+
attach_function :version, :groove_version, [], :string
|
177
|
+
|
178
|
+
# GrooveFile
|
179
|
+
#
|
180
|
+
# = Fields:
|
181
|
+
# :dirty ::
|
182
|
+
# (Integer) read-only
|
183
|
+
# :filename ::
|
184
|
+
# (String) read-only
|
185
|
+
class GrooveFile < FFI::Struct
|
186
|
+
layout :dirty, :int,
|
187
|
+
:filename, :string
|
188
|
+
end
|
189
|
+
|
190
|
+
# If the entry already exists, append to it. Note that no
|
191
|
+
# delimiter is added, the strings are simply concatenated.
|
192
|
+
class GrooveTag < FFI::Struct
|
193
|
+
layout :dummy, :char
|
194
|
+
end
|
195
|
+
|
196
|
+
# If the entry already exists, append to it. Note that no
|
197
|
+
# delimiter is added, the strings are simply concatenated.
|
198
|
+
#
|
199
|
+
# @method tag_key(tag)
|
200
|
+
# @param [GrooveTag] tag
|
201
|
+
# @return [String]
|
202
|
+
# @scope class
|
203
|
+
attach_function :tag_key, :groove_tag_key, [GrooveTag], :string
|
204
|
+
|
205
|
+
# (Not documented)
|
206
|
+
#
|
207
|
+
# @method tag_value(tag)
|
208
|
+
# @param [GrooveTag] tag
|
209
|
+
# @return [String]
|
210
|
+
# @scope class
|
211
|
+
attach_function :tag_value, :groove_tag_value, [GrooveTag], :string
|
212
|
+
|
213
|
+
# you are always responsible for calling groove_file_close on the
|
214
|
+
# returned GrooveFile.
|
215
|
+
#
|
216
|
+
# @method file_open(filename)
|
217
|
+
# @param [String] filename
|
218
|
+
# @return [GrooveFile]
|
219
|
+
# @scope class
|
220
|
+
attach_function :file_open, :groove_file_open, [:string], GrooveFile
|
221
|
+
|
222
|
+
# (Not documented)
|
223
|
+
#
|
224
|
+
# @method file_close(file)
|
225
|
+
# @param [GrooveFile] file
|
226
|
+
# @return [nil]
|
227
|
+
# @scope class
|
228
|
+
attach_function :file_close, :groove_file_close, [GrooveFile], :void
|
229
|
+
|
230
|
+
# (Not documented)
|
231
|
+
#
|
232
|
+
# @method file_metadata_get(file, key, prev, flags)
|
233
|
+
# @param [GrooveFile] file
|
234
|
+
# @param [String] key
|
235
|
+
# @param [GrooveTag] prev
|
236
|
+
# @param [Integer] flags
|
237
|
+
# @return [GrooveTag]
|
238
|
+
# @scope class
|
239
|
+
attach_function :file_metadata_get, :groove_file_metadata_get, [GrooveFile, :string, GrooveTag, :int], GrooveTag
|
240
|
+
|
241
|
+
# key entry to add to metadata. will be strdup'd
|
242
|
+
# value entry to add to metadata. will be strdup'd
|
243
|
+
# passing NULL causes existing entry to be deleted.
|
244
|
+
# return >= 0 on success otherwise an error code < 0
|
245
|
+
# note that this will not save the file; you must call groove_file_save
|
246
|
+
# to do that.
|
247
|
+
#
|
248
|
+
# @method file_metadata_set(file, key, value, flags)
|
249
|
+
# @param [GrooveFile] file
|
250
|
+
# @param [String] key
|
251
|
+
# @param [String] value
|
252
|
+
# @param [Integer] flags
|
253
|
+
# @return [Integer]
|
254
|
+
# @scope class
|
255
|
+
attach_function :file_metadata_set, :groove_file_metadata_set, [GrooveFile, :string, :string, :int], :int
|
256
|
+
|
257
|
+
# a comma separated list of short names for the format
|
258
|
+
#
|
259
|
+
# @method file_short_names(file)
|
260
|
+
# @param [GrooveFile] file
|
261
|
+
# @return [String]
|
262
|
+
# @scope class
|
263
|
+
attach_function :file_short_names, :groove_file_short_names, [GrooveFile], :string
|
264
|
+
|
265
|
+
# write changes made to metadata to disk.
|
266
|
+
# return < 0 on error
|
267
|
+
#
|
268
|
+
# @method file_save(file)
|
269
|
+
# @param [GrooveFile] file
|
270
|
+
# @return [Integer]
|
271
|
+
# @scope class
|
272
|
+
attach_function :file_save, :groove_file_save, [GrooveFile], :int
|
273
|
+
|
274
|
+
# main audio stream duration in seconds. note that this relies on a
|
275
|
+
# combination of format headers and heuristics. It can be inaccurate.
|
276
|
+
# The most accurate way to learn the duration of a file is to use
|
277
|
+
# GrooveLoudnessDetector
|
278
|
+
#
|
279
|
+
# @method file_duration(file)
|
280
|
+
# @param [GrooveFile] file
|
281
|
+
# @return [Float]
|
282
|
+
# @scope class
|
283
|
+
attach_function :file_duration, :groove_file_duration, [GrooveFile], :double
|
284
|
+
|
285
|
+
# get the audio format of the main audio stream of a file
|
286
|
+
#
|
287
|
+
# @method file_audio_format(file, audio_format)
|
288
|
+
# @param [GrooveFile] file
|
289
|
+
# @param [GrooveAudioFormat] audio_format
|
290
|
+
# @return [nil]
|
291
|
+
# @scope class
|
292
|
+
attach_function :file_audio_format, :groove_file_audio_format, [GrooveFile, GrooveAudioFormat], :void
|
293
|
+
|
294
|
+
# GroovePlaylist
|
295
|
+
#
|
296
|
+
# = Fields:
|
297
|
+
# :file ::
|
298
|
+
# (GrooveFile) all fields are read-only. modify with methods below.
|
299
|
+
# :gain ::
|
300
|
+
# (Float) A volume adjustment in float format to apply to the file when it plays.
|
301
|
+
# This is typically used for loudness compensation, for example ReplayGain.
|
302
|
+
# To convert from dB to float, use exp(log(10) * 0.05 * dB_value)
|
303
|
+
# :peak ::
|
304
|
+
# (Float) The sample peak of this playlist item is assumed to be 1.0 in float
|
305
|
+
# format. If you know for certain that the peak is less than 1.0, you
|
306
|
+
# may set this value which may allow the volume adjustment to use
|
307
|
+
# a pure amplifier rather than a compressor. This results in slightly
|
308
|
+
# better audio quality.
|
309
|
+
# :prev ::
|
310
|
+
# (FFI::Pointer(*GroovePlaylistItem)) A GroovePlaylist is a doubly linked list. Use these fields to
|
311
|
+
# traverse the list.
|
312
|
+
# :next_ ::
|
313
|
+
# (FFI::Pointer(*GroovePlaylistItem))
|
314
|
+
class GroovePlaylistItem < FFI::Struct
|
315
|
+
layout :file, GrooveFile,
|
316
|
+
:gain, :double,
|
317
|
+
:peak, :double,
|
318
|
+
:prev, :pointer,
|
319
|
+
:next_, :pointer
|
320
|
+
end
|
321
|
+
|
322
|
+
# A GroovePlaylist is a doubly linked list. Use these fields to
|
323
|
+
# traverse the list.
|
324
|
+
#
|
325
|
+
# = Fields:
|
326
|
+
# :head ::
|
327
|
+
# (GroovePlaylistItem) all fields are read-only. modify using methods below.
|
328
|
+
# doubly linked list which is the playlist
|
329
|
+
# :tail ::
|
330
|
+
# (GroovePlaylistItem)
|
331
|
+
# :gain ::
|
332
|
+
# (Float) volume adjustment in float format which applies to all playlist items
|
333
|
+
# and all sinks. defaults to 1.0.
|
334
|
+
class GroovePlaylist < FFI::Struct
|
335
|
+
layout :head, GroovePlaylistItem,
|
336
|
+
:tail, GroovePlaylistItem,
|
337
|
+
:gain, :double
|
338
|
+
end
|
339
|
+
|
340
|
+
# a playlist keeps its sinks full.
|
341
|
+
#
|
342
|
+
# @method playlist_create()
|
343
|
+
# @return [GroovePlaylist]
|
344
|
+
# @scope class
|
345
|
+
attach_function :playlist_create, :groove_playlist_create, [], GroovePlaylist
|
346
|
+
|
347
|
+
# this will not call groove_file_close on any files
|
348
|
+
# it will remove all playlist items and sinks from the playlist
|
349
|
+
#
|
350
|
+
# @method playlist_destroy(playlist)
|
351
|
+
# @param [GroovePlaylist] playlist
|
352
|
+
# @return [nil]
|
353
|
+
# @scope class
|
354
|
+
attach_function :playlist_destroy, :groove_playlist_destroy, [GroovePlaylist], :void
|
355
|
+
|
356
|
+
# (Not documented)
|
357
|
+
#
|
358
|
+
# @method playlist_play(playlist)
|
359
|
+
# @param [GroovePlaylist] playlist
|
360
|
+
# @return [nil]
|
361
|
+
# @scope class
|
362
|
+
attach_function :playlist_play, :groove_playlist_play, [GroovePlaylist], :void
|
363
|
+
|
364
|
+
# (Not documented)
|
365
|
+
#
|
366
|
+
# @method playlist_pause(playlist)
|
367
|
+
# @param [GroovePlaylist] playlist
|
368
|
+
# @return [nil]
|
369
|
+
# @scope class
|
370
|
+
attach_function :playlist_pause, :groove_playlist_pause, [GroovePlaylist], :void
|
371
|
+
|
372
|
+
# (Not documented)
|
373
|
+
#
|
374
|
+
# @method playlist_seek(playlist, item, seconds)
|
375
|
+
# @param [GroovePlaylist] playlist
|
376
|
+
# @param [GroovePlaylistItem] item
|
377
|
+
# @param [Float] seconds
|
378
|
+
# @return [nil]
|
379
|
+
# @scope class
|
380
|
+
attach_function :playlist_seek, :groove_playlist_seek, [GroovePlaylist, GroovePlaylistItem, :double], :void
|
381
|
+
|
382
|
+
# once you add a file to the playlist, you must not destroy it until you first
|
383
|
+
# remove it from the playlist.
|
384
|
+
# next: the item to insert before. if NULL, you will append to the playlist.
|
385
|
+
# gain: see GroovePlaylistItem structure. use 1.0 for no adjustment.
|
386
|
+
# peak: see GroovePlaylistItem structure. use 1.0 for no adjustment.
|
387
|
+
# returns the newly created playlist item.
|
388
|
+
#
|
389
|
+
# @method playlist_insert(playlist, file, gain, peak, next_)
|
390
|
+
# @param [GroovePlaylist] playlist
|
391
|
+
# @param [GrooveFile] file
|
392
|
+
# @param [Float] gain
|
393
|
+
# @param [Float] peak
|
394
|
+
# @param [GroovePlaylistItem] next_
|
395
|
+
# @return [GroovePlaylistItem]
|
396
|
+
# @scope class
|
397
|
+
attach_function :playlist_insert, :groove_playlist_insert, [GroovePlaylist, GrooveFile, :double, :double, GroovePlaylistItem], GroovePlaylistItem
|
398
|
+
|
399
|
+
# this will not call groove_file_close on item->file !
|
400
|
+
# item is destroyed and the address it points to is no longer valid
|
401
|
+
#
|
402
|
+
# @method playlist_remove(playlist, item)
|
403
|
+
# @param [GroovePlaylist] playlist
|
404
|
+
# @param [GroovePlaylistItem] item
|
405
|
+
# @return [nil]
|
406
|
+
# @scope class
|
407
|
+
attach_function :playlist_remove, :groove_playlist_remove, [GroovePlaylist, GroovePlaylistItem], :void
|
408
|
+
|
409
|
+
# get the position of the decode head
|
410
|
+
# both the current playlist item and the position in seconds in the playlist
|
411
|
+
# item are given. item will be set to NULL if the playlist is empty
|
412
|
+
# seconds will be set to -1.0 if item is NULL.
|
413
|
+
# you may pass NULL for item or seconds
|
414
|
+
# Note that typically you are more interested in the position of the play
|
415
|
+
# head, not the decode head. For example, if you have a GroovePlayer attached,
|
416
|
+
# groove_player_position will give you the position of the play head.
|
417
|
+
#
|
418
|
+
# @method playlist_position(playlist, item, seconds)
|
419
|
+
# @param [GroovePlaylist] playlist
|
420
|
+
# @param [FFI::Pointer(**GroovePlaylistItem)] item
|
421
|
+
# @param [FFI::Pointer(*Double)] seconds
|
422
|
+
# @return [nil]
|
423
|
+
# @scope class
|
424
|
+
attach_function :playlist_position, :groove_playlist_position, [GroovePlaylist, :pointer, :pointer], :void
|
425
|
+
|
426
|
+
# return 1 if the playlist is playing; 0 if it is not.
|
427
|
+
#
|
428
|
+
# @method playlist_playing(playlist)
|
429
|
+
# @param [GroovePlaylist] playlist
|
430
|
+
# @return [Integer]
|
431
|
+
# @scope class
|
432
|
+
attach_function :playlist_playing, :groove_playlist_playing, [GroovePlaylist], :int
|
433
|
+
|
434
|
+
# remove all playlist items
|
435
|
+
#
|
436
|
+
# @method playlist_clear(playlist)
|
437
|
+
# @param [GroovePlaylist] playlist
|
438
|
+
# @return [nil]
|
439
|
+
# @scope class
|
440
|
+
attach_function :playlist_clear, :groove_playlist_clear, [GroovePlaylist], :void
|
441
|
+
|
442
|
+
# return the count of playlist items
|
443
|
+
#
|
444
|
+
# @method playlist_count(playlist)
|
445
|
+
# @param [GroovePlaylist] playlist
|
446
|
+
# @return [Integer]
|
447
|
+
# @scope class
|
448
|
+
attach_function :playlist_count, :groove_playlist_count, [GroovePlaylist], :int
|
449
|
+
|
450
|
+
# (Not documented)
|
451
|
+
#
|
452
|
+
# @method playlist_set_gain(playlist, gain)
|
453
|
+
# @param [GroovePlaylist] playlist
|
454
|
+
# @param [Float] gain
|
455
|
+
# @return [nil]
|
456
|
+
# @scope class
|
457
|
+
attach_function :playlist_set_gain, :groove_playlist_set_gain, [GroovePlaylist, :double], :void
|
458
|
+
|
459
|
+
# (Not documented)
|
460
|
+
#
|
461
|
+
# @method playlist_set_item_gain(playlist, item, gain)
|
462
|
+
# @param [GroovePlaylist] playlist
|
463
|
+
# @param [GroovePlaylistItem] item
|
464
|
+
# @param [Float] gain
|
465
|
+
# @return [nil]
|
466
|
+
# @scope class
|
467
|
+
attach_function :playlist_set_item_gain, :groove_playlist_set_item_gain, [GroovePlaylist, GroovePlaylistItem, :double], :void
|
468
|
+
|
469
|
+
# (Not documented)
|
470
|
+
#
|
471
|
+
# @method playlist_set_item_peak(playlist, item, peak)
|
472
|
+
# @param [GroovePlaylist] playlist
|
473
|
+
# @param [GroovePlaylistItem] item
|
474
|
+
# @param [Float] peak
|
475
|
+
# @return [nil]
|
476
|
+
# @scope class
|
477
|
+
attach_function :playlist_set_item_peak, :groove_playlist_set_item_peak, [GroovePlaylist, GroovePlaylistItem, :double], :void
|
478
|
+
|
479
|
+
# Use this to set the fill mode using the constants above
|
480
|
+
#
|
481
|
+
# @method playlist_set_fill_mode(playlist, mode)
|
482
|
+
# @param [GroovePlaylist] playlist
|
483
|
+
# @param [Integer] mode
|
484
|
+
# @return [nil]
|
485
|
+
# @scope class
|
486
|
+
attach_function :playlist_set_fill_mode, :groove_playlist_set_fill_mode, [GroovePlaylist, :int], :void
|
487
|
+
|
488
|
+
# GrooveBuffer
|
489
|
+
#
|
490
|
+
# = Fields:
|
491
|
+
# :data ::
|
492
|
+
# (FFI::Pointer(**Uint8T)) all fields read-only
|
493
|
+
# for interleaved audio, data(0) is the buffer.
|
494
|
+
# for planar audio, each channel has a separate data pointer.
|
495
|
+
# for encoded audio, data(0) is the encoded buffer.
|
496
|
+
# :format ::
|
497
|
+
# (GrooveAudioFormat)
|
498
|
+
# :frame_count ::
|
499
|
+
# (Integer) number of audio frames described by this buffer
|
500
|
+
# for encoded audio, this is unknown and set to 0.
|
501
|
+
# :item ::
|
502
|
+
# (GroovePlaylistItem) when encoding, if item is NULL, this is a format header or trailer.
|
503
|
+
# otherwise, this is encoded audio for the item specified.
|
504
|
+
# when decoding, item is never NULL.
|
505
|
+
# :pos ::
|
506
|
+
# (Float)
|
507
|
+
# :size ::
|
508
|
+
# (Integer) total number of bytes contained in this buffer
|
509
|
+
# :pts ::
|
510
|
+
# (Integer) presentation time stamp of the buffer
|
511
|
+
class GrooveBuffer < FFI::Struct
|
512
|
+
layout :data, :pointer,
|
513
|
+
:format, GrooveAudioFormat.by_value,
|
514
|
+
:frame_count, :int,
|
515
|
+
:item, GroovePlaylistItem,
|
516
|
+
:pos, :double,
|
517
|
+
:size, :int,
|
518
|
+
:pts, :ulong
|
519
|
+
end
|
520
|
+
|
521
|
+
# presentation time stamp of the buffer
|
522
|
+
#
|
523
|
+
# @method buffer_ref(buffer)
|
524
|
+
# @param [GrooveBuffer] buffer
|
525
|
+
# @return [nil]
|
526
|
+
# @scope class
|
527
|
+
attach_function :buffer_ref, :groove_buffer_ref, [GrooveBuffer], :void
|
528
|
+
|
529
|
+
# (Not documented)
|
530
|
+
#
|
531
|
+
# @method buffer_unref(buffer)
|
532
|
+
# @param [GrooveBuffer] buffer
|
533
|
+
# @return [nil]
|
534
|
+
# @scope class
|
535
|
+
attach_function :buffer_unref, :groove_buffer_unref, [GrooveBuffer], :void
|
536
|
+
|
537
|
+
# use this to get access to a realtime raw audio buffer
|
538
|
+
# for example you could use it to draw a waveform or other visualization
|
539
|
+
# GroovePlayer uses this internally to get the audio buffer for playback
|
540
|
+
#
|
541
|
+
# = Fields:
|
542
|
+
# :audio_format ::
|
543
|
+
# (GrooveAudioFormat) set this to the audio format you want the sink to output
|
544
|
+
# :disable_resample ::
|
545
|
+
# (Integer) Set this flag to ignore audio_format. If you set this flag, the
|
546
|
+
# buffers you pull from this sink could have any audio format.
|
547
|
+
# :buffer_sample_count ::
|
548
|
+
# (Integer) If you leave this to its default of 0, frames pulled from the sink
|
549
|
+
# will have sample count determined by efficiency.
|
550
|
+
# If you set this to a positive number, frames pulled from the sink
|
551
|
+
# will always have this number of samples.
|
552
|
+
# :buffer_size ::
|
553
|
+
# (Integer) how big the buffer queue should be, in sample frames.
|
554
|
+
# groove_sink_create defaults this to 8192
|
555
|
+
# :gain ::
|
556
|
+
# (Float) This volume adjustment only applies to this sink.
|
557
|
+
# It is recommended that you leave this at 1.0 and instead adjust the
|
558
|
+
# gain of the playlist.
|
559
|
+
# If you want to change this value after you have already attached the
|
560
|
+
# sink to the playlist, you must use groove_sink_set_gain.
|
561
|
+
# float format. Defaults to 1.0
|
562
|
+
# :userdata ::
|
563
|
+
# (FFI::Pointer(*Void)) set to whatever you want
|
564
|
+
# :flush ::
|
565
|
+
# (FFI::Pointer(*)) called when the audio queue is flushed. For example, if you seek to a
|
566
|
+
# different location in the song.
|
567
|
+
# :purge ::
|
568
|
+
# (FFI::Pointer(*)) called when a playlist item is deleted. Take this opportunity to remove
|
569
|
+
# all your references to the GroovePlaylistItem.
|
570
|
+
# :pause ::
|
571
|
+
# (FFI::Pointer(*)) called when the playlist is paused
|
572
|
+
# :play ::
|
573
|
+
# (FFI::Pointer(*)) called when the playlist is played
|
574
|
+
# :playlist ::
|
575
|
+
# (GroovePlaylist) read-only. set when you call groove_sink_attach. cleared when you call
|
576
|
+
# groove_sink_detach
|
577
|
+
# :bytes_per_sec ::
|
578
|
+
# (Integer) read-only. automatically computed from audio_format when you call
|
579
|
+
# groove_sink_attach
|
580
|
+
class GrooveSink < FFI::Struct
|
581
|
+
layout :audio_format, GrooveAudioFormat.by_value,
|
582
|
+
:disable_resample, :int,
|
583
|
+
:buffer_sample_count, :int,
|
584
|
+
:buffer_size, :int,
|
585
|
+
:gain, :double,
|
586
|
+
:userdata, :pointer,
|
587
|
+
:flush, :pointer,
|
588
|
+
:purge, :pointer,
|
589
|
+
:pause, :pointer,
|
590
|
+
:play, :pointer,
|
591
|
+
:playlist, GroovePlaylist,
|
592
|
+
:bytes_per_sec, :int
|
593
|
+
end
|
594
|
+
|
595
|
+
# read-only. automatically computed from audio_format when you call
|
596
|
+
# groove_sink_attach
|
597
|
+
#
|
598
|
+
# @method sink_create()
|
599
|
+
# @return [GrooveSink]
|
600
|
+
# @scope class
|
601
|
+
attach_function :sink_create, :groove_sink_create, [], GrooveSink
|
602
|
+
|
603
|
+
# (Not documented)
|
604
|
+
#
|
605
|
+
# @method sink_destroy(sink)
|
606
|
+
# @param [GrooveSink] sink
|
607
|
+
# @return [nil]
|
608
|
+
# @scope class
|
609
|
+
attach_function :sink_destroy, :groove_sink_destroy, [GrooveSink], :void
|
610
|
+
|
611
|
+
# before calling this, set audio_format
|
612
|
+
# returns 0 on success, < 0 on error
|
613
|
+
#
|
614
|
+
# @method sink_attach(sink, playlist)
|
615
|
+
# @param [GrooveSink] sink
|
616
|
+
# @param [GroovePlaylist] playlist
|
617
|
+
# @return [Integer]
|
618
|
+
# @scope class
|
619
|
+
attach_function :sink_attach, :groove_sink_attach, [GrooveSink, GroovePlaylist], :int
|
620
|
+
|
621
|
+
# returns 0 on success, < 0 on error
|
622
|
+
#
|
623
|
+
# @method sink_detach(sink)
|
624
|
+
# @param [GrooveSink] sink
|
625
|
+
# @return [Integer]
|
626
|
+
# @scope class
|
627
|
+
attach_function :sink_detach, :groove_sink_detach, [GrooveSink], :int
|
628
|
+
|
629
|
+
# returns < 0 on error, GROOVE_BUFFER_NO on aborted (block=1) or no buffer
|
630
|
+
# ready (block=0), GROOVE_BUFFER_YES on buffer returned, and GROOVE_BUFFER_END
|
631
|
+
# on end of playlist.
|
632
|
+
# buffer is always set to either a valid GrooveBuffer or NULL
|
633
|
+
#
|
634
|
+
# @method sink_buffer_get(sink, buffer, block)
|
635
|
+
# @param [GrooveSink] sink
|
636
|
+
# @param [FFI::Pointer(**GrooveBuffer)] buffer
|
637
|
+
# @param [Integer] block
|
638
|
+
# @return [Integer]
|
639
|
+
# @scope class
|
640
|
+
attach_function :sink_buffer_get, :groove_sink_buffer_get, [GrooveSink, :pointer, :int], :int
|
641
|
+
|
642
|
+
# returns < 0 on error, 0 on no buffer ready, 1 on buffer ready
|
643
|
+
# if block is 1, block until buffer is ready
|
644
|
+
#
|
645
|
+
# @method sink_buffer_peek(sink, block)
|
646
|
+
# @param [GrooveSink] sink
|
647
|
+
# @param [Integer] block
|
648
|
+
# @return [Integer]
|
649
|
+
# @scope class
|
650
|
+
attach_function :sink_buffer_peek, :groove_sink_buffer_peek, [GrooveSink, :int], :int
|
651
|
+
|
652
|
+
# See the gain property of GrooveSink. It is recommended that you leave this
|
653
|
+
# at 1.0 and instead adjust the gain of the playlist.
|
654
|
+
# returns 0 on success, < 0 on error
|
655
|
+
#
|
656
|
+
# @method sink_set_gain(sink, gain)
|
657
|
+
# @param [GrooveSink] sink
|
658
|
+
# @param [Float] gain
|
659
|
+
# @return [Integer]
|
660
|
+
# @scope class
|
661
|
+
attach_function :sink_set_gain, :groove_sink_set_gain, [GrooveSink, :double], :int
|
662
|
+
|
663
|
+
# (Not documented)
|
664
|
+
#
|
665
|
+
# = Fields:
|
666
|
+
# :context ::
|
667
|
+
# (FFI::Pointer(*Void))
|
668
|
+
# :cleanup ::
|
669
|
+
# (FFI::Pointer(*)) // defaults to groove_queue_cleanup_default
|
670
|
+
# :put ::
|
671
|
+
# (FFI::Pointer(*))
|
672
|
+
# :get ::
|
673
|
+
# (FFI::Pointer(*))
|
674
|
+
# :purge ::
|
675
|
+
# (FFI::Pointer(*))
|
676
|
+
class GrooveQueue < FFI::Struct
|
677
|
+
layout :context, :pointer,
|
678
|
+
:cleanup, :pointer,
|
679
|
+
:put, :pointer,
|
680
|
+
:get, :pointer,
|
681
|
+
:purge, :pointer
|
682
|
+
end
|
683
|
+
|
684
|
+
# (Not documented)
|
685
|
+
#
|
686
|
+
# @method queue_create()
|
687
|
+
# @return [GrooveQueue]
|
688
|
+
# @scope class
|
689
|
+
attach_function :queue_create, :groove_queue_create, [], GrooveQueue
|
690
|
+
|
691
|
+
# (Not documented)
|
692
|
+
#
|
693
|
+
# @method queue_flush(queue)
|
694
|
+
# @param [GrooveQueue] queue
|
695
|
+
# @return [nil]
|
696
|
+
# @scope class
|
697
|
+
attach_function :queue_flush, :groove_queue_flush, [GrooveQueue], :void
|
698
|
+
|
699
|
+
# (Not documented)
|
700
|
+
#
|
701
|
+
# @method queue_destroy(queue)
|
702
|
+
# @param [GrooveQueue] queue
|
703
|
+
# @return [nil]
|
704
|
+
# @scope class
|
705
|
+
attach_function :queue_destroy, :groove_queue_destroy, [GrooveQueue], :void
|
706
|
+
|
707
|
+
# (Not documented)
|
708
|
+
#
|
709
|
+
# @method queue_abort(queue)
|
710
|
+
# @param [GrooveQueue] queue
|
711
|
+
# @return [nil]
|
712
|
+
# @scope class
|
713
|
+
attach_function :queue_abort, :groove_queue_abort, [GrooveQueue], :void
|
714
|
+
|
715
|
+
# (Not documented)
|
716
|
+
#
|
717
|
+
# @method queue_reset(queue)
|
718
|
+
# @param [GrooveQueue] queue
|
719
|
+
# @return [nil]
|
720
|
+
# @scope class
|
721
|
+
attach_function :queue_reset, :groove_queue_reset, [GrooveQueue], :void
|
722
|
+
|
723
|
+
# (Not documented)
|
724
|
+
#
|
725
|
+
# @method queue_put(queue, obj)
|
726
|
+
# @param [GrooveQueue] queue
|
727
|
+
# @param [FFI::Pointer(*Void)] obj
|
728
|
+
# @return [Integer]
|
729
|
+
# @scope class
|
730
|
+
attach_function :queue_put, :groove_queue_put, [GrooveQueue, :pointer], :int
|
731
|
+
|
732
|
+
# // returns -1 if aborted, 1 if got event, 0 if no event ready
|
733
|
+
#
|
734
|
+
# @method queue_get(queue, obj_ptr, block)
|
735
|
+
# @param [GrooveQueue] queue
|
736
|
+
# @param [FFI::Pointer(**Void)] obj_ptr
|
737
|
+
# @param [Integer] block
|
738
|
+
# @return [Integer]
|
739
|
+
# @scope class
|
740
|
+
attach_function :queue_get, :groove_queue_get, [GrooveQueue, :pointer, :int], :int
|
741
|
+
|
742
|
+
# (Not documented)
|
743
|
+
#
|
744
|
+
# @method queue_peek(queue, block)
|
745
|
+
# @param [GrooveQueue] queue
|
746
|
+
# @param [Integer] block
|
747
|
+
# @return [Integer]
|
748
|
+
# @scope class
|
749
|
+
attach_function :queue_peek, :groove_queue_peek, [GrooveQueue, :int], :int
|
750
|
+
|
751
|
+
# (Not documented)
|
752
|
+
#
|
753
|
+
# @method queue_purge(queue)
|
754
|
+
# @param [GrooveQueue] queue
|
755
|
+
# @return [nil]
|
756
|
+
# @scope class
|
757
|
+
attach_function :queue_purge, :groove_queue_purge, [GrooveQueue], :void
|
758
|
+
|
759
|
+
# (Not documented)
|
760
|
+
#
|
761
|
+
# @method queue_cleanup_default(queue, obj)
|
762
|
+
# @param [GrooveQueue] queue
|
763
|
+
# @param [FFI::Pointer(*Void)] obj
|
764
|
+
# @return [nil]
|
765
|
+
# @scope class
|
766
|
+
attach_function :queue_cleanup_default, :groove_queue_cleanup_default, [GrooveQueue, :pointer], :void
|
767
|
+
|
768
|
+
end
|