Class: Awaaz::Extensions::Soundfile::SF_INFO

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

Overview

Structure containing metadata about an audio file.

Mirrors the C struct ‘SF_INFO` from libsndfile.

Instance Attribute Summary collapse

Instance Attribute Details

#channelsInteger

Returns Number of audio channels.

Returns:

  • (Integer)

    Number of audio channels.



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

class SF_INFO < FFI::Struct
  layout :frames, :long_long,
         :samplerate, :int,
         :channels,   :int,
         :format,     :int,
         :sections,   :int,
         :seekable,   :int
end

#formatInteger

Returns Format identifier of the audio file.

Returns:

  • (Integer)

    Format identifier of the audio file.



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

class SF_INFO < FFI::Struct
  layout :frames, :long_long,
         :samplerate, :int,
         :channels,   :int,
         :format,     :int,
         :sections,   :int,
         :seekable,   :int
end

#framesInteger

Returns Total number of frames in the file.

Returns:

  • (Integer)

    Total number of frames in the file.



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

class SF_INFO < FFI::Struct
  layout :frames, :long_long,
         :samplerate, :int,
         :channels,   :int,
         :format,     :int,
         :sections,   :int,
         :seekable,   :int
end

#samplerateInteger

Returns Sample rate of the audio file (Hz).

Returns:

  • (Integer)

    Sample rate of the audio file (Hz).



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

class SF_INFO < FFI::Struct
  layout :frames, :long_long,
         :samplerate, :int,
         :channels,   :int,
         :format,     :int,
         :sections,   :int,
         :seekable,   :int
end

#sectionsInteger

Returns Number of sections in the file.

Returns:

  • (Integer)

    Number of sections in the file.



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

class SF_INFO < FFI::Struct
  layout :frames, :long_long,
         :samplerate, :int,
         :channels,   :int,
         :format,     :int,
         :sections,   :int,
         :seekable,   :int
end

#seekableInteger

Returns Whether the file is seekable (1) or not (0).

Returns:

  • (Integer)

    Whether the file is seekable (1) or not (0).



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

class SF_INFO < FFI::Struct
  layout :frames, :long_long,
         :samplerate, :int,
         :channels,   :int,
         :format,     :int,
         :sections,   :int,
         :seekable,   :int
end