Class: SFML::SoundSourceCone
- Inherits:
-
Object
- Object
- SFML::SoundSourceCone
- Defined in:
- ext/audio/sound_source_cone.c,
ext/audio/sound_source_cone.c
Overview
A directional attenuation cone for a SoundSource (SoundSource#cone) or the
Listener (Listener.cone): within inner_angle degrees of the facing
direction the source is heard at full volume; beyond outer_angle
degrees it is heard at outer_gain volume, with a smooth transition in
between.
Instance Attribute Summary collapse
-
#inner_angle ⇒ Float
Returns the inner cone angle in degrees.
-
#outer_angle ⇒ Float
Returns the outer cone angle in degrees.
-
#outer_gain ⇒ Float
Returns the gain applied outside the outer cone.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Returns
trueifotheris a cone with the same angles and gain. -
#new(inner_angle, outer_angle, outer_gain) ⇒ SoundSourceCone
constructor
Creates a directional attenuation cone with the given angles and gain.
-
#to_a ⇒ Array, Float
Returns the cone's three components as an Array.
Constructor Details
#new(inner_angle, outer_angle, outer_gain) ⇒ SoundSourceCone
Creates a directional attenuation cone with the given angles and gain.
51 52 53 54 55 56 57 58 59 |
# File 'ext/audio/sound_source_cone.c', line 51
static VALUE SoundSourceCone_initialize(VALUE self, VALUE rb_inner, VALUE rb_outer, VALUE rb_gain) {
sfSoundSourceCone cone = {.innerAngle = (float)NUM2DBL(rb_inner),
.outerAngle = (float)NUM2DBL(rb_outer),
.outerGain = (float)NUM2DBL(rb_gain)};
((SoundSourceCone*)Get_SoundSourceCone_Struct(self))->cone = cone;
return self;
}
|
Instance Attribute Details
#inner_angle ⇒ Float
Returns the inner cone angle in degrees.
165 166 167 |
# File 'ext/audio/sound_source_cone.c', line 165
static VALUE SoundSourceCone_get_inner_angle(VALUE self) {
return DBL2NUM(((SoundSourceCone*)Get_SoundSourceCone_Struct(self))->cone.innerAngle);
}
|
#outer_angle ⇒ Float
Returns the outer cone angle in degrees.
165 166 167 |
# File 'ext/audio/sound_source_cone.c', line 165
static VALUE SoundSourceCone_get_outer_angle(VALUE self) {
return DBL2NUM(((SoundSourceCone*)Get_SoundSourceCone_Struct(self))->cone.outerAngle);
}
|
#outer_gain ⇒ Float
Returns the gain applied outside the outer cone.
165 166 167 |
# File 'ext/audio/sound_source_cone.c', line 165
static VALUE SoundSourceCone_get_outer_gain(VALUE self) {
return DBL2NUM(((SoundSourceCone*)Get_SoundSourceCone_Struct(self))->cone.outerGain);
}
|
Instance Method Details
#==(other) ⇒ Boolean
Returns true if other is a cone with the same angles and gain.
151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'ext/audio/sound_source_cone.c', line 151
static VALUE SoundSourceCone_eql(VALUE self, VALUE rb_other) {
sfSoundSourceCone a = ((SoundSourceCone*)Get_SoundSourceCone_Struct(self))->cone;
sfSoundSourceCone b;
if (!rb_obj_is_kind_of(rb_other, rb_cSoundSourceCone)) {
return Qfalse;
}
b = ((SoundSourceCone*)Get_SoundSourceCone_Struct(rb_other))->cone;
return BOOL2RB(a.innerAngle == b.innerAngle && a.outerAngle == b.outerAngle &&
a.outerGain == b.outerGain);
}
|
#to_a ⇒ Array, Float
Returns the cone's three components as an Array.
137 138 139 140 141 142 |
# File 'ext/audio/sound_source_cone.c', line 137
static VALUE SoundSourceCone_to_a(VALUE self) {
sfSoundSourceCone cone = ((SoundSourceCone*)Get_SoundSourceCone_Struct(self))->cone;
return rb_ary_new_from_args(3, DBL2NUM(cone.innerAngle), DBL2NUM(cone.outerAngle),
DBL2NUM(cone.outerGain));
}
|