Class MusicBrainz::TRM
In: musicbrainz.c
Parent: Object
Methods
convert_sig    finalize_signature    generate_signature    initialize    length=    new    pcm_data    proxy=   
Public Class methods
new(VALUE klass)

Allocate and initialize a new MusicBrainz::TRM object.

Example:

  trm = MusicBrainz::TRM.new
initialize(VALUE self)

Constructor for MusicBrainz::TRM object.

This method is currently empty. You should never call this method directly unless you're instantiating a derived class (ie, you know what you're doing).

Public Instance methods
proxy=(int argc, VALUE *argv, VALUE self)

Set the proxy name and port for the MusicBrainz::TRM object.

Returns false if MusicBrainz could not connect to the proxy.

Aliases:

  MusicBrainz::TRM#set_proxy

Examples:

  # connect to 'proxy.localdomain', port 8080
  trm.proxy = 'proxy.localdomain'

  # connect to proxy.example.com, port 31337
  trm.proxy = 'proxy.example.com:31337'
  # connect to www.musicbrainz.org, port 8080
  trm.set_proxy 'www.musicbrainz.org'

  # connect to proxy.example.com, port 31337
  trm.set_proxy 'proxy.example.com', 31337
pcm_data(VALUE self, VALUE samples, VALUE chans, VALUE bps)

Set the information of an audio stream to be signatured.

Note: this MUST be called before attempting to generate a signature.

samples: samples per second (Hz) of audio data (eg 44100) channels: number of audio channels (eg 1 for mono, or two for stereo) bits: bits per sample (eg 8 or 16)

Aliases:

  MusicBrainz::TRM#set_pcm_data
  MusicBrainz::TRM#pcm_data_info
  MusicBrainz::TRM#set_pcm_data_info

Examples:

  # prepare for CD-quality audio
  samples, channels, bits = 44100, 2, 16
  trm.pcm_data samples, channels, bits
length=(VALUE self, VALUE len)

Set the length of an audio stream (in seconds).

Note: This method is optional, but if it is called, it must be called after MusicBrainz::TRM#pcm_data and before any calls to MusicBrainz::TRM#generate_signature.

Aliases:

  MusicBrainz::TRM#set_length
  MusicBrainz::TRM#song_length=
  MusicBrainz::TRM#set_song_length

Examples:

  trm.length = 4000
generate_signature(VALUE self, VALUE buf)

Pass raw PCM data to generate a signature.

Note: MusicBrainz::TRM#pcm_data must be called before this function.

Returns true if enough data has been sent to generate a signature, and false if more data is needed.

Example:

  trm.generate_signature buf, BUFSIZ
finalize_signature(int argc, VALUE *argv, VALUE self)

Finalize generated signature.

Call this after MusicBrainz::TRM#generate_signature has returned 1.

Accepts an optional 16-byte string, used to associate the signature with a particular collection in the RElatable Engine. Returns nil on error, or a 16 byte signature on success.

Example:

  sig = trm.finalize_signature
convert_sig(VALUE self, VALUE sig)

Convert 16-bypte raw signature into a human-readable 36-byte ASCII string.

Used after MusicBrainz::TRM#generate_signature has returned false and MusicBrainz::TRM#finalize_signature has returned a signature.

Aliases:

  MusicBrainz::TRM#sig_to_ascii
  MusicBrainz::TRM#convert_sig_to_ascii

Examples:

  puts 'signature: ' << trm.convert_sig raw_sig