Module: Groove::Fingerprinter

Extended by:
FFI::Library
Defined in:
lib/groove/fingerprinter.rb

Defined Under Namespace

Classes: GrooveFingerprinter, GrooveFingerprinterInfo

Class Method Summary collapse

Class Method Details

.attach_function(name, *_) ⇒ Object



9
10
11
12
13
# File 'lib/groove/fingerprinter.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

.fingerprinter_attach(printer, playlist) ⇒ Integer

once you attach, you must detach before destroying the playlist

Parameters:

Returns:

  • (Integer)


77
# File 'lib/groove/fingerprinter.rb', line 77

attach_function :fingerprinter_attach, :groove_fingerprinter_attach, [GrooveFingerprinter, :pointer], :int

.fingerprinter_createGrooveFingerprinter

(Not documented)

Returns:



60
# File 'lib/groove/fingerprinter.rb', line 60

attach_function :fingerprinter_create, :groove_fingerprinter_create, [], GrooveFingerprinter

.fingerprinter_dealloc(ptr) ⇒ nil

(Not documented)

Parameters:

  • ptr (FFI::Pointer(*Void))

Returns:

  • (nil)


182
# File 'lib/groove/fingerprinter.rb', line 182

attach_function :fingerprinter_dealloc, :groove_fingerprinter_dealloc, [:pointer], :void

.fingerprinter_decode(encoded_fp, fp, size) ⇒ Integer

Uncompress and base64-decode an encoded fingerprint

The caller is responsible for freeing the returned pointer using groove_fingerprinter_dealloc().

Parameters:

- encoded_fp: Pointer to an encoded fingerprint
- encoded_size: Size of the encoded fingerprint in bytes
- fp: Pointer to a pointer, where the decoded raw fingerprint (array
      of signed 32-bit integers) will be stored
- size: Number of items in the returned raw fingerprint

Returns:

- 0 on success, < 0 on error

Parameters:

  • encoded_fp (String)
  • fp (FFI::Pointer(**Int32T))
  • size (FFI::Pointer(*Int))

Returns:

  • (Integer)


174
# File 'lib/groove/fingerprinter.rb', line 174

attach_function :fingerprinter_decode, :groove_fingerprinter_decode, [:string, :pointer, :pointer], :int

.fingerprinter_destroy(printer) ⇒ nil

(Not documented)

Parameters:

Returns:

  • (nil)


68
# File 'lib/groove/fingerprinter.rb', line 68

attach_function :fingerprinter_destroy, :groove_fingerprinter_destroy, [GrooveFingerprinter], :void

.fingerprinter_detach(printer) ⇒ Integer

(Not documented)

Parameters:

Returns:

  • (Integer)


85
# File 'lib/groove/fingerprinter.rb', line 85

attach_function :fingerprinter_detach, :groove_fingerprinter_detach, [GrooveFingerprinter], :int

.fingerprinter_encode(fp, size, encoded_fp) ⇒ Integer

Compress and base64-encode a raw fingerprint

The caller is responsible for freeing the returned pointer using groove_fingerprinter_dealloc().

Parameters:

- fp: pointer to an array of signed 32-bit integers representing the raw
      fingerprint to be encoded
- size: number of items in the raw fingerprint
- encoded_fp: pointer to a pointer, where the encoded fingerprint will be
              stored

Returns:

- 0 on success, < 0 on error

Parameters:

  • fp (FFI::Pointer(*Int32T))
  • size (Integer)
  • encoded_fp (FFI::Pointer(**CharS))

Returns:

  • (Integer)


151
# File 'lib/groove/fingerprinter.rb', line 151

attach_function :fingerprinter_encode, :groove_fingerprinter_encode, [:pointer, :int, :pointer], :int

.fingerprinter_free_info(info) ⇒ nil

(Not documented)

Parameters:

Returns:

  • (nil)


105
# File 'lib/groove/fingerprinter.rb', line 105

attach_function :fingerprinter_free_info, :groove_fingerprinter_free_info, [GrooveFingerprinterInfo], :void

.fingerprinter_info_get(printer, info, block) ⇒ Integer

returns < 0 on error, 0 on aborted (block=1) or no info ready (block=0), 1 on info returned. When you get info you must free it with groove_fingerprinter_free_info.

Parameters:

Returns:

  • (Integer)


97
# File 'lib/groove/fingerprinter.rb', line 97

attach_function :fingerprinter_info_get, :groove_fingerprinter_info_get, [GrooveFingerprinter, GrooveFingerprinterInfo, :int], :int

.fingerprinter_info_peek(printer, block) ⇒ Integer

returns < 0 on error, 0 on no info ready, 1 on info ready if block is 1, block until info is ready

Parameters:

Returns:

  • (Integer)


115
# File 'lib/groove/fingerprinter.rb', line 115

attach_function :fingerprinter_info_peek, :groove_fingerprinter_info_peek, [GrooveFingerprinter, :int], :int

.fingerprinter_position(printer, item, seconds) ⇒ nil

get the position of the printer 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 you may pass NULL for item or seconds

Parameters:

Returns:

  • (nil)


128
# File 'lib/groove/fingerprinter.rb', line 128

attach_function :fingerprinter_position, :groove_fingerprinter_position, [GrooveFingerprinter, :pointer, :pointer], :void