Class: FMOD::Core::ParameterInfo

Inherits:
Structure
  • Object
show all
Includes:
Fiddle
Defined in:
lib/fmod/core/parameter_info.rb

Overview

Base Structure for DSP parameter descriptions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Structure

#inspect, #names, #values

Constructor Details

#initialize(address = nil) ⇒ ParameterInfo

Returns a new instance of ParameterInfo.

Parameters:

  • address (Pointer, Integer, String, nil) (defaults to: nil)

    The address in memory where the structure will be created from. If no address is given, new memory will be allocated.



14
15
16
17
18
# File 'lib/fmod/core/parameter_info.rb', line 14

def initialize(address = nil)
  types = [TYPE_INT, [TYPE_CHAR, 16], [TYPE_CHAR, 16], TYPE_VOIDP, TYPE_VOIDP]
  members = [:type, :name, :label, :description, :info]
  super(address, types, members)
end

Instance Attribute Details

#descriptionString (readonly)

Returns the description of the parameter to be displayed as a help item / tooltip for this parameter.

Returns:

  • (String)

    the description of the parameter to be displayed as a help item / tooltip for this parameter.



51
52
53
# File 'lib/fmod/core/parameter_info.rb', line 51

def description
  self[:description].to_s
end

#labelString (readonly)

Returns a string to be put next to value to denote the unit type (ie “Hz”).

Returns:

  • (String)

    a string to be put next to value to denote the unit type (ie “Hz”).



43
44
45
# File 'lib/fmod/core/parameter_info.rb', line 43

def label
  (self + SIZEOF_INT + 16).to_s(16).delete("\0")
end

#nameString (readonly)

Returns the of the parameter to be displayed (ie “Cutoff frequency”).

Returns:

  • (String)

    the of the parameter to be displayed (ie “Cutoff frequency”).



34
35
36
# File 'lib/fmod/core/parameter_info.rb', line 34

def name
  (self + SIZEOF_INT).to_s(16).delete("\0").force_encoding('UTF-8')
end

#typeInteger (readonly)

Returns the type of this parameter. @see ParameterType.

Returns:

  • (Integer)

    the type of this parameter. @see ParameterType



25
26
27
# File 'lib/fmod/core/parameter_info.rb', line 25

def type
  self[:type]
end

Instance Method Details

#infoFloatDescription, ...

Returns:



65
66
67
68
69
70
71
72
73
74
# File 'lib/fmod/core/parameter_info.rb', line 65

def info
  pointer = self + SIZEOF_INT + (SIZEOF_CHAR * 32) + SIZEOF_INTPTR_T
  case self[:type]
  when ParameterType::FLOAT then FloatDescription.new(pointer)
  when ParameterType::INT then IntegerDescription.new(pointer)
  when ParameterType::BOOL then BoolDescription.new(pointer)
  when ParameterType::DATA then DataDescription.new(pointer)
  else raise RangeError, "Invalid data type for parameter."
  end
end