Class: ALSA::PCM::SwParameters
- Inherits:
-
Object
- Object
- ALSA::PCM::SwParameters
- Defined in:
- lib/alsa/pcm/sw_parameters.rb
Instance Attribute Summary collapse
-
#device ⇒ Object
Returns the value of attribute device.
-
#handle ⇒ Object
Returns the value of attribute handle.
Instance Method Summary collapse
- #avail_min ⇒ Object (also: #available_minimum)
- #avail_min=(avail_min) ⇒ Object (also: #available_minimum=)
- #current_for_device ⇒ Object
- #free ⇒ Object
-
#initialize(device = nil) ⇒ SwParameters
constructor
A new instance of SwParameters.
- #update_attributes(attributes) ⇒ Object
Constructor Details
#initialize(device = nil) ⇒ SwParameters
Returns a new instance of SwParameters.
6 7 8 9 10 11 12 13 |
# File 'lib/alsa/pcm/sw_parameters.rb', line 6 def initialize(device = nil) sw_params_pointer = FFI::MemoryPointer.new :pointer ALSA::PCM::Native::sw_params_malloc sw_params_pointer self.handle = sw_params_pointer.read_pointer self.device = device if device end |
Instance Attribute Details
#device ⇒ Object
Returns the value of attribute device.
4 5 6 |
# File 'lib/alsa/pcm/sw_parameters.rb', line 4 def device @device end |
#handle ⇒ Object
Returns the value of attribute handle.
4 5 6 |
# File 'lib/alsa/pcm/sw_parameters.rb', line 4 def handle @handle end |
Instance Method Details
#avail_min ⇒ Object Also known as: available_minimum
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/alsa/pcm/sw_parameters.rb', line 33 def avail_min value = nil ALSA::try_to "get period time" do value_pointer = FFI::MemoryPointer.new(:int) error_code = ALSA::PCM::Native::sw_params_get_avail_min self.handle, value_pointer value = value_pointer.read_int value_pointer.free error_code end value end |
#avail_min=(avail_min) ⇒ Object Also known as: available_minimum=
26 27 28 29 30 |
# File 'lib/alsa/pcm/sw_parameters.rb', line 26 def avail_min=(avail_min) ALSA::try_to "set avail_min (#{avail_min})" do ALSA::PCM::Native::sw_params_set_avail_min self.device.handle, self.handle, avail_min end end |
#current_for_device ⇒ Object
19 20 21 22 23 24 |
# File 'lib/alsa/pcm/sw_parameters.rb', line 19 def current_for_device ALSA::try_to "retrieve current hardware parameters" do ALSA::PCM::Native::sw_params_current device.handle, self.handle end self end |
#free ⇒ Object
46 47 48 49 50 |
# File 'lib/alsa/pcm/sw_parameters.rb', line 46 def free ALSA::try_to "unallocate sw_params" do ALSA::PCM::Native::sw_params_free self.handle end end |
#update_attributes(attributes) ⇒ Object
15 16 17 |
# File 'lib/alsa/pcm/sw_parameters.rb', line 15 def update_attributes(attributes) attributes.each_pair { |name, value| send("#{name}=", value) } end |