ruby-groove 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,133 @@
1
+ # Generated by ffi_gen. Please do not change this file by hand.
2
+
3
+ require 'ffi'
4
+
5
+ module Groove::Loudness
6
+ extend FFI::Library
7
+ ffi_lib 'grooveloudness'
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
+ # :loudness ::
19
+ # (Float) loudness is in LUFS. 1 LUFS == 1 dB
20
+ # EBU R128 specifies that playback should target -23 LUFS. replaygain on
21
+ # the other hand is a suggestion of how many dB to adjust the gain so
22
+ # that it equals -18 dB.
23
+ # so, for playback you might adjust the gain so that it is equal to -18 dB
24
+ # (this would be the replaygain standard) or so that it is equal to -23 dB
25
+ # (this would be the EBU R128 standard).
26
+ # :peak ::
27
+ # (Float) peak amplitude in float format
28
+ # :duration ::
29
+ # (Float) how many seconds long this song is
30
+ # :item ::
31
+ # (FFI::Pointer(*GroovePlaylistItem)) if item is NULL, this info applies to all songs analyzed until
32
+ # this point. otherwise it is the playlist item that this info
33
+ # applies to.
34
+ # when disable_album is set, this sentinel is still sent, but loudness
35
+ # will be set to 0
36
+ class GrooveLoudnessDetectorInfo < FFI::Struct
37
+ layout :loudness, :double,
38
+ :peak, :double,
39
+ :duration, :double,
40
+ :item, :pointer
41
+ end
42
+
43
+ # (Not documented)
44
+ #
45
+ # = Fields:
46
+ # :info_queue_size ::
47
+ # (Integer) maximum number of GrooveLoudnessDetectorInfo items to store in this
48
+ # loudness detector's queue. this defaults to MAX_INT, meaning that
49
+ # the loudness detector will cause the decoder to decode the entire
50
+ # playlist. if you want to instead, for example, obtain loudness info
51
+ # at the same time as playback, you might set this value to 1.
52
+ # :sink_buffer_size ::
53
+ # (Integer) how big the sink buffer should be, in sample frames.
54
+ # groove_loudness_detector_create defaults this to 8192
55
+ # :disable_album ::
56
+ # (Integer) set to 1 to only compute track loudness. This is faster and requires
57
+ # less memory than computing both.
58
+ # :playlist ::
59
+ # (FFI::Pointer(*GroovePlaylist)) read-only. set when attached and cleared when detached
60
+ class GrooveLoudnessDetector < FFI::Struct
61
+ layout :info_queue_size, :int,
62
+ :sink_buffer_size, :int,
63
+ :disable_album, :int,
64
+ :playlist, :pointer
65
+ end
66
+
67
+ # (Not documented)
68
+ #
69
+ # @method loudness_detector_create()
70
+ # @return [GrooveLoudnessDetector]
71
+ # @scope class
72
+ attach_function :loudness_detector_create, :groove_loudness_detector_create, [], GrooveLoudnessDetector
73
+
74
+ # (Not documented)
75
+ #
76
+ # @method loudness_detector_destroy(detector)
77
+ # @param [GrooveLoudnessDetector] detector
78
+ # @return [nil]
79
+ # @scope class
80
+ attach_function :loudness_detector_destroy, :groove_loudness_detector_destroy, [GrooveLoudnessDetector], :void
81
+
82
+ # once you attach, you must detach before destroying the playlist
83
+ #
84
+ # @method loudness_detector_attach(detector, playlist)
85
+ # @param [GrooveLoudnessDetector] detector
86
+ # @param [FFI::Pointer(*GroovePlaylist)] playlist
87
+ # @return [Integer]
88
+ # @scope class
89
+ attach_function :loudness_detector_attach, :groove_loudness_detector_attach, [GrooveLoudnessDetector, :pointer], :int
90
+
91
+ # (Not documented)
92
+ #
93
+ # @method loudness_detector_detach(detector)
94
+ # @param [GrooveLoudnessDetector] detector
95
+ # @return [Integer]
96
+ # @scope class
97
+ attach_function :loudness_detector_detach, :groove_loudness_detector_detach, [GrooveLoudnessDetector], :int
98
+
99
+ # returns < 0 on error, 0 on aborted (block=1) or no info ready (block=0),
100
+ # 1 on info returned
101
+ #
102
+ # @method loudness_detector_info_get(detector, info, block)
103
+ # @param [GrooveLoudnessDetector] detector
104
+ # @param [GrooveLoudnessDetectorInfo] info
105
+ # @param [Integer] block
106
+ # @return [Integer]
107
+ # @scope class
108
+ attach_function :loudness_detector_info_get, :groove_loudness_detector_info_get, [GrooveLoudnessDetector, GrooveLoudnessDetectorInfo, :int], :int
109
+
110
+ # returns < 0 on error, 0 on no info ready, 1 on info ready
111
+ # if block is 1, block until info is ready
112
+ #
113
+ # @method loudness_detector_info_peek(detector, block)
114
+ # @param [GrooveLoudnessDetector] detector
115
+ # @param [Integer] block
116
+ # @return [Integer]
117
+ # @scope class
118
+ attach_function :loudness_detector_info_peek, :groove_loudness_detector_info_peek, [GrooveLoudnessDetector, :int], :int
119
+
120
+ # get the position of the detect head
121
+ # both the current playlist item and the position in seconds in the playlist
122
+ # item are given. item will be set to NULL if the playlist is empty
123
+ # you may pass NULL for item or seconds
124
+ #
125
+ # @method loudness_detector_position(detector, item, seconds)
126
+ # @param [GrooveLoudnessDetector] detector
127
+ # @param [FFI::Pointer(**GroovePlaylistItem)] item
128
+ # @param [FFI::Pointer(*Double)] seconds
129
+ # @return [nil]
130
+ # @scope class
131
+ attach_function :loudness_detector_position, :groove_loudness_detector_position, [GrooveLoudnessDetector, :pointer, :pointer], :void
132
+
133
+ end
@@ -0,0 +1,183 @@
1
+ # Generated by ffi_gen. Please do not change this file by hand.
2
+
3
+ require 'ffi'
4
+
5
+ module Groove::Player
6
+ extend FFI::Library
7
+ ffi_lib 'grooveplayer'
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
+ # <em>This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:groove_player_event_type).</em>
18
+ #
19
+ # === Options:
20
+ # :nowplaying ::
21
+ # when the currently playing track changes.
22
+ # :bufferunderrun ::
23
+ # when something tries to read from an empty buffer
24
+ #
25
+ # @method _enum_groove_player_event_type_
26
+ # @return [Symbol]
27
+ # @scope class
28
+ enum :groove_player_event_type, [
29
+ :nowplaying, 0,
30
+ :bufferunderrun, 1
31
+ ]
32
+
33
+ # (Not documented)
34
+ #
35
+ # = Fields:
36
+ # :type ::
37
+ # (Symbol from _enum_groove_player_event_type_)
38
+ class GroovePlayerEvent < FFI::Union
39
+ layout :type, :groove_player_event_type
40
+ end
41
+
42
+ # (Not documented)
43
+ #
44
+ # = Fields:
45
+ # :device_index ::
46
+ # (Integer) set this to the device you want to open
47
+ # could also be GROOVE_PLAYER_DEFAULT_DEVICE or GROOVE_PLAYER_DUMMY_DEVICE
48
+ # :target_audio_format ::
49
+ # (unknown) The desired audio format settings with which to open the device.
50
+ # groove_player_create defaults these to 44100 Hz,
51
+ # signed 16-bit int, stereo.
52
+ # These are preferences; if a setting cannot be used, a substitute will be
53
+ # used instead. actual_audio_format is set to the actual values.
54
+ # :device_buffer_size ::
55
+ # (Integer) how big the device buffer should be, in sample frames.
56
+ # must be a power of 2.
57
+ # groove_player_create defaults this to 1024
58
+ # :sink_buffer_size ::
59
+ # (Integer) how big the sink buffer should be, in sample frames.
60
+ # groove_player_create defaults this to 8192
61
+ # :gain ::
62
+ # (Float) This volume adjustment to make to this player.
63
+ # It is recommended that you leave this at 1.0 and instead adjust the
64
+ # gain of the underlying playlist.
65
+ # If you want to change this value after you have already attached the
66
+ # sink to the playlist, you must use groove_player_set_gain.
67
+ # float format. Defaults to 1.0
68
+ # :playlist ::
69
+ # (FFI::Pointer(*GroovePlaylist)) read-only. set when you call groove_player_attach and cleared when
70
+ # you call groove_player_detach
71
+ # :actual_audio_format ::
72
+ # (unknown) read-only. set to the actual format you get when you open the device.
73
+ # ideally will be the same as target_audio_format but might not be.
74
+ class GroovePlayer < FFI::Struct
75
+ layout :device_index, :int,
76
+ :target_audio_format, :char,
77
+ :device_buffer_size, :int,
78
+ :sink_buffer_size, :int,
79
+ :gain, :double,
80
+ :playlist, :pointer,
81
+ :actual_audio_format, :char
82
+ end
83
+
84
+ # (Not documented)
85
+ #
86
+ # @method device_count()
87
+ # @return [Integer]
88
+ # @scope class
89
+ attach_function :device_count, :groove_device_count, [], :int
90
+
91
+ # Returns the name of the audio device at the requested index, or NULL on error
92
+ # The string returned by this function is UTF-8 encoded, read-only, and
93
+ # managed internally. You are not to free it. If you need to keep the string
94
+ # for any length of time, you should make your own copy of it.
95
+ #
96
+ # @method device_name(index)
97
+ # @param [Integer] index
98
+ # @return [String]
99
+ # @scope class
100
+ attach_function :device_name, :groove_device_name, [:int], :string
101
+
102
+ # (Not documented)
103
+ #
104
+ # @method player_create()
105
+ # @return [GroovePlayer]
106
+ # @scope class
107
+ attach_function :player_create, :groove_player_create, [], GroovePlayer
108
+
109
+ # (Not documented)
110
+ #
111
+ # @method player_destroy(player)
112
+ # @param [GroovePlayer] player
113
+ # @return [nil]
114
+ # @scope class
115
+ attach_function :player_destroy, :groove_player_destroy, [GroovePlayer], :void
116
+
117
+ # Attaches the player to the playlist instance and opens the device to
118
+ # begin playback.
119
+ # Internally this creates a GrooveSink and sends the samples to the device.
120
+ # you must detach a player before destroying it or the playlist it is
121
+ # attached to
122
+ # returns 0 on success, < 0 on error
123
+ #
124
+ # @method player_attach(player, playlist)
125
+ # @param [GroovePlayer] player
126
+ # @param [FFI::Pointer(*GroovePlaylist)] playlist
127
+ # @return [Integer]
128
+ # @scope class
129
+ attach_function :player_attach, :groove_player_attach, [GroovePlayer, :pointer], :int
130
+
131
+ # returns 0 on success, < 0 on error
132
+ #
133
+ # @method player_detach(player)
134
+ # @param [GroovePlayer] player
135
+ # @return [Integer]
136
+ # @scope class
137
+ attach_function :player_detach, :groove_player_detach, [GroovePlayer], :int
138
+
139
+ # get the position of the play head
140
+ # both the current playlist item and the position in seconds in the playlist
141
+ # item are given. item will be set to NULL if the playlist is empty
142
+ # you may pass NULL for item or seconds
143
+ #
144
+ # @method player_position(player, item, seconds)
145
+ # @param [GroovePlayer] player
146
+ # @param [FFI::Pointer(**GroovePlaylistItem)] item
147
+ # @param [FFI::Pointer(*Double)] seconds
148
+ # @return [nil]
149
+ # @scope class
150
+ attach_function :player_position, :groove_player_position, [GroovePlayer, :pointer, :pointer], :void
151
+
152
+ # returns < 0 on error, 0 on no event ready, 1 on got event
153
+ #
154
+ # @method player_event_get(player, event, block)
155
+ # @param [GroovePlayer] player
156
+ # @param [GroovePlayerEvent] event
157
+ # @param [Integer] block
158
+ # @return [Integer]
159
+ # @scope class
160
+ attach_function :player_event_get, :groove_player_event_get, [GroovePlayer, GroovePlayerEvent, :int], :int
161
+
162
+ # returns < 0 on error, 0 on no event ready, 1 on event ready
163
+ # if block is 1, block until event is ready
164
+ #
165
+ # @method player_event_peek(player, block)
166
+ # @param [GroovePlayer] player
167
+ # @param [Integer] block
168
+ # @return [Integer]
169
+ # @scope class
170
+ attach_function :player_event_peek, :groove_player_event_peek, [GroovePlayer, :int], :int
171
+
172
+ # See the gain property of GrooveSink. It is recommended that you leave this
173
+ # at 1.0 and instead adjust the gain of the playlist.
174
+ # returns 0 on success, < 0 on error
175
+ #
176
+ # @method player_set_gain(player, gain)
177
+ # @param [GroovePlayer] player
178
+ # @param [Float] gain
179
+ # @return [Integer]
180
+ # @scope class
181
+ attach_function :player_set_gain, :groove_player_set_gain, [GroovePlayer, :double], :int
182
+
183
+ end
@@ -0,0 +1,5 @@
1
+ module Groove
2
+ # This is the ruby-groove version.
3
+ # To get the libgroove version use: Groove.version
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'test_helper'
2
+
3
+ describe Groove do
4
+ it 'heyo' do
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ describe Groove::VERSION do
4
+ it 'must be a valid version' do
5
+ Groove::VERSION.must_be_kind_of String
6
+ Groove::VERSION.must_match /\d+\.\d+\.\d/
7
+ end
8
+ end
@@ -0,0 +1,2 @@
1
+ require 'minitest/autorun'
2
+ require 'groove'
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-groove
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - john muhl
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ffi_gen
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.8'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.8'
97
+ description:
98
+ email:
99
+ - me@johnmuhl.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - LICENSE.txt
105
+ - README.md
106
+ - lib/groove.rb
107
+ - lib/groove/fingerprinter.rb
108
+ - lib/groove/groove.rb
109
+ - lib/groove/loudness.rb
110
+ - lib/groove/player.rb
111
+ - lib/groove/version.rb
112
+ - test/lib/groove.rb
113
+ - test/lib/test_version.rb
114
+ - test/test_helper.rb
115
+ homepage: http://github.com/johnmuhl/ruby-groove
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.2.2
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: FFI bindings to libgroove
139
+ test_files: []
140
+ has_rdoc: