Module: Groove::Player

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

Defined Under Namespace

Classes: GroovePlayer, GroovePlayerEvent

Class Method Summary collapse

Class Method Details

._enum_groove_player_event_type_Symbol

(Not documented)

This entry is only for documentation and no real method. The FFI::Enum can be accessed via #enum_type(:groove_player_event_type).

Options:

:nowplaying

when the currently playing track changes.

:bufferunderrun

when something tries to read from an empty buffer

Returns:

  • (Symbol)


28
29
30
31
# File 'lib/groove/player.rb', line 28

enum :groove_player_event_type, [
  :nowplaying, 0,
  :bufferunderrun, 1
]

.attach_function(name, *_) ⇒ Object



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

.device_countInteger

(Not documented)

Returns:

  • (Integer)


89
# File 'lib/groove/player.rb', line 89

attach_function :device_count, :groove_device_count, [], :int

.device_name(index) ⇒ String

Returns the name of the audio device at the requested index, or NULL on error The string returned by this function is UTF-8 encoded, read-only, and managed internally. You are not to free it. If you need to keep the string for any length of time, you should make your own copy of it.

Parameters:

  • index (Integer)

Returns:

  • (String)


100
# File 'lib/groove/player.rb', line 100

attach_function :device_name, :groove_device_name, [:int], :string

.player_attach(player, playlist) ⇒ Integer

Attaches the player to the playlist instance and opens the device to begin playback. Internally this creates a GrooveSink and sends the samples to the device. you must detach a player before destroying it or the playlist it is attached to returns 0 on success, < 0 on error

Parameters:

Returns:

  • (Integer)


129
# File 'lib/groove/player.rb', line 129

attach_function :player_attach, :groove_player_attach, [GroovePlayer, :pointer], :int

.player_createGroovePlayer

(Not documented)

Returns:



107
# File 'lib/groove/player.rb', line 107

attach_function :player_create, :groove_player_create, [], GroovePlayer

.player_destroy(player) ⇒ nil

(Not documented)

Parameters:

Returns:

  • (nil)


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

attach_function :player_destroy, :groove_player_destroy, [GroovePlayer], :void

.player_detach(player) ⇒ Integer

returns 0 on success, < 0 on error

Parameters:

Returns:

  • (Integer)


137
# File 'lib/groove/player.rb', line 137

attach_function :player_detach, :groove_player_detach, [GroovePlayer], :int

.player_event_get(player, event, block) ⇒ Integer

returns < 0 on error, 0 on no event ready, 1 on got event

Parameters:

Returns:

  • (Integer)


160
# File 'lib/groove/player.rb', line 160

attach_function :player_event_get, :groove_player_event_get, [GroovePlayer, GroovePlayerEvent, :int], :int

.player_event_peek(player, block) ⇒ Integer

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

Parameters:

Returns:

  • (Integer)


170
# File 'lib/groove/player.rb', line 170

attach_function :player_event_peek, :groove_player_event_peek, [GroovePlayer, :int], :int

.player_position(player, item, seconds) ⇒ nil

get the position of the play 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)


150
# File 'lib/groove/player.rb', line 150

attach_function :player_position, :groove_player_position, [GroovePlayer, :pointer, :pointer], :void

.player_set_gain(player, 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

Parameters:

Returns:

  • (Integer)


181
# File 'lib/groove/player.rb', line 181

attach_function :player_set_gain, :groove_player_set_gain, [GroovePlayer, :double], :int