Class: CoreAudio::AudioBuffer

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/macos/core_audio/audio_types.rb

Instance Method Summary collapse

Instance Method Details

#bytesString

Returns the raw bytes.

Returns:

  • (String)

    the raw bytes



8
9
10
# File 'lib/macos/core_audio/audio_types.rb', line 8

def bytes
    self[:mData].get_bytes(0, self[:mDataByteSize])
end

#bytesizeObject



12
13
14
# File 'lib/macos/core_audio/audio_types.rb', line 12

def bytesize
    self[:mDataByteSize]
end

#samples_float(bytes_per_channel) ⇒ Array<Float>

Returns an array of samples, converted to Float.

Returns:

  • (Array<Float>)

    an array of samples, converted to Float



22
23
24
# File 'lib/macos/core_audio/audio_types.rb', line 22

def samples_float(bytes_per_channel)
    self[:mData].get_array_of_float32(0, self[:mDataByteSize]/bytes_per_channel)
end

#samples_int(bytes_per_channel) ⇒ Array<Integer>

Returns an array of samples, converted to signed integers.

Returns:

  • (Array<Integer>)

    an array of samples, converted to signed integers



17
18
19
# File 'lib/macos/core_audio/audio_types.rb', line 17

def samples_int(bytes_per_channel)
    self[:mData].get_array_of_int16(0, self[:mDataByteSize]/bytes_per_channel)
end