Class: CoreAudio::AudioStreamBasicDescription

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

CoreAudioTypes.h collapse

FormatFlagIsFloat =
(1 << 0)
FormatFlagIsSignedInteger =
(1 << 2)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#channel_widthInteger

Returns the number of bits per channel.

Returns:

  • (Integer)

    the number of bits per channel



31
32
33
34
35
# File 'lib/macos/core_audio/audio_stream.rb', line 31

def channel_width=(bits)
    self[:mBitsPerChannel] = bits
    self[:mBytesPerFrame] = self[:mChannelsPerFrame] * bits / 8
    self[:mBytesPerPacket] = self[:mBytesPerFrame] * self[:mFramesPerPacket]
end

#channelsObject



20
21
22
# File 'lib/macos/core_audio/audio_stream.rb', line 20

def channels
    self[:mChannelsPerFrame]
end

#float?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/macos/core_audio/audio_stream.rb', line 39

def float?
    (self[:mFormatFlags] & FormatFlagIsFloat) != 0
end

#sample_rateObject



50
# File 'lib/macos/core_audio/audio_stream.rb', line 50

def sample_rate;    self[:mSampleRate];	end

Instance Method Details

#integerObject



43
44
45
46
# File 'lib/macos/core_audio/audio_stream.rb', line 43

def integer
    self[:mFormatFlags] &= ~FormatFlagIsFloat
    self[:mFormatFlags] |= FormatFlagIsSignedInteger
end