Class: FMOD::Core::Driver

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

Overview

Identification information about a sound device.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Driver

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Driver.

Parameters:

  • args (Array)

    Array of binary data.



43
44
45
46
47
48
49
50
# File 'lib/fmod/core/driver.rb', line 43

def initialize(args)
  @id = args.shift
  # noinspection RubyResolve
  @name = args.shift.delete("\0").force_encoding(Encoding::UTF_8)
  args.shift
  @guid = args.shift
  @rate, @speaker_mode, @channels, @state = args.join.unpack('l*')
end

Instance Attribute Details

#channelsInteger (readonly)

Returns the number of channels in the current speaker setup.

Returns:

  • (Integer)

    the number of channels in the current speaker setup.



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

def channels
  @channels
end

#guidGuid (readonly)

Returns the GUID that uniquely identifies the device.

Returns:

  • (Guid)

    the GUID that uniquely identifies the device.



20
21
22
# File 'lib/fmod/core/driver.rb', line 20

def guid
  @guid
end

#idInteger (readonly)

Returns the enumerated driver ID.

Returns:

  • (Integer)

    the enumerated driver ID.



12
13
14
# File 'lib/fmod/core/driver.rb', line 12

def id
  @id
end

#nameString (readonly)

Returns the name of the device encoded in a UTF-8 string.

Returns:

  • (String)

    the name of the device encoded in a UTF-8 string.



16
17
18
# File 'lib/fmod/core/driver.rb', line 16

def name
  @name
end

#rateInteger (readonly)

Returns the sample rate this device operates at.

Returns:

  • (Integer)

    the sample rate this device operates at.



24
25
26
# File 'lib/fmod/core/driver.rb', line 24

def rate
  @rate
end

#speaker_modeInteger (readonly)

Returns the speaker setup this device is currently using.

Returns:

  • (Integer)

    the speaker setup this device is currently using.

See Also:



29
30
31
# File 'lib/fmod/core/driver.rb', line 29

def speaker_mode
  @speaker_mode
end

#stateInteger (readonly)

Returns flags that provide additional information about the driver.

Returns:

  • (Integer)

    flags that provide additional information about the driver.



38
39
40
# File 'lib/fmod/core/driver.rb', line 38

def state
  @state
end

Instance Method Details

#record_driver?Boolean

Returns true if this a record driver, otherwise false.

Returns:

  • (Boolean)

    true if this a record driver, otherwise false.



54
55
56
# File 'lib/fmod/core/driver.rb', line 54

def record_driver?
  !@state.nil?
end