Class: LAME::Encoding::EncodeShortBuffer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/lame/encoding/encode_short_buffer.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ EncodeShortBuffer

Returns a new instance of EncodeShortBuffer.



8
9
10
# File 'lib/lame/encoding/encode_short_buffer.rb', line 8

def initialize(configuration)
  @configuration = configuration
end

Instance Method Details

#encode_frame(left, right) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lame/encoding/encode_short_buffer.rb', line 12

def encode_frame(left, right)
  left_buffer  = Buffer.create(:short, left)
  right_buffer = Buffer.create(:short, right)
  output       = Buffer.create_empty(:uchar, output_buffer_size)

  mp3_size = LAME.lame_encode_buffer(global_flags,
                                     left_buffer, right_buffer, left.size,
                                     output, output_buffer_size)

  output.get_bytes(0, mp3_size)
end