Module: SFML::Listener
- Defined in:
- ext/audio/listener.c,
ext/audio/listener.c
Overview
Module functions controlling the single global audio listener: its position, orientation and volume, against which every SoundSource's spatialization is computed.
Class Method Summary collapse
-
.cone ⇒ SoundSourceCone
Returns the listener's directional attenuation cone.
-
.cone=(value) ⇒ SoundSourceCone
Sets the listener's directional attenuation cone.
-
.direction ⇒ Vector3
Returns the direction the listener is facing, used for spatialization.
-
.direction=(value) ⇒ Vector3
Sets the direction the listener is facing.
-
.global_volume ⇒ Float
Returns the global volume applied to every sound source in the scene.
-
.global_volume=(value) ⇒ Float
Sets the global volume all sound sources are scaled by.
-
.position ⇒ Vector3
Returns the listener's position in the 3D audio scene.
-
.position=(value) ⇒ Vector3
Sets the listener's position in the 3D audio scene.
-
.up_vector ⇒ Vector3
Returns the listener's up vector, defining its vertical orientation.
-
.up_vector=(value) ⇒ Vector3
Sets the listener's up vector, defining its vertical orientation.
-
.velocity ⇒ Vector3
Returns the listener's velocity, used for Doppler calculations.
-
.velocity=(value) ⇒ Vector3
Sets the listener's velocity for Doppler calculations.
Class Method Details
.cone ⇒ SoundSourceCone
Returns the listener's directional attenuation cone.
124 125 126 127 128 129 |
# File 'ext/audio/listener.c', line 124
static VALUE Listener_cone(VALUE module) {
sfListenerCone cone = sfListener_getCone();
return sound_source_cone_to_rb(
(sfSoundSourceCone){cone.innerAngle, cone.outerAngle, cone.outerGain});
}
|
.cone=(value) ⇒ SoundSourceCone
Sets the listener's directional attenuation cone.
138 139 140 141 142 143 144 |
# File 'ext/audio/listener.c', line 138
static VALUE Listener_set_cone(VALUE module, VALUE rb_value) {
sfSoundSourceCone cone = sound_source_cone_from_rb(rb_value);
sfListener_setCone((sfListenerCone){cone.innerAngle, cone.outerAngle, cone.outerGain});
return rb_value;
}
|
.direction ⇒ Vector3
Returns the direction the listener is facing, used for spatialization.
58 59 60 |
# File 'ext/audio/listener.c', line 58
static VALUE Listener_direction(VALUE module) {
return vec3f_to_rb(sfListener_getDirection());
}
|
.direction=(value) ⇒ Vector3
Sets the direction the listener is facing.
69 70 71 72 |
# File 'ext/audio/listener.c', line 69
static VALUE Listener_set_direction(VALUE module, VALUE rb_value) {
sfListener_setDirection(vec3f_from_rb(rb_value));
return rb_value;
}
|
.global_volume ⇒ Float
Returns the global volume applied to every sound source in the scene.
14 15 16 |
# File 'ext/audio/listener.c', line 14
static VALUE Listener_global_volume(VALUE module) {
return DBL2NUM(sfListener_getGlobalVolume());
}
|
.global_volume=(value) ⇒ Float
Sets the global volume all sound sources are scaled by.
25 26 27 28 |
# File 'ext/audio/listener.c', line 25
static VALUE Listener_set_global_volume(VALUE module, VALUE rb_value) {
sfListener_setGlobalVolume((float)NUM2DBL(rb_value));
return rb_value;
}
|
.position ⇒ Vector3
Returns the listener's position in the 3D audio scene.
36 37 38 |
# File 'ext/audio/listener.c', line 36
static VALUE Listener_position(VALUE module) {
return vec3f_to_rb(sfListener_getPosition());
}
|
.position=(value) ⇒ Vector3
Sets the listener's position in the 3D audio scene.
47 48 49 50 |
# File 'ext/audio/listener.c', line 47
static VALUE Listener_set_position(VALUE module, VALUE rb_value) {
sfListener_setPosition(vec3f_from_rb(rb_value));
return rb_value;
}
|
.up_vector ⇒ Vector3
Returns the listener's up vector, defining its vertical orientation.
102 103 104 |
# File 'ext/audio/listener.c', line 102
static VALUE Listener_up_vector(VALUE module) {
return vec3f_to_rb(sfListener_getUpVector());
}
|
.up_vector=(value) ⇒ Vector3
Sets the listener's up vector, defining its vertical orientation.
113 114 115 116 |
# File 'ext/audio/listener.c', line 113
static VALUE Listener_set_up_vector(VALUE module, VALUE rb_value) {
sfListener_setUpVector(vec3f_from_rb(rb_value));
return rb_value;
}
|
.velocity ⇒ Vector3
Returns the listener's velocity, used for Doppler calculations.
80 81 82 |
# File 'ext/audio/listener.c', line 80
static VALUE Listener_velocity(VALUE module) {
return vec3f_to_rb(sfListener_getVelocity());
}
|
.velocity=(value) ⇒ Vector3
Sets the listener's velocity for Doppler calculations.
91 92 93 94 |
# File 'ext/audio/listener.c', line 91
static VALUE Listener_set_velocity(VALUE module, VALUE rb_value) {
sfListener_setVelocity(vec3f_from_rb(rb_value));
return rb_value;
}
|