Module: Groove
- Extended by:
- FFI::Library
- Defined in:
- lib/groove/groove.rb,
lib/groove/version.rb
Defined Under Namespace
Modules: Fingerprinter, Loudness, Player Classes: GrooveAudioFormat, GrooveBuffer, GrooveFile, GroovePlaylist, GroovePlaylistItem, GrooveQueue, GrooveSink, GrooveTag
Constant Summary collapse
- GROOVE_LOG_ERROR =
16
- GROOVE_LOG_WARNING =
24
- GROOVE_LOG_INFO =
32
- GROOVE_CH_FRONT_LEFT =
0x00000001
- GROOVE_CH_FRONT_RIGHT =
0x00000002
- GROOVE_CH_FRONT_CENTER =
0x00000004
- GROOVE_TAG_MATCH_CASE =
1
- GROOVE_TAG_DONT_OVERWRITE =
16
- GROOVE_TAG_APPEND =
32
- GROOVE_EVERY_SINK_FULL =
0
- GROOVE_ANY_SINK_FULL =
1
- GROOVE_BUFFER_NO =
0
- GROOVE_BUFFER_YES =
1
- GROOVE_BUFFER_END =
2
- VERSION =
This is the ruby-groove version. To get the libgroove version use: Groove.version
"0.1.0"
Class Method Summary collapse
-
._enum_groove_sample_format_ ⇒ Symbol
(Not documented).
- .attach_function(name, *_) ⇒ Object
-
.buffer_ref(buffer) ⇒ nil
presentation time stamp of the buffer.
-
.buffer_unref(buffer) ⇒ nil
(Not documented).
-
.channel_layout_count(channel_layout) ⇒ Integer
get the channel count for the channel layout.
-
.channel_layout_default(count) ⇒ Integer
get the default channel layout based on the channel count.
-
.file_audio_format(file, audio_format) ⇒ nil
get the audio format of the main audio stream of a file.
-
.file_close(file) ⇒ nil
(Not documented).
-
.file_duration(file) ⇒ Float
main audio stream duration in seconds.
-
.file_metadata_get(file, key, prev, flags) ⇒ GrooveTag
(Not documented).
-
.file_metadata_set(file, key, value, flags) ⇒ Integer
key entry to add to metadata.
-
.file_open(filename) ⇒ GrooveFile
you are always responsible for calling groove_file_close on the returned GrooveFile.
-
.file_save(file) ⇒ Integer
write changes made to metadata to disk.
-
.file_short_names(file) ⇒ String
a comma separated list of short names for the format.
-
.finish ⇒ nil
call at the end of your program to clean up.
-
.init ⇒ Integer
(Not documented).
-
.playlist_clear(playlist) ⇒ nil
remove all playlist items.
-
.playlist_count(playlist) ⇒ Integer
return the count of playlist items.
-
.playlist_create ⇒ GroovePlaylist
a playlist keeps its sinks full.
-
.playlist_destroy(playlist) ⇒ nil
this will not call groove_file_close on any files it will remove all playlist items and sinks from the playlist.
-
.playlist_insert(playlist, file, gain, peak, next_) ⇒ GroovePlaylistItem
once you add a file to the playlist, you must not destroy it until you first remove it from the playlist.
-
.playlist_pause(playlist) ⇒ nil
(Not documented).
-
.playlist_play(playlist) ⇒ nil
(Not documented).
-
.playlist_playing(playlist) ⇒ Integer
return 1 if the playlist is playing; 0 if it is not.
-
.playlist_position(playlist, item, seconds) ⇒ nil
get the position of the decode head both the current playlist item and the position in seconds in the playlist item are given.
-
.playlist_remove(playlist, item) ⇒ nil
this will not call groove_file_close on item->file ! item is destroyed and the address it points to is no longer valid.
-
.playlist_seek(playlist, item, seconds) ⇒ nil
(Not documented).
-
.playlist_set_fill_mode(playlist, mode) ⇒ nil
Use this to set the fill mode using the constants above.
-
.playlist_set_gain(playlist, gain) ⇒ nil
(Not documented).
-
.playlist_set_item_gain(playlist, item, gain) ⇒ nil
(Not documented).
-
.playlist_set_item_peak(playlist, item, peak) ⇒ nil
(Not documented).
-
.queue_abort(queue) ⇒ nil
(Not documented).
-
.queue_cleanup_default(queue, obj) ⇒ nil
(Not documented).
-
.queue_create ⇒ GrooveQueue
(Not documented).
-
.queue_destroy(queue) ⇒ nil
(Not documented).
-
.queue_flush(queue) ⇒ nil
(Not documented).
-
.queue_get(queue, obj_ptr, block) ⇒ Integer
// returns -1 if aborted, 1 if got event, 0 if no event ready.
-
.queue_peek(queue, block) ⇒ Integer
(Not documented).
-
.queue_purge(queue) ⇒ nil
(Not documented).
-
.queue_put(queue, obj) ⇒ Integer
(Not documented).
-
.queue_reset(queue) ⇒ nil
(Not documented).
-
.sample_format_bytes_per_sample(format) ⇒ Integer
double (64 bits), planar.
-
.set_logging(level) ⇒ nil
enable/disable logging of errors.
-
.sink_attach(sink, playlist) ⇒ Integer
before calling this, set audio_format returns 0 on success, < 0 on error.
-
.sink_buffer_get(sink, buffer, block) ⇒ Integer
returns < 0 on error, GROOVE_BUFFER_NO on aborted (block=1) or no buffer ready (block=0), GROOVE_BUFFER_YES on buffer returned, and GROOVE_BUFFER_END on end of playlist.
-
.sink_buffer_peek(sink, block) ⇒ Integer
returns < 0 on error, 0 on no buffer ready, 1 on buffer ready if block is 1, block until buffer is ready.
-
.sink_create ⇒ GrooveSink
read-only.
-
.sink_destroy(sink) ⇒ nil
(Not documented).
-
.sink_detach(sink) ⇒ Integer
returns 0 on success, < 0 on error.
-
.sink_set_gain(sink, gain) ⇒ Integer
See the gain property of GrooveSink.
-
.tag_key(tag) ⇒ String
If the entry already exists, append to it.
-
.tag_value(tag) ⇒ String
(Not documented).
-
.version ⇒ String
(Not documented).
-
.version_major ⇒ Integer
(Not documented).
-
.version_minor ⇒ Integer
(Not documented).
-
.version_patch ⇒ Integer
(Not documented).
Class Method Details
._enum_groove_sample_format_ ⇒ Symbol
(Not documented)
This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:groove_sample_format).
Options:
- :fmt_none
- :fmt_u8
- :fmt_s16
- :fmt_u8
-
unsigned 8 bits
- :fmt_s32
-
signed 16 bits
- :fmt_flt
-
signed 32 bits
- :fmt_dbl
-
float (32 bits)
- :fmt_u8p
-
double (64 bits)
- :fmt_s16p
-
unsigned 8 bits, planar
- :fmt_s32p
-
signed 16 bits, planar
- :fmt_fltp
-
signed 32 bits, planar
- :fmt_dblp
-
float (32 bits), planar
113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/groove/groove.rb', line 113 enum :groove_sample_format, [ :fmt_none, -1, :fmt_u8, 0, :fmt_s16, 1, :fmt_s32, 2, :fmt_flt, 3, :fmt_dbl, 4, :fmt_u8p, 5, :fmt_s16p, 6, :fmt_s32p, 7, :fmt_fltp, 8, :fmt_dblp, 9 ] |
.attach_function(name, *_) ⇒ Object
9 10 11 12 13 |
# File 'lib/groove/groove.rb', line 9 def self.attach_function(name, *_) begin; super; rescue FFI::NotFoundError => e (class << self; self; end).class_eval { define_method(name) { |*_| raise e } } end end |
.buffer_ref(buffer) ⇒ nil
presentation time stamp of the buffer
527 |
# File 'lib/groove/groove.rb', line 527 attach_function :buffer_ref, :groove_buffer_ref, [GrooveBuffer], :void |
.buffer_unref(buffer) ⇒ nil
(Not documented)
535 |
# File 'lib/groove/groove.rb', line 535 attach_function :buffer_unref, :groove_buffer_unref, [GrooveBuffer], :void |
.channel_layout_count(channel_layout) ⇒ Integer
get the channel count for the channel layout
72 |
# File 'lib/groove/groove.rb', line 72 attach_function :channel_layout_count, :groove_channel_layout_count, [:ulong], :int |
.channel_layout_default(count) ⇒ Integer
get the default channel layout based on the channel count
80 |
# File 'lib/groove/groove.rb', line 80 attach_function :channel_layout_default, :groove_channel_layout_default, [:int], :ulong |
.file_audio_format(file, audio_format) ⇒ nil
get the audio format of the main audio stream of a file
292 |
# File 'lib/groove/groove.rb', line 292 attach_function :file_audio_format, :groove_file_audio_format, [GrooveFile, GrooveAudioFormat], :void |
.file_close(file) ⇒ nil
(Not documented)
228 |
# File 'lib/groove/groove.rb', line 228 attach_function :file_close, :groove_file_close, [GrooveFile], :void |
.file_duration(file) ⇒ Float
main audio stream duration in seconds. note that this relies on a combination of format headers and heuristics. It can be inaccurate. The most accurate way to learn the duration of a file is to use GrooveLoudnessDetector
283 |
# File 'lib/groove/groove.rb', line 283 attach_function :file_duration, :groove_file_duration, [GrooveFile], :double |
.file_metadata_get(file, key, prev, flags) ⇒ GrooveTag
(Not documented)
239 |
# File 'lib/groove/groove.rb', line 239 attach_function :file_metadata_get, :groove_file_metadata_get, [GrooveFile, :string, GrooveTag, :int], GrooveTag |
.file_metadata_set(file, key, value, flags) ⇒ Integer
key entry to add to metadata. will be strdup’d value entry to add to metadata. will be strdup’d
passing NULL causes existing entry to be deleted.
return >= 0 on success otherwise an error code < 0 note that this will not save the file; you must call groove_file_save to do that.
255 |
# File 'lib/groove/groove.rb', line 255 attach_function :file_metadata_set, :groove_file_metadata_set, [GrooveFile, :string, :string, :int], :int |
.file_open(filename) ⇒ GrooveFile
you are always responsible for calling groove_file_close on the returned GrooveFile.
220 |
# File 'lib/groove/groove.rb', line 220 attach_function :file_open, :groove_file_open, [:string], GrooveFile |
.file_save(file) ⇒ Integer
write changes made to metadata to disk. return < 0 on error
272 |
# File 'lib/groove/groove.rb', line 272 attach_function :file_save, :groove_file_save, [GrooveFile], :int |
.file_short_names(file) ⇒ String
a comma separated list of short names for the format
263 |
# File 'lib/groove/groove.rb', line 263 attach_function :file_short_names, :groove_file_short_names, [GrooveFile], :string |
.finish ⇒ nil
call at the end of your program to clean up. after calling this you may no longer use this API.
56 |
# File 'lib/groove/groove.rb', line 56 attach_function :finish, :groove_finish, [], :void |
.init ⇒ Integer
(Not documented)
48 |
# File 'lib/groove/groove.rb', line 48 attach_function :init, :groove_init, [], :int |
.playlist_clear(playlist) ⇒ nil
remove all playlist items
440 |
# File 'lib/groove/groove.rb', line 440 attach_function :playlist_clear, :groove_playlist_clear, [GroovePlaylist], :void |
.playlist_count(playlist) ⇒ Integer
return the count of playlist items
448 |
# File 'lib/groove/groove.rb', line 448 attach_function :playlist_count, :groove_playlist_count, [GroovePlaylist], :int |
.playlist_create ⇒ GroovePlaylist
a playlist keeps its sinks full.
345 |
# File 'lib/groove/groove.rb', line 345 attach_function :playlist_create, :groove_playlist_create, [], GroovePlaylist |
.playlist_destroy(playlist) ⇒ nil
this will not call groove_file_close on any files it will remove all playlist items and sinks from the playlist
354 |
# File 'lib/groove/groove.rb', line 354 attach_function :playlist_destroy, :groove_playlist_destroy, [GroovePlaylist], :void |
.playlist_insert(playlist, file, gain, peak, next_) ⇒ GroovePlaylistItem
once you add a file to the playlist, you must not destroy it until you first remove it from the playlist. next: the item to insert before. if NULL, you will append to the playlist. gain: see GroovePlaylistItem structure. use 1.0 for no adjustment. peak: see GroovePlaylistItem structure. use 1.0 for no adjustment. returns the newly created playlist item.
397 |
# File 'lib/groove/groove.rb', line 397 attach_function :playlist_insert, :groove_playlist_insert, [GroovePlaylist, GrooveFile, :double, :double, GroovePlaylistItem], GroovePlaylistItem |
.playlist_pause(playlist) ⇒ nil
(Not documented)
370 |
# File 'lib/groove/groove.rb', line 370 attach_function :playlist_pause, :groove_playlist_pause, [GroovePlaylist], :void |
.playlist_play(playlist) ⇒ nil
(Not documented)
362 |
# File 'lib/groove/groove.rb', line 362 attach_function :playlist_play, :groove_playlist_play, [GroovePlaylist], :void |
.playlist_playing(playlist) ⇒ Integer
return 1 if the playlist is playing; 0 if it is not.
432 |
# File 'lib/groove/groove.rb', line 432 attach_function :playlist_playing, :groove_playlist_playing, [GroovePlaylist], :int |
.playlist_position(playlist, item, seconds) ⇒ nil
get the position of the decode head both the current playlist item and the position in seconds in the playlist item are given. item will be set to NULL if the playlist is empty seconds will be set to -1.0 if item is NULL. you may pass NULL for item or seconds Note that typically you are more interested in the position of the play head, not the decode head. For example, if you have a GroovePlayer attached, groove_player_position will give you the position of the play head.
424 |
# File 'lib/groove/groove.rb', line 424 attach_function :playlist_position, :groove_playlist_position, [GroovePlaylist, :pointer, :pointer], :void |
.playlist_remove(playlist, item) ⇒ nil
this will not call groove_file_close on item->file ! item is destroyed and the address it points to is no longer valid
407 |
# File 'lib/groove/groove.rb', line 407 attach_function :playlist_remove, :groove_playlist_remove, [GroovePlaylist, GroovePlaylistItem], :void |
.playlist_seek(playlist, item, seconds) ⇒ nil
(Not documented)
380 |
# File 'lib/groove/groove.rb', line 380 attach_function :playlist_seek, :groove_playlist_seek, [GroovePlaylist, GroovePlaylistItem, :double], :void |
.playlist_set_fill_mode(playlist, mode) ⇒ nil
Use this to set the fill mode using the constants above
486 |
# File 'lib/groove/groove.rb', line 486 attach_function :playlist_set_fill_mode, :groove_playlist_set_fill_mode, [GroovePlaylist, :int], :void |
.playlist_set_gain(playlist, gain) ⇒ nil
(Not documented)
457 |
# File 'lib/groove/groove.rb', line 457 attach_function :playlist_set_gain, :groove_playlist_set_gain, [GroovePlaylist, :double], :void |
.playlist_set_item_gain(playlist, item, gain) ⇒ nil
(Not documented)
467 |
# File 'lib/groove/groove.rb', line 467 attach_function :playlist_set_item_gain, :groove_playlist_set_item_gain, [GroovePlaylist, GroovePlaylistItem, :double], :void |
.playlist_set_item_peak(playlist, item, peak) ⇒ nil
(Not documented)
477 |
# File 'lib/groove/groove.rb', line 477 attach_function :playlist_set_item_peak, :groove_playlist_set_item_peak, [GroovePlaylist, GroovePlaylistItem, :double], :void |
.queue_abort(queue) ⇒ nil
(Not documented)
713 |
# File 'lib/groove/groove.rb', line 713 attach_function :queue_abort, :groove_queue_abort, [GrooveQueue], :void |
.queue_cleanup_default(queue, obj) ⇒ nil
(Not documented)
766 |
# File 'lib/groove/groove.rb', line 766 attach_function :queue_cleanup_default, :groove_queue_cleanup_default, [GrooveQueue, :pointer], :void |
.queue_create ⇒ GrooveQueue
(Not documented)
689 |
# File 'lib/groove/groove.rb', line 689 attach_function :queue_create, :groove_queue_create, [], GrooveQueue |
.queue_destroy(queue) ⇒ nil
(Not documented)
705 |
# File 'lib/groove/groove.rb', line 705 attach_function :queue_destroy, :groove_queue_destroy, [GrooveQueue], :void |
.queue_flush(queue) ⇒ nil
(Not documented)
697 |
# File 'lib/groove/groove.rb', line 697 attach_function :queue_flush, :groove_queue_flush, [GrooveQueue], :void |
.queue_get(queue, obj_ptr, block) ⇒ Integer
// returns -1 if aborted, 1 if got event, 0 if no event ready
740 |
# File 'lib/groove/groove.rb', line 740 attach_function :queue_get, :groove_queue_get, [GrooveQueue, :pointer, :int], :int |
.queue_peek(queue, block) ⇒ Integer
(Not documented)
749 |
# File 'lib/groove/groove.rb', line 749 attach_function :queue_peek, :groove_queue_peek, [GrooveQueue, :int], :int |
.queue_purge(queue) ⇒ nil
(Not documented)
757 |
# File 'lib/groove/groove.rb', line 757 attach_function :queue_purge, :groove_queue_purge, [GrooveQueue], :void |
.queue_put(queue, obj) ⇒ Integer
(Not documented)
730 |
# File 'lib/groove/groove.rb', line 730 attach_function :queue_put, :groove_queue_put, [GrooveQueue, :pointer], :int |
.queue_reset(queue) ⇒ nil
(Not documented)
721 |
# File 'lib/groove/groove.rb', line 721 attach_function :queue_reset, :groove_queue_reset, [GrooveQueue], :void |
.sample_format_bytes_per_sample(format) ⇒ Integer
double (64 bits), planar
148 |
# File 'lib/groove/groove.rb', line 148 attach_function :sample_format_bytes_per_sample, :groove_sample_format_bytes_per_sample, [:groove_sample_format], :int |
.set_logging(level) ⇒ nil
enable/disable logging of errors
64 |
# File 'lib/groove/groove.rb', line 64 attach_function :set_logging, :groove_set_logging, [:int], :void |
.sink_attach(sink, playlist) ⇒ Integer
before calling this, set audio_format returns 0 on success, < 0 on error
619 |
# File 'lib/groove/groove.rb', line 619 attach_function :sink_attach, :groove_sink_attach, [GrooveSink, GroovePlaylist], :int |
.sink_buffer_get(sink, buffer, block) ⇒ Integer
returns < 0 on error, GROOVE_BUFFER_NO on aborted (block=1) or no buffer ready (block=0), GROOVE_BUFFER_YES on buffer returned, and GROOVE_BUFFER_END on end of playlist. buffer is always set to either a valid GrooveBuffer or NULL
640 |
# File 'lib/groove/groove.rb', line 640 attach_function :sink_buffer_get, :groove_sink_buffer_get, [GrooveSink, :pointer, :int], :int |
.sink_buffer_peek(sink, block) ⇒ Integer
returns < 0 on error, 0 on no buffer ready, 1 on buffer ready if block is 1, block until buffer is ready
650 |
# File 'lib/groove/groove.rb', line 650 attach_function :sink_buffer_peek, :groove_sink_buffer_peek, [GrooveSink, :int], :int |
.sink_create ⇒ GrooveSink
read-only. automatically computed from audio_format when you call groove_sink_attach
601 |
# File 'lib/groove/groove.rb', line 601 attach_function :sink_create, :groove_sink_create, [], GrooveSink |
.sink_destroy(sink) ⇒ nil
(Not documented)
609 |
# File 'lib/groove/groove.rb', line 609 attach_function :sink_destroy, :groove_sink_destroy, [GrooveSink], :void |
.sink_detach(sink) ⇒ Integer
returns 0 on success, < 0 on error
627 |
# File 'lib/groove/groove.rb', line 627 attach_function :sink_detach, :groove_sink_detach, [GrooveSink], :int |
.sink_set_gain(sink, gain) ⇒ Integer
See the gain property of GrooveSink. It is recommended that you leave this at 1.0 and instead adjust the gain of the playlist. returns 0 on success, < 0 on error
661 |
# File 'lib/groove/groove.rb', line 661 attach_function :sink_set_gain, :groove_sink_set_gain, [GrooveSink, :double], :int |
.tag_key(tag) ⇒ String
If the entry already exists, append to it. Note that no delimiter is added, the strings are simply concatenated.
203 |
# File 'lib/groove/groove.rb', line 203 attach_function :tag_key, :groove_tag_key, [GrooveTag], :string |
.tag_value(tag) ⇒ String
(Not documented)
211 |
# File 'lib/groove/groove.rb', line 211 attach_function :tag_value, :groove_tag_value, [GrooveTag], :string |
.version ⇒ String
(Not documented)
176 |
# File 'lib/groove/groove.rb', line 176 attach_function :version, :groove_version, [], :string |
.version_major ⇒ Integer
(Not documented)
155 |
# File 'lib/groove/groove.rb', line 155 attach_function :version_major, :groove_version_major, [], :int |
.version_minor ⇒ Integer
(Not documented)
162 |
# File 'lib/groove/groove.rb', line 162 attach_function :version_minor, :groove_version_minor, [], :int |
.version_patch ⇒ Integer
(Not documented)
169 |
# File 'lib/groove/groove.rb', line 169 attach_function :version_patch, :groove_version_patch, [], :int |