Class: FMOD::SoundGroup
- Includes:
- Enumerable, Fiddle
- Defined in:
- lib/fmod/sound_group.rb
Overview
Represents a logical grouping of Sound objects that can be manipulated as one.
Instance Attribute Summary collapse
-
#behavior ⇒ Integer
Determines the way the sound playback behaves when too many sounds are playing in a sound group.
-
#count ⇒ Integer
(also: #size)
readonly
The current number of sounds in this sound group.
-
#fade_speed ⇒ Float
The time in seconds to fade with when #behavior is set to Core::SoundGroupBehavior::MUTE.
-
#max_audible ⇒ Integer
Limits the number of concurrent playbacks of sounds in a sound group to the specified value.
-
#name ⇒ String
readonly
The name of the sound group.
-
#parent ⇒ System
readonly
The parent System object that was used to create this object.
-
#playing_count ⇒ Integer
readonly
E number of currently playing channels for the group.
-
#volume ⇒ Float
The volume for a sound group, affecting all channels playing the sounds in this sound group.
Attributes inherited from Handle
Instance Method Summary collapse
-
#[](index) ⇒ Sound?
(also: #sound)
Retrieves a sound from within a sound group.
-
#each ⇒ Object
Enumerates the sounds contained within the sound group.
-
#stop ⇒ void
Stops all sounds within this sound group.
Methods inherited from Handle
#initialize, #int_ptr, #release, #to_s
Constructor Details
This class inherits a constructor from FMOD::Handle
Instance Attribute Details
#behavior ⇒ Integer
Determines the way the sound playback behaves when too many sounds are playing in a sound group. Muting, failing and stealing behaviors can be specified.
38 |
# File 'lib/fmod/sound_group.rb', line 38 integer_reader(:behavior, :SoundGroup_GetMaxAudibleBehavior) |
#count ⇒ Integer (readonly) Also known as: size
Returns the current number of sounds in this sound group.
68 |
# File 'lib/fmod/sound_group.rb', line 68 integer_reader(:count, :SoundGroup_GetNumSounds) |
#fade_speed ⇒ Float
Returns the time in seconds to fade with when #behavior is set to Core::SoundGroupBehavior::MUTE. By default there is no fade.
57 |
# File 'lib/fmod/sound_group.rb', line 57 float_reader(:fade_speed, :SoundGroup_GetMuteFadeSpeed) |
#max_audible ⇒ Integer
Limits the number of concurrent playbacks of sounds in a sound group to the specified value.
After this, if the sounds in the sound group are playing this many times, any attempts to play more of the sounds in the sound group will by default fail an exception.
Use #behavior to change the way the sound playback behaves when too many sounds are playing. Muting, failing and stealing behaviors can be specified.
27 |
# File 'lib/fmod/sound_group.rb', line 27 integer_reader(:max_audible, :SoundGroup_GetMaxAudible) |
#name ⇒ String (readonly)
Returns the name of the sound group.
75 76 77 78 79 |
# File 'lib/fmod/sound_group.rb', line 75 def name buffer = "\0" * 512 FMOD.invoke(:SoundGroup_GetName, self, buffer, 512) buffer.delete("\0") end |
#parent ⇒ System (readonly)
Returns the parent FMOD::System object that was used to create this object.
118 119 120 121 |
# File 'lib/fmod/sound_group.rb', line 118 def parent FMOD.invoke(:SoundGroup_GetSystemObject, self, system = int_ptr) System.new(system) end |
#playing_count ⇒ Integer (readonly)
Returns e number of currently playing channels for the group.
63 |
# File 'lib/fmod/sound_group.rb', line 63 integer_reader(:playing_count, :SoundGroup_GetNumPlaying) |
#volume ⇒ Float
The volume for a sound group, affecting all channels playing the sounds in this sound group.
0.0 is silent, 1.0 is full volume, though negative values and amplification are supported.
50 |
# File 'lib/fmod/sound_group.rb', line 50 float_reader(:volume, :SoundGroup_GetVolume) |
Instance Method Details
#[](index) ⇒ Sound? Also known as: sound
Retrieves a sound from within a sound group.
106 107 108 109 110 |
# File 'lib/fmod/sound_group.rb', line 106 def [](index) return nil unless FMOD.valid_range?(0, 0, count - 1, false) FMOD.invoke(:SoundGroup_GetSound, self, index, sound = int_ptr) Sound.new(sound) end |
#each {|sound| ... } ⇒ self #each ⇒ Enumerator
Enumerates the sounds contained within the sound group.
93 94 95 96 97 |
# File 'lib/fmod/sound_group.rb', line 93 def each return to_enum(:each) unless block_given? (0...count).each { |i| yield self[i] } self end |