Class: Awaaz::Extensions::Samplerate::SRC_DATA

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/awaaz/extensions/samplerate.rb

Overview

Structure representing the parameters for a sample rate conversion operation.

Mirrors the C struct SRC_DATA from libsamplerate.

Instance Attribute Summary collapse

Instance Attribute Details

#data_in ⇒ FFI::Pointer

Returns Pointer to the input audio buffer.

Returns:

  • (FFI::Pointer) —

    Pointer to the input audio buffer.



43
44
45
46
47
48
49
50
51
52
# File 'lib/awaaz/extensions/samplerate.rb', line 43

class SRC_DATA < FFI::Struct
  layout :data_in, :pointer,
         :data_out, :pointer,
         :input_frames,      :long,
         :output_frames,     :long,
         :input_frames_used, :long,
         :output_frames_gen, :long,
         :end_of_input,      :int,
         :src_ratio,         :double
end

#data_out ⇒ FFI::Pointer

Returns Pointer to the output audio buffer.

Returns:

  • (FFI::Pointer) —

    Pointer to the output audio buffer.



43
44
45
46
47
48
49
50
51
52
# File 'lib/awaaz/extensions/samplerate.rb', line 43

class SRC_DATA < FFI::Struct
  layout :data_in, :pointer,
         :data_out, :pointer,
         :input_frames,      :long,
         :output_frames,     :long,
         :input_frames_used, :long,
         :output_frames_gen, :long,
         :end_of_input,      :int,
         :src_ratio,         :double
end

#end_of_input ⇒ Integer

Returns Flag (0 or 1) indicating whether this is the last block of input data.

Returns:

  • (Integer) —

    Flag (0 or 1) indicating whether this is the last block of input data.



43
44
45
46
47
48
49
50
51
52
# File 'lib/awaaz/extensions/samplerate.rb', line 43

class SRC_DATA < FFI::Struct
  layout :data_in, :pointer,
         :data_out, :pointer,
         :input_frames,      :long,
         :output_frames,     :long,
         :input_frames_used, :long,
         :output_frames_gen, :long,
         :end_of_input,      :int,
         :src_ratio,         :double
end

#input_frames ⇒ Integer

Returns Number of input frames.

Returns:

  • (Integer) —

    Number of input frames.



43
44
45
46
47
48
49
50
51
52
# File 'lib/awaaz/extensions/samplerate.rb', line 43

class SRC_DATA < FFI::Struct
  layout :data_in, :pointer,
         :data_out, :pointer,
         :input_frames,      :long,
         :output_frames,     :long,
         :input_frames_used, :long,
         :output_frames_gen, :long,
         :end_of_input,      :int,
         :src_ratio,         :double
end

#input_frames_used ⇒ Integer

Returns Number of input frames actually used.

Returns:

  • (Integer) —

    Number of input frames actually used.



43
44
45
46
47
48
49
50
51
52
# File 'lib/awaaz/extensions/samplerate.rb', line 43

class SRC_DATA < FFI::Struct
  layout :data_in, :pointer,
         :data_out, :pointer,
         :input_frames,      :long,
         :output_frames,     :long,
         :input_frames_used, :long,
         :output_frames_gen, :long,
         :end_of_input,      :int,
         :src_ratio,         :double
end

#output_frames ⇒ Integer

Returns Number of output frames allocated.

Returns:

  • (Integer) —

    Number of output frames allocated.



43
44
45
46
47
48
49
50
51
52
# File 'lib/awaaz/extensions/samplerate.rb', line 43

class SRC_DATA < FFI::Struct
  layout :data_in, :pointer,
         :data_out, :pointer,
         :input_frames,      :long,
         :output_frames,     :long,
         :input_frames_used, :long,
         :output_frames_gen, :long,
         :end_of_input,      :int,
         :src_ratio,         :double
end

#output_frames_gen ⇒ Integer

Returns Number of output frames generated.

Returns:

  • (Integer) —

    Number of output frames generated.



43
44
45
46
47
48
49
50
51
52
# File 'lib/awaaz/extensions/samplerate.rb', line 43

class SRC_DATA < FFI::Struct
  layout :data_in, :pointer,
         :data_out, :pointer,
         :input_frames,      :long,
         :output_frames,     :long,
         :input_frames_used, :long,
         :output_frames_gen, :long,
         :end_of_input,      :int,
         :src_ratio,         :double
end

#src_ratio ⇒ Float

Returns Conversion ratio (output_sample_rate / input_sample_rate).

Returns:

  • (Float) —

    Conversion ratio (output_sample_rate / input_sample_rate).



43
44
45
46
47
48
49
50
51
52
# File 'lib/awaaz/extensions/samplerate.rb', line 43

class SRC_DATA < FFI::Struct
  layout :data_in, :pointer,
         :data_out, :pointer,
         :input_frames,      :long,
         :output_frames,     :long,
         :input_frames_used, :long,
         :output_frames_gen, :long,
         :end_of_input,      :int,
         :src_ratio,         :double
end