Module: RbSDL2::Audio::AudioFormat

Included in:
RbSDL2::Audio, AudioBuffer, AudioDevice
Defined in:
lib/rb_sdl2/audio/audio_format.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.to_num(signed: true, big_endian: false, bit_size: 16, float: false) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/rb_sdl2/audio/audio_format.rb', line 5

def to_num(signed: true, big_endian: false, bit_size: 16, float: false)
  num = 0 |
    (big_endian ? ::SDL2::SDL_AUDIO_MASK_ENDIAN : 0) |
    (bit_size & ::SDL2::SDL_AUDIO_MASK_BITSIZE) |
    (signed ? ::SDL2::SDL_AUDIO_MASK_SIGNED : 0)
  num | (float ? ::SDL2::SDL_AUDIO_MASK_DATATYPE & ::SDL2::SDL_AUDIO_MASK_SIGNED : 0)
end

Instance Method Details

#big_endian?Boolean

Returns:

  • (Boolean)


14
# File 'lib/rb_sdl2/audio/audio_format.rb', line 14

def big_endian? = ::SDL2::SDL_AUDIO_MASK_ENDIAN & format != 0

#bit_sizeObject



16
# File 'lib/rb_sdl2/audio/audio_format.rb', line 16

def bit_size = ::SDL2::SDL_AUDIO_MASK_BITSIZE & format

#float?Boolean

Returns:

  • (Boolean)


18
# File 'lib/rb_sdl2/audio/audio_format.rb', line 18

def float? = ::SDL2::SDL_AUDIO_MASK_DATATYPE & format != 0

#signed?Boolean

Returns:

  • (Boolean)


20
# File 'lib/rb_sdl2/audio/audio_format.rb', line 20

def signed? = ::SDL2::SDL_AUDIO_MASK_SIGNED & format != 0