Class: LAME::Buffer

Inherits:
Object
  • Object
show all
Defined in:
lib/lame/buffer.rb

Class Method Summary collapse

Class Method Details

.create(type, input) ⇒ Object



4
5
6
7
8
# File 'lib/lame/buffer.rb', line 4

def self.create(type, input)
  buffer = ::FFI::MemoryPointer.new(type, input.size)
  buffer.send(:"put_array_of_#{type}", 0, input)
  buffer
end

.create_empty(type, size) ⇒ Object



16
17
18
# File 'lib/lame/buffer.rb', line 16

def self.create_empty(type, size)
  ::FFI::MemoryPointer.new(type, size)
end

.create_uchar(input) ⇒ Object



10
11
12
13
14
# File 'lib/lame/buffer.rb', line 10

def self.create_uchar(input)
  buffer = ::FFI::MemoryPointer.new(:uchar, input.size)
  buffer.put_array_of_uchar(0, input.bytes.to_a)
  buffer
end