Class: FMOD::ChannelGroup
- Inherits:
-
ChannelControl
- Object
- Fiddle::Pointer
- Handle
- ChannelControl
- FMOD::ChannelGroup
- Includes:
- Enumerable, Fiddle
- Defined in:
- lib/fmod/channel_group.rb
Overview
Represents a logical grouping of Channel and/or ChannelGroup objects that can be manipulated as one.
Instance Attribute Summary collapse
-
#channel_count ⇒ Integer
readonly
The number of assigned channels to this channel group.
-
#parent_group ⇒ ChannelGroup?
readonly
The channel group parent.
-
#subgroup_count ⇒ Integer
readonly
The number of sub groups under this channel group.
Attributes inherited from ChannelControl
#audibility, #cone_orientation, #cone_settings, #custom_rolloff, #delay, #direct_occlusion, #distance_filter, #doppler3D, #dsps, #level3D, #low_pass_gain, #matrix, #max_distance, #min_distance, #mode, #parent, #pitch, #position3D, #reverb_occlusion, #spread3D, #velocity3D, #volume, #volume_ramp
Attributes inherited from Handle
Instance Method Summary collapse
-
#<<(channel_control) ⇒ self, DspConnection
Adds a Channel or a ChannelGroup as a child of this group.
-
#[](index) ⇒ Channel?
(also: #channel)
Retrieves the Channel within this group at the specified index.
-
#add_channel(channel) ⇒ self
Adds a channel as a child of the this group.
-
#add_group(group, propagate_clock = true) ⇒ DspConnection
Adds a channel group as a child of the current channel group.
-
#each ⇒ Object
Enumerates the channels contained within the ChannelGroup.
-
#name ⇒ String
The name of the channel group set when the group was created.
-
#subgroup(index) ⇒ ChannelGroup?
Retrieves the sub-group at the specified index.
Methods inherited from ChannelControl
#add_fade, #dsp_clock, #fade_point_count, #fade_points, #fade_ramp, #get_reverb_level, #initialize, #input_mix, #min_max_distance, #mute, #muted?, #on_occlusion, #on_stop, #on_sync_point, #on_voice_swap, #output_mix, #pan, #parent_clock, #pause, #paused?, #playing?, #remove_fade_points, #resume, #set_cone, #set_delay, #set_reverb_level, #stop, #unmute
Methods inherited from Handle
#initialize, #int_ptr, #release, #to_s
Constructor Details
This class inherits a constructor from FMOD::ChannelControl
Instance Attribute Details
#channel_count ⇒ Integer (readonly)
Returns the number of assigned channels to this channel group.
17 |
# File 'lib/fmod/channel_group.rb', line 17 integer_reader(:channel_count, :ChannelGroup_GetNumChannels) |
#parent_group ⇒ ChannelGroup? (readonly)
Returns the channel group parent.
43 44 45 46 |
# File 'lib/fmod/channel_group.rb', line 43 def parent_group FMOD.invoke(:ChannelGroup_GetParentGroup, self, group = int_ptr) group.null? ? nil : ChannelGroup.new(group) end |
#subgroup_count ⇒ Integer (readonly)
Returns the number of sub groups under this channel group.
13 |
# File 'lib/fmod/channel_group.rb', line 13 integer_reader(:subgroup_count, :ChannelGroup_GetNumGroups) |
Instance Method Details
#<<(channel_control) ⇒ self, DspConnection
Adds a FMOD::Channel or a FMOD::ChannelGroup as a child of this group.
87 88 89 90 91 |
# File 'lib/fmod/channel_group.rb', line 87 def <<(channel_control) return add_channel(channel_control) if channel_control.is_a?(Channel) return add_group(channel_control) if channel_control.is_a?(ChannelGroup) raise TypeError, "#{channel_control} is not a #{ChannelControl}." end |
#[](index) ⇒ Channel? Also known as: channel
Retrieves the FMOD::Channel within this group at the specified index.
55 56 57 58 59 |
# File 'lib/fmod/channel_group.rb', line 55 def [](index) return nil unless FMOD.valid_range?(index, 0, channel_count - 1, false) FMOD.invoke(:ChannelGroup_GetChannel, self, index, channel = int_ptr) Channel.new(channel) end |
#add_channel(channel) ⇒ self
Adds a channel as a child of the this group. This detaches the channel from any group it may already be attached to.
100 101 102 103 104 |
# File 'lib/fmod/channel_group.rb', line 100 def add_channel(channel) FMOD.type?(channel, Channel) channel.group = self self end |
#add_group(group, propagate_clock = true) ⇒ DspConnection
Adds a channel group as a child of the current channel group.
116 117 118 119 120 121 |
# File 'lib/fmod/channel_group.rb', line 116 def add_group(group, propagate_clock = true) FMOD.type?(group, ChannelGroup) FMOD.invoke(:ChannelGroup_AddGroup, self, group, propagate_clock.to_i, connection = int_ptr) DspConnection.new(connection) end |
#each {|channel| ... } ⇒ self #each ⇒ Enumerator
Enumerates the channels contained within the FMOD::ChannelGroup.
73 74 75 76 77 |
# File 'lib/fmod/channel_group.rb', line 73 def each return to_enum(:each) unless block_given? (0...channel_count).each { |i| yield self[i] } self end |
#name ⇒ String
Returns the name of the channel group set when the group was created.
22 23 24 25 26 |
# File 'lib/fmod/channel_group.rb', line 22 def name buffer = "\0" * 512 FMOD.invoke(:ChannelGroup_GetName, self, buffer, 512) buffer.delete("\0") end |
#subgroup(index) ⇒ ChannelGroup?
Retrieves the sub-group at the specified index.
34 35 36 37 38 |
# File 'lib/fmod/channel_group.rb', line 34 def subgroup(index) return nil unless FMOD.valid_range?(index, 0, subgroup_count - 1, false) FMOD.invoke(:ChannelGroup_GetGroup, self, index, group = int_ptr) ChannelGroup.new(group) end |