Class: Ray::AudioSource
- Inherits:
-
Object
- Object
- Ray::AudioSource
- Includes:
- PP
- Defined in:
- ext/audio_source.c,
lib/ray/audio_source.rb,
ext/audio_source.c
Overview
Audio sources are objects able to produce sound, either by directly passing them to a buffer or by streaming audio data.
This class holds generic methods to manipulate a source.
Instance Method Summary collapse
- #attenuation ⇒ Object
-
#attenuation=(attenuation) ⇒ Object
Sets the attenuation of a sound.
- #min_distance ⇒ Object
-
#min_distance=(dist) ⇒ Object
Sets the sounds minimal distance.
- #pitch ⇒ Object
-
#pitch=(pitch) ⇒ Object
Sets the pitch of the sound.
- #pos ⇒ Object
-
#pos=(pos) ⇒ Object
Sets the position of the sound.
- #pretty_print(q, other_attr = []) ⇒ Object
-
#relative=(rel) ⇒ Object
Sets whether the sound position is relative to the listener’s.
- #relative? ⇒ Boolean
-
#status ⇒ Symbol
Playing status.
- #volume ⇒ Object
-
#volume=(vol) ⇒ Object
Sets the volume of the source.
Methods included from PP
Instance Method Details
#attenuation ⇒ Object
146 147 148 149 150 |
# File 'ext/audio_source.c', line 146 static VALUE ray_audio_source_attenuation(VALUE self) { say_audio_source *source = ray_rb2audio_source(self); return rb_float_new(say_audio_source_get_attenuation(source)); } |
#attenuation=(attenuation) ⇒ Object
161 162 163 164 165 166 |
# File 'ext/audio_source.c', line 161 static VALUE ray_audio_source_set_attenuation(VALUE self, VALUE att) { rb_check_frozen(self); say_audio_source_set_attenuation(ray_rb2audio_source(self), NUM2DBL(att)); return att; } |
#min_distance ⇒ Object
120 121 122 123 124 |
# File 'ext/audio_source.c', line 120 static VALUE ray_audio_source_min_distance(VALUE self) { say_audio_source *source = ray_rb2audio_source(self); return rb_float_new(say_audio_source_get_min_distance(source)); } |
#min_distance=(dist) ⇒ Object
135 136 137 138 139 140 141 142 143 |
# File 'ext/audio_source.c', line 135 static VALUE ray_audio_source_set_min_distance(VALUE self, VALUE dist) { rb_check_frozen(self); say_audio_source *source = ray_rb2audio_source(self); say_audio_source_set_min_distance(source, NUM2DBL(dist)); return dist; } |
#pitch ⇒ Object
45 46 47 48 49 |
# File 'ext/audio_source.c', line 45 static VALUE ray_audio_source_pitch(VALUE self) { say_audio_source *source = ray_rb2audio_source(self); return rb_float_new(say_audio_source_get_pitch(source)); } |
#pitch=(pitch) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'ext/audio_source.c', line 60 static VALUE ray_audio_source_set_pitch(VALUE self, VALUE pitch) { rb_check_frozen(self); say_audio_source *source = ray_rb2audio_source(self); say_audio_source_set_pitch(source, NUM2DBL(pitch)); return pitch; } |
#pos ⇒ Object
71 72 73 74 75 |
# File 'ext/audio_source.c', line 71 static VALUE ray_audio_source_pos(VALUE self) { say_audio_source *source = ray_rb2audio_source(self); return ray_vector3_to_rb(say_audio_source_get_pos(source)); } |
#pos=(pos) ⇒ Object
82 83 84 85 86 87 88 89 90 |
# File 'ext/audio_source.c', line 82 static VALUE ray_audio_source_set_pos(VALUE self, VALUE pos) { rb_check_frozen(self); say_audio_source *source = ray_rb2audio_source(self); say_audio_source_set_pos(source, ray_convert_to_vector3(pos)); return pos; } |
#pretty_print(q, other_attr = []) ⇒ Object
5 6 7 8 9 |
# File 'lib/ray/audio_source.rb', line 5 def pretty_print(q, other_attr = []) attr = ["pos", "relative?", "min_distance", "attenuation", "pitch", "status", "volume"] pretty_print_attributes q, attr + other_attr end |
#relative=(rel) ⇒ Object
109 110 111 112 113 114 115 116 117 |
# File 'ext/audio_source.c', line 109 static VALUE ray_audio_source_set_relative(VALUE self, VALUE val) { rb_check_frozen(self); say_audio_source *source = ray_rb2audio_source(self); say_audio_source_set_relative(source, RTEST(val)); return val; } |
#relative? ⇒ Boolean
95 96 97 98 99 |
# File 'ext/audio_source.c', line 95 static VALUE ray_audio_source_is_relative(VALUE self) { say_audio_source *source = ray_rb2audio_source(self); return say_audio_source_get_relative(source) ? Qtrue : Qfalse; } |
#status ⇒ Symbol
Playing status
The status can be :playing, :paused, or :stopped.
175 176 177 178 179 180 181 182 183 184 |
# File 'ext/audio_source.c', line 175 static VALUE ray_audio_source_status(VALUE self) { switch (say_audio_source_get_status(ray_rb2audio_source(self))) { case SAY_STATUS_PAUSED: return RAY_SYM("paused"); case SAY_STATUS_PLAYING: return RAY_SYM("playing"); case SAY_STATUS_STOPPED: return RAY_SYM("stopped"); } return Qnil; /* should never happen */ } |
#volume ⇒ Object
19 20 21 22 23 |
# File 'ext/audio_source.c', line 19 static VALUE ray_audio_source_volume(VALUE self) { say_audio_source *source = ray_rb2audio_source(self); return rb_float_new(say_audio_source_get_volume(source)); } |
#volume=(vol) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'ext/audio_source.c', line 34 static VALUE ray_audio_source_set_volume(VALUE self, VALUE value) { rb_check_frozen(self); say_audio_source *source = ray_rb2audio_source(self); say_audio_source_set_volume(source, NUM2DBL(value)); return value; } |