Module: SFML::SoundRecorder
- Defined in:
- lib/sfml/audio/sound_recorder.rb
Overview
Static helpers for audio capture. Use SFML::SoundBufferRecorder to actually record; these tell you what hardware is available.
SFML::SoundRecorder.available? #=> true / false
SFML::SoundRecorder.devices #=> ["alsa_input.pci-...", ...]
SFML::SoundRecorder.default_device #=> "alsa_input.pci-..."
Class Method Summary collapse
-
.available? ⇒ Boolean
Is at least one audio input device present on the host?.
- .default_device ⇒ Object
-
.devices ⇒ Object
All input devices the OS exposes to SFML, as an Array of String names.
Class Method Details
.available? ⇒ Boolean
Is at least one audio input device present on the host?
12 13 14 |
# File 'lib/sfml/audio/sound_recorder.rb', line 12 def available? C::Audio.sfSoundRecorder_isAvailable end |
.default_device ⇒ Object
16 17 18 |
# File 'lib/sfml/audio/sound_recorder.rb', line 16 def default_device C::Audio.sfSoundRecorder_getDefaultDevice end |
.devices ⇒ Object
All input devices the OS exposes to SFML, as an Array of String names. Pass any of them to SoundBufferRecorder#device= to switch.
22 23 24 25 26 27 28 |
# File 'lib/sfml/audio/sound_recorder.rb', line 22 def devices count_buf = FFI::MemoryPointer.new(:size_t) array_ptr = C::Audio.sfSoundRecorder_getAvailableDevices(count_buf) n = count_buf.read(:size_t) return [] if array_ptr.null? || n.zero? array_ptr.read_array_of_pointer(n).map { |p| p.read_string } end |