class PartyGoerPlayer::FrameReader

Attributes

size[R]

Public Class Methods

new(channels, sample_type, frames_count, frames_ptr) click to toggle source
# File lib/partygoer-player/framereader.rb, line 6
def initialize(channels, sample_type, frames_count, frames_ptr)
  @channels = channels
  @sample_type = sample_type
  @size = frames_count * @channels
  @pointer = FFI::Pointer.new(@sample_type, frames_ptr)
end

Public Instance Methods

each() { |public_send| ... } click to toggle source
# File lib/partygoer-player/framereader.rb, line 13
def each
  return enum_for(__method__) unless block_given?

  ffi_read = :"read_#{@sample_type}"

  (0...size).each do |index|
    yield @pointer[index].public_send(ffi_read)
  end
end