Class: FMOD::Core::IntegerDescription

Inherits:
Structure
  • Object
show all
Defined in:
lib/fmod/core/integer_description.rb

Overview

Structure describing a integer parameter for a DSP unit.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Structure

#inspect, #names, #values

Constructor Details

#initialize(address = nil) ⇒ IntegerDescription

Returns a new instance of IntegerDescription.

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.



12
13
14
15
16
# File 'lib/fmod/core/integer_description.rb', line 12

def initialize(address = nil)
  types = [TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_VOIDP]
  members = [:min, :max, :default, :infinite, :names]
  super(address, types, members)
end

Instance Attribute Details

#defaultInteger

Returns the default parameter value.

Returns:

  • (Integer)

    the default parameter value.



27
28
29
# File 'lib/fmod/core/integer_description.rb', line 27

[:min, :max, :default].each do |symbol|
  define_method(symbol) { self[symbol] }
end

#maxInteger

Returns the maximum parameter value.

Returns:

  • (Integer)

    the maximum parameter value.



# File 'lib/fmod/core/integer_description.rb', line 21

#minInteger

Returns the minimum parameter value.

Returns:

  • (Integer)

    the minimum parameter value.



# File 'lib/fmod/core/integer_description.rb', line 18

Instance Method Details

#infinite?Boolean

Returns flag indicating if the last value represents infinity.

Returns:

  • (Boolean)

    flag indicating if the last value represents infinity.



33
34
35
# File 'lib/fmod/core/integer_description.rb', line 33

def infinite?
  self[:infinite] != 0
end

#value_namesArray<String>

Returns the names for each value.

Returns:

  • (Array<String>)

    the names for each value.



39
40
41
42
43
# File 'lib/fmod/core/integer_description.rb', line 39

def value_names
  return [] if self[:names].null?
  count = max - min + 1
  (0...count).map { |i| (self[:names] + (i * SIZEOF_INTPTR_T)).ptr.to_s }
end