Module: AudioToolbox
- Extended by:
- FFI::Library
- Defined in:
- lib/macos/audio_toolbox.rb,
lib/macos/audio_toolbox/audio_converter.rb
Defined Under Namespace
Classes: AudioConverterRef
Constant Summary collapse
- OSStatus =
CoreFoundation::OSStatus
- AudioStreamBasicDescription =
CoreAudio::AudioStreamBasicDescription
Class Method Summary collapse
-
.converter(from, to) ⇒ AudioConverterRef
Create a new AudioConverter that convertes between the given stream formats.
Class Method Details
.converter(from, to) ⇒ AudioConverterRef
Create a new AudioConverter that convertes between the given stream formats
46 47 48 49 50 51 52 53 54 |
# File 'lib/macos/audio_toolbox.rb', line 46 def self.converter(from, to) reference = FFI::MemoryPointer.new(AudioConverterRef) status = AudioToolbox.AudioConverterNew(from, to, reference) raise "No converter '#{[status].pack('L').reverse}'" unless status.zero? AudioConverterRef.new(reference.get_pointer(0)).tap do |converter| converter.from = from converter.to = to end end |